1!function(){try{var t="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},i=(new t.Error).stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="8369ed52-34ab-4903-9a04-a54f192b07df",t._sentryDebugIdIdentifier="sentry-dbid-8369ed52-34ab-4903-9a04-a54f192b07df")}catch(t){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3944],{40882:function(t){t.exports=function(){"use strict";var t={},i={};function r(r,a,n){if(i[r]=n,"index"===r){var s="var sharedModule = {}; ("+i.shared+")(sharedModule); ("+i.worker+")(sharedModule);",o={};return i.shared(o),i.index(t,o),"u">typeof window&&t.setWorkerUrl(window.URL.createObjectURL(new Blob([s],{type:"text/javascript"}))),t}}return r("shared",["exports"],function(t){let i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v;function b(t,i,r,a){return new(r||(r=Promise))(function(n,s){function o(t){try{h(a.next(t))}catch(t){s(t)}}function l(t){try{h(a.throw(t))}catch(t){s(t)}}function h(t){var i;t.done?n(t.value):((i=t.value)instanceof r?i:new r(function(t){t(i)})).then(o,l)}h((a=a.apply(t,i||[])).next())})}function w(t,i){this.x=t,this.y=i}function T(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}"function"==typeof SuppressedError&&SuppressedError,w.prototype={clone(){return new w(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,i){return this.clone()._rotateAround(t,i)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){let i=t.x-this.x,r=t.y-this.y;return i*i+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,i){return Math.atan2(this.x*i-this.y*t,this.x*t+this.y*i)},_matMult(t){let i=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=i,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let i=Math.cos(t),r=Math.sin(t),a=r*this.x+i*this.y;return this.x=i*this.x-r*this.y,this.y=a,this},_rotateAround(t,i){let r=Math.cos(t),a=Math.sin(t),n=i.y+a*(this.x-i.x)+r*(this.y-i.y);return this.x=i.x+r*(this.x-i.x)-a*(this.y-i.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:w},w.convert=function(t){if(t instanceof w)return t;if(Array.isArray(t))return new w(+t[0],+t[1]);if(void 0!==t.x&&void 0!==t.y)return new w(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};var S,P,M,I,E,C,A,D,z,k,R,L,F,B,O,V,j,N,U,G,q,Z,$,W=T(function(){if(ig)return i_;function t(t,i,r,a){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=r,this.p2y=a}return ig=1,i_=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,i){if(void 0===i&&(i=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,a=0;a<8;a++){var n=this.sampleCurveX(r)-t;if(Math.abs(n)<i)return r;var s=this.sampleCurveDerivativeX(r);if(1e-6>Math.abs(s))break;r-=n/s}var o=0,l=1;for(r=t,a=0;a<20&&!(Math.abs((n=this.sampleCurveX(r))-t)<i);a++)t>
1n?o=r:l=r,r=.5*(l-o)+o;return r},solve:function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}},i_}());function H(){return null==i&&(i="u">typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),i}function X(){if(null==r&&(r=!1,H())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let i=0;i<25;i++){let r=4*i;t.fillStyle=`rgb(${r},${r+1},${r+2})`,t.fillRect(i%5,Math.floor(i/5),1,1)}let i=t.getImageData(0,0,5,5).data;for(let t=0;t<100;t++)if(t%4!=3&&i[t]!==t){r=!0;break}}}return r||!1}var Y="u">typeof Float32Array?Float32Array:Array;function K(){var t=new Y(9);return Y!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function J(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Q(){var t=new Y(3);return Y!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ee(t){var i=t[0],r=t[1],a=t[2];return Math.sqrt(i*i+r*r+a*a)}function et(t,i,r){var a=new Y(3);return a[0]=t,a[1]=i,a[2]=r,a}function ei(t,i,r){return t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function er(t,i,r){return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t}function ea(t,i,r){var a=i[0],n=i[1],s=i[2],o=r[0],l=r[1],h=r[2];return t[0]=n*h-s*l,t[1]=s*o-a*h,t[2]=a*l-n*o,t}function en(t,i,r){var a=i[0],n=i[1],s=i[2],o=i[3];return t[0]=r[0]*a+r[4]*n+r[8]*s+r[12]*o,t[1]=r[1]*a+r[5]*n+r[9]*s+r[13]*o,t[2]=r[2]*a+r[6]*n+r[10]*s+r[14]*o,t[3]=r[3]*a+r[7]*n+r[11]*s+r[15]*o,t}function es(){var t=new Y(4);return Y!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function eo(t,i,r,a){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",s=Math.PI/360;i*=s,a*=s,r*=s;var o=Math.sin(i),l=Math.cos(i),h=Math.sin(r),u=Math.cos(r),c=Math.sin(a),d=Math.cos(a);switch(n){case"xyz":t[0]=o*u*d+l*h*c,t[1]=l*h*d-o*u*c,t[2]=l*u*c+o*h*d,t[3]=l*u*d-o*h*c;break;case"xzy":t[0]=o*u*d-l*h*c,t[1]=l*h*d-o*u*c,t[2]=l*u*c+o*h*d,t[3]=l*u*d+o*h*c;break;case"yxz":t[0]=o*u*d+l*h*c,t[1]=l*h*d-o*u*c,t[2]=l*u*c-o*h*d,t[3]=l*u*d+o*h*c;break;case"yzx":t[0]=o*u*d+l*h*c,t[1]=l*h*d+o*u*c,t[2]=l*u*c-o*h*d,t[3]=l*u*d-o*h*c;break;case"zxy":t[0]=o*u*d-l*h*c,t[1]=l*h*d+o*u*c,t[2]=l*u*c+o*h*d,t[3]=l*u*d-o*h*c;break;case"zyx":t[0]=o*u*d-l*h*c,t[1]=l*h*d+o*u*c,t[2]=l*u*c-o*h*d,t[3]=l*u*d+o*h*c;break;default:throw Error("Unknown angle order "+n)}return t}function el(){var t=new Y(2);return Y!=Float32Array&&(t[0]=0,t[1]=0),t}function eh(t,i){var r=new Y(2);return r[0]=t,r[1]=i,r}function eu(t,i,r){return i*(8192/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}function ec(t,i){return(t%i+i)%i}function ed(t,i,r){return t*(1-r)+i*r}function ep(t){if(t<=0)return 0;if(t>=1)return 1;let i=t*t,r=i*t;return 4*(t<.5?r:3*(t-i)+r-.75)}function ef(t,i,r,a){let n=new W(t,i,r,a);return t=>n.solve(t)}Q(),iy=new Y(4),Y!=Float32Array&&(iy[0]=0,iy[1]=0,iy[2]=0,iy[3]=0),Q(),et(1,0,0),et(0,1,0),es(),es(),K(),el();let em=ef(.25,.1,.25,1);function e_(t,i,r){return Math.min(r,Math.max(i,t))}function eg(t,i,r){let a=r-i,n=((t-i)%a+a)%a+i;return n===i?r:n}function ey(t,...i){for(let r of i)for(let i in r)t[i]=r[i];return t}let ex=1;function ev(t,i,r){let a={};for(let r in t)a[r]=i.call(this,t[r],r,t);return a}function eb(t,i,r){let a={};for(let r in t)i.call(this,t[r],r,t)&&(a[r]=t[r]);return a}function ew(t){return Array.isArray(t)?t.map(ew):"object"==typeof t&&t?ev(t,ew):t}let eT={};function eS(t){eT[t]||("u">typeof console&&console.warn(t),eT[t]=!0)}function eP(t,i,r){return(r.y-t.y)*(i.x-t.x)>(i.y-t.y)*(r.x-t.x)}function eM(t){return"u">typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}let eI=null;function eE(t){return"u">typeof ImageBitmap&&t instanceof ImageBitmap}let eC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function eA(t,i,r,a,n){return b(this,void 0,void 0,function*(){if("u"<typeof VideoFrame)throw Error("VideoFrame not supported");let s=new VideoFrame(t,{timestamp:0});try{let o,l,h,u,c=null==s?void 0:s.format;if(!c||!c.startsWith("BGR")&&!c.startsWith("RGB"))throw Error(`Unrecognized format ${c}`);let d=c.startsWith("BGR"),p=new Uint8ClampedArray(a*n*4);if(yield s.copyTo(p,(o=4*Math.max(-i,0),l=(Math.max(0,r)-r)*a*4+o,h=Math.max(0,i),u=Math.max(0,r),{rect:{x:h,y:u,width:Math.min(t.width,i+a)-h,height:Math.min(t.height,r+n)-u},layout:[{offset:l,stride:4*a}]})),d)for(let t=0;t<p.length;t+=4){let i=p[t];p[t]=p[t+2],p[t+2]=i}return p}finally{s.close()}})}function eD(t,i,r,a){return t.addEventListener(i,r,a),{unsubscribe:()=>{t.removeEventListener(i,r,a)}}}function ez(t){return t*Math.PI/180}function ek(t){return t/Math.PI*180}let eR={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0}
1,eL={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},eF="AbortError";class eB extends Error{constructor(t=eF){super(t instanceof Error?t.message:t),this.name=eF,t instanceof Error&&t.stack&&(this.stack=t.stack)}}function eO(t){return t.name===eF}let eV={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ej(t){return eV.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}let eN="global-dispatcher";class eU extends Error{constructor(t,i,r,a){super(`AJAXError: ${i} (${t}): ${r}`),this.status=t,this.statusText=i,this.url=r,this.body=a}}let eG=()=>eM(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,eq=function(t,i){var r;if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){let r=ej(t.url);if(r)return r(t,i);if(eM(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:eN},i)}if(!(/^file:/.test(r=t.url)||/^file:/.test(eG())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(t,i){return b(this,void 0,void 0,function*(){let r,a,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:eG(),signal:i.signal});"json"!==t.type||n.headers.has("Accept")||n.headers.set("Accept","application/json");try{r=yield fetch(n)}catch(i){if(eO(i))throw i;throw new eU(0,i.message,t.url,new Blob)}if(!r.ok){let i=yield r.blob();throw new eU(r.status,r.statusText,t.url,i)}a="arrayBuffer"===t.type||"image"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text();let s=yield a;return i.signal.throwIfAborted(),{data:s,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}})}(t,i);if(eM(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:eN},i)}return new Promise((r,a)=>{var n;let s=new XMLHttpRequest;for(let i in s.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(s.responseType="arraybuffer"),t.headers)s.setRequestHeader(i,t.headers[i]);"json"===t.type&&(s.responseType="text",(null==(n=t.headers)?void 0:n.Accept)||s.setRequestHeader("Accept","application/json")),s.withCredentials="include"===t.credentials,s.onerror=()=>{a(Error(s.statusText))},s.onload=()=>{if(!i.signal.aborted)if((s.status>=200&&s.status<300||0===s.status)&&null!==s.response){let i=s.response;if("json"===t.type)try{i=JSON.parse(s.response)}catch(t){return void a(t)}r({data:i,cacheControl:s.getResponseHeader("Cache-Control"),expires:s.getResponseHeader("Expires")})}else{let i=new Blob([s.response],{type:s.getResponseHeader("Content-Type")});a(new eU(s.status,s.statusText,t.url,i))}},i.signal.addEventListener("abort",()=>{s.abort(),a(new eB(i.signal.reason))}),s.send(t.body)})};function eZ(t){if(!t||0>=t.indexOf("://")||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;let i=new URL(t),r=window.location;return i.protocol===r.protocol&&i.host===r.host}function e$(t,i,r){r[t]&&-1!==r[t].indexOf(i)||(r[t]=r[t]||[],r[t].push(i))}function eW(t,i,r){if(r&&r[t]){let a=r[t].indexOf(i);-1!==a&&r[t].splice(a,1)}}class eH{constructor(t,i={}){ey(this,i),this.type=t}}class eX extends eH{constructor(t,i={}){super("error",ey({error:t},i))}}class eY{on(t,i){return this._listeners=this._listeners||{},e$(t,i,this._listeners),{unsubscribe:()=>{this.off(t,i)}}}off(t,i){return eW(t,i,this._listeners),eW(t,i,this._oneTimeListeners),this}once(t,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},e$(t,i,this._oneTimeListeners),this):new Promise(i=>this.once(t,i))}fire(t,i){"string"==typeof t&&(t=new eH(t,i||{}));let r=t.type;if(this.listens(r)){for(let i of(t.target=this,this._listeners&&this._listeners[r]?this._listeners[r].slice():[]))i.call(this,t);for(let i of this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[])eW(r,i,this._oneTimeListeners),i.call(this,t);let i=this._eventedParent;i&&(ey(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t))}else t instanceof eX&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,i){return this._eventedParent=t,this._eventedParentData=i,this}}var eK={$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: 28,867 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"]},"property-type":"data-constant"},"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"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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"},"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"}
1,"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"},"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"}},"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"}},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"}]}}}}};let eJ=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function eQ(t,i){if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let r=0;r<t.length;r++)if(!eQ(t[r],i[r]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==i){if("object"!=typeof i||Object.keys(t).length!==Object.keys(i).length)return!1;for(let r in t)if(!eQ(t[r],i[r]))return!1;return!0}return t===i}function e0(t,i){t.push(i)}function e1(t,i,r){e0(r,{command:"addSource",args:[t,i[t]]})}function e2(t,i,r){e0(i,{command:"removeSource",args:[t]}),r[t]=!0}function e3(t,i,r,a,n,s){for(let o in i=i||{},t=t||{})Object.prototype.hasOwnProperty.call(t,o)&&(eQ(t[o],i[o])||r.push({command:s,args:[a,o,i[o],n]}));for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&!Object.prototype.hasOwnProperty.call(t,o)&&(eQ(t[o],i[o])||r.push({command:s,args:[a,o,i[o],n]}))}function e5(t){return t.id}function e4(t,i){return t[i.id]=i,t}class e6{constructor(t,i,r,a){this.message=(t?`${t}: `:"")+r,a&&(this.identifier=a),null!=i&&i.__line__&&(this.line=i.__line__)}}function e8(t,...i){for(let r of i)for(let i in r)t[i]=r[i];return t}
1class e9 extends Error{constructor(t,i){super(i),this.message=i,this.key=t}}class e7{constructor(t,i=[]){for(const[r,a]of(this.parent=t,this.bindings={},i))this.bindings[r]=a}concat(t){return new e7(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}let te={kind:"null"},tt={kind:"number"},ti={kind:"string"},tr={kind:"boolean"},ta={kind:"color"},tn={kind:"projectionDefinition"},ts={kind:"object"},to={kind:"value"},tl={kind:"collator"},th={kind:"formatted"},tu={kind:"padding"},tc={kind:"colorArray"},td={kind:"numberArray"},tp={kind:"resolvedImage"},tf={kind:"variableAnchorOffsetCollection"};function tm(t,i){return{kind:"array",itemType:t,N:i}}function t_(t){if("array"===t.kind){let i=t_(t.itemType);return"number"==typeof t.N?`array<${i}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${i}>`}return t.kind}let tg=[te,tt,ti,tr,ta,tn,th,ts,tm(to),tu,td,tc,tp,tf];function ty(t,i){if("error"===i.kind)return null;if("array"===t.kind){if("array"===i.kind&&(0===i.N&&"value"===i.itemType.kind||!ty(t.itemType,i.itemType))&&("number"!=typeof t.N||t.N===i.N))return null}else{if(t.kind===i.kind)return null;if("value"===t.kind){for(let t of tg)if(!ty(t,i))return null}}return`Expected ${t_(t)} but found ${t_(i)} instead.`}function tx(t,i){return i.some(i=>i.kind===t.kind)}function tv(t,i){return i.some(i=>"null"===i?null===t:"array"===i?Array.isArray(t):"object"===i?t&&!Array.isArray(t)&&"object"==typeof t:i===typeof t)}function tb(t,i){return"array"===t.kind&&"array"===i.kind?t.itemType.kind===i.itemType.kind&&"number"==typeof t.N:t.kind===i.kind}let tw=4/29,tT=6/29,tS=6/29*3*(6/29),tP=6/29*(6/29)*(6/29),tM=Math.PI/180,tI=180/Math.PI;function tE(t){return(t%=360)<0&&(t+=360),t}function tC([t,i,r,a]){let n,s,o=tD((.2225045*(t=tA(t))+.7168786*(i=tA(i))+.0606169*(r=tA(r)))/1);t===i&&i===r?n=s=o:(n=tD((.4360747*t+.3850649*i+.1430804*r)/.96422),s=tD((.0139322*t+.0971045*i+.7141733*r)/.82521));let l=116*o-16;return[l<0?0:l,500*(n-o),200*(o-s),a]}function tA(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function tD(t){return t>tP?Math.pow(t,1/3):t/tS+tw}function tz([t,i,r,a]){let n=(t+16)/116,s=isNaN(i)?n:n+i/500,o=isNaN(r)?n:n-r/200;return n=+tR(n),[tk(3.1338561*(s=.96422*tR(s))-1.6168667*n-.4906146*(o=.82521*tR(o))),tk(-.9787684*s+1.9161415*n+.033454*o),tk(.0719453*s-.2289914*n+1.4052427*o),a]}
1function tk(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function tR(t){return t>tT?t*t*t:tS*(t-tw)}let tL=Object.hasOwn||function(t,i){return Object.prototype.hasOwnProperty.call(t,i)};function tF(t,i){return tL(t,i)?t[i]:void 0}function tB(t){return parseInt(t.padEnd(2,t),16)/255}function tO(t,i){return tV(i?t/100:t,0,1)}function tV(t,i,r){return Math.min(Math.max(i,t),r)}function tj(t){return!t.some(Number.isNaN)}let tN={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 tU(t,i,r){return t.map((t,a)=>t+r*(i[a]-t))}class tG{constructor(t,i,r,a=1,n=!0){this.r=t,this.g=i,this.b=r,this.a=a,n||(this.r*=a,this.g*=a,this.b*=a,a||this.overwriteGetter("rgb",[t,i,r,a]))}static parse(t){if(t instanceof tG)return t;if("string"!=typeof t)return;let i=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];let i=tF(tN,t);
1if(i){let[t,r,a]=i;return[t/255,r/255,a/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let i=t.length<6?1:2,r=1;return[tB(t.slice(r,r+=i)),tB(t.slice(r,r+=i)),tB(t.slice(r,r+=i)),tB(t.slice(r,r+i)||"ff")]}if(t.startsWith("rgb")){let i=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){let[t,r,a,n,s,o,l,h,u,c,d,p]=i,f=[n||" ",l||" ",c].join("");if(" "===f||" /"===f||",,"===f||",,,"===f){let t=[a,o,u].join(""),i="%%%"===t?100:255*(""===t);if(i){let t=[tV(r/i,0,1),tV(s/i,0,1),tV(h/i,0,1),d?tO(+d,p):1];if(tj(t))return t}}return}}let r=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){let[t,i,a,n,s,o,l,h,u]=r,c=[a||" ",s||" ",l].join("");if(" "===c||" /"===c||",,"===c||",,,"===c){let t=[+i,tV(+n,0,100),tV(+o,0,100),h?tO(+h,u):1];if(tj(t))return function([t,i,r,a]){function n(a){let n=(a+t/30)%12,s=i*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(n-3,9-n,1))}return t=tE(t),i/=100,r/=100,[n(0),n(8),n(4),a]}(t)}}}(t);return i?new tG(...i,!1):void 0}get rgb(){let{r:t,g:i,b:r,a:a}=this,n=a||1/0;return this.overwriteGetter("rgb",[t/n,i/n,r/n,a])}get hcl(){return this.overwriteGetter("hcl",function(t){let[i,r,a,n]=tC(t),s=Math.sqrt(r*r+a*a);return[Math.round(1e4*s)?tE(Math.atan2(a,r)*tI):NaN,s,i,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",tC(this.rgb))}overwriteGetter(t,i){return Object.defineProperty(this,t,{value:i}),i}toString(){let[t,i,r,a]=this.rgb;return`rgba(${[t,i,r].map(t=>Math.round(255*t)).join(",")},${a})`}static interpolate(t,i,r,a="rgb"){switch(a){case"rgb":{let[a,n,s,o]=tU(t.rgb,i.rgb,r);return new tG(a,n,s,o,!1)}case"hcl":{let a,n,[s,o,l,h]=t.hcl,[u,c,d,p]=i.hcl;if(isNaN(s)||isNaN(u))isNaN(s)?isNaN(u)?a=NaN:(a=u,1!==l&&0!==l||(n=c)):(a=s,1!==d&&0!==d||(n=o));else{let t=u-s;u>s&&t>180?t-=360:u<s&&s-u>180&&(t+=360),a=s+r*t}let[f,m,_,g]=function([t,i,r,a]){return tz([r,Math.cos(t=isNaN(t)?0:t*tM)*i,Math.sin(t)*i,a])}([a,null!=n?n:o+r*(c-o),l+r*(d-l),h+r*(p-h)]);return new tG(f,m,_,g,!1)}case"lab":{let[a,n,s,o]=tz(tU(t.lab,i.lab,r));return new tG(a,n,s,o,!1)}}}}tG.black=new tG(0,0,0,1),tG.white=new tG(1,1,1,1),tG.transparent=new tG(0,0,0,0),tG.red=new tG(1,0,0,1);class tq{constructor(t,i,r){this.sensitivity=t?i?"variant":"case":i?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,i){return this.collator.compare(t,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}let tZ=["bottom","center","top"];class t${constructor(t,i,r,a,n,s){this.text=t,this.image=i,this.scale=r,this.fontStack=a,this.textColor=n,this.verticalAlign=s}}class tW{constructor(t){this.sections=t}static fromString(t){return new tW([new t$(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof tW?t:tW.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}}class tH{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof tH)return t;if("number"==typeof t)return new tH([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let i of t)if("number"!=typeof i)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new tH(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new tH(tU(t.values,i.values,r))}}class tX{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof tX)return t;if("number"==typeof t)return new tX([t]);if(Array.isArray(t)){for(let i of t)if("number"!=typeof i)return;return new tX(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new tX(tU(t.values,i.values,r))}}class tY{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof tY)return t;if("string"==typeof t){let i=tG.parse(t);if(!i)return;return new tY([i])}if(!Array.isArray(t))return;let i=[];for(let r of t){if("string"!=typeof r)return;let t=tG.parse(r);if(!t)return;i.push(t)}return new tY(i)}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r,a="rgb"){let n=[];if(t.values.length!=i.values.length)throw Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let s=0;s<t.values.length;s++)n.push(tG.interpolate(t.values[s],i.values[s],r,a));return new tY(n)}}
1class tK extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}let tJ=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class tQ{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof tQ)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let i=0;i<t.length;i+=2){let r=t[i],a=t[i+1];if("string"!=typeof r||!tJ.has(r)||!Array.isArray(a)||2!==a.length||"number"!=typeof a[0]||"number"!=typeof a[1])return}return new tQ(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){let a=t.values,n=i.values;if(a.length!==n.length)throw new tK(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${i.toString()}`);let s=[];for(let t=0;t<a.length;t+=2){if(a[t]!==n[t])throw new tK(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${a[t]}, to[${t}]: ${n[t]}`);s.push(a[t]);let[i,o]=a[t+1],[l,h]=n[t+1];s.push([i+r*(l-i),o+r*(h-o)])}return new tQ(s)}}class t0{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new t0({name:t,available:!1}):null}}class t1{constructor(t,i,r){this.from=t,this.to=i,this.transition=r}static interpolate(t,i,r){return new t1(t,i,r)}static parse(t){return t instanceof t1?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new t1(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new t1(t.from,t.to,t.transition):"string"==typeof t?new t1(t,t,1):void 0}}function t2(t,i,r,a){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===a||"number"==typeof a&&a>=0&&a<=1?null:`Invalid rgba value [${[t,i,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof a?[t,i,r,a]:[t,i,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function t3(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof t1||t instanceof tG||t instanceof tq||t instanceof tW||t instanceof tH||t instanceof tX||t instanceof tY||t instanceof tQ||t instanceof t0)return!0;if(Array.isArray(t)){for(let i of t)if(!t3(i))return!1;return!0}if("object"==typeof t){for(let i in t)if(!t3(t[i]))return!1;return!0}return!1}function t5(t){if(null===t)return te;if("string"==typeof t)return ti;if("boolean"==typeof t)return tr;if("number"==typeof t)return tt;if(t instanceof tG)return ta;if(t instanceof t1)return tn;if(t instanceof tq)return tl;if(t instanceof tW)return th;if(t instanceof tH)return tu;if(t instanceof tX)return td;if(t instanceof tY)return tc;if(t instanceof tQ)return tf;if(t instanceof t0)return tp;if(Array.isArray(t)){let i,r=t.length;for(let r of t){let t=t5(r);if(i){if(i===t)continue;i=to;break}i=t}return tm(i||to,r)}return ts}function t4(t){let i=typeof t;return null===t?"":"string"===i||"number"===i||"boolean"===i?String(t):t instanceof tG||t instanceof t1||t instanceof tW||t instanceof tH||t instanceof tX||t instanceof tY||t instanceof tQ||t instanceof t0?t.toString():JSON.stringify(t)}class t6{constructor(t,i){this.type=t,this.value=i}static parse(t,i){if(2!==t.length)return i.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!t3(t[1]))return i.error("invalid value");let r=t[1],a=t5(r),n=i.expectedType;return"array"===a.kind&&0===a.N&&n&&"array"===n.kind&&("number"!=typeof n.N||0===n.N)&&(a=n),new t6(a,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let t8={string:ti,number:tt,boolean:tr,object:ts};class t9{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r,a=1,n=t[0];if("array"===n){let n,s;if(t.length>2){let r=t[1];if("string"!=typeof r||!(r in t8)||"object"===r)return i.error('The item type argument of "array" must be one of string, number, boolean',1);n=t8[r],a++}else n=to;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return i.error('The length argument to "array" must be a positive integer literal',2);s=t[2],a++}r=tm(n,s)}else{if(!t8[n])throw Error(`Types doesn't contain name = ${n}`);r=t8[n]}let s=[];for(;a<t.length;a++){let r=i.parse(t[a],a,to);if(!r)return null;s.push(r)}
1return new t9(r,s)}evaluate(t){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(t);if(!ty(this.type,t5(r)))return r;if(i===this.args.length-1)throw new tK(`Expected value to be of type ${t_(this.type)}, but found ${t_(t5(r))} instead.`)}throw Error()}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}let t7={"to-boolean":tr,"to-color":ta,"to-number":tt,"to-string":ti};class ie{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[0];if(!t7[r])throw Error(`Can't parse ${r} as it is not part of the known types`);if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return i.error("Expected one argument.");let a=t7[r],n=[];for(let r=1;r<t.length;r++){let a=i.parse(t[r],r,to);if(!a)return null;n.push(a)}return new ie(a,n)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let i,r;for(let a of this.args){if(i=a.evaluate(t),r=null,i instanceof tG)return i;if("string"==typeof i){let r=t.parseColor(i);if(r)return r}else if(Array.isArray(i)&&!(r=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:t2(i[0],i[1],i[2],i[3])))return new tG(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new tK(r||`Could not parse color from value '${"string"==typeof i?i:JSON.stringify(i)}'`)}case"padding":{let i;for(let r of this.args){i=r.evaluate(t);let a=tH.parse(i);if(a)return a}throw new tK(`Could not parse padding from value '${"string"==typeof i?i:JSON.stringify(i)}'`)}case"numberArray":{let i;for(let r of this.args){i=r.evaluate(t);let a=tX.parse(i);if(a)return a}throw new tK(`Could not parse numberArray from value '${"string"==typeof i?i:JSON.stringify(i)}'`)}case"colorArray":{let i;for(let r of this.args){i=r.evaluate(t);let a=tY.parse(i);if(a)return a}throw new tK(`Could not parse colorArray from value '${"string"==typeof i?i:JSON.stringify(i)}'`)}case"variableAnchorOffsetCollection":{let i;for(let r of this.args){i=r.evaluate(t);let a=tQ.parse(i);if(a)return a}throw new tK(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof i?i:JSON.stringify(i)}'`)}case"number":{let i=null;for(let r of this.args){if(null===(i=r.evaluate(t)))return 0;let a=Number(i);if(!isNaN(a))return a}throw new tK(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return tW.fromString(t4(this.args[0].evaluate(t)));case"resolvedImage":return t0.fromString(t4(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return t4(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}let it=["Unknown","Point","LineString","Polygon"];class ii{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?"number"==typeof this.feature.type?it[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let i=this._parseColorCache.get(t);return i||(i=tG.parse(t),this._parseColorCache.set(t,i)),i}}class ir{constructor(t,i,r=[],a,n=new e7,s=[]){this.registry=t,this.path=r,this.key=r.map(t=>`[${t}]`).join(""),this.scope=n,this.errors=s,this.expectedType=a,this._isConstant=i}parse(t,i,r,a,n={}){return i?this.concat(i,r,a)._parse(t,n):this._parse(t,n)}_parse(t,i){function r(t,i,r){return"assert"===r?new t9(i,[t]):"coerce"===r?new ie(i,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let a=t[0];if("string"!=typeof a)return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let n=this.registry[a];if(n){let a=n.parse(t,this);if(!a)return null;if(this.expectedType){let t=this.expectedType,n=a.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind){if("projectionDefinition"===t.kind&&["string","array"].includes(n.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(n.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(n.kind)||"colorArray"===t.kind&&["value","string","array"].includes(n.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(n.kind))a=r(a,t,i.typeAnnotation||"coerce");else if(this.checkSubtype(t,n))return null}
1else a=r(a,t,i.typeAnnotation||"assert")}if(!(a instanceof t6)&&"resolvedImage"!==a.type.kind&&this._isConstant(a)){let t=new ii;try{a=new t6(a.type,a.evaluate(t))}catch(t){return this.error(t.message),null}}return a}return this.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,i,r){let a="number"==typeof t?this.path.concat(t):this.path,n=r?this.scope.concat(r):this.scope;return new ir(this.registry,this._isConstant,a,i||null,n,this.errors)}error(t,...i){let r=`${this.key}${i.map(t=>`[${t}]`).join("")}`;this.errors.push(new e9(r,t))}checkSubtype(t,i){let r=ty(t,i);return r&&this.error(r),r}}class ia{constructor(t,i){this.type=i.type,this.bindings=[].concat(t),this.result=i}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let i of this.bindings)t(i[1]);t(this.result)}static parse(t,i){if(t.length<4)return i.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let r=[];for(let a=1;a<t.length-1;a+=2){let n=t[a];if("string"!=typeof n)return i.error(`Expected string, but found ${typeof n} instead.`,a);if(/[^a-zA-Z0-9_]/.test(n))return i.error("Variable names must contain only alphanumeric characters or '_'.",a);let s=i.parse(t[a+1],a+1);if(!s)return null;r.push([n,s])}let a=i.parse(t[t.length-1],t.length-1,i.expectedType,r);return a?new ia(r,a):null}outputDefined(){return this.result.outputDefined()}}class is{constructor(t,i){this.type=i.type,this.name=t,this.boundExpression=i}static parse(t,i){if(2!==t.length||"string"!=typeof t[1])return i.error("'var' expression requires exactly one string literal argument.");let r=t[1];return i.scope.has(r)?new is(r,i.scope.get(r)):i.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class io{constructor(t,i,r){this.type=t,this.index=i,this.input=r}static parse(t,i){if(3!==t.length)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,tt),a=i.parse(t[2],2,tm(i.expectedType||to));return r&&a?new io(a.type.itemType,r,a):null}evaluate(t){let i=this.index.evaluate(t),r=this.input.evaluate(t);if(i<0)throw new tK(`Array index out of bounds: ${i} < 0.`);if(i>=r.length)throw new tK(`Array index out of bounds: ${i} > ${r.length-1}.`);if(i!==Math.floor(i))throw new tK(`Array index must be an integer, but found ${i} instead.`);return r[i]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class il{constructor(t,i){this.type=tr,this.needle=t,this.haystack=i}static parse(t,i){if(3!==t.length)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,to),a=i.parse(t[2],2,to);return r&&a?tx(r.type,[tr,ti,tt,te,to])?new il(r,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${t_(r.type)} instead`):null}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!tv(i,["boolean","string","number","null"]))throw new tK(`Expected first argument to be of type boolean, string, number or null, but found ${t_(t5(i))} instead.`);if(!tv(r,["string","array"]))throw new tK(`Expected second argument to be of type array or string, but found ${t_(t5(r))} instead.`);return r.indexOf(i)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class ih{constructor(t,i,r){this.type=tt,this.needle=t,this.haystack=i,this.fromIndex=r}static parse(t,i){if(t.length<=2||t.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,to),a=i.parse(t[2],2,to);if(!r||!a)return null;if(!tx(r.type,[tr,ti,tt,te,to]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${t_(r.type)} instead`);if(4===t.length){let n=i.parse(t[3],3,tt);return n?new ih(r,a,n):null}return new ih(r,a)}evaluate(t){let i,r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!tv(r,["boolean","string","number","null"]))throw new tK(`Expected first argument to be of type boolean, string, number or null, but found ${t_(t5(r))} instead.`);if(this.fromIndex&&(i=this.fromIndex.evaluate(t)),tv(a,["string"])){let t=a.indexOf(r,i);return -1===t?-1:[...a.slice(0,t)].length}if(tv(a,["array"]))return a.indexOf(r,i);throw new tK(`Expected second argument to be of type array or string, but found ${t_(t5(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class iu{constructor(t,i,r,a,n,s){this.inputType=t,this.type=i,this.input=r,this.cases=a,this.outputs=n,this.otherwise=s}static parse(t,i){let r,a;
1if(t.length<5)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return i.error("Expected an even number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(a=i.expectedType);let n={},s=[];for(let o=2;o<t.length-1;o+=2){let l=t[o],h=t[o+1];Array.isArray(l)||(l=[l]);let u=i.concat(o);if(0===l.length)return u.error("Expected at least one branch label.");for(let t of l){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,t5(t)))return null}else r=t5(t);if(void 0!==n[String(t)])return u.error("Branch labels must be unique.");n[String(t)]=s.length}let c=i.parse(h,o,a);if(!c)return null;a=a||c.type,s.push(c)}let o=i.parse(t[1],1,to);if(!o)return null;let l=i.parse(t[t.length-1],t.length-1,a);return l?"value"!==o.type.kind&&i.concat(1).checkSubtype(r,o.type)?null:new iu(r,a,o,n,s,l):null}evaluate(t){let i=this.input.evaluate(t);return(t5(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class ic{constructor(t,i,r){this.type=t,this.branches=i,this.otherwise=r}static parse(t,i){let r;if(t.length<4)return i.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return i.error("Expected an odd number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(r=i.expectedType);let a=[];for(let n=1;n<t.length-1;n+=2){let s=i.parse(t[n],n,tr);if(!s)return null;let o=i.parse(t[n+1],n+1,r);if(!o)return null;a.push([s,o]),r=r||o.type}let n=i.parse(t[t.length-1],t.length-1,r);if(!n)return null;if(!r)throw Error("Can't infer output type");return new ic(r,a,n)}evaluate(t){for(let[i,r]of this.branches)if(i.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[i,r]of this.branches)t(i),t(r);t(this.otherwise)}outputDefined(){return this.branches.every(([t,i])=>i.outputDefined())&&this.otherwise.outputDefined()}}class id{constructor(t,i,r,a){this.type=t,this.input=i,this.beginIndex=r,this.endIndex=a}static parse(t,i){if(t.length<=2||t.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,to),a=i.parse(t[2],2,tt);if(!r||!a)return null;if(!tx(r.type,[tm(to),ti,to]))return i.error(`Expected first argument to be of type array or string, but found ${t_(r.type)} instead`);if(4===t.length){let n=i.parse(t[3],3,tt);return n?new id(r.type,r,a,n):null}return new id(r.type,r,a)}evaluate(t){let i,r=this.input.evaluate(t),a=this.beginIndex.evaluate(t);if(this.endIndex&&(i=this.endIndex.evaluate(t)),tv(r,["string"]))return[...r].slice(a,i).join("");if(tv(r,["array"]))return r.slice(a,i);throw new tK(`Expected first argument to be of type array or string, but found ${t_(t5(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function ip(t,i){let r=t.length-1,a,n,s=0,o=r,l=0;for(;s<=o;)if(a=t[l=Math.floor((s+o)/2)],n=t[l+1],a<=i){if(l===r||i<n)return l;s=l+1}else{if(!(a>i))throw new tK("Input is not a number.");o=l-1}return 0}class im{constructor(t,i,r){for(const[a,n]of(this.type=t,this.input=i,this.labels=[],this.outputs=[],r))this.labels.push(a),this.outputs.push(n)}static parse(t,i){if(t.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");let r=i.parse(t[1],1,tt);if(!r)return null;let a=[],n=null;i.expectedType&&"value"!==i.expectedType.kind&&(n=i.expectedType);for(let r=1;r<t.length;r+=2){let s=1===r?-1/0:t[r],o=t[r+1],l=r,h=r+1;if("number"!=typeof s)return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',l);if(a.length&&a[a.length-1][0]>=s)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);let u=i.parse(o,h,n);if(!u)return null;n=n||u.type,a.push([s,u])}return new im(n,r,a)}evaluate(t){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(t);let a=this.input.evaluate(t);if(a<=i[0])return r[0].evaluate(t);let n=i.length;return a>=i[n-1]?r[n-1].evaluate(t):r[ip(i,a)].evaluate(t)}eachChild(t){for(let i of(t(this.input),this.outputs))t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}var i_,ig,iy,ix,iv,ib,iw=(ix=function(){if(ib)return iv;function t(t,i,r,a){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=r,this.p2y=a}return ib=1,iv=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,i){if(void 0===i&&(i=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,a=0;a<8;a++){var n=this.sampleCurveX(r)-t;if(Math.abs(n)<i)return r;var s=this.sampleCurveDerivativeX(r);if(1e-6>Math.abs(s))break;r-=n/s}var o=0,l=1;for(r=t,a=0;a<20&&!(Math.abs((n=this.sampleCurveX(r))-t)<i);a++)t>n?o=r:l=r,r=.5*(l-o)+o;return r},solve:function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}},iv}())&&ix.__esModule&&Object.prototype.hasOwnProperty.call(ix,"default")?ix.default:ix;class iT{constructor(t,i,r,a,n){for(const[s,o]of(this.type=t,this.operator=i,this.interpolation=r,this.input=a,this.labels=[],this.outputs=[],n))this.labels.push(s),this.outputs.push(o)}static interpolationFactor(t,i,r,a){let n=0;if("exponential"===t.name)n=iS(i,t.base,r,a);else if("linear"===t.name)n=iS(i,1,r,a);else if("cubic-bezier"===t.name){let s=t.controlPoints;n=new iw(s[0],s[1],s[2],s[3]).solve(iS(i,1,r,a))}return n}static parse(t,i){let[r,a,n,...s]=t;if(!Array.isArray(a)||0===a.length)return i.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};else if("exponential"===a[0]){let t=a[1];if("number"!=typeof t)return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:t}}else{if("cubic-bezier"!==a[0])return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{let t=a.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(!(n=i.parse(n,2,tt)))return null;let o=[],l=null;"interpolate-hcl"!==r&&"interpolate-lab"!==r||i.expectedType==tc?i.expectedType&&"value"!==i.expectedType.kind&&(l=i.expectedType):l=ta;for(let t=0;t<s.length;t+=2){let r=s[t],a=s[t+1],n=t+3,h=t+4;if("number"!=typeof r)return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(o.length&&o[o.length-1][0]>=r)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);let u=i.parse(a,h,l);if(!u)return null;l=l||u.type,o.push([r,u])}return tb(l,tt)||tb(l,tn)||tb(l,ta)||tb(l,tu)||tb(l,td)||tb(l,tc)||tb(l,tf)||tb(l,tm(tt))?new iT(l,r,a,n,o):i.error(`Type ${t_(l)} is not interpolatable.`)}evaluate(t){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(t);let a=this.input.evaluate(t);if(a<=i[0])return r[0].evaluate(t);let n=i.length;if(a>=i[n-1])return r[n-1].evaluate(t);let s=ip(i,a),o=iT.interpolationFactor(this.interpolation,a,i[s],i[s+1]),l=r[s].evaluate(t),h=r[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return l+o*(h-l);case"color":return tG.interpolate(l,h,o);case"padding":return tH.interpolate(l,h,o);case"colorArray":return tY.interpolate(l,h,o);case"numberArray":return tX.interpolate(l,h,o);case"variableAnchorOffsetCollection":return tQ.interpolate(l,h,o);case"array":return tU(l,h,o);case"projectionDefinition":return t1.interpolate(l,h,o)}case"interpolate-hcl":switch(this.type.kind){case"color":return tG.interpolate(l,h,o,"hcl");case"colorArray":return tY.interpolate(l,h,o,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return tG.interpolate(l,h,o,"lab");case"colorArray":return tY.interpolate(l,h,o,"lab")}}}eachChild(t){for(let i of(t(this.input),this.outputs))t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function iS(t,i,r,a){let n=a-r,s=t-r;return 0===n?0:1===i?s/n:(Math.pow(i,s)-1)/(Math.pow(i,n)-1)}let iP={color:tG.interpolate,number:function(t,i,r){return t+r*(i-t)},padding:tH.interpolate,numberArray:tX.interpolate,colorArray:tY.interpolate,variableAnchorOffsetCollection:tQ.interpolate,array:tU};class iM{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=null,a=i.expectedType;a&&"value"!==a.kind&&(r=a);let n=[];for(let a of t.slice(1)){let t=i.parse(a,1+n.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,n.push(t)}if(!r)throw Error("No output type");return new iM(a&&n.some(t=>ty(a,t.type))?to:r,n)}evaluate(t){let i,r=null,a=0;for(let n of this.args)if(a++,(r=n.evaluate(t))&&r instanceof t0&&!r.available&&(i||(i=r.name),r=null,a===this.args.length&&(r=i)),null!==r)break;return r}
1eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function iI(t,i){return"=="===t||"!="===t?"boolean"===i.kind||"string"===i.kind||"number"===i.kind||"null"===i.kind||"value"===i.kind:"string"===i.kind||"number"===i.kind||"value"===i.kind}function iE(t,i,r,a){return 0===a.compare(i,r)}function iC(t,i,r){let a="=="!==t&&"!="!==t;return class n{constructor(t,i,r){this.type=tr,this.lhs=t,this.rhs=i,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===i.type.kind}static parse(t,i){if(3!==t.length&&4!==t.length)return i.error("Expected two or three arguments.");let r=t[0],s=i.parse(t[1],1,to);if(!s)return null;if(!iI(r,s.type))return i.concat(1).error(`"${r}" comparisons are not supported for type '${t_(s.type)}'.`);let o=i.parse(t[2],2,to);if(!o)return null;if(!iI(r,o.type))return i.concat(2).error(`"${r}" comparisons are not supported for type '${t_(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return i.error(`Cannot compare types '${t_(s.type)}' and '${t_(o.type)}'.`);a&&("value"===s.type.kind&&"value"!==o.type.kind?s=new t9(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new t9(s.type,[o])));let l=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return i.error("Cannot use collator to compare non-string types.");if(!(l=i.parse(t[3],3,tl)))return null}return new n(s,o,l)}evaluate(n){let s=this.lhs.evaluate(n),o=this.rhs.evaluate(n);if(a&&this.hasUntypedArgument){let i=t5(s),r=t5(o);if(i.kind!==r.kind||"string"!==i.kind&&"number"!==i.kind)throw new tK(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${i.kind}, ${r.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){let t=t5(s),r=t5(o);if("string"!==t.kind||"string"!==r.kind)return i(n,s,o)}return this.collator?r(n,s,o,this.collator.evaluate(n)):i(n,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}let iA=iC("==",function(t,i,r){return i===r},iE),iD=iC("!=",function(t,i,r){return i!==r},function(t,i,r,a){return!iE(0,i,r,a)}),iz=iC("<",function(t,i,r){return i<r},function(t,i,r,a){return 0>a.compare(i,r)}),ik=iC(">",function(t,i,r){return i>r},function(t,i,r,a){return a.compare(i,r)>0}),iR=iC("<=",function(t,i,r){return i<=r},function(t,i,r,a){return 0>=a.compare(i,r)}),iL=iC(">=",function(t,i,r){return i>=r},function(t,i,r,a){return a.compare(i,r)>=0});class iF{constructor(t,i,r){this.type=tl,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=i}static parse(t,i){if(2!==t.length)return i.error("Expected one argument.");let r=t[1];if("object"!=typeof r||Array.isArray(r))return i.error("Collator options argument must be an object.");let a=i.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,tr);if(!a)return null;let n=i.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,tr);if(!n)return null;let s=null;return!r.locale||(s=i.parse(r.locale,1,ti))?new iF(a,n,s):null}evaluate(t){return new tq(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class iB{constructor(t,i,r,a,n){this.type=ti,this.number=t,this.locale=i,this.currency=r,this.minFractionDigits=a,this.maxFractionDigits=n}static parse(t,i){if(3!==t.length)return i.error("Expected two arguments.");let r=i.parse(t[1],1,tt);if(!r)return null;let a=t[2];if("object"!=typeof a||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let n=null;if(a.locale&&!(n=i.parse(a.locale,1,ti)))return null;let s=null;if(a.currency&&!(s=i.parse(a.currency,1,ti)))return null;let o=null;if(a["min-fraction-digits"]&&!(o=i.parse(a["min-fraction-digits"],1,tt)))return null;let l=null;return!a["max-fraction-digits"]||(l=i.parse(a["max-fraction-digits"],1,tt))?new iB(r,n,s,o,l):null}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class iO{constructor(t){this.type=th,this.sections=t}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return i.error("First argument must be an image or text section.");let a=[],n=!1;for(let r=1;r<=t.length-1;++r){let s=t[r];
1if(n&&"object"==typeof s&&!Array.isArray(s)){n=!1;let t=null;if(s["font-scale"]&&!(t=i.parse(s["font-scale"],1,tt)))return null;let r=null;if(s["text-font"]&&!(r=i.parse(s["text-font"],1,tm(ti))))return null;let o=null;if(s["text-color"]&&!(o=i.parse(s["text-color"],1,ta)))return null;let l=null;if(s["vertical-align"]){if("string"==typeof s["vertical-align"]&&!tZ.includes(s["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(!(l=i.parse(s["vertical-align"],1,ti)))return null}let h=a[a.length-1];h.scale=t,h.font=r,h.textColor=o,h.verticalAlign=l}else{let s=i.parse(t[r],1,to);if(!s)return null;let o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,a.push({content:s,scale:null,font:null,textColor:null,verticalAlign:null})}}return new iO(a)}evaluate(t){return new tW(this.sections.map(i=>{let r=i.content.evaluate(t);return t5(r)===tp?new t$("",r,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(t):null):new t$(t4(r),null,i.scale?i.scale.evaluate(t):null,i.font?i.font.evaluate(t).join(","):null,i.textColor?i.textColor.evaluate(t):null,i.verticalAlign?i.verticalAlign.evaluate(t):null)}))}eachChild(t){for(let i of this.sections)t(i.content),i.scale&&t(i.scale),i.font&&t(i.font),i.textColor&&t(i.textColor),i.verticalAlign&&t(i.verticalAlign)}outputDefined(){return!1}}class iV{constructor(t){this.type=tp,this.input=t}static parse(t,i){if(2!==t.length)return i.error("Expected two arguments.");let r=i.parse(t[1],1,ti);return r?new iV(r):i.error("No image name provided.")}evaluate(t){let i=this.input.evaluate(t),r=t0.fromString(i);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(i)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}}class ij{constructor(t){this.type=tt,this.input=t}static parse(t,i){if(2!==t.length)return i.error(`Expected 1 argument, but found ${t.length-1} instead.`);let r=i.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?i.error(`Expected argument of type string or array, but found ${t_(r.type)} instead.`):new ij(r):null}evaluate(t){let i=this.input.evaluate(t);if("string"==typeof i)return[...i].length;if(Array.isArray(i))return i.length;throw new tK(`Expected value to be of type string or array, but found ${t_(t5(i))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}function iN(t,i){let r=Math.pow(2,i.z);return[360*((t[0]/8192+i.x)/r)-180,360/Math.PI*Math.atan(Math.exp((180-360*((t[1]/8192+i.y)/r))*Math.PI/180))-90]}function iU(t,i){t[0]=Math.min(t[0],i[0]),t[1]=Math.min(t[1],i[1]),t[2]=Math.max(t[2],i[0]),t[3]=Math.max(t[3],i[1])}function iG(t,i){return!(t[0]<=i[0]||t[2]>=i[2]||t[1]<=i[1]||t[3]>=i[3])}function iq(t,i,r,a){var n,s;return 0!=(n=[a[0]-r[0],a[1]-r[1]])[0]*(s=[i[0]-t[0],i[1]-t[1]])[1]-n[1]*s[0]&&!(!iW(t,i,r,a)||!iW(r,a,t,i))}function iZ(t,i,r=!1){var a,n;let s=!1;for(let o of i)for(let i=0;i<o.length-1;i++){if(function(t,i,r){let a=t[0]-i[0],n=t[1]-i[1],s=t[0]-r[0],o=t[1]-r[1];return a*o-s*n==0&&a*s<=0&&n*o<=0}(t,o[i],o[i+1]))return r;(a=o[i])[1]>t[1]!=(n=o[i+1])[1]>t[1]&&t[0]<(n[0]-a[0])*(t[1]-a[1])/(n[1]-a[1])+a[0]&&(s=!s)}return s}function i$(t,i){for(let r of t)if(!iZ(r,i))return!1;for(let r=0;r<t.length-1;++r)if(function(t,i,r){for(let a of r)for(let r=0;r<a.length-1;++r)if(iq(t,i,a[r],a[r+1]))return!0;return!1}(t[r],t[r+1],i))return!1;return!0}function iW(t,i,r,a){let n=a[0]-r[0],s=a[1]-r[1],o=(t[0]-r[0])*s-n*(t[1]-r[1]),l=(i[0]-r[0])*s-n*(i[1]-r[1]);return o>0&&l<0||o<0&&l>0}function iH(t,i,r){let a=[];for(let n=0;n<t.length;n++){let s=[];for(let a=0;a<t[n].length;a++){let o=function(t,i){let r=(180+t[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,i.z);return[Math.round(r*n*8192),Math.round(a*n*8192)]}(t[n][a],r);iU(i,o),s.push(o)}a.push(s)}return a}function iX(t,i,r){let a=[];for(let n=0;n<t.length;n++){let s=iH(t[n],i,r);a.push(s)}return a}function iY(t,i,r,a){if(t[0]<r[0]||t[0]>r[2]){let i=.5*a,n=t[0]-r[0]>i?-a:r[0]-t[0]>i?a:0;0===n&&(n=t[0]-r[2]>i?-a:r[2]-t[0]>i?a:0),t[0]+=n}iU(i,t)}function iK(t,i,r,a){let n=8192*Math.pow(2,a.z),s=[8192*a.x,8192*a.y],o=[];for(let a of t)for(let t of a){let a=[t.x+s[0],t.y+s[1]];iY(a,i,r,n),o.push(a)}return o}function iJ(t,i,r,a){let n=8192*Math.pow(2,a.z),s=[8192*a.x,8192*a.y],o=[];for(let r of t){let t=[];for(let a of r){let r=[a.x+s[0],a.y+s[1]];iU(i,r),t.push(r)}o.push(t)}if(i[2]-i[0]<=n/2)for(let t of(i[0]=i[1]=1/0,i[2]=i[3]=-1/0,o))for(let a of t)iY(a,i,r,n);return o}class iQ{constructor(t,i){this.type=tr,this.geojson=t,this.geometries=i}static parse(t,i){if(2!==t.length)return i.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(t3(t[1])){let i=t[1];
1if("FeatureCollection"===i.type){let t=[];for(let r of i.features){let{type:i,coordinates:a}=r.geometry;"Polygon"===i&&t.push(a),"MultiPolygon"===i&&t.push(...a)}if(t.length)return new iQ(i,{type:"MultiPolygon",coordinates:t})}else if("Feature"===i.type){let t=i.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new iQ(i,i.geometry)}else if("Polygon"===i.type||"MultiPolygon"===i.type)return new iQ(i,i)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,i){let r=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===i.type){let s=iH(i.coordinates,a,n),o=iK(t.geometry(),r,a,n);if(!iG(r,a))return!1;for(let t of o)if(!iZ(t,s))return!1}if("MultiPolygon"===i.type){let s=iX(i.coordinates,a,n),o=iK(t.geometry(),r,a,n);if(!iG(r,a))return!1;for(let t of o)if(!function(t,i){for(let r of i)if(iZ(t,r))return!0;return!1}(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,i){let r=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===i.type){let s=iH(i.coordinates,a,n),o=iJ(t.geometry(),r,a,n);if(!iG(r,a))return!1;for(let t of o)if(!i$(t,s))return!1}if("MultiPolygon"===i.type){let s=iX(i.coordinates,a,n),o=iJ(t.geometry(),r,a,n);if(!iG(r,a))return!1;for(let t of o)if(!function(t,i){for(let r of i)if(i$(t,r))return!0;return!1}(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let i0=class{constructor(t=[],i=(t,i)=>t<i?-1:+(t>i)){if(this.data=t,this.length=this.data.length,this.compare=i,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;let t=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:i,compare:r}=this,a=i[t];for(;t>0;){let n=t-1>>1,s=i[n];if(r(a,s)>=0)break;i[t]=s,t=n}i[t]=a}_down(t){let{data:i,compare:r}=this,a=this.length>>1,n=i[t];for(;t<a;){let a=1+(t<<1),s=a+1;if(s<this.length&&0>r(i[s],i[a])&&(a=s),r(i[a],n)>=0)break;i[t]=i[a],t=a}i[t]=n}};function i1(t,i,r){let a=t[i];t[i]=t[r],t[r]=a}function i2(t,i){let r,a;if(t.length<=1)return[t];let n=[];for(let i of t){let t=function(t){let i=0;for(let r,a,n=0,s=t.length,o=s-1;n<s;o=n++)r=t[n],i+=((a=t[o]).x-r.x)*(r.y+a.y);return i}(i);0!==t&&(i.area=Math.abs(t),void 0===a&&(a=t<0),a===t<0?(r&&n.push(r),r=[i]):r.push(i))}if(r&&n.push(r),i>1)for(let t=0;t<n.length;t++)n[t].length<=i||(function t(i,r,a=0,n=i.length-1,s=function(t,i){return t<i?-1:+(t>i)}){for(;n>a;){if(n-a>600){let o=n-a+1,l=r-a+1,h=Math.log(o),u=.5*Math.exp(2*h/3),c=.5*Math.sqrt(h*u*(o-u)/o)*(l-o/2<0?-1:1);t(i,r,Math.max(a,Math.floor(r-l*u/o+c)),Math.min(n,Math.floor(r+(o-l)*u/o+c)),s)}let o=i[r],l=a,h=n;for(i1(i,a,r),s(i[n],o)>0&&i1(i,a,n);l<h;){for(i1(i,l,h),l++,h--;0>s(i[l],o);)l++;for(;s(i[h],o)>0;)h--}0===s(i[a],o)?i1(i,a,h):i1(i,++h,n),h<=r&&(a=h+1),r<=h&&(n=h-1)}}(n[t],i,1,n[t].length-1,i3),n[t]=n[t].slice(0,i));return n}function i3(t,i){return i.area-t.area}let i5=1/298.257223563*(2-1/298.257223563),i4=Math.PI/180;class i6{constructor(t){const i=6378.137*i4*1e3,r=Math.cos(t*i4),a=1/(1-i5*(1-r*r)),n=Math.sqrt(a);this.kx=i*n*r,this.ky=i*n*a*(1-i5)}distance(t,i){let r=this.wrap(t[0]-i[0])*this.kx,a=(t[1]-i[1])*this.ky;return Math.sqrt(r*r+a*a)}pointOnLine(t,i){let r,a,n,s,o=1/0;for(let l=0;l<t.length-1;l++){let h=t[l][0],u=t[l][1],c=this.wrap(t[l+1][0]-h)*this.kx,d=(t[l+1][1]-u)*this.ky,p=0;0===c&&0===d||((p=(this.wrap(i[0]-h)*this.kx*c+(i[1]-u)*this.ky*d)/(c*c+d*d))>1?(h=t[l+1][0],u=t[l+1][1]):p>0&&(h+=c/this.kx*p,u+=d/this.ky*p));let f=(c=this.wrap(i[0]-h)*this.kx)*c+(d=(i[1]-u)*this.ky)*d;f<o&&(o=f,r=h,a=u,n=l,s=p)}return{point:[r,a],index:n,t:Math.max(0,Math.min(1,s))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function i8(t,i){return i[0]-t[0]}function i9(t){return t[1]-t[0]+1}function i7(t,i){return t[1]>=t[0]&&t[1]<i}function re(t,i){if(t[0]>
1t[1])return[null,null];let r=i9(t);if(i){if(2===r)return[t,null];let i=Math.floor(r/2);return[[t[0],t[0]+i],[t[0]+i,t[1]]]}if(1===r)return[t,null];let a=Math.floor(r/2)-1;return[[t[0],t[0]+a],[t[0]+a+1,t[1]]]}function rt(t,i){if(!i7(i,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let a=i[0];a<=i[1];++a)iU(r,t[a]);return r}function ri(t){let i=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let t of r)iU(i,t);return i}function rr(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function ra(t,i,r){if(!rr(t)||!rr(i))return NaN;let a=0,n=0;return t[2]<i[0]&&(a=i[0]-t[2]),t[0]>i[2]&&(a=t[0]-i[2]),t[1]>i[3]&&(n=t[1]-i[3]),t[3]<i[1]&&(n=i[1]-t[3]),r.distance([0,0],[a,n])}function rn(t,i,r){let a=r.pointOnLine(i,t);return r.distance(t,a.point)}function rs(t,i,r,a,n){return Math.min(Math.min(rn(t,[r,a],n),rn(i,[r,a],n)),Math.min(rn(r,[t,i],n),rn(a,[t,i],n)))}function ro(t,i){for(let r of t)for(let t of r)if(iZ(t,i,!0))return!0;return!1}function rl(t,i,r,a,n,s){if(!s)return;let o=ra(rt(a,s),n,r);o<i&&t.push([o,s,[0,0]])}function rh(t,i,r,a,n,s,o){if(!s||!o)return;let l=ra(rt(a,s),rt(n,o),r);l<i&&t.push([l,s,o])}function ru(t,i,r,a,n=1/0){let s=Math.min(a.distance(t[0],r[0][0]),n);if(0===s)return s;let o=new i0([[0,[0,t.length-1],[0,0]]],i8),l=ri(r);for(;o.length>0;){let n=o.pop();if(n[0]>=s)continue;let h=n[1],u=i?50:100;if(i9(h)<=u){if(!i7(h,t.length))return NaN;if(i){let i=function(t,i,r,a){if(!i7(i,t.length))return NaN;for(let a=i[0];a<=i[1];++a)if(iZ(t[a],r,!0))return 0;let n=1/0;for(let s=i[0];s<i[1];++s){let i=t[s],o=t[s+1];for(let t of r)for(let r=0,s=t.length,l=s-1;r<s;l=r++){let s=t[l],h=t[r];if(iq(i,o,s,h))return 0;n=Math.min(n,rs(i,o,s,h,a))}}return n}(t,h,r,a);if(isNaN(i)||0===i)return i;s=Math.min(s,i)}else for(let i=h[0];i<=h[1];++i)if(0===(s=Math.min(s,function(t,i,r){if(iZ(t,i,!0))return 0;let a=1/0;for(let n of i){let i=n[0],s=n[n.length-1];if(i!==s&&0===(a=Math.min(a,rn(t,[s,i],r))))break;let o=r.pointOnLine(n,t);if(0===(a=Math.min(a,r.distance(t,o.point))))break}return a}(t[i],r,a))))return 0}else{let r=re(h,i);rl(o,s,a,t,l,r[0]),rl(o,s,a,t,l,r[1])}}return s}function rc(t,i,r,a,n,s=1/0){let o=Math.min(s,n.distance(t[0],r[0]));if(0===o)return o;let l=new i0([[0,[0,t.length-1],[0,r.length-1]]],i8);for(;l.length>0;){let s=l.pop();if(s[0]>=o)continue;let h=s[1],u=s[2],c=i?50:100,d=a?50:100;if(i9(h)<=c&&i9(u)<=d){if(!i7(h,t.length)&&i7(u,r.length))return NaN;if(i&&a)o=Math.min(o,function(t,i,r,a,n){if(!i7(i,t.length)||!i7(a,r.length))return 1/0;let s=1/0;for(let o=i[0];o<i[1];++o){let i=t[o],l=t[o+1];for(let t=a[0];t<a[1];++t){let a=r[t],o=r[t+1];if(iq(i,l,a,o))return 0;s=Math.min(s,rs(i,l,a,o,n))}}return s}(t,h,r,u,n));else if(i&&!a){let i=t.slice(h[0],h[1]+1);for(let t=u[0];t<=u[1];++t)if(0===(o=Math.min(o,rn(r[t],i,n))))return o}else if(!i&&a){let i=r.slice(u[0],u[1]+1);for(let r=h[0];r<=h[1];++r)if(0===(o=Math.min(o,rn(t[r],i,n))))return o}else o=Math.min(o,function(t,i,r,a,n){if(!i7(i,t.length)||!i7(a,r.length))return NaN;let s=1/0;for(let o=i[0];o<=i[1];++o)for(let i=a[0];i<=a[1];++i)if(0===(s=Math.min(s,n.distance(t[o],r[i]))))return s;return s}(t,h,r,u,n))}else{let s=re(h,i),c=re(u,a);rh(l,o,n,t,r,s[0],c[0]),rh(l,o,n,t,r,s[0],c[1]),rh(l,o,n,t,r,s[1],c[0]),rh(l,o,n,t,r,s[1],c[1])}}return o}function rd(t){return"MultiPolygon"===t.type?t.coordinates.map(t=>({type:"Polygon",coordinates:t})):"MultiLineString"===t.type?t.coordinates.map(t=>({type:"LineString",coordinates:t})):"MultiPoint"===t.type?t.coordinates.map(t=>({type:"Point",coordinates:t})):[t]}class rp{constructor(t,i){this.type=tt,this.geojson=t,this.geometries=i}static parse(t,i){if(2!==t.length)return i.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(t3(t[1])){let i=t[1];if("FeatureCollection"===i.type)return new rp(i,i.features.map(t=>rd(t.geometry)).flat());if("Feature"===i.type)return new rp(i,rd(i.geometry));if("type"in i&&"coordinates"in i)return new rp(i,rd(i))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,i){let r=t.geometry(),a=r.flat().map(i=>iN([i.x,i.y],t.canonical));if(0===r.length)return NaN;let n=new i6(a[0][1]),s=1/0;for(let t of i){switch(t.type){case"Point":s=Math.min(s,rc(a,!1,[t.coordinates],!1,n,s));break;case"LineString":s=Math.min(s,rc(a,!1,t.coordinates,!0,n,s));break;case"Polygon":s=Math.min(s,ru(a,!1,t.coordinates,n,s))}if(0===s)break}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,i){let r=t.geometry(),a=r.flat().map(i=>iN([i.x,i.y],t.canonical));if(0===r.length)return NaN;let n=new i6(a[0][1]),s=1/0;for(let t of i){switch(t.type){case"Point":s=Math.min(s,rc(a,!0,[t.coordinates],!1,n,s));break;case"LineString":s=Math.min(s,rc(a,!0,t.coordinates,!0,n,s));break;case"Polygon":s=Math.min(s,ru(a,!0,t.coordinates,n,s))}if(0===s)break}return s}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,i){let r=t.geometry();if(0===r.length||0===r[0].length)return NaN;let a=i2(r,0).map(i=>i.map(i=>i.map(i=>iN([i.x,i.y],t.canonical)))),n=new i6(a[0][0][0][1]),s=1/0;for(let t of i)for(let i of a){switch(t.type){case"Point":s=Math.min(s,ru([t.co
1ordinates],!1,i,n,s));break;case"LineString":s=Math.min(s,ru(t.coordinates,!0,i,n,s));break;case"Polygon":s=Math.min(s,function(t,i,r,a=1/0){let n=ri(t),s=ri(i);if(a!==1/0&&ra(n,s,r)>=a)return a;if(iG(n,s)){if(ro(t,i))return 0}else if(ro(i,t))return 0;let o=1/0;for(let a of t)for(let t=0,n=a.length,s=n-1;t<n;s=t++){let n=a[s],l=a[t];for(let t of i)for(let i=0,a=t.length,s=a-1;i<a;s=i++){let a=t[s],h=t[i];if(iq(n,l,a,h))return 0;o=Math.min(o,rs(n,l,a,h,r))}}return o}(i,t.coordinates,n,s))}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class rf{constructor(t){this.type=to,this.key=t}static parse(t,i){if(2!==t.length)return i.error(`Expected 1 argument, but found ${t.length-1} instead.`);let r=t[1];return null==r?i.error("Global state property must be defined."):"string"!=typeof r?i.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new rf(r)}evaluate(t){var i;let r=null==(i=t.globals)?void 0:i.globalState;return r&&0!==Object.keys(r).length?tF(r,this.key):null}eachChild(){}outputDefined(){return!1}}let rm={"==":iA,"!=":iD,">":ik,"<":iz,">=":iL,"<=":iR,array:t9,at:io,boolean:t9,case:ic,coalesce:iM,collator:iF,format:iO,image:iV,in:il,"index-of":ih,interpolate:iT,"interpolate-hcl":iT,"interpolate-lab":iT,length:ij,let:ia,literal:t6,match:iu,number:t9,"number-format":iB,object:t9,slice:id,step:im,string:t9,"to-boolean":ie,"to-color":ie,"to-number":ie,"to-string":ie,var:is,within:iQ,distance:rp,"global-state":rf};class r_{constructor(t,i,r,a){this.name=t,this.type=i,this._evaluate=r,this.args=a}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,i){let r=t[0],a=r_.definitions[r];if(!a)return i.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);let n=Array.isArray(a)?a[0]:a.type,s=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,o=s.filter(([i])=>!Array.isArray(i)||i.length===t.length-1),l=null;for(let[a,s]of o){l=new ir(i.registry,rv,i.path,null,i.scope);let o=[],h=!1;for(let i=1;i<t.length;i++){let r=t[i],n=Array.isArray(a)?a[i-1]:a.type,s=l.parse(r,1+o.length,n);if(!s){h=!0;break}o.push(s)}if(!h)if(Array.isArray(a)&&a.length!==o.length)l.error(`Expected ${a.length} arguments, but found ${o.length} instead.`);else{for(let t=0;t<o.length;t++){let i=Array.isArray(a)?a[t]:a.type,r=o[t];l.concat(t+1).checkSubtype(i,r.type)}if(0===l.errors.length)return new r_(r,n,s,o)}}if(1===o.length)i.errors.push(...l.errors);else{let r=(o.length?o:s).map(([t])=>Array.isArray(t)?`(${t.map(t_).join(", ")})`:`(${t_(t.type)}...)`).join(" | "),a=[];for(let r=1;r<t.length;r++){let n=i.parse(t[r],1+a.length);if(!n)return null;a.push(t_(n.type))}i.error(`Expected arguments of type ${r}, but found (${a.join(", ")}) instead.`)}return null}static register(t,i){for(let r in r_.definitions=i,i)t[r]=r_}}function rg(t,[i,r,a,n]){i=i.evaluate(t),r=r.evaluate(t),a=a.evaluate(t);let s=n?n.evaluate(t):1,o=t2(i,r,a,s);if(o)throw new tK(o);return new tG(i/255,r/255,a/255,s,!1)}function ry(t,i){let r=i[t];return void 0===r?null:r}function rx(t){return{type:t}}function rv(t){if(t instanceof is)return rv(t.boundExpression);if(t instanceof r_&&"error"===t.name||t instanceof iF||t instanceof iQ||t instanceof rp||t instanceof rf)return!1;let i=t instanceof ie||t instanceof t9,r=!0;return t.eachChild(t=>{r=i?r&&rv(t):r&&t instanceof t6}),!!r&&rb(t)&&rT(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function rb(t){if(t instanceof r_&&("get"===t.name&&1===t.args.length||"feature-state"===t.name||"has"===t.name&&1===t.args.length||"properties"===t.name||"geometry-type"===t.name||"id"===t.name||/^filter-/.test(t.name))||t instanceof iQ||t instanceof rp)return!1;let i=!0;return t.eachChild(t=>{i&&!rb(t)&&(i=!1)}),i}function rw(t){if(t instanceof r_&&"feature-state"===t.name)return!1;let i=!0;return t.eachChild(t=>{i&&!rw(t)&&(i=!1)}),i}function rT(t,i){if(t instanceof r_&&i.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(t=>{r&&!rT(t,i)&&(r=!1)}),r}function rS(t){return{result:"success",value:t}}function rP(t){return{result:"error",value:t}}function rM(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function rI(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function rE(t){return!!t.expression&&t.expression.interpolated}function rC(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function rA(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&t5(t)===ts}function rD(t){return t}function rz(t,i,r){return void 0!==t?t:void 0!==i?i:void 0!==r?r:void 0}function rk(t,i,r,a,n){return rz(typeof r===n?a[r]:void 0,t.default,i.default)}function rR(t,i,r){if("number"!==rC(r))return rz(t.default,i.default);let a=t.stops.length;if(1===a||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[a-1][0])return t.stops[a-1][1];let n=ip(t.stops.map(t=>t[0]),r);return t.stops[n][1]}function rL(t,i,r){var a;let n,s,o=void 0!==t.base?t.base:1;if("number"!==rC(r))return rz(t.default,i.default);let l=t.stops.length;if(1===l||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[l-1][0])return t.stops[l-1][1];let h=ip(t.stops.map(t=>
1t[0]),r),u=(a=t.stops[h][0],n=t.stops[h+1][0]-a,s=r-a,0===n?0:1===o?s/n:(Math.pow(o,s)-1)/(Math.pow(o,n)-1)),c=t.stops[h][1],d=t.stops[h+1][1],p=iP[i.type]||rD;return"function"==typeof c.evaluate?{evaluate(...i){let r=c.evaluate.apply(void 0,i),a=d.evaluate.apply(void 0,i);if(void 0!==r&&void 0!==a)return p(r,a,u,t.colorSpace)}}:p(c,d,u,t.colorSpace)}function rF(t,i,r){switch(i.type){case"color":r=tG.parse(r);break;case"formatted":r=tW.fromString(r.toString());break;case"resolvedImage":r=t0.fromString(r.toString());break;case"padding":r=tH.parse(r);break;case"colorArray":r=tY.parse(r);break;case"numberArray":r=tX.parse(r);break;default:rC(r)===i.type||"enum"===i.type&&i.values[r]||(r=void 0)}return rz(r,t.default,i.default)}r_.register(rm,{error:[{kind:"error"},[ti],(t,[i])=>{throw new tK(i.evaluate(t))}],typeof:[ti,[to],(t,[i])=>t_(t5(i.evaluate(t)))],"to-rgba":[tm(tt,4),[ta],(t,[i])=>{let[r,a,n,s]=i.evaluate(t).rgb;return[255*r,255*a,255*n,s]}],rgb:[ta,[tt,tt,tt],rg],rgba:[ta,[tt,tt,tt,tt],rg],has:{type:tr,overloads:[[[ti],(t,[i])=>i.evaluate(t)in t.properties()],[[ti,ts],(t,[i,r])=>i.evaluate(t)in r.evaluate(t)]]},get:{type:to,overloads:[[[ti],(t,[i])=>ry(i.evaluate(t),t.properties())],[[ti,ts],(t,[i,r])=>ry(i.evaluate(t),r.evaluate(t))]]},"feature-state":[to,[ti],(t,[i])=>ry(i.evaluate(t),t.featureState||{})],properties:[ts,[],t=>t.properties()],"geometry-type":[ti,[],t=>t.geometryType()],id:[to,[],t=>t.id()],zoom:[tt,[],t=>t.globals.zoom],"heatmap-density":[tt,[],t=>t.globals.heatmapDensity||0],elevation:[tt,[],t=>t.globals.elevation||0],"line-progress":[tt,[],t=>t.globals.lineProgress||0],accumulated:[to,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[tt,rx(tt),(t,i)=>{let r=0;for(let a of i)r+=a.evaluate(t);return r}],"*":[tt,rx(tt),(t,i)=>{let r=1;for(let a of i)r*=a.evaluate(t);return r}],"-":{type:tt,overloads:[[[tt,tt],(t,[i,r])=>i.evaluate(t)-r.evaluate(t)],[[tt],(t,[i])=>-i.evaluate(t)]]},"/":[tt,[tt,tt],(t,[i,r])=>i.evaluate(t)/r.evaluate(t)],"%":[tt,[tt,tt],(t,[i,r])=>i.evaluate(t)%r.evaluate(t)],ln2:[tt,[],()=>Math.LN2],pi:[tt,[],()=>Math.PI],e:[tt,[],()=>Math.E],"^":[tt,[tt,tt],(t,[i,r])=>Math.pow(i.evaluate(t),r.evaluate(t))],sqrt:[tt,[tt],(t,[i])=>Math.sqrt(i.evaluate(t))],log10:[tt,[tt],(t,[i])=>Math.log(i.evaluate(t))/Math.LN10],ln:[tt,[tt],(t,[i])=>Math.log(i.evaluate(t))],log2:[tt,[tt],(t,[i])=>Math.log(i.evaluate(t))/Math.LN2],sin:[tt,[tt],(t,[i])=>Math.sin(i.evaluate(t))],cos:[tt,[tt],(t,[i])=>Math.cos(i.evaluate(t))],tan:[tt,[tt],(t,[i])=>Math.tan(i.evaluate(t))],asin:[tt,[tt],(t,[i])=>Math.asin(i.evaluate(t))],acos:[tt,[tt],(t,[i])=>Math.acos(i.evaluate(t))],atan:[tt,[tt],(t,[i])=>Math.atan(i.evaluate(t))],min:[tt,rx(tt),(t,i)=>Math.min(...i.map(i=>i.evaluate(t)))],max:[tt,rx(tt),(t,i)=>Math.max(...i.map(i=>i.evaluate(t)))],abs:[tt,[tt],(t,[i])=>Math.abs(i.evaluate(t))],round:[tt,[tt],(t,[i])=>{let r=i.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[tt,[tt],(t,[i])=>Math.floor(i.evaluate(t))],ceil:[tt,[tt],(t,[i])=>Math.ceil(i.evaluate(t))],"filter-==":[tr,[ti,to],(t,[i,r])=>t.properties()[i.value]===r.value],"filter-id-==":[tr,[to],(t,[i])=>t.id()===i.value],"filter-type-==":[tr,[ti],(t,[i])=>t.geometryType()===i.value],"filter-<":[tr,[ti,to],(t,[i,r])=>{let a=t.properties()[i.value],n=r.value;return typeof a==typeof n&&a<n}],"filter-id-<":[tr,[to],(t,[i])=>{let r=t.id(),a=i.value;return typeof r==typeof a&&r<a}],"filter->":[tr,[ti,to],(t,[i,r])=>{let a=t.properties()[i.value],n=r.value;return typeof a==typeof n&&a>n}],"filter-id->":[tr,[to],(t,[i])=>{let r=t.id(),a=i.value;return typeof r==typeof a&&r>a}],"filter-<=":[tr,[ti,to],(t,[i,r])=>{let a=t.properties()[i.value],n=r.value;return typeof a==typeof n&&a<=n}],"filter-id-<=":[tr,[to],(t,[i])=>{let r=t.id(),a=i.value;return typeof r==typeof a&&r<=a}],"filter->=":[tr,[ti,to],(t,[i,r])=>{let a=t.properties()[i.value],n=r.value;return typeof a==typeof n&&a>=n}],"filter-id->=":[tr,[to],(t,[i])=>{let r=t.id(),a=i.value;return typeof r==typeof a&&r>=a}],"filter-has":[tr,[to],(t,[i])=>i.value in t.properties()],"filter-has-id":[tr,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[tr,[tm(ti)],(t,[i])=>i.value.indexOf(t.geometryType())>=0],"filter-id-in":[tr,[tm(to)],(t,[i])=>i.value.indexOf(t.id())>=0],"filter-in-small":[tr,[ti,tm(to)],(t,[i,r])=>r.value.indexOf(t.properties()[i.value])>=0],"filter-in-large":[tr,[ti,tm(to)],(t,[i,r])=>(function(t,i,r,a){for(;r<=a;){let n=r+a>>1;if(i[n]===t)return!0;
1i[n]>t?a=n-1:r=n+1}return!1})(t.properties()[i.value],r.value,0,r.value.length-1)],all:{type:tr,overloads:[[[tr,tr],(t,[i,r])=>i.evaluate(t)&&r.evaluate(t)],[rx(tr),(t,i)=>{for(let r of i)if(!r.evaluate(t))return!1;return!0}]]},any:{type:tr,overloads:[[[tr,tr],(t,[i,r])=>i.evaluate(t)||r.evaluate(t)],[rx(tr),(t,i)=>{for(let r of i)if(r.evaluate(t))return!0;return!1}]]},"!":[tr,[tr],(t,[i])=>!i.evaluate(t)],"is-supported-script":[tr,[ti],(t,[i])=>{let r=t.globals&&t.globals.isSupportedScript;return!r||r(i.evaluate(t))}],upcase:[ti,[ti],(t,[i])=>i.evaluate(t).toUpperCase()],downcase:[ti,[ti],(t,[i])=>i.evaluate(t).toLowerCase()],concat:[ti,rx(to),(t,i)=>i.map(i=>t4(i.evaluate(t))).join("")],"resolved-locale":[ti,[tl],(t,[i])=>i.evaluate(t).resolvedLocale()]});class rB{constructor(t,i,r){this.expression=t,this._warningHistory={},this._evaluator=new ii,this._defaultValue=i?function(t){if("color"===t.type&&rA(t.default))return new tG(0,0,0,0);switch(t.type){case"color":return tG.parse(t.default)||null;case"padding":return tH.parse(t.default)||null;case"numberArray":return tX.parse(t.default)||null;case"colorArray":return tY.parse(t.default)||null;case"variableAnchorOffsetCollection":return tQ.parse(t.default)||null;case"projectionDefinition":return t1.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(i):null,this._enumValues=i&&"enum"===i.type?i.values:null,this._globalState=r}evaluateWithoutErrorHandling(t,i,r,a,n,s){return this._globalState&&(t=rZ(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=i,this._evaluator.featureState=r,this._evaluator.canonical=a,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,i,r,a,n,s){this._globalState&&(t=rZ(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=i||null,this._evaluator.featureState=r||null,this._evaluator.canonical=a,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s||null;try{let t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new tK(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"u">typeof console&&console.warn(t.message)),this._defaultValue}}}function rO(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in rm}function rV(t,i,r){let a,n=new ir(rm,rv,[],i?(a={color:ta,string:ti,number:tt,enum:ti,boolean:tr,formatted:th,padding:tu,numberArray:td,colorArray:tc,projectionDefinition:tn,resolvedImage:tp,variableAnchorOffsetCollection:tf},"array"===i.type?tm(a[i.value]||to,i.length):a[i.type]):void 0),s=n.parse(t,void 0,void 0,void 0,i&&"string"===i.type?{typeAnnotation:"coerce"}:void 0);return s?rS(new rB(s,i,r)):rP(n.errors)}class rj{constructor(t,i,r){this.kind=t,this._styleExpression=i,this.isStateDependent="constant"!==t&&!rw(i.expression),this.globalStateRefs=rq(i.expression),this._globalState=r}evaluateWithoutErrorHandling(t,i,r,a,n,s){return this._globalState&&(t=rZ(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,i,r,a,n,s)}evaluate(t,i,r,a,n,s){return this._globalState&&(t=rZ(t,this._globalState)),this._styleExpression.evaluate(t,i,r,a,n,s)}}class rN{constructor(t,i,r,a,n){this.kind=t,this.zoomStops=r,this._styleExpression=i,this.isStateDependent="camera"!==t&&!rw(i.expression),this.globalStateRefs=rq(i.expression),this.interpolationType=a,this._globalState=n}evaluateWithoutErrorHandling(t,i,r,a,n,s){return this._globalState&&(t=rZ(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,i,r,a,n,s)}evaluate(t,i,r,a,n,s){return this._globalState&&(t=rZ(t,this._globalState)),this._styleExpression.evaluate(t,i,r,a,n,s)}interpolationFactor(t,i,r){return this.interpolationType?iT.interpolationFactor(this.interpolationType,t,i,r):0}}function rU(t,i,r){let a=rV(t,i,r);if("error"===a.result)return a;let n=a.value.expression,s=rb(n);if(!s&&!rM(i))return rP([new e9("","data expressions not supported")]);let o=rT(n,["zoom"]);if(!o&&!rI(i))return rP([new e9("","zoom expressions not supported")]);let l=function t(i){let r=null;if(i instanceof ia)r=t(i.result);
1else if(i instanceof iM){for(let a of i.args)if(r=t(a))break}else(i instanceof im||i instanceof iT)&&i.input instanceof r_&&"zoom"===i.input.name&&(r=i);return r instanceof e9||i.eachChild(i=>{let a=t(i);a instanceof e9?r=a:!r&&a?r=new e9("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):r&&a&&r!==a&&(r=new e9("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}(n);return l||o?l instanceof e9?rP([l]):l instanceof iT&&!rE(i)?rP([new e9("",'"interpolate" expressions cannot be used with this property')]):rS(l?new rN(s?"camera":"composite",a.value,l.labels,l instanceof iT?l.interpolation:void 0,r):new rj(s?"constant":"source",a.value,r)):rP([new e9("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class rG{constructor(t,i){this._parameters=t,this._specification=i,e8(this,function t(i,r){var a;let n,s,o=i.stops&&"object"==typeof i.stops[0][0],l=o||!(o||void 0!==i.property),h=i.type||(rE(r)?"exponential":"interval"),u=function(t){switch(t.type){case"color":return tG.parse;case"padding":return tH.parse;case"numberArray":return tX.parse;case"colorArray":return tY.parse;default:return null}}(r);if(u&&((i=e8({},i)).stops&&(i.stops=i.stops.map(t=>[t[0],u(t[1])])),i.default=u(i.default?i.default:r.default)),i.colorSpace&&"rgb"!==(a=i.colorSpace)&&"hcl"!==a&&"lab"!==a)throw Error(`Unknown color space: "${i.colorSpace}"`);let c=function(t){switch(t){case"exponential":return rL;case"interval":return rR;case"categorical":return rk;case"identity":return rF;default:throw Error(`Unknown function type "${t}"`)}}(h);if("categorical"===h){for(let t of(n=Object.create(null),i.stops))n[t[0]]=t[1];s=typeof i.stops[0][0]}if(o){let a={},n=[];for(let t=0;t<i.stops.length;t++){let r=i.stops[t],s=r[0].zoom;void 0===a[s]&&(a[s]={zoom:s,type:i.type,property:i.property,default:i.default,stops:[]},n.push(s)),a[s].stops.push([r[0].value,r[1]])}let s=[];for(let i of n)s.push([a[i].zoom,t(a[i],r)]);let o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:iT.interpolationFactor.bind(void 0,o),zoomStops:s.map(t=>t[0]),evaluate:({zoom:t},a)=>rL({stops:s,base:i.base},r,t).evaluate(t,a)}}if(l){let t="exponential"===h?{name:"exponential",base:void 0!==i.base?i.base:1}:null;return{kind:"camera",interpolationType:t,interpolationFactor:iT.interpolationFactor.bind(void 0,t),zoomStops:i.stops.map(t=>t[0]),evaluate:({zoom:t})=>c(i,r,t,n,s)}}return{kind:"source",evaluate(t,a){let o=a&&a.properties?a.properties[i.property]:void 0;return void 0===o?rz(i.default,r.default):c(i,r,o,n,s)}}}(this._parameters,this._specification))}static deserialize(t){return new rG(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function rq(t,i=new Set){return t instanceof rf&&i.add(t.key),t.eachChild(t=>{rq(t,i)}),i}function rZ(t,i){let{zoom:r,heatmapDensity:a,elevation:n,lineProgress:s,isSupportedScript:o,accumulated:l}=null!=t?t:{};return{zoom:r,heatmapDensity:a,elevation:n,lineProgress:s,isSupportedScript:o,accumulated:l,globalState:i}}function r$(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(let i of t.slice(1))if(!r$(i)&&"boolean"!=typeof i)return!1;return!0;default:return!0}}let rW={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function rH(t,i){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};r$(t)||(t=function t(i){if(!i)return!0;let r=i[0];return i.length<=1?"any"!==r:"=="===r?rY(i[1],i[2],"=="):"!="===r?rQ(rY(i[1],i[2],"==")):"<"===r||">"===r||"<="===r||">="===r?rY(i[1],i[2],r):"any"===r?["any"].concat(i.slice(1).map(t)):"all"===r?["all"].concat(i.slice(1).map(t)):"none"===r?["all"].concat(i.slice(1).map(t).map(rQ)):"in"===r?rK(i[1],i.slice(2)):"!in"===r?rQ(rK(i[1],i.slice(2))):"has"===r?rJ(i[1]):"!has"!==r||rQ(rJ(i[1]))}(t));let r=rV(t,rW,i);if("error"===r.result)throw Error(r.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,i,a)=>r.value.evaluate(t,i,{},a),needGeometry:function t(i){if(!Array.isArray(i))return!1;if("within"===i[0]||"distance"===i[0])return!0;for(let r=1;r<i.length;r++)if(t(i[r]))return!0;return!1}(t),getGlobalStateRefs:()=>rq(r.value.expression)}}function rX(t,i){return t<i?-1:+(t>i)}function rY(t,i,r){switch(t){case"$type":return[`filter-type-${r}`,i];case"$id":return[`filter-id-${r}`,i];default:return[`filter-${r}`,t,i]}}function rK(t,i){if(0===i.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",i]];case"$id":return["filter-id-in",["literal",i]];default:return i.length>200&&!i.some(t=>typeof t!=typeof i[0])?["filter-in-large",t,["literal",i.sort(rX)]]:["filter-in-small",t,["literal",i]]}}function rJ(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function rQ(t){return["!",t]}function r0(t){let i=t.value;return i?[new e6(t.key,i,"constants have been deprecated as of v8")]:[]}function r1(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function r2(t){if(Array.isArray(t))return t.map(r2);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let i={};for(let r in t)i[r]=r2(t[r]);return i}return r1(t)}function r3(t){let i=t.key,r=t.value,a=t.valueSpec||{},n=t.objectElementValidators||{},s=t.style,o=t.styleSpec,l=t.validateSpec,h=[],u=rC(r);if("object"!==u)return[new e6(i,r,`object expected, ${u}
1 found`)];for(let t in r){let u,c=t.split(".")[0],d=tF(a,c)||a["*"];if(tF(n,c))u=n[c];else if(tF(a,c)){if(void 0===r[t])continue;u=l}else if(n["*"])u=n["*"];else{if(!a["*"]){h.push(new e6(i,r[t],`unknown property "${t}"`));continue}u=l}h=h.concat(u({key:(i?`${i}.`:i)+t,value:r[t],valueSpec:d,style:s,styleSpec:o,object:r,objectKey:t,validateSpec:l},r))}for(let t in a)n[t]||a[t].required&&void 0===a[t].default&&void 0===r[t]&&h.push(new e6(i,r,`missing required property "${t}"`));return h}function r5(t){let i=t.value,r=t.valueSpec,a=t.style,n=t.styleSpec,s=t.key,o=t.arrayElementValidator||t.validateSpec;if("array"!==rC(i))return[new e6(s,i,`array expected, ${rC(i)} found`)];if(r.length&&i.length!==r.length)return[new e6(s,i,`array length ${r.length} expected, length ${i.length} found`)];let l={type:r.value,values:r.values};n.$version<7&&(l.function=r.function),"object"===rC(r.value)&&(l=r.value);let h=[];for(let r=0;r<i.length;r++)h=h.concat(o({array:i,arrayIndex:r,value:i[r],valueSpec:l,validateSpec:t.validateSpec,style:a,styleSpec:n,key:`${s}[${r}]`}));return h}function r4(t){let i=t.key,r=t.value,a=t.valueSpec,n=rC(r);return"number"===n&&r!=r&&(n="NaN"),"number"!==n?[new e6(i,r,`number expected, ${n} found`)]:"minimum"in a&&r<a.minimum?[new e6(i,r,`${r} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&r>a.maximum?[new e6(i,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function r6(t){let i=t.valueSpec,r=r1(t.value.type),a,n,s,o={},l="categorical"!==r&&void 0===t.value.property,h="array"===rC(t.value.stops)&&"array"===rC(t.value.stops[0])&&"object"===rC(t.value.stops[0][0]),u=r3({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new e6(t.key,t.value,'identity function may not have a "stops" property')];let i=[],a=t.value;return i=i.concat(r5({key:t.key,value:a,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:c})),"array"===rC(a)&&0===a.length&&i.push(new e6(t.key,a,"array must have at least one stop")),i},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:i,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===r&&l&&u.push(new e6(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||u.push(new e6(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!rE(t.valueSpec)&&u.push(new e6(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l||rM(t.valueSpec)?l&&!rI(t.valueSpec)&&u.push(new e6(t.key,t.value,"zoom functions not supported")):u.push(new e6(t.key,t.value,"property functions not supported"))),("categorical"===r||h)&&void 0===t.value.property&&u.push(new e6(t.key,t.value,'"property" property is required')),u;function c(t){let r=[],a=t.value,l=t.key;if("array"!==rC(a))return[new e6(l,a,`array expected, ${rC(a)} found`)];if(2!==a.length)return[new e6(l,a,`array length 2 expected, length ${a.length} found`)];if(h){if("object"!==rC(a[0]))return[new e6(l,a,`object expected, ${rC(a[0])} found`)];if(void 0===a[0].zoom)return[new e6(l,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new e6(l,a,"object stop key must have value")];if(s&&s>r1(a[0].zoom))return[new e6(l,a[0].zoom,"stop zoom values must appear in ascending order")];r1(a[0].zoom)!==s&&(s=r1(a[0].zoom),n=void 0,o={}),r=r.concat(r3({key:`${l}[0]`,value:a[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:r4,value:d}}))}else r=r.concat(d({key:`${l}[0]`,value:a[0],validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},a));return rO(r2(a[1]))?r.concat([new e6(`${l}[1]`,a[1],"expressions are not allowed in function stops.")]):r.concat(t.validateSpec({key:`${l}[1]`,value:a[1],valueSpec:i,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function d(t,s){let l=rC(t.value),h=r1(t.value),u=null!==t.value?t.value:s;if(a){if(l!==a)return[new e6(t.key,u,`${l} stop domain type must match previous stop domain type ${a}`)]}else a=l;if("number"!==l&&"string"!==l&&"boolean"!==l)return[new e6(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==l&&"categorical"!==r){let a=`number expected, ${l}
1 found`;return rM(i)&&void 0===r&&(a+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new e6(t.key,u,a)]}return"categorical"!==r||"number"!==l||isFinite(h)&&Math.floor(h)===h?"categorical"!==r&&"number"===l&&void 0!==n&&h<n?[new e6(t.key,u,"stop domain values must appear in ascending order")]:(n=h,"categorical"===r&&h in o?[new e6(t.key,u,"stop domain values must be unique")]:(o[h]=!0,[])):[new e6(t.key,u,`integer expected, found ${h}`)]}}function r8(t){let i=("property"===t.expressionContext?rU:rV)(r2(t.value),t.valueSpec);if("error"===i.result)return i.value.map(i=>new e6(`${t.key}${i.key}`,t.value,i.message));let r=i.value.expression||i.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new e6(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!rw(r))return[new e6(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!rw(r))return[new e6(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!rT(r,["zoom","feature-state"]))return[new e6(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!rb(r))return[new e6(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function r9(t){let i=t.key,r=t.value,a=rC(r);return"string"!==a?[new e6(i,r,`color expected, ${a} found`)]:tG.parse(String(r))?[]:[new e6(i,r,`color expected, "${r}" found`)]}function r7(t){let i=t.key,r=t.value,a=t.valueSpec,n=[];return Array.isArray(a.values)?-1===a.values.indexOf(r1(r))&&n.push(new e6(i,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(a.values).indexOf(r1(r))&&n.push(new e6(i,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function ae(t){return r$(r2(t.value))?r8(e8({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(i){let r=i.value,a=i.key;if("array"!==rC(r))return[new e6(a,r,`array expected, ${rC(r)} found`)];let n=i.styleSpec,s,o=[];if(r.length<1)return[new e6(a,r,"filter array must have at least 1 element")];switch(o=o.concat(r7({key:`${a}[0]`,value:r[0],valueSpec:n.filter_operator,style:i.style,styleSpec:i.styleSpec})),r1(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===r1(r[1])&&o.push(new e6(a,r,`"$type" cannot be use with operator "${r[0]}"`));case"==":case"!=":3!==r.length&&o.push(new e6(a,r,`filter array for operator "${r[0]}" must have 3 elements`));case"in":case"!in":r.length>=2&&"string"!==(s=rC(r[1]))&&o.push(new e6(`${a}[1]`,r[1],`string expected, ${s} found`));for(let t=2;t<r.length;t++)s=rC(r[t]),"$type"===r1(r[1])?o=o.concat(r7({key:`${a}[${t}]`,value:r[t],valueSpec:n.geometry_type,style:i.style,styleSpec:i.styleSpec})):"string"!==s&&"number"!==s&&"boolean"!==s&&o.push(new e6(`${a}[${t}]`,r[t],`string, number, or boolean expected, ${s} found`));break;case"any":case"all":case"none":for(let n=1;n<r.length;n++)o=o.concat(t({key:`${a}[${n}]`,value:r[n],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":s=rC(r[1]),2!==r.length?o.push(new e6(a,r,`filter array for "${r[0]}" operator must have 2 elements`)):"string"!==s&&o.push(new e6(`${a}[1]`,r[1],`string expected, ${s} found`))}return o}(t)}function at(t,i){let r,a=t.key,n=t.validateSpec,s=t.style,o=t.styleSpec,l=t.value,h=t.objectKey,u=o[`${i}_${t.layerType}`];if(!u)return[];let c=h.match(/^(.*)-transition$/);if("paint"===i&&c&&u[c[1]]&&u[c[1]].transition)return n({key:a,value:l,valueSpec:o.transition,style:s,styleSpec:o});let d=t.valueSpec||u[h];if(!d)return[new e6(a,l,`unknown property "${h}"`)];if("string"===rC(l)&&rM(d)&&!d.tokens&&(r=/^{([^}]+)}$/.exec(l)))return[new e6(a,l,`"${h}" does not support interpolation syntax 2Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(r[1])} }\`.`)];let p=[];return"symbol"===t.layerType&&"text-font"===h&&rA(r2(l))&&"identity"===r1(l.type)&&p.push(new e6(a,l,'"text-font" does not support identity functions')),p.concat(n({key:t.key,value:l,valueSpec:d,style:s,styleSpec:o,expressionContext:"property",propertyType:i,propertyKey:h}))}function ai(t){return at(t,"paint")}function ar(t){return at(t,"layout")}function aa(t){let i=[],r=t.value,a=t.key,n=t.style,s=t.styleSpec;if("object"!==rC(r))return[new e6(a,r,`object expected, ${rC(r)} found`)];r.type||r.ref||i.push(new e6(a,r,'either "type" or "ref" is required'));let o=r1(r.type),l=r1(r.ref);if(r.id){let s=r1(r.id);for(let o=0;o<t.arrayIndex;o++){let t=n.layers[o];r1(t.id)===s&&i.push(new e6(a,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in r&&i.push(new e6(a,r[t],`"${t}" is prohibited for ref layers`))}
2),n.layers.forEach(i=>{r1(i.id)===l&&(t=i)}),t?t.ref?i.push(new e6(a,r.ref,"ref cannot reference another ref layer")):o=r1(t.type):i.push(new e6(a,r.ref,`ref layer "${l}" not found`))}else if("background"!==o)if(r.source){let t=n.sources&&n.sources[r.source],s=t&&r1(t.type);t?"vector"===s&&"raster"===o?i.push(new e6(a,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==s&&"hillshade"===o||"raster-dem"!==s&&"color-relief"===o?i.push(new e6(a,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===s&&"raster"!==o?i.push(new e6(a,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==o&&"color-relief"!==o?i.push(new e6(a,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"===o&&r.paint&&r.paint["line-gradient"]&&("geojson"!==s||!t.lineMetrics)&&i.push(new e6(a,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):i.push(new e6(a,r,`layer "${r.id}" must specify a "source-layer"`)):i.push(new e6(a,r.source,`source "${r.source}" not found`))}else i.push(new e6(a,r,'missing required property "source"'));return i=i.concat(r3({key:a,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${a}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"}),filter:ae,layout:t=>r3({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>ar(e8({layerType:o},t))}}),paint:t=>r3({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>ai(e8({layerType:o},t))}})}}))}function an(t){let i=t.value,r=t.key,a=rC(i);return"string"!==a?[new e6(r,i,`string expected, ${a} found`)]:[]}let as={promoteId:function({key:t,value:i}){if("string"===rC(i))return an({key:t,value:i});{let r=[];for(let a in i)r.push(...an({key:`${t}.${a}`,value:i[a]}));return r}}};function ao(t){let i,r=t.value,a=t.key,n=t.styleSpec,s=t.style,o=t.validateSpec;if(!r.type)return[new e6(a,r,'"type" is required')];let l=r1(r.type);switch(l){case"vector":case"raster":return r3({key:a,value:r,valueSpec:n[`source_${l.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:as,validateSpec:o});case"raster-dem":return function(t){var i;let r=null!=(i=t.sourceName)?i:"",a=t.value,n=t.styleSpec,s=n.source_raster_dem,o=t.style,l=[],h=rC(a);if(void 0===a)return l;if("object"!==h)return l.push(new e6("source_raster_dem",a,`object expected, ${h} found`)),l;let u="custom"===r1(a.encoding),c=["redFactor","greenFactor","blueFactor","baseShift"],d=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let i in a)!u&&c.includes(i)?l.push(new e6(i,a[i],`In "${r}": "${i}" is only valid when "encoding" is set to "custom". ${d} encoding found`)):s[i]?l=l.concat(t.validateSpec({key:i,value:a[i],valueSpec:s[i],validateSpec:t.validateSpec,style:o,styleSpec:n})):l.push(new e6(i,a[i],`unknown property "${i}"`));return l}({sourceName:a,value:r,style:t.style,styleSpec:n,validateSpec:o});case"geojson":if(i=r3({key:a,value:r,valueSpec:n.source_geojson,style:s,styleSpec:n,validateSpec:o,objectElementValidators:as}),r.cluster)for(let t in r.clusterProperties){let[n,s]=r.clusterProperties[t],o="string"==typeof n?[n,["accumulated"],["get",t]]:n;i.push(...r8({key:`${a}.${t}.map`,value:s,expressionContext:"cluster-map"})),i.push(...r8({key:`${a}.${t}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return i;case"video":return r3({key:a,value:r,valueSpec:n.source_video,style:s,validateSpec:o,styleSpec:n});case"image":return r3({key:a,value:r,valueSpec:n.source_image,style:s,validateSpec:o,styleSpec:n});case"canvas":return[new e6(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return r7({key:`${a}.type`,value:r.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function al(t){let i=t.value,r=t.styleSpec,a=r.light,n=t.style,s=[],o=rC(i);if(void 0===i)return s;if("object"!==o)return s.concat([new e6("light",i,`object expected, ${o} found`)]);for(let o in i){let l=o.match(/^(.*)-transition$/);s=s.concat(l&&a[l[1]]&&a[l[1]].transition?t.validateSpec({key:o,value:i[o],valueSpec:r.transition,validateSpec:t.validateSpec,style:n,styleSpec:r}):a[o]?t.validateSpec({key:o,value:i[o],valueSpec:a[o],validateSpec:t.validateSpec,style:n,styleSpec:r}):[new e6(o,i[o],`unknown property "${o}"`)])}return s}function ah(t){let i=t.value,r=t.styleSpec,a=r.sky,n=t.style,s=rC(i);if(void 0===i)return[];if("object"!==s)return[new e6("sky",i,`object expected, ${s} found`)];let o=[];
2for(let s in i)o=o.concat(a[s]?t.validateSpec({key:s,value:i[s],valueSpec:a[s],style:n,styleSpec:r}):[new e6(s,i[s],`unknown property "${s}"`)]);return o}function au(t){let i=t.value,r=t.styleSpec,a=r.terrain,n=t.style,s=[],o=rC(i);if(void 0===i)return s;if("object"!==o)return s.concat([new e6("terrain",i,`object expected, ${o} found`)]);for(let o in i)s=s.concat(a[o]?t.validateSpec({key:o,value:i[o],valueSpec:a[o],validateSpec:t.validateSpec,style:n,styleSpec:r}):[new e6(o,i[o],`unknown property "${o}"`)]);return s}function ac(t){let i=[],r=t.value,a=t.key;if(Array.isArray(r)){let n=[],s=[];for(let o in r)r[o].id&&n.includes(r[o].id)&&i.push(new e6(a,r,`all the sprites' ids must be unique, but ${r[o].id} is duplicated`)),n.push(r[o].id),r[o].url&&s.includes(r[o].url)&&i.push(new e6(a,r,`all the sprites' URLs must be unique, but ${r[o].url} is duplicated`)),s.push(r[o].url),i=i.concat(r3({key:`${a}[${o}]`,value:r[o],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return i}return an({key:a,value:r})}function ad(t){return!!t&&t.constructor===Object}function ap(t){return ad(t.value)?[]:[new e6(t.key,t.value,`object expected, ${rC(t.value)} found`)]}let af={"*":()=>[],array:r5,boolean:function(t){let i=t.value,r=t.key,a=rC(i);return"boolean"!==a?[new e6(r,i,`boolean expected, ${a} found`)]:[]},number:r4,color:r9,constants:r0,enum:r7,filter:ae,function:r6,layer:aa,object:r3,source:ao,light:al,sky:ah,terrain:au,projection:function(t){let i=t.value,r=t.styleSpec,a=r.projection,n=t.style,s=rC(i);if(void 0===i)return[];if("object"!==s)return[new e6("projection",i,`object expected, ${s} found`)];let o=[];
2for(let s in i)o=o.concat(a[s]?t.validateSpec({key:s,value:i[s],valueSpec:a[s],style:n,styleSpec:r}):[new e6(s,i[s],`unknown property "${s}"`)]);return o},projectionDefinition:function(t){var i;let r=t.key,a=t.value,n=rC(a=a instanceof String?a.valueOf():a);return"array"!==n||Array.isArray(i=a)&&3===i.length&&"string"==typeof i[0]&&"string"==typeof i[1]&&"number"==typeof i[2]||["interpolate","step","literal"].includes(a[0])?["array","string"].includes(n)?[]:[new e6(r,a,`projection expected, invalid type "${n}" found`)]:[new e6(r,a,`projection expected, invalid array ${JSON.stringify(a)} found`)]},string:an,formatted:function(t){return 0===an(t).length?[]:r8(t)},resolvedImage:function(t){return 0===an(t).length?[]:r8(t)},padding:function(t){let i=t.key,r=t.value;if("array"===rC(r)){if(r.length<1||r.length>4)return[new e6(i,r,`padding requires 1 to 4 values; ${r.length} values found`)];let a={type:"number"},n=[];for(let s=0;s<r.length;s++)n=n.concat(t.validateSpec({key:`${i}[${s}]`,value:r[s],validateSpec:t.validateSpec,valueSpec:a}));return n}return r4({key:i,value:r,valueSpec:{}})},numberArray:function(t){let i=t.key,r=t.value;if("array"===rC(r)){let a={type:"number"};if(r.length<1)return[new e6(i,r,"array length at least 1 expected, length 0 found")];let n=[];for(let s=0;s<r.length;s++)n=n.concat(t.validateSpec({key:`${i}[${s}]`,value:r[s],validateSpec:t.validateSpec,valueSpec:a}));return n}return r4({key:i,value:r,valueSpec:{}})},colorArray:function(t){let i=t.key,r=t.value;if("array"===rC(r)){if(r.length<1)return[new e6(i,r,"array length at least 1 expected, length 0 found")];let t=[];for(let a=0;a<r.length;a++)t=t.concat(r9({key:`${i}[${a}]`,value:r[a]}));return t}return r9({key:i,value:r})},variableAnchorOffsetCollection:function(t){let i=t.key,r=t.value,a=rC(r),n=t.styleSpec;if("array"!==a||r.length<1||r.length%2!=0)return[new e6(i,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let a=0;a<r.length;a+=2)s=(s=s.concat(r7({key:`${i}[${a}]`,value:r[a],valueSpec:n.layout_symbol["text-anchor"]}))).concat(r5({key:`${i}[${a+1}]`,value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return s},sprite:ac,state:ap,fontFaces:function(t){let i=t.key,r=t.value,a=t.validateSpec,n=t.styleSpec,s=t.style;if(!ad(r))return[new e6(i,r,`object expected, ${rC(r)} found`)];let o=[];for(let t in r){let l=r[t],h=rC(l);if("string"===h)o.push(...an({key:`${i}.${t}`,value:l}));else if("array"===h){let r={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[h,u]of l.entries())o.push(...r3({key:`${i}.${t}[${h}]`,value:u,valueSpec:r,styleSpec:n,style:s,validateSpec:a}))}else o.push(new e6(`${i}.${t}`,l,`string or array expected, ${h} found`))}return o}};function am(t){let i=t.value,r=t.valueSpec,a=t.styleSpec;return t.validateSpec=am,r.expression&&rA(r1(i))?r6(t):r.expression&&rO(r2(i))?r8(t):r.type&&af[r.type]?af[r.type](t):r3(e8({},t,{valueSpec:r.type?a[r.type]:r}))}function a_(t){let i=t.value,r=t.key,a=an(t);return a.length||(-1===i.indexOf("{fontstack}")&&a.push(new e6(r,i,'"glyphs" url must include a "{fontstack}" token')),-1===i.indexOf("{range}")&&a.push(new e6(r,i,'"glyphs" url must include a "{range}" token'))),a}function ag(t,i=eK){let r=[];return r=r.concat(am({key:"",value:t,valueSpec:i.$root,styleSpec:i,style:t,validateSpec:am,objectElementValidators:{glyphs:a_,"*":()=>[]}})),t.constants&&(r=r.concat(r0({key:"constants",value:t.constants}))),ax(r)}function ay(t){return function(i){return t(Object.assign({},i,{validateSpec:am}))}}function ax(t){return[].concat(t).sort((t,i)=>t.line-i.line)}function av(t){return function(...i){return ax(t.apply(this,i))}}ag.source=av(ay(ao)),ag.sprite=av(ay(ac)),ag.glyphs=av(ay(a_)),ag.light=av(ay(al)),ag.sky=av(ay(ah)),ag.terrain=av(ay(au)),ag.state=av(ay(ap)),ag.layer=av(ay(aa)),ag.filter=av(ay(ae)),ag.paintProperty=av(ay(ai)),ag.layoutProperty=av(ay(ar));let ab={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class aw{constructor(t,i){this._globalState=i,this.setValue(t)}evaluate(){var t;return null!=(t=this._literalValue)?t:this._compiledValue.evaluate({})}setValue(t){if(null==t||"visible"===t||"none"===t)return this._literalValue="none"===t?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);let i=rV(t,ab,this._globalState);if("error"===i.result)throw this._literalValue="visible",this._compiledValue=void 0,Error(i.value.map(t=>`${t.key}: ${t.message}`).join(", "));this._literalValue=void 0,this._compiledValue=i.value,this._globalStateRefs=rq(i.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}let aT=ag.light,aS=ag.sky,aP=ag.paintProperty,aM=ag.layoutProperty;function aI(t,i){let r=!1;if(i&&i.length)for(let a of i)t.fire(new eX(Error(a.message))),r=!0;return r}class aE{constructor(t,i,r){const a=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(i=n[1])+2*(r=n[2]);for(let t=0;t<this.d*this.d;t++){const i=n[3+t],r=n[3+t+1];a.push(i===r?null:n.subarray(i,r))}const s=n[3+a.length+1];this.keys=n.subarray(n[3+a.length],s),this.bboxes=n.subarray(s),this.insert=this._insertReadonly}else{this.d=i+2*r;for(let t=0;t<this.d*this.d;t++)a.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=t,this.padding=r,this.scale=i/t,this.uid=0;const n=r/i*t;this.min=-n,this.max=t+n}
2insert(t,i,r,a,n){this._forEachCell(i,r,a,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,i,r,a,n,s){this.cells[n].push(s)}query(t,i,r,a,n){let s=this.min,o=this.max;if(t<=s&&i<=s&&o<=r&&o<=a&&!n)return Array.prototype.slice.call(this.keys);{let s=[];return this._forEachCell(t,i,r,a,this._queryCell,s,{},n),s}}_queryCell(t,i,r,a,n,s,o,l){let h=this.cells[n];if(null!==h){let n=this.keys,u=this.bboxes;for(let c=0;c<h.length;c++){let d=h[c];if(void 0===o[d]){let h=4*d;(l?l(u[h+0],u[h+1],u[h+2],u[h+3]):t<=u[h+2]&&i<=u[h+3]&&r>=u[h+0]&&a>=u[h+1])?(o[d]=!0,s.push(n[d])):o[d]=!1}}}}_forEachCell(t,i,r,a,n,s,o,l){let h=this._convertToCellCoord(t),u=this._convertToCellCoord(i),c=this._convertToCellCoord(r),d=this._convertToCellCoord(a);for(let p=h;p<=c;p++)for(let h=u;h<=d;h++){let u=this.d*h+p;if((!l||l(this._convertFromCellCoord(p),this._convertFromCellCoord(h),this._convertFromCellCoord(p+1),this._convertFromCellCoord(h+1)))&&n.call(this,t,i,r,a,u,s,o,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,i=3+this.cells.length+1+1,r=0;for(let t=0;t<this.cells.length;t++)r+=this.cells[t].length;let a=new Int32Array(i+r+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;let n=i;for(let i=0;i<t.length;i++){let r=t[i];a[3+i]=n,a.set(r,n),n+=r.length}return a[3+t.length]=n,a.set(this.keys,n),n+=this.keys.length,a[3+t.length+1]=n,a.set(this.bboxes,n),n+=this.bboxes.length,a.buffer}static serialize(t,i){let r=t.toArrayBuffer();return i&&i.push(r),{buffer:r}}static deserialize(t){return new aE(t.buffer)}}let aC={};function aA(t,i,r={}){if(aC[t])throw Error(`${t} is already registered.`);Object.defineProperty(i,"_classRegistryKey",{value:t,writeable:!1}),aC[t]={klass:i,omit:r.omit||[],shallow:r.shallow||[]}}for(let t in aA("Object",Object),aA("Set",Set),aA("TransferableGridIndex",aE),aA("Color",tG),aA("Error",Error),aA("AJAXError",eU),aA("ResolvedImage",t0),aA("StylePropertyFunction",rG),aA("StyleExpression",rB,{omit:["_evaluator"]}),aA("ZoomDependentExpression",rN),aA("ZoomConstantExpression",rj),aA("CompoundExpression",r_,{omit:["_evaluate"]}),rm)rm[t]._classRegistryKey||aA(`Expression_${t}`,rm[t]);function aD(t){return t&&"u">typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function az(t){return t.$name||t.constructor._classRegistryKey}function ak(t){return!function(t){if(null===t||"object"!=typeof t)return!1;let i=az(t);return!(!i||"Object"===i)}(t)&&(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||aD(t)||eE(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function aR(t,i){if(ak(t))return(aD(t)||eE(t))&&i&&i.push(t),ArrayBuffer.isView(t)&&i&&i.push(t.buffer),t instanceof ImageData&&i&&i.push(t.data.buffer),t;if(Array.isArray(t)){let r=[];for(let a of t)r.push(aR(a,i));return r}if("object"!=typeof t)throw Error("can't serialize object of type "+typeof t);let r=az(t);if(!r)throw Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!aC[r])throw Error(`${r} is not registered.`);let{klass:a}=aC[r],n=a.serialize?a.serialize(t,i):{};if(a.serialize){if(i&&n===i[i.length-1])throw Error("statically serialized object won't survive transfer of $name property")}else{for(let a in t){if(!t.hasOwnProperty(a)||aC[r].omit.indexOf(a)>=0)continue;let s=t[a];n[a]=aC[r].shallow.indexOf(a)>=0?s:aR(s,i)}t instanceof Error&&(n.message=t.message)}if(n.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(n.$name=r),n}function aL(t){if(ak(t))return t;if(Array.isArray(t))return t.map(aL);if("object"!=typeof t)throw Error("can't deserialize object of type "+typeof t);let i=az(t)||"Object";if(!aC[i])throw Error(`can't deserialize unregistered class ${i}`);let{klass:r}=aC[i];if(!r)throw Error(`can't deserialize unregistered class ${i}`);if(r.deserialize)return r.deserialize(t);let a=Object.create(r.prototype);for(let r of Object.keys(t)){if("$name"===r)continue;let n=t[r];a[r]=aC[i].shallow.indexOf(r)>=0?n:aL(n)}return a}class aF{constructor(){this.first=!0}update(t,i){let r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=i):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=i),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}}function aB(t){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))}function aO(t){return/\s/u.test(String.fromCodePoint(t))}
2function aV(t){for(let i of t)if(aB(i.codePointAt(0)))return!0;return!1}function aj(t){return RegExp(t.map(t=>{try{return RegExp(`\\p{sc=${t}}`,"u").source}catch(t){return null}}).filter(t=>t).join("|"),"u")}let aN=aj(["Arab","Dupl","Mong","Ougr","Syrc"]);function aU(t){return!(aB(t)||/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(t)))}let aG=aj(["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 aq(t){return aG.test(String.fromCodePoint(t))}let aZ=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(aZ.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(t,i){return b(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if("loading"!==t.pluginStatus)return this.setState(t),t;let r=t.pluginURL,a=new Promise(t=>{this.loadScriptResolve=t});i(r);let n=new Promise(t=>setTimeout(()=>t(),this.TIMEOUT));if(yield Promise.race([a,n]),this.isParsed()){let t={pluginStatus:"loaded",pluginURL:r};return this.setState(t),t}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${r}`)})}};class a${constructor(t,i){this.isSupportedScript=aW,this.zoom=t,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new aF,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new aF,this.transition={})}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,i=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:i+(1-i)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*i}}}function aW(t){var i,r="loaded"===aZ.getRTLTextPluginStatus();for(let a of t)if(i=a.codePointAt(0),!r&&aq(i)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(i)))return!1;return!0}let aH="-transition";class aX{constructor(t,i,r){this.property=t,this.value=i,this.expression=function(t,i,r){if(rA(t))return new rG(t,i);if(rO(t)){let a=rU(t,i,r);if("error"===a.result)throw Error(a.value.map(t=>`${t.key}: ${t.message}`).join(", "));return a.value}{let r=t;return"color"===i.type&&"string"==typeof t?r=tG.parse(t):"padding"===i.type&&("number"==typeof t||Array.isArray(t))?r=tH.parse(t):"numberArray"===i.type&&("number"==typeof t||Array.isArray(t))?r=tX.parse(t):"colorArray"===i.type&&("string"==typeof t||Array.isArray(t))?r=tY.parse(t):"variableAnchorOffsetCollection"===i.type&&Array.isArray(t)?r=tQ.parse(t):"projectionDefinition"===i.type&&"string"==typeof t&&(r=t1.parse(t)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>r}}}(void 0===i?t.specification.default:i,t.specification,r)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}
2possiblyEvaluate(t,i,r){return this.property.possiblyEvaluate(this,t,i,r)}}class aY{constructor(t,i){this.property=t,this.value=new aX(t,void 0,i)}transitioned(t,i){return new aJ(this.property,this.value,i,ey({},t.transition,this.transition),t.now)}untransitioned(){return new aJ(this.property,this.value,null,{},0)}}class aK{constructor(t,i){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=i}getValue(t){return ew(this._values[t].value.value)}setValue(t,i){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new aY(this._values[t].property,this._globalState)),this._values[t].value=new aX(this._values[t].property,null===i?void 0:ew(i),this._globalState)}getTransition(t){return ew(this._values[t].transition)}setTransition(t,i){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new aY(this._values[t].property,this._globalState)),this._values[t].transition=ew(i)||void 0}serialize(){let t={};for(let i of Object.keys(this._values)){let r=this.getValue(i);void 0!==r&&(t[i]=r);let a=this.getTransition(i);void 0!==a&&(t[`${i}${aH}`]=a)}return t}transitioned(t,i){let r=new aQ(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].transitioned(t,i._values[a]);return r}untransitioned(){let t=new aQ(this._properties);for(let i of Object.keys(this._values))t._values[i]=this._values[i].untransitioned();return t}}class aJ{constructor(t,i,r,a,n){this.property=t,this.value=i,this.begin=n+a.delay||0,this.end=this.begin+a.duration||0,t.specification.transition&&(a.delay||a.duration)&&(this.prior=r)}possiblyEvaluate(t,i,r){let a=t.now||0,n=this.value.possiblyEvaluate(t,i,r),s=this.prior;if(s){if(a>this.end||this.value.isDataDriven())return this.prior=null,n;if(a<this.begin)return s.possiblyEvaluate(t,i,r);{let o=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,i,r),n,ep(o))}}return n}}class aQ{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,i,r){let a=new a2(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(t,i,r);return a}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class a0{constructor(t,i){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=i}hasValue(t){return void 0!==this._values[t].value}getValue(t){return ew(this._values[t].value)}setValue(t,i){this._values[t]=new aX(this._values[t].property,null===i?void 0:ew(i),this._globalState)}serialize(){let t={};for(let i of Object.keys(this._values)){let r=this.getValue(i);void 0!==r&&(t[i]=r)}return t}possiblyEvaluate(t,i,r){let a=new a2(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(t,i,r);return a}}class a1{constructor(t,i,r){this.property=t,this.value=i,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,i,r,a){return this.property.evaluate(this.value,this.parameters,t,i,r,a)}}class a2{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class a3{constructor(t){this.specification=t}possiblyEvaluate(t,i){if(t.isDataDriven())throw Error("Value should not be data driven");return t.expression.evaluate(i)}interpolate(t,i,r){let a=iP[this.specification.type];return a?a(t,i,r):t}}class a5{constructor(t,i){this.specification=t,this.overrides=i}possiblyEvaluate(t,i,r,a){return new a1(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(i,null,{},r,a)}:t.expression,i)}interpolate(t,i,r){if("constant"!==t.value.kind||"constant"!==i.value.kind)return t;if(void 0===t.value.value||void 0===i.value.value)return new a1(this,{kind:"constant",value:void 0},t.parameters);let a=iP[this.specification.type];return a?new a1(this,{kind:"constant",value:a(t.value.value,i.value.value,r)},t.parameters):t}evaluate(t,i,r,a,n,s){return"constant"===t.kind?t.value:t.evaluate(i,r,a,n,s)}}class a4 extends a5{possiblyEvaluate(t,i,r,a){if(void 0===t.value)return new a1(this,{kind:"constant",value:void 0},i);if("constant"===t.expression.kind){let n=t.expression.evaluate(i,null,{},r,a),s="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n;return new a1(this,{kind:"constant",value:this._calculate(s,s,s,i)},i)}return"camera"===t.expression.kind?new a1(this,{kind:"constant",value:this._calculate(t.expression.evaluate({zoom:i.zoom-1}),t.expression.evaluate({zoom:i.zoom}),t.expression.evaluate({zoom:i.zoom+1}),i)},i):new a1(this,t.expression,i)}evaluate(t,i,r,a,n,s){if("source"===t.kind){let o=t.evaluate(i,r,a,n,s);return this._calculate(o,o,o,i)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(i.zoom)-1},r,a),t.evaluate({zoom:Math.floor(i.zoom)},r,a),t.evaluate({zoom:Math.floor(i.zoom)+1},r,a),i):t.value}_calculate(t,i,r,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t,to:i}:{from:r,to:i}}interpolate(t){return t}}class a6{constructor(t){this.specification=t}possiblyEvaluate(t,i,r,a){if(void 0!==t.value){if("constant"===t.expression.kind){let n=t.expression.evaluate(i,null,{},r,a);return this._calculate(n,n,n,i)}return this._calculate(t.expression.evaluate(new a$(Math.floor(i.zoom-1),i)),t.expression.evaluate(new a$(Math.floor(i.zoom),i)),t.expression.evaluate(new a$(Math.floor(i.zoom+1),i)),i)}}_calculate(t,i,r,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t,to:i}:{from:r,to:i}}interpolate(t){return t}}class a8{constructor(t){this.specification=t}possiblyEvaluate(t,i,r,a){return!!t.expression.evaluate(i,null,{},r,a)}interpolate(){return!1}}class a9{constructor(t){for(const i in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){const r=t[i];r.specification.overridable&&this.overridableProperties.push(i);const a=this.defaultPropertyValues[i]=new aX(r,void 0,void 0),n=this.defaultTransitionablePropertyValues[i]=new aY(r,void 0);this.defaultTransitioningPropertyValues[i]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=a.possiblyEvaluate({})}}}aA("DataDrivenProperty",a5),aA("DataConstantProperty",a3),aA("CrossFadedDataDrivenProperty",a4),aA("CrossFadedProperty",a6),aA("ColorRampProperty",a8);class a7 extends eY{constructor(t,i,r){if(super(),this.id=t.id,this.type=t.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(t,i){return new aw(t,i)}(this.visibility,r),"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=rH(t.filter,r)),i.layout&&(this._unevaluatedLayout=new a0(i.layout,r)),i.paint)){for(const a in this._transitionablePaint=new aK(i.paint,r),t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(const i in t.layout)this.setLayoutProperty(i,t.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new a2(i.paint)}}setFilter(t){this.filter=t,this._featureFilter=rH(t,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let i of this._visibilityExpression.getGlobalStateRefs())t.add(i);if(this._unevaluatedLayout)for(let i in this._unevaluatedLayout._values)for(let r of this._unevaluatedLayout._values[i].getGlobalStateRefs())t.add(r);for(let i of this._featureFilter.getGlobalStateRefs())t.add(i);return t}getPaintAffectingGlobalStateRefs(){var t;let i=new globalThis.Map;if(this._transitionablePaint)for(let r in this._transitionablePaint._values){let a=this._transitionablePaint._values[r].value;for(let n of a.getGlobalStateRefs()){let s=null!=(t=i.get(n))?t:[];s.push({name:r,value:a.value}),i.set(n,s)}}return i}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,i,r={}
2){if(null==i||!this._validate(aM,`layers.${this.id}.layout.${t}`,t,i,r))return"visibility"===t?(this.visibility=i,this._visibilityExpression.setValue(i),void this.recalculateVisibility()):void this._unevaluatedLayout.setValue(t,i)}getPaintProperty(t){return t.endsWith(aH)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,i,r={}){if(null!=i&&this._validate(aP,`layers.${this.id}.paint.${t}`,t,i,r))return!1;if(t.endsWith(aH))return this._transitionablePaint.setTransition(t.slice(0,-11),i||void 0),!1;{let r=this._transitionablePaint._values[t],a="cross-faded-data-driven"===r.property.specification["property-type"],n=r.value.isDataDriven(),s=r.value;this._transitionablePaint.setValue(t,i),this._handleSpecialPaintPropertyUpdate(t);let o=this._transitionablePaint._values[t].value;return o.isDataDriven()||n||a||this._handleOverridablePaintPropertyUpdate(t,s,o)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,i,r){return!1}isHidden(t=this.minzoom,i=!1){return!!(this.minzoom&&t<(i?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,i){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,i)}
2serialize(){let t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),eb(t,(t,i)=>!(void 0===t||"layout"===i&&!Object.keys(t).length||"paint"===i&&!Object.keys(t).length))}_validate(t,i,r,a,n={}){return(!n||!1!==n.validate)&&aI(this,t.call(ag,{key:i,layerType:this.type,objectKey:r,value:a,styleSpec:eK,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let i=this.paint.get(t);if(i instanceof a1&&rM(i.property.specification)&&("source"===i.value.kind||"composite"===i.value.kind)&&i.value.isStateDependent)return!0}return!1}}var ne={get paint(){return s=s||new a9({"raster-opacity":new a3(eK.paint_raster["raster-opacity"]),"raster-hue-rotate":new a3(eK.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new a3(eK.paint_raster["raster-brightness-min"]),"raster-brightness-max":new a3(eK.paint_raster["raster-brightness-max"]),"raster-saturation":new a3(eK.paint_raster["raster-saturation"]),"raster-contrast":new a3(eK.paint_raster["raster-contrast"]),"raster-resampling":new a3(eK.paint_raster["raster-resampling"]),"raster-fade-duration":new a3(eK.paint_raster["raster-fade-duration"])})}};class nt extends a7{constructor(t,i){super(t,ne,i)}}let ni={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};
2class nr{constructor(t,i){this._structArray=t,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class na{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,i){return t._trim(),i&&(t.isTransferred=!0,i.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let i=Object.create(this.prototype);return i.arrayBuffer=t.arrayBuffer,i.length=t.length,i.capacity=t.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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function nn(t,i=1){let r=0,a=0;return{members:t.map(t=>{let n=ni[t.type].BYTES_PER_ELEMENT,s=r=ns(r,Math.max(i,n)),o=t.components||1;return a=Math.max(a,n),r+=n*o,{name:t.name,type:t.type,components:o,offset:s}}),size:ns(r,Math.max(a,i)),alignment:i}}function ns(t,i){return Math.ceil(t/i)*i}class no extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,i)}emplace(t,i,r){let a=2*t;return this.int16[a+0]=i,this.int16[a+1]=r,t}}no.prototype.bytesPerElement=4,aA("StructArrayLayout2i4",no);class nl extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=3*t;return this.int16[n+0]=i,this.int16[n+1]=r,this.int16[n+2]=a,t}}nl.prototype.bytesPerElement=6,aA("StructArrayLayout3i6",nl);class nh extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,t,i,r,a)}emplace(t,i,r,a,n){let s=4*t;return this.int16[s+0]=i,this.int16[s+1]=r,this.int16[s+2]=a,this.int16[s+3]=n,t}}nh.prototype.bytesPerElement=8,aA("StructArrayLayout4i8",nh);class nu extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,i,r,a,n,s)}emplace(t,i,r,a,n,s,o){let l=6*t;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.int16[l+3]=n,this.int16[l+4]=s,this.int16[l+5]=o,t}}nu.prototype.bytesPerElement=12,aA("StructArrayLayout2i4i12",nu);class nc extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,i,r,a,n,s)}emplace(t,i,r,a,n,s,o){let l=4*t,h=8*t;return this.int16[l+0]=i,this.int16[l+1]=r,this.uint8[h+4]=a,this.uint8[h+5]=n,this.uint8[h+6]=s,this.uint8[h+7]=o,t}}nc.prototype.bytesPerElement=8,aA("StructArrayLayout2i4ub8",nc);class nd extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,i)}emplace(t,i,r){let a=2*t;return this.float32[a+0]=i,this.float32[a+1]=r,t}}nd.prototype.bytesPerElement=8,aA("StructArrayLayout2f8",nd);class np extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l,h,u){let c=this.length;return this.resize(c+1),this.emplace(c,t,i,r,a,n,s,o,l,h,u)}emplace(t,i,r,a,n,s,o,l,h,u,c){let d=10*t;return this.uint16[d+0]=i,this.uint16[d+1]=r,this.uint16[d+2]=a,this.uint16[d+3]=n,this.uint16[d+4]=s,this.uint16[d+5]=o,this.uint16[d+6]=l,this.uint16[d+7]=h,this.uint16[d+8]=u,this.uint16[d+9]=c,t}}np.prototype.bytesPerElement=20,aA("StructArrayLayout10ui20",np);
2class nf extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l){let h=this.length;return this.resize(h+1),this.emplace(h,t,i,r,a,n,s,o,l)}emplace(t,i,r,a,n,s,o,l,h){let u=8*t;return this.uint16[u+0]=i,this.uint16[u+1]=r,this.uint16[u+2]=a,this.uint16[u+3]=n,this.uint16[u+4]=s,this.uint16[u+5]=o,this.uint16[u+6]=l,this.uint16[u+7]=h,t}}nf.prototype.bytesPerElement=16,aA("StructArrayLayout8ui16",nf);class nm extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l,h,u,c,d){let p=this.length;return this.resize(p+1),this.emplace(p,t,i,r,a,n,s,o,l,h,u,c,d)}emplace(t,i,r,a,n,s,o,l,h,u,c,d,p){let f=12*t;return this.int16[f+0]=i,this.int16[f+1]=r,this.int16[f+2]=a,this.int16[f+3]=n,this.uint16[f+4]=s,this.uint16[f+5]=o,this.uint16[f+6]=l,this.uint16[f+7]=h,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=d,this.int16[f+11]=p,t}}nm.prototype.bytesPerElement=24,aA("StructArrayLayout4i4ui4i24",nm);class n_ extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=3*t;return this.float32[n+0]=i,this.float32[n+1]=r,this.float32[n+2]=a,t}}n_.prototype.bytesPerElement=12,aA("StructArrayLayout3f12",n_);class ng extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.uint32[+t+0]=i,t}}ng.prototype.bytesPerElement=4,aA("StructArrayLayout1ul4",ng);class ny extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l,h){let u=this.length;return this.resize(u+1),this.emplace(u,t,i,r,a,n,s,o,l,h)}emplace(t,i,r,a,n,s,o,l,h,u){let c=10*t;return this.int16[c+0]=i,this.int16[c+1]=r,this.int16[c+2]=a,this.int16[c+3]=n,this.int16[c+4]=s,this.int16[c+5]=o,this.uint32[5*t+3]=l,this.uint16[c+8]=h,this.uint16[c+9]=u,t}}ny.prototype.bytesPerElement=20,aA("StructArrayLayout6i1ul2ui20",ny);class nx extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,i,r,a,n,s)}emplace(t,i,r,a,n,s,o){let l=6*t;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.int16[l+3]=n,this.int16[l+4]=s,this.int16[l+5]=o,t}}nx.prototype.bytesPerElement=12,aA("StructArrayLayout2i2i2i12",nx);class nv extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,t,i,r,a,n)}emplace(t,i,r,a,n,s){let o=4*t,l=8*t;return this.float32[o+0]=i,this.float32[o+1]=r,this.float32[o+2]=a,this.int16[l+6]=n,this.int16[l+7]=s,t}}nv.prototype.bytesPerElement=16,aA("StructArrayLayout2f1f2i16",nv);class nb extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,i,r,a,n,s)}emplace(t,i,r,a,n,s,o){let l=16*t,h=4*t,u=8*t;return this.uint8[l+0]=i,this.uint8[l+1]=r,this.float32[h+1]=a,this.float32[h+2]=n,this.int16[u+6]=s,this.int16[u+7]=o,t}}nb.prototype.bytesPerElement=16,aA("StructArrayLayout2ub2f2i16",nb);class nw extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=3*t;return this.uint16[n+0]=i,this.uint16[n+1]=r,this.uint16[n+2]=a,t}}nw.prototype.bytesPerElement=6,aA("StructArrayLayout3ui6",nw);
2class nT extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g){let y=this.length;return this.resize(y+1),this.emplace(y,t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g)}emplace(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y){let x=24*t,v=12*t,b=48*t;return this.int16[x+0]=i,this.int16[x+1]=r,this.uint16[x+2]=a,this.uint16[x+3]=n,this.uint32[v+2]=s,this.uint32[v+3]=o,this.uint32[v+4]=l,this.uint16[x+10]=h,this.uint16[x+11]=u,this.uint16[x+12]=c,this.float32[v+7]=d,this.float32[v+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=m,this.uint8[b+38]=_,this.uint32[v+10]=g,this.int16[x+22]=y,t}}nT.prototype.bytesPerElement=48,aA("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",nT);class nS extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,P,M,I,E){let C=this.length;return this.resize(C+1),this.emplace(C,t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,P,M,I,E)}emplace(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,P,M,I,E,C){let A=32*t,D=16*t;return this.int16[A+0]=i,this.int16[A+1]=r,this.int16[A+2]=a,this.int16[A+3]=n,this.int16[A+4]=s,this.int16[A+5]=o,this.int16[A+6]=l,this.int16[A+7]=h,this.uint16[A+8]=u,this.uint16[A+9]=c,this.uint16[A+10]=d,this.uint16[A+11]=p,this.uint16[A+12]=f,this.uint16[A+13]=m,this.uint16[A+14]=_,this.uint16[A+15]=g,this.uint16[A+16]=y,this.uint16[A+17]=x,this.uint16[A+18]=v,this.uint16[A+19]=b,this.uint16[A+20]=w,this.uint16[A+21]=T,this.uint16[A+22]=S,this.uint32[D+12]=P,this.float32[D+13]=M,this.float32[D+14]=I,this.uint16[A+30]=E,this.uint16[A+31]=C,t}}nS.prototype.bytesPerElement=64,aA("StructArrayLayout8i15ui1ul2f2ui64",nS);class nP extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.float32[+t+0]=i,t}}nP.prototype.bytesPerElement=4,aA("StructArrayLayout1f4",nP);class nM extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=3*t;return this.uint16[6*t+0]=i,this.float32[n+1]=r,this.float32[n+2]=a,t}}nM.prototype.bytesPerElement=12,aA("StructArrayLayout1ui2f12",nM);class nI extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=4*t;return this.uint32[2*t+0]=i,this.uint16[n+2]=r,this.uint16[n+3]=a,t}}nI.prototype.bytesPerElement=8,aA("StructArrayLayout1ul2ui8",nI);class nE extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,i)}emplace(t,i,r){let a=2*t;return this.uint16[a+0]=i,this.uint16[a+1]=r,t}}nE.prototype.bytesPerElement=4,aA("StructArrayLayout2ui4",nE);class nC extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.uint16[+t+0]=i,t}}nC.prototype.bytesPerElement=2,aA("StructArrayLayout1ui2",nC);class nA extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,t,i,r,a)}emplace(t,i,r,a,n){let s=4*t;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,this.float32[s+3]=n,t}}nA.prototype.bytesPerElement=16,aA("StructArrayLayout4f16",nA);class nD extends nr{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]}
2get anchorPoint(){return new w(this.anchorPointX,this.anchorPointY)}}nD.prototype.size=20;class nz extends ny{get(t){return new nD(this,t)}}aA("CollisionBoxArray",nz);class nk extends nr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}nk.prototype.size=48;class nR extends nT{get(t){return new nk(this,t)}}aA("PlacedSymbolArray",nR);class nL extends nr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}nL.prototype.size=64;class nF extends nS{get(t){return new nL(this,t)}}aA("SymbolInstanceArray",nF);
2class nB extends nP{getoffsetX(t){return this.float32[+t+0]}}aA("GlyphOffsetArray",nB);class nO extends nl{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}aA("SymbolLineVertexArray",nO);class nV extends nr{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]}}nV.prototype.size=12;class nj extends nM{get(t){return new nV(this,t)}}aA("TextAnchorOffsetArray",nj);class nN extends nr{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]}}nN.prototype.size=8;class nU extends nI{get(t){return new nN(this,t)}}aA("FeatureIndexArray",nU);class nG extends no{}class nq extends no{}class nZ extends no{}class n$ extends nu{}class nW extends nc{}class nH extends nd{}class nX extends np{}class nY extends nf{}class nK extends nm{}class nJ extends n_{}class nQ extends ng{}class n0 extends nx{}class n1 extends nb{}class n2 extends nw{}class n3 extends nE{}let{members:n5}=nn([{name:"a_pos",components:2,type:"Int16"}],4);class n4{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,i,r,a){let n=this.segments[this.segments.length-1];return t>n4.MAX_VERTEX_ARRAY_LENGTH&&eS(`Max vertices per segment is ${n4.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${n4.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+t>n4.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==a?this.createNewSegment(i,r,a):n}createNewSegment(t,i,r){let a={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==r&&(a.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(a),a}getOrCreateLatestSegment(t,i,r){return this.prepareSegment(0,t,i,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let i in t.vaos)t.vaos[i].destroy()}static simpleSegment(t,i,r,a){return new n4([{vertexOffset:t,primitiveOffset:i,vertexLength:r,primitiveLength:a,vaos:{},sortKey:0}])}}function n6(t,i){return 256*(t=e_(Math.floor(t),0,255))+e_(Math.floor(i),0,255)}n4.MAX_VERTEX_ARRAY_LENGTH=65535,aA("SegmentVector",n4);let n8=nn([{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"}]),n9=nn([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var n7,se,st,si={exports:{}},sr={exports:{}},sa={exports:{}},sn=T(function(){if(st)return si.exports;st=1;var t=(n7||(n7=1,sr.exports=function(t,i){var r,a,n,s,o,l;for(a=t.length-(r=3&t.length),n=i,l=0;l<a;)o=255&t.charCodeAt(l)|(255&t.charCodeAt(++l))<<8|(255&t.charCodeAt(++l))<<16|(255&t.charCodeAt(++l))<<24,++l,n=27492+(65535&(s=5*(65535&(n=(n^=o=(65535&(o=(o=(65535&o)*0xcc9e2d51+(((o>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|o>>>17))*0x1b873593+(((o>>>16)*0x1b873593&65535)<<16)|0)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)|0))+((58964+(s>>>16)&65535)<<16);switch(o=0,r){case 3:o^=(255&t.charCodeAt(l+2))<<16;case 2:o^=(255&t.charCodeAt(l+1))<<8;case 1:n^=o=(65535&(o=(o=(65535&(o^=255&t.charCodeAt(l)))*0xcc9e2d51+(((o>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|o>>>17))*0x1b873593+(((o>>>16)*0x1b873593&65535)<<16)|0}return n^=t.length,n=0x85ebca6b*(65535&(n^=n>>>16))+((0x85ebca6b*(n>>>16)&65535)<<16)|0,n=0xc2b2ae35*(65535&(n^=n>>>13))+((0xc2b2ae35*(n>>>16)&65535)<<16)|0,(n^=n>>>16)>>>0}),sr.exports),i=(se||(se=1,sa.exports=function(t,i){for(var r,a=t.length,n=i^a,s=0;a>=4;)r=0x5bd1e995*(65535&(r=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((0x5bd1e995*(r>>>16)&65535)<<16),n=0x5bd1e995*(65535&n)+((0x5bd1e995*(n>>>16)&65535)<<16)^(r=0x5bd1e995*(65535&(r^=r>>>24))+((0x5bd1e995*(r>>>16)&65535)<<16)),a-=4,++s;switch(a){case 3:n^=(255&t.charCodeAt(s+2))<<16;case 2:n^=(255&t.charCodeAt(s+1))<<8;case 1:n=0x5bd1e995*(65535&(n^=255&t.charCodeAt(s)))+((0x5bd1e995*(n>>>16)&65535)<<16)}return n=0x5bd1e995*(65535&(n^=n>>>13))+((0x5bd1e995*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}
2),sa.exports);return si.exports=t,si.exports.murmur3=t,si.exports.murmur2=i,si.exports}());class ss{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,i,r,a){this.ids.push(so(t)),this.positions.push(i,r,a)}getPositions(t){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let i=so(t),r=0,a=this.ids.length-1;for(;r<a;){let t=r+a>>1;this.ids[t]>=i?a=t:r=t+1}let n=[];for(;this.ids[r]===i;)n.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return n}static serialize(t,i){let r=new Float64Array(t.ids),a=new Uint32Array(t.positions);return function t(i,r,a,n){for(;a<n;){let s=i[a+n>>1],o=a-1,l=n+1;for(;;){do o++;while(i[o]<s);do l--;while(i[l]>s);if(o>=l)break;sl(i,o,l),sl(r,3*o,3*l),sl(r,3*o+1,3*l+1),sl(r,3*o+2,3*l+2)}l-a<n-l?(t(i,r,a,l),a=l+1):(t(i,r,l+1,n),n=l)}}(r,a,0,r.length-1),i&&i.push(r.buffer,a.buffer),{ids:r,positions:a}}static deserialize(t){let i=new ss;return i.ids=t.ids,i.positions=t.positions,i.indexed=!0,i}}function so(t){let i=+t;return!isNaN(i)&&i<=Number.MAX_SAFE_INTEGER?i:sn(String(t))}function sl(t,i,r){let a=t[i];t[i]=t[r],t[r]=a}aA("FeaturePositionMap",ss);class sh{constructor(t,i){this.gl=t.gl,this.location=i}}class su extends sh{constructor(t,i){super(t,i),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class sc extends sh{constructor(t,i){super(t,i),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class sd extends sh{constructor(t,i){super(t,i),this.current=tG.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}let sp=new Float32Array(16);function sf(t){return[n6(255*t.r,255*t.g),n6(255*t.b,255*t.a)]}class sm{constructor(t,i,r){this.value=t,this.uniformNames=i.map(t=>`u_${t}`),this.type=r}setUniform(t,i,r){t.set(r.constantOr(this.value))}getBinding(t,i,r){return"color"===this.type?new sd(t,i):new su(t,i)}}class s_{constructor(t,i){this.uniformNames=i.map(t=>`u_${t}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,i){this.pixelRatioFrom=i.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=i.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,i){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,i.y,i.height,i.width]}setUniform(t,i,r,a){let n=null;"u_pattern_to"===a?n=this.patternTo:"u_pattern_from"===a?n=this.patternFrom:"u_dasharray_to"===a?n=this.dashTo:"u_dasharray_from"===a?n=this.dashFrom:"u_pixel_ratio_to"===a?n=this.pixelRatioTo:"u_pixel_ratio_from"===a&&(n=this.pixelRatioFrom),null!==n&&t.set(n)}getBinding(t,i,r){return"u_pattern"===r.substr(0,9)||"u_dasharray_"===r.substr(0,12)?new sc(t,i):new su(t,i)}}class sg{constructor(t,i,r,a){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=i.map(t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,i,r){let a=this.paintVertexArray.length,n=this.expression.evaluate(new a$(0,r),i,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(a,t,n)}updatePaintArray(t,i,r,a,n){let s=this.expression.evaluate(new a$(0,n),r,a);this._setPaintValue(t,i,s)}_setPaintValue(t,i,r){if("color"===this.type){let a=sf(r);for(let r=t;r<i;r++)this.paintVertexArray.emplace(r,a[0],a[1])}else{for(let a=t;a<i;a++)this.paintVertexArray.emplace(a,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class sy{constructor(t,i,r,a,n,s){this.expression=t,this.uniformNames=i.map(t=>`u_${t}_t`),this.type=r,this.useIntegerZoom=a,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=i.map(t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new s}populatePaintArray(t,i,r){let a=this.expression.evaluate(new a$(this.zoom,r),i,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new a$(this.zoom+1,r),i,{},r.canonical,[],r.formattedSection),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,a,n)}updatePaintArray(t,i,r,a,n){let s=this.expression.evaluate(new a$(this.zoom,n),r,a),o=this.expression.evaluate(new a$(this.zoom+1,n),r,a);this._setPaintValue(t,i,s,o)}_setPaintValue(t,i,r,a){if("color"===this.type){let n=sf(r),s=sf(a);for(let r=t;r<i;r++)this.paintVertexArray.emplace(r,n[0],n[1],s[0],s[1])}else{for(let n=t;n<i;n++)this.paintVertexArray.emplace(n,r,a);
2this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(a))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,i){let r=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,a=e_(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(a)}getBinding(t,i,r){return new su(t,i)}}class sx{constructor(t,i,r,a,n,s){this.expression=t,this.type=i,this.useIntegerZoom=r,this.zoom=a,this.layerId=s,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,i,r){let a=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(a,t,this.getPositionIds(i),r)}updatePaintArray(t,i,r,a,n){this._setPaintValues(t,i,this.getPositionIds(r),n)}_setPaintValues(t,i,r,a){let n=this.getPositions(a);if(!n||!r)return;let s=n[r.min],o=n[r.mid],l=n[r.max];if(s&&o&&l)for(let r=t;r<i;r++)this.emplace(this.zoomInPaintVertexArray,r,o,s),this.emplace(this.zoomOutPaintVertexArray,r,o,l)}upload(t){if(this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer){let i=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,i,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,i,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class sv extends sx{getPositions(t){return t.imagePositions}getPositionIds(t){return t.patterns&&t.patterns[this.layerId]}getVertexAttributes(){return n8.members}emplace(t,i,r,a){t.emplace(i,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],a.tlbr[0],a.tlbr[1],a.tlbr[2],a.tlbr[3],r.pixelRatio,a.pixelRatio)}}class sb extends sx{getPositions(t){return t.dashPositions}getPositionIds(t){return t.dashes&&t.dashes[this.layerId]}getVertexAttributes(){return n9.members}emplace(t,i,r,a){t.emplace(i,0,r.y,r.height,r.width,0,a.y,a.height,a.width)}}class sw{constructor(t,i,r){this.binders={},this._buffers=[];const a=[];for(const n in t.paint._values){if(!r(n))continue;const s=t.paint.get(n);if(!(s instanceof a1&&rM(s.property.specification)))continue;const o=function(t,i){return({"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]})[t]||[t.replace(`${i}-`,"").replace(/-/g,"_")]}(n,t.type),l=s.value,h=s.property.specification.type,u=s.property.useIntegerZoom,c=s.property.specification["property-type"],d="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===l.kind)this.binders[n]=d?new s_(l.value,o):new sm(l.value,o,h),a.push(`/u_${n}`);else if("source"===l.kind||d){const r=sS(n,h,"source");this.binders[n]=d?"line-dasharray"===n?new sb(l,h,u,i,r,t.id):new sv(l,h,u,i,r,t.id):new sg(l,o,h,r),a.push(`/a_${n}`)}else{const t=sS(n,h,"composite");this.binders[n]=new sy(l,o,h,u,i,t),a.push(`/z_${n}`)}}this.cacheKey=a.sort().join("")}getMaxValue(t){let i=this.binders[t];return i instanceof sg||i instanceof sy?i.maxValue:0}populatePaintArrays(t,i,r){for(let a in this.binders){let n=this.binders[a];(n instanceof sg||n instanceof sy||n instanceof sx)&&n.populatePaintArray(t,i,r)}}setConstantPatternPositions(t,i){for(let r in this.binders){let a=this.binders[r];a instanceof s_&&a.setConstantPatternPositions(t,i)}}setConstantDashPositions(t,i){for(let r in this.binders){let a=this.binders[r];a instanceof s_&&a.setConstantDashPositions(t,i)}}updatePaintArrays(t,i,r,a,n){let s=!1;for(let o in t)for(let l of i.getPositions(o)){let i=r.feature(l.index);for(let r in this.binders){let h=this.binders[r];(h instanceof sg||h instanceof sy||h instanceof sx)&&!0===h.expression.isStateDependent&&(h.expression=a.paint.get(r).value,h.updatePaintArray(l.start,l.end,i,t[o],n),s=!0)}}return s}defines(){let t=[];for(let i in this.binders){let r=this.binders[i];(r instanceof sm||r instanceof s_)&&t.push(...r.uniformNames.map(t=>`#define HAS_UNIFORM_${t}`))}return t}getBinderAttributes(){let t=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof sg||r instanceof sy)for(let i=0;i<r.paintVertexAttributes.length;i++)t.push(r.paintVertexAttributes[i].name);else if(r instanceof sx)for(let i of r.getVertexAttributes())t.push(i.name)}return t}getBinderUniforms(){let t=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof sm||r instanceof s_||r instanceof sy)for(let i of r.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,i){let r=[];for(let a in this.binders){let n=this.binders[a];if(n instanceof sm||n instanceof s_||n instanceof sy){for(let s of n.uniformNames)if(i[s]){let o=n.getBinding(t,i[s],s);r.push({name:s,property:a,binding:o})}}}return r}setUniforms(t,i,r,a){for(let{name:t,property:n,binding:s}of i)this.binders[n].setUniform(s,a,r.get(n),t)}updatePaintBuffers(t){for(let i in this._buffers=[],this.binders){let r=this.binders[i];if(t&&r instanceof sx){let i=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof sg||r instanceof sy)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(let i in this.binders){let r=this.binders[i];(r instanceof sg||r instanceof sy||r instanceof sx)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let i=this.binders[t];(i instanceof sg||i instanceof sy||i instanceof sx)&&i.destroy()}}}class sT{constructor(t,i,r=()=>!0){for(const a of(this.programConfigurations={},t))this.programConfigurations[a.id]=new sw(a,i,r);this.needsUpload=!1,this._featureMap=new ss,this._bufferOffset=0}populatePaintArrays(t,i,r,a){for(let r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,i,a);void 0!==i.id&&this._featureMap.add(i.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,i,r,a){for(let n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,i,n,a)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let i in this.programConfigurations)this.programConfigurations[i].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}}function sS(t,i,r){let a={"line-pattern":{source:nX,composite:nX}
2,"fill-pattern":{source:nX,composite:nX},"fill-extrusion-pattern":{source:nX,composite:nX},"line-dasharray":{source:nY,composite:nY}}[t];return a&&a[r]||({color:{source:nd,composite:nA},number:{source:nP,composite:nd}})[i][r]}aA("ConstantBinder",sm),aA("CrossFadedConstantBinder",s_),aA("SourceExpressionBinder",sg),aA("CrossFadedPatternBinder",sv),aA("CrossFadedDasharrayBinder",sb),aA("CompositeExpressionBinder",sy),aA("ProgramConfiguration",sw,{omit:["_buffers"]}),aA("ProgramConfigurationSet",sT);let sP=-16383-1;function sM(t){let i=8192/t.extent,r=t.loadGeometry();for(let t=0;t<r.length;t++){let a=r[t];for(let t=0;t<a.length;t++){let r=a[t],n=Math.round(r.x*i),s=Math.round(r.y*i);r.x=e_(n,sP,16383),r.y=e_(s,sP,16383),(n<r.x||n>r.x+1||s<r.y||s>r.y+1)&&eS("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function sI(t,i){return{type:t.type,id:t.id,properties:t.properties,geometry:i?sM(t):[]}}class sE{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new nq,this.indexArray=new n2,this.segments=new n4,this.programConfigurations=new sT(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,i,r){let a=this.layers[0],n=[],s=null,o=!1,l="heatmap"===a.type;"circle"===a.type&&(o=!(s=a.layout.get("circle-sort-key")).isConstant(),l=l||"map"===a.paint.get("circle-pitch-alignment"));let h=l?i.subdivisionGranularity.circle:1;for(let{feature:i,id:a,index:l,sourceLayerIndex:h}of t){let t=this.layers[0]._featureFilter.needGeometry,u=sI(i,t);if(!this.layers[0]._featureFilter.filter(new a$(this.zoom),u,r))continue;let c=o?s.evaluate(u,{},r):void 0,d={id:a,properties:i.properties,type:i.type,sourceLayerIndex:h,index:l,geometry:t?u.geometry:sM(i),patterns:{},sortKey:c};n.push(d)}for(let a of(o&&n.sort((t,i)=>t.sortKey-i.sortKey),n)){let{geometry:n,index:s,sourceLayerIndex:o}=a,l=t[s].feature;this.addFeature(a,n,s,r,h),i.featureIndex.insert(l,n,s,o,this.index)}}update(t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,n5),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,i,r,a,n=1){let s;switch(n){case 1:s=[0,7];break;case 3:s=[0,2,5,7];break;case 5:s=[0,1,3,4,6,7];break;case 7:s=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let o=s.length;for(let r of i)for(let i of r){let r=i.x,a=i.y;if(r<0||r>=8192||a<0||a>=8192)continue;let n=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,t.sortKey),c=n.vertexLength;for(let t=0;t<o;t++)for(let i=0;i<o;i++){var l,h,u;l=this.layoutVertexArray,h=s[i],u=s[t],l.emplaceBack(-32768+8*r+h,-32768+8*a+u)}for(let t=0;t<o-1;t++)for(let i=0;i<o-1;i++){let r=c+t*o+i,a=c+(t+1)*o+i;this.indexArray.emplaceBack(r,a+1,r+1),this.indexArray.emplaceBack(r,a,a+1)}n.vertexLength+=o*o,n.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:{},canonical:a})}}function sC(t,i){for(let r=0;r<t.length;r++)if(sF(i,t[r]))return!0;for(let r=0;r<i.length;r++)if(sF(t,i[r]))return!0;return!!sz(t,i)}function sA(t,i,r){return!!sF(t,i)||!!sk(i,t,r)}function sD(t,i){if(1===t.length)return sL(i,t[0]);for(let r=0;r<i.length;r++){let a=i[r];for(let i=0;i<a.length;i++)if(sF(t,a[i]))return!0}for(let r=0;r<t.length;r++)if(sL(i,t[r]))return!0;for(let r=0;r<i.length;r++)if(sz(t,i[r]))return!0;return!1}function sz(t,i){if(0===t.length||0===i.length)return!1;for(let o=0;o<t.length-1;o++){let l=t[o],h=t[o+1];for(let t=0;t<i.length-1;t++){var r,a,n,s;if(r=l,a=h,n=i[t],eP(r,n,s=i[t+1])!==eP(a,n,s)&&eP(r,a,n)!==eP(r,a,s))return!0}}return!1}function sk(t,i,r){let a=r*r;if(1===i.length)return t.distSqr(i[0])<a;for(let r=1;r<i.length;r++)if(sR(t,i[r-1],i[r])<a)return!0;return!1}function sR(t,i,r){let a=i.distSqr(r);if(0===a)return t.distSqr(i);let n=((t.x-i.x)*(r.x-i.x)+(t.y-i.y)*(r.y-i.y))/a;return t.distSqr(n<0?i:n>1?r:r.sub(i)._mult(n)._add(i))}function sL(t,i){let r,a,n,s=!1;for(let o=0;o<t.length;o++){r=t[o];for(let t=0,o=r.length-1;t<r.length;o=t++)a=r[t],n=r[o],a.y>i.y!=n.y>i.y&&i.x<(n.x-a.x)*(i.y-a.y)/(n.y-a.y)+a.x&&(s=!s)}return s}function sF(t,i){let r=!1;for(let a=0,n=t.length-1;a<t.length;n=a++){let s=t[a],o=t[n];s.y>i.y!=o.y>i.y&&i.x<(o.x-s.x)*(i.y-s.y)/(o.y-s.y)+s.x&&(r=!r)}return r}function sB(t,i,r){let a=i.paint.get(t).value;return"constant"===a.kind?a.value:r.programConfigurations.get(i.id).getMaxValue(t)}function sO(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function sV(t,i,r,a,n){if(!i[0]&&!i[1])return t;let s=w.convert(i)._mult(n);"viewport"===r&&s._rotate(-a);let o=[];for(let i=0;i<t.length;i++)o.push(t[i].sub(s));return o}function sj({queryGeometry:t,size:i},r){return sA(t,r,i)}function sN({queryGeometry:t,size:i,transform:r,unwrappedTileID:a,getElevation:n},s){return sA(t,s,i*(r.projectTileCoordinates(s.x,s.y,a,n).signedDistanceFromCamera/r.cameraToCenterDistance))}function sU({queryGeometry:t,size:i,transform:r,unwrappedTileID:a,getElevation:n},s){let o=r.projectTileCoordinates(s.x,s.y,a,n).signedDistanceFromCamera,l=i*(r.cameraToCenterDistance/o);return sA(t,sZ(s,r,a,n),l)}function sG({queryGeometry:t,size:i,transform:r,unwrappedTileID:a,getElevation:n},s){return sA(t,sZ(s,r,a,n),i)}function sq({queryGeometry:t,size:i,transform:r,unwrappedTileID:a,getElevation:n,pitchAlignment:s="map",pitchScale:o="map"},l){let h="map"===s?"map"===o?sj:sN:"map"===o?sU:sG,u={queryGeometry:t,size:i,transform:r,unwrappedTileID:a,getElevation:n};for(let t of l)for(let i of t)if(h(u,i))return!0;return!1}function sZ(t,i,r,a){let n=i.projectTileCoordinates(t.x,t.y,r,a).point;return new w((.5*n.x+.5)*i.width,(-(.5*n.y)+.5)*i.height)}aA("CircleBucket",sE,{omit:["layers"]});var s$={get paint(){return l=l||new a9({"circle-radius":new a5(eK.paint_circle["circle-radius"]),"circle-color":new a5(eK.paint_circle["circle-color"]),"circle-blur":new a5(eK.paint_circle["circle-blur"]),"circle-opacity":new a5(eK.paint_circle["circle-opacity"]),"circle-translate":new a3(eK.paint_circle["circle-translate"]),"circle-translate-anchor":new a3(eK.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new a3(eK.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new a3(eK.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new a5(eK.paint_circle["circle-stroke-width"]),"circle-stroke-color":new a5(eK.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new a5(eK.paint_circle["circle-stroke-opacity"])})},get layout(){return o=o||new a9({"circle-sort-key":new a5(eK.layout_circle["circle-sort-key"])})}};
2class sW extends a7{constructor(t,i){super(t,s$,i)}createBucket(t){return new sE(t)}queryRadius(t){return sB("circle-radius",this,t)+sB("circle-stroke-width",this,t)+sO(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:r,geometry:a,transform:n,pixelsToTileUnits:s,unwrappedTileID:o,getElevation:l}){let h,u,c=sV(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,s),d=this.paint.get("circle-radius").evaluate(i,r)+this.paint.get("circle-stroke-width").evaluate(i,r),p=this.paint.get("circle-pitch-scale"),f=this.paint.get("circle-pitch-alignment");return"map"===f?(h=c,u=d*s):(h=c.map(t=>sZ(t,n,o,l)),u=d),sq({queryGeometry:h,size:u,transform:n,unwrappedTileID:o,getElevation:l,pitchAlignment:f,pitchScale:p},a)}}class sH extends sE{}aA("HeatmapBucket",sH,{omit:["layers"]});var sX={get paint(){return h=h||new a9({"heatmap-radius":new a5(eK.paint_heatmap["heatmap-radius"]),"heatmap-weight":new a5(eK.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new a3(eK.paint_heatmap["heatmap-intensity"]),"heatmap-color":new a8(eK.paint_heatmap["heatmap-color"]),"heatmap-opacity":new a3(eK.paint_heatmap["heatmap-opacity"])})}};function sY(t,{width:i,height:r}
2,a,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==i*r*a)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${i*r*a}`)}else n=new Uint8Array(i*r*a);return t.width=i,t.height=r,t.data=n,t}function sK(t,{width:i,height:r},a){if(i===t.width&&r===t.height)return;let n=sY({},{width:i,height:r},a);sJ(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,i),height:Math.min(t.height,r)},a),t.width=i,t.height=r,t.data=n.data}function sJ(t,i,r,a,n,s){if(0===n.width||0===n.height)return i;if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>i.width||n.height>i.height||a.x>i.width-n.width||a.y>i.height-n.height)throw RangeError("out of range destination coordinates for image copy");let o=t.data,l=i.data;if(o===l)throw Error("srcData equals dstData, so image is already copied");for(let h=0;h<n.height;h++){let u=((r.y+h)*t.width+r.x)*s,c=((a.y+h)*i.width+a.x)*s;for(let t=0;t<n.width*s;t++)l[c+t]=o[u+t]}return i}class sQ{constructor(t,i){sY(this,t,1,i)}resize(t){sK(this,t,1)}clone(){return new sQ({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,a,n){sJ(t,i,r,a,n,1)}}class s0{constructor(t,i){sY(this,t,4,i)}resize(t){sK(this,t,4)}replace(t,i){i?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new s0({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,a,n){sJ(t,i,r,a,n,4)}setPixel(t,i,r){let a=4*(t*this.width+i);this.data[a+0]=Math.round(255*r.r/r.a),this.data[a+1]=Math.round(255*r.g/r.a),this.data[a+2]=Math.round(255*r.b/r.a),this.data[a+3]=Math.round(255*r.a)}}function s1(t){let i={},r=t.resolution||256,a=t.clips?t.clips.length:1,n=t.image||new s0({width:r,height:a});if(Math.log(r)/Math.LN2%1!=0)throw Error(`width is not a power of 2 - ${r}`);let s=(a,s,o)=>{i[t.evaluationKey]=o;let l=t.expression.evaluate(i);n.setPixel(a/4/r,s/4,l)};if(t.clips)for(let i=0,n=0;i<a;++i,n+=4*r)for(let a=0,o=0;a<r;a++,o+=4){let l=a/(r-1),{start:h,end:u}=t.clips[i];s(n,o,h*(1-l)+u*l)}else for(let t=0,i=0;t<r;t++,i+=4)s(0,i,t/(r-1));return n}aA("AlphaImage",sQ),aA("RGBAImage",s0);let s2="big-fb";
2class s3 extends a7{createBucket(t){return new sH(t)}constructor(t,i){super(t,sX,i),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=s1({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(s2)&&this.heatmapFbos.delete(s2)}queryRadius(t){return sB("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:r,geometry:a,transform:n,pixelsToTileUnits:s,unwrappedTileID:o,getElevation:l}){return sq({queryGeometry:t,size:this.paint.get("heatmap-radius").evaluate(i,r)*s,transform:n,unwrappedTileID:o,getElevation:l},a)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}}var s5={get paint(){return u=u||new a9({"hillshade-illumination-direction":new a3(eK.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new a3(eK.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new a3(eK.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new a3(eK.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new a3(eK.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new a3(eK.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new a3(eK.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new a3(eK.paint_hillshade["hillshade-method"])})}};class s4 extends a7{constructor(t,i){super(t,s5,i),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,i=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,a=this.paint.get("hillshade-shadow-color").values,n=Math.max(t.length,i.length,r.length,a.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),a=a.concat(Array(n-a.length).fill(a.at(-1)));let s=i.map(ez);return{directionRadians:t.map(ez),altitudeRadians:s,shadowColor:a,highlightColor:r}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}}var s6={get paint(){return c=c||new a9({"color-relief-opacity":new a3(eK["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new a8(eK["paint_color-relief"]["color-relief-color"])})}};class s8{constructor(t,i,r,a){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(i,a)}update(t,i,r){let{width:a,height:n}=t,s=!(this.size&&this.size[0]===a&&this.size[1]===n||r),{context:o}=this,{gl:l}=o;if(this.useMipmap=!!(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1),o.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),s)this.size=[a,n],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||eE(t)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,t):l.texImage2D(l.TEXTURE_2D,0,this.format,a,n,0,this.format,l.UNSIGNED_BYTE,t.data);else{let{x:i,y:s}=r||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||eE(t)?l.texSubImage2D(l.TEXTURE_2D,0,i,s,l.RGBA,l.UNSIGNED_BYTE,t):l.texSubImage2D(l.TEXTURE_2D,0,i,s,a,n,l.RGBA,l.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(t,i,r){let{context:a}=this,{gl:n}=a;n.bindTexture(n.TEXTURE_2D,this.texture),r!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(r=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||t),this.filter=t),i!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,i),n.texParameteri(n.TEXTURE_2D,n.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(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class s9{constructor(t,i,r,a=1,n=1,s=1,o=0){if(this.uid=t,i.height!==i.width)throw RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r))return void eS(`"${r}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=i.height;const l=this.dim=i.height-2;switch(this.data=new Uint32Array(i.data.buffer),r){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;
2case"custom":this.redFactor=a,this.greenFactor=n,this.blueFactor=s,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let t=0;t<l;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(l,t)]=this.data[this._idx(l-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,l)]=this.data[this._idx(t,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<l;t++)for(let i=0;i<l;i++){const r=this.get(t,i);r>this.max&&(this.max=r),r<this.min&&(this.min=r)}}get(t,i){let r=new Uint8Array(this.data.buffer),a=4*this._idx(t,i);return this.unpack(r[a],r[a+1],r[a+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,i){if(t<-1||t>=this.dim+1||i<-1||i>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${i}, dim: ${this.dim}`);return(i+1)*this.stride+(t+1)}unpack(t,i,r){return t*this.redFactor+i*this.greenFactor+r*this.blueFactor-this.baseShift}pack(t){return s7(t,this.getUnpackVector())}getPixels(){return new s0({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,i,r){if(this.dim!==t.dim)throw Error("dem dimension mismatch");let a=i*this.dim,n=i*this.dim+this.dim,s=r*this.dim,o=r*this.dim+this.dim;switch(i){case -1:a=n-1;break;case 1:n=a+1}switch(r){case -1:s=o-1;break;case 1:o=s+1}let l=-i*this.dim,h=-r*this.dim;for(let i=s;i<o;i++)for(let r=a;r<n;r++)this.data[this._idx(r,i)]=t.data[this._idx(r+l,i+h)]}}function s7(t,i){let r=i[0],a=i[1],n=i[2],s=i[3],o=Math.min(r,a,n),l=Math.round((t+s)/o);return{r:Math.floor(l*o/r)%256,g:Math.floor(l*o/a)%256,b:Math.floor(l*o/n)%256}}aA("DEMData",s9);class oe extends a7{constructor(t,i){super(t,s6,i)}_createColorRamp(t){let i={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof rj&&r._styleExpression.expression instanceof iT){this.colorRampExpression=r;let t=r._styleExpression.expression;for(let r of(i.elevationStops=t.labels,i.colorStops=[],i.elevationStops))i.colorStops.push(t.evaluate({globals:{elevation:r}}))}if(i.elevationStops.length<1&&(i.elevationStops=[0],i.colorStops=[tG.transparent]),i.elevationStops.length<2&&(i.elevationStops.push(i.elevationStops[0]+1),i.colorStops.push(i.colorStops[0])),i.elevationStops.length<=t)return i;let a={elevationStops:[],colorStops:[]},n=(i.elevationStops.length-1)/(t-1);for(let t=0;t<i.elevationStops.length-.5;t+=n)a.elevationStops.push(i.elevationStops[Math.round(t)]),a.colorStops.push(i.colorStops[Math.round(t)]);return eS(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${i.elevationStops.length}`),a}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,i,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let a=this._createColorRamp(i),n=new s0({width:a.colorStops.length,height:1}),s=new s0({width:a.colorStops.length,height:1});for(let t=0;t<a.elevationStops.length;t++){let i=s7(a.elevationStops[t],r);s.setPixel(0,t,new tG(i.r/255,i.g/255,i.b/255,1)),n.setPixel(0,t,a.colorStops[t])}return this.colorRampTextures={elevationTexture:new s8(t,s,t.gl.RGBA),colorTexture:new s8(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}let{members:ot}=nn([{name:"a_pos",components:2,type:"Int16"}],4);function oi(t,i,r){let a=r.patternDependencies,n=!1;for(let r of i){let i=r.paint.get(`${t}-pattern`);i.isConstant()||(n=!0);let s=i.constantOr(null);s&&(n=!0,a[s.to]=!0,a[s.from]=!0)}return n}function or(t,i,r,a,n){let{zoom:s}=a,o=n.patternDependencies;for(let a of i){let i=a.paint.get(`${t}-pattern`).value;if("constant"!==i.kind){let t=i.evaluate({zoom:s-1},r,{},n.availableImages),l=i.evaluate({zoom:s},r,{},n.availableImages),h=i.evaluate({zoom:s+1},r,{},n.availableImages);t=t&&t.name?t.name:t,l=l&&l.name?l.name:l,h=h&&h.name?h.name:h,o[t]=!0,o[l]=!0,o[h]=!0,r.patterns[a.id]={min:t,mid:l,max:h}}}return r}function oa(t,i,r,a,n){let s;if(n===function(t,i,r,a){let n=0;for(let s=i,o=r-a;s<r;s+=a)n+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return n}(t,i,r,a)>0)for(let n=i;n<r;n+=a)s=og(n/a|0,t[n],t[n+1],s);else for(let n=r-a;n>=i;n-=a)s=og(n/a|0,t[n],t[n+1],s);return s&&oc(s,s.next)&&(oy(s),s=s.next),s}function on(t,i){if(!t)return t;i||(i=t);let r,a=t;do if(r=!1,a.steiner||!oc(a,a.next)&&0!==ou(a.prev,a,a.next))a=a.next;else{if(oy(a),(a=i=a.prev)===a.next)break;r=!0}while(r||a!==i);return i}function os(t,i){let r=t.x-i.x;return 0===r&&0==(r=t.y-i.y)&&(r=(t.next.y-t.y)/(t.next.x-t.x)-(i.next.y-i.y)/(i.next.x-i.x)),r}function oo(t,i,r,a,n){return(t=0x55555555&((t=0x33333333&((t=0xf0f0f0f&((t=0xff00ff&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(i=0x55555555&((i=0x33333333&((i=0xf0f0f0f&((i=0xff00ff&((i=(i-a)*n|0)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function ol(t,i,r,a,n,s,o,l){return(n-o)*(i-l)>=(t-o)*(s-l)&&(t-o)*(a-l)>=(r-o)*(i-l)&&(r-o)*(s-l)>=(n-o)*(a-l)}function oh(t,i,r,a,n,s,o,l){return(t!==o||i!==l)&&ol(t,i,r,a,n,s,o,l)}function ou(t,i,r){return(i.y-t.y)*(r.x-i.x)-(i.x-t.x)*(r.y-i.y)}function oc(t,i){return t.x===i.x&&t.y===i.y}function od(t,i,r,a){let n=of(ou(t,i,r)),s=of(ou(t,i,a)),o=of(ou(r,a,t)),l=of(ou(r,a,i));return n!==s&&o!==l||!(0!==n||!op(t,r,i))||!(0!==s||!op(t,a,i))||!(0!==o||!op(r,t,a))||!(0!==l||!op(r,i,a))}function op(t,i,r){return i.x<=Math.max(t.x,r.x)&&i.x>=Math.min(t.x,r.x)&&i.y<=Math.max(t.y,r.y)&&i.y>=Math.min(t.y,r.y)}function of(t){return t>0?1:t<0?-1:0}function om(t,i){return 0>ou(t.prev,t,t.next)?ou(t,i,t.next)>=0&&ou(t,t.prev,i)>=0:0>ou(t,i,t.prev)||0>ou(t,t.next,i)}function o_(t,i){let r=ox(t.i,t.x,t.y),a=ox(i.i,i.x,i.y),n=t.next,s=i.prev;return t.next=i,i.prev=t,r.next=n,n.prev=r,a.next=r,r.prev=a,s.next=a,a.prev=s,a}function og(t,i,r,a){let n=ox(t,i,r);return a?(n.next=a.next,n.prev=a,a.next.prev=n,a.next=n):(n.prev=n,n.next=n),n}function oy(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ox(t,i,r){return{i:t,x:i,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class ov{constructor(t,i){if(i>t)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=i}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class ob{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}ob.noSubdivision=new ob({fill:new ov(0,0),line:new ov(0,0),tile:new ov(0,0),stencil:new ov(0,0),circle:1}),aA("SubdivisionGranularityExpression",ov),aA("SubdivisionGranularitySetting",ob);class ow{constructor(t,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=8192/t,this._canonical=i}_getKey(t,i){return(t+=32768)<<16|i+32768}_vertexToIndex(t,i){if(t<-32768||i<-32768||t>32767||i>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let r=0|Math.round(t),a=0|Math.round(i),n=this._getKey(r,a);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let s=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,s),this._vertexBuffer.push(r,a),s}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(t,i){let r=[];for(let a=0;a<i.length;a+=3){let n=i[a],s=i[a+1],o=i[a+2],l=t[2*n],h=t[2*n+1];(t[2*s]-l)*(t[2*o+1]-h)-(t[2*s+1]-h)*(t[2*o]-l)>0?(r.push(n),r.push(o),r.push(s)):(r.push(n),r.push(s),r.push(o))}return r}(this._vertexBuffer,t);let i=[],r=t.length;for(let a=0;a<r;a+=3){let r=[t[a+0],t[a+1],t[a+2]],n=[this._vertexBuffer[2*t[a+0]+0],this._vertexBuffer[2*t[a+0]+1],this._vertexBuffer[2*t[a+1]+0],this._vertexBuffer[2*t[a+1]+1],this._vertexBuffer[2*t[a+2]+0],this._vertexBuffer[2*t[a+2]+1]],s=1/0,o=1/0,l=-1/0,h=-1/0;for(let t=0;t<3;t++){let i=n[2*t],r=n[2*t+1];s=Math.min(s,i),l=Math.max(l,i),o=Math.min(o,r),h=Math.max(h,r)}if(s===l||o===h)continue;let u=Math.floor(s/this._granularityCellSize),c=Math.ceil(l/this._granularityCellSize),d=Math.floor(o/this._granularityCellSize),p=Math.ceil(h/this._granularityCellSize);if(u!==c||d!==p)for(let t=d;t<p;t++){let a=this._scanlineGenerateVertexRingForCellRow(t,n,r);!function(t,i,r){if(0===i.length)throw Error("Subdivision vertex ring is empty.");let a=0,n=t[2*i[0]];for(let r=1;r<i.length;r++){let s=t[2*i[r]];s<n&&(n=s,a=r)}let s=i.length,o=a,l=(o+1)%s;for(;;){let a=o-1>=0?o-1:s-1,n=(l+1)%s,h=t[2*i[a]],u=t[2*i[n]],c=t[2*i[o]],d=t[2*i[o]+1],p=t[2*i[l]+1],f=!1;if(h<u)f=!0;else if(h>u)f=!1;else{let r=p-d,s=-(t[2*i[l]]-c),o=d<p?1:-1;((h-c)*r+(t[2*i[a]+1]-d)*s)*o>((u-c)*r+(t[2*i[n]+1]-d)*s)*o&&(f=!0)}if(f){let t=i[a],n=i[o],h=i[l];t!==n&&t!==h&&n!==h&&r.push(h,n,t),--o<0&&(o=s-1)}else{let t=i[n],a=i[o],h=i[l];t!==a&&t!==h&&a!==h&&r.push(h,a,t),++l>=s&&(l=0)}
2if(a===n)break}}(this._vertexBuffer,a,i)}else i.push(...r)}return i}_scanlineGenerateVertexRingForCellRow(t,i,r){let a=t*this._granularityCellSize,n=a+this._granularityCellSize,s=[];for(let t=0;t<3;t++){let o=i[2*t],l=i[2*t+1],h=i[2*(t+1)%6],u=i[(2*(t+1)+1)%6],c=i[2*(t+2)%6],d=i[(2*(t+2)+1)%6],p=h-o,f=u-l,m=0===p,_=0===f,g=(a-l)/f,y=(n-l)/f,x=Math.min(g,y),v=Math.max(g,y);if(!_&&(x>=1||v<=0)||_&&(l<a||l>n)){u>=a&&u<=n&&s.push(r[(t+1)%3]);continue}!_&&x>0&&s.push(this._vertexToIndex(o+p*x,l+f*x));let b=o+p*Math.max(x,0),w=o+p*Math.min(v,1);m||this._generateIntraEdgeVertices(s,o,l,h,u,b,w),!_&&v<1&&s.push(this._vertexToIndex(o+p*v,l+f*v)),(_||u>=a&&u<=n)&&s.push(r[(t+1)%3]),!_&&(u<=a||u>=n)&&this._generateInterEdgeVertices(s,o,l,h,u,c,d,w,a,n)}return s}_generateIntraEdgeVertices(t,i,r,a,n,s,o){let l=a-i,h=n-r,u=0===h,c=u?Math.min(i,a):Math.min(s,o),d=u?Math.max(i,a):Math.max(s,o),p=Math.floor(c/this._granularityCellSize)+1,f=Math.ceil(d/this._granularityCellSize)-1;if(u?i<a:s<o)for(let a=p;a<=f;a++){let n=a*this._granularityCellSize;t.push(this._vertexToIndex(n,r+h*(n-i)/l))}else for(let a=f;a>=p;a--){let n=a*this._granularityCellSize;t.push(this._vertexToIndex(n,r+h*(n-i)/l))}}_generateInterEdgeVertices(t,i,r,a,n,s,o,l,h,u){let c=o-n,d=(h-n)/c,p=(u-n)/c,f=Math.min(d,p),m=Math.max(d,p),_=a+(s-a)*f,g=Math.floor(Math.min(_,l)/this._granularityCellSize)+1,y=Math.ceil(Math.max(_,l)/this._granularityCellSize)-1,x=l<_,v=0===c;if(v&&(o===h||o===u))return;if(v||f>=1||m<=0){let t=r-o,a=s+(i-s)*Math.min((h-o)/t,(u-o)/t);g=Math.floor(Math.min(a,l)/this._granularityCellSize)+1,y=Math.ceil(Math.max(a,l)/this._granularityCellSize)-1,x=l<a}let b=n-r>0?u:h;if(x)for(let i=g;i<=y;i++)t.push(this._vertexToIndex(i*this._granularityCellSize,b));else for(let i=y;i>=g;i--)t.push(this._vertexToIndex(i*this._granularityCellSize,b))}_generateOutline(t){let i=[];for(let r of t){let t=oS(r,this._granularity,!0),a=this._pointArrayToIndices(t),n=[];for(let t=1;t<a.length;t++)n.push(a[t-1]),n.push(a[t]);i.push(n)}return i}_handlePoles(t){let i=!1,r=!1;this._canonical&&(0===this._canonical.y&&(i=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(i||r)&&this._fillPoles(t,i,r)}_ensureNoPoleVertices(){let t=this._vertexBuffer;for(let i=0;i<t.length;i+=2){let r=t[i+1];-32768===r&&(t[i+1]=-32767),32767===r&&(t[i+1]=32766)}}_generatePoleQuad(t,i,r,a,n,s){a>n!=(-32768===s)?(t.push(i),t.push(r),t.push(this._vertexToIndex(a,s)),t.push(r),t.push(this._vertexToIndex(n,s))):(t.push(r),t.push(i),t.push(this._vertexToIndex(a,s)),t.push(this._vertexToIndex(n,s)),t.push(r)),t.push(this._vertexToIndex(a,s))}_fillPoles(t,i,r){let a=this._vertexBuffer,n=t.length;for(let s=2;s<n;s+=3){let n=t[s-2],o=t[s-1],l=t[s],h=a[2*n],u=a[2*n+1],c=a[2*o],d=a[2*o+1],p=a[2*l],f=a[2*l+1];i&&(0===u&&0===d&&this._generatePoleQuad(t,n,o,h,c,-32768),0===d&&0===f&&this._generatePoleQuad(t,o,l,c,p,-32768),0===f&&0===u&&this._generatePoleQuad(t,l,n,p,h,-32768)),r&&(8192===u&&8192===d&&this._generatePoleQuad(t,n,o,h,c,32767),8192===d&&8192===f&&this._generatePoleQuad(t,o,l,c,p,32767),8192===f&&8192===u&&this._generatePoleQuad(t,l,n,p,h,32767))}}_initializeVertices(t){for(let i=0;i<t.length;i+=2)this._vertexToIndex(t[i],t[i+1])}subdividePolygonInternal(t,i){let r;if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:a,holeIndices:n}=function(t){let i=[],r=[];for(let a of t)if(0!==a.length){a!==t[0]&&i.push(r.length/2);for(let t=0;t<a.length;t++)r.push(a[t].x),r.push(a[t].y)}return{flattened:r,holeIndices:i}}(t);this._initializeVertices(a);try{let t=function(t,i,r=2){let a,n,s,o=i&&i.length,l=o?i[0]*r:t.length,h=oa(t,0,l,r,!0),u=[];if(!h||h.next===h.prev)return u;if(o&&(h=function(t,i,r,a){let n=[];for(let r=0,s=i.length;r<s;r++){let o=oa(t,i[r]*a,r<s-1?i[r+1]*a:t.length,a,!1);o===o.next&&(o.steiner=!0),n.push(function(t){let i=t,r=t;do(i.x<r.x||i.x===r.x&&i.y<r.y)&&(r=i),i=i.next;while(i!==t);return r}(o))}n.sort(os);for(let t=0;t<n.length;t++)r=function(t,i){let r=function(t,i){let r=i,a=t.x,n=t.y,s,o=-1/0;if(oc(t,r))return r;do{if(oc(t,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let t=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y
2);if(t<=a&&t>o&&(o=t,s=r.x<r.next.x?r:r.next,t===a))return s}r=r.next}while(r!==i);if(!s)return null;let l=s,h=s.x,u=s.y,c=1/0;r=s;do{if(a>=r.x&&r.x>=h&&a!==r.x&&ol(n<u?a:o,n,h,u,n<u?o:a,n,r.x,r.y)){var d,p;let i=Math.abs(n-r.y)/(a-r.x);om(r,t)&&(i<c||i===c&&(r.x>s.x||r.x===s.x&&(d=s,p=r,0>ou(d.prev,d,p.prev)&&0>ou(p.next,d,d.next))))&&(s=r,c=i)}r=r.next}while(r!==l);return s}(t,i);if(!r)return i;let a=o_(r,t);return on(a,a.next),on(r,r.next)}(n[t],r);return r}(t,i,h,r)),t.length>80*r){a=t[0],n=t[1];let i=a,o=n;for(let s=r;s<l;s+=r){let r=t[s],l=t[s+1];r<a&&(a=r),l<n&&(n=l),r>i&&(i=r),l>o&&(o=l)}s=Math.max(i-a,o-n),s=0!==s?32767/s:0}return function t(i,r,a,n,s,o,l){if(!i)return;!l&&o&&function(t,i,r,a){let n=t;do 0===n.z&&(n.z=oo(n.x,n.y,i,r,a)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){let i,r=1;do{let a,n=t;t=null;let s=null;for(i=0;n;){i++;let o=n,l=0;for(let t=0;t<r&&(l++,o=o.nextZ);t++);let h=r;for(;l>0||h>0&&o;)0!==l&&(0===h||!o||n.z<=o.z)?(a=n,n=n.nextZ,l--):(a=o,o=o.nextZ,h--),s?s.nextZ=a:t=a,a.prevZ=s,s=a;n=o}s.nextZ=null,r*=2}while(i>1)}(n)}(i,n,s,o);let h=i;for(;i.prev!==i.next;){let u=i.prev,c=i.next;if(o?function(t,i,r,a){let n=t.prev,s=t.next;if(ou(n,t,s)>=0)return!1;let o=n.x,l=t.x,h=s.x,u=n.y,c=t.y,d=s.y,p=Math.min(o,l,h),f=Math.min(u,c,d),m=Math.max(o,l,h),_=Math.max(u,c,d),g=oo(p,f,i,r,a),y=oo(m,_,i,r,a),x=t.prevZ,v=t.nextZ;for(;x&&x.z>=g&&v&&v.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&oh(o,u,l,c,h,d,x.x,x.y)&&ou(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==s&&oh(o,u,l,c,h,d,v.x,v.y)&&ou(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&oh(o,u,l,c,h,d,x.x,x.y)&&ou(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==s&&oh(o,u,l,c,h,d,v.x,v.y)&&ou(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}(i,n,s,o):function(t){let i=t.prev,r=t.next;if(ou(i,t,r)>=0)return!1;let a=i.x,n=t.x,s=r.x,o=i.y,l=t.y,h=r.y,u=Math.min(a,n,s),c=Math.min(o,l,h),d=Math.max(a,n,s),p=Math.max(o,l,h),f=r.next;for(;f!==i;){if(f.x>=u&&f.x<=d&&f.y>=c&&f.y<=p&&oh(a,o,n,l,s,h,f.x,f.y)&&ou(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}(i))r.push(u.i,i.i,c.i),oy(i),i=c.next,h=c.next;else if((i=c)===h){l?1===l?t(i=function(t,i){let r=t;do{let a=r.prev,n=r.next.next;!oc(a,n)&&od(a,r,r.next,n)&&om(a,n)&&om(n,a)&&(i.push(a.i,r.i,n.i),oy(r),oy(r.next),r=t=n),r=r.next}while(r!==t);return on(r)}(on(i),r),r,a,n,s,o,2):2===l&&function(i,r,a,n,s,o){let l=i;do{let i=l.next.next;for(;i!==l.prev;){var h,u;if(l.i!==i.i&&(h=l,u=i,h.next.i!==u.i&&h.prev.i!==u.i&&!function(t,i){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==i.i&&r.next.i!==i.i&&od(r,r.next,t,i))return!0;r=r.next}while(r!==t);return!1}(h,u)&&(om(h,u)&&om(u,h)&&function(t,i){let r=t,a=!1,n=(t.x+i.x)/2,s=(t.y+i.y)/2;do r.y>s!=r.next.y>
2s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(a=!a),r=r.next;while(r!==t);return a}(h,u)&&(ou(h.prev,h,u.prev)||ou(h,u.prev,u))||oc(h,u)&&ou(h.prev,h,h.next)>0&&ou(u.prev,u,u.next)>0))){let h=o_(l,i);return l=on(l,l.next),h=on(h,h.next),t(l,r,a,n,s,o,0),void t(h,r,a,n,s,o,0)}i=i.next}l=l.next}while(l!==i)}(i,r,a,n,s,o):t(on(i),r,a,n,s,o,1);break}}}(h,u,r,a,n,s,0),u}(a,n),i=this._convertIndices(a,t);r=this._subdivideTrianglesScanline(i)}catch(t){console.error(t)}let s=[];return i&&(s=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(r),{verticesFlattened:this._vertexBuffer,indicesTriangles:r,indicesLineList:s}}_convertIndices(t,i){let r=[];for(let a=0;a<i.length;a++)r.push(this._vertexToIndex(t[2*i[a]],t[2*i[a]+1]));return r}_pointArrayToIndices(t){let i=[];for(let r=0;r<t.length;r++){let a=t[r];i.push(this._vertexToIndex(a.x,a.y))}return i}}function oT(t,i,r,a=!0){return new ow(r,i).subdividePolygonInternal(t,a)}function oS(t,i,r=!1){if(!t||t.length<1||t.length<2)return[];let a=t[0],n=t[t.length-1],s=r&&(a.x!==n.x||a.y!==n.y);if(i<2)return s?[...t,t[0]]:[...t];let o=Math.floor(8192/i),l=[];l.push(new w(t[0].x,t[0].y));let h=t.length,u=s?h:h-1;for(let i=0;i<u;i++){let r=t[i],a=i<h-1?t[i+1]:t[0],n=r.x,s=r.y,u=a.x,c=a.y,d=n!==u,p=s!==c;if(!d&&!p)continue;let f=u-n,m=c-s,_=Math.abs(f),g=Math.abs(m),y=n,x=s;for(;;){let t=f>0?(Math.floor(y/o)+1)*o:(Math.ceil(y/o)-1)*o,i=m>0?(Math.floor(x/o)+1)*o:(Math.ceil(x/o)-1)*o,r=Math.abs(y-t),a=Math.abs(x-i),n=Math.abs(x-c),s=d?r/_:1/0,h=p?a/g:1/0;if((Math.abs(y-u)<=r||!d)&&(n<=a||!p))break;if(s<h&&d||!p){let i=new w(y=t,Math.round(x+=m*s));l[l.length-1].x===i.x&&l[l.length-1].y===i.y||l.push(i)}else{let t=new w(Math.round(y+=f*h),x=i);l[l.length-1].x===t.x&&l[l.length-1].y===t.y||l.push(t)}}let v=new w(u,c);l[l.length-1].x===v.x&&l[l.length-1].y===v.y||l.push(v)}return l}function oP(t,i,r,a,n,s,o,l,h){let u=n.length/2,c=o&&l&&h;if(u<n4.MAX_VERTEX_ARRAY_LENGTH){let d,p,f=i.prepareSegment(u,r,a),m=f.vertexLength;for(let t=0;t<s.length;t+=3)a.emplaceBack(m+s[t],m+s[t+1],m+s[t+2]);f.vertexLength+=u,f.primitiveLength+=s.length/3,c&&(d=(p=o.prepareSegment(u,r,l)).vertexLength,p.vertexLength+=u);for(let i=0;i<n.length;i+=2)t(n[i],n[i+1]);if(c)for(let t=0;t<h.length;t++){let i=h[t];for(let t=1;t<i.length;t+=2)l.emplaceBack(d+i[t-1],d+i[t]);p.primitiveLength+=i.length/2}}else!function(t,i,r,a,n,s){let o=[];for(let t=0;t<a.length/2;t++)o.push(-1);let l={count:0},h=0,u=t.getOrCreateLatestSegment(i,r),c=u.vertexLength;for(let d=2;d<n.length;d+=3){let p=n[d-2],f=n[d-1],m=n[d],_=o[p]<h,g=o[f]<h,y=o[m]<h;u.vertexLength+(+!!_+ +!!g+ +!!y)>n4.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(i,r),h=l.count,_=!0,g=!0,y=!0,c=0);let x=oM(o,a,s,l,p,_,u),v=oM(o,a,s,l,f,g,u),b=oM(o,a,s,l,m,y,u);r.emplaceBack(c+x-h,c+v-h,c+b-h),u.primitiveLength++}}(i,r,a,n,s,t),c&&function(t,i,r,a,n,s){let o=[];for(let t=0;t<a.length/2;t++)o.push(-1);let l={count:0},h=0,u=t.getOrCreateLatestSegment(i,r),c=u.vertexLength;for(let d=0;d<n.length;d++){let p=n[d];for(let f=1;f<n[d].length;f+=2){let n=p[f-1],d=p[f],m=o[n]<h,_=o[d]<h;u.vertexLength+(+!!m+ +!!_)>n4.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(i,r),h=l.count,m=!0,_=!0,c=0);let g=oM(o,a,s,l,n,m,u),y=oM(o,a,s,l,d,_,u);r.emplaceBack(c+g-h,c+y-h),u.primitiveLength++}}}(o,r,l,n,h,t),i.forceNewSegmentOnNextPrepare(),null==o||o.forceNewSegmentOnNextPrepare()}function oM(t,i,r,a,n,s,o){if(s){let s=a.count;return r(i[2*n],i[2*n+1]),t[n]=a.count,a.count++,o.vertexLength++,s}return t[n]}class oI{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new nZ,this.indexArray=new n2,this.indexArray2=new n3,this.programConfigurations=new sT(t.layers,t.zoom),this.segments=new n4,this.segments2=new n4,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,i,r){this.hasDependencies=oi("fill",this.layers,i);let a=this.layers[0].layout.get("fill-sort-key"),n=!a.isConstant(),s=[];for(let{feature:o,id:l,index:h,sourceLayerIndex:u}of t){let t=this.layers[0]._featureFilter.needGeometry,c=sI(o,t);
2if(!this.layers[0]._featureFilter.filter(new a$(this.zoom),c,r))continue;let d=n?a.evaluate(c,{},r,i.availableImages):void 0,p={id:l,properties:o.properties,type:o.type,sourceLayerIndex:u,index:h,geometry:t?c.geometry:sM(o),patterns:{},sortKey:d};s.push(p)}for(let a of(n&&s.sort((t,i)=>t.sortKey-i.sortKey),s)){let{geometry:n,index:s,sourceLayerIndex:o}=a;if(this.hasDependencies){let t=or("fill",this.layers,a,{zoom:this.zoom},i);this.patternFeatures.push(t)}else this.addFeature(a,n,s,r,{},i.subdivisionGranularity);i.featureIndex.insert(t[s].feature,n,s,o,this.index)}}update(t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:r})}addFeatures(t,i,r){for(let a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,i,r,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ot),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,i,r,a,n,s){for(let t of i2(i,500)){let i=oT(t,a,s.fill.getGranularityForZoomLevel(a.z)),r=this.layoutVertexArray;oP((t,i)=>{r.emplaceBack(t,i)},this.segments,this.layoutVertexArray,this.indexArray,i.verticesFlattened,i.indicesTriangles,this.segments2,this.indexArray2,i.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:a})}}aA("FillBucket",oI,{omit:["layers","patternFeatures"]});var oE={get paint(){return p=p||new a9({"fill-antialias":new a3(eK.paint_fill["fill-antialias"]),"fill-opacity":new a5(eK.paint_fill["fill-opacity"]),"fill-color":new a5(eK.paint_fill["fill-color"]),"fill-outline-color":new a5(eK.paint_fill["fill-outline-color"]),"fill-translate":new a3(eK.paint_fill["fill-translate"]),"fill-translate-anchor":new a3(eK.paint_fill["fill-translate-anchor"]),"fill-pattern":new a4(eK.paint_fill["fill-pattern"])})},get layout(){return d=d||new a9({"fill-sort-key":new a5(eK.layout_fill["fill-sort-key"])})}};class oC extends a7{constructor(t,i){super(t,oE,i)}recalculate(t,i){super.recalculate(t,i);let r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new oI(t)}queryRadius(){return sO(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:i,transform:r,pixelsToTileUnits:a}){return sD(sV(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,a),i)}isTileClipped(){return!0}}let oA=nn([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),oD=nn([{name:"a_centroid",components:2,type:"Int16"}],4),{members:oz}=oA;class ok{constructor(t,i,r,a,n){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=a,this._values=n,t.readFields(oR,this,i)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let i=t.readVarint()+t.pos,r=[],a,n=1,s=0,o=0,l=0;for(;t.pos<i;){if(s<=0){let i=t.readVarint();n=7&i,s=i>>3}if(s--,1===n||2===n)o+=t.readSVarint(),l+=t.readSVarint(),1===n&&(a&&r.push(a),a=[]),a&&a.push(new w(o,l));else{if(7!==n)throw Error(`unknown command ${n}`);a&&a.push(a[0].clone())}}return a&&r.push(a),r}bbox(){let t=this._pbf;t.pos=this._geometry;let i=t.readVarint()+t.pos,r=1,a=0,n=0,s=0,o=1/0,l=-1/0,h=1/0,u=-1/0;for(;t.pos<i;){if(a<=0){let i=t.readVarint();r=7&i,a=i>>3}if(a--,1===r||2===r)n+=t.readSVarint(),s+=t.readSVarint(),n<o&&(o=n),n>l&&(l=n),s<h&&(h=s),s>u&&(u=s);else if(7!==r)throw Error(`unknown command ${r}`)}return[o,h,l,u]}toGeoJSON(t,i,r){let a,n=this.extent*Math.pow(2,r),s=this.extent*t,o=this.extent*i,l=this.loadGeometry();function h(t){return[360*(t.x+s)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+o)/n)
2*Math.PI))-90]}function u(t){return t.map(h)}if(1===this.type){let t=[];for(let i of l)t.push(i[0]);let i=u(t);a=1===t.length?{type:"Point",coordinates:i[0]}:{type:"MultiPoint",coordinates:i}}else if(2===this.type){let t=l.map(u);a=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}}else{if(3!==this.type)throw Error("unknown feature type");{let t=oL(l),i=[];for(let r of t)i.push(r.map(u));a=1===i.length?{type:"Polygon",coordinates:i[0]}:{type:"MultiPolygon",coordinates:i}}}let c={type:"Feature",geometry:a,properties:this.properties};return null!=this.id&&(c.id=this.id),c}}function oR(t,i,r){1===t?i.id=r.readVarint():2===t?function(t,i){let r=t.readVarint()+t.pos;for(;t.pos<r;){let r=i._keys[t.readVarint()],a=i._values[t.readVarint()];i.properties[r]=a}}(r,i):3===t?i.type=r.readVarint():4===t&&(i._geometry=r.pos)}function oL(t){let i,r,a=t.length;if(a<=1)return[t];let n=[];for(let s=0;s<a;s++){let a=function(t){let i=0;for(let r,a,n=0,s=t.length,o=s-1;n<s;o=n++)r=t[n],i+=((a=t[o]).x-r.x)*(r.y+a.y);return i}(t[s]);0!==a&&(void 0===r&&(r=a<0),r===a<0?(i&&n.push(i),i=[t[s]]):i&&i.push(t[s]))}return i&&n.push(i),n}ok.types=["Unknown","Point","LineString","Polygon"];class oF{constructor(t,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(oB,this,i),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let i=this._pbf.readVarint()+this._pbf.pos;return new ok(this._pbf,i,this.extent,this._keys,this._values)}}function oB(t,i,r){15===t?i.version=r.readVarint():1===t?i.name=r.readString():5===t?i.extent=r.readVarint():2===t?i._features.push(r.pos):3===t?i._keys.push(r.readString()):4===t&&i._values.push(function(t){let i=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let r=t.readVarint()>>3;i=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}if(null==i)throw Error("unknown feature value");return i}(r))}class oO{constructor(t,i){this.layers=t.readFields(oV,{},i)}}function oV(t,i,r){if(3===t){let t=new oF(r,r.readVarint()+r.pos);t.length&&(i[t.name]=t)}}function oj(t,i,r,a,n,s,o,l){t.emplaceBack(i,r,2*Math.floor(8192*a)+o,8192*n*2,8192*s*2,Math.round(l))}class oN{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new n$,this.centroidVertexArray=new nG,this.indexArray=new n2,this.programConfigurations=new sT(t.layers,t.zoom),this.segments=new n4,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,i,r){for(let{feature:a,id:n,index:s,sourceLayerIndex:o}of(this.features=[],this.hasDependencies=oi("fill-extrusion",this.layers,i),t)){let t=this.layers[0]._featureFilter.needGeometry,l=sI(a,t);if(!this.layers[0]._featureFilter.filter(new a$(this.zoom),l,r))continue;let h={id:n,sourceLayerIndex:o,index:s,geometry:t?l.geometry:sM(a),properties:a.properties,type:a.type,patterns:{}};this.hasDependencies?this.features.push(or("fill-extrusion",this.layers,h,{zoom:this.zoom},i)):this.addFeature(h,h.geometry,s,r,{},i.subdivisionGranularity),i.featureIndex.insert(a,h.geometry,s,o,this.index,!0)}}addFeatures(t,i,r){for(let a of this.features){let{geometry:n}=a;this.addFeature(a,n,a.index,i,r,t.subdivisionGranularity)}}update(t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,oz),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,oD.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,i,r,a,n,s){for(let r of i2(i,500)){let i={x:0,y:0,sampleCount:0},n=this.layoutVertexArray.length;this.processPolygon(i,a,t,r,s);let o=this.layoutVertexArray.length-n,l=Math.floor(i.x/i.sampleCount),h=Math.floor(i.y/i.sampleCount);for(let t=0;t<o;t++)this.centroidVertexArray.emplaceBack(l,h)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:a})}processPolygon(t,i,r,a,n){if(a.length<1||oU(a[0]))return;for(let i of a)0!==i.length&&function(t,i){for(let r=0;r<i.length;r++){let a=i[r];r===i.length-1&&i[0].x===a.x&&i[0].y===a.y||(t.x+=a.x,t.y+=a.y,t.sampleC
2ount++)}}(t,i);let s={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=n.fill.getGranularityForZoomLevel(i.z),l="Polygon"===ok.types[r.type];for(let t of a){if(0===t.length||oU(t))continue;let i=oS(t,o,l);this._generateSideFaces(i,s)}if(!l)return;let h=oT(a,i,o,!1),u=this.layoutVertexArray;oP((t,i)=>{oj(u,t,i,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,h.verticesFlattened,h.indicesTriangles)}_generateSideFaces(t,i){let r=0;for(let s=1;s<t.length;s++){var a,n;let o=t[s],l=t[s-1];if(a=o,n=l,a.x===n.x&&(a.x<0||a.x>8192)||a.y===n.y&&(a.y<0||a.y>8192))continue;i.segment.vertexLength+4>n4.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let h=o.sub(l)._perp()._unit(),u=l.dist(o);r+u>32768&&(r=0),oj(this.layoutVertexArray,o.x,o.y,h.x,h.y,0,0,r),oj(this.layoutVertexArray,o.x,o.y,h.x,h.y,0,1,r),r+=u,oj(this.layoutVertexArray,l.x,l.y,h.x,h.y,0,0,r),oj(this.layoutVertexArray,l.x,l.y,h.x,h.y,0,1,r);let c=i.segment.vertexLength;this.indexArray.emplaceBack(c,c+2,c+1),this.indexArray.emplaceBack(c+1,c+2,c+3),i.segment.vertexLength+=4,i.segment.primitiveLength+=2}}}function oU(t){return t.every(t=>t.x<0)||t.every(t=>t.x>8192)||t.every(t=>t.y<0)||t.every(t=>t.y>8192)}aA("FillExtrusionBucket",oN,{omit:["layers","features"]});var oG={get paint(){return f=f||new a9({"fill-extrusion-opacity":new a3(eK["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new a5(eK["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new a3(eK["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new a3(eK["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new a4(eK["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new a5(eK["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new a5(eK["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new a3(eK["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};
2class oq extends a7{constructor(t,i){super(t,oG,i)}createBucket(t){return new oN(t)}queryRadius(){return sO(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:r,geometry:a,transform:n,pixelsToTileUnits:s,pixelPosMatrix:o}){let l=sV(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,s),h=this.paint.get("fill-extrusion-height").evaluate(i,r),u=this.paint.get("fill-extrusion-base").evaluate(i,r),c=function(t,i){let r=[];for(let a of t){let t=[a.x,a.y,0,1];en(t,t,i),r.push(new w(t[0]/t[3],t[1]/t[3]))}return r}(l,o),d=function(t,i,r,a){let n=[],s=[],o=a[8]*i,l=a[9]*i,h=a[10]*i,u=a[11]*i,c=a[8]*r,d=a[9]*r,p=a[10]*r,f=a[11]*r;for(let i of t){let t=[],r=[];for(let n of i){let i=n.x,s=n.y,m=a[0]*i+a[4]*s+a[12],_=a[1]*i+a[5]*s+a[13],g=a[2]*i+a[6]*s+a[14],y=a[3]*i+a[7]*s+a[15],x=g+h,v=y+u,b=m+c,T=_+d,S=g+p,P=y+f,M=new w((m+o)/v,(_+l)/v);M.z=x/v,t.push(M);let I=new w(b/P,T/P);I.z=S/P,r.push(I)}n.push(t),s.push(r)}return[n,s]}(a,u,h,o);return function(t,i,r){let a=1/0;sD(r,i)&&(a=o$(r,i[0]));for(let n=0;n<i.length;n++){let s=i[n],o=t[n];for(let t=0;t<s.length-1;t++){let i=s[t],n=[i,s[t+1],o[t+1],o[t],i];sC(r,n)&&(a=Math.min(a,o$(r,n)))}}return a!==1/0&&a}(d[0],d[1],c)}}function oZ(t,i){return t.x*i.x+t.y*i.y}function o$(t,i){if(1===t.length){let r,a=0,n=i[a++];for(;!r||n.equals(r);)if(!(r=i[a++]))return 1/0;for(;a<i.length;a++){let s=i[a],o=t[0],l=r.sub(n),h=s.sub(n),u=o.sub(n),c=oZ(l,l),d=oZ(l,h),p=oZ(h,h),f=oZ(u,l),m=oZ(u,h),_=c*p-d*d,g=(p*f-d*m)/_,y=(c*m-d*f)/_,x=n.z*(1-g-y)+r.z*g+s.z*y;if(isFinite(x))return x}return 1/0}{let t=1/0;for(let r of i)t=Math.min(t,r.z);return t}}let{members:oW}=nn([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:oH}=nn([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),oX=Math.cos(Math.PI/180*37.5);class oY{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new nW,this.layoutVertexArray2=new nH,this.indexArray=new n2,this.programConfigurations=new sT(t.layers,t.zoom),this.segments=new n4,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,i,r){this.hasDependencies=oi("line",this.layers,i)||this.hasLineDasharray(this.layers);let a=this.layers[0].layout.get("line-sort-key"),n=!a.isConstant(),s=[];for(let{feature:i,id:o,index:l,sourceLayerIndex:h}of t){let t=this.layers[0]._featureFilter.needGeometry,u=sI(i,t);if(!this.layers[0]._featureFilter.filter(new a$(this.zoom),u,r))continue;let c=n?a.evaluate(u,{},r):void 0,d={id:o,properties:i.properties,type:i.type,sourceLayerIndex:h,index:l,geometry:t?u.geometry:sM(i),patterns:{},dashes:{},sortKey:c};s.push(d)}for(let a of(n&&s.sort((t,i)=>t.sortKey-i.sortKey),s)){let{geometry:n,index:s,sourceLayerIndex:o}=a;this.hasDependencies?(oi("line",this.layers,i)?or("line",this.layers,a,{zoom:this.zoom},i):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,a,this.zoom,i),this.patternFeatures.push(a)):this.addFeature(a,n,s,r,{},{},i.subdivisionGranularity),i.featureIndex.insert(t[s].feature,n,s,o,this.index)}}update(t,i,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:r,dashPositions:a})}addFeatures(t,i,r,a){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,i,r,a,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,oH)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,oW),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,i,r,a,n,s,o){let l=this.layers[0].layout,h=l.get("line-join").evaluate(t,{}),u=l.get("line-cap"),c=l.get("line-miter-limit"),d=l.get("line-round-limit");for(let r of(this.lineClips=this.lineFeatureClips(t),i))this.addLine(r,t,h,u,c,d,a,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,dashPositions:s,canonical:a})}addLine(t,i,r,a,n,s,o,l){let h,u,c,d,p;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=oS(t,o?l.line.getGranularityForZoomLevel(o.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let i=0;i<t.length-1;i++)this.totalDistance+=t[i].dist(t[i+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let f="Polygon"===ok.types[i.type],m=t.length;for(;m>=2&&t[m-1].equals(t[m-2]);)m--;let _=0;for(;_<m-1&&t[_].equals(t[_+1]);)_++;if(m<(f?3:2))return;"bevel"===r&&(n=1.05);let g=this.overscaling<=16?122880/(512*this.overscaling):0,y=this.segments.prepareSegment(10*m,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,f&&(h=t[m-2],p=t[_].sub(h)._unit()._perp());for(let i=_;i<m;i++){if((c=i===m-1?f?t[_+1]:void 0:t[i+1])&&t[i].equals(c))continue;p&&(d=p),h&&(u=h),h=t[i],p=c?c.sub(h)._unit()._perp():d;let o=(d=d||p).add(p);0===o.x&&0===o.y||o._unit();let l=d.x*p.x+d.y*p.y,x=o.x*p.x+o.y*p.y,v=0!==x?1/x:1/0,b=2*Math.sqrt(2-2*x),w=x<oX&&u&&c,T=d.x*p.y-d.y*p.x>0;if(w&&i>_){let t=h.dist(u);if(t>
22*g){let i=h.sub(h.sub(u)._mult(g/t)._round());this.updateDistance(u,i),this.addCurrentVertex(i,d,0,0,y),u=i}}let S=u&&c,P=S?r:f?"butt":a;if(S&&"round"===P&&(v<s?P="miter":v<=2&&(P="fakeround")),"miter"===P&&v>n&&(P="bevel"),"bevel"===P&&(v>2&&(P="flipbevel"),v<n&&(P="miter")),u&&this.updateDistance(u,h),"miter"===P)o._mult(v),this.addCurrentVertex(h,o,0,0,y);else if("flipbevel"===P){if(v>100)o=p.mult(-1);else{let t=v*d.add(p).mag()/d.sub(p).mag();o._perp()._mult(t*(T?-1:1))}this.addCurrentVertex(h,o,0,0,y),this.addCurrentVertex(h,o.mult(-1),0,0,y)}else if("bevel"===P||"fakeround"===P){let t=-Math.sqrt(v*v-1),i=T?t:0,r=T?0:t;if(u&&this.addCurrentVertex(h,d,i,r,y),"fakeround"===P){let t=Math.round(180*b/Math.PI/20);for(let i=1;i<t;i++){let r=i/t;if(.5!==r){let t=r-.5;r+=r*t*(r-1)*((1.0904+l*(l*(3.55645-1.43519*l)-3.2452))*t*t+(.848013+l*(.215638*l-1.06021)))}let a=p.sub(d)._mult(r)._add(d)._unit()._mult(T?-1:1);this.addHalfVertex(h,a.x,a.y,!1,T,0,y)}}c&&this.addCurrentVertex(h,p,-i,-r,y)}else if("butt"===P)this.addCurrentVertex(h,o,0,0,y);else if("square"===P){let t=u?1:-1;this.addCurrentVertex(h,o,t,t,y)}else"round"===P&&(u&&(this.addCurrentVertex(h,d,0,0,y),this.addCurrentVertex(h,d,1,1,y,!0)),c&&(this.addCurrentVertex(h,p,-1,-1,y,!0),this.addCurrentVertex(h,p,0,0,y)));if(w&&i<m-1){let t=h.dist(c);if(t>2*g){let i=h.add(c.sub(h)._mult(g/t)._round());this.updateDistance(h,i),this.addCurrentVertex(i,p,0,0,y),h=i}}}}addCurrentVertex(t,i,r,a,n,s=!1){let o=i.y*a-i.x,l=-i.y-i.x*a;this.addHalfVertex(t,i.x+i.y*r,i.y-i.x*r,s,!1,r,n),this.addHalfVertex(t,o,l,s,!0,-a,n),this.distance>16384&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,i,r,a,n,s))}addHalfVertex({x:t,y:i},r,a,n,s,o,l){let h=.5*(this.lineClips?32767*this.scaledDistance:this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+ +!!n,(i<<1)+ +!!s,Math.round(63*r)+128,Math.round(63*a)+128,1+(0===o?0:o<0?-1:1)|(63&h)<<2,h>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let u=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),l.primitiveLength++),s?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,i){this.distance+=t.dist(i),this.updateScaledDistance()}hasLineDasharray(t){for(let i of t){let t=i.paint.get("line-dasharray");if(t&&!t.isConstant())return!0}return!1}addLineDashDependencies(t,i,r,a){for(let n of t){let t=n.paint.get("line-dasharray");if(!t||"constant"===t.value.kind)continue;let s="round"===n.layout.get("line-cap"),o={dasharray:t.value.evaluate({zoom:r-1},i,{}),round:s},l={dasharray:t.value.evaluate({zoom:r},i,{}),round:s},h={dasharray:t.value.evaluate({zoom:r+1},i,{}),round:s},u=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`,d=`${h.dasharray.join(",")},${h.round}`;a.dashDependencies[u]=o,a.dashDependencies[c]=l,a.dashDependencies[d]=h,i.dashes[n.id]={min:u,mid:c,max:d}}}}aA("LineBucket",oY,{omit:["layers","patternFeatures"]});var oK={get paint(){return _=_||new a9({"line-opacity":new a5(eK.paint_line["line-opacity"]),"line-color":new a5(eK.paint_line["line-color"]),"line-translate":new a3(eK.paint_line["line-translate"]),"line-translate-anchor":new a3(eK.paint_line["line-translate-anchor"]),"line-width":new a5(eK.paint_line["line-width"]),"line-gap-width":new a5(eK.paint_line["line-gap-width"]),"line-offset":new a5(eK.paint_line["line-offset"]),"line-blur":new a5(eK.paint_line["line-blur"]),"line-dasharray":new a4(eK.paint_line["line-dasharray"]),"line-pattern":new a4(eK.paint_line["line-pattern"]),"line-gradient":new a8(eK.paint_line["line-gradient"])})},get layout(){return m=m||new a9({"line-cap":new a3(eK.layout_line["line-cap"]),"line-join":new a5(eK.layout_line["line-join"]),"line-miter-limit":new a3(eK.layout_line["line-miter-limit"]),"line-round-limit":new a3(eK.layout_line["line-round-limit"]),"line-sort-key":new a5(eK.layout_line["line-sort-key"])})}};class oJ extends a5{possiblyEvaluate(t,i){return i=new a$(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),super.possiblyEvaluate(t,i)}evaluate(t,i,r,a){return i=ey({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(t,i,r,a)}}
2class oQ extends a7{constructor(t,i){super(t,oK,i),this.gradientVersion=0,g||((g=new oJ(oK.paint.properties["line-width"].specification)).useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){let t=this.gradientExpression();this.stepInterpolant=void 0!==t._styleExpression&&t._styleExpression.expression instanceof im,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,i){super.recalculate(t,i),this.paint._values["line-floorwidth"]=g.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new oY(t)}queryRadius(t){var i,r;return i=sB("line-width",this,t),((r=sB("line-gap-width",this,t))>0?r+2*i:i)/2+Math.abs(sB("line-offset",this,t))+sO(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:r,geometry:a,transform:n,pixelsToTileUnits:s}){var o,l;let h=sV(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,s),u=s/2*(o=this.paint.get("line-width").evaluate(i,r),(l=this.paint.get("line-gap-width").evaluate(i,r))>0?l+2*o:o),c=this.paint.get("line-offset").evaluate(i,r);return c&&(a=function(t,i){let r=[];for(let a=0;a<t.length;a++){let n=function(t){let i=[];for(let r=0;r<t.length;r++){let a=t[r],n=i.at(-1);(0===r||n&&!a.equals(n))&&i.push(a)}return i}(t[a]),s=[];for(let t=0;t<n.length;t++){let r=n[t],a=n[t-1],o=n[t+1],l=0===t?new w(0,0):r.sub(a)._unit()._perp(),h=t===n.length-1?new w(0,0):o.sub(r)._unit()._perp(),u=l._add(h)._unit(),c=u.x*h.x+u.y*h.y;0!==c&&u._mult(1/c),s.push(u._mult(i)._add(r))}r.push(s)}return r}(a,c*s)),function(t,i,r){for(let a=0;a<i.length;a++){let n=i[a];if(t.length>=3){for(let i=0;i<n.length;i++)if(sF(t,n[i]))return!0}if(function(t,i,r){if(t.length>1){if(sz(t,i))return!0;for(let a=0;a<i.length;a++)if(sk(i[a],t,r))return!0}for(let a=0;a<t.length;a++)if(sk(t[a],i,r))return!0;return!1}(t,n,r))return!0}return!1}(h,a,u)}isTileClipped(){return!0}}let o0=nn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),o1=nn([{name:"a_projected_pos",components:3,type:"Float32"}],4);nn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let o2=nn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);nn([{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"}]);let o3=nn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),o5=nn([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);nn([{name:"triangle",components:3,type:"Uint16"}]),nn([{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"}]),nn([{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"}
2]),nn([{type:"Float32",name:"offsetX"}]),nn([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),nn([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let o4={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","\xa2":"ï¿ ","\xa3":"ï¿¡","\xa5":"ï¿¥","\xa6":"¦","\xac":"ï¿¢","\xaf":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â¯":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹"},o6={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},o8={40:!0};function o9(t,i,r,a,n,s){if("fontStack"in i){let a=r[i.fontStack],s=a&&a[t];return s?s.metrics.advance*i.scale+n:0}{let t=a[i.imageName];return t?t.displaySize[0]*i.scale*24/s+n:0}}function o7(t,i,r,a){let n=Math.pow(t-i,2);return a?t<i?n/2:2*n:n+Math.abs(r)*r}function le(t,i,r,a,n,s){let o=null,l=o7(i,r,n,s);for(let t of a){let a=o7(i-t.x,r,n,s)+t.badness;a<=l&&(o=t,l=a)}return{index:t,x:i,priorBreak:o,badness:l}}class lt{constructor(t="",i=[],r=[]){this.text=t,this.sections=i,this.sectionIndex=r,this.imageSectionID=null}static fromFeature(t,i){let r=new lt;for(let a=0;a<t.sections.length;a++){let n=t.sections[a];n.image?r.addImageSection(n):r.addTextSection(n,i)}return r}length(){return[...this.text].length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}verticalizePunctuation(){this.text=function(t){let i="",r={premature:!0,value:void 0},a=t[Symbol.iterator](),n=a.next(),s=t[Symbol.iterator]();s.next();let o=s.next();for(;!n.done;)i+=!o.done&&aU(o.value.codePointAt(0))&&!o4[o.value]||!r.premature&&aU(r.value.codePointAt(0))&&!o4[r.value]||!o4[n.value]?n.value:o4[n.value],r={value:n.value,premature:!1},n=a.next(),o=s.next();return i}(this.text)}hasZeroWidthSpaces(){return this.text.includes("â")}trim(){let t=this.text.match(/^\s*/),i=t?t[0].length:0,r=this.text.match(/\S\s*$/),a=r?r[0].length-1:0;this.text=this.text.substring(i,this.text.length-a),this.sectionIndex=this.sectionIndex.slice(i,this.sectionIndex.length-a)}substring(t,i){let r=[...this.text].slice(t,i).join(""),a=this.sectionIndex.slice(t,i);return new lt(r,this.sections,a)}toCodeUnitIndex(t){return[...this.text].slice(0,t).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,i)=>Math.max(t,this.sections[i].scale),0)}getMaxImageSize(t){let i=0,r=0;for(let a=0;a<this.length();a++){let n=this.getSection(a);if("imageName"in n){let a=t[n.imageName];if(!a)continue;let s=a.displaySize;i=Math.max(i,s[0]),r=Math.max(r,s[1])}}return{maxImageWidth:i,maxImageHeight:r}}addTextSection(t,i){this.text+=t.text,this.sections.push({scale:t.scale||1,verticalAlign:t.verticalAlign||"bottom",fontStack:t.fontStack||i});let r=this.sections.length-1;this.sectionIndex.push(...[...t.text].map(()=>r))}addImageSection(t){let i=t.image?t.image.name:"";if(0===i.length)return void eS("Can't add FormattedSection with an empty image.");let r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push({scale:1,verticalAlign:t.verticalAlign||"bottom",imageName:i}),this.sectionIndex.push(this.sections.length-1)):eS("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t,i,r,a,n){let s=[],o=this.determineAverageLineWidth(t,i,r,a,n),l=this.hasZeroWidthSpaces(),h=0,u=0,c=this.text[Symbol.iterator](),d=c.next(),p=this.text[Symbol.iterator]();p.next();let f=p.next(),m=this.text[Symbol.iterator]();m.next(),m.next();let _=m.next();for(;!d.done;){let i=this.getSection(u),g=d.value.codePointAt(0);if(aO(g)||(h+=o9(g,i,r,a,t,n)),!f.done){let t=/[\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(g)),r=f.value.codePointAt(0);(o6[g]||t||"imageName"in i||!_.done&&o8[r])&&s.push(le(u+1,h,o,s,function(t,i,r){let a=0;return 10===t&&(a-=1e4),r&&(a+=150),40!==t&&65288!==t||(a+=50),41!==i&&65289!==i||(a+=50),a}(g,r,t&&l),!1))}u++,d=c.next(),f=p.next(),_=m.next()}return function t(i){return i?t(i.priorBreak).concat(i.index):[]}(le(this.length(),h,o,s,0,!0))}determineAverageLineWidth(t,i,r,a,n){let s=0,o=0;for(let i of this.text){let l=this.getSection(o);s+=o9(i.codePointAt(0),l,r,a,t,n),o++}return s/Math.max(1,Math.ceil(s/i))}}let li="u"<typeof TextDecoder?null:new TextDecoder("utf-8");class lr{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,i,r=this.length){for(;this.pos<r;){let r=this.readVarint(),a=r>>3,n=this.pos;this.type=7&r,t(a,i,this),this.pos===n&&this.skip(r)}return i}readMessage(t,i){return this.readFields(t,i,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getUint32(this.pos+4,!0);return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getInt32(this.pos+4,!0);return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let i,r,a=this.buf;return i=127&(r=a[this.pos++]),r<128?i:(i|=(127&(r=a[this.pos++]))<<7,r<128?i:(i|=(127&(r=a[this.pos++]))<<14,r<128?i:(i|=(127&(r=a[this.pos++]))<<21,r<128?i:function(t,i,r){let a,n,s=r.buf;if(a=(112&(n=s[r.pos++]))>>4,n<128||(a|=(127&(n=s[r.pos++]))<<3,n<128)||(a|=(127&(n=s[r.pos++]))<<10,n<128)||(a|=(127&(n=s[r.pos++]))<<17,n<128)||(a|=(127&(n=s[r.pos++]))<<24,n<128)||(a|=(1&(n=s[r.pos++]))<<31,n<128))return function(t,i,r){return r?0x100000000*i+(t>>>0):0x100000000*(i>>>0)+(t>>>0)}(t,a,i);throw Error("Expected varint not more than 10 bytes")}(i|=(15&(r=a[this.pos]))<<28,t,this))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let t=this.readVarint();return t%2==1?-((t+1)/2):t/2}readBoolean(){return!!this.readVarint()}readString(){let t=this.readVarint()+this.pos,i=this.pos;return this.pos=t,t-i>=12&&li?li.decode(this.buf.subarray(i,t)):function(t,i,r){let a="",n=i;for(;n<r;){let i=t[n],s,o,l,h=null,u=i>239?4:i>223?3:i>191?2:1;if(n+u>r)break;
21===u?i<128&&(h=i):2===u?128==(192&(s=t[n+1]))&&(h=(31&i)<<6|63&s)<=127&&(h=null):3===u?(s=t[n+1],o=t[n+2],128==(192&s)&&128==(192&o)&&((h=(15&i)<<12|(63&s)<<6|63&o)<=2047||h>=55296&&h<=57343)&&(h=null)):4===u&&(s=t[n+1],o=t[n+2],l=t[n+3],128==(192&s)&&128==(192&o)&&128==(192&l)&&((h=(15&i)<<18|(63&s)<<12|(63&o)<<6|63&l)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,u=1):h>65535&&(h-=65536,a+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),a+=String.fromCharCode(h),n+=u}return a}(this.buf,i,t)}readBytes(){let t=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,t);return this.pos=t,i}readPackedVarint(t=[],i){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readVarint(i));return t}readPackedSVarint(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFloat());return t}readPackedDouble(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){let i=7&t;if(0===i)for(;this.buf[this.pos++]>127;);else if(2===i)this.pos=this.readVarint()+this.pos;else if(5===i)this.pos+=4;else{if(1!==i)throw Error(`Unimplemented type: ${i}`);this.pos+=8}}writeTag(t,i){this.writeVarint(t<<3|i)}realloc(t){let i=this.length||16;for(;i<this.pos+t;)i*=2;if(i!==this.length){let t=new Uint8Array(i);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=i}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*t),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*t),!0),this.pos+=8}writeVarint(t){(t=+t||0)>0xfffffff||t<0?function(t,i){var r,a;let n,s,o;if(t>=0?(n=t%0x100000000|0,s=t/0x100000000|0):(n=~(-t%0x100000000),s=~(-t/0x100000000),0xffffffff^n?n=n+1|0:(n=0,s=s+1|0)),t>=0xffffffffffffffff||t<-0xffffffffffffffff)throw Error("Given varint doesn't fit into 10 bytes");i.realloc(10),r=n,i.buf[i.pos++]=127&r|128,r>>>=7,i.buf[i.pos++]=127&r|128,r>>>=7,i.buf[i.pos++]=127&r|128,r>>>=7,i.buf[i.pos++]=127&r|128,i.buf[i.pos]=127&(r>>>=7),o=(7&(a=s))<<4,i.buf[i.pos++]|=o|128*!!(a>>>=3),a&&(i.buf[i.pos++]=127&a|128*!!(a>>>=7),a&&(i.buf[i.pos++]=127&a|128*!!(a>>>=7),a&&(i.buf[i.pos++]=127&a|128*!!(a>>>=7),a&&(i.buf[i.pos++]=127&a|128*!!(a>>>=7),a&&(i.buf[i.pos++]=127&a)))))}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|128*(t>127),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|128*(t>127),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|128*(t>127),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?-(2*t)-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;let i=this.pos;this.pos=function(t,i,r){for(let a,n,s=0;s<i.length;s++){if((a=i.charCodeAt(s))>55295&&a<57344){if(!n){a>56319||s+1===i.length?(t[r++]=239,t[r++]=191,t[r++]=189):n=a;continue}if(a<56320){t[r++]=239,t[r++]=191,t[r++]=189,n=a;continue}a=n-55296<<10|a-56320|65536,n=null}else n&&(t[r++]=239,t[r++]=191,t[r++]=189,n=null);a<128?t[r++]=a:(a<2048?t[r++]=a>>6|192:(a<65536?t[r++]=a>>12|224:(t[r++]=a>>18|240,t[r++]=a>>12&63|128),t[r++]=a>>6&63|128),t[r++]=63&a|128)}return r}(this.buf,t,this.pos);let r=this.pos-i;r>=128&&la(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){let i=t.length;this.writeVarint(i),this.realloc(i);for(let r=0;r<i;r++)this.buf[this.pos++]=t[r]}writeRawMessage(t,i){this.pos++;let r=this.pos;t(i,this);let a=this.pos-r;a>=128&&la(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a}writeMessage(t,i,r){this.writeTag(t,2),this.writeRawMessage(i,r)}writePackedVarint(t,i){i.length&&this.writeMessage(t,ln,i)}writePackedSVarint(t,i){i.length&&this.writeMessage(t,ls,i)}writePackedBoolean(t,i){i.length&&this.writeMessage(t,lh,i)}writePackedFloat(t,i){i.length&&this.writeMessage(t,lo,i)}writePackedDouble(t,i){i.length&&this.writeMessage(t,ll,i)}writePackedFixed32(t,i){i.length&&this.writeMessage(t,lu,i)}writePackedSFixed32(t,i){i.length&&this.writeMessage(t,lc,i)}writePackedFixed64(t,i){i.length&&this.writeMessage(t,ld,i)}writePackedSFixed64(t,i){i.length&&this.writeMessage(t,lp,i)}writeBytesField(t,i){this.writeTag(t,2),this.writeBytes(i)}writeFixed32Field(t,i){this.writeTag(t,5),this.writeFixed32(i)}writeSFixed32Field(t,i){this.writeTag(t,5),this.writeSFixed32(i)}
2writeFixed64Field(t,i){this.writeTag(t,1),this.writeFixed64(i)}writeSFixed64Field(t,i){this.writeTag(t,1),this.writeSFixed64(i)}writeVarintField(t,i){this.writeTag(t,0),this.writeVarint(i)}writeSVarintField(t,i){this.writeTag(t,0),this.writeSVarint(i)}writeStringField(t,i){this.writeTag(t,2),this.writeString(i)}writeFloatField(t,i){this.writeTag(t,5),this.writeFloat(i)}writeDoubleField(t,i){this.writeTag(t,1),this.writeDouble(i)}writeBooleanField(t,i){this.writeVarintField(t,+i)}}function la(t,i,r){let a=i<=16383?1:i<=2097151?2:i<=0xfffffff?3:Math.floor(Math.log(i)/(7*Math.LN2));r.realloc(a);for(let i=r.pos-1;i>=t;i--)r.buf[i+a]=r.buf[i]}function ln(t,i){for(let r=0;r<t.length;r++)i.writeVarint(t[r])}function ls(t,i){for(let r=0;r<t.length;r++)i.writeSVarint(t[r])}function lo(t,i){for(let r=0;r<t.length;r++)i.writeFloat(t[r])}function ll(t,i){for(let r=0;r<t.length;r++)i.writeDouble(t[r])}function lh(t,i){for(let r=0;r<t.length;r++)i.writeBoolean(t[r])}function lu(t,i){for(let r=0;r<t.length;r++)i.writeFixed32(t[r])}function lc(t,i){for(let r=0;r<t.length;r++)i.writeSFixed32(t[r])}function ld(t,i){for(let r=0;r<t.length;r++)i.writeFixed64(t[r])}function lp(t,i){for(let r=0;r<t.length;r++)i.writeSFixed64(t[r])}function lf(t,i,r){1===t&&r.readMessage(lm,i)}function lm(t,i,r){if(3===t){let{id:t,bitmap:a,width:n,height:s,left:o,top:l,advance:h}=r.readMessage(l_,{});i.push({id:t,bitmap:new sQ({width:n+6,height:s+6},a),metrics:{width:n,height:s,left:o,top:l,advance:h}})}}function l_(t,i,r){1===t?i.id=r.readVarint():2===t?i.bitmap=r.readBytes():3===t?i.width=r.readVarint():4===t?i.height=r.readVarint():5===t?i.left=r.readSVarint():6===t?i.top=r.readSVarint():7===t&&(i.advance=r.readVarint())}function lg(t){let i=0,r=0;for(let a of t)i+=a.w*a.h,r=Math.max(r,a.w);t.sort((t,i)=>i.h-t.h);let a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),r),h:1/0}],n=0,s=0;for(let i of t)for(let t=a.length-1;t>=0;t--){let r=a[t];if(!(i.w>r.w||i.h>r.h)){if(i.x=r.x,i.y=r.y,s=Math.max(s,i.y+i.h),n=Math.max(n,i.x+i.w),i.w===r.w&&i.h===r.h){let i=a.pop();i&&t<a.length&&(a[t]=i)}else i.h===r.h?(r.x+=i.w,r.w-=i.w):(i.w===r.w||a.push({x:r.x+i.w,y:r.y,w:r.w-i.w,h:i.h}),r.y+=i.h,r.h-=i.h);break}}return{w:n,h:s,fill:i/(n*s)||0}}class ly{constructor(t,{pixelRatio:i,version:r,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l}){this.paddedRect=t,this.pixelRatio=i,this.stretchX=a,this.stretchY=n,this.content=s,this.version=r,this.textFitWidth=o,this.textFitHeight=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class lx{constructor(t,i){const r={},a={};this.haveRenderCallbacks=[];const n=[];this.addImages(t,r,n),this.addImages(i,a,n);const{w:s,h:o}=lg(n),l=new s0({width:s||1,height:o||1});for(const i in t){const a=t[i],n=r[i].paddedRect;s0.copy(a.data,l,{x:0,y:0},{x:n.x+1,y:n.y+1},a.data)}for(const t in i){const r=i[t],n=a[t].paddedRect,s=n.x+1,o=n.y+1,h=r.data.width,u=r.data.height;s0.copy(r.data,l,{x:0,y:0},{x:s,y:o},r.data),s0.copy(r.data,l,{x:0,y:u-1},{x:s,y:o-1},{width:h,height:1}),s0.copy(r.data,l,{x:0,y:0},{x:s,y:o+u},{width:h,height:1}),s0.copy(r.data,l,{x:h-1,y:0},{x:s-1,y:o},{width:1,height:u}),s0.copy(r.data,l,{x:0,y:0},{x:s+h,y:o},{width:1,height:u})}this.image=l,this.iconPositions=r,this.patternPositions=a}addImages(t,i,r){for(let a in t){let n=t[a],s={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(s),i[a]=new ly(s,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(a)}}patchUpdatedImages(t,i){for(let r in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),i),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),i)}patchUpdatedImage(t,i,r){if(!t||!i||t.version===i.version)return;t.version=i.version;let[a,n]=t.tl;r.update(i.data,void 0,{x:a,y:n})}}function lv(i,r,a,n,s,o,l,h,u,c,d,p,f,m,_){let g,y=lt.fromFeature(i,s);p===t.az.vertical&&y.verticalizePunctuation();let x=y.determineLineBreaks(c,o,r,n,m),{processBidirectionalText:v,processStyledBidirectionalText:b}=aZ;if(v&&1===y.sections.length)for(let t of(g=[],x=x.map(t=>y.toCodeUnitIndex(t)),v(y.toString(),x))){let i=[...t].map(()=>0);g.push(new lt(t,y.sections,i))}else if(b){g=[],x=x.map(t=>y.toCodeUnitIndex(t));let t=0,i=[];for(let r of y.text)i.push(...Array(r.length).fill(y.sectionIndex[t])),t++;for(let t of b(y.text,i,x)){let i=[],r="";for(let a of t[0])i.push(t[1][r.length]),r+=a;g.push(new lt(t[0],y.sections,i))}}else g=function(t,i){let r=[],a=0;for(let n of i)r.push(t.substring(a,n)),a=n;return a<t.length()&&r.push(t.substring(a,t.length())),r}(y,x);let w=[],T={positionedLines:w,text:y.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(i,r,a,n,s,o,l,h,u,c,d,p){let f=0,m=0,_=0,g=0,y="right"===h?1:.5*("left"!==h),x=24/p,v=0;for(let l of s){l.trim();let s=l.getMaxScale(),h={positionedGlyphs:[],lineOffset:0};i.positionedLines[v]=h;let p=h.positionedGlyphs,S=0;if(!l.length()){m+=o,++v;continue}let P=function(t,i,r){let a=24*i.getMaxScale(),{maxImageWidth:n,maxImageHeight:s}=i.getMaxImageSize(t),o=Math.max(a,s*r);return{verticalLineContentWidth:Math.max(a,n*r),horizontalLineContentHeight:o}}(n,l,x),M=0;for(let o of l.text){var b,w,T;let h,_=l.getSection(M),g=o.codePointAt(0),y=(b=u,w=d,T=g,!(b===t.az.horizontal||!w&&!aB(T)||w&&(aO(T)||/\p{sc=Arab}/u.test(String.fromCodePoint(T))))),v={glyph:g,imageName:null,x:f,y:m+-17,vertical:y,scale:1,fontStack:"",sectionIndex:l.getSectionIndex(M),metrics:null,rect:null};if("fontStack"in _){if(!(h=function(t,i,r,a,n,s){let o,l=s[t.fontStack],h=function(t,i,r,a){if(t&&t.rect)return t;let n=i[r.fontStack],s=n&&n[a];return s?{rect:null,metrics:s.metrics}:null}(l&&l[i],n,t,i);if(null===h)return null;if(r)o=a.verticalLineContentWidth-24*t.scale;else{let i=lw(t.verticalAlign);o=(a.horizontalLineContentHeight-24*t.scale)*i}return{rect:h.rect,metrics:h.metrics,baselineOffset:o}}(_,g,y,P,r,a)))continue;v.fontStack=_.fontStack}else{if(i.iconsInText=!0,_.scale*=x,!(h=function(t,i,r,a,n){let s,o=n[t.imageName];if(!o)return null;let l=o.paddedRect,h=o.displaySize,u={width:h[0],height:h[1],left:1,top:-3,advance:i?h[1]:h[0]};if(i)s=a.verticalLineContentWidth-h[1]*t.scale;else{let i=lw(t.verticalAlign);s=(a.horizontalLineContentHeight-h[1]*t.scale)*i}return{rect:l,metrics:u,baselineOffset:s,imageOffset:(i?h[0]:h[1])*t.scale-24*r}}(_,y,s,P,n)))continue;S=Math.max(S,h.imageOffset),v.imageName=_.imageName}let{rect:I,metrics:E,baselineOffset:C}=h;v.y+=C,v.scale=_.scale,v.metrics=E,v.rect=I,p.push(v),y?(i.verticalizable=!0,f+=("imageName"in _?E.advance:24)*_.scale+c):f+=E.advance*_.scale+c,M++}0!==p.length&&(_=Math.max(f-c,_),function(t,i,r){if(0===r)return;let a=t[i],n=(t[i].x+a.metrics.advance*a.scale)*r;
2for(let r=0;r<=i;r++)t[r].x-=n}(p,p.length-1,y)),f=0,h.lineOffset=Math.max(S,(s-1)*24);let I=o*s+S;m+=I,g=Math.max(I,g),++v}let{horizontalAlign:S,verticalAlign:P}=lb(l);(function(t,i,r,a,n,s,o,l,h){let u=(i-r)*n,c=0;for(let i of(c=s!==o?-l*a- -17:-a*h*o+.5*o,t))for(let t of i.positionedGlyphs)t.x+=u,t.y+=c})(i.positionedLines,y,S,P,_,g,o,m,s.length),i.top+=-P*m,i.bottom=i.top+m,i.left+=-S*_,i.right=i.left+_}(T,r,a,n,g,l,h,u,p,c,f,_),!function(t){for(let i of t)if(0!==i.positionedGlyphs.length)return!1;return!0}(w)&&T}function lb(t){let i=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":i=1;break;case"left":case"top-left":case"bottom-left":i=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:i,verticalAlign:r}}function lw(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function lT(t){var i,r;let a=t.left,n=t.top,s=t.right-a,o=t.bottom-n,l=null!=(i=t.image.textFitWidth)?i:"stretchOrShrink",h=null!=(r=t.image.textFitHeight)?r:"stretchOrShrink",u=(t.image.content[2]-t.image.content[0])/(t.image.content[3]-t.image.content[1]);if("proportional"===h){if("stretchOnly"===l&&s/o<u||"proportional"===l){let t=Math.ceil(o*u);a*=t/s,s=t}}else if("proportional"===l&&"stretchOnly"===h&&0!==u&&s/o>u){let t=Math.ceil(s/u);n*=t/o,o=t}return{x1:a,y1:n,x2:a+s,y2:n+o}}function lS(t,i,r,a,n,s){let o,l,h,u,c,d=t.image;if(d.content){let t=d.content,i=d.pixelRatio||1;o=[t[0]/i,t[1]/i,d.displaySize[0]-t[2]/i,d.displaySize[1]-t[3]/i]}let p=i.left*s,f=i.right*s;"width"===r||"both"===r?(c=n[0]+p-a[3],h=n[0]+f+a[1]):h=(c=n[0]+(p+f-d.displaySize[0])/2)+d.displaySize[0];let m=i.top*s,_=i.bottom*s;return"height"===r||"both"===r?(l=n[1]+m-a[0],u=n[1]+_+a[2]):u=(l=n[1]+(m+_-d.displaySize[1])/2)+d.displaySize[1],{image:d,top:l,right:h,bottom:u,left:c,collisionPadding:o}}function lP(t,i){let{expression:r}=i;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new a$(t+1))};if("source"===r.kind)return{kind:"source"};{let{zoomStops:i,interpolationType:a}=r,n=0;for(;n<i.length&&i[n]<=t;)n++;let s=n=Math.max(0,n-1);for(;s<i.length&&i[s]<t+1;)s++;s=Math.min(i.length-1,s);let o=i[n],l=i[s];return"composite"===r.kind?{kind:"composite",minZoom:o,maxZoom:l,interpolationType:a}:{kind:"camera",minZoom:o,maxZoom:l,minSize:r.evaluate(new a$(o)),maxSize:r.evaluate(new a$(l)),interpolationType:a}}}function lM(t,i,r){let a="never",n=t.get(i);return n?a=n:t.get(r)&&(a="always"),a}aA("ImagePosition",ly),aA("ImageAtlas",lx),t.az=void 0,(R=t.az||(t.az={}))[R.none=0]="none",R[R.horizontal=1]="horizontal",R[R.vertical=2]="vertical",R[R.horizontalOnly=3]="horizontalOnly";let lI=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function lE(t,i,r,a,n,s,o,l,h,u,c,d,p){let f=l?Math.min(32640,Math.round(l[0])):0,m=l?Math.min(32640,Math.round(l[1])):0;t.emplaceBack(i,r,Math.round(32*a),Math.round(32*n),s,o,(f<<1)+ +!!h,m,16*u,16*c,256*d,256*p)}function lC(t,i,r){t.emplaceBack(i.x,i.y,r),t.emplaceBack(i.x,i.y,r),t.emplaceBack(i.x,i.y,r),t.emplaceBack(i.x,i.y,r)}class lA{constructor(t){this.layoutVertexArray=new nK,this.indexArray=new n2,this.programConfigurations=t,this.segments=new n4,this.dynamicLayoutVertexArray=new nJ,this.opacityVertexArray=new nQ,this.hasVisibleVertices=!1,this.placedSymbolArray=new nR}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,i,r,a){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,o0.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,o1.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,lI,!0),this.opacityVertexBuffer.itemSize=1),(r||a)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}aA("SymbolBuffers",lA);class lD{constructor(t,i,r){this.layoutVertexArray=new t,this.layoutAttributes=i,this.indexArray=new r,this.segments=new n4,this.collisionVertexArray=new n1}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,o2.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}aA("CollisionBuffers",lD);class lz{constructor(i){this.collisionBoxArray=i.collisionBoxArray,this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(t=>
2t.id),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=lP(this.zoom,r["text-size"]),this.iconSizeData=lP(this.zoom,r["icon-size"]);const a=this.layers[0].layout,n=a.get("symbol-sort-key"),s=a.get("symbol-z-order");this.canOverlap="never"!==lM(a,"text-overlap","text-allow-overlap")||"never"!==lM(a,"icon-overlap","icon-allow-overlap")||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==s&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===s||"auto"===s&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===a.get("symbol-placement")&&(this.writingModes=a.get("text-writing-mode").map(i=>t.az[i])),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.sourceID=i.sourceID}createArrays(){this.text=new lA(new sT(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new lA(new sT(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new nB,this.lineVertexArray=new nO,this.symbolInstances=new nF,this.textAnchorOffsets=new nj}calculateGlyphDependencies(t,i,r,a,n){for(let s of t)if(i[s.codePointAt(0)]=!0,(r||a)&&n){let t=o4[s];t&&(i[t.codePointAt(0)]=!0)}}populate(i,r,a){let n=this.layers[0],s=n.layout,o=s.get("text-font"),l=s.get("text-field"),h=s.get("icon-image"),u=("constant"!==l.value.kind||l.value.value instanceof tW&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),c="constant"!==h.value.kind||!!h.value.value||Object.keys(h.parameters).length>0,d=s.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let p=r.iconDependencies,f=r.glyphDependencies,m=r.availableImages,_=new a$(this.zoom);for(let{feature:r,id:l,index:h,sourceLayerIndex:g}of i){let i,y,x=n._featureFilter.needGeometry,v=sI(r,x);if(!n._featureFilter.filter(_,v,a))continue;if(x||(v.geometry=sM(r)),u){let t=n.getValueAndResolveTokens("text-field",v,a,m),r=tW.factory(t),s=this.hasRTLText=this.hasRTLText||function(t){for(let i of t.sections)if(function(t){for(let i of t)if(aq(i.codePointAt(0)))return!0;return!1}(i.text))return!0;return!1}(r);(!s||"unavailable"===aZ.getRTLTextPluginStatus()||s&&aZ.isParsed())&&(i=function(t,i,r){return t.sections.forEach(t=>{var a;let n;a=t.text,"uppercase"===(n=i.layout.get("text-transform").evaluate(r,{}))?a=a.toLocaleUpperCase():"lowercase"===n&&(a=a.toLocaleLowerCase()),aZ.applyArabicShaping&&(a=aZ.applyArabicShaping(a)),t.text=a}),t}(r,n,v))}if(c){let t=n.getValueAndResolveTokens("icon-image",v,a,m);y=t instanceof t0?t:t0.fromString(t)}if(!i&&!y)continue;let b=this.sortFeaturesByKey?d.evaluate(v,{},a):void 0;if(this.features.push({id:l,text:i,icon:y,index:h,sourceLayerIndex:g,geometry:v.geometry,properties:r.properties,type:ok.types[r.type],sortKey:b}),y&&(p[y.name]=!0),i){let r=o.evaluate(v,{},a).join(","),n="viewport"!==s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");for(let a of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.az.vertical)>=0,i.sections))if(a.image)p[a.image.name]=!0;else{let t=aV(i.toString()),s=a.fontStack||r,o=f[s]=f[s]||{};this.calculateGlyphDependencies(a.text,o,n,this.allowVerticalPlacement,t)}}}"line"===s.get("symbol-placement")&&(this.features=function(t){let i={},r={},a=[],n=0;function s(i){a.push(t[i]),n++}function o(t,i,n){let s=r[t];return delete r[t],r[i]=s,a[s].geometry[0].pop(),a[s].geometry[0]=a[s].geometry[0].concat(n[0]),s}function l(t,r,n){let s=i[r];return delete i[r],i[t]=s,a[s].geometry[0].shift(),a[s].geometry[0]=n[0].concat(a[s].geometry[0]),s}function h(t,i,r){let a=r?i[0][i[0].length-1]:i[0][0];return`${t}:${a.x}:${a.y}`}for(let u=0;u<t.length;u++){let c=t[u],d=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}let f=h(p,d),m=h(p,d,!0);if(f in r&&m in i&&r[f]!==i[m]){let t=l(f,m,d),n=o(f,m,a[t].geometry);delete i[f],delete r[m],r[h(p,a[n].geometry,!0)]=n,a[t].geometry=null}else f in r?o(f,m,d):m in i?l(f,m,d):(s(u),i[f]=n-1,r[m]=n-1)}return a.filter(t=>t.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((t,i)=>t.sortKey-i.sortKey)}update(t,i,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,i,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(t,i,this.layers,{imagePositions:r}))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,i){let r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(i[t.segment+1]),a=t.dist(i[t.segment]),n={};for(let a=t.segment+1;a<i.length;a++)n[a]={x:i[a].x,y:i[a].y,tileUnitDistanceFromAnchor:r}
2,a<i.length-1&&(r+=i[a+1].dist(i[a]));for(let r=t.segment||0;r>=0;r--)n[r]={x:i[r].x,y:i[r].y,tileUnitDistanceFromAnchor:a},r>0&&(a+=i[r-1].dist(i[r]));for(let t=0;t<i.length;t++){let i=n[t];this.lineVertexArray.emplaceBack(i.x,i.y,i.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(i,r,a,n,s,o,l,h,u,c,d,p){let f=i.indexArray,m=i.layoutVertexArray,_=i.segments.prepareSegment(4*r.length,m,f,this.canOverlap?o.sortKey:void 0),g=this.glyphOffsetArray.length,y=_.vertexLength,x=this.allowVerticalPlacement&&l===t.az.vertical?Math.PI/2:0,v=o.text&&o.text.sections;for(let t=0;t<r.length;t++){let{tl:n,tr:s,bl:l,br:u,tex:c,pixelOffsetTL:d,pixelOffsetBR:g,minFontScaleX:y,minFontScaleY:b,glyphOffset:w,isSDF:T,sectionIndex:S}=r[t],P=_.vertexLength,M=w[1];lE(m,h.x,h.y,n.x,M+n.y,c.x,c.y,a,T,d.x,d.y,y,b),lE(m,h.x,h.y,s.x,M+s.y,c.x+c.w,c.y,a,T,g.x,d.y,y,b),lE(m,h.x,h.y,l.x,M+l.y,c.x,c.y+c.h,a,T,d.x,g.y,y,b),lE(m,h.x,h.y,u.x,M+u.y,c.x+c.w,c.y+c.h,a,T,g.x,g.y,y,b),lC(i.dynamicLayoutVertexArray,h,x),f.emplaceBack(P,P+2,P+1),f.emplaceBack(P+1,P+2,P+3),_.vertexLength+=4,_.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(w[0]),t!==r.length-1&&S===r[t+1].sectionIndex||i.programConfigurations.populatePaintArrays(m.length,o,o.index,{imagePositions:{},canonical:p,formattedSection:v&&v[S]})}i.placedSymbolArray.emplaceBack(h.x,h.y,g,this.glyphOffsetArray.length-g,y,u,c,h.segment,a?a[0]:0,a?a[1]:0,n[0],n[1],l,0,!1,0,d)}_addCollisionDebugVertex(t,i,r,a,n,s){return i.emplaceBack(0,0),t.emplaceBack(r.x,r.y,a,n,Math.round(s.x),Math.round(s.y))}addCollisionDebugVertices(t,i,r,a,n,s,o){let l=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),h=l.vertexLength,u=n.layoutVertexArray,c=n.collisionVertexArray,d=o.anchorX,p=o.anchorY;this._addCollisionDebugVertex(u,c,s,d,p,new w(t,i)),this._addCollisionDebugVertex(u,c,s,d,p,new w(r,i)),this._addCollisionDebugVertex(u,c,s,d,p,new w(r,a)),this._addCollisionDebugVertex(u,c,s,d,p,new w(t,a)),l.vertexLength+=4;let f=n.indexArray;f.emplaceBack(h,h+1),f.emplaceBack(h+1,h+2),f.emplaceBack(h+2,h+3),f.emplaceBack(h+3,h),l.primitiveLength+=4}addDebugCollisionBoxes(t,i,r,a){for(let n=t;n<i;n++){let t=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,a?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new lD(n0,o3.members,n3),this.iconCollisionBox=new lD(n0,o3.members,n3);for(let t=0;t<this.symbolInstances.length;t++){let i=this.symbolInstances.get(t);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(t,i,r,a,n,s,o,l,h){let u={};for(let a=i;a<r;a++){let i=t.get(a);u.textBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},u.textFeatureIndex=i.featureIndex;break}for(let i=a;i<n;i++){let r=t.get(i);u.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalTextFeatureIndex=r.featureIndex;break}for(let i=s;i<o;i++){let r=t.get(i);u.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.iconFeatureIndex=r.featureIndex;break}for(let i=l;i<h;i++){let r=t.get(i);u.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalIconFeatureIndex=r.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){let r=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,i){let r=t.placedSymbolArray.get(i),a=r.vertexStartIndex+4*r.numGlyphs;for(let i=r.vertexStartIndex;i<a;
2i+=4)t.indexArray.emplaceBack(i,i+2,i+1),t.indexArray.emplaceBack(i+1,i+2,i+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let i=Math.sin(t),r=Math.cos(t),a=[],n=[],s=[];for(let t=0;t<this.symbolInstances.length;++t){s.push(t);let o=this.symbolInstances.get(t);a.push(0|Math.round(i*o.anchorX+r*o.anchorY)),n.push(o.featureIndex)}return s.sort((t,i)=>a[t]-a[i]||n[i]-n[t]),s}addToSortKeyRanges(t,i){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===i?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(let i of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let t=this.symbolInstances.get(i);this.featureSortOrder.push(t.featureIndex),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach((t,i,r)=>{t>=0&&r.indexOf(t)===i&&this.addIndicesForPlacedSymbol(this.text,t)}),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}aA("SymbolBucket",lz,{omit:["layers","collisionBoxArray","features","compareText"]}),lz.MAX_GLYPHS=65535,lz.addDynamicAttributes=lC;var lk={get paint(){return x=x||new a9({"icon-opacity":new a5(eK.paint_symbol["icon-opacity"]),"icon-color":new a5(eK.paint_symbol["icon-color"]),"icon-halo-color":new a5(eK.paint_symbol["icon-halo-color"]),"icon-halo-width":new a5(eK.paint_symbol["icon-halo-width"]),"icon-halo-blur":new a5(eK.paint_symbol["icon-halo-blur"]),"icon-translate":new a3(eK.paint_symbol["icon-translate"]),"icon-translate-anchor":new a3(eK.paint_symbol["icon-translate-anchor"]),"text-opacity":new a5(eK.paint_symbol["text-opacity"]),"text-color":new a5(eK.paint_symbol["text-color"],{runtimeType:ta,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new a5(eK.paint_symbol["text-halo-color"]),"text-halo-width":new a5(eK.paint_symbol["text-halo-width"]),"text-halo-blur":new a5(eK.paint_symbol["text-halo-blur"]),"text-translate":new a3(eK.paint_symbol["text-translate"]),"text-translate-anchor":new a3(eK.paint_symbol["text-translate-anchor"])})},get layout(){return y=y||new a9({"symbol-placement":new a3(eK.layout_symbol["symbol-placement"]),"symbol-spacing":new a3(eK.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new a3(eK.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new a5(eK.layout_symbol["symbol-sort-key"]),"symbol-z-order":new a3(eK.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new a3(eK.layout_symbol["icon-allow-overlap"]),"icon-overlap":new a3(eK.layout_symbol["icon-overlap"]),"icon-ignore-placement":new a3(eK.layout_symbol["icon-ignore-placement"]),"icon-optional":new a3(eK.layout_symbol["icon-optional"]),"icon-rotation-alignment":new a3(eK.layout_symbol["icon-rotation-alignment"]),"icon-size":new a5(eK.layout_symbol["icon-size"]),"icon-text-fit":new a3(eK.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new a3(eK.layout_symbol["icon-text-fit-padding"]),"icon-image":new a5(eK.layout_symbol["icon-image"]),"icon-rotate":new a5(eK.layout_symbol["icon-rotate"]),"icon-padding":new a5(eK.layout_symbol["icon-padding"]),"icon-keep-upright":new a3(eK.layout_symbol["icon-keep-upright"]),"icon-offset":new a5(eK.layout_symbol["icon-offset"]),"icon-anchor":new a5(eK.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new a3(eK.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new a3(eK.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new a3(eK.layout_symbol["text-rotation-alignment"]),"text-field":new a5(eK.layout_symbol["text-field"]),"text-font":new a5(eK.layout_symbol["text-font"]),"text-size":new a5(eK.layout_symbol["text-size"]),"text-max-width":new a5(eK.layout_symbol["text-max-width"]),"text-line-height":new a3(eK.layout_symbol["text-line-height"]),"text-letter-spacing":new a5(eK.layout_symbol["text-letter-spacing"]),"text-justify":new a5(eK.layout_symbol["text-justify"]),"text-radial-offset":new a5(eK.layout_symbol["text-radial-offset"]),"text-variable-anchor":new a3(eK.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new a5(eK.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new a5(eK.layout_symbol["text-anchor"]),"text-max-angle":new a3(eK.layout_symbol["text-max-angle"]),"text-writing-mode":new a3(eK.layout_symbol["text-writing-mode"]),"text-rotate":new a5(eK.layout_symbol["text-rotate"]),"text-padding":new a3(eK.layout_symbol["text-padding"]),"text-keep-upright":new a3(eK.layout_symbol["text-keep-upright"]),"text-transform":new a5(eK.layout_symbol["text-transform"]),"text-offset":new a5(eK.layout_symbol["text-offset"]),"text-allow-overlap":new a3(eK.layout_symbol["text-allow-overlap"]),"text-overlap":new a3(eK.layout_symbol["text-overlap"]),"text-ignore-placement":new a3(eK.layout_symbol["text-ignore-placement"]),"text-optional":new a3(eK.layout_symbol["text-optional"])})}};class lR{constructor(t){if(void 0===t.property.overrides)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:te,this.defaultValue=t}evaluate(t){if(t.formattedSection){let i=this.defaultValue.property.overrides;if(i&&i.hasOverride(t.formattedSection))return i.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}aA("FormatSectionOverride",lR,{omit:["defaultValue"]});
2class lL extends a7{constructor(t,i){super(t,lk,i)}recalculate(t,i){if(super.recalculate(t,i),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){let t=this.layout.get("text-writing-mode");if(t){let i=[];for(let r of t)0>i.indexOf(r)&&i.push(r);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,i,r,a){var n;let s=this.layout.get(t).evaluate(i,{},r,a),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||rO(o.value)||!s?s:(n=i.properties,s.replace(/{([^{}]+)}/g,(t,i)=>n&&i in n?String(n[i]):""))}createBucket(t){return new lz(t)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of lk.paint.overridableProperties){if(!lL.hasPaintOverride(this.layout,t))continue;let i=this.paint.get(t),r=new rB(new lR(i),i.property.specification),a=null;a="constant"===i.value.kind||"source"===i.value.kind?new rj("source",r):new rN("composite",r,i.value.zoomStops),this.paint._values[t]=new a1(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(t,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven())&&lL.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,i){let r=t.get("text-field"),a=lk.paint.properties[i],n=!1,s=t=>{for(let i of t)if(a.overrides&&a.overrides.hasOverride(i))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof tW)s(r.value.value.sections);else if("source"===r.value.kind||"composite"===r.value.kind){let t=i=>{n||(i instanceof t6&&t5(i.value)===th?s(i.value.sections):i instanceof iO?s(i.sections):i.eachChild(t))},i=r.value;i._styleExpression&&t(i._styleExpression.expression)}return n}}var lF={get paint(){return v=v||new a9({"background-color":new a3(eK.paint_background["background-color"]),"background-pattern":new a6(eK.paint_background["background-pattern"]),"background-opacity":new a3(eK.paint_background["background-opacity"])})}};class lB extends a7{constructor(t,i){super(t,lF,i)}}class lO extends a7{constructor(t,i){super(t,{},i),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}}class lV{constructor(t){this._methodToThrottle=t,this._triggered=!1,"u">typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let lj={once:!0};class lN{constructor(t,i){if(isNaN(t)||isNaN(i))throw Error(`Invalid LngLat object: (${t}, ${i})`);if(this.lng=+t,this.lat=+i,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new lN(eg(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let i=Math.PI/180,r=this.lat*i,a=t.lat*i;return 6371008.8*Math.acos(Math.min(Math.sin(r)*Math.sin(a)+Math.cos(r)*Math.cos(a)*Math.cos((t.lng-this.lng)*i),1))}static convert(t){if(t instanceof lN)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new lN(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new lN(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}let lU=2*Math.PI*6371008.8;function lG(t){return lU*Math.cos(t*Math.PI/180)}function lq(t){return(180+t)/360}function lZ(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function l$(t){return 360*t-180}function lW(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180)
2)-90}function lH(t,i){return t*lG(lW(i))}class lX{constructor(t,i,r=0){this.x=+t,this.y=+i,this.z=+r}static fromLngLat(t,i=0){let r=lN.convert(t);return new lX(lq(r.lng),lZ(r.lat),i/lG(r.lat))}toLngLat(){return new lN(l$(this.x),lW(this.y))}toAltitude(){return lH(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/lU*(1/Math.cos(lW(this.y)*Math.PI/180))}}function lY(t,i,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[t*a-2*Math.PI*6378137/2,i*a-2*Math.PI*6378137/2]}class lK{constructor(t,i,r){if(!function(t,i,r){return!(t<0||t>25||r<0||r>=Math.pow(2,t)||i<0||i>=Math.pow(2,t))}(t,i,r))throw Error(`x=${i}, y=${r}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=i,this.y=r,this.key=l0(0,t,t,i,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,i,r){var a,n,s,o,l;let h=(a=this.x,n=this.y,o=lY(256*a,256*(n=Math.pow(2,s=this.z)-n-1),s),l=lY(256*(a+1),256*(n+1),s),o[0]+","+o[1]+","+l[0]+","+l[1]),u=function(t,i,r){let a,n="";for(let s=t;s>0;s--)n+=(i&(a=1<<s-1)?1:0)+(r&a?2:0);return n}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,i>1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,h)}isChildOf(t){let i=this.z-t.z;return i>0&&t.x===this.x>>i&&t.y===this.y>>i}getTilePoint(t){let i=Math.pow(2,this.z);return new w((t.x*i-this.x)*8192,(t.y*i-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}}class lJ{constructor(t,i){this.wrap=t,this.canonical=i,this.key=l0(t,i.z,i.z,i.x,i.y)}}class lQ{constructor(t,i,r,a,n){if(this.terrainRttPosMatrix32f=null,t<r)throw Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=i,this.canonical=new lK(r,+a,+n),this.key=l0(i,t,r,a,n)}clone(){return new lQ(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-t;return t>this.canonical.z?new lQ(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new lQ(t,this.wrap,t,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,i){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?l0(this.wrap*i,t,this.canonical.z,this.canonical.x,this.canonical.y):l0(this.wrap*i,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap||this.overscaledZ-t.overscaledZ<=0)return!1;if(0===t.overscaledZ)return this.overscaledZ>0;let i=this.canonical.z-t.canonical.z;return!(i<0)&&t.canonical.x===this.canonical.x>>i&&t.canonical.y===this.canonical.y>>i}children(t){if(this.overscaledZ>=t)return[new lQ(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=2*this.canonical.x,a=2*this.canonical.y;return[new lQ(i,this.wrap,i,r,a),new lQ(i,this.wrap,i,r+1,a),new lQ(i,this.wrap,i,r,a+1),new lQ(i,this.wrap,i,r+1,a+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new lQ(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new lQ(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new lJ(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new lX(t.x-this.wrap,t.y))}}function l0(t,i,r,a,n){(t*=2)<0&&(t=-1*t-1);let s=1<<r;return(s*s*t+s*n+a).toString(36)+r.toString(36)+i.toString(36)}function l1(t,i){return i?t.properties[i]:t.id}function l2(t){var i,r;if(!t)return{};let a={};
2return a.removeAll=t.removeAll,a.remove=new Set(t.remove||[]),a.add=new Map(null==(i=t.add)?void 0:i.map(t=>[t.id,t])),a.update=new Map(null==(r=t.update)?void 0:r.map(t=>[t.id,t])),a}aA("CanonicalTileID",lK),aA("OverscaledTileID",lQ,{omit:["terrainRttPosMatrix32f"]});class l3{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){let i=new l3;return i.extend(t(new w(this.minX,this.minY))),i.extend(t(new w(this.maxX,this.minY))),i.extend(t(new w(this.minX,this.maxY))),i.extend(t(new w(this.maxX,this.maxY))),i}static fromPoints(t){let i=new l3;for(let r of t)i.extend(r);return i}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class l5{constructor(t){this._stringToNumber={},this._numberToString=[];for(let i=0;i<t.length;i++){const r=t[i];this._stringToNumber[r]=i,this._numberToString[i]=r}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class l4{constructor(t,i,r,a,n){this.type="Feature",this._vectorTileFeature=t,this._x=r,this._y=a,this._z=i,this.properties=t.properties,this.id=n}projectPoint(t,i,r,a){return[360*(t.x+i)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+r)/a)*Math.PI))-90]}projectLine(t,i,r,a){return t.map(t=>this.projectPoint(t,i,r,a))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,i=t.extent*Math.pow(2,this._z),r=t.extent*this._x,a=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let t=[];for(let i of n)t.push(i[0]);let s=this.projectLine(t,r,a,i);this._geometry=1===t.length?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{let t=n.map(t=>this.projectLine(t,r,a,i));this._geometry=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t};break}case 3:{let t=oL(n),s=[];for(let n of t)s.push(n.map(t=>this.projectLine(t,r,a,i)));this._geometry=1===s.length?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let i in this)"_geometry"!==i&&"_vectorTileFeature"!==i&&"_x"!==i&&"_y"!==i&&"_z"!==i&&(t[i]=this[i]);return t}}class l6{_name;dataBuffer;nullabilityBuffer;_size;constructor(t,i,r){this._name=t,this.dataBuffer=i,"number"==typeof r?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer&&this.nullabilityBuffer.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class l8 extends l6{}class l9 extends l8{getValueFromBuffer(t){return this.dataBuffer[t]}}class l7 extends l8{getValueFromBuffer(t){return this.dataBuffer[t]}}class he extends l6{delta;constructor(t,i,r,a){super(t,i,a),this.delta=r}}class ht extends he{constructor(t,i,r,a){super(t,Int32Array.of(i),r,a)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}}class hi extends l6{constructor(t,i,r){super(t,Int32Array.of(i),r)}getValueFromBuffer(t){return this.dataBuffer[0]}}class hr{_name;_geometryVector;_idVector;_propertyVectors;_extent;propertyVectorsMap;constructor(t,i,r,a,n=4096){this._name=t,this._geometryVector=i,this._idVector=r,this._propertyVectors=a,this._extent=n}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(t=>[t.name,t]))),this.propertyVectorsMap.get(t)}*[Symbol.iterator](){let t=this.geometryVector[Symbol.iterator](),i=0;for(;i<this.numFeatures;){let r;this.idVector&&(r=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(i)):this.idVector.getValue(i));let a=t?.next().value,n={};
2for(let t of this.propertyVectors){if(!t)continue;let r=t.name,a=t.getValue(i);null!==a&&(n[r]=a)}i++,yield{id:r,geometry:a,properties:n}}}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],i=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let a;this.idVector&&(a=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(r)):this.idVector.getValue(r));let n={coordinates:i[r],type:this.geometryVector.geometryType(r)},s={};for(let t of this.propertyVectors){if(!t)continue;let i=t.name,a=t.getValue(r);null!==a&&(s[i]=a)}t.push({id:a,geometry:n,properties:s})}return t}containsMaxSaveIntegerValues(t){return t instanceof l9||t instanceof hi&&t instanceof ht||t instanceof l7}}class ha{value;constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}}function hn(t,i,r){let a=new Int32Array(r),n=0,s=i.get();for(let i=0;i<a.length;i++){let i=t[s++],r=127&i;i<128||(r|=(127&(i=t[s++]))<<7,i<128||(r|=(127&(i=t[s++]))<<14,i<128||(r|=(127&(i=t[s++]))<<21,i<128||(r|=(15&(i=t[s++]))<<28)))),a[n++]=r}return i.set(s),a}function hs(t,i,r){let a=new BigInt64Array(r);for(let r=0;r<a.length;r++)a[r]=function(t,i){let r=0n,a=0,n=i.get();for(;n<t.length;){let i=t[n++];if(r|=BigInt(127&i)<<BigInt(a),!(128&i))break;if((a+=7)>=64)throw Error("Varint too long")}return i.set(n),r}(t,i);return a}function ho(t,i,r,a){throw Error("FastPFor is not implemented yet.")}function hl(t){return t>>>1^-(1&t)}function hh(t){return t>>1n^-(1n&t)}function hu(t,i,r){let a=new Int32Array(r),n=0;for(let r=0;r<i;r++){let s=t[r];a.fill(t[r+i],n,n+s),n+=s}return a}function hc(t,i,r){let a=new BigInt64Array(r),n=0;for(let r=0;r<i;r++){let s=Number(t[r]);a.fill(t[r+i],n,n+s),n+=s}return a}function hd(t,i,r){let a=new Float64Array(r),n=0;for(let r=0;r<i;r++){let s=t[r];a.fill(t[r+i],n,n+s),n+=s}return a}function hp(t){let i=t.length/4*4,r=1;if(i>=4)for(let a=t[0];r<i-4;r+=4)a=t[r]+=a,a=t[r+1]+=a,a=t[r+2]+=a,a=t[r+3]+=a;for(;r!=t.length;)t[r]+=t[r-1],++r}function hf(t){t[0]=t[0]>>>1^-(1&t[0]),t[1]=t[1]>>>1^-(1&t[1]);let i=t.length/4*4,r=2;if(i>=4)for(;r<i-4;r+=4){let i=t[r],a=t[r+1],n=t[r+2],s=t[r+3];t[r]=(i>>>1^-(1&i))+t[r-2],t[r+1]=(a>>>1^-(1&a))+t[r-1],t[r+2]=(n>>>1^-(1&n))+t[r],t[r+3]=(s>>>1^-(1&s))+t[r+1]}for(;r!=t.length;r+=2)t[r]=(t[r]>>>1^-(1&t[r]))+t[r-2],t[r+1]=(t[r+1]>>>1^-(1&t[r+1]))+t[r-1]}(S=L||(L={})).NONE="NONE",S.DELTA="DELTA",S.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",S.RLE="RLE",S.MORTON="MORTON",S.PDE="PDE",(P=F||(F={})).NONE="NONE",P.FAST_PFOR="FAST_PFOR",P.VARINT="VARINT",P.ALP="ALP",(M=B||(B={})).PRESENT="PRESENT",M.DATA="DATA",M.OFFSET="OFFSET",M.LENGTH="LENGTH";class hm{_dictionaryType;_offsetType;_lengthType;constructor(t,i,r){this._dictionaryType=t,this._offsetType=i,this._lengthType=r}get dictionaryType(){return this._dictionaryType}get offsetType(){return this._offsetType}get lengthType(){return this._lengthType}}function h_(t,i){let r,a,n=function(t,i){let r=t[i.get()],a=Object.values(B)[r>>4],n=null;switch(a){case B.DATA:n=new hm(Object.values(O)[15&r]);break;case B.OFFSET:n=new hm(null,Object.values(V)[15&r]);break;case B.LENGTH:n=new hm(null,null,Object.values(j)[15&r])}i.increment();let s=t[i.get()],o=Object.values(L)[s>>5],l=Object.values(L)[s>>2&7],h=Object.values(F)[3&s];i.increment();let u=hn(t,i,2),c=u[0];return{physicalStreamType:a,logicalStreamType:n,logicalLevelTechnique1:o,logicalLevelTechnique2:l,physicalLevelTechnique:h,numValues:c,byteLength:u[1],decompressedCount:c}}(t,i);return n.logicalLevelTechnique1===L.MORTON?(r=hn(t,i,2),{physicalStreamType:n.physicalStreamType,logicalStreamType:n.logicalStreamType,logicalLevelTechnique1:n.logicalLevelTechnique1,logicalLevelTechnique2:n.logicalLevelTechnique2,physicalLevelTechnique:n.physicalLevelTechnique,numValues:n.numValues,byteLength:n.byteLength,decompressedCount:n.decompressedCount,numBits:r[0],coordinateShift:r[1]}):L.RLE!==n.logicalLevelTechnique1&&L.RLE!==n.logicalLevelTechnique2||F.NONE===n.physicalLevelTechnique?n:(a=hn(t,i,2),{physicalStreamType:n.physicalStreamType,logicalStreamType:n.logicalStreamType,logicalLevelTechnique1:n.logicalLevelTechnique1,logicalLevelTechnique2:n.logicalLevelTechnique2,physicalLevelTechnique:n.physicalLevelTechnique,numValues:n.numValues,byteLength:n.byteLength,decompressedCount:a[1],runs:a[0],numRleValues:a[1]})}(I=O||(O={})).NONE="NONE",I.SINGLE="SINGLE",I.SHARED="SHARED",I.VERTEX="VERTEX",I.MORTON="MORTON",I.FSST="FSST",(E=V||(V={})).VERTEX="VERTEX",E.INDEX="INDEX",E.STRING="STRING",E.KEY="KEY",(C=j||(j={})).VAR_BINARY="VAR_BINARY",C.GEOMETRIES="GEOMETRIES",C.PARTS="PARTS",C.RINGS="RINGS",C.TRIANGLES="TRIANGLES",C.SYMBOL="SYMBOL",C.DICTIONARY="DICTIONARY",(A=N||(N={}
2))[A.FLAT=0]="FLAT",A[A.CONST=1]="CONST",A[A.SEQUENCE=2]="SEQUENCE",A[A.DICTIONARY=3]="DICTIONARY",A[A.FSST_DICTIONARY=4]="FSST_DICTIONARY";class hg{values;_size;constructor(t,i){this.values=t,this._size=i}get(t){let i=Math.floor(t/8);return 1==(this.values[i]>>t%8&1)}set(t,i){let r=Math.floor(t/8);this.values[r]=this.values[r]|!!i<<t%8}getInt(t){let i=Math.floor(t/8);return this.values[i]>>t%8&1}size(){return this._size}getBuffer(){return this.values}}function hy(t,i,r,a,n){return function(t,i,r){switch(i.logicalLevelTechnique1){case L.DELTA:return i.logicalLevelTechnique2===L.RLE?function(t,i,r){let a=new Int32Array(r),n=0,s=0;for(let r=0;r<i;r++){let o=t[r],l=hl(t[r+i]);for(let t=0;t<o;t++)s+=l,a[n++]=s}return a}(t,i.runs,i.numRleValues):(function(t){t[0]=t[0]>>>1^-(1&t[0]);let i=t.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let i=t[r],a=t[r+1],n=t[r+2],s=t[r+3];t[r]=(i>>>1^-(1&i))+t[r-1],t[r+1]=(a>>>1^-(1&a))+t[r],t[r+2]=(n>>>1^-(1&n))+t[r+1],t[r+3]=(s>>>1^-(1&s))+t[r+2]}for(;r!=t.length;++r)t[r]=(t[r]>>>1^-(1&t[r]))+t[r-1]}(t),t);case L.RLE:return r?function(t,i,r){let a=new Int32Array(r),n=0;for(let r=0;r<i;r++){let s=t[r],o=t[r+i];o=o>>>1^-(1&o),a.fill(o,n,n+s),n+=s}return a}(t,i.runs,i.numRleValues):hu(t,i.runs,i.numRleValues);case L.MORTON:return hp(t),t;case L.COMPONENTWISE_DELTA:return hf(t),t;case L.NONE:return r&&function(t){for(let i=0;i<t.length;i++){let r=t[i];t[i]=r>>>1^-(1&r)}}(t),t;default:throw Error(`The specified Logical level technique is not supported: ${i.logicalLevelTechnique1}`)}}(hv(t,i,r),r,a)}function hx(t,i,r){return function(t,i){if(i.logicalLevelTechnique1===L.DELTA&&i.logicalLevelTechnique2===L.NONE){var r=t;let i=new Int32Array(r.length+1);i[0]=0,i[1]=hl(r[0]);let a=i[1],n=2;for(;n!=i.length;++n){let t=r[n-1];a+=t>>>1^-(1&t),i[n]=i[n-1]+a}return i}if(i.logicalLevelTechnique1===L.RLE&&i.logicalLevelTechnique2===L.NONE)return function(t,i,r){let a=new Int32Array(r+1);a[0]=0;let n=1,s=a[0];for(let r=0;r<i;r++){let o=t[r],l=t[r+i];for(let t=n;t<n+o;t++)a[t]=l+s,s=a[t];n+=o}return a}(t,i.runs,i.numRleValues);if(i.logicalLevelTechnique1===L.NONE&&i.logicalLevelTechnique2===L.NONE){let r=0;for(let i=0;i<t.length;i++)t[i]+=r,r=t[i];let a=new Int32Array(i.numValues+1);return a[0]=0,a.set(t,1),a}if(i.logicalLevelTechnique1===L.DELTA&&i.logicalLevelTechnique2===L.RLE){let r=function(t,i,r){let a=new Int32Array(r+1);a[0]=0;let n=1,s=a[0];for(let r=0;r<i;r++){let o=t[r],l=t[r+i];l=l>>>1^-(1&l);for(let t=n;t<n+o;t++)a[t]=l+s,s=a[t];n+=o}return a}(t,i.runs,i.numRleValues);return hp(r),r}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}(hv(t,i,r),r)}function hv(t,i,r){let a=r.physicalLevelTechnique;if(a===F.FAST_PFOR)return ho();if(a===F.VARINT)return hn(t,i,r.numValues);if(a===F.NONE){let a=i.get();return i.add(r.byteLength),new Int32Array(t.subarray(a,i.get()))}throw Error("Specified physicalLevelTechnique is not supported (yet).")}function hb(t,i,r,a){let n=hv(t,i,r);if(1===n.length){let t=n[0];return a?hl(t):t}return a?hl(n[1]):n[1]}function hw(t,i,r){var a=hv(t,i,r);if(2==a.length){let t=hl(a[1]);return[t,t]}return[hl(a[2]),hl(a[3])]}function hT(t,i,r){var a=hs(t,i,r.numValues);if(2==a.length){let t=hh(a[1]);return[t,t]}return[hh(a[2]),hh(a[3])]}function hS(t,i,r,a){return function(t,i,r){switch(i.logicalLevelTechnique1){case L.DELTA:return i.logicalLevelTechnique2===L.RLE?function(t,i,r){let a=new BigInt64Array(r),n=0,s=0n;for(let r=0;r<i;r++){let o=Number(t[r]),l=hh(t[r+i]);for(let t=0;t<o;t++)s+=l,a[n++]=s}return a}(t,i.runs,i.numRleValues):(function(t){t[0]=t[0]>>1n^-(1n&t[0]);let i=t.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let i=t[r],a=t[r+1],n=t[r+2],s=t[r+3];t[r]=(i>>1n^-(1n&i))+t[r-1],t[r+1]=(a>>1n^-(1n&a))+t[r],t[r+2]=(n>>1n^-(1n&n))+t[r+1],t[r+3]=(s>>1n^-(1n&s))+t[r+2]}for(;r!=t.length;++r)t[r]=(t[r]>>1n^-(1n&t[r]))+t[r-1]}(t),t);case L.RLE:return r?function(t,i,r){let a=new BigInt64Array(r),n=0;for(let r=0;r<i;r++){let s=Number(t[r]),o=t[r+i];o=o>>1n^-(1n&o),a.fill(o,n,n+s),n+=s}return a}(t,i.runs,i.numRleValues):hc(t,i.runs,i.numRleValues);case L.NONE:return r&&function(t){for(let i=0;i<t.length;i++){let r=t[i];t[i]=r>>1n^-(1n&r)}}(t),t;default:throw Error(`The specified Logical level technique is not supported: ${i.logicalLevelTechnique1}`)}}(hs(t,i,r.numValues),r,a)}function hP(t,i,r,a){let n=hs(t,i,r.numValues);if(1===n.length){let t=n[0];return a?hh(t):t}return a?hh(n[1]):n[1]}function hM(t,i,r,a,n){return function(t,i,r,a){switch(i.logicalLevelTechnique1){case L.DELTA:return i.logicalLevelTechnique2===L.RLE&&(t=hu(t,i.runs,i.numRleValues)),function(t,i){let r=new Int32Array(t.size()),a=0;t.get(0)?(r[0]=t.get(0)?i[0]>>>
21^-(1&i[0]):0,a=1):r[0]=0;let n=1;for(;n!=r.length;++n)r[n]=t.get(n)?r[n-1]+(i[a]>>>1^-(1&i[a++])):r[n-1];return r}(a,t);case L.RLE:var n;return n=t,r?function(t,i,r){let a=new Int32Array(t.size()),n=0;for(let s=0;s<r;s++){let o=i[s],l=i[s+r];l=l>>>1^-(1&l);for(let i=n;i<n+o;i++)t.get(i)?a[i]=l:(a[i]=0,n++);n+=o}return a}(a,n,i.runs):function(t,i,r){let a=new Int32Array(t.size()),n=0;for(let s=0;s<r;s++){let o=i[s],l=i[s+r];for(let i=n;i<n+o;i++)t.get(i)?a[i]=l:(a[i]=0,n++);n+=o}return a}(a,n,i.runs);case L.MORTON:return hp(t),t;case L.COMPONENTWISE_DELTA:return hf(t),t;case L.NONE:return r?function(t,i){let r=new Int32Array(t.size()),a=0,n=0;for(;n!=r.length;++n)if(t.get(n)){let t=i[a++];r[n]=t>>>1^-(1&t)}else r[n]=0;return r}(a,t):function(t,i){let r=new Int32Array(t.size()),a=0,n=0;for(;n!=r.length;++n)r[n]=t.get(n)?i[a++]:0;return r}(a,t);default:throw Error("The specified Logical level technique is not supported")}}(r.physicalLevelTechnique===F.FAST_PFOR?ho():hn(t,i,r.numValues),r,a,n)}function hI(t,i,r,a){let n=t.logicalLevelTechnique1;if(n===L.RLE)return 1===t.runs?N.CONST:N.FLAT;let s=i instanceof hg?i.size():i;if(n===L.DELTA&&t.logicalLevelTechnique2===L.RLE){let i=t.runs;if(t.numRleValues!==s)return N.FLAT;if(1===i)return N.SEQUENCE;if(2===i){let i,n=a.get();if(t.physicalLevelTechnique===F.VARINT)i=hn(r,a,4);else{let t=a.get();i=new Int32Array(r.buffer,r.byteOffset+t,4)}if(a.set(n),2===i[2]&&2===i[3])return N.SEQUENCE}}return 1===t.numValues?N.CONST:N.FLAT}class hE extends l8{getValueFromBuffer(t){return this.dataBuffer[t]}}class hC extends he{constructor(t,i,r,a){super(t,BigInt64Array.of(i),r,a)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}}class hA{_geometryOffsets;_partOffsets;_ringOffsets;constructor(t,i,r){this._geometryOffsets=t,this._partOffsets=i,this._ringOffsets=r}get geometryOffsets(){return this._geometryOffsets}get partOffsets(){return this._partOffsets}get ringOffsets(){return this._ringOffsets}}function hD(t,i,r){return{x:hz(t,i)-r,y:hz(t>>1,i)-r}}function hz(t,i){let r=0;for(let a=0;a<i;a++)r|=(t&1<<2*a)>>a;return r}(D=U||(U={}))[D.POINT=0]="POINT",D[D.LINESTRING=1]="LINESTRING",D[D.POLYGON=2]="POLYGON",D[D.MULTIPOINT=3]="MULTIPOINT",D[D.MULTILINESTRING=4]="MULTILINESTRING",D[D.MULTIPOLYGON=5]="MULTIPOLYGON",(z=G||(G={}))[z.POINT=0]="POINT",z[z.LINESTRING=1]="LINESTRING",z[z.POLYGON=2]="POLYGON",(k=q||(q={}))[k.MORTON=0]="MORTON",k[k.VEC_2=1]="VEC_2",k[k.VEC_3=2]="VEC_3";class hk{createPoint(t){return[[t]]}createMultiPoint(t){return t.map(t=>[t])}createLineString(t){return[t]}createMultiLineString(t){return t}createPolygon(t,i){return[t].concat(i)}createMultiPolygon(t){return t.flat()}}function hR(t){let i=Array(t.numGeometries),r=1,a=1,n=1,s=0,o=new hk,l=0,h=0,u=t.mortonSettings,c=t.topologyVector,d=c.geometryOffsets,p=c.partOffsets,f=c.ringOffsets,m=t.vertexOffsets,_=t.containsPolygonGeometry(),g=t.vertexBuffer;for(let c=0;c<t.numGeometries;c++){let y=t.geometryType(c);if(y===U.POINT){if(m&&0!==m.length)if(t.vertexBufferType===q.VEC_2){let t=2*m[h++],r=new w(g[t],g[t+1]);i[s++]=o.createPoint(r)}else{let t=hD(g[m[h++]],u.numBits,u.coordinateShift),r=new w(t.x,t.y);i[s++]=o.createPoint(r)}else{let t=new w(g[l++],g[l++]);i[s++]=o.createPoint(t)}d&&n++,p&&r++,f&&a++}else if(y===U.MULTIPOINT){let t=d[n]-d[n-1];n++;let r=Array(t);if(m&&0!==m.length){for(let i=0;i<t;i++){let t=2*m[h++];r[i]=new w(g[t],g[t+1])}i[s++]=o.createMultiPoint(r)}else{for(let i=0;i<t;i++){let t=g[l++],a=g[l++];r[i]=new w(t,a)}i[s++]=o.createMultiPoint(r)}}else if(y===U.LINESTRING){let c,y=0;_?(y=f[a]-f[a-1],a++):y=p[r]-p[r-1],r++,m&&0!==m.length?(c=t.vertexBufferType===q.VEC_2?hF(g,m,h,y,!1):hB(g,m,h,y,!1,u),h+=y):(c=hL(g,l,y,!1),l+=2*y),i[s++]=o.createLineString(c),d&&n++}else if(y===U.POLYGON){let c=p[r]-p[r-1];r++;let _=Array(c-1),y=f[a]-f[a-1];if(a++,m&&0!==m.length){let r=t.vertexBufferType===q.VEC_2?hF(g,m,h,y,!0):hB(g,m,h,y,!0,u);h+=y;for(let i=0;i<_.length;i++)y=f[a]-f[a-1],a++,_[i]=t.vertexBufferType===q.VEC_2?hF(g,m,h,y,!0):hB(g,m,h,y,!0,u),h+=y;i[s++]=o.createPolygon(r,_)}else{let t=hL(g,l,y,!0);l+=2*y;for(let t=0;t<_.length;t++)y=f[a]-f[a-1],a++,_[t]=hL(g,l,y,!0),l+=2*y;i[s++]=o.createPolygon(t,_)}d&&n++}else if(y===U.MULTILINESTRING){let c=d[n]-d[n-1];n++;let y=Array(c);if(m&&0!==m.length){for(let i=0;i<c;i++){let n=0;_?(n=f[a]-f[a-1],a++):n=p[r]-p[r-1],r++;let s=t.vertexBufferType===q.VEC_2?hF(g,m,h,n,!1):hB(g,m,h,n,!1,u);y[i]=s,h+=n}i[s++]=o.createMultiLineString(y)}else{for(let t=0;t<c;t++){let i=0;
2_?(i=f[a]-f[a-1],a++):i=p[r]-p[r-1],r++,y[t]=hL(g,l,i,!1),l+=2*i}i[s++]=o.createMultiLineString(y)}}else{if(y!==U.MULTIPOLYGON)throw Error("The specified geometry type is currently not supported.");{let c=d[n]-d[n-1];n++;let _=Array(c),y=0;if(m&&0!==m.length){for(let i=0;i<c;i++){let n=p[r]-p[r-1];r++;let s=Array(n-1);y=f[a]-f[a-1],a++;let l=t.vertexBufferType===q.VEC_2?hF(g,m,h,y,!0):hB(g,m,h,y,!0,u);h+=y;for(let i=0;i<s.length;i++)y=f[a]-f[a-1],a++,s[i]=t.vertexBufferType===q.VEC_2?hF(g,m,h,y,!0):hB(g,m,h,y,!0,u),h+=y;_[i]=o.createPolygon(l,s)}i[s++]=o.createMultiPolygon(_)}else{for(let t=0;t<c;t++){let i=p[r]-p[r-1];r++;let n=Array(i-1);y=f[a]-f[a-1],a++;let s=hL(g,l,y,!0);l+=2*y;for(let t=0;t<n.length;t++){let i=f[a]-f[a-1];a++,n[t]=hL(g,l,i,!0),l+=2*i}_[t]=o.createPolygon(s,n)}i[s++]=o.createMultiPolygon(_)}}}}return i}function hL(t,i,r,a){let n=Array(a?r+1:r);for(let a=0;a<2*r;a+=2)n[a/2]=new w(t[i+a],t[i+a+1]);return a&&(n[n.length-1]=n[0]),n}function hF(t,i,r,a,n){let s=Array(n?a+1:a);for(let n=0;n<2*a;n+=2){let a=2*i[r+n/2];s[n/2]=new w(t[a],t[a+1])}return n&&(s[s.length-1]=s[0]),s}function hB(t,i,r,a,n,s){let o=Array(n?a+1:a);for(let n=0;n<a;n++){let a=hD(t[i[r+n]],s.numBits,s.coordinateShift);o[n]=new w(a.x,a.y)}return n&&(o[o.length-1]=o[0]),o}class hO{_vertexBufferType;_topologyVector;_vertexOffsets;_vertexBuffer;_mortonSettings;constructor(t,i,r,a,n){this._vertexBufferType=t,this._topologyVector=i,this._vertexOffsets=r,this._vertexBuffer=a,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}*[Symbol.iterator](){let t=hR(this),i=0;for(;i<this.numGeometries;)yield{coordinates:t[i],type:this.geometryType(i)},i++}getSimpleEncodedVertex(t){let i=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){let i=hD(this.vertexBuffer[this.vertexOffsets[t]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[i.x,i.y]}let i=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getGeometries(){return hR(this)}get mortonSettings(){return this._mortonSettings}}class hV extends hO{_numGeometries;_geometryType;constructor(t,i,r,a,n,s,o){super(r,a,n,s,o),this._numGeometries=t,this._geometryType=i}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===U.POLYGON||this._geometryType===U.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class hj extends hO{_geometryTypes;constructor(t,i,r,a,n,s){super(t,r,a,n,s),this._geometryTypes=i}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===U.POLYGON||this.geometryType(t)===U.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class hN{_triangleOffsets;_indexBuffer;_vertexBuffer;_topologyVector;constructor(t,i,r,a){this._triangleOffsets=t,this._indexBuffer=i,this._vertexBuffer=r,this._topologyVector=a}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let t=Array(this.numGeometries),i=this._topologyVector,r=i.partOffsets,a=i.ringOffsets,n=i.geometryOffsets,s=0,o=1,l=1,h=1;for(let i=0;i<this.numGeometries;i++)switch(this.geometryType(i)){case U.POLYGON:{let u=r[o]-r[o-1];o++;let c=[];for(let t=0;t<u;t++){let t=a[l]-a[l-1];l++;let i=[];for(let r=0;r<t;r++){let t=this._vertexBuffer[s++],r=this._vertexBuffer[s++];i.push(new w(t,r))}i.length>0&&i.push(i[0]),c.push(i)}t[i]=c,n&&h++}break;case U.MULTIPOLYGON:{let u=n[h]-n[h-1];h++;let c=[];for(let t=0;t<u;t++){let t=r[o]-r[o-1];o++;for(let i=0;i<t;i++){let t=a[l]-a[l-1];l++;let i=[];for(let r=0;r<t;r++){let t=this._vertexBuffer[s++],r=this._vertexBuffer[s++];i.push(new w(t,r))}i.length>0&&i.push(i[0]),c.push(i)}}t[i]=c}}return t}[Symbol.iterator](){return null}}class hU extends hN{_numGeometries;_geometryType;constructor(t,i,r,a,n,s){super(r,a,n,s),this._numGeometries=t,this._geometryType=i}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}class hG extends hN{_geometryTypes;constructor(t,i,r,a,n){super(i,r,a,n),this._geometryTypes=t}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function hq(t,i,r){let a=new Int32Array(t.length+1),n=0;a[0]=n;let s=0;for(let o=0;o<t.length;o++)n=a[o+1]=n+(t[o]>r?i[s++]:1);return a}function hZ(t,i,r,a){let n=new Int32Array(i[i.length-1]+1),s=0;
2n[0]=s;let o=1,l=0;for(let h=0;h<t.length;h++){let u=t[h],c=i[h+1]-i[h];if(5===u||2===u||a&&(4===u||1===u))for(let t=0;t<c;t++)s=n[o++]=s+r[l++];else for(let t=0;t<c;t++)n[o++]=++s}return n}class h$ extends l6{dataVector;constructor(t,i,r){super(t,i.getBuffer(),r),this.dataVector=i}getValueFromBuffer(t){return this.dataVector.get(t)}}class hW extends l8{getValueFromBuffer(t){return this.dataBuffer[t]}}class hH extends l6{constructor(t,i,r){super(t,BigInt64Array.of(i),r)}getValueFromBuffer(t){return this.dataBuffer[0]}}function hX(t,i,r){return hY(t,Math.ceil(i/8),r)}function hY(t,i,r){let a=new Uint8Array(i),n=0;for(;n<i;){let i=t[r.increment()];if(i<=127){let s=i+3,o=t[r.increment()],l=n+s;a.fill(o,n,l),n=l}else{let s=256-i;for(let i=0;i<s;i++)a[n++]=t[r.increment()]}}return a}let hK=new TextDecoder;function hJ(t,i,r){return r-i>=12?hK.decode(t.subarray(i,r)):function(t,i,r){let a="",n=i;for(;n<r;){let i=t[n],s,o,l,h=null,u=i>239?4:i>223?3:i>191?2:1;if(n+u>r)break;1===u?i<128&&(h=i):2===u?128==(192&(s=t[n+1]))&&(h=(31&i)<<6|63&s)<=127&&(h=null):3===u?(s=t[n+1],o=t[n+2],128==(192&s)&&128==(192&o)&&((h=(15&i)<<12|(63&s)<<6|63&o)<=2047||h>=55296&&h<=57343)&&(h=null)):4===u&&(s=t[n+1],o=t[n+2],l=t[n+3],128==(192&s)&&128==(192&o)&&128==(192&l)&&((h=(15&i)<<18|(63&s)<<12|(63&o)<<6|63&l)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,u=1):h>65535&&(h-=65536,a+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),a+=String.fromCharCode(h),n+=u}return a}(t,i,r)}class hQ extends l6{offsetBuffer;constructor(t,i,r,a){super(t,r,a),this.offsetBuffer=i}}class h0 extends hQ{textEncoder;constructor(t,i,r,a){super(t,i,r,a??i.length-1),this.textEncoder=new TextEncoder}getValueFromBuffer(t){return hJ(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class h1 extends hQ{indexBuffer;textEncoder;constructor(t,i,r,a,n){super(t,r,a,n??i.length),this.indexBuffer=i,this.indexBuffer=i,this.textEncoder=new TextEncoder}getValueFromBuffer(t){let i=this.indexBuffer[t];return hJ(this.dataBuffer,this.offsetBuffer[i],this.offsetBuffer[i+1])}}class h2 extends hQ{indexBuffer;symbolOffsetBuffer;symbolTableBuffer;textEncoder;symbolLengthBuffer;lengthBuffer;decodedDictionary;constructor(t,i,r,a,n,s,o){super(t,r,a,o),this.indexBuffer=i,this.symbolOffsetBuffer=n,this.symbolTableBuffer=s,this.textEncoder=new TextEncoder}getValueFromBuffer(t){null==this.decodedDictionary&&(null==this.symbolLengthBuffer&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.lengthBuffer=this.offsetToLengthBuffer(this.offsetBuffer)),this.decodedDictionary=function(t,i,r){let a=[],n=Array(i.length).fill(0);for(let t=1;t<i.length;t++)n[t]=n[t-1]+i[t-1];for(let s=0;s<r.length;s++)if(255===r[s])a.push(r[++s]);else{let o=i[r[s]],l=n[r[s]];for(let i=0;i<o;i++)a.push(t[l+i])}return new Uint8Array(a)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));let i=this.indexBuffer[t];return hJ(this.decodedDictionary,this.offsetBuffer[i],this.offsetBuffer[i+1])}offsetToLengthBuffer(t){let i=new Uint32Array(t.length-1),r=t[0];for(let a=1;a<t.length;a++){let n=t[a];i[a-1]=n-r,r=n}return i}}function h3(t){return t instanceof hg}let h5=new TextDecoder;function h4(t,i){let r=hn(t,i,1)[0];if(0===r)return"";let a=i.get(),n=t.subarray(a,a+r);return i.add(r),h5.decode(n)}class h6{constructor(t,i){var r;switch(this._featureData=t,this.properties=this._featureData.properties||{},null==(r=this._featureData.geometry)?void 0:r.type){case U.POINT:case U.MULTIPOINT:this.type=1;break;case U.LINESTRING:case U.MULTILINESTRING:this.type=2;break;case U.POLYGON:case U.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=i,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let i of this._featureData.geometry.coordinates){let r=[];for(let t of i)r.push(new w(t.x,t.y));t.push(r)}return t}}class h8{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new h6(this.features[t],this.extent)}}class h9{constructor(t){this.layers={};const i=function(t,i=!0){let r=new ha(0),a=[];for(;r.get()<t.length;){let s=hn(t,r,1)[0]>>>0,o=r.get()+s;if(o>t.length)throw Error(`Block overruns tile: ${o} > ${t.length}`);if(1!=hn(t,r,1)[0]>>>0){r.set(o);continue}let l=function(t,i){let r={featureTables:[]},a={};a.name=h4(t,i);let n=hn(t,i,1)[0]>>>0,s=hn(t,i,1)[0]>>>0;a.columns=Array(s);for(let r=0;r<s;r++)a.columns[r]=function(t,i){let r=hn(t,i,1)[0]>>>0,a=function(t){switch(t){case 0:case 1:case 2:case 3:{let i={};i.nullable=!!(1&t),i.columnScope=0;let r={};return r.physicalType=t>1?6:4,r.type="physicalType",i.scalarType=r,i.type="scalarType",i}
2case 4:{let t={nullable:!1,columnScope:0};return t.type="complexType",t.complexType={type:"physicalType",physicalType:0},t}case 30:{let t={nullable:!1,columnScope:0};return t.type="complexType",t.complexType={type:"physicalType",physicalType:1},t}default:let i=null;switch(t){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}let r={};r.nullable=!!(1&t),r.columnScope=0;let a={type:"physicalType"};return a.physicalType=i,r.type="scalarType",r.scalarType=a,r}}(r);if(!a)throw Error(`Unsupported column type code: ${r}`);if(r>=10?a.name=h4(t,i):r>=0&&r<=3?a.name="id":4===r&&(a.name="geometry"),30===r){let r=hn(t,i,1)[0]>>>0,n=a.complexType;n.children=Array(r);for(let a=0;a<r;a++)n.children[a]=function t(i,r){let a=hn(i,r,1)[0]>>>0,n=!!(4&a),s=hn(i,r,1)[0]>>>0,o={};if(1&a&&(o.nullable=!0),2&a){let l={};if(n?(l.type="logicalType",l.logicalType=s):(l.type="physicalType",l.physicalType=s),8&a){let a=hn(i,r,1)[0]>>>0;l.children=Array(a);for(let n=0;n<a;n++)l.children[n]=t(i,r)}o.type="complexField",o.complexField=l}else{let t={};n?(t.type="logicalType",t.logicalType=s):(t.type="physicalType",t.physicalType=s),o.type="scalarField",o.scalarField=t}return o}(t,i)}return a}(t,i);return r.featureTables.push(a),[r,n]}(t,r),h=l[1],u=l[0].featureTables[0],c=null,d=null,p=[],f=0;for(let a of u.columns){let s=a.name;if("id"===s){let n=null;if(a.nullable){let i=h_(t,r),a=r.get(),s=hX(t,i.numValues,r);r.set(a+i.byteLength),n=new hg(s,i.numValues)}let o=h_(t,r);f=o.decompressedCount,c=function(t,i,r,a,n,s,o=!1){let l=i.scalarType.physicalType,h=hI(n,s,t,r);if(4===l)switch(h){case N.FLAT:return new l9(a,hy(t,r,n,!1),s);case N.SEQUENCE:{let i=hw(t,r,n);return new ht(a,i[0],i[1],n.numRleValues)}case N.CONST:return new hi(a,hb(t,r,n,!1),s)}else switch(h){case N.FLAT:if(o)return new l7(a,function(t,i,r,a){var n,s=function(t,i,r){let a=new Float64Array(i);for(let n=0;n<i;n++)a[n]=function(t,i){let r,a;return a=t[i.get()],i.increment(),r=127&a,a<128?r:(a=t[i.get()],i.increment(),r|=(127&a)<<7,a<128?r:(a=t[i.get()],i.increment(),r|=(127&a)<<14,a<128?r:(a=t[i.get()],i.increment(),r|=(127&a)<<21,a<128?r:function(t,i,r){let a,n;if(n=i[r.get()],r.increment(),a=(112&n)>>4,n<128||(n=i[r.get()],r.increment(),a|=(127&n)<<3,n<128)||(n=i[r.get()],r.increment(),a|=(127&n)<<10,n<128)||(n=i[r.get()],r.increment(),a|=(127&n)<<17,n<128)||(n=i[r.get()],r.increment(),a|=(127&n)<<24,n<128)||(n=i[r.get()],r.increment(),a|=(1&n)<<31,n<128))return 0x100000000*a+(t>>>0);throw Error("Expected varint not more than 10 bytes")}(r|=(15&(a=t[i.get()]))<<28,t,i))))}(t,r);return a}(t,r.numValues,i);switch(r.logicalLevelTechnique1){case L.DELTA:return r.logicalLevelTechnique2===L.RLE&&(s=hd(s,r.runs,r.numRleValues)),function(t){t[0]=t[0]%2==1?-((t[0]+1)/2):t[0]/2;let i=t.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let i=t[r],a=t[r+1],n=t[r+2],s=t[r+3];t[r]=(i%2==1?-((i+1)/2):i/2)+t[r-1],t[r+1]=(a%2==1?-((a+1)/2):a/2)+t[r],t[r+2]=(n%2==1?-((n+1)/2):n/2)+t[r+1],t[r+3]=(s%2==1?-((s+1)/2):s/2)+t[r+2]}for(;r!=t.length;++r)t[r]=(t[r]%2==1?-((t[r]+1)/2):t[r]/2)+t[r-1]}(s),s;case L.RLE:return n=s,a?function(t,i,r){let a=new Float64Array(r),n=0;for(let r=0;r<i;r++){let s=t[r],o=t[r+i];o=o%2==1?-((o+1)/2):o/2,a.fill(o,n,n+s),n+=s}return a}(n,r.runs,r.numRleValues):hd(n,r.runs,r.numRleValues);case L.NONE:return s;default:throw Error(`The specified Logical level technique is not supported: ${r.logicalLevelTechnique1}`)}}(t,r,n,!1),s);return new hE(a,hS(t,r,n,!1),s);case N.SEQUENCE:{let i=hT(t,r,n);return new hC(a,i[0],i[1],n.numRleValues)}case N.CONST:return new hH(a,hP(t,r,n,!1),s)}throw Error("Vector type not supported for id column.")}(t,a,r,s,o,n??f,i)}else if("geometry"===s){let i=hn(t,r,1)[0];if(0===f){let i=r.get();f=h_(t,r).decompressedCount,r.set(i)}d=function(t,i,r,a){var n,s,o,l,h,u,c,d,p,f,m,_,g,y;let x=h_(t,r),v=null,b=null,w=null,T=null,S=null,P=null,M=null,I=null;if(hI(x,a,t,r)===N.CONST){let d=hb(t,r,x,!1);for(let a=0;a<i-1;a++){let i=h_(t,r);switch(i.physicalStreamType){case B.LENGTH:switch(i.logicalStreamType.lengthType){case j.GEOMETRIES:v=hx(t,r,i);break;case j.PARTS:b=hx(t,r,i);break;case j.RINGS:w=hx(t,r,i);break;case j.TRIANGLES:M=hx(t,r,i)}break;case B.OFFSET:switch(i.logicalStreamType.offsetType){case V.VERTEX:T=hy(t,r,i,!1);break;case V.INDEX:I=hy(t,r,i,!1)}break;case B.DATA:O.VERTEX===i.logicalStreamType.dictionaryType?S=hy(t,r,i,!0):(P={numBits:i.numBits,coordinateShift:i.coordinateShift},S=hy(t,r,i,!1))}}return null!==I?null!=v||null!=b?new hU(a,d,M,I,S,new hA(v,b,w)):new hU(a,d,M,I,S,void 0):null===P?(n=new hA(v,b,w),s=T,o=S,new hV(a,d,q.VEC_2,n,s,o)):(l=new hA(v,b,w),h=T,u=S,c=P,new hV(a,d,q.MORTON,l,h,u,c))}let E=hy(t,r,x,!1);for(let a=0;a<i-1;a++){let i=h_(t,r);switch(i.physicalStreamType){case B.LENGTH:switch(i.logicalStreamType.lengthType){case j.GEOMETRIES:v=hy(t,r,i,!1);break;case j.PARTS:b=hy(t,r,i,!1);break;case j.RINGS:w=hy(t,r,i,!1);break;case j.TRIANGLES:M=hx(t,r,i)}break;case B.OFFSET:switch(i.logicalStreamType.offsetType){case V.VERTEX:T=hy(t,r,i,!1);break;case V.INDEX:I=hy(t,r,i,!1)}break;case B.DATA:O.VERTEX===i.logicalStreamType.dictionaryType?S=hy(t,r,i,!0):(P={numBits:i.numBits,coordinateShift:i.coordinateShift},S=hy(t,r,i,!1))}}return null!==I&&null===b?new hG(E,M,I,S,void 0):(null!==v?(v=hq(E,v,2),null!==b&&null!==w?(b=hZ(E,v,b,!1),w=function(t,i,r,a){let n=new Int32Array(r[r.length-1]+1),s=0;
2n[0]=s;let o=1,l=1,h=0;for(let u=0;u<t.length;u++){let c=t[u],d=i[u+1]-i[u];if(0!==c&&3!==c)for(let t=0;t<d;t++){let t=r[o]-r[o-1];o++;for(let i=0;i<t;i++)s=n[l++]=s+a[h++]}else for(let t=0;t<d;t++)n[l++]=++s,o++}return n}(E,v,b,w)):null!==b&&(b=function(t,i,r){let a=new Int32Array(i[i.length-1]+1),n=0;a[0]=n;let s=1,o=0;for(let l=0;l<t.length;l++){let h=t[l],u=i[l+1]-i[l];if(4===h||1===h)for(let t=0;t<u;t++)n=a[s++]=n+r[o++];else for(let t=0;t<u;t++)a[s++]=++n}return a}(E,v,b))):null!==b&&null!==w?(b=hq(E,b,1),w=hZ(E,b,w,!0)):null!==b&&(b=hq(E,b,0)),null!==I?new hG(E,M,I,S,new hA(v,b,w)):null===P?(d=new hA(v,b,w),p=T,f=S,new hj(q.VEC_2,E,d,p,f)):(m=new hA(v,b,w),_=T,g=S,y=P,new hj(q.MORTON,E,m,_,g,y)))}(t,i,r,f)}else{var n;let i=!function(t){if("id"===t.name)return!1;if("scalarType"===t.type){let i=t.scalarType;if("physicalType"===i.type)switch(i.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("logicalType"===i.type)return!1}else if("complexType"===t.type){let i=t.complexType;if("physicalType"===i.type)switch(i.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}(a)?1:hn(t,r,1)[0];if(0===i&&"scalarType"===a.type)continue;let s=(n=f,"scalarType"===a.type?function(t,i,r,a,n,s){var o,l;let h=null,u=0;if(0===t)return null;if(s.nullable){let t=h_(i,r);u=t.numValues;let a=r.get(),n=hX(i,u,r);r.set(a+t.byteLength),h=new hg(n,t.numValues)}let c=h??a;switch(n.physicalType){case 4:case 3:return function(t,i,r,a,n){let s=h_(t,i),o=hI(s,n,t,i),l=3===a.physicalType;if(o===N.FLAT){let a=h3(n)?hM(t,i,s,l,n):hy(t,i,s,l);return new l9(r.name,a,n)}if(o===N.SEQUENCE){let a=hw(t,i,s);return new ht(r.name,a[0],a[1],s.numRleValues)}{let a=hb(t,i,s,l);return new hi(r.name,a,n)}}(i,r,s,n,c);case 9:return function(t,i,r,a,n){var s,o,l,h,u,c,d,p,f,m;let _=null,g=null,y=null,x=null,v=null,b=null,w=null,T=null;for(let t=0;t<a;t++){let t=h_(i,r);if(0!==t.byteLength)switch(t.physicalStreamType){case B.PRESENT:b=new hg(hX(i,t.numValues,r),t.numValues);break;case B.OFFSET:g=null!=n||null!=b?hM(i,r,t,!1,n??b):hy(i,r,t,!1);break;case B.LENGTH:{let a=hx(i,r,t);j.DICTIONARY===t.logicalStreamType.lengthType?_=a:j.SYMBOL===t.logicalStreamType.lengthType?x=a:w=a;break}case B.DATA:{let a=i.subarray(r.get(),r.get()+t.byteLength);r.add(t.byteLength);let n=t.logicalStreamType.dictionaryType;O.FSST===n?v=a:O.SINGLE===n||O.SHARED===n?y=a:O.NONE===n&&(T=a)}}}return s=v,o=g,l=_,h=y,u=x,c=n??b,(s?new h2(t,o,l,h,u,s,c):null)??(d=y,p=g,f=_,m=n??b,d?m?new h1(t,p,f,d,m):new h1(t,p,f,d):null)??function(t,i,r,a,n){if(!i||!r)return null;if(a)return n?new h1(t,a,i,r,n):new h1(t,a,i,r);if(n&&n.size()!==i.length-1){let a=new Int32Array(n.size()),s=0;for(let t=0;t<n.size();t++)a[t]=n.get(t)?s++:0;return new h1(t,a,i,r,n)}return n?new h0(t,i,r,n):new h0(t,i,r)}(t,w,T,g,n??b)}(s.name,i,r,s.nullable?t-1:t,h);case 0:let d,p,f,m,_;return p=(d=h_(i,r)).numValues,f=r.get(),m=h3(c)?function(t,i,r,a){let n=new hg(hY(t,Math.ceil(i/8),r),i),s=a.size(),o=new hg(new Uint8Array(s),s),l=0;for(let t=0;t<a.size();t++){let i=!!a.get(t)&&n.get(l++);o.set(t,i)}return o.getBuffer()}(i,p,r,c):hX(i,p,r),r.set(f+d.byteLength),_=new hg(m,p),new h$(s.name,_,c);case 6:case 5:return function(t,i,r,a,n){let s=h_(t,i),o=hI(s,a,t,i),l=5===n.physicalType;if(o===N.FLAT){let n=h3(a)?function(t,i,r,a){switch(i.logicalLevelTechnique1){case L.DELTA:return i.logicalLevelTechnique2===L.RLE&&(t=hc(t,i.runs,i.numRleValues)),function(t,i){let r=new BigInt64Array(t.size()),a=0;t.get(0)?(r[0]=t.get(0)?i[0]>>1n^-(1n&i[0]):0n,a=1):r[0]=0n;let n=1;for(;n!=r.length;++n)r[n]=t.get(n)?r[n-1]+(i[a]>>1n^-(1n&i[a++])):r[n-1];return r}(a,t);case L.RLE:var n;return n=t,r?function(t,i,r){let a=new BigInt64Array(t.size()),n=0;for(let s=0;s<r;s++){let o=Number(i[s]),l=i[s+r];l=l>>1n^-(1n&l);for(let i=n;i<n+o;i++)t.get(i)?a[i]=l:(a[i]=0n,n++);n+=o}return a}(a,n,i.runs):function(t,i,r){let a=new BigInt64Array(t.size()),n=0;for(let s=0;s<r;s++){let o=Number(i[s]),l=i[s+r];for(let i=n;i<n+o;i++)t.get(i)?a[i]=l:(a[i]=0n,n++);n+=o}return a}(a,n,i.runs);case L.NONE:return r?function(t,i){let r=new BigInt64Array(t.size()),a=0,n=0;for(;n!=r.length;++n)if(t.get(n)){let t=i[a++];r[n]=t>>1n^-(1n&t)}else r[n]=0n;return r}(a,t):function(t,i){let r=new BigInt64Array(t.size()),a=0,n=0;for(;n!=r.length;++n)r[n]=t.get(n)?i[a++]:0n;return r}(a,t);default:throw Error("The specified Logical level technique is not supported")}}(hs(t,i,s.numValues),s,l,a):hS(t,i,s,l);return new hE(r.name,n,a)}if(o===N.SEQUENCE){let a=hT(t,i,s);return new hC(r.name,a[0],a[1],s.numRleValues)}{let n=hP(t,i,s,l);return new hH(r.name,n,a)}}(i,r,s,c,n);case 7:let g,y,x,v,b;return v=h_(i,r),b=h3(c)?function(t,i,r,a){let n=i.get(),s=n+a*Float32Array.BYTES_PER_ELEMENT,o=new Float32Array(new Uint8Array(t.subarray(n,s)).buffer);i.set(s);let l=r.size(),h=new Float32Array(l),u=0;for(let t=0;t<l;t++)h[t]=r.get(t)?o[u++]:0;return h}(i,r,c,v.numValues):(o=v.numValues,y=(g=r.get())+o*Float32Array.BYTES_PER_ELEMENT,x=new Float32Array(new Uint8Array(i.subarray(g,y)).buffer),r.set(y),x),new hW(s.name,b,c);case 8:let w,T,S,P,M;return P=h_(i,r),M=h3(c)?function(t,i,r,a){let n=i.get(),s=n+a*Float64Array.BYTES_PER_ELEMENT,o=new Float64Array(new Uint8Array(t.subarray(n,s)).buffer);i.set(s);let l=r.size(),h=new Float64Array(l),u=0;for(let t=0;t<l;t++)h[t]=r.get(t)?o[u++]:0;return h}(i,r,c,P.numValues):(l=P.numValues,T=(w=r.get())+l*Float64Array.BYTES_PER_ELEMENT,S=new Float64Array(new Uint8Array(i.subarray(w,T)).buffer),r.set(T),S),new l7(s.name,M,c);default:throw Error(`The specified data type for the field is currently not supported: ${n}`)}}(i,t,r,n,a.scalarType,a):1!=i?null:function(t,i,r,a){let n=null,s=null,o=null,l=null,h=!1;for(;!h;){let r=h_(t,i);switch(r.physicalStreamType){case B.LENGTH:j.DICTIONARY===r.logicalStreamType.lengthType?n=hx(t,i,r):o=hx(t,i,r);break;case B.DATA:O.SINGLE===r.logicalStreamType.dictionaryType||O.SHARED===r.logicalStreamType.dictionaryType?(s=t.subarray(i.get(),i.get()+r.byteLength),h=!0):l=t.subarray(i.get(),i.get()+r.byteLength),i.add(r.byteLength)}}let u=r.complexType.children,c=[],d=0;for(let h of u){let u=hn(t,i,1)[0];if(0==u)continue;let p=`${r.name}${"default"===h.name?"":":"+h.name}`;if(2!==u||"scalarField"!==h.type||9!==h.scalarField.physicalType)throw Error("Currently only optional string fields are implemented for a struct.");let f=h_(t,i),m=hX(t,f.numValues,i),_=h_(t,i),g=_.decompressedCount!==a?hM(t,i,_,!1,new hg(m,f.numValues)):hy(t,i,_,!1);
2c[d++]=l?new h2(p,g,n,s,o,l,new hg(m,f.numValues)):new h1(p,g,n,s,new hg(m,f.numValues))}return c}(t,r,a,n));if(s)if(Array.isArray(s))for(let t of s)p.push(t);else p.push(s)}}let m=new hr(u.name,d,c,p,h);a.push(m),r.set(o)}return a}(new Uint8Array(t));this.layers=i.reduce((t,i)=>Object.assign(Object.assign({},t),{[i.name]:new h8(i)}),{})}}class h7{constructor(t,i){this.feature=t,this.type=t.type,this.properties=t.tags?t.tags:{},this.extent=i,"id"in t&&("string"==typeof t.id?this.id=parseInt(t.id,10):"number"!=typeof t.id||isNaN(t.id)||(this.id=t.id))}loadGeometry(){let t=[];for(let i of 1===this.feature.type?[this.feature.geometry]:this.feature.geometry){let r=[];for(let t of i)r.push(new w(t[0],t[1]));t.push(r)}return t}}let ue="_geojsonTileLayer";function ut(t,i){i.writeVarintField(15,t.version||1),i.writeStringField(1,t.name||""),i.writeVarintField(5,t.extent||4096);let r={keys:[],values:[],keycache:{},valuecache:{}};for(let a=0;a<t.length;a++)r.feature=t.feature(a),i.writeMessage(2,ui,r);for(let t of r.keys)i.writeStringField(3,t);for(let t of r.values)i.writeMessage(4,un,t)}function ui(t,i){if(!t.feature)return;let r=t.feature;void 0!==r.id&&i.writeVarintField(1,r.id),i.writeMessage(2,ur,t),i.writeVarintField(3,r.type),i.writeMessage(4,ua,r)}function ur(t,i){for(let r in t.feature?.properties){let a=t.feature.properties[r],n=t.keycache[r];if(null==a)continue;void 0===n&&(t.keys.push(r),n=t.keys.length-1,t.keycache[r]=n),i.writeVarint(n),"string"!=typeof a&&"boolean"!=typeof a&&"number"!=typeof a&&(a=JSON.stringify(a));let s=typeof a+":"+a,o=t.valuecache[s];void 0===o&&(t.values.push(a),o=t.values.length-1,t.valuecache[s]=o),i.writeVarint(o)}}function ua(t,i){let r=t.loadGeometry(),a=t.type,n=0,s=0;for(let o of r){let r=1;1===a&&(r=o.length),i.writeVarint((r<<3)+1);let l=3===a?o.length-1:o.length;for(let t=0;t<l;t++){1===t&&1!==a&&i.writeVarint((l-1<<3)+2);let r=o[t].x-n,h=o[t].y-s;i.writeVarint(r<<1^r>>31),i.writeVarint(h<<1^h>>31),n+=r,s+=h}3===t.type&&i.writeVarint(15)}}function un(t,i){let r=typeof t;"string"===r?i.writeStringField(1,t):"boolean"===r?i.writeBooleanField(7,t):"number"===r&&(t%1!=0?i.writeDoubleField(3,t):t<0?i.writeSVarintField(6,t):i.writeVarintField(5,t))}class us{constructor(t,i){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new aE(8192,16,0),this.grid3D=new aE(8192,16,0),this.featureIndexArray=new nU,this.promoteId=i}insert(t,i,r,a,n,s){let o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,a,n);let l=s?this.grid3D:this.grid;for(let t=0;t<i.length;t++){let r=i[t],a=[1/0,1/0,-1/0,-1/0];for(let t=0;t<r.length;t++){let i=r[t];a[0]=Math.min(a[0],i.x),a[1]=Math.min(a[1],i.y),a[2]=Math.max(a[2],i.x),a[3]=Math.max(a[3],i.y)}a[0]<8192&&a[1]<8192&&a[2]>=0&&a[3]>=0&&l.insert(o,a[0],a[1],a[2],a[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers="mlt"!==this.encoding?new oO(new lr(this.rawTileData)).layers:new h9(this.rawTileData).layers,this.sourceLayerCoder=new l5(this.vtLayers?Object.keys(this.vtLayers).sort():[ue])),this.vtLayers}query(t,i,r,a){let n;this.loadVTLayers();let s=t.params,o=8192/t.tileSize/t.scale,l=rH(s.filter,s.globalState),h=t.queryGeometry,u=t.queryPadding*o,c=l3.fromPoints(h),d=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),p=l3.fromPoints(t.cameraQueryGeometry).expandBy(u);for(let i of this.grid3D.query(p.minX,p.minY,p.maxX,p.maxY,(i,r,a,n)=>(function(t,i,r,a,n){for(let s of t)if(i<=s.x&&r<=s.y&&a>=s.x&&n>=s.y)return!0;let s=[new w(i,r),new w(i,n),new w(a,n),new w(a,r)];if(t.length>2){for(let i of s)if(sF(t,i))return!0}for(let i=0;i<t.length-1;i++)if(function(t,i,r){let a=r[0],n=r[2];if(t.x<a.x&&i.x<a.x||t.x>n.x&&i.x>n.x||t.y<a.y&&i.y<a.y||t.y>n.y&&i.y>n.y)return!1;let s=eP(t,i,r[0]);return s!==eP(t,i,r[1])||s!==eP(t,i,r[2])||s!==eP(t,i,r[3])}(t[i],t[i+1],s))return!0;return!1})(t.cameraQueryGeometry,i-u,r-u,a+u,n+u)))d.push(i);d.sort(ul);let f={};for(let u=0;u<d.length;u++){let c=d[u];if(c===n)continue;n=c;let p=this.featureIndexArray.get(c),m=null;this.loadMatchingFeature(f,p.bucketIndex,p.sourceLayerIndex,p.featureIndex,l,s.layers,s.availableImages,i,r,a,(i,r,a)=>(m||(m=sM(i)),r.queryIntersectsFeature({queryGeometry:h,feature:i,featureState:a,geometry:m,zoom:this.z,transform:t.transform,pixelsToTileUnits:o,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return f}
2loadMatchingFeature(t,i,r,a,n,s,o,l,h,u,c){let d=this.bucketLayerIDs[i];if(s&&!d.some(t=>s.has(t)))return;let p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p].feature(a);if(n.needGeometry){let t=sI(f,!0);if(!n.filter(new a$(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new a$(this.tileID.overscaledZ),f))return;let m=this.getId(f,p);for(let i=0;i<d.length;i++){let r=d[i];if(s&&!s.has(r))continue;let n=l[r];if(!n)continue;let p={};m&&u&&(p=u.getState(n.sourceLayer||ue,m));let _=ey({},h[r]);_.paint=uo(_.paint,n.paint,f,p,o),_.layout=uo(_.layout,n.layout,f,p,o);let g=!c||c(f,n,p);if(!g)continue;let y=new l4(f,this.z,this.x,this.y,m);y.layer=_;let x=t[r];void 0===x&&(x=t[r]=[]),x.push({featureIndex:a,feature:y,intersectionZ:g})}}lookupSymbolFeatures(t,i,r,a,n,s,o,l){let h={};this.loadVTLayers();let u=rH(n.filterSpec,n.globalState);for(let n of t)this.loadMatchingFeature(h,r,a,n,u,s,o,l,i);return h}hasLayer(t){for(let i of this.bucketLayerIDs)for(let r of i)if(t===r)return!0;return!1}getId(t,i){var r;let a=t.id;return this.promoteId&&("boolean"==typeof(a=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[i]])&&(a=Number(a)),void 0===a&&(null==(r=t.properties)?void 0:r.cluster)&&this.promoteId&&(a=Number(t.properties.cluster_id))),a}}function uo(t,i,r,a,n){return ev(t,(t,s)=>{let o=i instanceof a2?i.get(s):null;return o&&o.evaluate?o.evaluate(r,a,n):o})}function ul(t,i){return i-t}function uh(t,i,r,a,n){let s=[];for(let o=0;o<t.length;o++){let l,h=t[o];for(let t=0;t<h.length-1;t++){let o=h[t],u=h[t+1];o.x<i&&u.x<i||(o.x<i?o=new w(i,o.y+(i-o.x)/(u.x-o.x)*(u.y-o.y))._round():u.x<i&&(u=new w(i,o.y+(i-o.x)/(u.x-o.x)*(u.y-o.y))._round()),o.y<r&&u.y<r||(o.y<r?o=new w(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r)._round():u.y<r&&(u=new w(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r)._round()),o.x>=a&&u.x>=a||(o.x>=a?o=new w(a,o.y+(a-o.x)/(u.x-o.x)*(u.y-o.y))._round():u.x>=a&&(u=new w(a,o.y+(a-o.x)/(u.x-o.x)*(u.y-o.y))._round()),o.y>=n&&u.y>=n||(o.y>=n?o=new w(o.x+(n-o.y)/(u.y-o.y)*(u.x-o.x),n)._round():u.y>=n&&(u=new w(o.x+(n-o.y)/(u.y-o.y)*(u.x-o.x),n)._round()),l&&o.equals(l[l.length-1])||(l=[o],s.push(l)),l.push(u)))))}}return s}function uu(t,i,r,a,n){switch(i){case 1:let s=[];for(let i of t)for(let t of i){let i=0===n?t.x:t.y;i>=r&&i<=a&&s.push([t])}return s;case 2:return uc(t,r,a,n,!1);case 3:return uc(t,r,a,n,!0)}return[]}function uc(t,i,r,a,n){let s=[];for(let o of t){let t=function(t,i,r,a,n){let s=0===a?ud:up,o=[],l=[];for(let h=0;h<t.length-1;h++){let u=t[h],c=t[h+1],d=0===a?u.x:u.y,p=0===a?c.x:c.y,f=!1;d<i?p>i&&o.push(s(u,c,i)):d>r?p<r&&o.push(s(u,c,r)):o.push(u),p<i&&d>=i&&(o.push(s(u,c,i)),f=!0),p>r&&d<=r&&(o.push(s(u,c,r)),f=!0),!n&&f&&(l.push(o),o=[])}let h=t.length-1,u=0===a?t[h].x:t[h].y;return u>=i&&u<=r&&o.push(t[h]),n&&o.length>0&&!o[0].equals(o[o.length-1])&&o.push(new w(o[0].x,o[0].y)),o.length>0&&l.push(o),l}(o,i,r,a,n);t.length>0&&s.push(...t)}return s}function ud(t,i,r){return new w(r,t.y+(r-t.x)/(i.x-t.x)*(i.y-t.y))}function up(t,i,r){return new w(t.x+(r-t.y)/(i.y-t.y)*(i.x-t.x),r)}aA("FeatureIndex",us,{omit:["rawTileData","sourceLayerCoder"]});class uf extends w{constructor(t,i,r,a){super(t,i),this.angle=r,void 0!==a&&(this.segment=a)}clone(){return new uf(this.x,this.y,this.angle,this.segment)}}function um(t,i,r,a,n){if(void 0===i.segment||0===r)return!0;let s=i,o=i.segment+1,l=0;for(;l>-r/2;){if(--o<0)return!1;l-=t[o].dist(s),s=t[o]}l+=t[o].dist(t[o+1]),o++;let h=[],u=0;for(;l<r/2;){let i=t[o],r=t[o+1];if(!r)return!1;let s=t[o-1].angleTo(i)-i.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),h.push({distance:l,angleDelta:s}),u+=s;l-h[0].distance>a;)u-=h.shift().angleDelta;if(u>n)return!1;o++,l+=i.dist(r)}return!0}function u_(t){let i=0;for(let r=0;r<t.length-1;r++)i+=t[r].dist(t[r+1]);return i}function ug(t,i){return Math.max(t?t.right-t.left:0,i?i.right-i.left:0)}function uy(t,i,r,a){let n=[],s=t.image,o=s.pixelRatio,l=s.paddedRect.w-2,h=s.paddedRect.h-2,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},c=s.stretchX||[[0,l]],d=s.stretchY||[[0,h]],p=(t,i)=>t+i[1]-i[0],f=c.reduce(p,0),m=d.reduce(p,0),_=l-f,g=h-m,y=0,x=f,v=0,b=m,T=0,S=_,P=0,M=g;if(s.content&&a){let i=s.content,r=i[2]-i[0],a=i[3]-i[1];(s.textFitWidth||s.textFitHeight)&&(u=lT(t)),y=ux(c,0,i[0]),v=ux(d,0,i[1]),x=ux(c,i[0],i[2]),b=ux(d,i[1],i[3]),T=i[0]-y,P=i[1]-v,S=r-x,M=a-b}let I=u.x1,E=u.y1,C=u.x2-I,A=u.y2-E,D=(t,a,n,l)=>{var h,u,c,d,p,_,g,D,z,k,R,L,F,B,O,V;let j=(h=t.stretch-y,h/x*C+I),N=(u=t.fixed-T,c=S,d=t.stretch,u-c*d/f),U=(p=a.stretch-v,p/b*A+E),G=(_=a.fixed-P,g=M,D=a.stretch,_-g*D/m),q=(z=n.stretch-y,z/x*C+I),Z=(k=n.fixed-T,R=S,L=n.stretch,k-R*L/f),$=(F=l.stretch-v,F/b*A+E),W=(B=l.fixed-P,O=M,V=l.stretch,B-O*V/m),H=new w(j,U),X=new w(q,U),Y=new w(q,$),K=new w(j,$),J=new w(N/o,G/o),Q=new w(Z/o,W/o),ee=i*Math.PI/180;if(ee){let t=Math.sin(ee),i=Math.cos(ee),r=[i,-t,t,i];H._matMult(r),X._matMult(r),K._matMult(r),Y._matMult(r)}let et=t.stretch+t.fixed,ei=a.stretch+a.fixed;return{tl:H,tr:X,bl:K,br:Y,tex:{x:s.paddedRect.x+1+et,y:s.paddedRect.y+1+ei,w:n.stretch+n.fixed-et,h:l.stretch+l.fixed-ei},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:J,pixelOffsetBR:Q,minFontScaleX:S/o/C,minFontScaleY:M/o/A,isSDF:r}};if(a&&(s.stretchX||s.stretchY)){let t=uv(c,_,f),i=uv(d,g,m);for(let r=0;r<t.length-1;r++){let a=t[r],s=t[r+1];for(let t=0;t<i.length-1;t++)n.push(D(a,i[t],s,i[t+1]))}}
2else n.push(D({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:h+1}));return n}function ux(t,i,r){let a=0;for(let n of t)a+=Math.max(i,Math.min(r,n[1]))-Math.max(i,Math.min(r,n[0]));return a}function uv(t,i,r){let a=[{fixed:-1,stretch:0}];for(let[i,r]of t){let t=a[a.length-1];a.push({fixed:i-t.stretch,stretch:t.stretch}),a.push({fixed:i-t.stretch,stretch:t.stretch+(r-i)})}return a.push({fixed:i+1,stretch:r}),a}aA("Anchor",uf);class ub{constructor(t,i,r,a,n,s,o,l,h,u){var c;if(this.boxStartIndex=t.length,h){let t=s.top,i=s.bottom;const r=s.collisionPadding;r&&(t-=r[1],i+=r[3]);let a=i-t;a>0&&(a=Math.max(10,a),this.circleDiameter=a)}else{const h=(null==(c=s.image)?void 0:c.content)&&(s.image.textFitWidth||s.image.textFitHeight)?lT(s):{x1:s.left,y1:s.top,x2:s.right,y2:s.bottom};h.y1=h.y1*o-l[0],h.y2=h.y2*o+l[2],h.x1=h.x1*o-l[3],h.x2=h.x2*o+l[1];const d=s.collisionPadding;if(d&&(h.x1-=d[0]*o,h.y1-=d[1]*o,h.x2+=d[2]*o,h.y2+=d[3]*o),u){const t=new w(h.x1,h.y1),i=new w(h.x2,h.y1),r=new w(h.x1,h.y2),a=new w(h.x2,h.y2),n=u*Math.PI/180;t._rotate(n),i._rotate(n),r._rotate(n),a._rotate(n),h.x1=Math.min(t.x,i.x,r.x,a.x),h.x2=Math.max(t.x,i.x,r.x,a.x),h.y1=Math.min(t.y,i.y,r.y,a.y),h.y2=Math.max(t.y,i.y,r.y,a.y)}t.emplaceBack(i.x,i.y,h.x1,h.y1,h.x2,h.y2,r,a,n)}this.boxEndIndex=t.length}}class uw{constructor(t=[],i=(t,i)=>t<i?-1:+(t>i)){if(this.data=t,this.length=this.data.length,this.compare=i,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;let t=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:i,compare:r}=this,a=i[t];for(;t>0;){let n=t-1>>1,s=i[n];if(r(a,s)>=0)break;i[t]=s,t=n}i[t]=a}_down(t){let{data:i,compare:r}=this,a=this.length>>1,n=i[t];for(;t<a;){let a=1+(t<<1),s=a+1;if(s<this.length&&0>r(i[s],i[a])&&(a=s),r(i[a],n)>=0)break;i[t]=i[a],t=a}i[t]=n}}function uT(t,i){return i.max-t.max}function uS(t,i,r,a){this.p=new w(t,i),this.h=r,this.d=function(t,i){let r=!1,a=1/0;for(let n=0;n<i.length;n++){let s=i[n];for(let i=0,n=s.length,o=n-1;i<n;o=i++){let n=s[i],l=s[o];n.y>t.y!=l.y>t.y&&t.x<(l.x-n.x)*(t.y-n.y)/(l.y-n.y)+n.x&&(r=!r),a=Math.min(a,sR(t,n,l))}}return(r?1:-1)*Math.sqrt(a)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}t.aP=void 0,(Z=t.aP||(t.aP={}))[Z.center=1]="center",Z[Z.left=2]="left",Z[Z.right=3]="right",Z[Z.top=4]="top",Z[Z.bottom=5]="bottom",Z[Z["top-left"]=6]="top-left",Z[Z["top-right"]=7]="top-right",Z[Z["bottom-left"]=8]="bottom-left",Z[Z["bottom-right"]=9]="bottom-right";let uP=1/0;function uM(t,i){return i[1]!==uP?function(t,i,r){let a=0,n=0;switch(i=Math.abs(i),r=Math.abs(r),t){case"top-right":case"top-left":case"top":n=r-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-r}switch(t){case"top-right":case"bottom-right":case"right":a=-i;break;case"top-left":case"bottom-left":case"left":a=i}return[a,n]}(t,i[0],i[1]):function(t,i){let r=0,a=0;i<0&&(i=0);let n=i/Math.SQRT2;switch(t){case"top-right":case"top-left":a=n-7;break;case"bottom-right":case"bottom-left":a=7-n;break;case"bottom":a=7-i;break;case"top":a=i-7}switch(t){case"top-right":case"bottom-right":r=-n;break;case"top-left":case"bottom-left":r=n;break;case"left":r=i;break;case"right":r=-i}return[r,a]}(t,i[0])}function uI(t,i,r){var a;let n=t.layout,s=null==(a=n.get("text-variable-anchor-offset"))?void 0:a.evaluate(i,{},r);if(s){let t=s.values,i=[];for(let r=0;r<t.length;r+=2){let a=i[r]=t[r],n=t[r+1].map(t=>24*t);a.startsWith("top")?n[1]-=7:a.startsWith("bottom")&&(n[1]+=7),i[r+1]=n}return new tQ(i)}let o=n.get("text-variable-anchor");if(o){let a;a=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[24*n.get("text-radial-offset").evaluate(i,{},r),uP]:n.get("text-offset").evaluate(i,{},r).map(t=>24*t);let s=[];for(let t of o)s.push(t,uM(t,a));return new tQ(s)}return null}function uE(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function uC(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m){let _=function(t,i,r,a,n,s,o){let l=r.layout.get("text-rotate").evaluate(n,{})*Math.PI/180,h=[];for(let r of t.positionedLines)for(let n of r.positionedGlyphs){if(!n.rect)continue;let u=n.rect||{},c=4,d=!0,p=1,f=0,m=(a||o)&&n.vertical,_=n.metrics.advance*n.scale/2;if(o&&t.verticalizable&&(f=r.lineOffset/2-(n.imageName?-(24-n.metrics.width*n.scale)/2:(n.scale-1)*24)),n.imageName){let t=s[n.imageName];d=t.sdf,c=1/(p=t.pixelRatio)}let g=a?[n.x+_,n.y]:[0,0],y=a?[0,0]:[n.x+_+i[0],n.y+i[1]-f],x=[0,0];m&&(x=y,y=[0,0]);let v=n.metrics.isDoubleResolution?2:1,b=(n.metrics.left-c)*n.scale-_+y[0],T=(-n.metrics.top-c)*n.scale+y[1],S=b+u.w/v*n.scale/p,P=T+u.h/v*n.scale/p,M=new w(b,T),I=new w(S,T),E=new w(b,P),C=new w(S,P);if(m){let t=new w(-_,_- -17),i=-Math.PI/2,r=12-_,a=new w(22-r,-(n.imageName?r:0)),s=new w(...x);
2M._rotateAround(i,t)._add(a)._add(s),I._rotateAround(i,t)._add(a)._add(s),E._rotateAround(i,t)._add(a)._add(s),C._rotateAround(i,t)._add(a)._add(s)}if(l){let t=Math.sin(l),i=Math.cos(l),r=[i,-t,t,i];M._matMult(r),I._matMult(r),E._matMult(r),C._matMult(r)}let A=new w(0,0),D=new w(0,0);h.push({tl:M,tr:I,bl:E,br:C,tex:u,writingMode:t.writingMode,glyphOffset:g,sectionIndex:n.sectionIndex,isSDF:d,pixelOffsetTL:A,pixelOffsetBR:D,minFontScaleX:0,minFontScaleY:0})}return h}(r,l,n,s,o,a,t.allowVerticalPlacement),g=t.textSizeData,y=null;for(let r of("source"===g.kind?(y=[128*n.layout.get("text-size").evaluate(o,{})])[0]>32640&&eS(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===g.kind&&((y=[128*f.compositeTextSizes[0].evaluate(o,{},m),128*f.compositeTextSizes[1].evaluate(o,{},m)])[0]>32640||y[1]>32640)&&eS(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),t.addSymbols(t.text,_,y,l,s,o,u,i,h.lineStartIndex,h.lineLength,p,m),c))d[r]=t.text.placedSymbolArray.length-1;return 4*_.length}function uA(t){for(let i in t)return t[i];return null}let uD=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class uz{static from(t){if(!(t instanceof ArrayBuffer))throw Error("Data must be an instance of ArrayBuffer.");let[i,r]=new Uint8Array(t,0,2);if(219!==i)throw Error("Data does not appear to be in a KDBush format.");let a=r>>4;if(1!==a)throw Error(`Got v${a} data when expected v1.`);let n=uD[15&r];if(!n)throw Error("Unrecognized array type.");let[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new uz(o,s,n,t)}constructor(t,i=64,r=Float64Array,a){if(isNaN(t)||t<0)throw Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const n=uD.indexOf(this.ArrayType),s=2*t*this.ArrayType.BYTES_PER_ELEMENT,o=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-o%8)%8;if(n<0)throw Error(`Unexpected typed array class: ${r}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+l,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+s+o+l),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+l,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=t)}add(t,i){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=i,r}finish(){let t=this._pos>>1;if(t!==this.numItems)throw Error(`Added ${t} items when expected ${this.numItems}.`);return function t(i,r,a,n,s,o){if(s-n<=a)return;let l=n+s>>1;(function t(i,r,a,n,s,o){for(;s>n;){if(s-n>600){let l=s-n+1,h=a-n+1,u=Math.log(l),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(l-c)/l)*(h-l/2<0?-1:1);t(i,r,a,Math.max(n,Math.floor(a-h*c/l+d)),Math.min(s,Math.floor(a+(l-h)*c/l+d)),o)}let l=r[2*a+o],h=n,u=s;for(uk(i,r,n,a),r[2*s+o]>l&&uk(i,r,n,s);h<u;){for(uk(i,r,h,u),h++,u--;r[2*h+o]<l;)h++;for(;r[2*u+o]>l;)u--}r[2*n+o]===l?uk(i,r,n,u):uk(i,r,++u,s),u<=a&&(n=u+1),a<=u&&(s=u-1)}})(i,r,l,n,s,o),t(i,r,a,n,l-1,1-o),t(i,r,a,l+1,s,1-o)}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:s,nodeSize:o}=this,l=[0,n.length-1,0],h=[];for(;l.length;){let u=l.pop()||0,c=l.pop()||0,d=l.pop()||0;if(c-d<=o){for(let o=d;o<=c;o++){let l=s[2*o],u=s[2*o+1];l>=t&&l<=r&&u>=i&&u<=a&&h.push(n[o])}continue}let p=d+c>>1,f=s[2*p],m=s[2*p+1];f>=t&&f<=r&&m>=i&&m<=a&&h.push(n[p]),(0===u?t<=f:i<=m)&&(l.push(d),l.push(p-1),l.push(1-u)),(0===u?r>=f:a>=m)&&(l.push(p+1),l.push(c),l.push(1-u))}return h}within(t,i,r){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:n,nodeSize:s}=this,o=[0,a.length-1,0],l=[],h=r*r;for(;o.length;){let u=o.pop()||0,c=o.pop()||0,d=o.pop()||0;
2if(c-d<=s){for(let r=d;r<=c;r++)uL(n[2*r],n[2*r+1],t,i)<=h&&l.push(a[r]);continue}let p=d+c>>1,f=n[2*p],m=n[2*p+1];uL(f,m,t,i)<=h&&l.push(a[p]),(0===u?t-r<=f:i-r<=m)&&(o.push(d),o.push(p-1),o.push(1-u)),(0===u?t+r>=f:i+r>=m)&&(o.push(p+1),o.push(c),o.push(1-u))}return l}}function uk(t,i,r,a){uR(t,r,a),uR(i,2*r,2*a),uR(i,2*r+1,2*a+1)}function uR(t,i,r){let a=t[i];t[i]=t[r],t[r]=a}function uL(t,i,r,a){let n=t-r,s=i-a;return n*n+s*s}t.cH=void 0,($=t.cH||(t.cH={})).create="create",$.load="load",$.fullLoad="fullLoad";let uF=null,uB=[],uO=1e3/60,uV="loadTime",uj="fullLoadTime";t.$=H,t.A=Y,t.B=aI,t.C=ag,t.D=a3,t.E=eY,t.F=function([t,i,r]){return i+=90,{x:t*Math.cos(i*=Math.PI/180)*Math.sin(r*=Math.PI/180),y:t*Math.sin(i)*Math.sin(r),z:t*Math.cos(r)}},t.G=iP,t.H=a$,t.I=ly,t.J=aS,t.K=function(t){if(null==eI){let i=t.navigator?t.navigator.userAgent:null;eI=!!t.safari||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")))}return eI},t.L=class{constructor(t,i){this.target=t,this.mapId=i,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new lV(()=>this.process()),this.subscription=eD(this.target,"message",t=>this.receive(t),!1),this.globalScope=eM(self)?t:window}registerMessageHandler(t,i){this.messageHandlers[t]=i}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,i){return new Promise((r,a)=>{let n=Math.round(1e18*Math.random()).toString(36).substring(0,10),s=i?eD(i.signal,"abort",()=>{null==s||s.unsubscribe(),delete this.resolveRejects[n];let i={id:n,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(i)},lj):null;this.resolveRejects[n]={resolve:t=>{null==s||s.unsubscribe(),r(t)},reject:t=>{null==s||s.unsubscribe(),a(t)}};let o=[],l=Object.assign(Object.assign({},t),{id:n,sourceMapId:this.mapId,origin:location.origin,data:aR(t.data,o)});this.target.postMessage(l,{transfer:o})})}receive(t){let i=t.data,r=i.id;if(!("file://"!==i.origin&&"file://"!==location.origin&&"resource://android"!==i.origin&&"resource://android"!==location.origin&&i.origin!==location.origin||i.targetMapId&&this.mapId!==i.targetMapId)){if("<cancel>"===i.type){delete this.tasks[r];let t=this.abortControllers[r];return delete this.abortControllers[r],void(t&&t.abort())}if(eM(self)||i.mustQueue)return this.tasks[r]=i,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,i)}}process(){if(0===this.taskQueue.length)return;let t=this.taskQueue.shift(),i=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),i&&this.processTask(t,i)}processTask(t,i){return b(this,void 0,void 0,function*(){if("<response>"===i.type){let r=this.resolveRejects[t];if(delete this.resolveRejects[t],!r)return;return void(i.error?r.reject(aL(i.error)):r.resolve(aL(i.data)))}if(!this.messageHandlers[i.type])return void this.completeTask(t,Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let r=aL(i.data),a=new AbortController;this.abortControllers[t]=a;try{let n=yield this.messageHandlers[i.type](i.sourceMapId,r,a);this.completeTask(t,null,n)}catch(i){this.completeTask(t,i)}})}completeTask(t,i,r){let a=[];delete this.abortControllers[t];let n={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:i?aR(i):null,data:aR(r,a)};this.target.postMessage(n,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},t.M=eN,t.N=function(){var t=new Y(16);return Y!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.O=function(t,i,r){var a,n,s,o,l,h,u,c,d,p,f,m,_=r[0],g=r[1],y=r[2];return i===t?(t[12]=i[0]*_+i[4]*g+i[8]*y+i[12],t[13]=i[1]*_+i[5]*g+i[9]*y+i[13],t[14]=i[2]*_+i[6]*g+i[10]*y+i[14],t[15]=i[3]*_+i[7]*g+i[11]*y+i[15]):(n=i[1],s=i[2],o=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],t[0]=a=i[0],t[1]=n,t[2]=s,t[3]=o,t[4]=l,t[5]=h,t[6]=u,t[7]=c,t[8]=d,t[9]=p,t[10]=f,t[11]=m,t[12]=a*_+l*g
2+d*y+i[12],t[13]=n*_+h*g+p*y+i[13],t[14]=s*_+u*g+f*y+i[14],t[15]=o*_+c*g+m*y+i[15]),t},t.P=w,t.Q=function(t,i,r){var a=r[0],n=r[1],s=r[2];return t[0]=i[0]*a,t[1]=i[1]*a,t[2]=i[2]*a,t[3]=i[3]*a,t[4]=i[4]*n,t[5]=i[5]*n,t[6]=i[6]*n,t[7]=i[7]*n,t[8]=i[8]*s,t[9]=i[9]*s,t[10]=i[10]*s,t[11]=i[11]*s,t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},t.R=s0,t.S=function(t,i,r){var a=i[0],n=i[1],s=i[2],o=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],_=i[12],g=i[13],y=i[14],x=i[15],v=r[0],b=r[1],w=r[2],T=r[3];return t[0]=v*a+b*l+w*d+T*_,t[1]=v*n+b*h+w*p+T*g,t[2]=v*s+b*u+w*f+T*y,t[3]=v*o+b*c+w*m+T*x,t[4]=(v=r[4])*a+(b=r[5])*l+(w=r[6])*d+(T=r[7])*_,t[5]=v*n+b*h+w*p+T*g,t[6]=v*s+b*u+w*f+T*y,t[7]=v*o+b*c+w*m+T*x,t[8]=(v=r[8])*a+(b=r[9])*l+(w=r[10])*d+(T=r[11])*_,t[9]=v*n+b*h+w*p+T*g,t[10]=v*s+b*u+w*f+T*y,t[11]=v*o+b*c+w*m+T*x,t[12]=(v=r[12])*a+(b=r[13])*l+(w=r[14])*d+(T=r[15])*_,t[13]=v*n+b*h+w*p+T*g,t[14]=v*s+b*u+w*f+T*y,t[15]=v*o+b*c+w*m+T*x,t},t.T=s8,t.U=function(t,i){let r={};for(let a=0;a<i.length;a++){let n=i[a];n in t&&(r[n]=t[n])}return r},t.V=lN,t.W=eg,t.X=lZ,t.Y=lq,t.Z=eO,t._=b,t.a=eB,t.a$=er,t.a0=X,t.a1=eA,t.a2=lQ,t.a3=l$,t.a4=lW,t.a5=8192,t.a6=function(t,i,r){let a;if(!t)return i||{};if(!i)return t||{};let n=l2(t),s=l2(i);for(let t of(s.removeAll&&(n.add.clear(),n.update.clear(),n.remove.clear(),s.remove.clear()),s.remove))n.add.delete(t),n.update.delete(t);for(let[t,i]of s.update){let r=n.update.get(t);r&&(s.update.set(t,function(t,i){let r={id:t.id};if(i.removeAllProperties&&(delete t.removeProperties,delete t.addOrUpdateProperties,delete i.removeProperties),i.removeProperties)for(let r of i.removeProperties){let i=t.addOrUpdateProperties.findIndex(t=>t.key===r);i>-1&&t.addOrUpdateProperties.splice(i,1)}return(t.removeAllProperties||i.removeAllProperties)&&(r.removeAllProperties=!0),(t.removeProperties||i.removeProperties)&&(r.removeProperties=[...t.removeProperties||[],...i.removeProperties||[]]),(t.addOrUpdateProperties||i.addOrUpdateProperties)&&(r.addOrUpdateProperties=[...t.addOrUpdateProperties||[],...i.addOrUpdateProperties||[]]),(t.newGeometry||i.newGeometry)&&(r.newGeometry=i.newGeometry||t.newGeometry),r}(r,i)),n.update.delete(t))}let o={};if((n.removeAll||s.removeAll)&&(o.removeAll=!0),o.remove=new Set([...n.remove,...s.remove]),o.add=new Map([...n.add,...s.add]),o.update=new Map([...n.update,...s.update]),o.remove.size&&o.add.size)for(let t of o.add.keys())o.remove.delete(t);return a={},o.removeAll&&(a.removeAll=o.removeAll),o.remove&&(a.remove=Array.from(o.remove)),o.add&&(a.add=Array.from(o.add.values())),o.update&&(a.update=Array.from(o.update.values())
2),a},t.a7=function(t,i){let r=new Map;if(null==t||null==t.type)return r;if("Feature"===t.type){let a=l1(t,i);if(null==a)return;return r.set(a,t),r}if("FeatureCollection"===t.type){let a=new Set;for(let n of t.features){let t=l1(n,i);if(null==t||a.has(t))return;a.add(t),r.set(t,n)}return r}},t.a8=function(t,i,r){var a,n;let s=[];if(i.removeAll)t.clear();else if(i.remove)for(let r of i.remove){let i=t.get(r);i&&(s.push(i.geometry),t.delete(r))}if(i.add)for(let a of i.add){let i=l1(a,r);if(null==i)continue;let n=t.get(i);n&&s.push(n.geometry),s.push(a.geometry),t.set(i,a)}if(i.update)for(let r of i.update){let i=t.get(r.id);if(!i)continue;let o=!!r.newGeometry,l=r.removeAllProperties||(null==(a=r.removeProperties)?void 0:a.length)>0||(null==(n=r.addOrUpdateProperties)?void 0:n.length)>0;if(!o&&!l)continue;s.push(i.geometry);let h=Object.assign({},i);if(t.set(r.id,h),o&&(s.push(r.newGeometry),h.geometry=r.newGeometry),l){if(h.properties=r.removeAllProperties?{}:Object.assign({},h.properties||{}),r.removeProperties)for(let t of r.removeProperties)delete h.properties[t];if(r.addOrUpdateProperties)for(let{key:t,value:i}of r.addOrUpdateProperties)h.properties[t]=i}}return s},t.a9=lX,t.aA=function(t,{uSize:i,uSizeT:r},{lowerSize:a,upperSize:n}){return"source"===t.kind?a/128:"composite"===t.kind?iP.number(a/128,n/128,r):i},t.aB=function(t,i){var r=i[0],a=i[1],n=i[2],s=i[3],o=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],_=i[13],g=i[14],y=i[15],x=r*l-a*o,v=r*h-n*o,b=r*u-s*o,w=a*h-n*l,T=a*u-s*l,S=n*u-s*h,P=c*_-d*m,M=c*g-p*m,I=c*y-f*m,E=d*g-p*_,C=d*y-f*_,A=p*y-f*g,D=x*A-v*C+b*E+w*I-T*M+S*P;return D?(t[0]=(l*A-h*C+u*E)*(D=1/D),t[1]=(n*C-a*A-s*E)*D,t[2]=(_*S-g*T+y*w)*D,t[3]=(p*T-d*S-f*w)*D,t[4]=(h*I-o*A-u*M)*D,t[5]=(r*A-n*I+s*M)*D,t[6]=(g*b-m*S-y*v)*D,t[7]=(c*S-p*b+f*v)*D,t[8]=(o*C-l*I+u*P)*D,t[9]=(a*I-r*C-s*P)*D,t[10]=(m*T-_*b+y*x)*D,t[11]=(d*b-c*T-f*x)*D,t[12]=(l*M-o*E-h*P)*D,t[13]=(r*E-a*M+n*P)*D,t[14]=(_*v-m*w-g*x)*D,t[15]=(c*w-d*v+p*x)*D,t):null},t.aC=el,t.aD=function(t){var i=t[0],r=t[1];return Math.sqrt(i*i+r*r)},t.aE=function(t){return t[0]=0,t[1]=0,t},t.aF=function(t,i,r){return t[0]=i[0]*r,t[1]=i[1]*r,t},t.aG=lC,t.aH=en,t.aI=function(t,i,r,a){let n=i.y-t.y,s=i.x-t.x,o=a.y-r.y,l=a.x-r.x,h=o*s-l*n;if(0===h)return null;let u=(l*(t.y-r.y)-o*(t.x-r.x))/h;return new w(t.x+u*s,t.y+u*n)},t.aJ=uh,t.aK=sC,t.aL=function(t){let i=1/0,r=1/0,a=-1/0,n=-1/0;for(let s of t)i=Math.min(i,s.x),r=Math.min(r,s.y),a=Math.max(a,s.x),n=Math.max(n,s.y);return[i,r,a,n]},t.aM=24,t.aN=eu,t.aO=function(t,i,r,a,n=!1){if(!r[0]&&!r[1])return[0,0];let s=n?"map"===a?-t.bearingInRadians:0:"viewport"===a?t.bearingInRadians:0;if(s){let t=Math.sin(s),i=Math.cos(s);r=[r[0]*i-r[1]*t,r[0]*t+r[1]*i]}return[n?r[0]:eu(i,r[0],t.zoom),n?r[1]:eu(i,r[1],t.zoom)]},t.aQ=lM,t.aR=uE,t.aS=lb,t.aT=uz,t.aU=nn,t.aV=ob,t.aW=nG,t.aX=n4,t.aY=n2,t.aZ=ek,t.a_=lH,t.aa=l3,t.ab=25,t.ac=lK,t.ad=t=>{let i=window.document.createElement("video");return i.muted=!0,new Promise(r=>{for(let a of(i.onloadstart=()=>{r(i)},t)){let t=window.document.createElement("source");eZ(a)||(i.crossOrigin="Anonymous"),t.src=a,i.appendChild(t)}})},t.ae=e6,t.af=function(){return ex++},t.ag=nz,t.ah=lz,t.ai=ue,t.aj=rH,t.ak=sI,t.al=l4,t.am=function(t){let i={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(t,r,a,n)=>{let s=a||n;return i[r]=!s||s.toLowerCase(),""}),i["max-age"]){let t=parseInt(i["max-age"],10);isNaN(t)?delete i["max-age"]:i["max-age"]=t}return i},t.an=e_,t.ao=85.051129,t.ap=ez,t.aq=function(t){return Math.pow(2,t)},t.ar=J,t.as=function(t,i){return t/lG(i)},t.at=function(t){return Math.log(t)/Math.LN2},t.au=function(t){var i=t[0],r=t[1];return i*i+r*r},t.av=function(t){if(!t.length)return new Set;let i=Math.max(...t.map(t=>t.canonical.z)),r=1/0,a=-1/0,n=1/0,s=-1/0,o=[];for(let l of t){let{x:t,y:h,z:u}=l.canonical,c=Math.pow(2,i-u),d=t*c,p=h*c;o.push({id:l,x:d,y:p}),d<r&&(r=d),d>a&&(a=d),p<n&&(n=p),p>s&&(s=p)}let l=new Set;for(let t of o)t.x!==r&&t.x!==a&&t.y!==n&&t.y!==s||l.add(t.id);return l},t.aw=function(t,i){let r=Math.abs(2*t.wrap)-(t.wrap<0),a=Math.abs(2*i.wrap)-(i.wrap<0);return t.overscaledZ-i.overscaledZ||a-r||i.canonical.y-t.canonical.y||i.canonical.x-t.canonical.x},t.ax=class{constructor(t,i){this.max=t,this.onRemove=i,this.reset()}reset(){for(let t in this.data)for(let i of this.data[t])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(t,i,r){let a=t.wrapped().key;void 0===this.data[a]&&(this.data[a]=[]);let n={value:i,timeout:void 0};if(void 0!==r&&(n.timeout=setTimeout(()=>{this.remove(t,n)},r)),this.data[a].push(n),this.order.push(a),this.order.length>this.max){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){let i=this.data[t].shift();return i.timeout&&clearTimeout(i.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),i.value}getByKey(t){let i=this.data[t];return i?i[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,i){if(!this.has(t))return this;let r=t.wrapped().key,a=void 0===i?0:this.data[r].indexOf(i),n=this.data[r][a];return this.data[r].splice(a,1),n.timeout&&clearTimeout(n.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(n.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){let i=[];for(let r in this.data)for(let a of this.data[r])t(a.value)||i.push(a);for(let t of i)this.remove(t.value.tileID,t)}},t.ay=function(t,i){let r=0,a=0;if("constant"===t.kind)a=t.layoutSize;else if("source"!==t.kind){let{interpolationType:n,minZoom:s,maxZoom:
2o}=t,l=n?e_(iT.interpolationFactor(n,i,s,o),0,1):0;"camera"===t.kind?a=iP.number(t.minSize,t.maxSize,l):r=l}return{uSizeT:r,uSize:a}},t.b=eE,t.b$=sd,t.b0=ei,t.b1=function(t){var i=new Y(3);return i[0]=t[0],i[1]=t[1],i[2]=t[2],i},t.b2=function(t,i,r){return t[0]=i[0]-r[0],t[1]=i[1]-r[1],t[2]=i[2]-r[2],t},t.b3=function(t,i){var r=i[0],a=i[1],n=i[2],s=r*r+a*a+n*n;return s>0&&(s=1/Math.sqrt(s)),t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t},t.b4=ea,t.b5=function(t,i){return t[0]*i[0]+t[1]*i[1]+t[2]*i[2]},t.b6=function(t,i,r){return t[0]=i[0]*r[0],t[1]=i[1]*r[1],t[2]=i[2]*r[2],t[3]=i[3]*r[3],t},t.b7=ee,t.b8=function(t,i,r){let a=i[0]*r[0]+i[1]*r[1]+i[2]*r[2];return 0===a?null:(-(t[0]*r[0]+t[1]*r[1]+t[2]*r[2])-r[3])/a},t.b9=ee,t.bA=function(t,i,r,a){return t[0]=i[0]+r[0]*a,t[1]=i[1]+r[1]*a,t[2]=i[2]+r[2]*a,t},t.bB=eo,t.bC=function(t,i,r){var a=r[0],n=r[1],s=r[2],o=r[3],l=i[0],h=i[1],u=i[2],c=n*u-s*h,d=s*l-a*u,p=a*h-n*l;return t[0]=l+o*(c+=c)+n*(p+=p)-s*(d+=d),t[1]=h+o*d+s*c-a*p,t[2]=u+o*p+a*d-n*c,t},t.bD=function(t,i,r){var a,n,s,o,l,h,u;let c=(n=(a=[t[0],t[1],t[2],i[0],i[1],i[2],r[0],r[1],r[2]])[3],s=a[4],o=a[5],l=a[6],h=a[7],u=a[8],a[0]*(u*s-o*h)+a[1]*(-u*n+o*l)+a[2]*(h*n-s*l));if(0===c)return null;let d=ea([],[i[0],i[1],i[2]],[r[0],r[1],r[2]]),p=ea([],[r[0],r[1],r[2]],[t[0],t[1],t[2]]),f=ea([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),m=er([],d,-t[3]);return ei(m,m,er([],p,-i[3])),ei(m,m,er([],f,-r[3])),er(m,m,1/c),m},t.bE=6371008.8,t.bF=function(){return new Float64Array(4)},t.bG=function(t,i,r,a){var n=[],s=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],s[0]=n[0]*Math.cos(a)-n[1]*Math.sin(a),s[1]=n[0]*Math.sin(a)+n[1]*Math.cos(a),s[2]=n[2],t[0]=s[0]+r[0],t[1]=s[1]+r[1],t[2]=s[2]+r[2],t},t.bH=function(t,i,r,a){var n=[],s=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],s[0]=n[0],s[1]=n[1]*Math.cos(a)-n[2]*Math.sin(a),s[2]=n[1]*Math.sin(a)+n[2]*Math.cos(a),t[0]=s[0]+r[0],t[1]=s[1]+r[1],t[2]=s[2]+r[2],t},t.bI=function(t,i,r,a){var n=[],s=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],s[0]=n[2]*Math.sin(a)+n[0]*Math.cos(a),s[1]=n[1],s[2]=n[2]*Math.cos(a)-n[0]*Math.sin(a),t[0]=s[0]+r[0],t[1]=s[1]+r[1],t[2]=s[2]+r[2],t},t.bJ=function(t,i,r){var a=Math.sin(r),n=Math.cos(r),s=i[0],o=i[1],l=i[2],h=i[3],u=i[8],c=i[9],d=i[10],p=i[11];return i!==t&&(t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15]),t[0]=s*n-u*a,t[1]=o*n-c*a,t[2]=l*n-d*a,t[3]=h*n-p*a,t[8]=s*a+u*n,t[9]=o*a+c*n,t[10]=l*a+d*n,t[11]=h*a+p*n,t},t.bK=function(t,i){let r=ec(t,360),a=ec(i,360),n=a-r,s=a>r?n-360:n+360;return Math.abs(n)<Math.abs(s)?n:s},t.bL=function(t){return t[0]=0,t[1]=0,t[2]=0,t},t.bM=function(t,i,r,a){let n=Math.sqrt(t*t+i*i),s=Math.sqrt(r*r+a*a);t/=n,i/=n;let o=Math.acos(t*(r/=s)+i*(a/=s));return-i*r+t*a>0?o:-o},t.bN=function(t,i){let r=ec(t,2*Math.PI),a=ec(i,2*Math.PI);return Math.min(Math.abs(r-a),Math.abs(r-a+2*Math.PI),Math.abs(r-a-2*Math.PI))},t.bO=function(){let t={},i=eK.$version;for(let r in eK.$root){let a=eK.$root[r];if(a.required){let n=null;null!=(n="version"===r?i:"array"===a.type?[]:{})&&(t[r]=n)}}return t},t.bP=eG,t.bQ=aF,t.bR=function t(i,r){if(Array.isArray(i)){if(!Array.isArray(r)||i.length!==r.length)return!1;for(let a=0;a<i.length;a++)if(!t(i[a],r[a]))return!1;return!0}if("object"==typeof i&&null!==i&&null!==r){if("object"!=typeof r||Object.keys(i).length!==Object.keys(r).length)return!1;for(let a in i)if(!t(i[a],r[a]))return!1;return!0}return i===r},t.bS=function(t){t=t.slice();let i=Object.create(null);for(let r=0;r<t.length;r++)i[t[r].id]=t[r];for(let r=0;r<t.length;r++)"ref"in t[r]&&(t[r]=function(t,i){let r={};for(let i in t)"ref"!==i&&(r[i]=t[i]);return eJ.forEach(t=>{t in i&&(r[t]=i[t])}),r}(t[r],i[t[r].ref]));return t},t.bT=function(t,i){if("custom"===t.type)return new lO(t,i);switch(t.type){case"background":return new lB(t,i);case"circle":return new sW(t,i);case"color-relief":return new oe(t,i);case"fill":return new oC(t,i);case"fill-extrusion":return new oq(t,i);case"heatmap":return new s3(t,i);case"hillshade":return new s4(t,i);case"line":return new oQ(t,i);case"raster":return new nt(t,i);case"symbol":return new lL(t,i)}},t.bU=t=>"raster"===t.type,t.bV=ew,t.bW=function(t,i){if(!t)return[{command:"setStyle",args:[i]}];let r=[];try{if(!eQ(t.version,i.version))return[{command:"setStyle",args:[i]}];eQ(t.center,i.center)||r.push({command:"setCenter",args:[i.center]}),eQ(t.state,i.state)||r.push({command:"setGlobalState",args:[i.state]}),eQ(t.centerAltitude,i.centerAltitude)||r.push({command:"setCenterAltitude",args:[i.centerAltitude]}),eQ(t.zoom,i.zoom)||r.push({command:"setZoom",args:[i.zoom]}),eQ(t.bearing,i.bearing)||r.push({command:"setBearing",args:[i.bearing]}),eQ(t.pitch,i.pitch)||r.push({command:"setPitch",args:[i.pitch]}),eQ(t.roll,i.roll)||r.push({command:"setRoll",args:[i.roll]}),eQ(t.sprite,i.sprite)||r.push({command:"setSprite",args:[i.sprite]}),eQ(t.glyphs,i.glyphs)||r.push({command:"setGlyphs",args:[i.glyphs]}),eQ(t.transition,i.transition)||r.push({command:"setTransition",args:[i.transition]}),eQ(t.light,i.light)||r.push({command:"setLight",args:[i.light]}),eQ(t.terrain,i.terrain)||r.push({command:"setTerrain",args:[i.terrain]}),eQ(t.sky,i.sky)||r.push({command:"setSky",args:[i.sky]}),eQ(t.projection,i.projection)||r.push({command:"setProjection",args:[i.projection]});let a={},n=[];!function(t,i,r,a){let n;for(n in i=i||{},t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(i,n)||e2(n,r,a));for(n in i){var s;Object.prototype.hasOwnProperty.call(i,n)&&(Object.prototype.hasOwnProperty.call(t,n)?eQ(t[n],i[n])||("geojson"===t[n].type&&"geojson"===i[n].type&&function(t,i,r){let a;for(a in t[r])if(Object.prototype.hasOwnProperty.call(t[r],a)&&"data"!==a&&!eQ(t[r][a],i[r][a]))return!1;for(a in i[r])if(Object.prototype.hasOwnProperty.call(i[r],a)&&"data"!==a&&!eQ(t[r][a],i[r][a]))return!1;return!0}(t,i,n)?e0(r,{command:"setGeoJSONSourceData",args:[n,i[n].data]}):(s=i,e2(n,r,a),e1(n,s,r))):e1(n,i,r))}}(t.sources,i.sources,n,a);let s=[];
2t.layers&&t.layers.forEach(t=>{"source"in t&&a[t.source]?r.push({command:"removeLayer",args:[t.id]}):s.push(t)}),r=r.concat(n),function(t,i,r){let a,n,s,o,l;i=i||[];let h=(t=t||[]).map(e5),u=i.map(e5),c=t.reduce(e4,{}),d=i.reduce(e4,{}),p=h.slice(),f=Object.create(null);for(let t=0,i=0;t<h.length;t++)a=h[t],Object.prototype.hasOwnProperty.call(d,a)?i++:(e0(r,{command:"removeLayer",args:[a]}),p.splice(p.indexOf(a,i),1));for(let t=0,i=0;t<u.length;t++)a=u[u.length-1-t],p[p.length-1-t]!==a&&(Object.prototype.hasOwnProperty.call(c,a)?(e0(r,{command:"removeLayer",args:[a]}),p.splice(p.lastIndexOf(a,p.length-i),1)):i++,o=p[p.length-t],e0(r,{command:"addLayer",args:[d[a],o]}),p.splice(p.length-t,0,a),f[a]=!0);for(let t=0;t<u.length;t++)if(n=c[a=u[t]],s=d[a],!f[a]&&!eQ(n,s))if(eQ(n.source,s.source)&&eQ(n["source-layer"],s["source-layer"])&&eQ(n.type,s.type)){for(l in e3(n.layout,s.layout,r,a,null,"setLayoutProperty"),e3(n.paint,s.paint,r,a,null,"setPaintProperty"),eQ(n.filter,s.filter)||e0(r,{command:"setFilter",args:[a,s.filter]}),eQ(n.minzoom,s.minzoom)&&eQ(n.maxzoom,s.maxzoom)||e0(r,{command:"setLayerZoomRange",args:[a,s.minzoom,s.maxzoom]}),n)Object.prototype.hasOwnProperty.call(n,l)&&"layout"!==l&&"paint"!==l&&"filter"!==l&&"metadata"!==l&&"minzoom"!==l&&"maxzoom"!==l&&(0===l.indexOf("paint.")?e3(n[l],s[l],r,a,l.slice(6),"setPaintProperty"):eQ(n[l],s[l])||e0(r,{command:"setLayerProperty",args:[a,l,s[l]]}));for(l in s)Object.prototype.hasOwnProperty.call(s,l)&&!Object.prototype.hasOwnProperty.call(n,l)&&"layout"!==l&&"paint"!==l&&"filter"!==l&&"metadata"!==l&&"minzoom"!==l&&"maxzoom"!==l&&(0===l.indexOf("paint.")?e3(n[l],s[l],r,a,l.slice(6),"setPaintProperty"):eQ(n[l],s[l])||e0(r,{command:"setLayerProperty",args:[a,l,s[l]]}))}else e0(r,{command:"removeLayer",args:[a]}),o=p[p.lastIndexOf(a)+1],e0(r,{command:"addLayer",args:[s,o]})}(s,i.layers,r)}catch(t){console.warn("Unable to compute style diff:",t),r=[{command:"setStyle",args:[i]}]}return r},t.bX=function(t){let i=[],r=t.id;return void 0===r&&i.push({message:`layers.${r}: missing required property "id"`}),void 0===t.render&&i.push({message:`layers.${r}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&i.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),i},t.bY=ev,t.bZ=eb,t.b_=class extends sh{constructor(t,i){super(t,i),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.ba=function(t,i,r){return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=i[3]*r,t},t.bb=function(t,i){return t[0]*i[0]+t[1]*i[1]+t[2]*i[2]+t[3]},t.bc=lJ,t.bd=l0,t.be=function(t,i,r,a,n){var s=1/Math.tan(i/2);if(t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0){var o=1/(a-n);t[10]=(n+a)*o,t[14]=2*n*a*o}else t[10]=-1,t[14]=-2*a;return t},t.bf=function(t){var i=new Y(16);return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},t.bg=function(t,i,r){var a=Math.sin(r),n=Math.cos(r),s=i[0],o=i[1],l=i[2],h=i[3],u=i[4],c=i[5],d=i[6],p=i[7];return i!==t&&(t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15]),t[0]=s*n+u*a,t[1]=o*n+c*a,t[2]=l*n+d*a,t[3]=h*n+p*a,t[4]=u*n-s*a,t[5]=c*n-o*a,t[6]=d*n-l*a,t[7]=p*n-h*a,t},t.bh=function(t,i,r){var a=Math.sin(r),n=Math.cos(r),s=i[4],o=i[5],l=i[6],h=i[7],u=i[8],c=i[9],d=i[10],p=i[11];return i!==t&&(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15]),t[4]=s*n+u*a,t[5]=o*n+c*a,t[6]=l*n+d*a,t[7]=h*n+p*a,t[8]=u*n-s*a,t[9]=c*n-o*a,t[10]=d*n-l*a,t[11]=p*n-h*a,t},t.bi=function(){let t=new Float32Array(16);return J(t),t},t.bj=function(){let t=new Float64Array(16);return J(t),t},t.bk=function(){return new Float64Array(16)},t.bl=function(t,i,r){let a=new Float64Array(4);return eo(a,t,i-90,r),a},t.bm=function(t,i,r,a){var n,s,o,l,h,u=i[0],c=i[1],d=i[2],p=i[3],f=r[0],m=r[1],_=r[2],g=r[3];return(s=u*f+c*m+d*_+p*g)<0&&(s=-s,f=-f,m=-m,_=-_,g=-g),1-s>1e-6?(o=Math.sin(n=Math.acos(s)),l=Math.sin((1-a)*n)/o,h=Math.sin(a*n)/o):(l=1-a,h=a),t[0]=l*u+h*f,t[1]=l*c+h*m,t[2]=l*d+h*_,t[3]=l*p+h*g,t},t.bn=function(t){var i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g;let y,x,v=new Float64Array(9);i=t[0],r=t[1],a=t[2],n=t[3],s=i+i,o=r+r,l=a+a,h=i*s,u=r*s,c=r*o,d=a*s,p=a*o,f=a*l,m=n*s,_=n*o,g=n*l,v[0]=1-c-f,v[3]=u-g,v[6]=d+_,v[1]=u+g,v[4]=1-h-f,v[7]=p-m,v[2]=d-_,v[5]=p+m,v[8]=1-h-c;let b=ek(-Math.asin(e_(v[2],-1,1)));return .001>Math.hypot(v[5],v[8])?(y=0,x=-ek(Math.atan2(v[3],v[4]))):(y=ek(0===v[5]&&0===v[8]?0:Math.atan2(v[5],v[8])),x=ek(0===v[1]&&0===v[0]?0:Math.atan2(v[1],v[0]))),{roll:y,pitch:b+90,bearing:x}},t.bo=function(t,i){return t.roll==i.roll&&t.pitch==i.pitch&&t.bearing==i.bearing},t.bp=tG,t.bq=su,t.br=-32768,t.bs=32767,t.bt=ov,t.bu=ed,t.bv=ep,t.bw=t1,t.bx=function(t,i,r,a,n){return ed(a,n,e_((t-i)/(r-i),0,1))},t.by=ec,t.bz=function(){return new Float64Array(3)},t.c=eV,t.c$=function(t,i,r,s,o){return b(this,void 0,void 0,function*(){let l,h,u;if(X())try{return yield eA(t,i,r,s,o)}catch(t){}return l=t.width,h=t.height,a&&n||(n=(a=new OffscreenCanvas(l,h)).getContext("2d",{willReadFrequently:!0})),a.width=l,a.height=h,n.drawImage(t,0,0,l,h),u=n.getImageData(i,r,s,o),n.clearRect(0,0,l,h),u.data})},t.c0=class extends sh{constructor(t,i){super(t,i),this.current=sp}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let i=1;i<16;i++)if(t[i]!==this.current[i]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.c1=sc,t.c2=class extends sh{constructor(t,i){super(t,i),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},t.c3=class extends sh{constructor(t,i){super(t,i),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},t.c4=K,t.c5=function(t,i){var r=Math.sin(i),a=Math.cos(i);return t[0]=a,t[1]=r,t[2]=0,t[3]=-r,t[4]=a,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.c6=function(t,i,r){var a=i[0],n=i[1],s=i[2];return t[0]=a*r[0]+n*r[3]+s*r[6],t[1]=a*r[1]+n*r[4]+s*r[7],t[2]=a*r[2]+n*r[5]+s*r[8],t},t.c7=function(t,i,r,a,n,s,o){var l=1/(i-r),h=1/(a-n),u=1/(s-o);return t[0]=-2*l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*h,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(i+r)*l,t[13]=(n+a)*h,t[14]=(o+s)*u,t[15]=1,t},t.c8=class extends sh{constructor(t,i){super(t,i),this.current=[]}set(t){if(t!=this.current){this.current=t;let i=new Float32Array(4*t.length);for(let r=0;r<t.length;r++)i[4*r]=t[r].r,i[4*r+1]=t[r].g,i[4*r+2]=t[r].b,i[4*r+3]=t[r].a;this.gl.uniform4fv(this.location,i)}}},t.c9=class extends sh{constructor(t,i){super(t,i),this.current=[]}set(t){if(t!=this.current){this.current=t;let i=new Float32Array(t);this.gl.uniform1fv(this.location,i)}}},t.cA=function(t,i){return eR[i]&&"touches"in t},t.cB=function(t){return eR[t]||eL[t]},t.cC=function(t,i,r){var a=i[0],n=i[1];return t[0]=r[0]*a+r[4]*n+r[12],t[1]=r[1]*a+r[5]*n+r[13],t},t.cD=function(t,i){let{x:r,y:a}=lX.fromLngLat(i);return!(t<0||t>25||a<0||a>=1||r<0||r>=1)},t.cE=function(t,i){return t[0]=i[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=i[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.cF=class extends nl{},t.cG={mark(t){performance.mark(t)},frame(t){null!=uF&&uB.push(t-uF),uF=t},clearMetrics(){for(let i in uF=null,uB=[],performance.clearMeasures(uV),performance.clearMeasures(uj),t.cH)performance.clearMarks(t.cH[i])},getPerformanceMetrics(){performance.measure(uV,t.cH.create,t.cH.load),performance.measure(uj,t.cH.create,t.cH.fullLoad);let i=performance.getEntriesByName(uV)[0].duration,r=performance.getEntriesByName(uj)[0].duration,a=uB.length,n=1/(uB.reduce((t,i)=>t+i,0)/a/1e3),s=uB.filter(t=>t>uO).reduce((t,i)=>t+(i-uO)/uO,0);return{loadTime:i,fullLoadTime:r,fps:n,percentDroppedFrames:s/(a+s)*100,totalFrames:a}}},t.cI=eU,t.cJ=function(t,i){eV.REGISTERED_PROTOCOLS[t]=i},t.cK=function(t){delete eV.REGISTERED_PROTOCOLS[t]},t.cL=function(t,i){let r={};for(let a=0;a<t.length;a++){let n=i&&i[t[a].id]||function(t){let i="";for(let r of eJ)i+=`/${function t(i){let r=typeof i;if("number"===r||"boolean"===r||"string"===r||null==i)return JSON.stringify(i);if(Array.isArray(i)){let r="[";for(let a of i)r+=`${t(a)},`;return`${r}]`}let a=Object.keys(i).sort(),n="{";for(let r=0;r<a.length;r++)n+=`${JSON.stringify(a[r])}:${t(i[a[r]])},`;return`${n}}`}(t[r])}`;return i}(t[a]);i&&(i[t[a].id]=n);let s=r[n];s||(s=r[n]=[]),s.push(t[a])}let a=[];for(let t in r)a.push(r[t]);return a},t.cM=aA,t.cN=l5,t.cO=us,t.cP=lx,t.cQ=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=8192/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;let r=i.bucket.layers[0],a=r.layout,n=r._unevaluatedLayout._values,s={layoutIconSize:n["icon-size"].possiblyEvaluate(new a$(i.bucket.zoom+1),i.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new a$(i.bucket.zoom+1),i.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new a$(18))};
2if("composite"===i.bucket.textSizeData.kind){let{minZoom:t,maxZoom:r}=i.bucket.textSizeData;s.compositeTextSizes=[n["text-size"].possiblyEvaluate(new a$(t),i.canonical),n["text-size"].possiblyEvaluate(new a$(r),i.canonical)]}if("composite"===i.bucket.iconSizeData.kind){let{minZoom:t,maxZoom:r}=i.bucket.iconSizeData;s.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new a$(t),i.canonical),n["icon-size"].possiblyEvaluate(new a$(r),i.canonical)]}let o=24*a.get("text-line-height"),l="viewport"!==a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement"),h=a.get("text-keep-upright"),u=a.get("text-size");for(let n of i.bucket.features){let c=a.get("text-font").evaluate(n,{},i.canonical).join(","),d=u.evaluate(n,{},i.canonical),p=s.layoutTextSize.evaluate(n,{},i.canonical),f=s.layoutIconSize.evaluate(n,{},i.canonical),m={horizontal:{},vertical:void 0},_=n.text,g,y=[0,0];if(_){let s=_.toString(),u=24*a.get("text-letter-spacing").evaluate(n,{},i.canonical),f=!function(t){for(let r of t){var i;if(i=r.codePointAt(0),aN.test(String.fromCodePoint(i)))return!1}return!0}(s)?0:u,g=a.get("text-anchor").evaluate(n,{},i.canonical),x=uI(r,n,i.canonical);if(!x){let t=a.get("text-radial-offset").evaluate(n,{},i.canonical);y=t?uM(g,[24*t,uP]):a.get("text-offset").evaluate(n,{},i.canonical).map(t=>24*t)}let v=l?"center":a.get("text-justify").evaluate(n,{},i.canonical),b="point"===a.get("symbol-placement")?24*a.get("text-max-width").evaluate(n,{},i.canonical):1/0,w=()=>{i.bucket.allowVerticalPlacement&&aV(s)&&(m.vertical=lv(_,i.glyphMap,i.glyphPositions,i.imagePositions,c,b,o,g,"left",f,y,t.az.vertical,!0,p,d))};if(!l&&x){let r=new Set;if("auto"===v)for(let t=0;t<x.values.length;t+=2)r.add(uE(x.values[t]));else r.add(v);let a=!1;for(let n of r)if(!m.horizontal[n])if(a)m.horizontal[n]=m.horizontal[0];else{let r=lv(_,i.glyphMap,i.glyphPositions,i.imagePositions,c,b,o,"center",n,f,y,t.az.horizontal,!1,p,d);r&&(m.horizontal[n]=r,a=1===r.positionedLines.length)}w()}else{"auto"===v&&(v=uE(g));let r=lv(_,i.glyphMap,i.glyphPositions,i.imagePositions,c,b,o,g,v,f,y,t.az.horizontal,!1,p,d);r&&(m.horizontal[v]=r),w(),aV(s)&&l&&h&&(m.vertical=lv(_,i.glyphMap,i.glyphPositions,i.imagePositions,c,b,o,g,v,f,y,t.az.vertical,!1,p,d))}}let x=!1;if(n.icon&&n.icon.name){let t=i.imageMap[n.icon.name];t&&(g=function(t,i,r){let{horizontalAlign:a,verticalAlign:n}=lb(r),s=i[0]-t.displaySize[0]*a,o=i[1]-t.displaySize[1]*n;return{image:t,top:o,bottom:o+t.displaySize[1],left:s,right:s+t.displaySize[0]}}(i.imagePositions[n.icon.name],a.get("icon-offset").evaluate(n,{},i.canonical),a.get("icon-anchor").evaluate(n,{},i.canonical)),x=!!t.sdf,void 0===i.bucket.sdfIcons?i.bucket.sdfIcons=x:i.bucket.sdfIcons!==x&&eS("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==i.bucket.pixelRatio||0!==a.get("icon-rotate").constantOr(1))&&(i.bucket.iconsNeedLinear=!0))}let v=uA(m.horizontal)||m.vertical;i.bucket.iconsInText=!!v&&v.iconsInText,(v||g)&&function(i,r,a,n,s,o,l,h,u,c,d,p){let f,m=o.textMaxSize.evaluate(r,{});void 0===m&&(m=l);let _=i.layers[0].layout,g=_.get("icon-offset").evaluate(r,{},d),y=uA(a.horizontal),x=l/24,v=i.tilePixelRatio*x,b=i.tilePixelRatio*m/24,T=i.tilePixelRatio*h,S=i.tilePixelRatio*_.get("symbol-spacing"),P=_.get("text-padding")*i.tilePixelRatio,M=function(t,i,r,a=1){let n=t.get("icon-padding").evaluate(i,{},r),s=n&&n.values;return[s[0]*a,s[1]*a,s[2]*a,s[3]*a]}(_,r,d,i.tilePixelRatio),I=_.get("text-max-angle")/180*Math.PI,E="viewport"!==_.get("text-rotation-alignment")&&"point"!==_.get("symbol-placement"),C="map"===_.get("icon-rotation-alignment")&&"point"!==_.get("symbol-placement"),A=_.get("symbol-placement"),D=S/2,z=_.get("icon-text-fit");n&&"none"!==z&&(i.allowVerticalPlacement&&a.vertical&&(f=lS(n,a.vertical,z,_.get("icon-text-fit-padding"),g,x)),y&&(n=lS(n,y,z,_.get("icon-text-fit-padding"),g,x)));let k=d?p.line.getGranularityForZoomLevel(d.z):1,R=(h,p)=>{p.x<0||p.x>=8192||p.y<0||p.y>=8192||function(i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,P,M){let I=i.addToLineVertexArray(r,a),E,C,A,D,z=0,k=0,R=0,L=0,F=-1,B=-1,O={},V=sn("");if(i.allowVerticalPlacement&&n.vertical){let t=h.layout.get("text-rotate").evaluate(w,{},P)+90;A=new ub(u,r,c,d,p,n.vertical,f,m,_,t),l&&(D=new ub(u,r,c,d,p,l,y,x,_,t))}if(s){let a=h.layout.get("icon-rotate").evaluate(w,{}),n="none"!==h.layout.get("icon-text-fit"),o=uy(s,a,S,n),f=l?uy(l,a,S,n):void 0;C=new ub(u,r,c,d,p,s,y,x,!1,a),z=4*o.length;let m=i.iconSizeData,_=null;"source"===m.kind?(_=[128*h.layout.get("icon-size").evaluate(w,{})])[0]>32640&&eS(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===m.kind&&((_=[128*T.compositeIconSizes[0].evaluate(w,{},P),128*T.compositeIconSizes[1].evaluate(w,{},P)])[0]>32640||_[1]>32640)&&eS(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),i.addSymbols(i.icon,o,_,b,v,w,t.az.none,r,I.lineStartIndex,I.lineLength,-1,P),F=i.icon.placedSymbolArray.length-1,f&&(k=4*f.length,i.addSymbols(i.icon,f,_,b,v,w,t.az.vertical,r,I.lineStartIndex,I.lineLength,-1,P),B=i.icon.placedSymbolArray.length-1)}let j=Object.keys(n.horizontal);for(let a of j){let s=n.horizontal[a];if(!E){V=sn(s.text);E=new ub(u,r,c,d,p,s,f,m,_,h.layout.get("text-rotate").evaluate(w,{},P))}let l=1===s.positionedLines.length;if(R+=uC(i,r,s,o,h,_,w,g,I,n.vertical?t.az.horizontal:t.az.horizontalOnly,l?j:[a],O,F,T,P),l)break}n.vertical&&(L+=uC(i,r,n.vertical,o,h,_,w,g,I,t.az.vertical,["vertical"],O,B,T,P));let N=E?E.boxStartIndex:i.collisionBoxArray.length,U=E?E.boxEndIndex:i.collisionBoxArray.length,G=A?A.boxStartIndex:i.collisionBoxArray.length,q=A?A.boxEndIndex:i.collisionBoxArray.length,Z=C?C.boxStartIndex:i.collisionBoxArray.length,$=C?C.boxEndIndex:i.collisionBoxArray.length,W=D?D.boxStartIndex:i.collisionBoxArray.length,H=D?D.boxEndIndex:i.collisionBoxArray.length,X=-1,Y=(t,i)=>
2t&&t.circleDiameter?Math.max(t.circleDiameter,i):i;X=Y(E,-1),X=Y(A,X),X=Y(C,X);let K=+((X=Y(D,X))>-1);K&&(X*=M/24),i.glyphOffsetArray.length>=lz.MAX_GLYPHS&&eS("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&i.addToSortKeyRanges(i.symbolInstances.length,w.sortKey);let J=uI(h,w,P),[Q,ee]=function(i,r){let a=i.length,n=null==r?void 0:r.values;if((null==n?void 0:n.length)>0)for(let r=0;r<n.length;r+=2){let a=n[r+1];i.emplaceBack(t.aP[n[r]],a[0],a[1])}return[a,i.length]}(i.textAnchorOffsets,J);i.symbolInstances.emplaceBack(r.x,r.y,O.right>=0?O.right:-1,O.center>=0?O.center:-1,O.left>=0?O.left:-1,O.vertical||-1,F,B,V,N,U,G,q,Z,$,W,H,c,R,L,z,k,K,0,f,X,Q,ee)}(i,p,h,a,n,s,f,i.layers[0],i.collisionBoxArray,r.index,r.sourceLayerIndex,i.index,v,[P,P,P,P],E,u,T,M,C,g,r,o,c,d,l)};if("line"===A)for(let t of uh(r.geometry,0,0,8192,8192)){let r=oS(t,k);for(let t of function(t,i,r,a,n,s,o){let l=a?.6*24*s:0,h=ug(a,n),u=h*s,c=0===t[0].x||8192===t[0].x||0===t[0].y||8192===t[0].y;return i-u<i/4&&(i=u+i/4),function t(i,r,a,n,s,o,l,h,u){let c=o/2,d=u_(i),p=0,f=r-a,m=[];for(let t=0;t<i.length-1;t++){let r=i[t],l=i[t+1],h=r.dist(l),_=l.angleTo(r);for(;f+a<p+h;){let g=((f+=a)-p)/h,y=iP.number(r.x,l.x,g),x=iP.number(r.y,l.y,g);if(y>=0&&y<u&&x>=0&&x<u&&f-c>=0&&f+c<=d){let r=new uf(y,x,_,t);r._round(),n&&!um(i,r,o,n,s)||m.push(r)}}p+=h}return h||m.length||l||(m=t(i,p/2,a,n,s,o,l,!0,u)),m}(t,c?i/2*o%i:(h/2+48)*s*o%i,i,l,r,u,c,!1,8192)}(r,S,I,a.vertical||y,n,b,i.overscaling))y&&function(t,i,r,a){let n=t.compareText;if(i in n){let t=n[i];for(let i=t.length-1;i>=0;i--)if(a.dist(t[i])<r)return!0}else n[i]=[];return n[i].push(a),!1}(i,y.text,D,t)||R(r,t)}else if("line-center"===A){for(let t of r.geometry)if(t.length>1){let i=oS(t,k),r=function(t,i,r,a,n){let s=r?.6*24*n:0,o=ug(r,a)*n,l=0,h=u_(t)/2;for(let r=0;r<t.length-1;r++){let a=t[r],n=t[r+1],u=a.dist(n);if(l+u>h){let c=(h-l)/u,d=new uf(iP.number(a.x,n.x,c),iP.number(a.y,n.y,c),n.angleTo(a),r);return d._round(),!s||um(t,d,o,s,i)?d:void 0}l+=u}}(i,I,a.vertical||y,n,b);r&&R(i,r)}}else if("Polygon"===r.type)for(let t of i2(r.geometry,0)){let i=function(t,i=1,r=!1){let a=l3.fromPoints(t[0]),n=Math.min(a.width(),a.height()),s=n/2,o=new uw([],uT),{minX:l,minY:h,maxX:u,maxY:c}=a;if(0===n)return new w(l,h);for(let i=l;i<u;i+=n)for(let r=h;r<c;r+=n)o.push(new uS(i+s,r+s,s,t));let d=function(t){let i=0,r=0,a=0,n=t[0];for(let t=0,s=n.length,o=s-1;t<s;o=t++){let s=n[t],l=n[o],h=s.x*l.y-l.x*s.y;r+=(s.x+l.x)*h,a+=(s.y+l.y)*h,i+=3*h}return new uS(r/i,a/i,0,t)}(t),p=o.length;for(;o.length;){let a=o.pop();(a.d>d.d||!d.d)&&(d=a,r&&console.log("found best %d after %d probes",Math.round(1e4*a.d)/1e4,p)),a.max-d.d<=i||(s=a.h/2,o.push(new uS(a.p.x-s,a.p.y-s,s,t)),o.push(new uS(a.p.x+s,a.p.y-s,s,t)),o.push(new uS(a.p.x-s,a.p.y+s,s,t)),o.push(new uS(a.p.x+s,a.p.y+s,s,t)),p+=4)}return r&&(console.log(`num probes: ${p}`),console.log(`best distance: ${d.d}`)),d.p}(t,16);R(oS(t[0],k,!0),new uf(i.x,i.y,0))}else if("LineString"===r.type)for(let t of r.geometry){let i=oS(t,k);R(i,new uf(i[0].x,i[0].y,0))}else if("Point"===r.type)for(let t of r.geometry)for(let i of t)R([i],new uf(i.x,i.y,0))}(i.bucket,n,m,g,i.imageMap,s,p,f,y,x,i.canonical,i.subdivisionGranularity)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},t.cR=oI,t.cS=oN,t.cT=oY,t.cU=function(t){let i=new lr;return function(t,i){for(let r in t.layers)i.writeMessage(3,ut,t.layers[r])}(t,i),i.finish()},t.cV=function(t,i,r,a,n,s){let o=uu(t,i,r,n,0);return uu(o,i,a,s,1)},t.cW=class{constructor(t){this.maxEntries=t,this.map=new Map}get(t){let i=this.map.get(t);return void 0!==i&&(this.map.delete(t),this.map.set(t,i)),i}set(t,i){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxEntries){let t=this.map.keys().next().value;this.map.delete(t)}this.map.set(t,i)}clear(){this.map.clear()}},t.cX=oO,t.cY=lr,t.cZ=h9,t.c_=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.ca=class extends nv{},t.cb=o5,t.cc=class extends nw{},t.cd=s2,t.ce=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.cf=s1,t.cg=function(t,i,r){var a=i[0],n=i[1],s=i[2],o=r[3]*a+r[7]*n+r[11]*s+r[15];return t[0]=(r[0]*a+r[4]*n+r[8]*s+r[12])/(o=o||1),t[1]=(r[1]*a+r[5]*n+r[9]*s+r[13])/o,t[2]=(r[2]*a+r[6]*n+r[10]*s+r[14])/o,t},t.ch=class extends nh{},t.ci=class extends nC{},t.cj=function(t,i){return t[0]===i[0]&&t[1]===i[1]&&t[2]===i[2]&&t[3]===i[3]&&t[4]===i[4]&&t[5]===i[5]&&t[6]===i[6]&&t[7]===i[7]&&t[8]===i[8]&&t[9]===i[9]&&t[10]===i[10]&&t[11]===i[11]&&t[12]===i[12]&&t[13]===i[13]&&t[14]===i[14]&&t[15]===i[15]},t.ck=function(t,i){var r=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],m=t[12],_=t[13],g=t[14],y=t[15],x=i[0],v=i[1],b=i[2],w=i[3],T=i[4],S=i[5],P=i[6],M=i[7],I=i[8],E=i[9],C=i[10],A=i[11],D=i[12],z=i[13],k=i[14],R=i[15];return Math.abs(r-x)<=1e-6*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(a-v)<=1e-6*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(n-b)<=1e-6*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(s-w)<=1e-6*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(o-T)<=1e-6*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(l-S)<=1e-6*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(h-P)<=1e-6*Math.max(1,Math.abs(h),Math.abs(P))&&Math.abs(u-M)<=1e-6*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(c-I)<=1e-6*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(d-E)<=1e-6*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(p-C)<=1e-6*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(f-A)<=1e-6*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(m-D)<=1e-6*Math.max(1,Math.abs(m),Math.abs(D))&&Math.abs(_-z)<=1e-6*Math.max(1,Math.abs(_),Math.abs(z))&&Math.abs(g-k)<=1e-6*Math.max(1,Math.abs(g),Math.abs(k))&&Math.abs(y-R)<=1e-6*Math.max(1,Math.abs(y),Math.abs(R))},t.cl=function(t,i){return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},t.cm=t=>"symbol"===t.type,t.cn=t=>"circle"===t.type,t.co=t=>"heatmap"===t.type,t.cp=t=>"line"===t.type,t.cq=t=>"fill"===t.type,t.cr=t=>"fill-extrusion"===t.type,t.cs=t=>"hillshade"===t.type,t.ct=t=>"color-relief"===t.type,t.cu=t=>"background"===t.type,t.cv=t=>"custom"===t.type,t.cw=ef,t.cx=function(t,i,r){let a=eh(i.x-r.x,i.y-r.y),n=eh(t.x-r.x,t.y-r.y);return ek(Math.atan2(a[0]*n[1]-a[1]*n[0],a[0]*n[0]+a[1]*n[1]))},t.cy=em,t.cz=function(t,i){return eL[i]&&(t instanceof MouseEvent||t instanceof WheelEvent)},t.d=eZ,t.d0=s9,t.d1=T,t.d2=class{constructor(t,i){this.layers={[ue]:this},this.name=ue,this.version=i?i.version:1,this.extent=i?i.extent:4096,this.length=t.length,this.features=t}feature(t){return new h7(this.features[t],this.extent)}},t.d3=rV,t.d4=aZ,t.e=ey,t.f=t=>b(void 0,void 0,void 0,function*(){if(0===t.byteLength)return createImageBitmap(new ImageData(1,1));let i=new Blob([new Uint8Array(t)],{type:"image/png"});try{return createImageBitmap(i)}catch(t){throw Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),t.g=ej,t.h=t=>new Promise((i,r)=>{let a=new Image;a.onload=()=>{i(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=eC})},a.onerror=()=>r(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let n=new Blob([new Uint8Array(t)],{type:"image/png"});a.src=t.byteLength?URL.createObjectURL(n):eC}),t.i=eM,t.j=(t,i)=>eq(ey(t,{type:"json"}),i),t.k=eX,t.l=eH,t.m=eq,t.n=(t,i)=>eq(ey(t,{type:"arrayBuffer"}),i),t.o=function(t){return new lr(t).readFields(lf,[])},t.p=lg,t.q=function(t){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(t))},t.r=sQ,t.s=eD,t.t=a9,t.u=eK,t.v=eK,t.w=eS,t.x=aK,t.y=aT,t.z=aH}),r("worker",["./shared"],function(t){class i{constructor(t,i){this.keyCache={},t&&this.replace(t,i)}replace(t,i){this._layerConfigs={},this._layers={},this.update(t,[],i)}update(i,r,a){for(let r of i){this._layerConfigs[r.id]=r;let i=this._layers[r.id]=t.bT(r,a);i._featureFilter=t.aj(i.filter,a),this.keyCache[r.id]&&delete this.keyCache[r.id]}for(let t of r)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];for(let i of(this.familiesBySource={},t.cL(Object.values(this._layerConfigs),this.keyCache))){let r=i.map(t=>this._layers[t.id]),a=r[0];if(a.isHidden())continue;let n=a.source||"",s=this.familiesBySource[n];
2s||(s=this.familiesBySource[n]={});let o=a.sourceLayer||t.ai,l=s[o];l||(l=s[o]=[]),l.push(r)}}}class r{constructor(i){const r={},a=[];for(const t in i){const n=i[t],s=r[t]={};for(const t in n){const i=n[+t];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const r={x:0,y:0,w:i.bitmap.width+2,h:i.bitmap.height+2};a.push(r),s[t]={rect:r,metrics:i.metrics}}}const{w:n,h:s}=t.p(a),o=new t.r({width:n||1,height:s||1});for(const a in i){const n=i[a];for(const i in n){const s=n[+i];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const l=r[a][i].rect;t.r.copy(s.bitmap,o,{x:0,y:0},{x:l.x+1,y:l.y+1},s.bitmap)}}this.image=o,this.positions=r}}t.cM("GlyphAtlas",r);class a{constructor(i){this.tileID=new t.a2(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.uid=i.uid,this.zoom=i.zoom,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.collectResourceTiming=!!i.collectResourceTiming,this.returnDependencies=!!i.returnDependencies,this.promoteId=i.promoteId,this.inFlightDependencies=[]}parse(i,a,s,o,l){return t._(this,void 0,void 0,function*(){this.status="parsing",this.data=i,this.collisionBoxArray=new t.ag;let h=new t.cN(Object.keys(i.layers).sort()),u=new t.cO(this.tileID,this.promoteId);u.bucketLayerIDs=[];let c={},d={featureIndex:u,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:s,subdivisionGranularity:l},p=a.familiesBySource[this.source];for(let r in p){let a=i.layers[r];if(!a)continue;1===a.version&&t.w(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let o=h.encode(r),l=[];for(let t=0;t<a.length;t++){let i=a.feature(t),n=u.getId(i,r);l.push({feature:i,id:n,index:t,sourceLayerIndex:o})}for(let i of p[r]){let r=i[0];r.source!==this.source&&t.w(`layer.source = ${r.source} does not equal this.source = ${this.source}`),r.isHidden(this.zoom,!0)||(n(i,this.zoom,s),(c[r.id]=r.createBucket({index:u.bucketLayerIDs.length,layers:i,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(l,d,this.tileID.canonical),u.bucketLayerIDs.push(i.map(t=>t.id)))}}let f=t.bY(d.glyphDependencies,t=>Object.keys(t).map(Number));this.inFlightDependencies.forEach(t=>null==t?void 0:t.abort()),this.inFlightDependencies=[];let m=Promise.resolve({});if(Object.keys(f).length){let t=new AbortController;this.inFlightDependencies.push(t),m=o.sendAsync({type:"GG",data:{stacks:f,source:this.source,tileID:this.tileID,type:"glyphs"}},t)}let _=Object.keys(d.iconDependencies),g=Promise.resolve({});if(_.length){let t=new AbortController;this.inFlightDependencies.push(t),g=o.sendAsync({type:"GI",data:{icons:_,source:this.source,tileID:this.tileID,type:"icons"}},t)}let y=Object.keys(d.patternDependencies),x=Promise.resolve({});if(y.length){let t=new AbortController;this.inFlightDependencies.push(t),x=o.sendAsync({type:"GI",data:{icons:y,source:this.source,tileID:this.tileID,type:"patterns"}},t)}let v=d.dashDependencies,b=Promise.resolve({});if(Object.keys(v).length){let t=new AbortController;this.inFlightDependencies.push(t),b=o.sendAsync({type:"GDA",data:{dashes:v}},t)}let[w,T,S,P]=yield Promise.all([m,g,x,b]),M=new r(w),I=new t.cP(T,S);for(let i in c){let r=c[i];r instanceof t.ah?(n(r.layers,this.zoom,s),t.cQ({bucket:r,glyphMap:w,glyphPositions:M.positions,imageMap:T,imagePositions:I.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:d.subdivisionGranularity})):r.hasDependencies&&(r instanceof t.cR||r instanceof t.cS||r instanceof t.cT)&&(n(r.layers,this.zoom,s),r.addFeatures(d,this.tileID.canonical,I.patternPositions,P))}return this.status="done",{buckets:Object.values(c).filter(t=>!t.isEmpty()),featureIndex:u,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:M.image,imageAtlas:I,dashPositions:P,glyphMap:this.returnDependencies?w:null,iconMap:this.returnDependencies?T:null,glyphPositions:this.returnDependencies?M.positions:null}})}}function n(i,r,a){let n=new t.H(r);
2for(let t of i)t.recalculate(n,a)}class s{constructor(t,i,r,a,n){this.type=t,this.properties=r||{},this.extent=n,this.pointsArray=i,this.id=a}loadGeometry(){return this.pointsArray.map(i=>i.map(i=>new t.P(i.x,i.y)))}}class o{constructor(t,i,r){this.version=2,this._myFeatures=t,this.name=i,this.length=t.length,this.extent=r}feature(t){return this._myFeatures[t]}}class l{constructor(){this.layers={}}addLayer(t){this.layers[t.name]=t}}function h(i){let r=t.cU(i);return 0===r.byteOffset&&r.byteLength===r.buffer.byteLength||(r=new Uint8Array(r)),{vectorTile:i,rawData:r.buffer}}class u{constructor(i,r,a){this.actor=i,this.layerIndex=r,this.availableImages=a,this.fetching={},this.loading={},this.loaded={},this.overzoomedTileResultCache=new t.cW(1e3)}loadVectorTile(i,r){return t._(this,void 0,void 0,function*(){let a=yield t.n(i.request,r);try{return{vectorTile:"mlt"!==i.encoding?new t.cX(new t.cY(a.data)):new t.cZ(a.data),rawData:a.data,cacheControl:a.cacheControl,expires:a.expires}}catch(n){let t=new Uint8Array(a.data),r=`Unable to parse the tile at ${i.request.url}, `;throw Error(r+=31===t[0]&&139===t[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${n.message}`)}})}loadTile(i){return t._(this,void 0,void 0,function*(){let{uid:r,overzoomParameters:n}=i;n&&(i.request=n.overzoomRequest);let s=!!(i&&i.request&&i.request.collectResourceTiming)&&new t.c_(i.request),o=new a(i);this.loading[r]=o;let l=new AbortController;o.abort=l;try{let a=yield this.loadVectorTile(i,l);if(delete this.loading[r],!a)return null;if(n){let t=this._getOverzoomTile(i,a.vectorTile);a.rawData=t.rawData,a.vectorTile=t.vectorTile}let h=a.rawData,u={};a.expires&&(u.expires=a.expires),a.cacheControl&&(u.cacheControl=a.cacheControl);let c={};if(s){let t=s.finish();t&&(c.resourceTiming=JSON.parse(JSON.stringify(t)))}o.vectorTile=a.vectorTile;let d=o.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,i.subdivisionGranularity);this.loaded[r]=o,this.fetching[r]={rawTileData:h,cacheControl:u,resourceTiming:c};try{let r=yield d;return t.e({rawTileData:h.slice(0),encoding:i.encoding},r,u,c)}finally{delete this.fetching[r]}}catch(t){throw delete this.loading[r],o.status="done",this.loaded[r]=o,t}})}_getOverzoomTile(i,r){let{tileID:a,source:n,overzoomParameters:u}=i,{maxZoomTileID:c}=u,d=`${c.key}_${a.key}`,p=this.overzoomedTileResultCache.get(d);if(p)return p;let f=new l,m=this.layerIndex.familiesBySource[n];for(let i in m){let n=r.layers[i];if(!n)continue;let l=function(i,r,a){let{extent:n}=i,l=Math.pow(2,a.z-r.z),h=(a.x-r.x*l)*n,u=(a.y-r.y*l)*n,c=[];for(let r=0;r<i.length;r++){let a=i.feature(r),o=a.loadGeometry();for(let t of o)for(let i of t)i.x=i.x*l-h,i.y=i.y*l-u;0!==(o=t.cV(o,a.type,-128,-128,n+128,n+128)).length&&c.push(new s(a.type,o,a.properties,a.id,n))}return new o(c,i.name,n)}(n,c,a.canonical);l.length>0&&f.addLayer(l)}let _=h(f);return this.overzoomedTileResultCache.set(d,_),_}reloadTile(i){return t._(this,void 0,void 0,function*(){let r=i.uid;if(!this.loaded||!this.loaded[r])throw Error("Should not be trying to reload a tile that was never loaded or has been removed");let a=this.loaded[r];if(a.showCollisionBoxes=i.showCollisionBoxes,"parsing"===a.status){let n,s=yield a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,i.subdivisionGranularity);if(this.fetching[r]){let{rawTileData:a,cacheControl:o,resourceTiming:l}=this.fetching[r];delete this.fetching[r],n=t.e({rawTileData:a.slice(0),encoding:i.encoding},s,o,l)}else n=s;return n}if("done"===a.status&&a.vectorTile)return a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,i.subdivisionGranularity)})}abortTile(i){return t._(this,void 0,void 0,function*(){let t=this.loading,r=i.uid;t&&t[r]&&t[r].abort&&(t[r].abort.abort(),delete t[r])})}removeTile(i){return t._(this,void 0,void 0,function*(){this.loaded&&this.loaded[i.uid]&&delete this.loaded[i.uid]})}}class c{constructor(){this.loaded={}}loadTile(i){return t._(this,void 0,void 0,function*(){let{uid:r,encoding:a,rawImageData:n,redFactor:s,greenFactor:o,blueFactor:l,baseShift:h}=i,u=n.width+2,c=n.height+2,d=t.b(n)?new t.R({width:u,height:c},(yield t.c$(n,-1,-1,u,c))):n,p=new t.d0(r,d,a,s,o,l,h);return this.loaded=this.loaded||{},this.loaded[r]=p,p})}removeTile(t){let i=this.loaded,r=t.uid;i&&i[r]&&delete i[r]}}var d,p,f,m=function(){if(f)return p;function t(t,r){if(0!==t.length){i(t[0],r);for(var a=1;a<t.length;a++)i(t[a],!r)}}function i(t,i){for(var r=0,a=0,n=0,s=t.length,o=s-1;n<s;o=n++){var l=(t[n][0]-t[o][0])*(t[o][1]+t[n][1]),h=r+l;a+=Math.abs(r)>=Math.abs(l)?r-h+l:l-h+r,r=h}r+a>=0!=!!i&&t.reverse()}return f=1,p=function i(r,a){var n,s=r&&r.type;if("FeatureCollection"===s)for(n=0;n<r.features.length;n++)i(r.features[n],a);else if("GeometryCollection"===s)for(n=0;n<r.geometries.length;n++)i(r.geometries[n],a);else if("Feature"===s)i(r.geometry,a);else if("Polygon"===s)t(r.coordinates,a);else if("MultiPolygon"===s)for(n=0;n<r.coordinates.length;n++)t(r.coordinates[n],a);return r}}(),_=t.d1(m);let g={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},y=Math.fround||(d=new Float32Array(1),t=>(d[0]=+t,d[0]));class x{constructor(t){this.options=Object.assign(Object.create(g),t),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){let{log:i,minZoom:r,maxZoom:a}=this.options;i&&console.time("total time");let n=`prepare ${t.length} points`;i&&console.time(n),this.points=t;let s=[];for(let i=0;i<t.length;i++){let r=t[i];if(!r.geometry)continue;let[a,n]=r.geometry.coordinates,o=y(w(a)),l=y(T(n));s.push(o,l,1/0,i,-1,1),this.options.reduce&&s.push(0)}let o=this.trees[a+1]=this._createTree(s);i&&console.timeEnd(n);for(let t=a;t>=r;t--){let r=+Date.now();o=this.trees[t]=this._createTree(this._cluster(o,t)),i&&console.log("z%d: %d clusters in %dms",t,o.numItems,Date.now()-r)}
2return i&&console.timeEnd("total time"),this}getClusters(t,i){let r=((t[0]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[1])),n=180===t[2]?180:((t[2]+180)%360+360)%360-180,s=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){let t=this.getClusters([r,a,180,s],i),o=this.getClusters([-180,a,n,s],i);return t.concat(o)}let o=this.trees[this._limitZoom(i)],l=o.range(w(r),T(s),w(n),T(a)),h=o.data,u=[];for(let t of l){let i=this.stride*t;u.push(h[i+5]>1?v(h,i,this.clusterProps):this.points[h[i+3]])}return u}getChildren(t){let i=this._getOriginId(t),r=this._getOriginZoom(t),a="No cluster with the specified id.",n=this.trees[r];if(!n)throw Error(a);let s=n.data;if(i*this.stride>=s.length)throw Error(a);let o=this.options.radius/(this.options.extent*Math.pow(2,r-1)),l=n.within(s[i*this.stride],s[i*this.stride+1],o),h=[];for(let i of l){let r=i*this.stride;s[r+4]===t&&h.push(s[r+5]>1?v(s,r,this.clusterProps):this.points[s[r+3]])}if(0===h.length)throw Error(a);return h}getLeaves(t,i,r){let a=[];return this._appendLeaves(a,t,i=i||10,r=r||0,0),a}getTile(t,i,r){let a=this.trees[this._limitZoom(t)],n=Math.pow(2,t),{extent:s,radius:o}=this.options,l=o/s,h=(r-l)/n,u=(r+1+l)/n,c={features:[]};return this._addTileFeatures(a.range((i-l)/n,h,(i+1+l)/n,u),a.data,i,r,n,c),0===i&&this._addTileFeatures(a.range(1-l/n,h,1,u),a.data,n,r,n,c),i===n-1&&this._addTileFeatures(a.range(0,h,l/n,u),a.data,-1,r,n,c),c.features.length?c:null}getClusterExpansionZoom(t){let i=this._getOriginZoom(t)-1;for(;i<=this.options.maxZoom;){let r=this.getChildren(t);if(i++,1!==r.length)break;t=r[0].properties.cluster_id}return i}_appendLeaves(t,i,r,a,n){for(let s of this.getChildren(i)){let i=s.properties;if(i&&i.cluster?n+i.point_count<=a?n+=i.point_count:n=this._appendLeaves(t,i.cluster_id,r,a,n):n<a?n++:t.push(s),t.length===r)break}return n}_createTree(i){let r=new t.aT(i.length/this.stride|0,this.options.nodeSize,Float32Array);for(let t=0;t<i.length;t+=this.stride)r.add(i[t],i[t+1]);return r.finish(),r.data=i,r}_addTileFeatures(t,i,r,a,n,s){for(let o of t){let t,l,h,u,c=o*this.stride,d=i[c+5]>1;if(d)t=b(i,c,this.clusterProps),l=i[c],h=i[c+1];else{let r=this.points[i[c+3]];t=r.properties;let[a,n]=r.geometry.coordinates;l=w(a),h=T(n)}let p={type:1,geometry:[[Math.round(this.options.extent*(l*n-r)),Math.round(this.options.extent*(h*n-a))]],tags:t};void 0!==(u=d||this.options.generateId?i[c+3]:this.points[i[c+3]].id)&&(p.id=u),s.features.push(p)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,i){let{radius:r,extent:a,reduce:n,minPoints:s}=this.options,o=r/(a*Math.pow(2,i)),l=t.data,h=[],u=this.stride;for(let r=0;r<l.length;r+=u){if(l[r+2]<=i)continue;l[r+2]=i;let a=l[r],c=l[r+1],d=t.within(l[r],l[r+1],o),p=l[r+5],f=p;for(let t of d){let r=t*u;l[r+2]>i&&(f+=l[r+5])}if(f>p&&f>=s){let t,s=a*p,o=c*p,m=-1,_=(r/u<<5)+(i+1)+this.points.length;for(let a of d){let h=a*u;if(l[h+2]<=i)continue;l[h+2]=i;let c=l[h+5];s+=l[h]*c,o+=l[h+1]*c,l[h+4]=_,n&&(t||(t=this._map(l,r,!0),m=this.clusterProps.length,this.clusterProps.push(t)),n(t,this._map(l,h)))}l[r+4]=_,h.push(s/f,o/f,1/0,_,-1,f),n&&h.push(m)}else{for(let t=0;t<u;t++)h.push(l[r+t]);if(f>1)for(let t of d){let r=t*u;if(!(l[r+2]<=i)){l[r+2]=i;for(let t=0;t<u;t++)h.push(l[r+t])}}}}return h}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,i,r){if(t[i+5]>1){let a=this.clusterProps[t[i+6]];return r?Object.assign({},a):a}let a=this.points[t[i+3]].properties,n=this.options.map(a);return r&&n===a?Object.assign({},n):n}}function v(t,i,r){return{type:"Feature",id:t[i+3],properties:b(t,i,r),geometry:{type:"Point",coordinates:[360*(t[i]-.5),360*Math.atan(Math.exp((180-360*t[i+1])*Math.PI/180))/Math.PI-90]}}}function b(t,i,r){let a=t[i+5],n=a>=1e4?`${Math.round(a/1e3)}k`:a>=1e3?Math.round(a/100)/10+"k":a,s=t[i+6];return Object.assign(-1===s?{}:Object.assign({},r[s]),{cluster:!0,cluster_id:t[i+3],point_count:a,point_count_abbreviated:n})}function w(t){return t/360+.5}function T(t){let i=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+i)/(1-i))/Math.PI;return r<0?0:r>1?1:r}function S(t,i,r,a){let n={id:null==t?null:t,type:i,geometry:r,tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===i||"MultiPoint"===i||"LineString"===i)P(n,r);else if("Polygon"===i)P(n,r[0]);else if("MultiLineString"===i)for(let t of r)P(n,t);else if("MultiPolygon"===i)for(let t of r)P(n,t[0]);return n}function P(t,i){for(let r=0;r<i.length;r+=3)t.minX=Math.min(t.minX,i[r]),t.minY=Math.min(t.minY,i[r+1]),t.maxX=Math.max(t.maxX,i[r]),t.maxY=Math.max(t.maxY,i[r+1])}function M(t,i,r,a){if(!i.geometry)return;let n=i.geometry.coordinates;if(n&&0===n.length)return;let s=i.geometry.type,o=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),l=[],h=i.id;if(r.promoteId?h=i.properties[r.promoteId]:r.generateId&&(h=a||0),"Point"===s)I(n,l);else if("MultiPoint"===s)for(let t of n)I(t,l);else if("LineString"===s)E(n,l,o,!1);else if("MultiLineString"===s){if(r.lineMetrics){for(let r of n)E(r,l=[],o,!1),t.push(S(h,"LineString",l,i.properties));return}C(n,l,o,!1)}else if("Polygon"===s)C(n,l,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(let n of i.geometry.geometries)M(t,{id:h,geometry:n,properties:i.properties},r,a);return}throw Error("Input data is not a valid GeoJSON object.")}for(let t of n){let i=[];C(t,i,o,!0),l.push(i)}}t.push(S(h,s,l,i.properties))}function I(t,i){i.push(t[0]/360+.5,A(t[1]),0)}function E(t,i,r,a){let n,s,o=0;for(let r=0;r<t.length;r++){let l=t[r][0]/360+.5,h=A(t[r][1]);i.push(l,h,0),r>0&&(o+=a?(n*h-l*s)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(h-s,2))),n=l,s=h}let l=i.length-3;i[2]=1,function t(i,r,a,n){let s=n,o=r+(a-r>>1),l,h=a-r,u=i[r],c=i[r+1],d=i[a],p=i[a+1];for(let t=r+3;t<a;t+=3){let r=function(t,i,r,a,n,s){let o=n-r,l=s-a;if(0!==o||0!==l){let h=((t-r)*o+(i-a)*l)/(o*o+l*l);h>1?(r=n,a=s):h>0&&(r+=o*h,a+=l*h)}return(o=t-r)*o+(l=i-a)*l}(i[t],i[t+1],u,c,d,p);if(r>s)l=t,s=r;else if(r===s){let i=Math.abs(t-o);
2i<h&&(l=t,h=i)}}s>n&&(l-r>3&&t(i,r,l,n),i[l+2]=s,a-l>3&&t(i,l,a,n))}(i,0,l,r),i[l+2]=1,i.size=Math.abs(o),i.start=0,i.end=i.size}function C(t,i,r,a){for(let n=0;n<t.length;n++){let s=[];E(t[n],s,r,a),i.push(s)}}function A(t){let i=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+i)/(1-i))/Math.PI;return r<0?0:r>1?1:r}function D(t,i,r,a,n,s,o,l){if(a/=i,s>=(r/=i)&&o<a)return t;if(o<r||s>=a)return null;let h=[];for(let i of t){let t=i.geometry,s=i.type,o=0===n?i.minX:i.minY,m=0===n?i.maxX:i.maxY;if(o>=r&&m<a){h.push(i);continue}if(m<r||o>=a)continue;let _=[];if("Point"===s||"MultiPoint"===s){var u=t,c=_,d=r,p=a,f=n;for(let t=0;t<u.length;t+=3){let i=u[t+f];i>=d&&i<=p&&L(c,u[t],u[t+1],u[t+2])}}else if("LineString"===s)z(t,_,r,a,n,!1,l.lineMetrics);else if("MultiLineString"===s)R(t,_,r,a,n,!1);else if("Polygon"===s)R(t,_,r,a,n,!0);else if("MultiPolygon"===s)for(let i of t){let t=[];R(i,t,r,a,n,!0),t.length&&_.push(t)}if(_.length){if(l.lineMetrics&&"LineString"===s){for(let t of _)h.push(S(i.id,s,t,i.tags));continue}"LineString"!==s&&"MultiLineString"!==s||(1===_.length?(s="LineString",_=_[0]):s="MultiLineString"),"Point"!==s&&"MultiPoint"!==s||(s=3===_.length?"Point":"MultiPoint"),h.push(S(i.id,s,_,i.tags))}}return h.length?h:null}function z(t,i,r,a,n,s,o){let l=k(t),h=0===n?F:B,u,c,d=t.start;for(let p=0;p<t.length-3;p+=3){let f=t[p],m=t[p+1],_=t[p+2],g=t[p+3],y=t[p+4],x=0===n?f:m,v=0===n?g:y,b=!1;o&&(u=Math.sqrt(Math.pow(f-g,2)+Math.pow(m-y,2))),x<r?v>r&&(c=h(l,f,m,g,y,r),o&&(l.start=d+u*c)):x>a?v<a&&(c=h(l,f,m,g,y,a),o&&(l.start=d+u*c)):L(l,f,m,_),v<r&&x>=r&&(c=h(l,f,m,g,y,r),b=!0),v>a&&x<=a&&(c=h(l,f,m,g,y,a),b=!0),!s&&b&&(o&&(l.end=d+u*c),i.push(l),l=k(t)),o&&(d+=u)}let p=t.length-3,f=t[p],m=t[p+1],_=0===n?f:m;_>=r&&_<=a&&L(l,f,m,t[p+2]),p=l.length-3,s&&p>=3&&(l[p]!==l[0]||l[p+1]!==l[1])&&L(l,l[0],l[1],l[2]),l.length&&i.push(l)}function k(t){let i=[];return i.size=t.size,i.start=t.start,i.end=t.end,i}function R(t,i,r,a,n,s){for(let o of t)z(o,i,r,a,n,s,!1)}function L(t,i,r,a){t.push(i,r,a)}function F(t,i,r,a,n,s){let o=(s-i)/(a-i);return L(t,s,r+(n-r)*o,1),o}function B(t,i,r,a,n,s){let o=(s-r)/(n-r);return L(t,i+(a-i)*o,s,1),o}function O(t,i){let r=[];for(let a=0;a<t.length;a++){let n,s=t[a],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)n=V(s.geometry,i);else if("MultiLineString"===o||"Polygon"===o)for(let t of(n=[],s.geometry))n.push(V(t,i));else if("MultiPolygon"===o)for(let t of(n=[],s.geometry)){let r=[];for(let a of t)r.push(V(a,i));n.push(r)}r.push(S(s.id,o,n,s.tags))}return r}function V(t,i){let r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(let a=0;a<t.length;a+=3)r.push(t[a]+i,t[a+1],t[a+2]);return r}function j(t,i){if(t.transformed)return t;let r=1<<t.z,a=t.x,n=t.y;for(let s of t.features){let t=s.geometry,o=s.type;if(s.geometry=[],1===o)for(let o=0;o<t.length;o+=2)s.geometry.push(N(t[o],t[o+1],i,r,a,n));else for(let o=0;o<t.length;o++){let l=[];for(let s=0;s<t[o].length;s+=2)l.push(N(t[o][s],t[o][s+1],i,r,a,n));s.geometry.push(l)}}return t.transformed=!0,t}function N(t,i,r,a,n,s){return[Math.round(r*(t*a-n)),Math.round(r*(i*a-s))]}function U(t,i,r,a,n,s){let o=a*a;if(a>0&&i.size<(n?o:a))return void(r.numPoints+=i.length/3);let l=[];for(let t=0;t<i.length;t+=3)(0===a||i[t+2]>o)&&(r.numSimplified++,l.push(i[t],i[t+1])),r.numPoints++;n&&function(t,i){let r=0;for(let i=0,a=t.length,n=a-2;i<a;n=i,i+=2)r+=(t[i]-t[n])*(t[i+1]+t[n+1]);if(r>0===i)for(let i=0,r=t.length;i<r/2;i+=2){let a=t[i],n=t[i+1];t[i]=t[r-2-i],t[i+1]=t[r-1-i],t[r-2-i]=a,t[r-1-i]=n}}(l,s),t.push(l)}let G={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class q{constructor(t,i){const r=(i=this.options=function(t,i){for(let r in i)t[r]=i[r];return t}(Object.create(G),i)).debug;if(r&&console.time("preprocess data"),i.maxZoom<0||i.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(i.promoteId&&i.generateId)throw Error("promoteId and generateId cannot be used together.");let a=function(t,i){let r=[];if("FeatureCollection"===t.type)for(let a=0;a<t.features.length;a++)M(r,t.features[a],i,a);else M(r,"Feature"===t.type?t:{geometry:t},i);return r}(t,i);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",i.indexMaxZoom,i.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(a=function(t,i){let r=i.buffer/i.extent,a=t,n=D(t,1,-1-r,r,0,-1,2,i
2),s=D(t,1,1-r,2+r,0,-1,2,i);return(n||s)&&(a=D(t,1,-r,1+r,0,-1,2,i)||[],n&&(a=O(n,1).concat(a)),s&&(a=a.concat(O(s,-1)))),a}(a,i)).length&&this.splitTile(a,0,0,0),r&&(a.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(t,i,r,a,n,s,o){let l=[t,i,r,a],h=this.options,u=h.debug;for(;l.length;){a=l.pop(),r=l.pop(),i=l.pop(),t=l.pop();let c=1<<i,d=Z(i,r,a),p=this.tiles[d];if(!p&&(u>1&&console.time("creation"),p=this.tiles[d]=function(t,i,r,a,n){let s=i===n.maxZoom?0:n.tolerance/((1<<i)*n.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:r,y:a,z:i,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let i of t)!function(t,i,r,a){let n=i.geometry,s=i.type,o=[];if(t.minX=Math.min(t.minX,i.minX),t.minY=Math.min(t.minY,i.minY),t.maxX=Math.max(t.maxX,i.maxX),t.maxY=Math.max(t.maxY,i.maxY),"Point"===s||"MultiPoint"===s)for(let i=0;i<n.length;i+=3)o.push(n[i],n[i+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)U(o,n,t,r,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(let i=0;i<n.length;i++)U(o,n[i],t,r,"Polygon"===s,0===i);else if("MultiPolygon"===s)for(let i=0;i<n.length;i++){let a=n[i];for(let i=0;i<a.length;i++)U(o,a[i],t,r,!0,0===i)}if(o.length){let r=i.tags||null;if("LineString"===s&&a.lineMetrics){for(let t in r={},i.tags)r[t]=i.tags[t];r.mapbox_clip_start=n.start/n.size,r.mapbox_clip_end=n.end/n.size}let l={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:r};null!==i.id&&(l.id=i.id),t.features.push(l)}}(o,i,s,n);return o}(t,i,r,a,h),this.tileCoords.push({z:i,x:r,y:a}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",i,r,a,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let t=`z${i}`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(p.source=t,null==n){if(i===h.indexMaxZoom||p.numPoints<=h.indexMaxPoints)continue}else{if(i===h.maxZoom||i===n)continue;if(null!=n){let t=n-i;if(r!==s>>t||a!==o>>t)continue}}if(p.source=null,0===t.length)continue;u>1&&console.time("clipping");let f=.5*h.buffer/h.extent,m=.5-f,_=.5+f,g=1+f,y=null,x=null,v=null,b=null,w=D(t,c,r-f,r+_,0,p.minX,p.maxX,h),T=D(t,c,r+m,r+g,0,p.minX,p.maxX,h);t=null,w&&(y=D(w,c,a-f,a+_,1,p.minY,p.maxY,h),x=D(w,c,a+m,a+g,1,p.minY,p.maxY,h),w=null),T&&(v=D(T,c,a-f,a+_,1,p.minY,p.maxY,h),b=D(T,c,a+m,a+g,1,p.minY,p.maxY,h),T=null),u>1&&console.timeEnd("clipping"),l.push(y||[],i+1,2*r,2*a),l.push(x||[],i+1,2*r,2*a+1),l.push(v||[],i+1,2*r+1,2*a),l.push(b||[],i+1,2*r+1,2*a+1)}}getTile(t,i,r){t*=1,i*=1,r*=1;let{extent:a,debug:n}=this.options;if(t<0||t>24)return null;let s=1<<t,o=Z(t,i=i+s&s-1,r);if(this.tiles[o])return j(this.tiles[o],a);n>1&&console.log("drilling down to z%d-%d-%d",t,i,r);let l,h=t,u=i,c=r;for(;!l&&h>0;)h--,u>>=1,c>>=1,l=this.tiles[Z(h,u,c)];return l&&l.source?(n>1&&(console.log("found parent tile z%d-%d-%d",h,u,c),console.time("drilling down")),this.splitTile(l.source,h,u,c,t,i,r),n>1&&console.timeEnd("drilling down"),this.tiles[o]?j(this.tiles[o],a):null):null}}function Z(t,i,r){return 32*((1<<t)*r+i)+t}class $ extends u{constructor(t,i,r,a=W){super(t,i,r),this._dataUpdateable=new Map,this._createGeoJSONIndex=a}loadVectorTile(i,r){return t._(this,void 0,void 0,function*(){let r=i.tileID.canonical;if(!this._geoJSONIndex)throw Error("Unable to parse the data into a cluster or geojson");let a=this._geoJSONIndex.getTile(r.z,r.x,r.y);return a?h(new t.d2(a.features,{version:2,extent:t.a5})):null})}loadData(i){return t._(this,void 0,void 0,function*(){var r;null==(r=this._pendingRequest)||r.abort();let a=this._startPerformance(i);this._pendingRequest=new AbortController;try{(!this._pendingData||i.request||i.data||i.dataDiff)&&(this._pendingData=this.loadAndProcessGeoJSON(i,this._pendingRequest));let t=yield this._pendingData;this._geoJSONIndex=this._createGeoJSONIndex(t,i),this.loaded={};let r={};return i.request&&(r.data=t),this._finishPerformance(a,i,r),r}catch(i){if(delete this._pendingRequest,t.Z(i))return{abandoned:!0};throw i}})}_startPerformance(i){var r;if(null==(r=null==i?void 0:i.request)?void 0:r.collectResourceTiming)return new t.c_(i.request)}_finishPerformance(t,i,r){if(!t)return;let a=t.finish();a&&(r.resourceTiming={},r.resourceTiming[i.source]=JSON.parse(JSON.stringify(a)))}getData(){return t._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(t){let i=this.loaded;return i&&i[t.uid]?super.reloadTile(t):this.loadTile(t)}loadAndProcessGeoJSON(i,r){return t._(this,void 0,void 0,function*(){let t;if(i.request?t=yield this.loadGeoJSONFromUrl(i.request,i.promoteId,r):i.data?t=this._loadGeoJSONFromObject(i.data,i.promoteId):i.dataDiff&&(t=this._loadGeoJSONFromDiff(i.dataDiff,i.promoteId,i.source)),delete this._pendingRequest,"object"!=typeof t)throw Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`);return _(t,!0),i.filter&&(t=this._filterGeoJSON(t,i.filter)),t})}loadGeoJSONFromUrl(i,r,a){return t._(this,void 0,void 0,function*(){let n=yield t.j(i,a);return this._dataUpdateable=t.a7(n.data,r),n.data})}_loadGeoJSONFromObject(i,r){return this._dataUpdateable=t.a7(i,r),i}_loadGeoJSONFromDiff(i,r,a){if(!this._dataUpdateable)throw Error(`Cannot update existing geojson data in ${a}`);t.a8(this._dataUpdateable,i,r);let n=Array.from(this._dataUpdateable.values());return this._toFeatureCollection(n)}_filterGeoJSON(i,r){let a=t.d3(r,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===a.result)throw Error(a.value.map(t=>`${t.key}: ${t.message}`).join(", "));let n=i.features.filter(t=>a.value.evaluate({zoom:0},t));return this._toFeatureCollection(n)}_toFeatureCollection(t){return{type:"FeatureCollection",features:t}}removeSource(i){return t._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset)}}function W(i,r){return r.cluster?new x(function({superclusterOptions:i,clusterProperties:r}){if(!r||!i)return i;let a={},n={},s={accumulated:null,zoom:0},o={properties:null},l=Object.keys(r);for(let i of l){let[s,o]=r[i],l=t.d3(o),h=t.d3("string"==typeof s?[s,["accumulated"],["get",i]]:s);a[i]=l.value,n[i]=h.value}return i.map=t=>{o.properties=t;let i={};for(let t of l)i[t]=a[t].evaluate(s,o);return i},i.reduce=(t,i)=>{for(let r of(o.properties=i,l))s.accumulated=t[r],t[r]=n[r].evaluate(s,o)},i}(r)).load(i.features):new q(i,r.geojsonVtOptions)}class H{constructor(i){this.self=i,this.actor=new t.L(i),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={}
2,this.globalStates=new Map,this.self.registerWorkerSource=(t,i)=>{if(this.externalWorkerSourceTypes[t])throw Error(`Worker source with name "${t}" already registered.`);this.externalWorkerSourceTypes[t]=i},this.self.addProtocol=t.cJ,this.self.removeProtocol=t.cK,this.self.registerRTLTextPlugin=i=>{t.d4.setMethods(i)},this.actor.registerMessageHandler("LDT",(t,i)=>this._getDEMWorkerSource(t,i.source).loadTile(i)),this.actor.registerMessageHandler("RDT",(i,r)=>t._(this,void 0,void 0,function*(){this._getDEMWorkerSource(i,r.source).removeTile(r)})),this.actor.registerMessageHandler("GCEZ",(i,r)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(i,r.type,r.source).getClusterExpansionZoom(r)})),this.actor.registerMessageHandler("GCC",(i,r)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(i,r.type,r.source).getClusterChildren(r)})),this.actor.registerMessageHandler("GCL",(i,r)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(i,r.type,r.source).getClusterLeaves(r)})),this.actor.registerMessageHandler("LD",(t,i)=>this._getWorkerSource(t,i.type,i.source).loadData(i)),this.actor.registerMessageHandler("GD",(t,i)=>this._getWorkerSource(t,i.type,i.source).getData()),this.actor.registerMessageHandler("LT",(t,i)=>this._getWorkerSource(t,i.type,i.source).loadTile(i)),this.actor.registerMessageHandler("RT",(t,i)=>this._getWorkerSource(t,i.type,i.source).reloadTile(i)),this.actor.registerMessageHandler("AT",(t,i)=>this._getWorkerSource(t,i.type,i.source).abortTile(i)),this.actor.registerMessageHandler("RMT",(t,i)=>this._getWorkerSource(t,i.type,i.source).removeTile(i)),this.actor.registerMessageHandler("RS",(i,r)=>t._(this,void 0,void 0,function*(){if(!this.workerSources[i]||!this.workerSources[i][r.type]||!this.workerSources[i][r.type][r.source])return;let t=this.workerSources[i][r.type][r.source];delete this.workerSources[i][r.type][r.source],void 0!==t.removeSource&&t.removeSource(r)})),this.actor.registerMessageHandler("RM",i=>t._(this,void 0,void 0,function*(){delete this.layerIndexes[i],delete this.availableImages[i],delete this.workerSources[i],delete this.demWorkerSources[i],this.globalStates.delete(i)})),this.actor.registerMessageHandler("SR",(i,r)=>t._(this,void 0,void 0,function*(){this.referrer=r})),this.actor.registerMessageHandler("SRPS",(t,i)=>this._syncRTLPluginState(t,i)),this.actor.registerMessageHandler("IS",(i,r)=>t._(this,void 0,void 0,function*(){this.self.importScripts(r)})),this.actor.registerMessageHandler("SI",(t,i)=>this._setImages(t,i)),this.actor.registerMessageHandler("UL",(i,r)=>t._(this,void 0,void 0,function*(){this._getLayerIndex(i).update(r.layers,r.removedIds,this._getGlobalState(i))})),this.actor.registerMessageHandler("UGS",(i,r)=>t._(this,void 0,void 0,function*(){let t=this._getGlobalState(i);for(let i in r)t[i]=r[i]})),this.actor.registerMessageHandler("SL",(i,r)=>t._(this,void 0,void 0,function*(){this._getLayerIndex(i).replace(r,this._getGlobalState(i))}))}_getGlobalState(t){let i=this.globalStates.get(t);return i||(i={},this.globalStates.set(t,i)),i}_setImages(i,r){return t._(this,void 0,void 0,function*(){for(let t in this.availableImages[i]=r,this.workerSources[i]){let a=this.workerSources[i][t];for(let t in a)a[t].availableImages=r}})}_syncRTLPluginState(i,r){return t._(this,void 0,void 0,function*(){return yield t.d4.syncState(r,this.self.importScripts)})}_getAvailableImages(t){let i=this.availableImages[t];return i||(i=[]),i}_getLayerIndex(t){let r=this.layerIndexes[t];return r||(r=this.layerIndexes[t]=new i),r}_getWorkerSource(t,i,r){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][i]||(this.workerSources[t][i]={}),!this.workerSources[t][i][r]){let a={sendAsync:(i,r)=>(i.targetMapId=t,this.actor.sendAsync(i,r))};switch(i){case"vector":this.workerSources[t][i][r]=new u(a,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][i][r]=new $(a,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][i][r]=new this.externalWorkerSourceTypes[i](a,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][i][r]}_getDEMWorkerSource(t,i){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][i]||(this.demWorkerSources[t][i]=new c),this.demWorkerSources[t][i]}}return t.i(self)&&(self.worker=new H(self)),H}),r("index",["exports","./shared"],function(t,i){let r,a,n,s,o,l,h,u;var c,d,p,f,m,_="5.16.0";function g(){var t=new i.A(4);return i.A!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}let y={frame(t,r,a){let n=requestAnimationFrame(t=>{s(),r(t)}),{unsubscribe:s}=i.s(t.signal,"abort",()=>{s(),cancelAnimationFrame(n),a(new i.a(t.signal.reason))},!1)},frameAsync(t){return new Promise((i,r)=>{this.frame(t,i,r)})},getImageData(t,i=0){return this.getImageCanvasContext(t).getImageData(-i,-i,t.width+2*i,t.height+2*i)},getImageCanvasContext(t){let i=window.document.createElement("canvas"),r=i.getContext("2d",{willReadFrequently:!0});if(!r)throw Error("failed to create canvas 2d context");return i.width=t.width,i.height=t.height,r.drawImage(t,0,0,t.width,t.height),r},resolveURL:t=>(r||(r=document.createElement("a")),r.href=t,r.href),hardwareConcurrency:"u">typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return void 0!==n?n:!!matchMedia&&(null==a&&(a=matchMedia("(prefers-reduced-motion: reduce)")),a.matches)},set prefersReducedMotion(e){n=e}},x=new class{constructor(){this._realTime="u">typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),this._frozenAt=null}getCurrentTime(){return null!==this._frozenAt?this._frozenAt:this._realTime()}setNow(t){this._frozenAt=t}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function v(){return x.getCurrentTime()}class b{static testProp(t){if(!b.docStyle)return t[0];for(let i=0;i<t.length;i++)if(t[i]in b.docStyle)return t[i];return t[0]}static create(t,i,r){let a=window.document.createElement(t);return void 0!==i&&(a.className=i),r&&r.appendChild(a),a}static createNS(t,i){return window.document.createElementNS(t,i)}static disableDrag(){b.docStyle&&b.selectProp&&(b.userSelect=b.docStyle[b.selectProp],b.docStyle[b.selectProp]="none")}static enableDrag(){b.docStyle&&b.selectProp&&(b.docStyle[b.selectProp]=b.userSelect)}static setTransform(t,i){t.style[b.transformProp]=i}static addEventListener(t,i,r,a={}){t.addEventListener(i,r,"passive"in a?a:a.capture)}static removeEventListener(t,i,r,a={}){t.removeEventListener(i,r,"passive"in a?a:a.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",b.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",b.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",b.suppressClickInternal,!0)},0)}static getScale(t){let i=t.getBoundingClientRect();return{x:i.width/t.offsetWidth||1,y:i.height/t.offsetHeight||1,boundingClientRect:i}}
2static getPoint(t,r,a){let n=r.boundingClientRect;return new i.P((a.clientX-n.left)/r.x-t.clientLeft,(a.clientY-n.top)/r.y-t.clientTop)}static mousePos(t,i){let r=b.getScale(t);return b.getPoint(t,r,i)}static touchPos(t,i){let r=[],a=b.getScale(t);for(let n=0;n<i.length;n++)r.push(b.getPoint(t,a,i[n]));return r}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}static sanitize(t){let i=(new DOMParser).parseFromString(t,"text/html").body||document.createElement("body");for(let t of i.querySelectorAll("script"))t.remove();return b.clean(i),i.innerHTML}static isPossiblyDangerous(t,i){let r=i.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!r.includes("javascript:")&&!r.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){for(let i of t.children)b.removeAttributes(i),b.clean(i)}static removeAttributes(t){for(let{name:i,value:r}of t.attributes)b.isPossiblyDangerous(i,r)&&t.removeAttribute(i)}}b.docStyle="u">typeof window&&window.document&&window.document.documentElement.style,b.selectProp=b.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),b.transformProp=b.testProp(["transform","WebkitTransform"]);let w={supported:!1,testSupport:function(t){!P&&S&&(M?I(t):T=t)}},T,S,P=!1,M=!1;function I(t){let i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,S),t.isContextLost())return;w.supported=!0}
2catch(t){}t.deleteTexture(i),P=!0}"u">typeof document&&((S=document.createElement("img")).onload=()=>{T&&I(T),T=null,M=!0},S.onerror=()=>{P=!0,T=null},S.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(t){let r,a,n,s;t.resetRequestQueue=()=>{r=[],a=0,n=0,s={}},t.addThrottleControl=t=>{let i=n++;return s[i]=t,i},t.removeThrottleControl=t=>{delete s[t],l()},t.getImage=(t,a,n=!0)=>new Promise((s,o)=>{w.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),i.e(t,{type:"image"}),r.push({abortController:a,requestParameters:t,supportImageRefresh:n,state:"queued",onError:t=>{o(t)},onSuccess:t=>{s(t)}}),l()});let o=t=>i._(this,void 0,void 0,function*(){var r;t.state="running";let{requestParameters:n,supportImageRefresh:s,onError:o,onSuccess:u,abortController:c}=t,d=!1===s&&!i.i(self)&&!i.g(n.url)&&(!n.headers||Object.keys(n.headers).reduce((t,i)=>t&&"accept"===i,!0));a++;let p=d?h(n,c):i.m(n,c);try{let a=yield p;delete t.abortController,t.state="completed",a.data instanceof HTMLImageElement||i.b(a.data)?u(a):a.data&&u({data:yield(r=a.data,"function"==typeof createImageBitmap?i.f(r):i.h(r)),cacheControl:a.cacheControl,expires:a.expires})}catch(i){delete t.abortController,o(i)}finally{a--,l()}}),l=()=>{let t=(()=>{for(let t of Object.keys(s))if(s[t]())return!0;return!1})()?i.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:i.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let i=a;i<t&&r.length>0;i++){let t=r.shift();t.abortController.signal.aborted?i--:o(t)}},h=(t,r)=>new Promise((a,n)=>{let s=new Image,o=t.url,l=t.credentials;l&&"include"===l?s.crossOrigin="use-credentials":(l&&"same-origin"===l||!i.d(o))&&(s.crossOrigin="anonymous"),r.signal.addEventListener("abort",()=>{s.src="",n(new i.a(r.signal.reason))}),s.fetchPriority="high",s.onload=()=>{s.onerror=s.onload=null,a({data:s})},s.onerror=()=>{s.onerror=s.onload=null,r.signal.aborted||n(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."))},s.src=o})}(p||(p={})),p.resetRequestQueue();class E{constructor(t){this._transformRequestFn=null!=t?t:null}transformRequest(t,i){return this._transformRequestFn&&this._transformRequestFn(t,i)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function C(t){let i=[];if("string"==typeof t)i.push({id:"default",url:t});else if(t&&t.length>0){let r=[];for(let{id:a,url:n}of t){let t=`${a}${n}`;-1===r.indexOf(t)&&(r.push(t),i.push({id:a,url:n}))}}return i}function A(t,i,r){try{let a=new URL(t);return a.pathname+=`${i}${r}`,a.toString()}catch(i){throw Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class D extends i.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.R({width:1,height:1}),this.dirty=!0}destroy(){for(let t of(this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null),Object.keys(this.images)))this.removeImage(t);this.patterns={},this.atlasImage=new i.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(let{ids:t,promiseResolve:i}of this.requestors)i(this._getImagesForIds(t));this.requestors=[]}}getImage(t){let r=this.images[t];if(r&&!r.data&&r.spriteData){let t=r.spriteData;r.data=new i.R({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),r.spriteData=null}return r}addImage(t,i){if(this.images[t])throw Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,i)&&(this.images[t]=i)}_validate(t,r){let a=!0,n=r.data||r.spriteData;return this._validateStretch(r.stretchX,n&&n.width)||(this.fire(new i.k(Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(r.stretchY,n&&n.height)||(this.fire(new i.k(Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(r.content,r)||(this.fire(new i.k(Error(`Image "${t}
2" has invalid "content" value`))),a=!1),a}_validateStretch(t,i){if(!t)return!0;let r=0;for(let a of t){if(a[0]<r||a[1]<a[0]||i<a[1])return!1;r=a[1]}return!0}_validateContent(t,i){if(!t)return!0;if(4!==t.length)return!1;let r=i.spriteData,a=r&&r.width||i.data.width,n=r&&r.height||i.data.height;return!(t[0]<0||a<t[0]||t[1]<0||n<t[1]||t[2]<0||a<t[2]||t[3]<0||n<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,i,r=!0){let a=this.getImage(t);if(r&&(a.data.width!==i.data.width||a.data.height!==i.data.height))throw Error(`size mismatch between old image (${a.data.width}x${a.data.height}) and new image (${i.data.width}x${i.data.height}).`);i.version=a.version+1,this.images[t]=i,this.updatedImages[t]=!0}removeImage(t){let i=this.images[t];delete this.images[t],delete this.patterns[t],i.userImage&&i.userImage.onRemove&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise((i,r)=>{let a=!0;if(!this.isLoaded())for(let i of t)this.images[i]||(a=!1);this.isLoaded()||a?i(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:i})})}_getImagesForIds(t){let r={};for(let a of t){let t=this.getImage(a);t||(this.fire(new i.l("styleimagemissing",{id:a})),t=this.getImage(a)),t?r[a]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:!!(t.userImage&&t.userImage.render)}:i.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 r}getPixelSize(){let{width:t,height:i}=this.atlasImage;return{width:t,height:i}}getPattern(t){let r=this.patterns[t],a=this.getImage(t);if(!a)return null;if(r&&r.position.version===a.version)return r.position;if(r)r.position.version=a.version;else{let r={w:a.data.width+2,h:a.data.height+2,x:0,y:0},n=new i.I(r,a);this.patterns[t]={bin:r,position:n}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){let r=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new i.T(t,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(){let t=[];for(let i in this.patterns)t.push(this.patterns[i].bin);let{w:r,h:a}=i.p(t),n=this.atlasImage;for(let t in n.resize({width:r||1,height:a||1}),this.patterns){let{bin:r}=this.patterns[t],a=r.x+1,s=r.y+1,o=this.getImage(t).data,l=o.width,h=o.height;i.R.copy(o,n,{x:0,y:0},{x:a,y:s},{width:l,height:h}),i.R.copy(o,n,{x:0,y:h-1},{x:a,y:s-1},{width:l,height:1}),i.R.copy(o,n,{x:0,y:0},{x:a,y:s+h},{width:l,height:1}),i.R.copy(o,n,{x:l-1,y:0},{x:a-1,y:s},{width:1,height:h}),i.R.copy(o,n,{x:0,y:0},{x:a+l,y:s},{width:1,height:h})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(let r of t){if(this.callbackDispatchedThisFrame[r])continue;this.callbackDispatchedThisFrame[r]=!0;let t=this.getImage(r);t||i.w(`Image with ID: "${r}" was not found`),function(t){let{userImage:i}=t;return!!(i&&i.render&&i.render())&&(t.data.replace(new Uint8Array(i.data.buffer)),!0)}(t)&&this.updateImage(r,t)}}cloneImages(){let t={};for(let i in this.images){let r=this.images[i];t[i]=Object.assign(Object.assign({},r),{data:r.data?r.data.clone():null})}return t}}function z(t,i,r,a,n,s,o,l,h){for(let u=i;u<i+a;u++)k(t,r*s+u,s,n,o,l,h);for(let u=r;u<r+n;u++)k(t,u*s+i,1,a,o,l,h)}function k(t,i,r,a,n,s,o){s[0]=0,o[0]=-1e20,o[1]=1e20,n[0]=t[i];for(let l=1,h=0,u=0;l<a;l++){n[l]=t[i+l*r];let a=l*l;do{let t=s[h];u=(n[l]-n[t]+a-t*t)/(l-t)/2}while(u<=o[h]&&--h>-1);s[++h]=l,o[h]=u,o[h+1]=1e20}for(let l=0,h=0;l<a;l++){for(;o[h+1]<l;)h++;let a=s[h],u=l-a;t[i+l*r]=n[a]+u*u}}let R=i.v.layout_symbol["text-font"].default.join(",");class L{constructor(t,i,r){this.requestManager=t,this.localIdeographFontFamily=i,this.entries={},this.lang=r}setURL(t){this.url=t}getGlyphs(t){return i._(this,void 0,void 0,function*(){let i=[];for(let r in t)for(let a of t[r])i.push(this._getAndCacheGlyphsPromise(r,a));let r=yield Promise.all(i),a={};for(let{stack:t,id:i,glyph:n}of r)a[t]||(a[t]={}),a[t][i]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};return a})}_getAndCacheGlyphsPromise(t,r){return i._(this,void 0,void 0,function*(){let i=this.entries[t];
2i||(i=this.entries[t]={glyphs:{},requests:{},ranges:{}});let a=i.glyphs[r];return void 0!==a?{stack:t,id:r,glyph:a}:!this.url||this._charUsesLocalIdeographFontFamily(r)?(a=i.glyphs[r]=this._drawGlyph(i,t,r),{stack:t,id:r,glyph:a}):yield this._downloadAndCacheRangePromise(t,r)})}_downloadAndCacheRangePromise(t,r){return i._(this,void 0,void 0,function*(){let i=this.entries[t],a=Math.floor(r/256);if(i.ranges[a])return{stack:t,id:r,glyph:null};if(!i.requests[a]){let r=L.loadGlyphRange(t,a,this.url,this.requestManager);i.requests[a]=r}try{let n=yield i.requests[a];for(let t in n)i.glyphs[+t]=n[+t];return i.ranges[a]=!0,{stack:t,id:r,glyph:n[r]||null}}catch(s){let n=i.glyphs[r]=this._drawGlyph(i,t,r);return this._warnOnMissingGlyphRange(n,a,r,s),{stack:t,id:r,glyph:n}}})}_warnOnMissingGlyphRange(t,r,a,n){let s=256*r,o=a.toString(16).padStart(4,"0").toUpperCase();i.w(`Unable to load glyph range ${r}, ${s}-${s+255}. Rendering codepoint U+${o} locally instead. ${n}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&i.q(t)}_drawGlyph(t,r,a){let n=r===R&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(a),s=n?"ideographTinySDF":"tinySDF";t[s]||(t[s]=this._createTinySDF(n?this.localIdeographFontFamily:r));let o=t[s].draw(String.fromCodePoint(a)),l=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(a));return{id:a,bitmap:new i.r({width:o.width||60,height:o.height||60},o.data),metrics:{width:l?0:o.glyphWidth/2||24,height:o.glyphHeight/2||24,left:o.glyphLeft/2+.5||0,top:o.glyphTop/2-27.5||-8,advance:l?0:o.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){let i=t?t.split(","):[];i.push("sans-serif");let r=i.map(t=>/[-\w]+/.test(t)?t:`'${CSS.escape(t)}'`).join(",");return new L.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:r,fontWeight:this._fontWeight(i[0]),fontStyle:this._fontStyle(i[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){let i;for(let[r,a]of Object.entries({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}))RegExp(`\\b${r}\\b`,"i").test(t)&&(i=`${a}`);return i}destroy(){for(let t in this.entries){let i=this.entries[t];
2i.tinySDF&&(i.tinySDF=null),i.ideographTinySDF&&(i.ideographTinySDF=null),i.glyphs={},i.requests={},i.ranges={}}this.entries={}}}L.loadGlyphRange=function(t,r,a,n){return i._(this,void 0,void 0,function*(){let s=256*r,o=s+255,l=n.transformRequest(a.replace("{fontstack}",t).replace("{range}",`${s}-${o}`),"Glyphs"),h=yield i.n(l,new AbortController);if(!h||!h.data)throw Error(`Could not load glyph range. range: ${r}, ${s}-${o}`);let u={};for(let t of i.o(h.data))u[t.id]=t;return u})},L.TinySDF=class{constructor({fontSize:t=24,buffer:i=3,radius:r=8,cutoff:a=.25,fontFamily:n="sans-serif",fontWeight:s="normal",fontStyle:o="normal",lang:l=null}={}){this.buffer=i,this.cutoff=a,this.radius=r,this.lang=l;const h=this.size=t+4*i,u=this._createCanvas(h),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${o} ${s} ${t}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(h*h),this.gridInner=new Float64Array(h*h),this.f=new Float64Array(h),this.z=new Float64Array(h+1),this.v=new Uint16Array(h)}_createCanvas(t){let i=document.createElement("canvas");return i.width=i.height=t,i}draw(t){let{width:i,actualBoundingBoxAscent:r,actualBoundingBoxDescent:a,actualBoundingBoxLeft:n,actualBoundingBoxRight:s}=this.ctx.measureText(t),o=Math.ceil(r),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-n))),h=Math.min(this.size-this.buffer,o+Math.ceil(a)),u=l+2*this.buffer,c=h+2*this.buffer,d=Math.max(u*c,0),p=new Uint8ClampedArray(d),f={data:p,width:u,height:c,glyphWidth:l,glyphHeight:h,glyphTop:o,glyphLeft:0,glyphAdvance:i};if(0===l||0===h)return f;let{ctx:m,buffer:_,gridInner:g,gridOuter:y}=this;this.lang&&(m.lang=this.lang),m.clearRect(_,_,l,h),m.fillText(t,_,_+o);let x=m.getImageData(_,_,l,h);y.fill(1e20,0,d),g.fill(0,0,d);for(let t=0;t<h;t++)for(let i=0;i<l;i++){let r=x.data[4*(t*l+i)+3]/255;if(0===r)continue;let a=(t+_)*u+i+_;if(1===r)y[a]=0,g[a]=1e20;else{let t=.5-r;y[a]=t>0?t*t:0,g[a]=t<0?t*t:0}}z(y,0,0,u,c,u,this.f,this.v,this.z),z(g,_,_,l,h,u,this.f,this.v,this.z);for(let t=0;t<d;t++){let i=Math.sqrt(y[t])-Math.sqrt(g[t]);p[t]=Math.round(255-255*(i/this.radius+this.cutoff))}return f}};class F{constructor(){this.specification=i.u.light.position}possiblyEvaluate(t,r){return i.F(t.expression.evaluate(r))}interpolate(t,r,a){return{x:i.G.number(t.x,r.x,a),y:i.G.number(t.y,r.y,a),z:i.G.number(t.z,r.z,a)}}}class B extends i.E{constructor(t){super(),s=s||new i.t({anchor:new i.D(i.u.light.anchor),position:new F,color:new i.D(i.u.light.color),intensity:new i.D(i.u.light.intensity)}),this._transitionable=new i.x(s,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,r={}){if(!this._validate(i.y,t,r))for(let r in t){let a=t[r];r.endsWith(i.z)?this._transitionable.setTransition(r.slice(0,-i.z.length),a):this._transitionable.setValue(r,a)}}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,r,a){return(!a||!1!==a.validate)&&i.B(this,t.call(i.C,{value:r,style:{glyphs:!0,sprite:!0},styleSpec:i.u}))}}let O=new i.t({"sky-color":new i.D(i.u.sky["sky-color"]),"horizon-color":new i.D(i.u.sky["horizon-color"]),"fog-color":new i.D(i.u.sky["fog-color"]),"fog-ground-blend":new i.D(i.u.sky["fog-ground-blend"]),"horizon-fog-blend":new i.D(i.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new i.D(i.u.sky["sky-horizon-blend"]),"atmosphere-blend":new i.D(i.u.sky["atmosphere-blend"])});class V extends i.E{constructor(t){super(),this._transitionable=new i.x(O,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new i.H(0))}setSky(t,r={}){if(!this._validate(i.J,t,r))for(let r in t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0}),t){let a=t[r];r.endsWith(i.z)?this._transitionable.setTransition(r.slice(0,-i.z.length),a):this._transitionable.setValue(r,a)}}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,r,a={}){return!1!==(null==a?void 0:a.validate)&&i.B(this,t.call(i.C,i.e({value:r,style:{glyphs:!0,sprite:!0},styleSpec:i.u})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class j{constructor(t,i){this.width=t,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,i){let r=t.join(",")+String(i);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(t,i)),this.dashEntry[r]}getDashRanges(t,i,r){let a=[],n=t.length%2==1?-t[t.length-1]*r:0,s=t[0]*r,o=!0;a.push({left:n,right:s,isDash:o,zeroLength:0===t[0]});let l=t[0];for(let i=1;i<t.length;i++){o=!o;let h=t[i];n=l*r,l+=h,s=l*r,a.push({left:n,right:s,isDash:o,zeroLength:0===
2h})}return a}addRoundDash(t,i,r){let a=i/2;for(let i=-r;i<=r;i++){let n=this.width*(this.nextRow+r+i),s=0,o=t[0];for(let l=0;l<this.width;l++){let h;l/o.right>1&&(o=t[++s]);let u=Math.min(Math.abs(l-o.left),Math.abs(l-o.right)),c=i/r*(a+1);if(o.isDash){let t=a-Math.abs(c);h=Math.sqrt(u*u+t*t)}else h=a-Math.sqrt(u*u+c*c);this.data[n+l]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t){for(let i=t.length-1;i>=0;--i){let r=t[i],a=t[i+1];r.zeroLength?t.splice(i,1):a&&a.isDash===r.isDash&&(a.left=r.left,t.splice(i,1))}let i=t[0],r=t[t.length-1];i.isDash===r.isDash&&(i.left=r.left-this.width,r.right=i.right+this.width);let a=this.width*this.nextRow,n=0,s=t[0];for(let i=0;i<this.width;i++){i/s.right>1&&(s=t[++n]);let r=Math.min(Math.abs(i-s.left),Math.abs(i-s.right));this.data[a+i]=Math.max(0,Math.min(255,(s.isDash?r:-r)+128))}}addDash(t,r){let a=7*!!r,n=2*a+1;if(this.nextRow+n>this.height)return i.w("LineAtlas out of space"),null;let s=0;for(let i=0;i<t.length;i++)s+=t[i];if(0!==s){let i=this.width/s,n=this.getDashRanges(t,this.width,i);r?this.addRoundDash(n,i,a):this.addRegularDash(n)}let o={y:this.nextRow+a,height:2*a,width:s};return this.nextRow+=n,this.dirty=!0,o}bind(t){let i=t.gl;this.texture?(i.bindTexture(i.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.width,this.height,i.ALPHA,i.UNSIGNED_BYTE,this.data))):(this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.ALPHA,this.width,this.height,0,i.ALPHA,i.UNSIGNED_BYTE,this.data))}}let N="maplibre_preloaded_worker_pool";class U{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<U.workerCount;)this.workers.push(new Worker(i.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach(t=>{t.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[N]}numActive(){return Object.keys(this.active).length}}let G=Math.floor(y.hardwareConcurrency/2);function q(){return o||(o=new U),o}U.workerCount=i.K(globalThis)?Math.max(Math.min(G,3),1):1;class Z{constructor(t,r){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=r;const a=this.workerPool.acquire(r);for(let t=0;t<a.length;t++){const n=new i.L(a[t],r);n.name=`Worker ${t}`,this.actors.push(n)}if(!this.actors.length)throw Error("No actors found")}broadcast(t,i){let r=[];for(let a of this.actors)r.push(a.sendAsync({type:t,data:i}));return Promise.all(r)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(t=>{t.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,i){for(let r of this.actors)r.registerMessageHandler(t,i)}unregisterMessageHandler(t){for(let i of this.actors)i.unregisterMessageHandler(t)}}function $(){return l||(l=new Z(q(),i.M)).registerMessageHandler("GR",(t,r,a)=>i.m(r,a)),l}function W(t,i){let r=t.tileID,a=i.tileID;return r.overscaledZ-a.overscaledZ||r.canonical.y-a.canonical.y||r.wrap-a.wrap||r.canonical.x-a.canonical.x}function H(t,i){let r=t.feature,a=i.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=a}function X(t,r,a){return i._(this,void 0,void 0,function*(){let n=t;if(t.url?n=(yield i.j(r.transformRequest(t.url,"Source"),a)).data:yield y.frameAsync(a),!n)return null;let s=i.U(i.e(n,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(s.vectorLayerIds=n.vector_layers.map(t=>t.id)),s})}class Y{constructor(t,i){t&&(i?this.setSouthWest(t).setNorthEast(i):Array.isArray(t)&&(4===t.length?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 i.V?new i.V(t.lng,t.lat):i.V.convert(t),this}
2setSouthWest(t){return this._sw=t instanceof i.V?new i.V(t.lng,t.lat):i.V.convert(t),this}extend(t){let r,a,n=this._sw,s=this._ne;if(t instanceof i.V)r=t,a=t;else{if(!(t instanceof Y))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Y.convert(t)):this.extend(i.V.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(i.V.convert(t)):this;if(r=t._sw,a=t._ne,!r||!a)return this}return n||s?(n.lng=Math.min(r.lng,n.lng),n.lat=Math.min(r.lat,n.lat),s.lng=Math.max(a.lng,s.lng),s.lat=Math.max(a.lat,s.lat)):(this._sw=new i.V(r.lng,r.lat),this._ne=new i.V(a.lng,a.lat)),this}getCenter(){return new i.V((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new i.V(this.getWest(),this.getNorth())}getSouthEast(){return new i.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){let{lng:r,lat:a}=i.V.convert(t),n=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&n}intersects(t){if(!((t=Y.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let r=Math.abs(this.getEast()-this.getWest()),a=Math.abs(t.getEast()-t.getWest());if(r>=360||a>=360)return!0;let n=i.W(this.getWest(),-180,180),s=i.W(this.getEast(),-180,180),o=i.W(t.getWest(),-180,180),l=i.W(t.getEast(),-180,180),h=n>=s,u=o>=l;return!(!h||!u)||(h?l>=n||o<=s:u?s>=o||n<=l:o<=s&&l>=n)}static convert(t){return t instanceof Y?t:t?new Y(t):t}static fromLngLat(t,r=0){let a=360*r/0x2637f09,n=a/Math.cos(Math.PI/180*t.lat);return new Y(new i.V(t.lng-n,t.lat-a),new i.V(t.lng+n,t.lat+a))}adjustAntiMeridian(){let t=new i.V(this._sw.lng,this._sw.lat),r=new i.V(this._ne.lng,this._ne.lat);return new Y(t,t.lng>r.lng?new i.V(r.lng+360,r.lat):r)}}class K{constructor(t,i,r){this.bounds=Y.convert(this.validateBounds(t)),this.minzoom=i||0,this.maxzoom=r||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[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){let r=Math.pow(2,t.z),a=Math.floor(i.Y(this.bounds.getWest())*r),n=Math.floor(i.X(this.bounds.getNorth())*r),s=Math.ceil(i.Y(this.bounds.getEast())*r),o=Math.ceil(i.X(this.bounds.getSouth())*r);return t.x>=a&&t.x<s&&t.y>=n&&t.y<o}}class J extends i.E{constructor(t,r,a,n){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,i.e(this,i.U(r,["url","scheme","tileSize","promoteId","encoding"])),this._options=i.e({type:"vector"},r),this._collectResourceTiming=r.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}load(){return i._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new i.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let t=yield X(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.tileManagers[this.id].clearTiles(),t&&(i.e(this,t),t.bounds&&(this.tileBounds=new K(t.bounds,this.minzoom,this.maxzoom)),this.fire(new i.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.l("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,i.Z(t)||this.fire(new i.k(t))}})}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()}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 i.e({},this._options)}
2loadTile(t){return i._(this,void 0,void 0,function*(){let i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(i,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:this._getOverzoomParameters(t)};r.request.collectResourceTiming=this._collectResourceTiming;let a="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise((i,r)=>{t.reloadPromise={resolve:i,reject:r}})}else t.actor=this.dispatcher.getActor(),a="LT";t.abortController=new AbortController;try{let i=yield t.actor.sendAsync({type:a,data:r},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,i)}catch(i){if(delete t.abortController,t.aborted)return;if(i&&404!==i.status)throw i;this._afterTileLoadWorkerResponse(t,null)}})}_getOverzoomParameters(t){if(t.tileID.canonical.z<=this.maxzoom||void 0===this.map._zoomLevelsToOverscale)return;let i=t.tileID.scaledTo(this.maxzoom).canonical,r=i.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:i,overzoomRequest:this.map._requestManager.transformRequest(r,"Tile")}}_afterTileLoadWorkerResponse(t,i){if(i&&i.resourceTiming&&(t.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&t.setExpiryData(i),t.loadVectorData(i,this.map.painter),t.reloadPromise){let i=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(i.resolve).catch(i.reject)}}abortTile(t){return i._(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 i._(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 Q extends i.E{constructor(t,r,a,n){super(),this.id=t,this.dispatcher=a,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=i.e({type:"raster"},r),i.e(this,i.U(r,["url","scheme","tileSize"]))}load(){return i._(this,arguments,void 0,function*(t=!1){this._loaded=!1,this.fire(new i.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let r=yield X(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,r&&(i.e(this,r),r.bounds&&(this.tileBounds=new K(r.bounds,this.minzoom,this.maxzoom)),this.fire(new i.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,i.Z(t)||this.fire(new i.k(t))}})}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 i.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return i._(this,void 0,void 0,function*(){let r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{let a=yield p.getImage(this.map._requestManager.transformRequest(r,"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});let r=this.map.painter.context,n=r.gl,s=a.data;t.texture=this.map.painter.getTileTexture(s.width),t.texture?t.texture.update(s,{useMipmap:!0}):(t.texture=new i.T(r,s,n.RGBA,{useMipmap:!0}),t.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(i){if(delete t.abortController,t.aborted)t.state="unloaded";else if(i)throw t.state="errored",i}})}abortTile(t){return i._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return i._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class ee extends Q{constructor(t,r,a,n){super(t,r,a,n),this.type="raster-dem",this.maxzoom=22,this._options=i.e({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox",this.redFactor=r.redFactor,this.greenFactor=r.greenFactor,this.blueFactor=r.blueFactor,this.baseShift=r.baseShift}loadTile(t){return i._(this,void 0,void 0,function*(){let r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=this.map._requestManager.transformRequest(r,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{let r=yield p.getImage(a,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(r&&r.data){let a=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&t.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let n=i.b(a)&&i.$()?a:yield this.readImageNow(a),s={type:this.type,uid:t.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||"expired"===t.state){t.actor=this.dispatcher.getActor();let i=yield t.actor.sendAsync({type:"LDT",data:s});t.dem=i,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}
2catch(i){if(delete t.abortController,t.aborted)t.state="unloaded";else if(i)throw t.state="errored",i}})}readImageNow(t){return i._(this,void 0,void 0,function*(){if("u">typeof VideoFrame&&i.a0()){let r=t.width+2,a=t.height+2;try{return new i.R({width:r,height:a},(yield i.a1(t,-1,-1,r,a)))}catch(t){}}return y.getImageData(t,1)})}_getNeighboringTiles(t){let r=t.canonical,a=Math.pow(2,r.z),n=(r.x-1+a)%a,s=0===r.x?t.wrap-1:t.wrap,o=(r.x+1+a)%a,l=r.x+1===a?t.wrap+1:t.wrap,h={};return h[new i.a2(t.overscaledZ,s,r.z,n,r.y).key]={backfilled:!1},h[new i.a2(t.overscaledZ,l,r.z,o,r.y).key]={backfilled:!1},r.y>0&&(h[new i.a2(t.overscaledZ,s,r.z,n,r.y-1).key]={backfilled:!1},h[new i.a2(t.overscaledZ,t.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},h[new i.a2(t.overscaledZ,l,r.z,o,r.y-1).key]={backfilled:!1}),r.y+1<a&&(h[new i.a2(t.overscaledZ,s,r.z,n,r.y+1).key]={backfilled:!1},h[new i.a2(t.overscaledZ,t.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},h[new i.a2(t.overscaledZ,l,r.z,o,r.y+1).key]={backfilled:!1}),h}unloadTile(t){return i._(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 et(t){return"GeometryCollection"===t.type?t.geometries.map(t=>t.coordinates).flat(1/0):t.coordinates.flat(1/0)}function ei(t){let i,r=new Y;switch(t.type){case"FeatureCollection":i=t.features.map(t=>et(t.geometry)).flat(1/0);break;case"Feature":i=et(t.geometry);break;default:i=et(t)}if(0==i.length)return r;for(let t=0;t<i.length-1;t+=2)r.extend([i[t],i[t+1]]);return r}class er extends i.E{constructor(t,r,a,n){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:r.data},this.actor=a.getActor(),this.setEventedParent(n),this._data="string"==typeof r.data?{url:r.data}:{geojson:r.data},this._options=i.e({},r),this._collectResourceTiming=r.collectResourceTiming,void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId,void 0!==r.clusterMaxZoom&&this.maxzoom<=r.clusterMaxZoom&&i.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${r.clusterMaxZoom}".`),this.workerOptions=i.e({source:this.id,cluster:r.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==r.buffer?r.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==r.tolerance?r.tolerance:.375),extent:i.a5,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(r.clusterMaxZoom),minPoints:Math.max(2,r.clusterMinPoints||2),extent:i.a5,radius:this._pixelsToTileUnits(r.clusterRadius||50),log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.optionsChanged}_pixelsToTileUnits(t){return t*(i.a5/this.tileSize)}_getClusterMaxZoom(t){let r=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||void 0===t||i.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${r}"`),r}load(){return i._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(t){this.map=t,this.load()}setData(t,i){this._data="string"==typeof t?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};let r=this._updateWorkerData();return i?r:this}updateData(t,r){this._pendingWorkerUpdate.diff=i.a6(this._pendingWorkerUpdate.diff,t);let a=this._updateWorkerData();return r?a:this}getData(){return i._(this,void 0,void 0,function*(){let t=i.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})})}getBounds(){return i._(this,void 0,void 0,function*(){return ei((yield this.getData()))})}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,void 0!==t.clusterRadius&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),void 0!==t.clusterMa
2xZoom&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.optionsChanged=!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,i,r){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:i,offset:r}})}_updateWorkerData(){return i._(this,void 0,void 0,function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void i.w(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:t,diff:r}=this._pendingWorkerUpdate,a=i.e({type:this.type},this.workerOptions);void 0!==t?("string"==typeof t?(a.request=this.map._requestManager.transformRequest(y.resolveURL(t),"Source"),a.request.collectResourceTiming=this._collectResourceTiming):a.data=t,this._pendingWorkerUpd
2ate.data=void 0):r&&(a.dataDiff=r,this._pendingWorkerUpdate.diff=void 0),this._pendingWorkerUpdate.optionsChanged=void 0,this._isUpdatingWorker=!0,this.fire(new i.l("dataloading",{dataType:"source"}));try{let t=yield this.actor.sendAsync({type:"LD",data:a});if(this._isUpdatingWorker=!1,this._removed||t.abandoned)return void this.fire(new i.l("dataabort",{dataType:"source"}));t.data&&(this._data={geojson:t.data});let n=this._applyDiffToSource(r),s=this._getShouldReloadTileOptions(n),o=null;t.resourceTiming&&t.resourceTiming[this.id]&&(o=t.resourceTiming[this.id].slice(0));let l={dataType:"source"};this._collectResourceTiming&&o&&o.length>0&&i.e(l,{resourceTiming:o}),this.fire(new i.l("data",Object.assign(Object.assign({},l),{sourceDataType:"metadata"}))),this.fire(new i.l("data",Object.assign(Object.assign({},l),{sourceDataType:"content",shouldReloadTileOptions:s})))}catch(t){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new i.l("dataabort",{dataType:"source"}));this.fire(new i.k(t))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}})}_applyDiffToSource(t){if(!t)return;let r="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let t=i.a7(this._data.geojson,r);if(!t)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:t}}if(!this._data.updateable)return;let a=i.a8(this._data.updateable,t,r);return t.removeAll||this._options.cluster?void 0:a}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map(t=>ei(t))}}shouldReloadTile(t,{affectedBounds:r}){if("loading"===t.state)return!0;if("unloaded"===t.state)return!1;let{buffer:a,extent:n}=this.workerOptions.geojsonVtOptions,s=function({x:t,y:r,z:a},n=0){return new Y([i.a3((t-n)/Math.pow(2,a)),i.a4((r+1+n)/Math.pow(2,a))],[i.a3((t+1+n)/Math.pow(2,a)),i.a4((r-n)/Math.pow(2,a))])}(t.tileID.canonical,a/n);for(let t of r)if(s.intersects(t))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return i._(this,void 0,void 0,function*(){let i=t.actor?"RT":"LT";t.actor=this.actor;let r={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;let a=yield this.actor.sendAsync({type:i,data:r},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(a,this.map.painter,"RT"===i)})}abortTile(t){return i._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return i._(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 i.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 ea extends i.E{constructor(t,i,r,a){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=r,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=i}load(t){return i._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new i.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let i=yield p.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,i&&i.data&&(this.image=i.data,t&&(this.coordinates=t),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,i.Z(t)||this.fire(new i.k(t))}})}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}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){var r;let a,n,s;this.coordinates=t;let o=t.map(i.a9.fromLngLat);return this.tileID=(s=Math.pow(2,n=Math.max(0,Math.floor(-Math.log(Math.max((a=i.aa.fromPoints(o)).width(),a.height()))/Math.LN2))),new i.ac(n,Math.floor((a.minX+a.maxX)/2*s),Math.floor((a.minY+a.maxY)/2*s))),this.terrainTileRanges=this._getOverlappingTileRanges(o),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=o.map(t=>this.tileID.getTilePoint(t)._round()),this.flippedWindingOrder=((r=this.tileCoords)[1].x-r[0].x)*(r[2].y-r[0].y)-(r[1].y-r[0].y)*(r[2].x-r[0].x)<0,this.fire(new i.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let t=this.map.painter.context,r=t.gl;this.texture||(this.texture=new i.T(t,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let a=!1;for(let t in this.tiles){let i=this.tiles[t];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture,a=!0)}a&&this.fire(new i.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return i._(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){let{minX:r,minY:a,maxX:n,maxY:s}=i.aa.fromPoints(t),o={};for(let t=0;t<=i.ab;t++){let i=Math.pow(2,t),l=Math.floor(r*i),h=Math.floor(a*i),u=Math.floor(n*i),c=Math.floor(s*i),d=(l%i+i)%i,p=u%i,f=Math.floor(l/i),m=Math.floor(u/i);o[t]={minWrap:f,maxWrap:m,minTileXWrapped:d,maxTileXWrapped:p,minTileY:h,maxTileY:c}}return o}}class en extends ea{constructor(t,i,r,a){super(t,i,r,a),this.roundZoom=!0,this.type="video",this.options=i}load(){return i._(this,void 0,void 0,function*(){this._loaded=!1;let t=this.options;for(let i of(this.urls=[],t.urls))this.urls.push(this.map._requestManager.transformRequest(i,"Source").url);try{let t=yield i.ad(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new i.k(t))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){let r=this.video.seekable;t<r.start(0)||t>r.end(0)?this.fire(new i.k(new i.ae(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}
2onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let t=this.map.painter.context,r=t.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new i.T(t,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let a=!1;for(let t in this.tiles){let i=this.tiles[t];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture,a=!0)}a&&this.fire(new i.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 es extends ea{constructor(t,r,a,n){super(t,r,a,n),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some(t=>!Array.isArray(t)||2!==t.length||t.some(t=>"number"!=typeof t))||this.fire(new i.k(new i.ae(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.k(new i.ae(`sources.${t}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new i.k(new i.ae(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new i.k(new i.ae(`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 i.k(new i.ae(`sources.${t}`,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}load(){return i._(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 i.k(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()||0===Object.keys(this.tiles).length)return;let r=this.map.painter.context,a=r.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new i.T(r,this.canvas,a.RGBA,{premultiply:!0}),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE));let n=!1;for(let t in this.tiles){let i=this.tiles[t];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture,n=!0)}n&&this.fire(new i.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(let t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}let eo={},el=t=>{switch(t){case"geojson":return er;case"image":return ea;case"raster":return Q;case"raster-dem":return ee;case"vector":return J;case"video":return en;case"canvas":return es}return eo[t]},eh="RTLPluginLoaded";class eu extends i.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=$()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(t=>{throw this.status="error",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return i._(this,arguments,void 0,function*(t,i=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=y.resolveURL(t),!this.url)throw Error(`requested url ${t}
2 is invalid`);if("unavailable"===this.status){if(!i)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()})}_requestImport(){return i._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new i.l(eh))})}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let ec=null;function ed(){return ec||(ec=new eu),ec}(c=f||(f={}))[c.Base=0]="Base",c[c.Parent=1]="Parent",(d=m||(m={}))[d.Departing=0]="Departing",d[d.Incoming=1]="Incoming";class ep{constructor(t,r){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=i.af(),this.uses=0,this.tileSize=r,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:i,fadingParentID:r,fadeEndTime:a}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=i,this.fadingParentID=r,this.fadeEndTime=a}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=v(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,r,a){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){for(let n in t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,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(t,i){let r={};if(!i)return r;for(let a of t){let t=a.layerIds.map(t=>i.getLayer(t)).filter(Boolean);if(0!==t.length)for(let i of(a.layers=t,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(i=>t.filter(t=>t.id===i)[0])),t))r[i.id]=a}return r}(t.buckets,null==r?void 0:r.style),this.hasSymbolBuckets=!1,this.buckets){let t=this.buckets[n];if(t instanceof i.ah){if(this.hasSymbolBuckets=!0,!a)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let t in this.buckets){let r=this.buckets[t];if(r instanceof i.ah&&r.hasRTLText){this.hasRTLText=!0,ed().lazyLoad();break}}for(let t in this.queryPadding=0,this.buckets){let i=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(t).queryRadius(i))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new i.ag}unloadVectorData(){for(let 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(let i in this.buckets){let r=this.buckets[i];r.uploadPending()&&r.upload(t)}let r=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new i.T(t,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new i.T(t,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,i,r,a,n,s,o,l,h,u,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:n,scale:s,tileSize:this.tileSize,pixelPosMatrix:u,transform:l,params:o,queryPadding:this.queryPadding*h,getElevation:c},t,i,r):{}}querySourceFeatures(t,r){let a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;
2let n=a.loadVTLayers(),s=r&&r.sourceLayer?r.sourceLayer:"",o=n[i.ai]||n[s];if(!o)return;let l=i.aj(null==r?void 0:r.filter,null==r?void 0:r.globalState),{z:h,x:u,y:c}=this.tileID.canonical,d={z:h,x:u,y:c};for(let r=0;r<o.length;r++){let n=o.feature(r);if(l.needGeometry){let t=i.ak(n,!0);if(!l.filter(new i.H(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!l.filter(new i.H(this.tileID.overscaledZ),n))continue;let p=a.getId(n,s),f=new i.al(n,h,u,c,p);f.tile=d,t.push(f)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){let r=this.expirationTime;if(t.cacheControl){let r=i.am(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){let t=Date.now(),i=!1;if(this.expirationTime>t)i=!1;else if(r)if(this.expirationTime<r)i=!0;else{let a=this.expirationTime-r;a?this.expirationTime=t+Math.max(a,3e4):i=!0}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),0x7fffffff)}setFeatureState(t,r){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;let a=this.latestFeatureIndex.loadVTLayers();for(let n in this.buckets){if(!r.style.hasLayer(n))continue;let s=this.buckets[n],o=s.layers[0].sourceLayer||i.ai,l=a[o],h=t[o];if(!l||!h||0===Object.keys(h).length)continue;s.update(h,l,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});let u=r&&r.style&&r.style.getLayer(n);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(s)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<v()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=v()+t}setDependencies(t,i){let r={};for(let t of i)r[t]=!0;this.dependencies[t]=r}hasDependency(t,i){for(let r of t){let t=this.dependencies[r];if(t){for(let r of i)if(t[r])return!0}}return!1}}class ef{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,r,a){let n=String(r);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},i.e(this.stateChanges[t][n],a),null===this.deletedStates[t])for(let i in this.deletedStates[t]={},this.state[t])i!==n&&(this.deletedStates[t][i]=null);else if(this.deletedStates[t]&&null===this.deletedStates[t][n])for(let i in this.deletedStates[t][n]={},this.state[t][n])a[i]||(this.deletedStates[t][n][i]=null);else for(let i in a)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][i]&&delete this.deletedStates[t][n][i]}removeFeatureState(t,i,r){if(null===this.deletedStates[t])return;let a=String(i);if(this.deletedStates[t]=this.deletedStates[t]||{},r&&void 0!==i)null!==this.deletedStates[t][a]&&(this.deletedStates[t][a]=this.deletedStates[t][a]||{},this.deletedStates[t][a][r]=null);else if(void 0!==i)if(this.stateChanges[t]&&this.stateChanges[t][a])for(r in this.deletedStates[t][a]={},this.stateChanges[t][a])this.deletedStates[t][a][r]=null;else this.deletedStates[t][a]=null;else this.deletedStates[t]=null}getState(t,r){let a=String(r),n=i.e({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){let i=this.deletedStates[t][r];if(null===i)return{};for(let t in i)delete n[t]}return n}initializeTileState(t,i){t.setFeatureState(this.state,i)}coalesceChanges(t,r){let a={};for(let t in this.stateChanges){this.state[t]=this.state[t]||{};let r={};for(let a in this.stateChanges[t])this.state[t][a]||(this.state[t][a]={}),i.e(this.state[t][a],this.stateChanges[t][a]),r[a]=this.state[t][a];a[t]=r}for(let t in this.deletedStates){this.state[t]=this.state[t]||{};let r={};if(null===this.deletedStates[t])for(let i in this.state[t])r[i]={},this.state[t][i]={};else for(let i in this.deletedStates[t]){if(null===this.deletedStates[t][i])this.state[t][i]={};else for(let r of Object.keys(this.deletedStates[t][i]))delete this.state[t][i][r];r[i]=this.state[t][i]}a[t]=a[t]||{},i.e(a[t],r)}this.stateChanges={},this.deletedStates={},0!==Object.keys(a).length&&t.setFeatureState(a,r)}}function em(t,r){let a=i.an(r.lat,-i.ao,i.ao);return new i.P(i.Y(r.lng)*t,i.X(a)*t)}function e_(t,r){return new i.a9(r.x/t,r.y/t).toLngLat()}function eg(t){return t.cameraToCenterDistance*Math.min(.85*Math.tan(i.ap(90-t.pitch)),Math.tan(i.ap(89.25-t.pitch)))}function ey(t,r){let a=t.canonical,n=r/i.aq(a.z),s=a.x+Math.pow(2,a.z)*t.wrap,o=i.ar(new Float64Array(16));return i.O(o,o,[s*n,a.y*n,0]),i.Q(o,o,[n/i.a5,n/i.a5,1]),o}function ex(t,r,a,n,s){let o=i.a9.fromLngLat(t,r),l=s*i.as(1,t.lat),{x:h,y:u,z:c}=ev(a,n);return new i.a9(o.x+-(l*h),o.y+-(l*u),o.z+-(l*c))}function ev(t,r){let a=i.ap(t),n=i.ap(r),s=Math.cos(-a),o=Math.sin(a);return{x:o*Math.sin(n),y:-o*Math.cos(n),z:s}}function eb(t,i,r){let a=0,n=(r-i)/10;for(let s=0;s<10;s++)a+=n*Math.pow(Math.cos(i+(s+.5)/10*(r-i)),t);return a}function ew(t,r){return function(a,n,s,o,l){let h=2*((t-1)/i.at(Math.cos(i.ap(89.25-l))/Math.cos(i.ap(89.25)))-1),u=Math.acos(s/o),c=2*eb(h-1,0,i.ap(l/2)),d=Math.min(i.ap(89.25),u+i.ap(l/2)),p=eb(h-1,Math.min(d,u-i.ap(l/2)),d),f=Math.atan(n/s),m=Math.hypot(n,s),_=a;
2return _+=i.at(o/m/Math.max(.5,Math.cos(i.ap(l/2)))),_+=h*i.at(Math.cos(f))/2,_-=i.at(Math.max(1,p/c/r))/2}}let eT=ew(9.314,3);function eS(t,r){return Math.max(0,(r.roundZoom?Math.round:Math.floor)(t.zoom+i.at(t.tileSize/r.tileSize)))}function eP(t,r){let a=t.getCameraFrustum(),n=t.getClippingPlane(),s=t.screenPointToMercatorCoordinate(t.getCameraPoint()),o=i.a9.fromLngLat(t.center,t.elevation);s.z=o.z+Math.cos(t.pitchInRadians)*t.cameraToCenterDistance/t.worldSize;let l=t.getCoveringTilesDetailsProvider(),h=l.allowVariableZoom(t,r),u=eS(t,r),c=r.minzoom||0,d=void 0!==r.maxzoom?r.maxzoom:t.maxZoom,p=Math.min(Math.max(0,u),d),f=Math.pow(2,p),m=[f*s.x,f*s.y,0],_=[f*o.x,f*o.y,0],g=Math.hypot(o.x-s.x,o.y-s.y),y=Math.abs(o.z-s.z),x=Math.hypot(g,y),v=t=>({zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),b=[],w=[];if(t.renderWorldCopies&&l.allowWorldCopies())for(let t=1;t<=3;t++)b.push(v(-t)),b.push(v(t));for(b.push(v(0));b.length>0;){let f=b.pop(),g=f.x,v=f.y,T=f.fullyVisible,S={x:g,y:v,z:f.zoom},P=l.getTileBoundingVolume(S,f.wrap,t.elevation,r);if(!T){let t=function(t,i,r){let a=i.intersectsFrustum(t);if(!r||0===a)return a;let n=i.intersectsPlane(r);return 0===n?0:2===a&&2===n?2:1}(a,P,n);if(0===t)continue;T=2===t}let M=l.distanceToTile2d(s.x,s.y,S,P),I=u;h&&(I=(r.calculateTileZoom||eT)(t.zoom+i.at(t.tileSize/r.tileSize),M,y,x,t.fov));let E=Math.min(I=Math.max(0,I=(r.roundZoom?Math.round:Math.floor)(I)),d);if(f.wrap=l.getWrap(o,S,f.wrap),f.zoom>=E){if(f.zoom<c)continue;let t=p-f.zoom,a=m[0]-.5-(g<<t),n=m[1]-.5-(v<<t),s=r.reparseOverscaled?Math.max(f.zoom,I):f.zoom;w.push({tileID:new i.a2(f.zoom===d?s:f.zoom,f.wrap,f.zoom,g,v),distanceSq:i.au([_[0]-.5-g,_[1]-.5-v]),tileDistanceToCamera:Math.sqrt(a*a+n*n)})}else for(let t=0;t<4;t++)b.push({zoom:f.zoom+1,x:(g<<1)+t%2,y:(v<<1)+(t>>1),wrap:f.wrap,fullyVisible:T})}return w.sort((t,i)=>t.distanceSq-i.distanceSq).map(t=>t.tileID)}let eM=i.aa.fromPoints([new i.P(0,0),new i.P(i.a5,i.a5)]);function eI(t){return"raster"===t||"image"===t||"video"===t}function eE(t,i,r,a,n,s,o){if(r[0].overscaledZ>=s)return!1;let l=!1;for(let s of r){let r=t.getLoadedTile(s);if(!r)continue;let{fadingRole:h,fadingDirection:u,fadingParentID:c}=r;h===f.Base&&u===m.Departing&&c||(r.setCrossFadeLogic({fadingRole:f.Base,fadingDirection:m.Departing,fadingParentID:i.tileID,fadeEndTime:n+o}),i.setCrossFadeLogic({fadingRole:f.Parent,fadingDirection:m.Incoming,fadeEndTime:n+o})),a[s.key]=s,l=!0}return l}function eC(t,i){var r;t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let a=i.tileID.canonical.x-t.tileID.canonical.x,n=i.tileID.canonical.y-t.tileID.canonical.y,s=Math.pow(2,t.tileID.canonical.z),o=i.tileID.key;0===a&&0===n||Math.abs(n)>1||(Math.abs(a)>1&&(1===Math.abs(a+s)?a+=s:1===Math.abs(a-s)&&(a-=s)),i.dem&&t.dem&&(t.dem.backfillBorder(i.dem,a,n),(null==(r=t.neighboringTiles)?void 0:r[o])&&(t.neighboringTiles[o].backfilled=!0)))}class eA{constructor(){this._tiles={}}handleWrapJump(t){let i={};for(let r in this._tiles){let a=this._tiles[r];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+t),i[a.tileID.key]=a}this._tiles=i}setFeatureState(t,i){for(let r in this._tiles)this._tiles[r].setFeatureState(t,i)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map(t=>t.tileID).sort(i.aw).map(t=>t.key):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,i){this._tiles[t]=i}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){let i=this.getTileById(t.key);return(null==i?void 0:i.hasData())?i:null}isIdRenderable(t,i=!1){var r;return null==(r=this.getTileById(t))?void 0:r.isRenderable(i)}getRenderableIds(t=0,r){let a=[];for(let t of this.getAllIds())this.isIdRenderable(t,r)&&a.push(this.getTileById(t));return r?a.sort((r,a)=>{let n=r.tileID,s=a.tileID,o=new i.P(n.canonical.x,n.canonical.y)._rotate(-t),l=new i.P(s.canonical.x,s.canonical.y)._rotate(-t);return n.overscaledZ-s.overscaledZ||l.y-o.y||l.x-o.x}).map(t=>t.tileID.key):a.map(t=>t.tileID).sort(i.aw).map(t=>t.key)}}class eD extends i.E{constructor(t,r,a){super(),this.id=t,this.dispatcher=a,this.on("data",t=>this._dataHandler(t)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((t,i,r,a)=>{let n=new(el(i.type))(t,i,r,a);if(n.id!==t)throw Error(`Expected Source id to be ${t} instead of ${n.id}`);return n})(t,r,a,this),this._inViewTiles=new eA,this._outOfViewCache=new i.ax(0,t=>this._unloadTile(t)),this._timers={}
2,this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new ef,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(let t of this._inViewTiles.getAllTiles())t.unloadVectorData();this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t),this._inViewTiles=new eA}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,r,a){return i._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,r,a)}catch(r){t.state="errored",404!==r.status?this._source.fire(new i.k(r,{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 i.l("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){for(let i of(this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null),this._inViewTiles.getAllTiles()))i.upload(t),i.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var i;return this._inViewTiles.getRenderableIds(null==(i=this.transform)?void 0:i.bearingInRadians,t)}hasRenderableParent(t){let i=t.overscaledZ-1;if(i>=this._source.minzoom){let r=this.getLoadedTile(t.scaledTo(i));if(r)return this._inViewTiles.isIdRenderable(r.tileID.key)}return!1}reload(t,i){if(this._paused)this._shouldReloadOnResume=!0;else for(let r of(this._outOfViewCache.reset(),this._inViewTiles.getAllIds())){let a=this._inViewTiles.getTileById(r);i&&!this._source.shouldReloadTile(a,i)||(t?this._reloadTile(r,"expired"):"errored"!==a.state&&this._reloadTile(r,"reloading"))}}_reloadTile(t,r){return i._(this,void 0,void 0,function*(){let i=this._inViewTiles.getTileById(t);i&&("loading"!==i.state&&(i.state=r),yield this._loadTile(i,t,r))})}_tileLoaded(t,r,a){t.timeAdded=v(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),"expired"===a&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(r,t),"raster-dem"===this.getSource().type&&t.dem&&function(t,i){var r,a;for(let n of i.getRenderableIds()){if(!t.neighboringTiles||!t.neighboringTiles[n])continue;let s=i.getTileById(n);t.neighboringTiles[n].backfilled||eC(t,s),(null==(a=null==(r=s.neighboringTiles)?void 0:r[t.tileID.key])?void 0:a.backfilled)||eC(s,t)}}(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new i.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,i){let r=this._getLoadedDescendents(i),a=new Set;for(let n of i){let i=r[n.key];if(!(null==i?void 0:i.length)){a.add(n);continue}let s=n.overscaledZ+eD.maxOverzooming,o=i.filter(t=>t.tileID.overscaledZ<=s);if(!o.length){a.add(n);continue}let l=Math.min(...o.map(t=>t.tileID.overscaledZ)),h=o.filter(t=>t.tileID.overscaledZ===l).map(t=>t.tileID);for(let i of h)t[i.key]=i;this._areDescendentsComplete(h,l,n.overscaledZ)||a.add(n)}return a}_getLoadedDescendents(t){var i;let r={};for(let a of this._inViewTiles.getAllTiles().filter(t=>t.hasData()))for(let n of t)a.tileID.isChildOf(n)&&(r[i=n.key]||(r[i]=[])).push(a);return r}_areDescendentsComplete(t,i,r){return 1===t.length&&t[0].isOverscaled()?t[0].overscaledZ===i:Math.pow(4,i-r)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let r=Math.floor((Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1)*(null===this._maxTileC
2acheZoomLevels?i.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._outOfViewCache.setMaxSize(a)}handleWrapJump(t){let i=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);this._prevLng=t,i&&(this._inViewTiles.handleWrapJump(i),this._resetTileReloadTimers())}update(t,r){let a;if(!this._sourceLoaded||this._paused)return;this.transform=t,this.terrain=r,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new i.a2(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(a=eP(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(a=a.filter(t=>this._source.hasTile(t)))):a=[],this.usedForTerrain&&(a=this._addTerrainIdealTiles(a));let n=0===a.length&&!this._updated&&this._didEmitContent;this._updated=!0,n&&this.fire(new i.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let s=eS(t,this._source),o=this._updateRetainedTiles(a,s),l=eI(this._source.type);l&&this._rasterFadeDuration>0&&!r&&function(t,r,a,n,s,o,l){let h=v(),u=i.av(r);for(let i of r){let r=t.getTileById(i.key);r.fadingDirection!==m.Departing&&0!==r.fadeOpacity||r.resetFadeLogic(),function(t,i,r,a,n,s,o){if(!i.hasData())return!1;let{tileID:l,fadingRole:h,fadingDirection:u,fadingParentID:c}=i;if(h===f.Base&&u===m.Incoming&&c)return r[c.key]=c,!0;let d=Math.max(l.overscaledZ-n,s);for(let n=l.overscaledZ-1;n>=d;n--){let s=l.scaledTo(n),h=t.getLoadedTile(s);if(h)return i.setCrossFadeLogic({fadingRole:f.Base,fadingDirection:m.Incoming,fadingParentID:h.tileID,fadeEndTime:a+o}),h.setCrossFadeLogic({fadingRole:f.Parent,fadingDirection:m.Departing,fadeEndTime:a+o}),r[s.key]=s,!0}return!1}(t,r,a,h,n,s,l)||function(t,i,r,a,n,s){if(!i.hasData())return!1;let o=i.tileID.children(n),l=eE(t,i,o,r,a,n,s);if(l)return!0;for(let h of o)eE(t,i,h.children(n),r,a,n,s)&&(l=!0);return l}(t,r,a,h,o,l)||function(t,i,r,a){let n=t.tileID;return!!t.selfFading||!t.hasData()&&!!i.has(n)&&(t.setSelfFadeLogic(r+a),!0)}(r,u,h,l)||r.resetFadeLogic()}}(this._inViewTiles,a,o,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),l?this._cleanUpRasterTiles(o):this._cleanUpVectorTiles(o)}_cleanUpRasterTiles(t){for(let i of this._inViewTiles.getAllIds())t[i]||this._removeTile(i)}_cleanUpVectorTiles(t){for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);t[i]?r.clearSymbolFadeHold():r.hasSymbolBuckets?r.holdingForSymbolFade()?r.symbolFadeFinished()&&this._removeTile(i):r.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(i)}}_addTerrainIdealTiles(t){let i=[];for(let r of t)if(r.canonical.z>this._source.minzoom){let t=r.scaledTo(r.canonical.z-1);i.push(t);let a=r.scaledTo(Math.max(this._source.minzoom,Math.min(r.canonical.z,5)));i.push(a)}return t.concat(i)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,i){var r;let a=new Set;for(let i of t)this._addTile(i).hasData()||a.add(i);let n=t.reduce((t,i)=>(t[i.key]=i,t),{}),s=this._retainLoadedChildren(n,a),o={},l=Math.max(i-eD.maxUnderzooming,this._source.minzoom);for(let t of s){let i=this._inViewTiles.getTileById(t.key),a=null==i?void 0:i.wasRequested();for(let s=t.overscaledZ-1;s>=l;--s){let l=t.scaledTo(s);if(o[l.key])break;if(o[l.key]=!0,(i=this.getTile(l))||!a||(i=this._addTile(l)),i){let t=i.hasData();if((t||!(null==(r=this.map)?void 0:r.cancelPendingTileRequestsWhileZooming)||a)&&(n[l.key]=l),a=i.wasRequested(),t)break}}}return n}_addTile(t){let r=this._inViewTiles.getTileById(t.key);if(r)return r;(r=this._outOfViewCache.getAndRemove(t))&&(r.resetFadeLogic(),this._setTileReloadTimer(t.key,r),r.tileID=t,this._state.initializeTileState(r,this.map?this.map.painter:null));let a=r;return r||(r=new ep(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(r,t.key,r.state)),r.uses++,this._inViewTiles.setTile(t.key,r),a||this._source.fire(new i.l("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r}_setTileReloadTimer(t,i){this._clearTileReloadTimer(t);let r=i.getExpiryTimeout();r&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},r))}_clearTileReloadTimer(t){let i=this._timers[t];i&&(clearTimeout(i),delete this._timers[t])}_resetTileReloadTimers(){for(let t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let t of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,i)}}refreshTiles(t){for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);(this._inViewTiles.isIdRenderable(i)||"errored"==r.state)&&t.some(t=>t.equals(r.tileID.canonical))&&this._reloadTile(i,"expired")}}_removeTile(t){let i=this._inViewTiles.getTileById(t);i&&(i.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),i.uses>0||(i.hasData()&&"reloading"!==i.state?this._outOfViewCache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(t){"source"===t.dataType&&("metadata"!==t.sourceDataType?"content"===t.sourceDataType&&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(){for(let t of(this._shouldReloadOnResume=!1,this._paused=!1,this._inViewTiles.getAllIds()))this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,r,a){let n=[],s=this.transform;if(!s)return n;let o=s.getCoveringTilesDetailsProvider().allowWorldCopies(),l=a?s.getCameraQueryGeometry(t):t,h=t=>s.screenPointToMercatorCoordinate(t,this.terrain),u=this.transformBbox(t,h,!o),c=this.transformBbox(l,h,!o),d=this.getIds(),p=i.aa.fromPoints(c);for(let t=0;t<d.length;t++){let a=this._inViewTiles.getTileById(d[t]);if(a.holdingForSymbolFade())continue;let l=o?[a.tileID]:[a.tileID.unwrapTo(-1),a.tileID.unwrapTo(0)],h=Math.pow(2,s.zoom-a.tileID.overscaledZ
2),f=r*a.queryPadding*i.a5/a.tileSize/h;for(let t of l){let r=p.map(r=>t.getTilePoint(new i.a9(r.x,r.y)));if(r.expandBy(f),r.intersects(eM)){let i=u.map(i=>t.getTilePoint(i)),r=c.map(i=>t.getTilePoint(i));n.push({tile:a,tileID:o?t:t.unwrapTo(0),queryGeometry:i,cameraQueryGeometry:r,scale:h})}}}return n}transformBbox(t,r,a){let n=t.map(r);if(a){let a=i.aa.fromPoints(t);a.shrinkBy(.001*Math.min(a.width(),a.height()));let s=a.map(r);i.aa.fromPoints(n).covers(s)||(n=n.map(t=>t.x>.5?new i.a9(t.x-1,t.y,t.z):t))}return n}getVisibleCoordinates(t){let i=this.getRenderableIds(t).map(t=>this._inViewTiles.getTileById(t).tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){return!!this._source.hasTransition()||!(!eI(this._source.type)||!function(t,i){if(i<=0)return!1;let r=v();for(let i of t.getAllTiles())if(i.fadeEndTime>=r)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration))}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,r,a){this._state.updateState(t=t||i.ai,r,a)}removeFeatureState(t,r,a){this._state.removeFeatureState(t=t||i.ai,r,a)}getFeatureState(t,r){return this._state.getState(t=t||i.ai,r)}
2setDependencies(t,i,r){let a=this._inViewTiles.getTileById(t);a&&a.setDependencies(i,r)}reloadTilesForDependencies(t,i){for(let r of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(r).hasDependency(t,i)&&this._reloadTile(r,"reloading");this._outOfViewCache.filter(r=>!r.hasDependency(t,i))}areTilesLoaded(){for(let t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return!1;return!0}}eD.maxUnderzooming=10,eD.maxOverzooming=3;class ez{constructor(t,i){this.reset(t,i)}reset(t,i){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=i.an(t,0,1);let r=1,a=this._distances[r],n=t*this.paddedLength+this.padding;for(;a<n&&r<this._distances.length;)a=this._distances[++r];let s=r-1,o=this._distances[s],l=a-o,h=l>0?(n-o)/l:0;return this.points[s].mult(1-h).add(this.points[r].mult(h))}}function ek(t,i){let r=!0;return"always"===t||"never"!==t&&"never"!==i||(r=!1),r}class eR{constructor(t,i,r){const a=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(i/r);for(let t=0;t<this.xCellCount*this.yCellCount;t++)a.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=i,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,i,r,a,n){this._forEachCell(i,r,a,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n)}insertCircle(t,i,r,a){this._forEachCell(i-a,r-a,i+a,r+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(i),this.circles.push(r),this.circles.push(a)}_insertBoxCell(t,i,r,a,n,s){this.boxCells[n].push(s)}_insertCircleCell(t,i,r,a,n,s){this.circleCells[n].push(s)}_query(t,i,r,a,n,s,o){if(r<0||t>this.width||a<0||i>this.height)return[];let l=[];if(t<=0&&i<=0&&this.width<=r&&this.height<=a){if(n)return[{key:null,x1:t,y1:i,x2:r,y2:a}];for(let t=0;t<this.boxKeys.length;t++)l.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){let i=this.circles[3*t],r=this.circles[3*t+1],a=this.circles[3*t+2];l.push({key:this.circleKeys[t],x1:i-a,y1:r-a,x2:i+a,y2:r+a})}}else this._forEachCell(t,i,r,a,this._queryCell,l,{hitTest:n,overlapMode:s,seenUids:{box:{},circle:{}}},o);return l}query(t,i,r,a){return this._query(t,i,r,a,!1,null)}hitTest(t,i,r,a,n,s){return this._query(t,i,r,a,!0,n,s).length>0}hitTestCircle(t,i,r,a,n){let s=t-r,o=t+r,l=i-r,h=i+r;if(o<0||s>this.width||h<0||l>this.height)return!1;let u=[];return this._forEachCell(s,l,o,h,this._queryCellCircle,u,{hitTest:!0,overlapMode:a,circle:{x:t,y:i,radius:r},seenUids:{box:{},circle:{}}},n),u.length>0}_queryCell(t,i,r,a,n,s,o,l){let{seenUids:h,hitTest:u,overlapMode:c}=o,d=this.boxCells[n];if(null!==d){let n=this.bboxes;for(let o of d)if(!h.box[o]){h.box[o]=!0;let d=4*o,p=this.boxKeys[o];if(t<=n[d+2]&&i<=n[d+3]&&r>=n[d+0]&&a>=n[d+1]&&(!l||l(p))&&(!u||!ek(c,p.overlapMode))&&(s.push({key:p,x1:n[d],y1:n[d+1],x2:n[d+2],y2:n[d+3]}),u))return!0}}let p=this.circleCells[n];if(null!==p){let n=this.circles;for(let o of p)if(!h.circle[o]){h.circle[o]=!0;let d=3*o,p=this.circleKeys[o];if(this._circleAndRectCollide(n[d],n[d+1],n[d+2],t,i,r,a)&&(!l||l(p))&&(!u||!ek(c,p.overlapMode))){let t=n[d],i=n[d+1],r=n[d+2];if(s.push({key:p,x1:t-r,y1:i-r,x2:t+r,y2:i+r}),u)return!0}}}return!1}_queryCellCircle(t,i,r,a,n,s,o,l){let{circle:h,seenUids:u,overlapMode:c}=o,d=this.boxCells[n];if(null!==d){let t=this.bboxes;for(let i of d)if(!u.box[i]){u.box[i]=!0;let r=4*i,a=this.boxKeys[i];if(this._circleAndRectCollide(h.x,h.y,h.radius,t[r+0],t[r+1],t[r+2],t[r+3])&&(!l||l(a))&&!ek(c,a.overlapMode))return s.push(!0),!0}}let p=this.circleCells[n];if(null!==p){let t=this.circles;for(let i of p)if(!u.circle[i]){u.circle[i]=!0;let r=3*i,a=this.circleKeys[i];
2if(this._circlesCollide(t[r],t[r+1],t[r+2],h.x,h.y,h.radius)&&(!l||l(a))&&!ek(c,a.overlapMode))return s.push(!0),!0}}}_forEachCell(t,i,r,a,n,s,o,l){let h=this._convertToXCellCoord(t),u=this._convertToYCellCoord(i),c=this._convertToXCellCoord(r),d=this._convertToYCellCoord(a);for(let p=h;p<=c;p++)for(let h=u;h<=d;h++)if(n.call(this,t,i,r,a,this.xCellCount*h+p,s,o,l))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,i,r,a,n,s){let o=a-t,l=n-i,h=r+s;return h*h>o*o+l*l}_circleAndRectCollide(t,i,r,a,n,s,o){let l=(s-a)/2,h=Math.abs(t-(a+l));if(h>l+r)return!1;let u=(o-n)/2,c=Math.abs(i-(n+u));if(c>u+r)return!1;if(h<=l||c<=u)return!0;let d=h-l,p=c-u;return d*d+p*p<=r*r}}function eL(t,r,a){var n,s,o,l,h;let u=i.N();if(!t){let{vecSouth:t,vecEast:i}=eF(r),a=g();a[0]=i[0],a[1]=i[1],a[2]=t[0],a[3]=t[1],(h=(n=a[0])*(l=a[3])-(o=a[2])*(s=a[1]))&&(a[0]=l*(h=1/h),a[1]=-s*h,a[2]=-o*h,a[3]=n*h),u[0]=a[0],u[1]=a[1],u[4]=a[2],u[5]=a[3]}return i.Q(u,u,[1/a,1/a,1]),u}function eF(t){let r=Math.cos(t.rollInRadians),a=Math.sin(t.rollInRadians),n=Math.cos(t.pitchInRadians),s=Math.cos(t.bearingInRadians),o=Math.sin(t.bearingInRadians),l=i.aC();l[0]=-s*n*a-o*r,l[1]=-o*n*a+s*r;let h=i.aD(l);h<1e-9?i.aE(l):i.aF(l,l,1/h);let u=i.aC();u[0]=s*n*r-o*a,u[1]=o*n*r+s*a;let c=i.aD(u);return c<1e-9?i.aE(u):i.aF(u,u,1/c),{vecEast:u,vecSouth:l}}function eB(t,r,a,n){let s;n?(s=[t,r,n(t,r),1],i.aH(s,s,a)):eY(s=[t,r,0,1],s,a);let o=s[3];return{point:new i.P(s[0]/o,s[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function eO(t,i,r,a,n,s,o,l){let h=s.glyphStartIndex+s.numGlyphs,u=s.lineStartIndex,c=s.lineStartIndex+s.lineLength,d=i.getoffsetX(s.glyphStartIndex),p=i.getoffsetX(h-1),f=eW(t*d,r,a,n,s.segment,u,c,l,o);if(!f)return null;let m=eW(t*p,r,a,n,s.segment,u,c,l,o);return m?l.projectionCache.anyProjectionOccluded?null:{first:f,last:m}:null}function eV(t,r,a,n){return t===i.az.horizontal&&Math.abs(a.y-r.y)>Math.abs(a.x-r.x)*n?{useVertical:!0}:(t===i.az.vertical?r.y<a.y:r.x>a.x)?{needsFlipping:!0}:null}function ej(t){let r,{projectionContext:a,pitchedLabelPlaneMatrixInverse:n,symbol:s,fontSize:o,flip:l,keepUpright:h,glyphOffsetArray:u,dynamicLayoutVertexArray:c,aspectRatio:d,rotateToLine:p}=t,f=o/24,m=s.lineOffsetX*f,_=s.lineOffsetY*f;if(s.numGlyphs>1){let t=s.glyphStartIndex+s.numGlyphs,i=s.lineStartIndex,o=s.lineStartIndex+s.lineLength,c=eO(f,u,m,_,l,s,p,a);if(!c)return{notEnoughRoom:!0};let g=eq(c.first.point.x,c.first.point.y,a,n),y=eq(c.last.point.x,c.last.point.y,a,n);if(h&&!l){let t=eV(s.writingMode,g,y,d);if(t)return t}r=[c.first];for(let n=s.glyphStartIndex+1;n<t-1;n++){let t=eW(f*u.getoffsetX(n),m,_,l,s.segment,i,o,a,p);if(!t)return{notEnoughRoom:!0};r.push(t)}r.push(c.last)}else{if(h&&!l){let t=eG(a.tileAnchorPoint.x,a.tileAnchorPoint.y,a).point,r=s.lineStartIndex+s.segment+1,o=new i.P(a.lineVertexArray.getx(r),a.lineVertexArray.gety(r)),l=eG(o.x,o.y,a),h=l.signedDistanceFromCamera>0?l.point:eN(a.tileAnchorPoint,o,t,1,a),u=eq(t.x,t.y,a,n),c=eq(h.x,h.y,a,n),p=eV(s.writingMode,u,c,d);if(p)return p}let t=eW(f*u.getoffsetX(s.glyphStartIndex),m,_,l,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,a,p);if(!t||a.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};r=[t]}for(let t of r)i.aG(c,t.point,t.angle);return{}}function eN(t,i,r,a,n){let s=t.add(t.sub(i)._unit()),o=eG(s.x,s.y,n).point,l=r.sub(o);return r.add(l._mult(a/l.mag()))}function eU(t,r,a){let n=r.projectionCache;if(n.projections[t])return n.projections[t];let s=new i.P(r.lineVertexArray.getx(t),r.lineVertexArray.gety(t)),o=eG(s.x,s.y,r);if(o.signedDistanceFromCamera>0)return n.projections[t]=o.point,n.anyProjectionOccluded=n.anyProjectionOccluded||o.isOccluded,o.point;let l=t-a.direction;return eN(0===a.distanceFromAnchor?r.tileAnchorPoint:new i.P(r.lineVertexArray.getx(l),r.lineVertexArray.gety(l)),s,a.previousVertex,a.absOffsetX-a.distanceFromAnchor+1,r)}function eG(t,i,r){let a,n=t+r.translation[0],s=i+r.translation[1];
2return r.pitchWithMap?(a=eB(n,s,r.pitchedLabelPlaneMatrix,r.getElevation)).isOccluded=!1:((a=r.transform.projectTileCoordinates(n,s,r.unwrappedTileID,r.getElevation)).point.x=(.5*a.point.x+.5)*r.width,a.point.y=(-(.5*a.point.y)+.5)*r.height),a}function eq(t,r,a,n){if(a.pitchWithMap){let s=[t,r,0,1];return i.aH(s,s,n),a.transform.projectTileCoordinates(s[0]/s[3],s[1]/s[3],a.unwrappedTileID,a.getElevation).point}return{x:t/a.width*2-1,y:1-r/a.height*2}}function eZ(t,i,r){return r.transform.projectTileCoordinates(t,i,r.unwrappedTileID,r.getElevation)}function e$(t,i,r){return t._unit()._perp()._mult(i*r)}function eW(t,r,a,n,s,o,l,h,u){let c,d=n?t-r:t+r,p=d>0?1:-1,f=0;n&&(p*=-1,f=Math.PI),p<0&&(f+=Math.PI);let m,_=p>0?o+s:o+s+1;h.projectionCache.cachedAnchorPoint?m=h.projectionCache.cachedAnchorPoint:(m=eG(h.tileAnchorPoint.x,h.tileAnchorPoint.y,h).point,h.projectionCache.cachedAnchorPoint=m);let g,y,x=m,v=m,b=0,w=0,T=Math.abs(d),S=[];for(;b+w<=T;){if((_+=p)<o||_>=l)return null;b+=w,v=x,y=g;let t={absOffsetX:T,direction:p,distanceFromAnchor:b,previousVertex:v};if(x=eU(_,h,t),0===a)S.push(v),c=x.sub(v);else{let r,n=x.sub(v);r=0===n.mag()?e$(eU(_+p,h,t).sub(x),a,p):e$(n,a,p),y||(y=v.add(r)),g=function(t,r,a,n,s,o,l,h,u){if(h.projectionCache.offsets[t])return h.projectionCache.offsets[t];let c=a.add(r);if(t+u.direction<n||t+u.direction>=s)return h.projectionCache.offsets[t]=c,c;let d=eU(t+u.direction,h,u),p=e$(d.sub(a),l,u.direction),f=a.add(p),m=d.add(p);return h.projectionCache.offsets[t]=i.aI(o,c,f,m)||c,h.projectionCache.offsets[t]}(_,r,x,o,l,y,a,h,t),S.push(y),c=g.sub(y)}w=c.mag()}let P=c._mult((T-b)/w)._add(y||v),M=f+Math.atan2(x.y-v.y,x.x-v.x);return S.push(P),{point:P,angle:u?M:0,path:S}}let eH=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function eX(t,i){for(let r=0;r<t;r++){let t=i.length;i.resize(t+4),i.float32.set(eH,3*t)}}function eY(t,i,r){let a=i[0],n=i[1];return t[0]=r[0]*a+r[4]*n+r[12],t[1]=r[1]*a+r[5]*n+r[13],t[3]=r[3]*a+r[7]*n+r[15],t}class eK{constructor(t,i=new eR(t.width+200,t.height+200,25),r=new eR(t.width+200,t.height+200,25)){this.transform=t,this.grid=i,this.ignoredGrid=r,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+100,this.screenBottomBoundary=t.height+100,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,i,r,a,n,s,o,l,h,u,c,d){let p,f=this.projectAndGetPerspectiveRatio(t.anchorPointX+l[0],t.anchorPointY+l[1],n,u,d),m=r*f.perspectiveRatio;if(s||o)p=this._projectCollisionBox(t,m,a,n,s,o,l,f,u,c,d);else{let i=f.x+(c?c.x*m:0),r=f.y+(c?c.y*m:0);p={allPointsOccluded:!1,box:[i+t.x1*m,r+t.y1*m,i+t.x2*m,r+t.y2*m]}}let[_,g,y,x]=p.box,v=s?p.allPointsOccluded:f.isOccluded,b=v;return b||(b=f.perspectiveRatio<this.perspectiveRatioCutoff),b||(b=!this.isInsideGrid(_,g,y,x)),b||"always"!==i&&this.grid.hitTest(_,g,y,x,i,h)?{box:[_,g,y,x],placeable:!1,offscreen:!1,occluded:v}:{box:[_,g,y,x],placeable:!0,offscreen:this.isOffscreen(_,g,y,x),occluded:v}}placeCollisionCircles(t,r,a,n,s,o,l,h,u,c,d,p,f,m){let _=[],g=new i.P(r.anchorX,r.anchorY),y=this.getPerspectiveRatio(g.x,g.y,o,m),x=(u?s*this.transform.getPitchedTextCorrection(r.anchorX,r.anchorY,o)/y:s*y)/i.aM,v={getElevation:m,pitchedLabelPlaneMatrix:l,lineVertexArray:a,pitchWithMap:u,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:o,width:this.transform.width,height:this.transform.height,translation:f},b=eO(x,n,r.lineOffsetX*x,r.lineOffsetY*x,!1,r,!1,v),w=!1,T=!1,S=!0;if(b){let r=.5*d*y+p,a=new i.P(-100,-100),n=new i.P(this.screenRightBoundary,this.screenBottomBoundary),s=new ez,o=b.first,l=b.last,f=[];for(let t=o.path.length-1;t>=1;t--)f.push(o.path[t]);for(let t=1;t<l.path.length;t++)f.push(l.path[t]);let m=2.5*r;if(u){let t=this.projectPathToScreenSpace(f,v);f=t.some(t=>t.signedDistanceFromCamera<=0)?[]:t.map(t=>t.point)}let g=[];if(f.length>0){let t=f[0].clone(),r=f[0].clone();for(let i=1;i<f.length;i++)t.x=Math.min(t.x,f[i].x),t.y=Math.min(t.y,f[i].y),r.x=Math.max(r.x,f[i].x),r.y=Math.max(r.y,f[i].y);g=t.x>=a.x&&r.x<=n.x&&t.y>=a.y&&r.y<=n.y?[f]:r.x<a.x||t.x>n.x||r.y<a.y||t.y>n.y?[]:i.aJ([f],a.x,a.y,n.x,n.y)}for(let i of g){s.reset(i,.25*r);let a=0;a=s.length<=.5*r?1:Math.ceil(s.paddedLength/m)+1;for(let i=0;i<a;i++){let n=i/Math.max(a-1,1),o=s.lerp(n),l=o.x+100,u=o.y+100;_.push(l,u,r,0);let d=l-r,p=u-r,f=l+r,m=u+r;if(S=S&&this.isOffscreen(d,p,f,m),T=T||this.isInsideGrid(d,p,f,m),"always"!==t&&this.grid.hitTestCircle(l,u,r,t,c)&&(w=!0,!h))return{circles:[],offscreen:!1,collisionDetected:w}}}}return{circles:!h&&w||!T||y<this.perspectiveRatioCutoff?[]:_,offscreen:S,collisionDetected:w}}projectPathToScreenSpace(t,r){let a;return function(t){let i=0,r=0,a=0,n=0;for(let s=0;s<t.length;s++)t[s].isOccluded?(a=s+1,n=0):++n>r&&(r=n,i=a);return t.slice(i,i+r)}
2((a=i.N(),i.aB(a,r.pitchedLabelPlaneMatrix),t.map(t=>{let i=eB(t.x,t.y,a,r.getElevation),n=r.transform.projectTileCoordinates(i.point.x,i.point.y,r.unwrappedTileID,r.getElevation);return n.point.x=(.5*n.point.x+.5)*r.width,n.point.y=(-(.5*n.point.y)+.5)*r.height,n})))}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let r=[],a=new i.aa;for(let n of t){let t=new i.P(n.x+100,n.y+100);a.extend(t),r.push(t)}let{minX:n,minY:s,maxX:o,maxY:l}=a,h=this.grid.query(n,s,o,l).concat(this.ignoredGrid.query(n,s,o,l)),u={},c={};for(let t of h){let a=t.key;if(void 0===u[a.bucketInstanceId]&&(u[a.bucketInstanceId]={}),u[a.bucketInstanceId][a.featureIndex])continue;let n=[new i.P(t.x1,t.y1),new i.P(t.x2,t.y1),new i.P(t.x2,t.y2),new i.P(t.x1,t.y2)];i.aK(r,n)&&(u[a.bucketInstanceId][a.featureIndex]=!0,void 0===c[a.bucketInstanceId]&&(c[a.bucketInstanceId]=[]),c[a.bucketInstanceId].push(a.featureIndex))}return c}insertCollisionBox(t,i,r,a,n,s){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:n,collisionGroupID:s,overlapMode:i},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,i,r,a,n,s){let o=r?this.ignoredGrid:this.grid,l={bucketInstanceId:a,featureIndex:n,collisionGroupID:s,overlapMode:i};for(let i=0;i<t.length;i+=4)o.insertCircle(l,t[i],t[i+1],t[i+2])}projectAndGetPerspectiveRatio(t,r,a,n,s){if(s){let a;n?(a=[t,r,n(t,r),1],i.aH(a,a,s)):eY(a=[t,r,0,1],a,s);let o=a[3];return{x:(a[0]/o+1)/2*this.transform.width+100,y:(-a[1]/o+1)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/o*.5,isOccluded:!1,signedDistanceFromCamera:o}}{let i=this.transform.projectTileCoordinates(t,r,a,n);return{x:(i.point.x+1)/2*this.transform.width+100,y:(1-i.point.y)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/i.signedDistanceFromCamera*.5,isOccluded:i.isOccluded,signedDistanceFromCamera:i.signedDistanceFromCamera}}}getPerspectiveRatio(t,i,r,a){let n=this.transform.projectTileCoordinates(t,i,r,a);return .5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(t,i,r,a){return r<100||t>=this.screenRightBoundary||a<100||i>this.screenBottomBoundary}isInsideGrid(t,i,r,a){return r>=0&&t<this.gridRightBoundary&&a>=0&&i<this.gridBottomBoundary}getViewportMatrix(){let t=i.ar([]);return i.O(t,t,[-100,-100,0]),t}_projectCollisionBox(t,r,a,n,s,o,l,h,u,c,d){let p=1,f=0,m=0,_=1,g=t.anchorPointX+l[0],y=t.anchorPointY+l[1];if(o&&!s){let t=this.projectAndGetPerspectiveRatio(g+1,y,n,u,d),i=t.x-h.x,r=Math.atan((t.y-h.y)/i)+(i<0?Math.PI:0),a=Math.sin(r),s=Math.cos(r);p=s,f=a,m=-a,_=s}else if(!o&&s){let t=eF(this.transform);p=t.vecEast[0],f=t.vecEast[1],m=t.vecSouth[0],_=t.vecSouth[1]}let x=h.x,v=h.y,b=r;s&&(x=g,v=y,b=Math.pow(2,-(this.transform.zoom-a.overscaledZ))*this.transform.getPitchedTextCorrection(g,y,n),c||(b*=i.an(.5+h.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),c&&(x+=p*c.x*b+m*c.y*b,v+=f*c.x*b+_*c.y*b);let w=t.x1*b,T=t.x2*b,S=(w+T)/2,P=t.y1*b,M=t.y2*b,I=(P+M)/2,E=[];for(let{offsetX:t,offsetY:r}of[{offsetX:w,offsetY:P},{offsetX:S,offsetY:P},{offsetX:T,offsetY:P},{offsetX:T,offsetY:I},{offsetX:T,offsetY:M},{offsetX:S,offsetY:M},{offsetX:w,offsetY:M},{offsetX:w,offsetY:I}])E.push(new i.P(x+p*t+m*r,v+f*t+_*r));let C=!1;if(s){let t=E.map(t=>this.projectAndGetPerspectiveRatio(t.x,t.y,n,u,d));C=t.some(t=>!t.isOccluded),E=t.map(t=>new i.P(t.x,t.y))}else C=!0;return{box:i.aL(E),allPointsOccluded:!C}}}class eJ{constructor(t,i,r,a){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?i:-i))):a&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}}class eQ{constructor(t,i,r,a,n){this.text=new eJ(t?t.text:null,i,r,n),this.icon=new eJ(t?t.icon:null,i,a,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class e0{constructor(t,i,r){this.text=t,this.icon=i,this.skipFade=r}}class e1{constructor(t,i,r,a,n){this.bucketInstanceId=t,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=a,this.tileID=n}}class e2{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){let i=++this.maxGroupID;this.collisionGroups[t]={ID:i,predicate:t=>t.collisionGroupID===i}}return this.collisionGroups[t]}}function e3(t,r,a,n,s){let{horizontalAlign:o,verticalAlign:l}=i.aS(t);return new i.P(-(o-.5)*r+n[0]*s,-(l-.5)*a+n[1]*s)}class e5{constructor(t,i,r,a,n){this.transform=t.clone(),this.terrain=i,this.collisionIndex=new eK(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new e2(a),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){let i=this.terrain;return i?(r,a)=>i.getElevation(t,r,a):null}getBucketParts(t,r,a,n){let s=a.getBucket(r),o=a.latestFeatureIndex;if(!s||!o||r.id!==s.layerIds[0])return;let l=a.collisionBoxArray,h=s.layers[0].layout,u=s.layers[0].paint,c=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ
2),d=a.tileSize/i.a5,p=a.tileID.toUnwrapped(),f="map"===h.get("text-rotation-alignment"),m=i.aN(a,1,this.transform.zoom),_=i.aO(this.collisionIndex.transform,a,u.get("text-translate"),u.get("text-translate-anchor")),g=i.aO(this.collisionIndex.transform,a,u.get("icon-translate"),u.get("icon-translate-anchor")),y=eL(f,this.transform,m);this.retainedQueryData[s.bucketInstanceId]=new e1(s.bucketInstanceId,o,s.sourceLayerIndex,s.index,a.tileID);let x={bucket:s,layout:h,translationText:_,translationIcon:g,unwrappedTileID:p,pitchedLabelPlaneMatrix:y,scale:c,textPixelRatio:d,holdingForFade:a.holdingForSymbolFade(),collisionBoxArray:l,partiallyEvaluatedTextSize:i.ay(s.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(s.sourceID)};if(n)for(let i of s.sortKeyRanges){let{sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n}=i;t.push({sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n,parameters:x})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:s.symbolInstances.length,parameters:x})}attemptAnchorPlacement(t,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b){let w=i.aP[t.textAnchor],T=[t.textOffset0,t.textOffset1],S=e3(w,a,n,T,s),P=this.collisionIndex.placeCollisionBox(r,p,h,u,c,l,o,g,d.predicate,v,S,b);if((!x||this.collisionIndex.placeCollisionBox(x,p,h,u,c,l,o,y,d.predicate,v,S,b).placeable)&&P.placeable){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[f.crossTileID]&&this.prevPlacement.placements[f.crossTileID]&&this.prevPlacement.placements[f.crossTileID].text&&(t=this.prevPlacement.variableOffsets[f.crossTileID].anchor),0===f.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[f.crossTileID]={textOffset:T,width:a,height:n,anchor:w,textBoxScale:s,prevAnchor:t},this.markUsedJustification(m,w,f,_),m.allowVerticalPlacement&&(this.markUsedOrientation(m,_,f),this.placedOrientations[f.crossTileID]=_),{shift:S,placedGlyphBoxes:P}}}placeLayerBucketPart(t,r,a){let{bucket:n,layout:s,translationText:o,translationIcon:l,unwrappedTileID:h,pitchedLabelPlaneMatrix:u,textPixelRatio:c,holdingForFade:d,collisionBoxArray:p,partiallyEvaluatedTextSize:f,collisionGroup:m}=t.parameters,_=s.get("text-optional"),g=s.get("icon-optional"),y=i.aQ(s,"text-overlap","text-allow-overlap"),x="always"===y,v=i.aQ(s,"icon-overlap","icon-allow-overlap"),b="always"===v,w="map"===s.get("text-rotation-alignment"),T="map"===s.get("text-pitch-alignment"),S="none"!==s.get("icon-text-fit"),P="viewport-y"===s.get("symbol-z-order"),M=x&&(b||!n.hasIconData()||g),I=b&&(x||!n.hasTextData()||_);!n.collisionArrays&&p&&n.deserializeCollisionBoxes(p);let E=this.retainedQueryData[n.bucketInstanceId].tileID,C=this._getTerrainElevationFunc(E),A=this.transform.getFastPathSimpleProjectionMatrix(E),D=(t,p,b)=>{var P,D;if(r[t.crossTileID])return;if(d)return void(this.placements[t.crossTileID]=new e0(!1,!1,!1));let z=!1,k=!1,R=!0,L=null,F={box:null,placeable:!1,offscreen:null,occluded:!1},B={placeable:!1},O=null,V=null,j=null,N=0,U=0,G=0;p.textFeatureIndex?N=p.textFeatureIndex:t.useRuntimeCollisionCircles&&(N=t.featureIndex),p.verticalTextFeatureIndex&&(U=p.verticalTextFeatureIndex);let q=p.textBox;if(q){let r=r=>{let a=i.az.horizontal;if(n.allowVerticalPlacement&&!r&&this.prevPlacement){let i=this.prevPlacement.placedOrientations[t.crossTileID];i&&(this.placedOrientations[t.crossTileID]=i,a=i,this.markUsedOrientation(n,a,t))}return a},s=(r,a)=>{if(n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&p.verticalTextBox){for(let t of n.writingModes)if(t===i.az.vertical?B=F=a():F=r(),F&&F.placeable)break}else F=r()},u=t.textAnchorOffsetStartIndex,d=t.textAnchorOffsetEndIndex;if(d===u){let a=(i,r)=>{let a=this.collisionIndex.placeCollisionBox(i,y,c,E,h,T,w,o,m.predicate,C,void 0,A);return a&&a.placeable&&(this.markUsedOrientation(n,r,t),this.placedOrientations[t.crossTileID]=r),a};s(()=>a(q,i.az.horizontal),()=>{let r=p.verticalTextBox;return n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&r?a(r,i.az.vertical):{box:null,offscreen:null}}),r(F&&F.placeable)}else{let f=i.aP[null==(D=null==(P=this.prevPlacement)?void 0:P.variableOffsets[t.crossTileID])?void 0:D.anchor],_=(i,r,s)=>{let p=i.x2-i.x1,_=i.y2-i.y1,g=t.textBoxScale,x=S&&"never"===v?r:null,b=null,P="never"===y?1:2,M="never";f&&P++;for(let r=0;r<P;r++){for(let r=u;r<d;r++){let a=n.textAnchorOffsets.get(r);if(f&&a.textAnchor!==f)continue;let u=this.attemptAnchorPlacement(a,i,p,_,g,w,T,c,E,h,m,M,t,n,s,o,l,x,C);if(u&&(b=u.placedGlyphBoxes)&&b.placeable)return z=!0,L=u.shift,b}f?f=null:M=y}return a&&!b&&(b={box:this.collisionIndex.placeCollisionBox(q,"always",c,E,h,T,w,o,m.predicate,C,void 0,A).box,offscreen:!1,placeable:!1,occluded:!1}),b};s(()=>_(q,p.iconBox,i.az.horizontal),()=>{let r=p.verticalTextBox;return n.allowVerticalPlacement&&(!F||!F.placeable)&&t.numVerticalGlyphVertices>0&&r?_(r,p.verticalIconBox,i.az.vertical):{box:null,occluded:!0,offscreen:null}}),F&&(z=F.placeable,R=F.offscreen);let g=r(F&&F.placeable);if(!z&&this.prevPlacement){let i=this.prevPlacement.variableOffsets[t.crossTileID];i&&(this.variableOffsets[t.crossTileID]=i,this.markUsedJustification(n,i.anchor,t,g))}}}if(z=(O=F)&&O.placeable,R=O&&O.offscreen,t.useRuntimeCollisionCircles&&t.centerJustifiedTextSymbolIndex>=0){let r=n.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),l=i.aA(n.textSizeData,f,r),c=s.get("text-padding");(V=this.collisionIndex.placeCollisionCircles(y,r,n.lineVertexArray,n.glyphOffsetArray,l,h,u,a,T,m.predicate,t.collisionCircleDiameter,c,o,C)).circles.length&&V.collisionDetected&&!a&&i.w("Collisions detected, but collision boxes are not shown"),z=x||V.circles.length>0&&!V.collisionDetected,R=R&&V.offscreen}if(p.iconFeatureIndex&&(G=p.iconFeatureIndex),p.iconBox){let t=t=>this.collisionIndex.placeCollisionBox(t,v,c,E,h,T,w,l,m.predicate,C,S&&L?L:void 0,A);k=B&&B.placeable&&p.verticalIconBox?(j=t(p.verticalIconBox)).placeable:(j=t(p.iconBox)).placeable,R=R&&j.offscreen}let Z=_||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,$=g||0===t.numIconVertices;Z||$?$?Z||(k=k&&z):z=k&&z:k=z=k&&z;let W=k&&j.placeable;if(z&&O.placeable&&this.collisionIndex.insertCollisionBox(O.box,y,s.get("text-ignore-placement"),n.bucketInstanceId,B&&B.placeable&&U?U:N,m.ID),W&&this.collisionIndex.insertCollisionBox(j.box,v,s.get("icon-ignore-placement"),n.bucketInstanceId,G,m.ID),V&&z&&this.collisionIndex.insertCollisionCircles(V.circles,y,s.get("text-ignore-placement"),n.bucketInstanceId,N,m.ID),a&&this.storeCollisionData(n.bucketInstanceId,b,p,O,j,V),0===t.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new e0((z||M)&&!(null==O?void 0:O.occluded),(k||I)&&!(null==j?void 0:j.occluded),R||n.justReloaded),r[t.crossTileID]=!0};if(P){if(0!==t.symbolInstanceStart)throw Error("bucket.bucketInstanceId should be 0");
2let i=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let t=i.length-1;t>=0;--t){let r=i[t];D(n.symbolInstances.get(r),n.collisionArrays[r],r)}}else for(let i=t.symbolInstanceStart;i<t.symbolInstanceEnd;i++)D(n.symbolInstances.get(i),n.collisionArrays[i],i);n.justReloaded=!1}storeCollisionData(t,i,r,a,n,s){if(r.textBox||r.iconBox){let s,o;this.collisionBoxArrays.has(t)?s=this.collisionBoxArrays.get(t):(s=new Map,this.collisionBoxArrays.set(t,s)),s.has(i)?o=s.get(i):(o={text:null,icon:null},s.set(i,o)),r.textBox&&(o.text=a.box),r.iconBox&&(o.icon=n.box)}if(s){let i=this.collisionCircleArrays[t];void 0===i&&(i=this.collisionCircleArrays[t]=[]);for(let t=0;t<s.circles.length;t+=4)i.push(s.circles[t+0]-100),i.push(s.circles[t+1]-100),i.push(s.circles[t+2]),i.push(+!!s.collisionDetected)}}markUsedJustification(t,r,a,n){let s;for(let o of(s=n===i.az.vertical?a.verticalPlacedTextSymbolIndex:({left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex})[i.aR(r)],[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex]))o>=0&&(t.text.placedSymbolArray.get(o).crossTileID=s>=0&&o!==s?0:a.crossTileID)}markUsedOrientation(t,r,a){let n=r===i.az.horizontal||r===i.az.horizontalOnly?r:0,s=r===i.az.vertical?r:0;for(let i of[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex])t.text.placedSymbolArray.get(i).placedOrientation=n;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=s)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;let i=this.prevPlacement,r=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;let a=i?i.symbolFadeChange(t):1,n=i?i.opacities:{},s=i?i.variableOffsets:{},o=i?i.placedOrientations:{};for(let t in this.placements){let i=this.placements[t],s=n[t];s?(this.opacities[t]=new eQ(s,a,i.text,i.icon),r=r||i.text!==s.text.placed||i.icon!==s.icon.placed):(this.opacities[t]=new eQ(null,a,i.text,i.icon,i.skipFade),r=r||i.text||i.icon)}for(let t in n){let i=n[t];if(!this.opacities[t]){let n=new eQ(i,a,!1,!1);n.isHidden()||(this.opacities[t]=n,r=r||i.text.placed||i.icon.placed)}}for(let t in s)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=s[t]);for(let t in o)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=o[t]);if(i&&void 0===i.lastPlacementChangeTime)throw Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:t)}updateLayerOpacities(t,i){let r={};for(let a of i){let i=a.getBucket(t);i&&a.latestFeatureIndex&&t.id===i.layerIds[0]&&this.updateBucketOpacities(i,a.tileID,r,a.collisionBoxArray)}}updateBucketOpacities(t,r,a,n){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();let s=t.layers[0],o=s.layout,l=new eQ(null,0,!1,!1,!0),h=o.get("text-allow-overlap"),u=o.get("icon-allow-overlap"),c=s._unevaluatedLayout.hasValue("text-variable-anchor")||s._unevaluatedLayout.hasValue("text-variable-anchor-offset"),d="map"===o.get("text-rotation-alignment"),p="map"===o.get("text-pitch-alignment"),f="none"!==o.get("icon-text-fit"),m=new eQ(null,0,h&&(u||!t.hasIconData()||o.get("icon-optional")),u&&(h||!t.hasTextData()||o.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);let _=(t,i,r)=>{for(let a=0;a<i/4;a++)t.opacityVertexArray.emplaceBack(r);t.hasVisibleVertices=t.hasVisibleVertices||r!==e8},g=this.collisionBoxArrays.get(t.bucketInstanceId);for(let r=0;r<t.symbolInstances.length;r++){let n=t.symbolInstances.get(r),{numHorizontalGlyphVertices:s,numVerticalGlyphVertices:o,crossTileID:h}=n,u=this.opacities[h];a[h]?u=l:u||(u=m,this.opacities[h]=u),a[h]=!0;let y=n.numIconVertices>
20,x=this.placedOrientations[n.crossTileID],v=x===i.az.vertical,b=x===i.az.horizontal||x===i.az.horizontalOnly;if(s>0||o>0){let i=e6(u.text);_(t.text,s,v?e8:i),_(t.text,o,b?e8:i);let r=u.text.isHidden();[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach(i=>{i>=0&&(t.text.placedSymbolArray.get(i).hidden=r||v?1:0)}),n.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=r||b?1:0);let a=this.variableOffsets[n.crossTileID];a&&this.markUsedJustification(t,a.anchor,n,x);let l=this.placedOrientations[n.crossTileID];l&&(this.markUsedJustification(t,"left",n,l),this.markUsedOrientation(t,l,n))}if(y){let i=e6(u.icon),r=!(f&&n.verticalPlacedIconSymbolIndex&&v);n.placedIconSymbolIndex>=0&&(_(t.icon,n.numIconVertices,r?i:e8),t.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=u.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(_(t.icon,n.numVerticalIconVertices,r?e8:i),t.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=u.icon.isHidden())}let w=g&&g.has(r)?g.get(r):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let a=t.collisionArrays[r];if(a){let r=new i.P(0,0);if(a.textBox||a.verticalTextBox){let i=!0;if(c){let t=this.variableOffsets[h];t?(r=e3(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),d&&r._rotate(p?-this.transform.bearingInRadians:this.transform.bearingInRadians)):i=!1}if(a.textBox||a.verticalTextBox){let n;a.textBox&&(n=v),a.verticalTextBox&&(n=b),e4(t.textCollisionBox.collisionVertexArray,u.text.placed,!i||n,w.text,r.x,r.y)}}if(a.iconBox||a.verticalIconBox){let i,n=!!(!b&&a.verticalIconBox);a.iconBox&&(i=n),a.verticalIconBox&&(i=!n),e4(t.iconCollisionBox.collisionVertexArray,u.icon.placed,i,w.icon,f?r.x:0,f?r.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 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 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 0===this.fadeDuration?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,i){let r=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*r>t}setStale(){this.stale=!0}}function e4(t,i,r,a,n,s){a&&0!==a.length||(a=[0,0,0,0]);let o=a[0]-100,l=a[1]-100,h=a[2]-100,u=a[3]-100;t.emplaceBack(+!!i,+!!r,n||0,s||0,o,l),t.emplaceBack(+!!i,+!!r,n||0,s||0,h,l),t.emplaceBack(+!!i,+!!r,n||0,s||0,h,u),t.emplaceBack(+!!i,+!!r,n||0,s||0,o,u)}function e6(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 0xffffffff;let i=+!!t.placed,r=Math.floor(127*t.opacity);return 0x2000000*r+0x1000000*i+131072*r+65536*i+512*r+256*i+2*r+i}let e8=0;class e9{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,i,r,a,n){let s=this._bucketParts;for(;this._currentTileIndex<t.length;)if(i.getBucketParts(s,a,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort((t,i)=>t.sortKey-i.sortKey));this._currentPartIndex<s.length;)if(i.placeLayerBucketPart(s[this._currentPartIndex],this._seenCrossTileIDs,r),this._currentPartIndex++,n())return!0;return!1}}class e7{constructor(t,i,r,a,n,s,o,l){this.placement=new e5(t,i,s,o,l),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=a,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(t,i,r){let a=v(),n=()=>!this._forceFullPlacement&&v()-a>2;for(;this._currentPlacementIndex>=0;){let a=i[t[this._currentPlacementIndex]],s=this.placement.collisionIndex.transform.zoom;if("symbol"===a.type&&(!a.minzoom||a.minzoom<=s)&&(!a.maxzoom||a.maxzoom>s)){if(this._inProgressLayer||(this._inProgressLayer=new e9(a)),this._inProgressLayer.continuePlacement(r[a.source],this.placement,this._showCollisionBoxes,a,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}let te=512/i.a5/2;class tt{constructor(t,r,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const n=new Map;for(let t=0;t<r.length;t++){const i=r.get(t),a=i.key,s=n.get(a);s?s.push(i):n.set(a,[i])}for(const[t,r]of n){const a={positions:r.map(t=>({x:Math.floor(t.anchorX*te),y:Math.floor(t.anchorY*te)})),crossTileIDs:r.map(t=>t.crossTileID)};if(a.positions.length>128){const t=new i.aT(a.positions.length,16,Uint16Array);for(const{x:i,y:r}of a.positions)t.add(i,r);t.finish(),delete a.positions,a.index=t}this._symbolsByKey[t]=a}}getScaledCoordinates(t,r){let{x:a,y:n,z:s}=this.tileID.canonical,{x:o,y:l,z:h}=r.canonical,u=te/Math.pow(2,h-s),c=(l*i.a5+t.anchorY)*u,d=n*i.a5*te;return{x:Math.floor((o*i.a5+t.anchorX)*u-a*i.a5*te),y:Math.floor(c-d)}}
2findMatches(t,i,r){let a=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z);for(let n=0;n<t.length;n++){let s=t.get(n);if(s.crossTileID)continue;let o=this._symbolsByKey[s.key];if(!o)continue;let l=this.getScaledCoordinates(s,i);if(o.index)for(let t of o.index.range(l.x-a,l.y-a,l.x+a,l.y+a).sort()){let i=o.crossTileIDs[t];if(!r[i]){r[i]=!0,s.crossTileID=i;break}}else if(o.positions)for(let t=0;t<o.positions.length;t++){let i=o.positions[t],n=o.crossTileIDs[t];if(Math.abs(i.x-l.x)<=a&&Math.abs(i.y-l.y)<=a&&!r[n]){r[n]=!0,s.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class ti{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class tr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){let i=Math.round((t-this.lng)/360);if(0!==i)for(let t in this.indexes){let r=this.indexes[t],a={};for(let t in r){let n=r[t];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+i),a[n.tileID.key]=n}this.indexes[t]=a}this.lng=t}addBucket(t,i,r){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<i.symbolInstances.length;t++)i.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});let a=this.usedCrossTileIDs[t.overscaledZ];for(let r in this.indexes){let n=this.indexes[r];if(Number(r)>t.overscaledZ)for(let r in n){let s=n[r];s.tileID.isChildOf(t)&&s.findMatches(i.symbolInstances,t,a)}else{let s=n[t.scaledTo(Number(r)).key];s&&s.findMatches(i.symbolInstances,t,a)}}for(let t=0;t<i.symbolInstances.length;t++){let n=i.symbolInstances.get(t);n.crossTileID||(n.crossTileID=r.generate(),a[n.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new tt(t,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(t,i){for(let r of i.getCrossTileIDsLists())for(let i of r)delete this.usedCrossTileIDs[t][i]}removeStaleBuckets(t){let i=!1;for(let r in this.indexes){let a=this.indexes[r];for(let n in a)t[a[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,a[n]),delete a[n],i=!0)}return i}}class ta{constructor(){this.layerIndexes={},this.crossTileIDs=new ti,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,i,r){let a=this.layerIndexes[t.id];void 0===a&&(a=this.layerIndexes[t.id]=new tr);let n=!1,s={};for(let o of(a.handleWrapJump(r),i)){let i=o.getBucket(t);i&&t.id===i.layerIds[0]&&(i.bucketInstanceId||(i.bucketInstanceId=++this.maxBucketInstanceId),a.addBucket(o.tileID,i,this.crossTileIDs)&&(n=!0),s[i.bucketInstanceId]=!0)}return a.removeStaleBuckets(s)&&(n=!0),n}pruneUnusedLayers(t){let i={};for(let r in t.forEach(t=>{i[t]=!0}),this.layerIndexes)i[r]||delete this.layerIndexes[r]}}var tn="void main() {fragColor=vec4(1.0);}";let ts={prelude:to("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const 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\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);
2return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);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;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:to("","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:to("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float 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); \nif (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\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {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:to("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:to("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;
2uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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:to("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 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) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:to(tn,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:to("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 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);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:to("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;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:to("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:to("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:to("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {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\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;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:to("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:to(tn,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:to("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:to("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:to("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:to("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=patte
2rn_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:to("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:to("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=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;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:to("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(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
2ow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;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:to("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;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:to("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin 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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat 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);
2float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:to("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin 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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat 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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:to("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin 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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat 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);
2float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:to("uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat 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);
2float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin 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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat 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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:to("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat 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);
2float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin 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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat 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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),raster:to("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);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform 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;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:to("uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 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);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;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_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:to("#define SDF_PX 8.0\nuniform 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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_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*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 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;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);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*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;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));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:to("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform 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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
2fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;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*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 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);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:to("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);
2float 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:to("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:to("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:to("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:to("#ifdef GL_ES\nprecision highp float;\n#endif\nin vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","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:to("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);}")};
2function to(t,i){let r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=i.match(/in ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=i.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=s?s.concat(n):n,l={};return{fragmentSource:t=t.replace(r,(t,i,r,a,n)=>(l[n]=!0,"define"===i?` 3#ifndef HAS_UNIFORM_u_${n} 4in ${r} ${a} ${n}; 5#else 6uniform ${r} ${a} u_${n}; 7#endif 8`:` 9#ifdef HAS_UNIFORM_u_${n} 10 ${r} ${a} ${n} = u_${n}; 11#endif 12`)),vertexSource:i=i.replace(r,(t,i,r,a,n)=>{let s="float"===a?"vec2":"vec4",o=n.match(/color/)?"color":s;return l[n]?"define"===i?` 13#ifndef HAS_UNIFORM_u_${n} 14uniform lowp float u_${n}_t; 15in ${r} ${s} a_${n}; 16out ${r} ${a} ${n}; 17#else 18uniform ${r} ${a} u_${n}; 19#endif 20`:"vec4"===o?` 21#ifndef HAS_UNIFORM_u_${n} 22 ${n} = a_${n}; 23#else 24 ${r} ${a} ${n} = u_${n}; 25#endif 26`:` 27#ifndef HAS_UNIFORM_u_${n} 28 ${n} = unpack_mix_${o}(a_${n}, u_${n}_t); 29#else 30 ${r} ${a} ${n} = u_${n}; 31#endif 32`:"define"===i?` 33#ifndef HAS_UNIFORM_u_${n} 34uniform lowp float u_${n}_t; 35in ${r} ${s} a_${n}; 36#else 37uniform ${r} ${a} u_${n}; 38#endif 39`:"vec4"===o?` 40#ifndef HAS_UNIFORM_u_${n} 41 ${r} ${a} ${n} = a_${n}; 42#else 43 ${r} ${a} ${n} = u_${n}; 44#endif 45`:` 46#ifndef HAS_UNIFORM_u_${n} 47 ${r} ${a} ${n} = unpack_mix_${o}(a_${n}, u_${n}_t); 48#else 49 ${r} ${a} ${n} = u_${n}; 50#endif 51`}),staticAttributes:a,staticUniforms:o}}class tl{constructor(t,i,r){this.vertexBuffer=t,this.indexBuffer=i,this.segments=r}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var th=i.aU([{name:"a_pos",type:"Int16",components:2}]);let tu="#define PROJECTION_MERCATOR",tc="mercator";class td{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return tc}get shaderDefine(){return tu}get shaderPreludeCode(){return ts.projectionMercator}get vertexShaderPreludeCode(){return ts.projectionMercator.vertexSource}get subdivisionGranularity(){return i.aV.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,r,a,n,s){if(this._cachedMesh)return this._cachedMesh;let o=new i.aW;o.emplaceBack(0,0),o.emplaceBack(i.a5,0),o.emplaceBack(0,i.a5),o.emplaceBack(i.a5,i.a5);let l=t.createVertexBuffer(o,th.members),h=i.aX.simpleSegment(0,0,4,2),u=new i.aY;u.emplaceBack(1,0,2),u.emplaceBack(1,2,3);let c=t.createIndexBuffer(u);return this._cachedMesh=new tl(l,c,h),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class tp{constructor(t=0,i=0,r=0,a=0){if(isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=i,this.left=r,this.right=a}interpolate(t,r,a){return null!=r.top&&null!=t.top&&(this.top=i.G.number(t.top,r.top,a)),null!=r.bottom&&null!=t.bottom&&(this.bottom=i.G.number(t.bottom,r.bottom,a)),null!=r.left&&null!=t.left&&(this.left=i.G.number(t.left,r.left,a)),null!=r.right&&null!=t.right&&(this.right=i.G.number(t.right,r.right,a)),this}getCenter(t,r){let a=i.an((this.left+t-this.right)/2,0,t),n=i.an((this.top+r-this.bottom)/2,0,r);return new i.P(a,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new tp(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function tf(t,i){if(!t.renderWorldCopies||t.lngRange)return;let r=i.lng-t.center.lng;i.lng+=r>180?-360:360*(r<-180)}function tm(t){return Math.max(0,Math.floor(t))}class t_{constructor(t,r){var a;this.applyConstrain=(t,i)=>null!==this._constrainOverride?this._constrainOverride(t,i):this._callbacks.defaultConstrain(t,i),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=void 0===(null==r?void 0:r.renderWorldCopies)||!!(null==r?void 0:r.renderWorldCopies),this._minZoom=(null==r?void 0:r.minZoom)||0,this._maxZoom=(null==r?void 0:r.maxZoom)||22,this._minPitch=null==(null==r?void 0:r.minPitch)?0:null==r?void 0:r.minPitch,this._maxPitch=null==(null==r?void 0:r.maxPitch)?60:null==r?void 0:r.maxPitch,this._constrainOverride=null!=(a=null==r?void 0:r.constrainOverride)?a:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new i.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=tm(this._zoom),this._scale=i.aq(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new tp,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,r,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=tm(this._zoom),this._scale=i.aq(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 tp(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,r&&this.constrainInternal(),this._calcMatrices()}
51get 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){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){void 0===t&&(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 i.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){var r,a,n,s,o,l,h,u,c;let d=i.W(t,-180,180)*Math.PI/180;this._bearingInRadians!==d&&(this._unmodified=!1,this._bearingInRadians=d,this._calcMatrices(),this._rotationMatrix=g(),r=this._rotationMatrix,n=-this._bearingInRadians,s=(a=this._rotationMatrix)[0],o=a[1],l=a[2],h=a[3],u=Math.sin(n),c=Math.cos(n),r[0]=s*c+l*u,r[1]=o*c+h*u,r[2]=-(s*u)+l*c,r[3]=-(o*u)+h*c)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){let r=i.an(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==r&&(this._unmodified=!1,this._pitchInRadians=r,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){let i=t/180*Math.PI;this._rollInRadians!==i&&(this._unmodified=!1,this._rollInRadians=i,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return i.aZ(this._fovInRadians)}setFov(t){t=i.an(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=i.ap(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){let r=this.applyConstrain(this._center,t).zoom;this._zoom!==r&&(this._unmodified=!1,this._zoom=r,this._tileZoom=Math.max(0,Math.floor(r)),this._scale=i.aq(r),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,i){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=i,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,i,r){this._unmodified=!1,this._edgeInsets.interpolate(t,i,r),this.constrainInternal(),this._calcMatrices()}resize(t,i,r=!0){this._width=t,this._height=i,r&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new Y([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=[-i.ao,i.ao])}getCameraQueryGeometry(t,r){if(1===r.length)return[r[0],t];{let{minX:a,minY:n,maxX:s,maxY:o}=i.aa.fromPoints(r).extend(t);return[new i.P(a,n),new i.P(s,n),new i.P(s,o),new i.P(a,o),new i.P(a,n)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let t=this._unmodified,{center:i,zoom:r}=this.applyConstrain(this.center,this.zoom);this.setCenter(i),this.setZoom(r),this._unmodified=t,this._constraining=!1}
51_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=i.ar(new Float64Array(16));i.Q(t,t,[this._width/2,-this._height/2,1]),i.O(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=i.ar(new Float64Array(16)),i.Q(t,t,[1,-1,1]),i.O(t,t,[-1,-1,0]),i.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,r,a,n){let s=void 0!==a?a:this.bearing,o=n=void 0!==n?n:this.pitch,{distanceToCenter:l,clampedElevation:h}=this._distanceToCenterFromAltElevationPitch(r,this.elevation,o),{x:u,y:c}=ev(o,s),d=i.a9.fromLngLat(t,r),p,f,m=i.a_(1,d.y),_=0;do{if((_+=1)>10)break;f=l/m,m=1/(p=new i.a9(d.x+u*f,d.y+c*f)).meterInMercatorCoordinateUnits()}while(Math.abs(l-f*m)>1e-12);return{center:p.toLngLat(),elevation:h,zoom:i.at(this.height/2/Math.tan(this.fovInRadians/2)/f/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;let r=1/this.worldSize,a=i.as(1,this.center.lat)*this.worldSize,n=i.a9.fromLngLat(this.center,this.elevation),s=n.x/r,o=n.y/r,l=n.z/r,h=this.pitch,{x:u,y:c,z:d}=ev(h,this.bearing),p=this.cameraToCenterDistance,{distanceToCenter:f,clampedElevation:m}=this._distanceToCenterFromAltElevationPitch((l+p*d)/a,t,h),_=f*a,g=new i.a9((s+-(p*u)+u*_)*r,(o+-(p*c)+c*_)*r,0).toLngLat(),y=i.as(1,g.lat),x=i.at(this.height/2/Math.tan(this.fovInRadians/2)/f/y/this.tileSize);this._elevation=m,this._center=g,this.setZoom(x)}_distanceToCenterFromAltElevationPitch(t,r,a){let n=-Math.cos(i.ap(a)),s=t-r,o,l=r;return n*s>=0||.1>Math.abs(n)?l=t+(o=1e4)*n:o=-s/n,{distanceToCenter:o,clampedElevation:l}}getCameraPoint(){let t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let t=i.as(1,this.center.lat)*this.worldSize;return ex(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];let r=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/r,t.canonical.y/r,1/r/i.a5,1/r/i.a5]}}class tg{constructor(t,r){this.min=t,this.max=r,this.center=i.a$([],i.b0([],this.min,this.max),.5)}quadrant(t){let r=[t%2==0,t<2],a=i.b1(this.min),n=i.b1(this.max);for(let t=0;t<r.length;t++)a[t]=r[t]?this.min[t]:this.center[t],n[t]=r[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new tg(a,n)}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 i=!0;for(let r=0;r<t.planes.length;r++){let a=this.intersectsPlane(t.planes[r]);if(0===a)return 0;1===a&&(i=!1)}return i?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 i=t[3],r=t[3];for(let a=0;a<3;a++)t[a]>0?(i+=t[a]*this.min[a],r+=t[a]*this.max[a]):(r+=t[a]*this.min[a],i+=t[a]*this.max[a]);return i>=0?2:r<0?0:1}}class ty{distanceToTile2d(t,i,r,a){return Math.hypot(a.distanceX([t,i]),a.distanceY([t,i]))}getWrap(t,i,r){return r}getTileBoundingVolume(t,r,a,n){var s,o;let l=0,h=0;if(null==n?void 0:n.terrain){let u=new i.a2(t.z,r,t.z,t.x,t.y),c=n.terrain.getMinMaxElevation(u);l=null!=(s=c.minElevation)?s:Math.min(0,a),h=null!=(o=c.maxElevation)?o:Math.max(0,a)}let u=1<<t.z;return new tg([r+t.x/u,t.y/u,l],[r+(t.x+1)/u,(t.y+1)/u,h])}allowVariableZoom(t,r){let a=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,n=i.an(78.5-a/2,0,60);return!!r.terrain||t.pitch>n}allowWorldCopies(){return!0}prepareNextFrame(){}}class tx{constructor(t,i,r){this.points=t,this.planes=i,this.aabb=r}static fromInvProjectionMatrix(t,r=1,a=0,n,s){let o=s?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=Math.pow(2,a),h=[[-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=>{let n,s;return s=1/(n=i.aH([],a,t))[3]/r*l,i.b6(n,n,[s,s,1/n[3],s])});n&&function(t,r,a,n){let s,o,l,h=4*!!n,u=4*!n,c=0,d=[],p=[];for(let r=0;r<4;r++){let a=i.b2([],t[r+u],t[r+h]),n=i.b7(a);i.a$(a,a,1/n),d.push(n),p.push(a)}for(let r=0;r<4;r++){let n=i.b8(t[r+h],p[r],a);c=null!==n&&n>=0?Math.max(c,n):Math.max(c,d[r])}let f=(s=i.b2([],t[r[0]],t[r[1]]),o=i.b2([],t[r[2]],t[r[1]]),l=[0,0,0,0],i.b3(l,i.b4([],s,o)),l[3]=-i.b5(l,t[r[0]]),l),m=function(t,r){let a=i.b9(t),n=i.ba([],t,1/a),s=i.b2([],r,i.a$([],n,i.b5(r,n))),o=i.b9(s);if(o>0){let t=Math.sqrt(1-n[3]*n[3]),a=i.a$([],n,-n[3]),l=i.b0([],a,i.a$([],s,t/o));return i.bb(r,l)}return null}(a,f);null!==m&&(c=Math.min(c,m/i.b5(p[0],f)));for(let i=0;i<4;i++){let r=Math.min(c,d[i]);t[i+u]=[t[i+h][0]+p[i][0]*r,t[i+h][1]+p[i][1]*r,t[i+h][2]+p[i][2]*r,1]}}(h,o[0],n,s);let u=o.map(t=>{let r=i.b2([],h[t[0]],h[t[1]]),a=i.b2([],h[t[2]],h[t[1]]),n=i.b3([],i.b4([],r,a)),s=-i.b5(n,h[t[1]]);return n.concat(s)}),c=[1/0,1/0,1/0],d=[-1/0,-1/0,-1/0];for(let t of h)for(let i=0;i<3;i++)c[i]=Math.min(c[i],t[i]),d[i]=Math.max(d[i],t[i]);return new tx(h,u,new tg(c,d))}}
51class tv{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,i,r){return this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}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,i){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(t,r)=>{let a,n;r=i.an(+r,this.minZoom,this.maxZoom);let s={center:new i.V(t.lng,t.lat),zoom:r},o=this._helper._lngRange;this._helper._renderWorldCopies||null!==o||(o=[-(180-1e-10),180-1e-10]);let l=this.tileSize*i.aq(s.zoom),h=0,u=l,c=0,d=l,p=0,f=0,{x:m,y:_}=this.size;if(this._helper._latRange){let t=this._helper._latRange;h=i.X(t[1])*l,(u=i.X(t[0])*l)-h<_&&(p=_/(u-h))}o&&(c=i.W(i.Y(o[0])*l,0,l),(d=i.W(i.Y(o[1])*l,0,l))<c&&(d+=l),d-c<m&&(f=m/(d-c)));let{x:g,y:y}=em(l,t),x=Math.max(f||0,p||0);if(x)return s.center=e_(l,new i.P(f?(d+c)/2:g,p?(u+h)/2:y)).wrap(),s.zoom+=i.at(x),s;if(this._helper._latRange){let t=_/2;y-t<h&&(n=h+t),y+t>u&&(n=u-t)}if(o){let t=(c+d)/2,r=g;
51this._helper._renderWorldCopies&&(r=i.W(g,t-l/2,t+l/2));let n=m/2;r-n<c&&(a=c+n),r+n>d&&(a=d-n)}return(void 0!==a||void 0!==n)&&(s.center=e_(l,new i.P(null!=a?a:g,null!=n?n:y)).wrap()),s},this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=new t_({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},t),this._coveringTilesDetailsProvider=new ty}clone(){let t=new tv;return t.apply(this,!1),t}apply(t,i,r){this._helper.apply(t,i,r)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let r=[new i.bc(0,t)];if(this._helper._renderWorldCopies){let a=this.screenPointToMercatorCoordinate(new i.P(0,0)),n=this.screenPointToMercatorCoordinate(new i.P(this._helper._width,0)),s=this.screenPointToMercatorCoordinate(new i.P(this._helper._width,this._helper._height)),o=this.screenPointToMercatorCoordinate(new i.P(0,this._helper._height)),l=Math.floor(Math.min(a.x,n.x,s.x,o.x)),h=Math.floor(Math.max(a.x,n.x,s.x,o.x));for(let a=l-1;a<=h+1;a++)0!==a&&r.push(new i.bc(a,t))}return r}getCameraFrustum(){return tx.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let i=this.screenPointToLocation(this.centerPoint,t),r=t?t.getElevationForLngLatZoom(i,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(t,r){let a=i.as(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(r,a),s=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,a),o=i.a9.fromLngLat(t),l=new i.a9(o.x-(n.x-s.x),o.y-(n.y-s.y));this.setCenter(null==l?void 0:l.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,r){return r?this.coordinatePoint(i.a9.fromLngLat(t),r.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(i.a9.fromLngLat(t))}screenPointToLocation(t,i){var r;return null==(r=this.screenPointToMercatorCoordinate(t,i))?void 0:r.toLngLat()}screenPointToMercatorCoordinate(t,i){if(i){let r=i.pointCoordinate(t);if(null!=r)return r}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,r){let a=r||0,n=[t.x,t.y,0,1],s=[t.x,t.y,1,1];i.aH(n,n,this._pixelMatrixInverse),i.aH(s,s,this._pixelMatrixInverse);let o=n[3],l=s[3],h=n[1]/o,u=s[1]/l,c=n[2]/o,d=s[2]/l,p=c===d?0:(a-c)/(d-c);return new i.a9(i.G.number(n[0]/o,s[0]/l,p)/this.worldSize,i.G.number(h,u,p)/this.worldSize,a)}coordinatePoint(t,r=0,a=this._pixelMatrix){let n=[t.x*this.worldSize,t.y*this.worldSize,r,1];return i.aH(n,n,a),new i.P(n[0]/n[3],n[1]/n[3])}getBounds(){let t=Math.max(0,this._helper._height/2-eg(this));return(new Y).extend(this.screenPointToLocation(new i.P(0,t))).extend(this.screenPointToLocation(new i.P(this._helper._width,t))).extend(this.screenPointToLocation(new i.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new i.P(0,this._helper._height)))}isPointOnMapSurface(t,i){return i?null!=i.pointCoordinate(t):t.y>this.height/2-eg(this)}calculatePosMatrix(t,r=!1,a){var n;let s=null!=(n=t.key)?n:i.bd(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),o=r?this._alignedPosMatrixCache:this._posMatrixCache;if(o.has(s)){let t=o.get(s);return a?t.f32:t.f64}let l=ey(t,this.worldSize);i.S(l,r?this._alignedProjMatrix:this._viewProjMatrix,l);let h={f64:l,f32:new Float32Array(l)};return o.set(s,h),a?h.f32:h.f64}calculateFogMatrix(t){let r=t.key,a=this._fogMatrixCacheF32;if(a.has(r))return a.get(r);let n=ey(t,this.worldSize);return i.S(n,this._fogMatrix,n),a.set(r,new Float32Array(n)),a.get(r)}calculateCenterFromCameraLngLatAlt(t,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,a)}_calculateNearFarZIfNeeded(t,r,a){if(!this._helper.autoCalculateNearFarZ)return;let n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),s=t-n*this._helper._pixelPerMeter/Math.cos(r),o=n<0?s:t,l=Math.PI/2+this.pitchInRadians,h=i.ap(this.fov)*(Math.abs(Math.cos(i.ap(this.roll)))*this.height+Math.abs(Math.sin(i.ap(this.roll)))*this.width)/this.height*(.5+a.y/this.height),u=Math.sin(h)*o/Math.sin(i.an(Math.PI-l-h,.01,Math.PI-.01)),c=eg(this),d=Math.atan(c/this._helper.cameraToCenterDistance),p=i.ap(.75),f=d>p?2*d*(.5+a.y/(2*c)):p,m=Math.min(u,Math.sin(f)*o/Math.sin(i.an(Math.PI-l-f,.01,Math.PI-.01)));
51this._helper._farZ=1.01*(Math.cos(Math.PI/2-r)*m+o),this._helper._nearZ=this._helper._height/50}_calcMatrices(){let t;if(!this._helper._height)return;let r=this.centerOffset,a=em(this.worldSize,this.center),n=a.x,s=a.y;this._helper._pixelPerMeter=i.as(1,this.center.lat)*this.worldSize;let o=i.ap(Math.min(this.pitch,89.25)),l=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));this._calculateNearFarZIfNeeded(l,o,r),t=new Float64Array(16),i.be(t,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),i.aB(this._invProjMatrix,t),t[8]=-(2*r.x)/this._helper._width,t[9]=2*r.y/this._helper._height,this._projectionMatrix=i.bf(t),i.Q(t,t,[1,-1,1]),i.O(t,t,[0,0,-this._helper.cameraToCenterDistance]),i.bg(t,t,-this.rollInRadians),i.bh(t,t,this.pitchInRadians),i.bg(t,t,-this.bearingInRadians),i.O(t,t,[-n,-s,0]),this._mercatorMatrix=i.Q([],t,[this.worldSize,this.worldSize,this.worldSize]),i.Q(t,t,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=i.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,t),i.O(t,t,[0,0,-this.elevation]),this._viewProjMatrix=t,this._invViewProjMatrix=i.aB([],t);let h=[0,0,-1,1];i.aH(h,h,this._invViewProjMatrix),this._cameraPosition=[h[0]/h[3],h[1]/h[3],h[2]/h[3]],this._fogMatrix=new Float64Array(16),i.be(this._fogMatrix,this.fovInRadians,this.width/this.height,l,this._helper._farZ),this._fogMatrix[8]=-(2*r.x)/this.width,this._fogMatrix[9]=2*r.y/this.height,i.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),i.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),i.bg(this._fogMatrix,this._fogMatrix,-this.rollInRadians),i.bh(this._fogMatrix,this._fogMatrix,this.pitchInRadians),i.bg(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),i.O(this._fogMatrix,this._fogMatrix,[-n,-s,0]),i.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),i.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=i.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,t);let u=this._helper._width%2/2,c=this._helper._height%2/2,d=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),f=n-Math.round(n)+d*u+p*c,m=s-Math.round(s)+d*c+p*u,_=new Float64Array(t);if(i.O(_,_,[f>.5?f-1:f,m>.5?m-1:m,0]),this._alignedProjMatrix=_,!(t=i.aB(new Float64Array(16),this._pixelMatrix)))throw Error("failed to invert matrix");this._pixelMatrixInverse=t,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new i.P(0,0)),r=[t.x*this.worldSize,t.y*this.worldSize,0,1];return i.aH(r,r,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let t=i.as(1,this.center.lat)*this.worldSize;return ex(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,r){let a=i.a9.fromLngLat(t),n=[a.x*this.worldSize,a.y*this.worldSize,r,1];return i.aH(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(t){let r,{overscaledTileID:a,aligned:n,applyTerrainMatrix:s}=t,o=this._helper.getMercatorTileCoordinates(a),l=a?this.calculatePosMatrix(a,n,!0):null;return{mainMatrix:r=a&&a.terrainRttPosMatrix32f&&s?a.terrainRttPosMatrix32f:l||i.bi(),tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,i,r){return 1}transformLightDirection(t){return i.b1(t)}getRayDirectionFromPixel(t){throw Error("Not implemented.")}projectTileCoordinates(t,r,a,n){let s,o=this.calculatePosMatrix(a);n?(s=[t,r,n(t,r),1],i.aH(s,s,o)):eY(s=[t,r,0,1],s,o);let l=s[3];return{point:new i.P(s[0]/l,s[1]/l),signedDistanceFromCamera:l,isOccluded:!1}}populateCache(t){for(let i of t)this.calculatePosMatrix(i)}getMatrixForModel(t,r){let a=i.a9.fromLngLat(t,r),n=a.meterInMercatorCoordinateUnits(),s=i.bj();return i.O(s,s,[a.x,a.y,a.z]),i.bg(s,s,Math.PI),i.bh(s,s,Math.PI/2),i.Q(s,s,[-n,n,n]),s}getProjectionDataForCustomLayer(t=!0){let r=new i.a2(0,0,0,0,0),a=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:t}),n=ey(r,this.worldSize);i.S(n,this._viewProjMatrix,n),a.tileMercatorCoords=[0,0,1,1];let s=[i.a5,i.a5,this.worldSize/this._helper.pixelsPerMeter],o=i.bk();return i.Q(o,n,s),a.fallbackMatrix=o,a.mainMatrix=o,a}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function tb(){i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function tw(t){if(t.useSlerp)if(t.k<1){let r=i.bl(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),a=i.bl(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),n=new Float64Array(4);i.bm(n,r,a,t.k);let s=i.bn(n);t.tr.setRoll(s.roll),t.tr.setPitch(s.pitch),t.tr.setBearing(s.bearing)}else t.tr.setRoll(t.endEulerAngles.roll),t.tr.setPitch(t.endEulerAngles.pitch),t.tr.setBearing(t.endEulerAngles.bearing);else t.tr.setRoll(i.G.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(i.G.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(i.G.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k))}function tT(t,r,a,n,s){let o=s.padding,l=em(s.worldSize,a.getNorthWest()),h=em(s.worldSize,a.getNorthEast()),u=em(s.worldSize,a.get
51SouthEast()),c=em(s.worldSize,a.getSouthWest()),d=i.ap(-n),p=l.rotate(d),f=h.rotate(d),m=u.rotate(d),_=c.rotate(d),g=new i.P(Math.max(p.x,f.x,_.x,m.x),Math.max(p.y,f.y,_.y,m.y)),y=new i.P(Math.min(p.x,f.x,_.x,m.x),Math.min(p.y,f.y,_.y,m.y)),x=g.sub(y),v=(s.width-(o.left+o.right+r.left+r.right))/x.x,b=(s.height-(o.top+o.bottom+r.top+r.bottom))/x.y;if(b<0||v<0)return void tb();let w=Math.min(i.at(s.scale*Math.min(v,b)),t.maxZoom),T=i.P.convert(t.offset),S=new i.P((r.left-r.right)/2,(r.top-r.bottom)/2).rotate(i.ap(n)),P=T.add(S).mult(s.scale/i.aq(w));return{center:e_(s.worldSize,l.add(u).div(2).sub(P)),zoom:w,bearing:n}}class tS{get useGlobeControls(){return!1}handlePanInertia(t,i){let r=t.mag(),a=Math.abs(eg(i));return{easingOffset:t.mult(Math.min(.75*a/r,1)),easingCenter:i.center}}handleMapControlsRollPitchBearingZoom(t,i){t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta),t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta)}handleMapControlsPan(t,i,r){.01>t.around.distSqr(i.centerPoint)||i.setLocationAtPoint(r,t.around)}cameraForBoxAndBearing(t,i,r,a,n){return tT(t,i,r,a,n)}handleJumpToCenterZoom(t,r){t.zoom!==(void 0!==r.zoom?+r.zoom:t.zoom)&&t.setZoom(+r.zoom),void 0!==r.center&&t.setCenter(i.V.convert(r.center))}handleEaseTo(t,r){let a=t.zoom,n=t.padding,s={roll:t.roll,pitch:t.pitch,bearing:t.bearing},o={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},l=void 0!==r.zoom,h=!t.isPaddingEqual(r.padding),u=!1,c=l?+r.zoom:t.zoom,d=t.centerPoint.add(r.offsetAsPoint),p=t.screenPointToLocation(d),{center:f,zoom:m}=t.applyConstrain(i.V.convert(r.center||p),null!=c?c:a);tf(t,f);let _=em(t.worldSize,p),g=em(t.worldSize,f).sub(_),y=i.aq(m-a);return{easeFunc:l=>{if(u&&t.setZoom(i.G.number(a,m,l)),i.bo(s,o)||tw({startEulerAngles:s,endEulerAngles:o,tr:t,k:l,useSlerp:s.roll!=o.roll}),h&&(t.interpolatePadding(n,r.padding,l),d=t.centerPoint.add(r.offsetAsPoint)),r.around)t.setLocationAtPoint(r.around,r.aroundPoint);else{let r=i.aq(t.zoom-a),n=Math.pow(m>a?Math.min(2,y):Math.max(.5,y),1-l),s=e_(t.worldSize,_.add(g.mult(l*n)).mult(r));t.setLocationAtPoint(t.renderWorldCopies?s.wrap():s,d)}},isZooming:u=m!==a,elevationCenter:f}}handleFlyTo(t,r){let a,n=void 0!==r.zoom,s=t.zoom,o=t.applyConstrain(i.V.convert(r.center||r.locationAtOffset),n?+r.zoom:s),l=o.center,h=o.zoom;tf(t,l);let u=em(t.worldSize,r.locationAtOffset),c=em(t.worldSize,l).sub(u),d=c.mag(),p=i.aq(h-s);if(void 0!==r.minZoom){let n=Math.min(+r.minZoom,s,h),o=t.applyConstrain(l,n).zoom;a=i.aq(o-s)}return{easeFunc:(r,a,n,o)=>{t.setZoom(1===r?h:s+i.at(a));let d=1===r?l:e_(t.worldSize,u.add(c.mult(n)).mult(a));t.setLocationAtPoint(t.renderWorldCopies?d.wrap():d,o)},scaleOfZoom:p,targetCenter:l,scaleOfMinZoom:a,pixelPathLength:d}}}class tP{constructor(t,i,r){this.blendFunction=t,this.blendColor=i,this.mask=r}}tP.Replace=[1,0],tP.disabled=new tP(tP.Replace,i.bp.transparent,[!1,!1,!1,!1]),tP.unblended=new tP(tP.Replace,i.bp.transparent,[!0,!0,!0,!0]),tP.alphaBlended=new tP([1,771],i.bp.transparent,[!0,!0,!0,!0]);class tM{constructor(t,i,r){this.enable=t,this.mode=i,this.frontFace=r}}tM.disabled=new tM(!1,1029,2305),tM.backCCW=new tM(!0,1029,2305),tM.frontCCW=new tM(!0,1028,2305);class tI{constructor(t,i,r){this.func=t,this.mask=i,this.range=r}}tI.ReadOnly=!1,tI.ReadWrite=!0,tI.disabled=new tI(519,tI.ReadOnly,[0,1]);class tE{constructor(t,i,r,a,n,s){this.test=t,this.ref=i,this.mask=r,this.fail=a,this.depthFail=n,this.pass=s}}tE.disabled=new tE({func:519,mask:0},0,0,7680,7680,7680);let tC=new WeakMap;function tA(t){var i;if(tC.has(t))return tC.get(t);{let r=null==(i=t.getParameter(t.VERSION))?void 0:i.startsWith("WebGL 2.0");return tC.set(t,r),r}}class tD{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 r=t.context,a=r.gl;this._texFormat=a.RGBA,this._texType=a.UNSIGNED_BYTE;const n=new i.aW;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);const s=new i.aY;s.emplaceBack(0,1,2),this._fullscreenTriangle=new tl(r.createVertexBuffer(n,th.members),r.createIndexBuffer(s),i.aX.simpleSegment(0,0,n.length,s.length)),this._resultBuffer=new Uint8Array(4),r.activeTexture.set(a.TEXTURE1);const o=a.createTexture();a.bindTexture(a.TEXTURE_2D,o),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=r.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(o),tA(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(){let 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,i){let r=this._updateCount;return this._readbackQueue?r>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():r>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,i),this._updateCount++,this._measuredError}_bindFramebuffer(){let t=this._cachedRenderContext.context,i=t.gl;t.activeTexture.set(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,r){let a=this._cachedRenderContext.context,n=a.gl;if(this._bindFramebuffer(),a.viewport.set([0,0,this._texWidth,this._texHeight]),a.clear({color:i.bp.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(a,n.TRIANGLES,tI.disabled,tE.disabled,tP.unblended,tM.disabled,{u_input:t,u_output_expected:r},null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&tA(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);let t=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:t}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&tA(t)){let r=t.clientWaitSync(this._readbackQueue.sync,0,0);if(r===t.WAIT_FAILED)return i.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(r===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=tD._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let i;return i=0+(t[0]/256+t[1]/65536+t[2]/0x1000000),t[3]<127&&(i=-i),i/128}}let tz=i.a5/128;function tk(t,r){let a=void 0!==t.granularity?Math.max(t.granularity,1):1,n=a+2*!!t.generateBorders,s=a+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),o=n+1,l=s+1,h=t.generateBorders?-1:0,u=t.generateBorders||t.extendToNorthPole?-1:0,c=a+ +!!t.generateBorders,d=a+(t.generateBorders||t.extendToSouthPole?1:0),p=n*s*6,f=o*l>65536;if(f&&"16bit"===r)throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");
51let m=f||"32bit"===r,_=new Int16Array(o*l*2),g=0;for(let r=u;r<=d;r++)for(let n=h;n<=c;n++){let s=n/a*i.a5;-1===n&&(s=-tz),n===a+1&&(s=i.a5+tz);let o=r/a*i.a5;-1===r&&(o=t.extendToNorthPole?i.br:-tz),r===a+1&&(o=t.extendToSouthPole?i.bs:i.a5+tz),_[g++]=s,_[g++]=o}let y=m?new Uint32Array(p):new Uint16Array(p),x=0;for(let t=0;t<s;t++)for(let i=0;i<n;i++){let r=i+1+t*o,a=i+(t+1)*o,n=i+1+(t+1)*o;y[x++]=i+t*o,y[x++]=a,y[x++]=r,y[x++]=r,y[x++]=a,y[x++]=n}return{vertices:_.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:m}}let tR=new i.aV({fill:new i.bt(128,2),line:new i.bt(512,0),tile:new i.bt(128,32),stencil:new i.bt(128,1),circle:3});class tL{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 ts.projectionGlobe}get vertexShaderPreludeCode(){return ts.projectionMercator.vertexSource}get subdivisionGranularity(){return tR}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new tD(t));let r=i.X(this._errorQueryLatitudeDegrees),a=2*Math.atan(Math.exp(Math.PI-r*Math.PI*2))-.5*Math.PI,n=this._errorMeasurement.updateErrorLoop(r,a),s=v();n!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=n,this._errorMeasurementLastChangeTime=s);let o=Math.min(Math.max((s-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=i.bu(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,i.bv(o))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,i,r,a,n){let s=("stencil"===n?tR.stencil:tR.tile).getGranularityForZoomLevel(i.z);return this._getMesh(t,{granularity:s,generateBorders:r,extendToNorthPole:0===i.y&&a,extendToSouthPole:i.y===(1<<i.z)-1&&a})}_getMesh(t,r){let a,n,s,o=this._getMeshKey(r);if(o in this._tileMeshCache)return this._tileMeshCache[o];let l=(a=tk(r,"16bit"),n=i.aW.deserialize({arrayBuffer:a.vertices,length:a.vertices.byteLength/2/2}),s=i.aY.deserialize({arrayBuffer:a.indices,length:a.indices.byteLength/2/3}),new tl(t.createVertexBuffer(n,th.members),t.createIndexBuffer(s),i.aX.simpleSegment(0,0,n.length,s.length)));return this._tileMeshCache[o]=l,l}recalculate(t){}hasTransition(){let t=v();return(t-this._errorMeasurementLastChangeTime)/1e3<.7||this._errorMeasurement&&this._errorMeasurement.awaitingQuery}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}let tF=new i.t({type:new i.D(i.u.projection.type)});class tB extends i.E{constructor(t){super(),this._transitionable=new i.x(tF,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new i.H(0)),this._mercatorProjection=new td,this._verticalPerspectiveProjection=new tL}get transitionState(){let t=this.properties.get("type");if("string"==typeof t&&"mercator"===t)return 0;if("string"==typeof t&&"vertical-perspective"===t)return 1;if(t instanceof i.bw){if("vertical-perspective"===t.from&&"mercator"===t.to)return 1-t.transition;if("mercator"===t.from&&"vertical-perspective"===t.to)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,i,r,a,n){return this.currentProjection.getMeshFromTileID(t,i,r,a,n)}setProjection(t){this._transitionable.setValue("type",(null==t?void 0: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 tO(t){return 2*Math.PI*tN(t.worldSize,t.center.lat)}function tV(t,r,a,n,s){let o=1/(1<<s),l=r/i.a5*o+n*o,h=i.by((t/i.a5*o+a*o)*Math.PI*2+Math.PI,2*Math.PI),u=2*Math.atan(Math.exp(Math.PI-l*Math.PI*2))-.5*Math.PI,c=Math.cos(u),d=new Float64Array(3);return d[0]=Math.sin(h)*c,d[1]=Math.sin(u),d[2]=Math.cos(h)*c,d}function tj(t){var i,r;let a,n;return i=t.lng*Math.PI/180,a=Math.cos(r=t.lat*Math.PI/180),(n=new Float64Array(3))[0]=Math.sin(i)*a,n[1]=Math.sin(r),n[2]=Math.cos(i)*a,n}function tN(t,i){return t/(2*Math.PI)/Math.cos(i*Math.PI/180)}function tU(t){let r=Math.asin(t[1])/Math.PI*180,a=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(a>1e-6){let n=t[0]/a,s=Math.acos(t[2]/a),o=(n>0?s:-s)/Math.PI*180;return new i.V(i.W(o,-180,180),r)}return new i.V(0,r)}function tG(t){return Math.cos(t*Math.PI/180)}function tq(t,r){let a=tG(t),n=tG(r);return i.at(n/a)}function tZ(t,r){let a=t.rotate(r.bearingInRadians),n=r.zoom+tq(r.center.lat,0),s=i.bu(1/tG(r.center.lat),1/tG(Math.min(Math.abs(r.center.lat),60)),i.bx(n,7,3,0,1)),o=360/tO({worldSize:r.worldSize,center:{lat:r.center.lat}});return new i.V(r.center.lng-a.x*o*s,i.an(r.center.lat+a.y*o,-i.ao,i.ao))}function t$(t){let i=.5*t,r=Math.sin(i),a=Math.cos(i);return Math.log(r+a)-Math.log(a-r)}function tW(t,r,a,n){let s=t.lat+a*n;if(Math.abs(a)>1){let o=(Math.sign(t.lat+a)!==Math.sign(t.lat)?-Math.abs(t.lat):Math.abs(t.lat))*Math.PI/180,l=Math.abs(t.lat+a)*Math.PI/180,h=t$(o+n*(l-o)),u=t$(o),c=t$(l);return new i.V(t.lng+(h-u)/(c-u)*r,s)}return new i.V(t.lng+r*n,s)}class tH{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;let t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,i,r,a){let n=`${t.z}_${t.x}_${t.y}_${(null==a?void 0:a.terrain)?"t":""}`,s=this._cache.get(n);if(s)return s;let o=this._cachePrevious.get(n);if(o)return this._cache.set(n,o),o;let l=this._boundingVolumeFactory(t,i,r,a);return this._cache.set(n,l),this._hadAnyChanges=!0,l}}class tX{constructor(t,i,r,a){this.min=r,this.max=a,this.points=t,this.planes=i}static fromAabb(t,i){let r=[];for(let a=0;a<8;a++)r.push([1&~a?t[0]:i[0],1==(a>>1&1)?i[1]:t[1],1==(a>>2&1)?i[2]:t[2]]);return new tX(r,[[-1,0,0,i[0]],[1,0,0,-t[0]],[0,-1,0,i[1]],[0,1,0,-t[1]],[0,0,-1,i[2]],[0,0,1,-t[2]]],t,i)}static fromCenterSizeAngles(t,r,a){let n=i.bB([],a[0],a[1],a[2]),s=i.bC([],[r[0],0,0],n),o=i.bC([],[0,r[1],0],n),l=i.bC([],[0,0,r[2]],n),h=[...t],u=[...t];for(let i=0;i<8;i++)for(let r=0;r<3;r++){let a=t[r]+s[r]*(1&~i?-1:1)+o[r]*(1==(i>>1&1)?1:-1)+l[r]*(1==(i>>2&1)?1:-1);h[r]=Math.min(h[r],a),u[r]=Math.max(u[r],a)}let c=[];for(let r=0;r<8;r++){let a=[...t];i.b0(a,a,i.a$([],s,1&~r?-1:1)),i.b0(a,a,i.a$([],o,1==(r>>1&1)?1:-1)),i.b0(a,a,i.a$([],l,1==(r>>2&1)?1:-1)),c.push(a)}return new tX(c,[[...s,-i.b5(s,c[0])],[...o,-i.b5(o,c[0])],[...l,-i.b5(l,c[0])],[-s[0],-s[1],-s[2],-i.b5(s,c[7])],[-o[0],-o[1],-o[2],-i.b5(o,c[7])],[-l[0],-l[1],-l[2],-i.b5(l,c[7])]],h,u)}intersectsFrustum(t){let i=!0,r=this.points.length,a=this.planes.length,n=t.planes.length,s=t.points.length;for(let a=0;a<n;a++){let n=t.planes[a],s=0;for(let t=0;t<r;t++){let i=this.points[t];n[0]*i[0]+n[1]*i[1]+n[2]*i[2]+n[3]>=0&&s++}if(0===s)return 0;s<r&&(i=!1)}if(i)return 2;for(let i=0;i<a;i++){let r=this.planes[i],a=0;for(let i=0;i<s;i++){let n=t.points[i];r[0]*n[0]+r[1]*n[1]+r[2]*n[2]+r[3]>=0&&a++}if(0===a)return 0}return 1}intersectsPlane(t){let i=this.points.length,r=0;for(let a=0;a<i;a++){let i=this.points[a];t[0]*i[0]+t[1]*i[1]+t[2]*i[2]+t[3]>=0&&r++}return r===i?2:+(0!==r)}}function tY(t,i,r){let a=t-i;return a<0?-a:Math.max(0,a-r)}function tK(t,i,r,a,n){let s=t-r;return Math.max(s<0?Math.min(-s,1+s-n):s>1?Math.min(Math.max(s-n,0),1-s):0,tY(i,a,n))}class tJ{constructor(){this._boundingVolumeCache=new tH(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,i,r,a){let n=1<<r.z,s=1/n,o=r.x/n,l=r.y/n;return Math.min(Math.min(Math.min(2,tK(t,i,o,l,s)),tK(t,i,o+.5,-l-s,s)),tK(t,i,o+.5,2-l-s,s))}getWrap(t,i,r){let a=1<<i.z,n=1/a,s=i.x/a,o=tY(t.x,s,n),l=tY(t.x,s-1,n),h=tY
51(t.x,s+1,n),u=Math.min(o,l,h);return u===h?1:u===l?-1:0}allowVariableZoom(t,i){return eS(t,i)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,i,r,a){return this._boundingVolumeCache.getTileBoundingVolume(t,i,r,a)}_computeTileBoundingVolume(t,r,a,n){var s,o;let l=0,h=0;if(null==n?void 0:n.terrain){let u=new i.a2(t.z,r,t.z,t.x,t.y),c=n.terrain.getMinMaxElevation(u);l=null!=(s=c.minElevation)?s:Math.min(0,a),h=null!=(o=c.maxElevation)?o:Math.max(0,a)}if(l/=i.bE,h/=i.bE,l+=1,h+=1,t.z<=0)return tX.fromAabb([-h,-h,-h],[h,h,h]);if(1===t.z)return tX.fromAabb([0===t.x?-h:0,0===t.y?0:-h,-h],[0===t.x?0:h,0===t.y?h:0,h]);{let r=[tV(0,0,t.x,t.y,t.z),tV(i.a5,0,t.x,t.y,t.z),tV(i.a5,i.a5,t.x,t.y,t.z),tV(0,i.a5,t.x,t.y,t.z)],a=[];for(let t of r)a.push(i.a$([],t,h));if(h!==l)for(let t of r)a.push(i.a$([],t,l));0===t.y&&a.push([0,1,0]),t.y===(1<<t.z)-1&&a.push([0,-1,0]);let n=[1,1,1],s=[-1,-1,-1];for(let t of a)for(let i=0;i<3;i++)n[i]=Math.min(n[i],t[i]),s[i]=Math.max(s[i],t[i]);let o=tV(i.a5/2,i.a5/2,t.x,t.y,t.z),u=i.b4([],[0,1,0],o);i.b3(u,u);let c=i.b4([],o,u);i.b3(c,c);let d=i.b4([],r[2],r[1]);i.b3(d,d);let p=i.b4([],r[0],r[3]);i.b3(p,p),a.push(i.a$([],o,h)),t.y>=(1<<t.z)/2&&a.push(i.a$([],tV(i.a5/2,0,t.x,t.y,t.z),h)),t.y<(1<<t.z)/2&&a.push(i.a$([],tV(i.a5/2,i.a5,t.x,t.y,t.z),h));let f=tQ(o,a),m=tQ(c,a),_=[-o[0],-o[1],-o[2],f.max],g=[o[0],o[1],o[2],-f.min],y=[-c[0],-c[1],-c[2],m.max],x=[c[0],c[1],c[2],-m.min],v=[...d,0],b=[...p,0],w=[];return 0===t.y?w.push(i.bD(b,v,_),i.bD(b,v,g)):w.push(i.bD(y,v,_),i.bD(y,v,g),i.bD(y,b,_),i.bD(y,b,g)),t.y===(1<<t.z)-1?w.push(i.bD(b,v,_),i.bD(b,v,g)):w.push(i.bD(x,v,_),i.bD(x,v,g),i.bD(x,b,_),i.bD(x,b,g)),new tX(w,[_,g,y,x,v,b],n,s)}}}function tQ(t,r){let a=1/0,n=-1/0;for(let s of r){let r=i.b5(t,s);a=Math.min(a,r),n=Math.max(n,r)}return{min:a,max:n}}class t0{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,i,r){return this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i){this._helper.resize(t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}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=i.bF(),this._projectionMatrix=i.bj(),this._globeViewProjMatrix32f=i.bi(),this._globeViewProjMatrixNoCorrection=i.bj(),this._globeViewProjMatrixNoCorrectionInverted=i.bj(),this._globeProjMatrixInverted=i.bj(),this._cameraPosition=i.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(t,r)=>{let a=i.an(t.lat,-i.ao,i.ao),n=i.an(+r,this.minZoom+tq(0,a),this.maxZoom);return{center:new i.V(t.lng,a),zoom:n}},this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=new t_({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},t),this._coveringTilesDetailsProvider=new tJ}clone(){let t=new t0;return t.apply(this,!1),t}apply(t,i,r){this._globeLatitudeErrorCorrectionRadians=r||0,this._helper.apply(t,i)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=i.bz();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:i,applyGlobeMatrix:r}=t,a=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:a,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!r,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){let r=this.pitchInRadians,a=this.cameraToCenterDistance/t,n=Math.sin(r)*a,s=Math.cos(r)*a+1,o=1/Math.sqrt(n*n+s*s)*1,l=-n,h=s,u=Math.sqrt(l*l+h*h),c=[0,l/=u,h/=u];i.bG(c,c,[0,0,0],-this.bearingInRadians),i.bH(c,c,[0,0,0],-1*this.center.lat*Math.PI/180),i.bI(c,c,[0,0,0],this.center.lng*Math.PI/180);let d=1/i.b7(c);return i.a$(c,c,d),[...c,-o*d]}isLocationOccluded(t){return!this.isSurfacePointVisible(tj(t))}transformLightDirection(t){let r=this._helper._center.lng*Math.PI/180,a=this._helper._center.lat*Math.PI/180,n=Math.cos(a),s=[Math.sin(r)*n,Math.sin(a),Math.cos(r)*n],o=[s[2],0,-s[0]],l=[0,0,0];i.b4(l,o,s),i.b3(o,o),i.b3(l,l);let h=[0,0,0];return i.b3(h,[o[0]*t[0]+l[0]*t[1]+s[0]*t[2],o[1]*t[0]+l[1]*t[1]+s[1]*t[2],o[2]*t[0]+l[2]*t[1]+s[2]*t[2]]),h}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,r,a){var n,s;
51let o,l=(o=1/(1<<(s=a.canonical).z),new i.a9(t/i.a5*o+s.x*o,r/i.a5*o+s.y*o)),h=(n=l.y,[i.by(l.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-n*Math.PI*2))-.5*Math.PI]);return this.getCircleRadiusCorrection()/Math.cos(h[1])}projectTileCoordinates(t,r,a,n){let s=a.canonical,o=tV(t,r,s.x,s.y,s.z),l=1+(n?n(t,r):0)/i.bE,h=[o[0]*l,o[1]*l,o[2]*l,1];i.aH(h,h,this._globeViewProjMatrixNoCorrection);let u=this._cachedClippingPlane,c=u[0]*o[0]+u[1]*o[1]+u[2]*o[2]+u[3]<0;return{point:new i.P(h[0]/h[3],h[1]/h[3]),signedDistanceFromCamera:h[3],isOccluded:c}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let t=tN(this.worldSize,this.center.lat),r=i.bk(),a=i.bk();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),i.be(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let n=this.centerOffset;r[8]=-(2*n.x)/this._helper._width,r[9]=2*n.y/this._helper._height,this._projectionMatrix=i.bf(r),this._globeProjMatrixInverted=i.bk(),i.aB(this._globeProjMatrixInverted,r),i.O(r,r,[0,0,-this.cameraToCenterDistance]),i.bg(r,r,this.rollInRadians),i.bh(r,r,-this.pitchInRadians),i.bg(r,r,this.bearingInRadians),i.O(r,r,[0,0,-t]);let s=i.bz();s[0]=t,s[1]=t,s[2]=t,i.bh(a,r,this.center.lat*Math.PI/180),i.bJ(a,a,-this.center.lng*Math.PI/180),i.Q(a,a,s),this._globeViewProjMatrixNoCorrection=a,i.bh(r,r,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),i.bJ(r,r,-this.center.lng*Math.PI/180),i.Q(r,r,s),this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixNoCorrectionInverted=i.bk(),i.aB(this._globeViewProjMatrixNoCorrectionInverted,a);let o=i.bz();this._cameraPosition=i.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/t,i.bG(this._cameraPosition,this._cameraPosition,o,-this.rollInRadians),i.bH(this._cameraPosition,this._cameraPosition,o,this.pitchInRadians),i.bG(this._cameraPosition,this._cameraPosition,o,-this.bearingInRadians),i.b0(this._cameraPosition,this._cameraPosition,[0,0,1]),i.bH(this._cameraPosition,this._cameraPosition,o,-this.center.lat*Math.PI/180),i.bI(this._cameraPosition,this._cameraPosition,o,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);let l=i.bf(this._globeViewProjMatrixNoCorrectionInverted);i.Q(l,l,[1,1,-1]),this._cachedFrustum=tx.fromInvProjectionMatrix(l,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){i.w("calculateFogMatrix is not supported on globe projection.");let r=i.bk();return i.ar(r),r}getVisibleUnwrappedCoordinates(t){return[new i.bc(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&i.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,r){if(!this._globeViewProjMatrixNoCorrection)return 1;let a=tj(t);i.a$(a,a,1+r/i.bE);let n=i.bF();return i.aH(n,[a[0],a[1],a[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(t){}getBounds(){let t=.5*this.width,r=.5*this.height,a=[new i.P(0,0),new i.P(t,0),new i.P(this.width,0),new i.P(this.width,r),new i.P(this.width,this.height),new i.P(t,this.height),new i.P(0,this.height),new i.P(0,r)],n=[];for(let t of a)n.push(this.unprojectScreenPoint(t));let s=0,o=0,l=0,h=0,u=this.center;for(let t of n){let r=i.bK(u.lng,t.lng),a=i.bK(u.lat,t.lat);r<o&&(o=r),r>s&&(s=r),a<h&&(h=a),a>l&&(l=a)}let c=[u.lng+o,u.lat+h,u.lng+s,u.lat+l];return this.isSurfacePointOnScreen([0,1,0])&&(c[3]=90,c[0]=-180,c[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(c[1]=-90,c[0]=-180,c[2]=180),new Y(c)}calculateCenterFromCameraLngLatAlt(t,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,a)}setLocationAtPoint(t,r){let a,n,s=tj(this.unprojectScreenPoint(r)),o=tj(t),l=i.bz();i.bL(l);let h=i.bz();i.bI(h,s,l,-this.center.lng*Math.PI/180),i.bH(h,h,l,this.center.lat*Math.PI/180);let u=o[0]*o[0]+o[2]*o[2],c=h[0]*h[0];if(u<c)return;let d=Math.sqrt(u-c),p=i.bM(o[0],o[2],h[0],d),f=i.bM(o[0],o[2],h[0],-d),m=i.bz();i.bI(m,o,l,-p);let _=i.bM(m[1],m[2],h[1],h[2]),g=i.bz();i.bI(g,o,l,-f);let y=i.bM(g[1],g[2],h[1],h[2]),x=.5*Math.PI,v=_>=-x&&_<=x,b=y>=-x&&y<=x;if(v&&b){let t=this.center.lng*Math.PI/180,r=this.center.lat*Math.PI/180;i.bN(p,t)+i.bN(_,r)<i.bN(f,t)+i.bN(y,r)?(a=p,n=_):(a=f,n=y)}else if(v)a=p,n=_;else{if(!b)return;a=f,n=y}let w=a/Math.PI*180,T=n/Math.PI*180,S=this.center.lat;this.setCenter(new i.V(w,i.an(T,-90,90))),this.setZoom(this.zoom+tq(S,this.center.lat))}locationToScreenPoint(t,r){let a=tj(t);if(r){let n=r.getElevationForLngLatZoom(t,this._helper._tileZoom);i.a$(a,a,1+n/i.bE)}return this._projectSurfacePointToScreen(a)}_projectSurfacePointToScreen(t){let r=i.bF();return i.aH(r,[...t,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],new i.P((.5*r[0]+.5)*this.width,(-(.5*r[1])+.5)*this.height)}screenPointToMercatorCoordinate(t,r){if(r){let i=r.pointCoordinate(t);if(i)return i}return i.a9.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,i){var r;return null==(r=this.screenPointToMercatorCoordinate(t,i))?void 0:r.toLngLat()}
51isPointOnMapSurface(t,i){let r=this._cameraPosition,a=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(r,a)}getRayDirectionFromPixel(t){let r=i.bF();r[0]=t.x/this.width*2-1,r[1]=-1*(t.y/this.height*2-1),r[2]=1,r[3]=1,i.aH(r,r,this._globeViewProjMatrixNoCorrectionInverted),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3];let a=i.bz();a[0]=r[0]-this._cameraPosition[0],a[1]=r[1]-this._cameraPosition[1],a[2]=r[2]-this._cameraPosition[2];let n=i.bz();return i.b3(n,a),n}isSurfacePointVisible(t){let i=this._cachedClippingPlane;return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let r=i.bF();return i.aH(r,[...t,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],r[0]>-1&&r[0]<1&&r[1]>-1&&r[1]<1&&r[2]>-1&&r[2]<1}rayPlanetIntersection(t,r){let a=i.b5(t,r),n=i.bz(),s=i.bz();i.a$(s,r,a),i.b2(n,t,s);let o=1-i.b5(n,n);if(o<0)return null;let l=i.b5(t,t)-1,h=-a+(a<0?1:-1)*Math.sqrt(o),u=l/h;return{tMin:Math.min(u,h),tMax:Math.max(u,h)}}unprojectScreenPoint(t){var r,a;let n,s,o,l=this._cameraPosition,h=this.getRayDirectionFromPixel(t),u=this.rayPlanetIntersection(l,h);if(u){let t=i.bz();i.b0(t,l,[h[0]*u.tMin,h[1]*u.tMin,h[2]*u.tMin]);let r=i.bz();return i.b3(r,t),tU(r)}let c=this._cachedClippingPlane,d=c[0]*h[0]+c[1]*h[1]+c[2]*h[2],p=-i.bb(c,l)/d,f=i.bz();if(p>0)i.b0(f,l,[h[0]*p,h[1]*p,h[2]*p]);else{let t=i.bz();i.b0(t,l,[2*h[0],2*h[1],2*h[2]]);let r=i.bb(this._cachedClippingPlane,t);i.b2(f,t,[this._cachedClippingPlane[0]*r,this._cachedClippingPlane[1]*r,this._cachedClippingPlane[2]*r])}let m=((n=i.bz())[0]=-(c[0]*c[3]),n[1]=-(c[1]*c[3]),n[2]=-(c[2]*c[3]),{center:n,radius:Math.sqrt(1-c[3]*c[3])});return tU((r=m.center,a=m.radius,s=i.bz(),i.b2(s,f,r),o=i.bz(),i.bA(o,r,s,a/i.b9(s)),o))}getMatrixForModel(t,r){let a=i.V.convert(t),n=1/i.bE,s=i.bj();return i.bJ(s,s,a.lng/180*Math.PI),i.bh(s,s,-a.lat/180*Math.PI),i.O(s,s,[0,0,1+r/i.bE]),i.bh(s,s,.5*Math.PI),i.Q(s,s,[n,n,n]),s}getProjectionDataForCustomLayer(t=!0){let r=this.getProjectionData({overscaledTileID:new i.a2(0,0,0,0,0),applyGlobeMatrix:t});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(t){}}class t1{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,i,r){return this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}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,i){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=i,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=(t,i)=>this.currentTransform.defaultConstrain(t,i),this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=new t_({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},t),this._globeness=1,this._mercatorTransform=new tv,this._verticalPerspectiveTransform=new t0}clone(){let t=new t1;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,i){this._helper.apply(t,i),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){let i=this._mercatorTransform.getProjectionData(t),r=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:i.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return i.bu(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return i.bu(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,r,a){let n=this._mercatorTransform.getPitchedTextCorrection(t,r,a),s=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,r,a);return i.bu(n,s,this._globeness)}projectTileCoordinates(t,i,r,a){return this.currentTransform.projectTileCoordinates(t,i,r,a)}_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,i){return this.currentTransform.lngLatToCameraDepth(t,i)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,a)}setLocationAtPoint(t,i){this.isGlobeRendering?(this._verticalPerspectiveTransform.setLocationAtPoint(t,i),this.apply(this._verticalPerspectiveTransform,!1)):(this._mercatorTransform.setLocationAtPoint(t,i),this.apply(this._mercatorTransform,!1))}locationToScreenPoint(t,i){return this.currentTransform.locationToScreenPoint(t,i)}screenPointToMercatorCoordinate(t,i){return this.currentTransform.screenPointToMercatorCoordinate(t,i)}screenPointToLocation(t,i){return this.currentTransform.screenPointToLocation(t,i)}
51isPointOnMapSurface(t,i){return this.currentTransform.isPointOnMapSurface(t,i)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,i){return this.currentTransform.getMatrixForModel(t,i)}getProjectionDataForCustomLayer(t=!0){let i=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return i;let r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return r.fallbackMatrix=i.mainMatrix,r}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class t2{get useGlobeControls(){return!0}handlePanInertia(t,r){let a=tZ(t,r);return Math.abs(a.lng-r.center.lng)>180&&(a.lng=r.center.lng+179.5*Math.sign(a.lng-r.center.lng)),{easingCenter:a,easingOffset:new i.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,r){let a=t.around,n=r.screenPointToLocation(a);t.bearingDelta&&r.setBearing(r.bearing+t.bearingDelta),t.pitchDelta&&r.setPitch(r.pitch+t.pitchDelta),t.rollDelta&&r.setRoll(r.roll+t.rollDelta);let s=r.zoom;t.zoomDelta&&r.setZoom(r.zoom+t.zoomDelta);let o=r.zoom-s;if(0===o)return;let l=i.bK(r.center.lng,n.lng),h=l/(Math.abs(l/180)+1),u=i.bK(r.center.lat,n.lat),c=r.getRayDirectionFromPixel(a),d=r.cameraPosition,p=-1*i.b5(d,c),f=i.bz();i.b0(f,d,[c[0]*p,c[1]*p,c[2]*p]);let m=Math.exp(-(.5*Math.max(i.b7(f)-1-.3,0))),_=tN(r.worldSize,r.center.lat)/Math.min(r.width,r.height),g=i.bx(_,.9,.5,1,.25),y=(1-i.aq(-o))*Math.min(m,g),x=r.center.lat,v=r.zoom,b=new i.V(r.center.lng+h*y,i.an(r.center.lat+u*y,-i.ao,i.ao));r.setLocationAtPoint(n,a);let w=r.center,T=Math.pow(Math.max(i.bx(Math.abs(l),45,85,0,1),i.bx(_,.75,.35,0,1)),.25),S=i.bK(w.lng,b.lng),P=i.bK(w.lat,b.lat);r.setCenter(new i.V(w.lng+S*T,w.lat+P*T).wrap()),r.setZoom(v+tq(x,r.center.lat))}handleMapControlsPan(t,i,r){if(!t.panDelta)return;let a=i.center.lat,n=i.zoom;i.setCenter(tZ(t.panDelta,i).wrap()),i.setZoom(n+tq(a,i.center.lat))}cameraForBoxAndBearing(t,r,a,n,s){let o=tT(t,r,a,n,s),l=r.left/s.width*2-1,h=(s.width-r.right)/s.width*2-1,u=-(r.top/s.height*2)+1,c=-((s.height-r.bottom)/s.height*2)+1,d=0>i.bK(a.getWest(),a.getEast()),p=d?a.getEast():a.getWest(),f=d?a.getWest():a.getEast(),m=Math.max(a.getNorth(),a.getSouth()),_=Math.min(a.getNorth(),a.getSouth()),g=p+.5*i.bK(p,f),y=m+.5*i.bK(m,_),x=s.clone();x.setCenter(o.center),x.setBearing(o.bearing),x.setPitch(0),x.setRoll(0),x.setZoom(o.zoom);let v=x.modelViewProjectionMatrix,b=[tj(a.getNorthWest()),tj(a.getNorthEast()),tj(a.getSouthWest
51()),tj(a.getSouthEast()),tj(new i.V(f,y)),tj(new i.V(p,y)),tj(new i.V(g,m)),tj(new i.V(g,_))],w=tj(o.center),T=1/0;for(let t of b)l<0&&(T=t2.getLesserNonNegativeNonNull(T,t2.solveVectorScale(t,w,v,"x",l))),h>0&&(T=t2.getLesserNonNegativeNonNull(T,t2.solveVectorScale(t,w,v,"x",h))),u>0&&(T=t2.getLesserNonNegativeNonNull(T,t2.solveVectorScale(t,w,v,"y",u))),c<0&&(T=t2.getLesserNonNegativeNonNull(T,t2.solveVectorScale(t,w,v,"y",c)));if(Number.isFinite(T)&&0!==T)return o.zoom=x.zoom+i.at(T),o;tb()}handleJumpToCenterZoom(t,r){let a=t.center.lat,n=t.applyConstrain(r.center?i.V.convert(r.center):t.center,t.zoom).center;t.setCenter(n.wrap());let s=void 0!==r.zoom?+r.zoom:t.zoom+tq(a,n.lat);t.zoom!==s&&t.setZoom(s)}handleEaseTo(t,r){let a=t.zoom,n=t.center,s=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},l={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},h=void 0!==r.zoom,u=!t.isPaddingEqual(r.padding),c=!1,d=r.center?i.V.convert(r.center):n,p=t.applyConstrain(d,a).center;tf(t,p);let f=t.clone();f.setCenter(p),f.setZoom(h?+r.zoom:a+tq(n.lat,d.lat)),f.setBearing(r.bearing);let m=new i.P(i.an(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),i.an(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));f.setLocationAtPoint(p,m);let _=(r.offset&&r.offsetAsPoint.mag())>0?f.center:p,g=h?+r.zoom:a+tq(n.lat,_.lat),y=a+tq(n.lat,0),x=g+tq(_.lat,0),v=i.bK(n.lng,_.lng),b=i.bK(n.lat,_.lat),w=i.aq(x-y);return{easeFunc:a=>{if(i.bo(o,l)||tw({startEulerAngles:o,endEulerAngles:l,tr:t,k:a,useSlerp:o.roll!=l.roll}),u&&t.interpolatePadding(s,r.padding,a),r.around)i.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(r.around,r.aroundPoint);else{let i=Math.pow(x>y?Math.min(2,w):Math.max(.5,w),1-a),r=tW(n,v,b,a*i);t.setCenter(r.wrap())}if(c){let r=i.G.number(y,x,a)+tq(0,t.center.lat);t.setZoom(r)}},isZooming:c=g!==a,elevationCenter:_}}handleFlyTo(t,r){let a,n,s,o=void 0!==r.zoom,l=t.center,h=t.zoom,u=t.padding,c=!t.isPaddingEqual(r.padding),d=t.applyConstrain(i.V.convert(r.center||r.locationAtOffset),h).center,p=o?+r.zoom:t.zoom+tq(t.center.lat,d.lat),f=t.clone();f.setCenter(d),f.setZoom(p),f.setBearing(r.bearing);let m=new i.P(i.an(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),i.an(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));f.setLocationAtPoint(d,m);let _=f.center;tf(t,_);let g=(n=tj(l),s=tj(_),Math.acos(i.b5(n,s))/(2*Math.PI)*tO(t)),y=h+tq(l.lat,0),x=p+tq(_.lat,0),v=i.aq(x-y);if("number"==typeof r.minZoom){let n=Math.min(+r.minZoom+tq(_.lat,0),y,x)+tq(0,_.lat),s=t.applyConstrain(_,n).zoom+tq(_.lat,0);a=i.aq(s-y)}let b=i.bK(l.lng,_.lng),w=i.bK(l.lat,_.lat);return{easeFunc:(a,n,s,o)=>{let h=tW(l,b,w,s);c&&t.interpolatePadding(u,r.padding,a);let d=1===a?_:h;t.setCenter(d.wrap());let f=y+i.at(n);t.setZoom(1===a?p:f+tq(0,d.lat))},scaleOfZoom:v,targetCenter:_,scaleOfMinZoom:a,pixelPathLength:g}}static solveVectorScale(t,i,r,a,n){let s="x"===a?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],o=[r[3],r[7],r[11],r[15]],l=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],h=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],u=i[0]*s[0]+i[1]*s[1]+i[2]*s[2],c=i[0]*o[0]+i[1]*o[1]+i[2]*o[2];return u+n*h===l+n*c||o[3]*(l-u)+s[3]*(c-h)+l*c==u*h?null:(u+s[3]-n*c-n*o[3])/(u-l-n*c+n*h)}static getLesserNonNegativeNonNull(t,i){return null!==i&&i>=0&&i<t?i:t}}class t3{constructor(t){this._globe=t,this._mercatorCameraHelper=new tS,this._verticalPerspectiveCameraHelper=new t2}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,i){return this.currentHelper.handlePanInertia(t,i)}handleMapControlsRollPitchBearingZoom(t,i){return this.currentHelper.handleMapControlsRollPitchBearingZoom(t,i)}handleMapControlsPan(t,i,r){this.currentHelper.handleMapControlsPan(t,i,r)}cameraForBoxAndBearing(t,i,r,a,n){return this.currentHelper.cameraForBoxAndBearing(t,i,r,a,n)}handleJumpToCenterZoom(t,i){this.currentHelper.handleJumpToCenterZoom(t,i)}handleEaseTo(t,i){return this.currentHelper.handleEaseTo(t,i)}handleFlyTo(t,i){return this.currentHelper.handleFlyTo(t,i)}}let t5=(t,r)=>i.B(t,r&&r.filter(t=>"source.canvas"!==t.identifier)),t4=i.bO();class t6 extends i.E{constructor(t,r={}){var a,n;super(),this._rtlPluginLoaded=()=>{for(let t in this.tileManagers){let i=this.tileManagers[t].getSource().type;"vector"!==i&&"geojson"!==i||this.tileManagers[t].reload()}},this.map=t,this.dispatcher=new Z(q(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(t,i)=>this.getGlyphs(t,i)),this.dispatcher.registerMessageHandler("GI",(t,i)=>this.getImages(t,i)),this.dispatcher.registerMessageHandler("GDA",(t,i)=>this.getDashes(t,i)),this.imageManager=new D,this.imageManager.setEventedParent(this);const s=(null==(a=t._container)?void 0:a.lang)||"u">typeof document&&(null==(n=document.documentElement)?void 0:n.lang)||void 0;this.glyphManager=new L(t._requestManager,r.localIdeographFontFamily,s),this.lineAtlas=new j(256,512),this.crossTileSymbolIndex=new ta,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",i.bP()),ed().on(eh,this._rtlPluginLoaded),this.on("data",t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;let i=this.tileManagers[t.sourceId];if(!i)return;let r=i.getSource();if(r&&r.vectorLayerIds)for(let t in this._layers){let i=this._layers[t];
51i.source===r.id&&this._validateLayer(i)}})}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new i.bQ,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((null==(t=this.crossTileSymbolIndex)?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,r){var a,n,s;this._checkLoaded();let o=null===r?null!=(s=null==(n=null==(a=this.stylesheet.state)?void 0:a[t])?void 0:n.default)?s:null:r;if(i.bR(o,this._globalState[t]))return this;this._globalState[t]=o,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();let r=[];for(let a in t)i.bR(this._globalState[a],t[a].default)||(r.push(a),this._globalState[a]=t[a].default);this._applyGlobalStateChanges(r)}_applyGlobalStateChanges(t){if(0===t.length)return;let i=new Set,r={};for(let a of t)for(let t in r[a]=this._globalState[a],this._layers){let r=this._layers[t],n=r.getLayoutAffectingGlobalStateRefs(),s=r.getPaintAffectingGlobalStateRefs(),o=r.getVisibilityAffectingGlobalStateRefs();if(n.has(a)&&i.add(r.source),s.has(a))for(let{name:t,value:i}of s.get(a))this._updatePaintProperty(r,t,i);(null==o?void 0:o.has(a))&&(r.recalculateVisibility(),this._updateLayer(r))}for(let t in this.dispatcher.broadcast("UGS",r),this.tileManagers)i.has(t)&&(this._reloadSource(t),this._changed=!0)}loadURL(t,r={},a){this.fire(new i.l("dataloading",{dataType:"style"})),r.validate="boolean"!=typeof r.validate||r.validate;let n=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;let s=this._loadStyleRequest;i.j(n,this._loadStyleRequest).then(t=>{this._loadStyleRequest=null,this._load(t.data,r,a)}).catch(t=>{this._loadStyleRequest=null,t&&!s.signal.aborted&&this.fire(new i.k(t))})}loadJSON(t,r={},a){this.fire(new i.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,y.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,r.validate=!1!==r.validate,this._load(t,r,a)}).catch(()=>{})}loadEmpty(){this.fire(new i.l("dataloading",{dataType:"style"})),this._load(t4,{validate:!1})}_load(t,r,a){var n,s;let o=r.transformStyle?r.transformStyle(a,t):t;if(!r.validate||!t5(this,i.C(o))){for(let t in o=Object.assign({},o),this._loaded=!0,this.stylesheet=o,o.sources)this.addSource(t,o.sources[t],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new B(this.stylesheet.light),this._setProjectionInternal((null==(n=this.stylesheet.projection)?void 0:n.type)||"mercator"),this.sky=new V(this.stylesheet.sky),this.map.setTerrain(null!=(s=this.stylesheet.terrain)?s:null),this.fire(new i.l("data",{dataType:"style"})),this.fire(new i.l("style.load"))}}_createLayers(){var t,r,a;let n=i.bS(this.stylesheet.layers);for(let s of(this.setGlobalState(null!=(t=this.stylesheet.state)?t:null),this.dispatcher.broadcast("SL",n),this._order=n.map(t=>t.id),this._layers={},this._serializedLayers=null,n)){let t=i.bT(s,this._globalState);if(t.setEventedParent(this,{layer:{id:s.id}}),this._layers[s.id]=t,i.bU(t)&&this.tileManagers[t.source]){let i=null!=(a=null==(r=s.paint)?void 0:r["raster-fade-duration"])?a:t.paint.get("raster-fade-duration");this.tileManagers[t.source].setRasterFadeDuration(i)}}}_loadSprite(t,r=!1,a){let n;this.imageManager.setLoaded(!1);let s=new AbortController;this._spriteRequest=s,(function(t,r,a,n){return i._(this,void 0,void 0,function*(){let s=C(t),o=a>1?"@2x":"",l={},h={};for(let{id:t,url:a}of s){let s=r.transformRequest(A(a,o,".json"),"SpriteJSON");l[t]=i.j(s,n);let u=r.transformRequest(A(a,o,".png"),"SpriteImage");h[t]=p.getImage(u,n)}return yield Promise.all([...Object.values(l),...Object.values(h)]),function(t,r){return i._(this,void 0,void 0,function*(){let i={};for(let a in t){i[a]={};let n=y.getImageCanvasContext((yield r[a]).data),s=(yield t[a]).data;for(let t in s){let{width:r,height:o,x:l,y:h,sdf:u,pixelRatio:c,stretchX:d,stretchY:p,content:f,textFitWidth:m,textFitHeight:_}=s[t];i[a][t]={data:null,pixelRatio:c,sdf:u,stretchX:d,stretchY:p,content:f,textFitWidth:m,textFitHeight:_,spriteData:{width:r,height:o,x:l,y:h,context:n}}}}return i})}(l,h)})})(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(t=>{if(this._spriteRequest=null,t)for(let i in t){for(let r of(this._spritesImagesIds[i]=[],this._spritesImagesIds[i]?this._spritesImagesIds[i].filter(i=>!(i in t)):[]))this.imageManager.removeImage(r),this._changedImages[r]=!0;for(let a in t[i]){let n="default"===i?a:`${i}:${a}`;this._spritesImagesIds[i].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,t[i][a],!1):this.imageManager.addImage(n,t[i][a]),r&&(this._changedImages[n]=!0)}}}).catch(t=>{this._spriteRequest=null,n=t,s.signal.aborted||this.fire(new i.k(n))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),r&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new i.l("data",{dataType:"style"})),a&&a(n)})}_unloadSprite(){for(let 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 i.l("data",{dataType:"style"}))}_validateLayer(t){let r=this.tileManagers[t.source];if(!r)return;let a=t.sourceLayer;if(!a)return;let n=r.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(a))&&this.fire(new i.k(Error(`Source layer "${a}" does not exist on source "${n.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,r=!1){let a=this._serializedAllLayers();if(!t||0===t.length)return Object.values(r?i.bV(a):a);let n=[];for(let s of t)if(a[s]){let t=r?i.bV(a[s]):a[s];n.push(t)}return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;for(let i of(t=this._serializedLayers={},Object.keys(this._layers))){let r=this._layers[i];"custom"!==r.type&&(t[i]=r.serialize())}return t}hasTransitions(){var t,i,r;
51if((null==(t=this.light)?void 0:t.hasTransition())||(null==(i=this.sky)?void 0:i.hasTransition())||(null==(r=this.projection)?void 0:r.hasTransition()))return!0;for(let t in this.tileManagers)if(this.tileManagers[t].hasTransition())return!0;for(let t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(t){if(!this._loaded)return;let r=this._changed;if(r){let i=Object.keys(this._updatedLayers),r=Object.keys(this._removedLayers);for(let t in(i.length||r.length)&&this._updateWorkerLayers(i,r),this._updatedSources){let i=this._updatedSources[t];if("reload"===i)this._reloadSource(t);else{if("clear"!==i)throw Error(`Invalid action ${i}`);this._clearSource(t)}}for(let i in this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs(),this._updatedPaintProps)this._layers[i].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}let a={};for(let t in this.tileManagers){let i=this.tileManagers[t];a[t]=i.used,i.used=!1}for(let i of this._order){let r=this._layers[i];r.recalculate(t,this._availableImages),!r.isHidden(t.zoom)&&r.source&&(this.tileManagers[r.source].used=!0)}for(let t in a){let r=this.tileManagers[t];!!a[t]!=!!r.used&&r.fire(new i.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:t}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,r&&this.fire(new i.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let i in this.tileManagers)this.tileManagers[i].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,i){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:i})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,r={}){var a;this._checkLoaded();let n=this.serialize();if(t=r.transformStyle?r.transformStyle(n,t):t,(null==(a=r.validate)||a)&&t5(this,i.C(t)))return!1;(t=i.bV(t)).layers=i.bS(t.layers);let s=i.bW(n,t),o=this._getOperationsToPerform(s);if(o.unimplemented.length>0)throw Error(`Unimplemented: ${o.unimplemented.join(", ")}.`);if(0===o.operations.length)return!1;for(let t of o.operations)t();return this.stylesheet=t,this._serializedLayers=null,this.fire(new i.l("style.load",{style:this})),!0}_getOperationsToPerform(t){let i=[],r=[];for(let a of t)switch(a.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":i.push(()=>
51this.addLayer.apply(this,a.args));break;case"removeLayer":i.push(()=>this.removeLayer.apply(this,a.args));break;case"setPaintProperty":i.push(()=>this.setPaintProperty.apply(this,a.args));break;case"setLayoutProperty":i.push(()=>this.setLayoutProperty.apply(this,a.args));break;case"setFilter":i.push(()=>this.setFilter.apply(this,a.args));break;case"addSource":i.push(()=>this.addSource.apply(this,a.args));break;case"removeSource":i.push(()=>this.removeSource.apply(this,a.args));break;case"setLayerZoomRange":i.push(()=>this.setLayerZoomRange.apply(this,a.args));break;case"setLight":i.push(()=>this.setLight.apply(this,a.args));break;case"setGeoJSONSourceData":i.push(()=>this.setGeoJSONSourceData.apply(this,a.args));break;case"setGlyphs":i.push(()=>this.setGlyphs.apply(this,a.args));break;case"setSprite":i.push(()=>this.setSprite.apply(this,a.args));break;case"setTerrain":i.push(()=>this.map.setTerrain.apply(this,a.args));break;case"setSky":i.push(()=>this.setSky.apply(this,a.args));break;case"setProjection":this.setProjection.apply(this,a.args
51);break;case"setGlobalState":i.push(()=>this.setGlobalState.apply(this,a.args));break;case"setTransition":i.push(()=>{});break;default:r.push(a.command)}return{operations:i,unimplemented:r}}addImage(t,r){if(this.getImage(t))return this.fire(new i.k(Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,r),this._afterImageUpdated(t)}updateImage(t,i){this.imageManager.updateImage(t,i)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new i.k(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 i.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,r,a={}){if(this._checkLoaded(),void 0!==this.tileManagers[t])throw Error(`Source "${t}" already exists.`);if(!r.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(i.C.source,`sources.${t}`,r,null,a))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);let n=this.tileManagers[t]=new eD(t,r,this.dispatcher);n.style=this,n.setEventedParent(this,()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:t})),n.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error("There is no source with this ID");for(let r in this._layers)if(this._layers[r].source===t)return this.fire(new i.k(Error(`Source "${t}" cannot be removed while layer "${r}" is using it.`)));let r=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],r.fire(new i.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,i){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error(`There is no source with this ID=${t}`);let r=this.tileManagers[t].getSource();if("geojson"!==r.type)throw Error(`geojsonSource.type is ${r.type}, which is !== 'geojson`);r.setData(i),this._changed=!0}getSource(t){return this.tileManagers[t]&&this.tileManagers[t].getSource()}addLayer(t,r,a={}){let n;this._checkLoaded();let s=t.id;if(this.getLayer(s))return void this.fire(new i.k(Error(`Layer "${s}" already exists on this map.`)));if("custom"===t.type){if(t5(this,i.bX(t)))return;n=i.bT(t,this._globalState)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(s,t.source),t=i.bV(t),t=i.e(t,{source:s})),this._validate(i.C.layer,`layers.${s}`,t,{arrayIndex:-1},a))return;n=i.bT(t,this._globalState),this._validateLayer(n),n.setEventedParent(this,{layer:{id:s}})}let o=r?this._order.indexOf(r):this._order.length;if(r&&-1===o)this.fire(new i.k(Error(`Cannot add layer "${s}" before non-existing layer "${r}".`)));else{if(this._order.splice(o,0,s),this._layerOrderChanged=!0,this._layers[s]=n,this._removedLayers[s]&&n.source&&"custom"!==n.type){let t=this._removedLayers[s];delete this._removedLayers[s],t.type!==n.type?this._updatedSources[n.source]="clear":(this._updatedSources[n.source]="reload",this.tileManagers[n.source].pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}}moveLayer(t,r){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new i.k(Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===r)return;let a=this._order.indexOf(t);this._order.splice(a,1);let n=r?this._order.indexOf(r):this._order.length;r&&-1===n?this.fire(new i.k(Error(`Cannot move layer "${t}" before non-existing layer "${r}".`))):(this._order.splice(n,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();let r=this._layers[t];if(!r)return void this.fire(new i.k(Error(`Cannot remove non-existing layer "${t}".`)));r.setEventedParent(null);let a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=r,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],r.onRemove&&r.onRemove(this.map)}getLayer(t){return this._layers[t]}
51getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,r,a){this._checkLoaded();let n=this.getLayer(t);n?n.minzoom===r&&n.maxzoom===a||(null!=r&&(n.minzoom=r),null!=a&&(n.maxzoom=a),this._updateLayer(n)):this.fire(new i.k(Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,r,a={}){this._checkLoaded();let n=this.getLayer(t);if(n){if(!i.bR(n.filter,r))return null==r?(n.setFilter(void 0),void this._updateLayer(n)):void(this._validate(i.C.filter,`layers.${n.id}.filter`,r,null,a)||(n.setFilter(i.bV(r)),this._updateLayer(n)))}else this.fire(new i.k(Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return i.bV(this.getLayer(t).filter)}setLayoutProperty(t,r,a,n={}){this._checkLoaded();let s=this.getLayer(t);s?i.bR(s.getLayoutProperty(r),a)||(s.setLayoutProperty(r,a,n),this._updateLayer(s)):this.fire(new i.k(Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,r){let a=this.getLayer(t);if(a)return a.getLayoutProperty(r);this.fire(new i.k(Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,r,a,n={}){this._checkLoaded();let s=this.getLayer(t);s?i.bR(s.getPaintProperty(r),a)||this._updatePaintProperty(s,r,a,n):this.fire(new i.k(Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,r,a,n={}){t.setPaintProperty(r,a,n)&&this._updateLayer(t),i.bU(t)&&"raster-fade-duration"===r&&this.tileManagers[t.source].setRasterFadeDuration(a),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,i){return this.getLayer(t).getPaintProperty(i)}setFeatureState(t,r){this._checkLoaded();let a=t.source,n=t.sourceLayer,s=this.tileManagers[a];if(void 0===s)return void this.fire(new i.k(Error(`The source '${a}' does not exist in the map's style.`)));let o=s.getSource().type;"geojson"===o&&n?this.fire(new i.k(Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||n?(void 0===t.id&&this.fire(new i.k(Error("The feature id parameter must be provided."))),s.setFeatureState(n,t.id,r)):this.fire(new i.k(Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,r){this._checkLoaded();let a=t.source,n=this.tileManagers[a];if(void 0===n)return void this.fire(new i.k(Error(`The source '${a}' does not exist in the map's style.`)));let s=n.getSource().type,o="vector"===s?t.sourceLayer:void 0;"vector"!==s||o?r&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new i.k(Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(o,t.id,r):this.fire(new i.k(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();let r=t.source,a=t.sourceLayer,n=this.tileManagers[r];if(void 0!==n)return"vector"!==n.getSource().type||a?(void 0===t.id&&this.fire(new i.k(Error("The feature id parameter must be provided."))),n.getFeatureState(a,t.id)):void this.fire(new i.k(Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new i.k(Error(`The source '${r}' does not exist in the map's style.`)))}getTransition(){return i.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let t=i.bY(this.tileManagers,t=>t.serialize()),r=this._serializeByIds(this._order,!0),a=this.map.getTerrain()||void 0,n=this.stylesheet;return i.bZ({version:n.version,name:n.name,metadata:n.metadata,light:n.light,sky:n.sky,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,projection:n.projection,sources:t,layers:r,terrain:a},t=>void 0!==t)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.tileManagers[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let i=t=>"fill-extrusion"===this._layers[t].type,r={},a=[];for(let n=this._order.length-1;n>=0;n--){let s=this._order[n];if(i(s))for(let i of(r[s]=n,t)){let t=i[s];if(t)for(let i of t)a.push(i)}}a.sort((t,i)=>i.intersectionZ-t.intersectionZ);let n=[];for(let s=this._order.length-1;s>=0;s--){let o=this._order[s];if(i(o))for(let t=a.length-1;t>=0;t--){let i=a[t].feature;if(r[i.layer.id]<s)break;n.push(i),a.pop()}else for(let i of t){let t=i[o];if(t)for(let i of t)n.push(i.feature)}}return n}
51queryRenderedFeatures(t,r,a){r&&r.filter&&this._validate(i.C.filter,"queryRenderedFeatures.filter",r.filter,null,r);let n={};if(r&&r.layers){if(!(Array.isArray(r.layers)||r.layers instanceof Set))return this.fire(new i.k(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let t of r.layers){let r=this._layers[t];if(!r)return this.fire(new i.k(Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];n[r.source]=!0}}let s=[];r.availableImages=this._availableImages;let o=this._serializedAllLayers(),l=r.layers instanceof Set?r.layers:Array.isArray(r.layers)?new Set(r.layers):null,h=Object.assign(Object.assign({},r),{layers:l,globalState:this._globalState});for(let l in this.tileManagers)r.layers&&!n[l]||s.push(function(t,r,a,n,s,o,l){let h=function(t,i,r){if(t)for(let a of t){let t=i[a];if(t&&t.source===r&&"fill-extrusion"===t.type)return!0}else for(let t in i){let a=i[t];if(a.source===r&&"fill-extrusion"===a.type)return!0}return!1}(null!=(p=null==s?void 0:s.layers)?p:null,r,t.id),u=o.maxPitchScaleFactor(),c=t.tilesIn(n,u,h);c.sort(W);let d=[];for(let n of c)d.push({wrappedTileID:n.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(r,a,t.getState(),n.queryGeometry,n.cameraQueryGeometry,n.scale,s,o,u,function(t,r){let a=i.N();return i.O(a,a,[1,1,0]),i.Q(a,a,[.5*t.width,.5*t.height,1]),t.calculatePosMatrix?i.S(a,a,t.calculatePosMatrix(r.toUnwrapped())):a}(o,n.tileID),l?(t,i)=>l(n.tileID,t,i):void 0)});var p,f=function(t){let i={},r={};for(let a of t){let t=a.queryResults,n=a.wrappedTileID,s=r[n]=r[n]||{};for(let r in t){let a=t[r],n=s[r]=s[r]||{},o=i[r]=i[r]||[];for(let t of a)n[t.featureIndex]||(n[t.featureIndex]=!0,o.push(t))}}return i}(d);for(let i in f)for(let r of f[i])H(r,t);return f}(this.tileManagers[l],this._layers,o,t,h,a,this.map.terrain?(t,i,r)=>this.map.terrain.getElevation(t,i,r):void 0));return this.placement&&s.push(function(t,i,r,a,n,s,o){let l={},h=s.queryRenderedSymbols(a),u=[];for(let t of Object.keys(h).map(Number))u.push(o[t]);for(let r of(u.sort(W),u)){let a=r.featureIndex.lookupSymbolFeatures(h[r.bucketInstanceId],i,r.bucketIndex,r.sourceLayerIndex,{filterSpec:n.filter,globalState:n.globalState},n.layers,n.availableImages,t);for(let t in a){let i=l[t]=l[t]||[],n=a[t];for(let t of(n.sort((t,i)=>{let a=r.featureSortOrder;if(a){let r=a.indexOf(t.featureIndex);return a.indexOf(i.featureIndex)-r}return i.featureIndex-t.featureIndex}),n))i.push(t)}}for(let i in l)for(let a of l[i])H(a,r[t[i].source]);return l}(this._layers,o,this.tileManagers,t,h,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(s)}querySourceFeatures(t,r){(null==r?void 0:r.filter)&&this._validate(i.C.filter,"querySourceFeatures.filter",r.filter,null,r);let a=this.tileManagers[t];return a?function(t,i){let r=t.getRenderableIds().map(i=>t.getTileByID(i)),a=[],n={};for(let t=0;t<r.length;t++){let s=r[t],o=s.tileID.canonical.key;n[o]||(n[o]=!0,s.querySourceFeatures(a,i))}return a}(a,r?Object.assign(Object.assign({},r),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,r={}){this._checkLoaded();let a=this.light.getLight(),n=!1;for(let r in t)if(!i.bR(t[r],a[r])){n=!0;break}if(!n)return;let s={now:v(),transition:i.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,r),this.light.updateTransitions(s)}getProjection(){var t;return null==(t=this.stylesheet)?void 0:t.projection}setProjection(t){if(this._checkLoaded(),this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=t,this._setProjectionInternal(t.type)}getSky(){var t;return null==(t=this.stylesheet)?void 0:t.sky}setSky(t,r={}){this._checkLoaded();let a=this.getSky(),n=!1;if(!t&&!a)return;if(t&&!a)n=!0;else if(!t&&a)n=!0;else for(let r in t)if(!i.bR(t[r],a[r])){n=!0;break}if(!n)return;let s={now:v(),transition:i.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,r),this.sky.updateTransitions(s)}_setProjectionInternal(t){let r=function(t,r){let a={constrainOverride:r};if(Array.isArray(t)){let i=new tB({type:t});return{projection:i,transform:new t1(a),cameraHelper:new t3(i)}}switch(t){case"mercator":return{projection:new td,transform:new tv
51(a),cameraHelper:new tS};case"globe":{let t=new tB({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:t,transform:new t1(a),cameraHelper:new t3(t)}}case"vertical-perspective":return{projection:new tL,transform:new t0(a),cameraHelper:new t2};default:return i.w(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new td,transform:new tv(a),cameraHelper:new tS}}}(t,this.map.transformConstrain);for(let t in this.projection=r.projection,this.map.migrateProjection(r.transform,r.cameraHelper),this.tileManagers)this.tileManagers[t].reload()}_validate(t,r,a,n,s={}){return(!s||!1!==s.validate)&&t5(this,t.call(i.C,i.e({key:r,style:this.serialize(),value:a,styleSpec:i.u},n)))}_remove(t=!0){for(let t in this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),ed().off(eh,this._rtlPluginLoaded),this._layers)this._layers[t].setEventedParent(null);for(let t in this.tileManagers){let i=this.tileManagers[t];i.setEventedParent(null),i.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(let i in this.tileManagers)this.tileManagers[i].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,i,r,a,n=!1){let s=!1,o=!1,l={};for(let i of this._order){let r=this._layers[i];if("symbol"!==r.type)continue;if(!l[r.source]){let t=this.tileManagers[r.source];l[r.source]=t.getRenderableIds(!0).map(i=>t.getTileByID(i)).sort((t,i)=>i.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(i.tileID)?-1:1))}let a=this.crossTileSymbolIndex.addLayer(r,l[r.source],t.center.lng);s=s||a}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((n=n||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(v(),t.zoom))&&(this.pauseablePlacement=new e7(t,this.map.terrain,this._order,n,i,r,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(v()),o=!0),s&&this.pauseablePlacement.placement.setStale()),o||s)for(let t of this._order){let i=this._layers[t];"symbol"===i.type&&this.placement.updateLayerOpacities(i,l[i.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(v())}_releaseSymbolFadeTiles(){for(let t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,r){return i._(this,void 0,void 0,function*(){let t=yield this.imageManager.getImages(r.icons);this._updateTilesForChangedImages();let i=this.tileManagers[r.source];return i&&i.setDependencies(r.tileID.key,r.type,r.icons),t})}getGlyphs(t,r){return i._(this,void 0,void 0,function*(){let t=yield this.glyphManager.getGlyphs(r.stacks),i=this.tileManagers[r.source];return i&&i.setDependencies(r.tileID.key,r.type,[""]),t})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,r={}){this._checkLoaded(),t&&this._validate(i.C.glyphs,"glyphs",t,null,r)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,r){return i._(this,void 0,void 0,function*(){let t={};for(let[i,a]of Object.entries(r.dashes))t[i]=this.lineAtlas.getDash(a.dasharray,a.round);return t})}addSprite(t,r,a={},n){this._checkLoaded();let s=[{id:t,url:r}],o=[...C(this.stylesheet.sprite),...s];this._validate(i.C.sprite,"sprite",o,null,a)||(this.stylesheet.sprite=o,this._loadSprite(s,!0,n))}removeSprite(t){this._checkLoaded();let r=C(this.stylesheet.sprite);if(r.find(i=>i.id===t)){if(this._spritesImagesIds[t])for(let i of this._spritesImagesIds[t])this.imageManager.removeImage(i),this._changedImages[i]=!0;r.splice(r.findIndex(i=>i.id===t),1),this.stylesheet.sprite=r.length>0?r:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new i.l("data",{dataType:"style"}))}else this.fire(new i.k(Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return C(this.stylesheet.sprite)}setSprite(t,r={}
51,a){this._checkLoaded(),t&&this._validate(i.C.sprite,"sprite",t,null,r)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)))}destroy(){for(let t in this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),this.tileManagers){let i=this.tileManagers[t];i.setEventedParent(null),i.onRemove(this.map)}for(let t in this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy(),this._layers){let i=this._layers[t];i.setEventedParent(null),i.onRemove&&i.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 t8=i.aU([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class t9{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,i,r,a,n,s,o,l,h){this.context=t;let u=this.boundPaintVertexBuffers.length!==a.length;for(let t=0;!u&&t<a.length;t++)this.boundPaintVertexBuffers[t]!==a[t]&&(u=!0);!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==r||u||this.boundIndexBuffer!==n||this.boundVertexOffset!==s||this.boundDynamicVertexBuffer!==o||this.boundDynamicVertexBuffer2!==l||this.boundDynamicVertexBuffer3!==h?this.freshBind(i,r,a,n,s,o,l,h):(t.bindVertexArray.set(this.vao),o&&o.bind(),n&&n.dynamicDraw&&n.bind(),l&&l.bind(),h&&h.bind())}freshBind(t,i,r,a,n,s,o,l){let h=t.numAttributes,u=this.context,c=u.gl;for(let h of(this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=a,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=s,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=l,i.enableAttributes(c,t),r))h.enableAttributes(c,t);for(let a of(s&&s.enableAttributes(c,t),o&&o.enableAttributes(c,t),l&&l.enableAttributes(c,t),i.bind(),i.setVertexAttribPointers(c,t,n),r))a.bind(),a.setVertexAttribPointers(c,t,n);s&&(s.bind(),s.setVertexAttribPointers(c,t,n)),a&&a.bind(),o&&(o.bind(),o.setVertexAttribPointers(c,t,n)),l&&(l.bind(),l.setVertexAttribPointers(c,t,n)),u.currentNumAttributes=h}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}let t7=(t,r,a,n,s)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:r,u_fog_color:a?a.properties.get("fog-color"):i.bp.white,u_fog_ground_blend:a?a.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:s?0:a?a.calculateFogBlendOpacity(n):0,u_horizon_color:a?a.properties.get("horizon-color"):i.bp.white,u_horizon_fog_blend:a?a.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!s}),ie={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 it(t){let i=[];for(let r=0;r<t.length;r++){if(null===t[r])continue;let a=t[r].split(" ");i.push(a.pop())}return i}class ii{constructor(t,r,a,n,s,o,l,h,u=[]){const c=t.gl;this.program=c.createProgram();const d=it(r.staticAttributes),p=a?a.getBinderAttributes():[],f=d.concat(p),m=ts.prelude.staticUniforms?it(ts.prelude.staticUniforms):[],_=l.staticUniforms?it(l.staticUniforms):[],g=r.staticUniforms?it(r.staticUniforms):[],y=a?a.getBinderUniforms():[],x=m.concat(_).concat(g).concat(y),v=[];for(const t of x)0>v.indexOf(t)&&v.push(t);const b=a?a.defines():[];tA(c)&&b.unshift("#version 300 es"),s&&b.push("#define OVERDRAW_INSPECTOR;"),o&&b.push("#define TERRAIN3D;
51"),h&&b.push(h),u&&b.push(...u);let w=b.concat(ts.prelude.fragmentSource,l.fragmentSource,r.fragmentSource).join("\n"),T=b.concat(ts.prelude.vertexSource,l.vertexSource,r.vertexSource).join("\n");tA(c)||(w=function(t){return t.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(w),T=function(t){return t.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(T));const S=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);if(c.shaderSource(S,w),c.compileShader(S),!c.getShaderParameter(S,c.COMPILE_STATUS))throw Error(`Could not compile fragment shader: ${c.getShaderInfoLog(S)}`);c.attachShader(this.program,S);const P=c.createShader(c.VERTEX_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);if(c.shaderSource(P,T),c.compileShader(P),!c.getShaderParameter(P,c.COMPILE_STATUS))throw Error(`Could not compile vertex shader: ${c.getShaderInfoLog(P)}`);c.attachShader(this.program,P),this.attributes={};const M={};this.numAttributes=f.length;for(let t=0;t<this.numAttributes;t++)f[t]&&(c.bindAttribLocation(this.program,t,f[t]),this.attributes[f[t]]=t);if(c.linkProgram(this.program),!c.getProgramParameter(this.program,c.LINK_STATUS))throw Error(`Program failed to link: ${c.getProgramInfoLog(this.program)}`);c.deleteShader(P),c.deleteShader(S);for(let t=0;t<v.length;t++){const i=v[t];if(i&&!M[i]){const t=c.getUniformLocation(this.program,i);t&&(M[i]=t)}}this.fixedUniforms=n(t,M),this.terrainUniforms=((t,r)=>({u_depth:new i.b_(t,r.u_depth),u_terrain:new i.b_(t,r.u_terrain),u_terrain_dim:new i.bq(t,r.u_terrain_dim),u_terrain_matrix:new i.c0(t,r.u_terrain_matrix),u_terrain_unpack:new i.c1(t,r.u_terrain_unpack),u_terrain_exaggeration:new i.bq(t,r.u_terrain_exaggeration)}))(t,M),this.projectionUniforms=((t,r)=>({u_projection_matrix:new i.c0(t,r.u_projection_matrix),u_projection_tile_mercator_coords:new i.c1(t,r.u_projection_tile_mercator_coords),u_projection_clipping_plane:new i.c1(t,r.u_projection_clipping_plane),u_projection_transition:new i.bq(t,r.u_projection_transition),u_projection_fallback_matrix:new i.c0(t,r.u_projection_fallback_matrix)}))(t,M),this.binderUniforms=a?a.getUniforms(t,M):[]}draw(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x){let v=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(a),t.setColorMode(n),t.setCullFace(s),l)for(let i in t.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,l.depthTexture),t.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,l.texture),this.terrainUniforms)this.terrainUniforms[i].set(l[i]);if(h)for(let t in h)this.projectionUniforms[ie[t]].set(h[t]);if(o)for(let t in this.fixedUniforms)this.fixedUniforms[t].set(o[t]);_&&_.setUniforms(t,this.binderUniforms,f,{zoom:m});let b=0;switch(i){case v.LINES:b=2;break;case v.TRIANGLES:b=3;break;case v.LINE_STRIP:b=1}for(let r of p.get()){let a=r.vaos||(r.vaos={});(a[u]||(a[u]=new t9)).bind(t,this,c,_?_.getPaintVertexBuffers():[],d,r.vertexOffset,g,y,x),v.drawElements(i,r.primitiveLength*b,v.UNSIGNED_SHORT,r.primitiveOffset*b*2)}}}function ir(t,r,a){let n=1/i.aN(a,1,r.transform.tileZoom),s=Math.pow(2,a.tileID.overscaledZ),o=a.tileSize*Math.pow(2,r.transform.tileZoom)/s,l=o*(a.tileID.canonical.x+a.tileID.wrap*s),h=o*a.tileID.canonical.y;return{u_image:0,u_texsize:a.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[l>>16,h>>16],u_pixel_coord_lower:[65535&l,65535&h]}}let ia=(t,r,a,n)=>{let s=t.style.light,o=s.properties.get("position"),l=[o.x,o.y,o.z],h=i.c4();"viewport"===s.properties.get("anchor")&&i.c5(h,t.transform.bearingInRadians),i.c6(l,l,h);let u=t.transform.transformLightDirection(l),c=s.properties.get("color");return{u_lightpos:l,u_lightpos_globe:u,u_lightintensity:s.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+r,u_opacity:a,u_fill_translate:n}},is=(t,r,a,n,s,o,l)=>i.e(ia(t,r,a,n),ir(o,t,l),{u_height_factor:-Math.pow(2,s.overscaledZ)/l.tileSize/8}),io=(t,r,a,n)=>i.e(ir(r,t,a),{u_fill_translate:n}),il=(t,i)=>({u_world:t,u_fill_translate:i}),ih=(t,r,a,n,s)=>i.e(io(t,r,a,s),{u_world:n}),iu=(t,r,a,n,s)=>{let o=t.transform,l,h,u=0;if("map"===a.paint.get("circle-pitch-alignment")){let t=i.aN(r,1,o.zoom);
51l=!0,h=[t,t],u=t/(i.a5*Math.pow(2,r.tileID.overscaledZ))*2*Math.PI*s}else l=!1,h=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+("map"===a.paint.get("circle-pitch-scale")),u_pitch_with_map:+l,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:h,u_globe_extrude_scale:u,u_translate:n}},ic=t=>({u_pixel_extrude_scale:[1/t.width,1/t.height]}),id=t=>({u_viewport_size:[t.width,t.height]}),ip=(t,i=1)=>({u_color:t,u_overlay:0,u_overlay_scale:i}),im=(t,r,a,n)=>{let s=i.aN(t,1,r)/(i.a5*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:i.aN(t,1,r),u_intensity:a,u_globe_extrude_scale:s}},i_=(t,r,a,n)=>{let s=i.N();i.c7(s,0,t.width,t.height,0,0,1);let o=t.context.gl;return{u_matrix:s,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:a,u_color_ramp:n,u_opacity:r.paint.get("heatmap-opacity")}},ig=(t,r,a)=>{var n;let s,o,l,h=a.paint.get("hillshade-accent-color");switch(a.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}let u=a.getIlluminationProperties();for(let i=0;i<u.directionRadians.length;i++)"viewport"===a.paint.get("hillshade-illumination-anchor")&&(u.directionRadians[i]+=t.transform.bearingInRadians);return{u_image:0,u_latrange:(s=Math.pow(2,(n=r.tileID).canonical.z),o=n.canonical.y,[new i.a9(0,o/s).toLngLat().lat,new i.a9(0,(o+1)/s).toLngLat().lat]),u_exaggeration:a.paint.get("hillshade-exaggeration"),u_altitudes:u.altitudeRadians,u_azimuths:u.directionRadians,u_accent:h,u_method:l,u_highlights:u.highlightColor,u_shadows:u.shadowColor}},iy=(t,r)=>{let a=r.stride,n=i.N();return i.c7(n,0,i.a5,-i.a5,0,0,1),i.O(n,n,[0,-i.a5,0]),{u_matrix:n,u_image:1,u_dimension:[a,a],u_zoom:t.overscaledZ,u_unpack:r.getUnpackVector()}},ix=(t,i,r=0)=>({u_image:0,u_unpack:i.getUnpackVector(),u_dimension:[i.stride,i.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:r,u_opacity:t.paint.get("color-relief-opacity")}),iv=(t,r,a,n)=>{let s=t.transform;return{u_translation:iM(t,r,a),u_ratio:n/i.aN(r,1,s.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},ib=(t,r,a,n,s)=>i.e(iv(t,r,a,n),{u_image:0,u_image_height:s}),iw=(t,r,a,n,s)=>{let o=t.transform,l=iP(r,o);return{u_translation:iM(t,r,a),u_texsize:r.imageAtlasTexture.size,u_ratio:n/i.aN(r,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[l,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},iT=(t,r,a,n,s)=>{let o=iP(r,t.transform);return i.e(iv(t,r,a,n),{u_tileratio:o,u_crossfade_from:s.fromScale,u_crossfade_to:s.toScale,u_image:0,u_mix:s.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})},iS=(t,r,a,n,s,o)=>{let l=iP(r,t.transform);return i.e(iv(t,r,a,n),{u_image:0,u_image_height:o,u_tileratio:l,u_crossfade_from:s.fromScale,u_crossfade_to:s.toScale,u_image_dash:1,u_mix:s.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})};function iP(t,r){return 1/i.aN(t,1,r.tileZoom)}function iM(t,r,a){return i.aO(t.transform,r,a.paint.get("line-translate"),a.paint.get("line-translate-anchor"))}let iI=(t,i,r,a,n)=>{var s,o,l;let h,u;return{u_tl_parent:t,u_scale_parent:i,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.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:(o=a.paint.get("raster-saturation"))>0?1-1/(1.001-o):-o,u_contrast_factor:(s=a.paint.get("raster-contrast"))>0?1/(1-s):1+s,u_spin_weights:(h=Math.sin(l=a.paint.get("raster-hue-rotate")*(Math.PI/180)),[(2*(u=Math.cos(l))+1)/3,(-Math.sqrt(3)*h-u+1)/3,(Math.sqrt(3)*h-u+1)/3]),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]}},iE=(t,i,r,a,n,s,o,l,h,u,c,d,p)=>{let f=o.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:f.cameraToCenterDistance,u_pitch:f.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:f.width/f.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_label_plane_matrix:l,u_coord_matrix:h,u_is_text:+c,u_pitch_with_map:+a,u_is_along_line:n,u_is_variable_anchor:s,u_texsize:d,u_texture:0,u_translation:u,u_pitched_scale:p}},iC=(t,r,a,n,s,o,l,h,u,c,d,p,f,m)=>{let _=l.transform;return i.e(iE(t,r,a,n,s,o,l,h,u,c,d,p,m),{u_gamma_scale:n?Math.cos(_.pitch
51*Math.PI/180)*_.cameraToCenterDistance:1,u_device_pixel_ratio:l.pixelRatio,u_is_halo:1})},iA=(t,r,a,n,s,o,l,h,u,c,d,p,f)=>i.e(iC(t,r,a,n,s,o,l,h,u,c,!0,d,0,f),{u_texsize_icon:p,u_texture_icon:1}),iD=(t,i)=>({u_opacity:t,u_color:i}),iz=(t,r,a,n,s)=>i.e(function(t,r,a,n){let s=a.imageManager.getPattern(t.from.toString()),o=a.imageManager.getPattern(t.to.toString()),{width:l,height:h}=a.imageManager.getPixelSize(),u=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,a.transform.tileZoom)/u,d=c*(n.tileID.canonical.x+n.tileID.wrap*u),p=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:s.tl,u_pattern_br_a:s.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[l,h],u_mix:r.t,u_pattern_size_a:s.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/i.aN(n,1,a.transform.tileZoom),u_pixel_coord_upper:[d>>16,p>>16],u_pixel_coord_lower:[65535&d,65535&p]}}(a,s,r,n),{u_opacity:t}),ik=(t,i)=>{},iR={fillExtrusion:(t,r)=>({u_lightpos:new i.c2(t,r.u_lightpos),u_lightpos_globe:new i.c2(t,r.u_lightpos_globe),u_lightintensity:new i.bq(t,r.u_lightintensity),u_lightcolor:new i.c2(t,r.u_lightcolor),u_vertical_gradient:new i.bq(t,r.u_vertical_gradient),u_opacity:new i.bq(t,r.u_opacity),u_fill_translate:new i.c3(t,r.u_fill_translate)}),fillExtrusionPattern:(t,r)=>({u_lightpos:new i.c2(t,r.u_lightpos),u_lightpos_globe:new i.c2(t,r.u_lightpos_globe),u_lightintensity:new i.bq(t,r.u_lightintensity),u_lightcolor:new i.c2(t,r.u_lightcolor),u_vertical_gradient:new i.bq(t,r.u_vertical_gradient),u_height_factor:new i.bq(t,r.u_height_factor),u_opacity:new i.bq(t,r.u_opacity),u_fill_translate:new i.c3(t,r.u_fill_translate),u_image:new i.b_(t,r.u_image),u_texsize:new i.c3(t,r.u_texsize),u_pixel_coord_upper:new i.c3(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new i.c3(t,r.u_pixel_coord_lower),u_scale:new i.c2(t,r.u_scale),u_fade:new i.bq(t,r.u_fade)}),fill:(t,r)=>({u_fill_translate:new i.c3(t,r.u_fill_translate)}),fillPattern:(t,r)=>({u_image:new i.b_(t,r.u_image),u_texsize:new i.c3(t,r.u_texsize),u_pixel_coord_upper:new i.c3(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new i.c3(t,r.u_pixel_coord_lower),u_scale:new i.c2(t,r.u_scale),u_fade:new i.bq(t,r.u_fade),u_fill_translate:new i.c3(t,r.u_fill_translate)}),fillOutline:(t,r)=>({u_world:new i.c3(t,r.u_world),u_fill_translate:new i.c3(t,r.u_fill_translate)}),fillOutlinePattern:(t,r)=>({u_world:new i.c3(t,r.u_world),u_image:new i.b_(t,r.u_image),u_texsize:new i.c3(t,r.u_texsize),u_pixel_coord_upper:new i.c3(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new i.c3(t,r.u_pixel_coord_lower),u_scale:new i.c2(t,r.u_scale),u_fade:new i.bq(t,r.u_fade),u_fill_translate:new i.c3(t,r.u_fill_translate)}),circle:(t,r)=>({u_camera_to_center_distance:new i.bq(t,r.u_camera_to_center_distance),u_scale_with_map:new i.b_(t,r.u_scale_with_map),u_pitch_with_map:new i.b_(t,r.u_pitch_with_map),u_extrude_scale:new i.c3(t,r.u_extrude_scale),u_device_pixel_ratio:new i.bq(t,r.u_device_pixel_ratio),u_globe_extrude_scale:new i.bq(t,r.u_globe_extrude_scale),u_translate:new i.c3(t,r.u_translate)}),collisionBox:(t,r)=>({u_pixel_extrude_scale:new i.c3(t,r.u_pixel_extrude_scale)}),collisionCircle:(t,r)=>({u_viewport_size:new i.c3(t,r.u_viewport_size)}),debug:(t,r)=>({u_color:new i.b$(t,r.u_color),u_overlay:new i.b_(t,r.u_overlay),u_overlay_scale:new i.bq(t,r.u_overlay_scale)}),depth:ik,clippingMask:ik,heatmap:(t,r)=>({u_extrude_scale:new i.bq(t,r.u_extrude_scale),u_intensity:new i.bq(t,r.u_intensity),u_globe_extrude_scale:new i.bq(t,r.u_globe_extrude_scale)}),heatmapTexture:(t,r)=>({u_matrix:new i.c0(t,r.u_matrix),u_world:new i.c3(t,r.u_world),u_image:new i.b_(t,r.u_image),u_color_ramp:new i.b_(t,r.u_color_ramp),u_opacity:new i.bq(t,r.u_opacity)}),hillshade:(t,r)=>({u_image:new i.b_(t,r.u_image),u_latrange:new i.c3(t,r.u_latrange),u_exaggeration:new i.bq(t,r.u_exaggeration),u_altitudes:new i.c9(t,r.u_altitudes),u_azimuths:new i.c9(t,r.u_azimuths),u_accent:new i.b$(t,r.u_accent),u_method:new i.b_(t,r.u_method),u_shadows:new i.c8(t,r.u_shadows),u_highlights:new i.c8(t,r.u_highlights)}),hillshadePrepare:(t,r)=>({u_matrix:new i.c0(t,r.u_matrix),u_image:new i.b_(t,r.u_image),u_dimension:new i.c3(t,r.u_dimension),u_zoom:new i.bq(t,r.u_zoom),u_unpack:new i.c1(t,r.u_unpack)}),colorRelief:(t,r)=>({u_image:new i.b_(t,r.u_image),u_unpack:new i.c1(t,r.u_unpack),u_dimension:new i.c3(t,r.u_dimension),u_elevation_stops:new i.b_(t,r.u_elevation_stops),u_color_stops:new i.b_(t,r.u_color_stops),u_color_ramp_size:new i.b_(t,r.u_color_ramp_size),u_opacity:new i.bq(t,r.u_opacity)}),line:(t,r)=>({u_translation:new i.c3(t,r.u_translation),u_ratio:new i.bq(t,r.u_ratio),u_device_pixel_ratio:new i.bq(t,r.u_device_pixel_ratio),u_units_to_pixels:new i.c3(t,r.u_units_to_pixels)}),lineGradient:(t,r)=>({u_translation:new i.c3(t,r.u_translation),u_ratio:new i.bq(t,r.u_ratio),u_device_pixel_ratio:new i.bq(t,r.u_device_pixel_ratio),u_units_to_pixels:new i.c3(t,r.u_units_to_pixels),u_image:new i.b_(t,r.u_image),u_image_height:new i.bq(t,r.u_image_height)}),linePattern:(t,r)=>({u_translation:new i.c3(t,r.u_translation),u_texsize:new i.c3(t,r.u_texsize),u_ratio:new i.bq(t,r.u_ratio),u_device_pixel_ratio:new i.bq(t,r.u_device_pixel_ratio),u_image:new i.b_(t,r.u_image),u_units_to_pixels:new i.c3(t,r.u_units_to_pixels),u_scale:new i.c2(t,r.u_scale),u_fade:new i.bq(t,r.u_fade)}),lineSDF:(t,r)=>({u_translation:new i.c3(t,r.u_translation),u_ratio:new i.bq(t,r.u_ratio),u_device_pixel_ratio:new i.bq(t,r.u_device_pixel_ratio),u_units_to_pixels:new i.c3(t,r.u_units_to_pixels),u_image:new i.b_(t,r.u_image),u_mix:new i.bq(t,r.u_mix),u_tileratio:new i.bq(t,r.u_tileratio),u_crossfade_from:new i.bq(t,r.u_crossfade_from),u_crossfade_to:new i.bq(t,r.u_crossfade_to),u_lineatlas_width:new i.bq(t,r.u_lineatlas_width),u_lineatlas_height:new i.bq(t,r.u_lineatlas_height)}),lineGradientSDF:(t,r)=>({u_translation:new i.c3(t,r.u_translation),u_ratio:new i.bq(t,r.u_ratio),u_device_pixel_ratio:new i.bq(t,r.u_device_pixel_ratio),u_units_to_pixels:new i.c3(t,r.u_units_to_pixels),u_image:new i.b_(t,r.u_image),u_image_height:new i.bq(t,r.u_image_height),u_tileratio:new i.bq(t,r.u_tileratio),u_crossfade_from:new i.bq(t,r.u_crossfade_from),u_crossfade_to:new i.bq(t,r.u_crossfade_to),u_image_dash:new i.b_(t,r.u_image_dash),u_mix:new i.bq(t,r.u_mix),u_lineatlas_width:new i.bq(t,r.u_lineatlas_width),u_lineatlas_height:new i.bq(t,r.u_lineatlas_height)}),raster:(t,r)=>({u_tl_parent:new i.c3(t,r.u_tl_parent),u_scale_parent:new i.bq(t,r.u_scale_parent),u_buffer_scale:new i.bq(t,r.u_buffer_scale),u_fade_t:new i.bq(t,r.u_fade_t),u_opacity:new i.bq(t,r.u_opacity),u_image0:new i.b_(t,r.u_image0),u_image1:new i.b_(t,r.u_image1),u_brightness_low:new i.bq(t,r.u_brightness_low),u_brightness_high:new i.bq(t,r.u_brightness_high),u_saturation_factor:new i.bq(t,r.u_saturation_factor),u_contrast_factor:new i.bq(t,r.u_contrast_factor),u_spin_weights:new i.c2(t,r.u_spin_weights),u_coords_top:new i.c1(t,r.u_coords_top),u_coords_bottom:new i.c1(t,r.u_coords_bottom)}),symbolIcon:(t,r)=>({u_is_size_zoom_constant:new i.b_(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new i.b_(t,r.u_is_size_feature_constant),u_size_t:new i.bq(t,r.u_size_t),u_size:new i.bq(t,r.u_size),u_camera_to_center_distance:new i.bq(t,r.u_camera_to_center_distance),u_pitch:new i.bq(t,r.u_pitch),u_rotate_symbol:new i.b_(t,r.u_rotate_symbol),u_aspect_ratio:new i.bq(t,r.u_aspect_ratio),u_fade_change:new i.bq(t,r.u_fade_change),u_label_plane_matrix:new i.c0(t,r.u_label_plane_matrix
51),u_coord_matrix:new i.c0(t,r.u_coord_matrix),u_is_text:new i.b_(t,r.u_is_text),u_pitch_with_map:new i.b_(t,r.u_pitch_with_map),u_is_along_line:new i.b_(t,r.u_is_along_line),u_is_variable_anchor:new i.b_(t,r.u_is_variable_anchor),u_texsize:new i.c3(t,r.u_texsize),u_texture:new i.b_(t,r.u_texture),u_translation:new i.c3(t,r.u_translation),u_pitched_scale:new i.bq(t,r.u_pitched_scale)}),symbolSDF:(t,r)=>({u_is_size_zoom_constant:new i.b_(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new i.b_(t,r.u_is_size_feature_constant),u_size_t:new i.bq(t,r.u_size_t),u_size:new i.bq(t,r.u_size),u_camera_to_center_distance:new i.bq(t,r.u_camera_to_center_distance),u_pitch:new i.bq(t,r.u_pitch),u_rotate_symbol:new i.b_(t,r.u_rotate_symbol),u_aspect_ratio:new i.bq(t,r.u_aspect_ratio),u_fade_change:new i.bq(t,r.u_fade_change),u_label_plane_matrix:new i.c0(t,r.u_label_plane_matrix),u_coord_matrix:new i.c0(t,r.u_coord_matrix),u_is_text:new i.b_(t,r.u_is_text),u_pitch_with_map:new i.b_(t,r.u_pitch_with_map),u_is_along_line:new i.b_(t,r.u_is_along_line),u_is_variable_anchor:new i.b_(t,r.u_is_variable_anchor),u_texsize:new i.c3(t,r.u_texsize),u_texture:new i.b_(t,r.u_texture),u_gamma_scale:new i.bq(t,r.u_gamma_scale),u_device_pixel_ratio:new i.bq(t,r.u_device_pixel_ratio),u_is_halo:new i.b_(t,r.u_is_halo),u_translation:new i.c3(t,r.u_translation),u_pitched_scale:new i.bq(t,r.u_pitched_scale)}),symbolTextAndIcon:(t,r)=>({u_is_size_zoom_constant:new i.b_(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new i.b_(t,r.u_is_size_feature_constant),u_size_t:new i.bq(t,r.u_size_t),u_size:new i.bq(t,r.u_size),u_camera_to_center_distance:new i.bq(t,r.u_camera_to_center_distance),u_pitch:new i.bq(t,r.u_pitch),u_rotate_symbol:new i.b_(t,r.u_rotate_symbol),u_aspect_ratio:new i.bq(t,r.u_aspect_ratio),u_fade_change:new i.bq(t,r.u_fade_change),u_label_plane_matrix:new i.c0(t,r.u_label_plane_matrix),u_coord_matrix:new i.c0(t,r.u_coord_matrix),u_is_text:new i.b_(t,r.u_is_text),u_pitch_with_map:new i.b_(t,r.u_pitch_with_map),u_is_along_line:new i.b_(t,r.u_is_along_line),u_is_variable_anchor:new i.b_(t,r.u_is_variable_anchor),u_texsize:new i.c3(t,r.u_texsize),u_texsize_icon:new i.c3(t,r.u_texsize_icon),u_texture:new i.b_(t,r.u_texture),u_texture_icon:new i.b_(t,r.u_texture_icon),u_gamma_scale:new i.bq(t,r.u_gamma_scale),u_device_pixel_ratio:new i.bq(t,r.u_device_pixel_ratio),u_is_halo:new i.b_(t,r.u_is_halo),u_translation:new i.c3(t,r.u_translation),u_pitched_scale:new i.bq(t,r.u_pitched_scale)}),background:(t,r)=>({u_opacity:new i.bq(t,r.u_opacity),u_color:new i.b$(t,r.u_color)}),backgroundPattern:(t,r)=>({u_opacity:new i.bq(t,r.u_opacity),u_image:new i.b_(t,r.u_image),u_pattern_tl_a:new i.c3(t,r.u_pattern_tl_a),u_pattern_br_a:new i.c3(t,r.u_pattern_br_a),u_pattern_tl_b:new i.c3(t,r.u_pattern_tl_b),u_pattern_br_b:new i.c3(t,r.u_pattern_br_b),u_texsize:new i.c3(t,r.u_texsize),u_mix:new i.bq(t,r.u_mix),u_pattern_size_a:new i.c3(t,r.u_pattern_size_a),u_pattern_size_b:new i.c3(t,r.u_pattern_size_b),u_scale_a:new i.bq(t,r.u_scale_a),u_scale_b:new i.bq(t,r.u_scale_b),u_pixel_coord_upper:new i.c3(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new i.c3(t,r.u_pixel_coord_lower),u_tile_units_to_pixels:new i.bq(t,r.u_tile_units_to_pixels)}),terrain:(t,r)=>({u_texture:new i.b_(t,r.u_texture),u_ele_delta:new i.bq(t,r.u_ele_delta),u_fog_matrix:new i.c0(t,r.u_fog_matrix),u_fog_color:new i.b$(t,r.u_fog_color),u_fog_ground_blend:new i.bq(t,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new i.bq(t,r.u_fog_ground_blend_opacity),u_horizon_color:new i.b$(t,r.u_horizon_color),u_horizon_fog_blend:new i.bq(t,r.u_horizon_fog_blend),u_is_globe_mode:new i.bq(t,r.u_is_globe_mode)}),terrainDepth:(t,r)=>({u_ele_delta:new i.bq(t,r.u_ele_delta)}),terrainCoords:(t,r)=>({u_texture:new i.b_(t,r.u_texture),u_terrain_coords_id:new i.bq(t,r.u_terrain_coords_id),u_ele_delta:new i.bq(t,r.u_ele_delta)}),projectionErrorMeasurement:(t,r)=>({u_input:new i.bq(t,r.u_input),u_output_expected:new i.bq(t,r.u_output_expected)}),atmosphere:(t,r)=>({u_sun_pos:new i.c2(t,r.u_sun_pos),u_atmosphere_blend:new i.bq(t,r.u_atmosphere_blend),u_globe_position:new i.c2(t,r.u_globe_position),u_globe_radius:new i.bq(t,r.u_globe_radius),u_inv_proj_matrix:new i.c0(t,r.u_inv_proj_matrix)}),sky:(t,r)=>({u_sky_color:new i.b$(t,r.u_sky_color),u_horizon_color:new i.b$(t,r.u_horizon_color),u_horizon:new i.c3(t,r.u_horizon),u_horizon_normal:new i.c3(t,r.u_horizon_normal),u_sky_horizon_blend:new i.bq(t,r.u_sky_horizon_blend),u_sky_blend:new i.bq(t,r.u_sky_blend)})};class iL{constructor(t,i,r){this.context=t;const a=t.gl;this.buffer=a.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let i=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let iF={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class iB{constructor(t,i,r,a){this.length=i.length,this.attributes=r,this.itemSize=i.bytesPerElement,this.dynamicDraw=a,this.context=t;const n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);let i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,t.arrayBuffer)}
51enableAttributes(t,i){for(let r=0;r<this.attributes.length;r++){let a=i.attributes[this.attributes[r].name];void 0!==a&&t.enableVertexAttribArray(a)}}setVertexAttribPointers(t,i,r){for(let a=0;a<this.attributes.length;a++){let n=this.attributes[a],s=i.attributes[n.name];void 0!==s&&t.vertexAttribPointer(s,n.components,t[iF[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class iO{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 iV extends iO{getDefault(){return i.bp.transparent}set(t){let i=this.current;(t.r!==i.r||t.g!==i.g||t.b!==i.b||t.a!==i.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class ij extends iO{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class iN extends iO{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class iU extends iO{getDefault(){return[!0,!0,!0,!0]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class iG extends iO{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class iq extends iO{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class iZ extends iO{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let i=this.current;(t.func!==i.func||t.ref!==i.ref||t.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class i$ extends iO{getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class iW extends iO{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=t,this.dirty=!1}}class iH extends iO{getDefault(){return[0,1]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class iX extends iO{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=t,this.dirty=!1}}class iY extends iO{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class iK extends iO{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.BLEND):i.disable(i.BLEND),this.current=t,this.dirty=!1}}class iJ extends iO{getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class iQ extends iO{getDefault(){return i.bp.transparent}set(t){let i=this.current;(t.r!==i.r||t.g!==i.g||t.b!==i.b||t.a!==i.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class i0 extends iO{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class i1 extends iO{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=t,this.dirty=!1}}class i2 extends iO{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class i3 extends iO{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class i5 extends iO{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class i4 extends iO{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class i6 extends iO{getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class i8 extends iO{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class i9 extends iO{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class i7 extends iO{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindTexture(i.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class re extends iO{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class rt extends iO{getDefault(){return null}set(t){let i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class ri extends iO{getDefault(){return null}set(t){var i;if(t===this.current&&!this.dirty)return;let r=this.gl;tA(r)?r.bindVertexArray(t):null==(i=r.getExtension("OES_vertex_array_object"))||i.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class rr extends iO{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class ra extends iO{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class rn extends iO{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class rs extends iO{constructor(t,i){super(t),this.context=t,this.parent=i}getDefault(){return null}}class ro extends rs{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class rl extends rs{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class rh extends rs{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,t),this.current=t,this.dirty=!1}}let ru="Framebuffer is not complete";class rc{constructor(t,i,r,a,n){this.context=t,this.width=i,this.height=r;const s=t.gl,o=this.framebuffer=s.createFramebuffer();
51if(this.colorAttachment=new ro(t,o),a)this.depthAttachment=n?new rh(t,o):new rl(t,o);else if(n)throw Error("Stencil cannot be set without depth");if(s.checkFramebufferStatus(s.FRAMEBUFFER)!==s.FRAMEBUFFER_COMPLETE)throw Error(ru)}destroy(){let t=this.context.gl,i=this.colorAttachment.get();if(i&&t.deleteTexture(i),this.depthAttachment){let i=this.depthAttachment.get();i&&t.deleteRenderbuffer(i)}t.deleteFramebuffer(this.framebuffer)}}class rd{constructor(t){var i,r;if(this.gl=t,this.clearColor=new iV(this),this.clearDepth=new ij(this),this.clearStencil=new iN(this),this.colorMask=new iU(this),this.depthMask=new iG(this),this.stencilMask=new iq(this),this.stencilFunc=new iZ(this),this.stencilOp=new i$(this),this.stencilTest=new iW(this),this.depthRange=new iH(this),this.depthTest=new iX(this),this.depthFunc=new iY(this),this.blend=new iK(this),this.blendFunc=new iJ(this),this.blendColor=new iQ(this),this.blendEquation=new i0(this),this.cullFace=new i1(this),this.cullFaceSide=new i2(this),this.frontFace=new i3(this),this.program=new i5(this),this.activeTexture=new i4(this),this.viewport=new i6(this),this.bindFramebuffer=new i8(this),this.bindRenderbuffer=new i9(this),this.bindTexture=new i7(this),this.bindVertexBuffer=new re(this),this.bindElementBuffer=new rt(this),this.bindVertexArray=new ri(this),this.pixelStoreUnpack=new rr(this),this.pixelStoreUnpackPremultiplyAlpha=new ra(this),this.pixelStoreUnpackFlipY=new rn(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),tA(t)){this.HALF_FLOAT=t.HALF_FLOAT;const a=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!=(i=t.RGBA16F)?i:null==a?void 0:a.RGBA16F_EXT,this.RGB16F=null!=(r=t.RGB16F)?r:null==a?void 0:a.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const i=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==i?void 0:i.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,i){return new iL(this,t,i)}createVertexBuffer(t,i,r){return new iB(this,t,i,r)}createRenderbuffer(t,i,r){let a=this.gl,n=a.createRenderbuffer();return this.bindRenderbuffer.set(n),a.renderbufferStorage(a.RENDERBUFFER,t,i,r),this.bindRenderbuffer.set(null),n}createFramebuffer(t,i,r,a){return new rc(this,t,i,r,a)}clear({color:t,depth:i,stencil:r}){let a=this.gl,n=0;t&&(n|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==i&&(n|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),void 0!==r&&(n|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),a.clear(n)}setCullFace(t){!1===t.enable?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){i.bR(t.blendFunction,tP.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 tA(this.gl)?this.gl.createVertexArray():null==(t=this.gl.getExtension("OES_vertex_array_object"))?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var i;return tA(this.gl)?this.gl.deleteVertexArray(t):null==(i=this.gl.getExtension("OES_vertex_array_object"))?void 0:i.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}function rp(t,r,a,n,s){let o=t.context,l=t.transform,u=o.gl,c=t.useProgram("collisionBox"),d=[],p=0,f=0;for(let i=0;i<n.length;i++){let h=n[i],m=r.getTile(h).getBucket(a);if(!m)continue;let _=s?m.textCollisionBox:m.iconCollisionBox,g=m.collisionCircleArray;g.length>0&&(d.push({circleArray:g,circleOffset:f,coord:h}),p+=g.length/4,f=p),_&&c.draw(o,u.LINES,tI.disabled,tE.disabled,t.colorModeForRenderPass(),tM.disabled,ic(t.transform),t.style.map.terrain&&t.style.map.terrain.getTerrainData(h),l.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),a.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,null,t.transform.zoom,null,null,_.collisionVertexBuffer)}if(!s||!d.length)return;let m=t.useProgram("collisionCircle"),_=new i.ca;_.resize(4*p),_._trim();let g=0;for(let t of d)for(let i=0;i<t.circleArray.length/4;i++){let r=4*i,a=t.circleArray[r+0],n=t.circleArray[r+1],s=t.circleArray[r+2],o=t.circleArray[r+3];_.emplace(g++,a,n,s,o,0),_.emplace(g++,a,n,s,o,1),_.emplace(g++,a,n,s,o,2),_.emplace(g++,a,n,s,o,3)}(!h||h.length<2*p)&&(h=function(t){let r=2*t,a=new i.cc;a.resize(r),a._trim();for(let t=0;t<r;t++){let i=6*t;a.uint16[i+0]=4*t+0,a.uint16[i+1]=4*t+1,a.uint16[i+2]=4*t+2,a.uint16[i+3]=4*t+2,a.uint16[i+4]=4*t+3,a.uint16[i+5]=4*t+0}return a}(p));let y=o.createIndexBuffer(h,!0),x=o.createVertexBuffer(_,i.cb.members,!0);for(let r of d){let n=id(t.transform);m.draw(o,u.TRIANGLES,tI.disabled,tE.disabled,t.colorModeForRenderPass(),tM.disabled,n,t.style.map.terrain&&t.style.map.terrain.getTerrainData(r.coord),null,a.id,x,y,i.aX.simpleSegment(0,2*r.circleOffset,r.circleArray.length,r.circleArray.length/2),null,t.transform.zoom,null,null,null)}x.destroy(),y.destroy()}let rf=i.ar(new Float32Array(16));function rm(t,r,a,n,s,o,l,h,u,c,d,p,f){let m=t.context,_=m.gl,g=t.transform,y="map"===h,x="map"===u,v="viewport"!==h&&"point"!==a.layout.get("symbol-placement"),b=y&&!x&&!v,w=!a.layout.get("symbol-sort-key").isConstant(),T=!1,S=t.getDepthModeForSublayer(0,tI.ReadOnly),P=a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"),M=[],I=g.getCircleRadiusCorrection();for(let h of n){let n=r.getTile(h),u=n.getBucket(a);if(!u)continue;let d=s?u.text:u.icon;if(!d||!d.segments.get().length||!d.hasVisibleVertices)continue;let p=d.programConfigurations.get(a.id),m=s||u.sdfIcons,S=s?u.textSizeData:u.iconSizeData,E=x||0!==g.pitch,C=t.useProgram(u.iconsInText&&s?"symbolTextAndIcon":m?"symbolSDF":"symbolIcon",p),A=i.ay(S,g.zoom),D=t.style.map.terrain&&t.style.map.terrain.getTerrainData(h),z,k,R,L,F=[0,0],B=null;if(s)k=n.glyphAtlasTexture,R=_.LINEAR,z=n.glyphAtlasTexture.size,u.iconsInText&&(F=n.imageAtlasTexture.size,B=n.imageAtlasTexture,L=E||t.options.rotating||t.options.zooming||"composite"===S.kind||"camera"===S.kind?_.LINEAR:_.NEAREST);else{let i=1!==a.layout.get("icon-size").constantOr(0)||u.iconsNeedLinear;k=n.imageAtlasTexture,R=m||t.options.rotating||t.options.zooming||i||E?_.LINEAR:_.NEAREST,z=n.imageAtlasTexture.size}let O=i.aN(n,1,t.transform.zoom),V=eL(y,t.transform,O),j=i.N();i.aB(j,V);let N=function(t,r,a,n){if(t){let t=i.N();if(!r){let{vecSouth:i,vecEast:r}=eF(a);t[0]=r[0],t[1]=r[1],t[4]=i[0],t[5]=i[1]}return i.Q(t,t,[n,n,1]),t}
51return a.pixelsToClipSpaceMatrix}(x,y,t.transform,O),U=i.aO(g,n,o,l),G=g.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!f,applyTerrainMatrix:!0}),q=P&&u.hasTextData(),Z="none"!==a.layout.get("icon-text-fit")&&q&&u.hasIconData();if(v){let r=t.style.map.terrain?(i,r)=>t.style.map.terrain.getElevation(h,i,r):null;!function(t,r,a,n,s,o,l,h,u,c,d,p,f){let m=a?t.textSizeData:t.iconSizeData,_=i.ay(m,r.transform.zoom),g=[256/r.width*2+1,256/r.height*2+1],y=a?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;y.clear();let x=t.lineVertexArray,v=a?t.text.placedSymbolArray:t.icon.placedSymbolArray,b=r.transform.width/r.transform.height,w=!1;for(let a=0;a<v.length;a++){var T;let S=v.get(a);if(S.hidden||S.writingMode===i.az.vertical&&!w){eX(S.numGlyphs,y);continue}w=!1;let P=new i.P(S.anchorX,S.anchorY),M={getElevation:f,pitchedLabelPlaneMatrix:n,lineVertexArray:x,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:r.transform,tileAnchorPoint:P,unwrappedTileID:u,width:c,height:d,translation:p},I=eZ(S.anchorX,S.anchorY,M);if(T=I.point,!(T.x>=-g[0]&&T.x<=g[0]&&T.y>=-g[1])||!(T.y<=g[1])){eX(S.numGlyphs,y);continue}let E=.5+r.transform.cameraToCenterDistance/I.signedDistanceFromCamera*.5,C=i.aA(m,_,S),A=o?C*r.transform.getPitchedTextCorrection(S.anchorX,S.anchorY,u)/E:C*E,D=ej({projectionContext:M,pitchedLabelPlaneMatrixInverse:s,symbol:S,fontSize:A,flip:!1,keepUpright:l,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:b,rotateToLine:h});w=D.useVertical,(D.notEnoughRoom||w||D.needsFlipping&&ej({projectionContext:M,pitchedLabelPlaneMatrixInverse:s,symbol:S,fontSize:A,flip:!0,keepUpright:l,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:b,rotateToLine:h}).notEnoughRoom)&&eX(S.numGlyphs,y)}a?t.text.dynamicLayoutVertexBuffer.updateData(y):t.icon.dynamicLayoutVertexBuffer.updateData(y)}(u,t,s,V,j,x,c,"map"===a.layout.get("text-rotation-alignment"),h.toUnwrapped(),g.width,g.height,U,r)}let $=s&&P||Z,W=v||$?rf:x?V:t.transform.clipSpaceToPixelsMatrix,H=m&&0!==a.paint.get(s?"text-halo-width":"icon-halo-width").constantOr(1),X={program:C,buffers:d,uniformValues:m?u.iconsInText?iA(S.kind,A,b,x,v,$,t,W,N,U,z,F,I):iC(S.kind,A,b,x,v,$,t,W,N,U,s,z,0,I):iE(S.kind,A,b,x,v,$,t,W,N,U,s,z,I),projectionData:G,atlasTexture:k,atlasTextureIcon:B,atlasInterpolation:R,atlasInterpolationIcon:L,isSDF:m,hasHalo:H};if(w&&u.canOverlap)for(let t of(T=!0,d.segments.get()))M.push({segments:new i.aX([t]),sortKey:t.sortKey,state:X,terrainData:D});else M.push({segments:d.segments,sortKey:0,state:X,terrainData:D})}for(let i of(T&&M.sort((t,i)=>t.sortKey-i.sortKey),M)){let r=i.state;if(m.activeTexture.set(_.TEXTURE0),r.atlasTexture.bind(r.atlasInterpolation,_.CLAMP_TO_EDGE),r.atlasTextureIcon&&(m.activeTexture.set(_.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,_.CLAMP_TO_EDGE)),r.isSDF){let n=r.uniformValues;r.hasHalo&&(n.u_is_halo=1,r_(r.buffers,i.segments,a,t,r.program,S,d,p,n,r.projectionData,i.terrainData)),n.u_is_halo=0}r_(r.buffers,i.segments,a,t,r.program,S,d,p,r.uniformValues,r.projectionData,i.terrainData)}}function r_(t,i,r,a,n,s,o,l,h,u,c){let d=a.context;n.draw(d,d.gl.TRIANGLES,s,o,l,tM.backCCW,h,c,u,r.id,t.layoutVertexBuffer,t.indexBuffer,i,r.paint,a.transform.zoom,t.programConfigurations.get(r.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function rg(t,i,r){var a,n;let s=t.gl,o=s.createTexture();s.bindTexture(s.TEXTURE_2D,o),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR);let l=null!=(a=t.HALF_FLOAT)?a:s.UNSIGNED_BYTE,h=null!=(n=t.RGBA16F)?n:s.RGBA;s.texImage2D(s.TEXTURE_2D,0,h,i,r,0,s.RGBA,l,null);let u=t.createFramebuffer(i,r,!1,!1);return u.colorAttachment.set(o),u}function ry(t,r){return r.colorRampTexture||(r.colorRampTexture=new i.T(t,r.colorRamp,t.gl.RGBA)),r.colorRampTexture}function rx(t,r,a,n,s,o,l,h){let u=256;if(s.stepInterpolant){let n=r.getSource().maxzoom,s=l.canonical.z===n?Math.ceil(1<<t.transform.maxZoom-l.canonical.z):1;u=i.an(i.ce(o.maxLineLength/i.a5*1024*s),256,a.maxTextureSize)}return h.gradient=i.cf({expression:s.gradientExpression(),evaluationKey:"lineProgress",resolution:u,image:h.gradient||void 0,clips:o.lineClipsArray}),h.texture?h.texture.update(h.gradient):h.texture=new i.T(a,h.gradient,n.RGBA),h.version=s.gradientVersion,h.texture}function rv(t,i,r,a,n){if(!r||!a||!a.imageAtlas)return;let s=a.imageAtlas.patternPositions,o=s[r.to.toString()],l=s[r.from.toString()];if(!o&&l&&(o=l),!l&&o&&(l=o),!o||!l){let t=n.getPaintProperty(i);o=s[t],l=s[t]}o&&l&&t.setConstantPatternPositions(o,l)}function rb(t,r,a,n,s,o,l,h){let u,c,d,p,f,m=t.context.gl,_="fill-pattern",g=a.paint.get(_),y=g&&g.constantOr(1),x=a.getCrossfadeParameters(),v=t.transform,b=a.paint.get("fill-translate"),w=a.paint.get("fill-translate-anchor");l?(c=y&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",u=m.LINES):(c=y?"fillPattern":"fill",u=m.TRIANGLES);let T=g.constantOr(null);for(let g of n){let n=r.getTile(g);if(y&&!n.patternsLoaded())continue;let S=n.getBucket(a);if(!S)continue;let P=S.programConfigurations.get(a.id),M=t.useProgram(c,P),I=t.style.map.terrain&&t.style.map.terrain.getTerrainData(g);y&&(t.context.activeTexture.set(m.TEXTURE0),n.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),P.updatePaintBuffers(x)),rv(P,_,T,n,a);let E=v.getProjectionData({overscaledTileID:g,applyGlobeMatrix:!h,applyTerrainMatrix:!0}),C=i.aO(v,n,b,w);if(l){p=S.indexBuffer2,f=S.segments2;let i=[m.drawingBufferWidth,m.drawingBufferHeight];d="fillOutlinePattern"===c&&y?ih(t,x,n,i,C):il(i,C)}else p=S.indexBuffer,f=S.segments,d=y?io(t,x,n,C):{u_fill_translate:C};let A=t.stencilModeForClipping(g);M.draw(t.context,u,s,A,o,tM.backCCW,d,I,E,a.id,S.layoutVertexBuffer,p,f,a.paint,t.transform.zoom,P)}}function rw(t,r,a,n,s,o,l,h){let u=t.context,c=u.gl,d="fill-extrusion-pattern",p=a.paint.get(d),f=p.constantOr(1),m=a.getCrossfadeParameters(),_=a.paint.get("fill-extrusion-opacity"),g=p.c
51onstantOr(null),y=t.transform;for(let p of n){let n=r.getTile(p),x=n.getBucket(a);if(!x)continue;let v=t.style.map.terrain&&t.style.map.terrain.getTerrainData(p),b=x.programConfigurations.get(a.id),w=t.useProgram(f?"fillExtrusionPattern":"fillExtrusion",b);f&&(t.context.activeTexture.set(c.TEXTURE0),n.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),b.updatePaintBuffers(m));let T=y.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!h,applyTerrainMatrix:!0});rv(b,d,g,n,a);let S=i.aO(y,n,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),P=a.paint.get("fill-extrusion-vertical-gradient"),M=f?is(t,P,_,S,p,m,n):ia(t,P,_,S);w.draw(u,u.gl.TRIANGLES,s,o,l,tM.backCCW,M,v,T,a.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,a.paint,t.transform.zoom,b,t.style.map.terrain&&x.centroidVertexBuffer)}}function rT(t,i,r,a,n,s,o,l,h){var u;let c=t.style.projection,d=t.context,p=t.transform,f=d.gl,m=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get("hillshade-highlight-color").values.length}`],_=t.useProgram("hillshade",null,!1,m),g=!t.options.moving;for(let m of a){let a=i.getTile(m),y=a.fbo;if(!y)continue;let x=c.getMeshFromTileID(d,m.canonical,l,!0,"raster"),v=null==(u=t.style.map.terrain)?void 0:u.getTerrainData(m);d.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,y.colorAttachment.get());let b=p.getProjectionData({overscaledTileID:m,aligned:g,applyGlobeMatrix:!h,applyTerrainMatrix:!0});_.draw(d,f.TRIANGLES,s,n[m.overscaledZ],o,tM.backCCW,ig(t,a,r),v,b,r.id,x.vertexBuffer,x.indexBuffer,x.segments)}}function rS(t,r,a,n,s,o,l,h,u){var c;let d=t.style.projection,p=t.context,f=t.transform,m=p.gl,_=t.useProgram("colorRelief"),g=!t.options.moving,y=!0,x=0;for(let v of n){let n=r.getTile(v),b=n.dem;if(y){let t=m.getParameter(m.MAX_TEXTURE_SIZE),{elevationTexture:i,colorTexture:r}=a.getColorRampTextures(p,t,b.getUnpackVector());p.activeTexture.set(m.TEXTURE1),i.bind(m.NEAREST,m.CLAMP_TO_EDGE),p.activeTexture.set(m.TEXTURE4),r.bind(m.LINEAR,m.CLAMP_TO_EDGE),y=!1,x=i.size[0]}if(!b||!b.data)continue;let w=b.stride,T=b.getPixels();if(p.activeTexture.set(m.TEXTURE0),p.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||t.getTileTexture(w),n.demTexture){let t=n.demTexture;t.update(T,{premultiply:!1}),t.bind(m.LINEAR,m.CLAMP_TO_EDGE)}else n.demTexture=new i.T(p,T,m.RGBA,{premultiply:!1}),n.demTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE);let S=d.getMeshFromTileID(p,v.canonical,h,!0,"raster"),P=null==(c=t.style.map.terrain)?void 0:c.getTerrainData(v),M=f.getProjectionData({overscaledTileID:v,aligned:g,applyGlobeMatrix:!u,applyTerrainMatrix:!0});_.draw(p,m.TRIANGLES,o,s[v.overscaledZ],l,tM.backCCW,ix(a,n.dem,x),P,M,a.id,S.vertexBuffer,S.indexBuffer,S.segments)}}let rP=[new i.P(0,0),new i.P(i.a5,0),new i.P(i.a5,i.a5),new i.P(0,i.a5)];function rM(t,r,a,n,s,o,l,h,u=!1,c=!1){let d=n[n.length-1].overscaledZ,p=t.context,f=p.gl,_=t.useProgram("raster"),g=t.transform,y=t.style.projection,x=t.colorModeForRenderPass(),b=!t.options.moving,w=a.paint.get("raster-opacity"),T=a.paint.get("raster-resampling"),S=a.paint.get("raster-fade-duration"),P=!!t.style.map.terrain;for(let M of n){let n=t.getDepthModeForSublayer(M.overscaledZ-d,1===w?tI.ReadWrite:tI.ReadOnly,f.LESS),I=r.getTile(M),E="nearest"===T?f.NEAREST:f.LINEAR;p.activeTexture.set(f.TEXTURE0),I.texture.bind(E,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(f.TEXTURE1);let{parentTile:C,parentScaleBy:A,parentTopLeft:D,fadeValues:z}=function(t,r,a,n){let s={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===a||n)return s;if(t.fadingParentID){let n,o,l,h,u,c,d=r.getLoadedTile(t.fadingParentID);if(!d)return s;let p=Math.pow(2,d.tileID.overscaledZ-t.tileID.overscaledZ),f=[t.tileID.canonical.x*p%1,t.tileID.canonical.y*p%1],_=(o=((n=v())-d.timeAdded)/a,l=t.fadingDirection===m.Incoming,h=i.an((n-t.timeAdded)/a,0,1),u=i.an(1-o,0,1),{tileOpacity:c=l?h:u,parentTileOpacity:l?u:h,fadeMix:{opacity:1,mix:1-c}});return{parentTile:d,parentScaleBy:p,parentTopLeft:f,fadeValues:_}}if(t.selfFading){let r,n;return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:(r=(v()-t.timeAdded)/a,{tileOpacity:n=i.an(r,0,1),fadeMix:{opacity:n,mix:0}})}}return s}(I,r,S,P);I.fadeOpacity=z.tileOpacity,C?(C.fadeOpacity=z.parentTileOpacity,C.texture.bind(E,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST)):I.texture.bind(E,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),I.texture.useMipmap&&p.extTextureFilterAnisotropic&&t.transform.pitch>20&&f.texParameterf(f.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let k=t.style.map.terrain&&t.style.map.terrain.getTerrainData(M),R=g.getProjectionData({overscaledTileID:M,aligned:b,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),L=iI(D,A,z.fadeMix,a,h),F=y.getMeshFromTileID(p,M.canonical,o,l,"raster");_.draw(p,f.TRIANGLES,n,s?s[M.overscaledZ]:tE.disabled,x,u?tM.frontCCW:tM.backCCW,L,k,R,a.id,F.vertexBuffer,F.indexBuffer,F.segments)}}let rI=new i.bp(1,0,0,1),rE=new i.bp(0,1,0,1),rC=new i.bp(0,0,1,1),rA=new i.bp(1,0,1,1),rD=new i.bp(0,1,1,1);function rz(t,i,r,a){rR(t,0,i+r/2,t.transform.width,r,a)}function rk(t,i,r,a){rR(t,i-r/2,0,r,t.transform.height,a)}function rR(t,i,r,a,n,s){let o=t.context,l=o.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*t.pixelRatio,r*t.pixelRatio,a*t.pixelRatio,n*t.pixelRatio),o.clear({color:s}),l.disable(l.SCISSOR_TEST)}function rL(t,i,r,a){let{isRenderingGlobe:n}=a,s=t.context,o=s.gl,l=t.transform,h=t.colorModeForRenderPass(),u=t.getDepthModeFor3D(),c=t.useProgram("terrain");for(let a of(s.bindFramebuffer.set(null),s.viewport.set([0,0,t.width,t.height]),r)){let r=i.getTerrainMesh(a.tileID),d=t.renderToTexture.getTexture(a),p=i.getTerrainData(a.tileID);s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,d.texture);let f=t7(i.getMeshFrameDelta(l.zoom),l.calculateFogMatrix(a.tileID.toUnwrapped()),t.style.sky,l.pitch,n),m=l.getProjectionData({overscaledTileID:a.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});c.draw(s,o.TRIANGLES,u,tE.disabled,h,tM.backCCW,f,p,m,"terrain",r.vertexBuffer,r.indexBuffer,r.segments)}}function rF(t,r){if(!r.mesh){let a=new i.aW;a.emplaceBack(-1,-1),a.emplaceBack(1,-1),a.emplaceBack(1,1),a.emplaceBack(-1,1);let n=new i.aY;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),r.mesh=new tl(t.createVertexBuffer(a,th.members),t.createIndexBuffer(n),i.aX.simpleSegment(0,0,a.length,n.length))}return r.mesh}class rB{constructor(t,r){this.context=new rd(t),this.transform=r,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:i.ar(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=eD.maxOverzooming+eD.maxUnderzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new ta}resize(t,i,r){if(this.width=Math.floor(t*r),this.height=Math.floor(i*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let t of this.style._order)this.style._layers[t].resize()}setup(){let t=this.context,r=new i.aW;
51r.emplaceBack(0,0),r.emplaceBack(i.a5,0),r.emplaceBack(0,i.a5),r.emplaceBack(i.a5,i.a5),this.tileExtentBuffer=t.createVertexBuffer(r,th.members),this.tileExtentSegments=i.aX.simpleSegment(0,0,4,2);let a=new i.aW;a.emplaceBack(0,0),a.emplaceBack(i.a5,0),a.emplaceBack(0,i.a5),a.emplaceBack(i.a5,i.a5),this.debugBuffer=t.createVertexBuffer(a,th.members),this.debugSegments=i.aX.simpleSegment(0,0,4,5);let n=new i.ch;n.emplaceBack(0,0,0,0),n.emplaceBack(i.a5,0,i.a5,0),n.emplaceBack(0,i.a5,0,i.a5),n.emplaceBack(i.a5,i.a5,i.a5,i.a5),this.rasterBoundsBuffer=t.createVertexBuffer(n,t8.members),this.rasterBoundsSegments=i.aX.simpleSegment(0,0,4,2);let s=new i.aW;s.emplaceBack(0,0),s.emplaceBack(i.a5,0),s.emplaceBack(0,i.a5),s.emplaceBack(i.a5,i.a5),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(s,th.members),this.rasterBoundsSegmentsPosOnly=i.aX.simpleSegment(0,0,4,5);let o=new i.aW;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(o,th.members),this.viewportSegments=i.aX.simpleSegment(0,0,4,2);let l=new i.ci;l.emplaceBack(0),l.emplaceBack(1),l.emplaceBack(3),l.emplaceBack(2),l.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(l);let h=new i.aY;h.emplaceBack(1,0,2),h.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(h);let u=this.context.gl;this.stencilClearMode=new tE({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.tileExtentMesh=new tl(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,r=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let a=i.N();i.c7(a,0,this.width,this.height,0,0,1),i.Q(a,a,[r.drawingBufferWidth,r.drawingBufferHeight,0]),this.useProgram("clippingMask",null,!0).draw(t,r.TRIANGLES,tI.disabled,this.stencilClearMode,tP.disabled,tM.disabled,null,null,{mainMatrix:a,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:a},"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,i,r){if(this.currentStencilSource===t.source||!t.isTileClipped()||!i||!i.length)return;this.currentStencilSource=t.source,this.nextStencilID+i.length>256&&this.clearStencil();let a=this.context;a.setColorMode(tP.disabled),a.setDepthMode(tI.disabled);let n={};for(let t of i)n[t.key]=this.nextStencilID++;this._renderTileMasks(n,i,r,!0),this._renderTileMasks(n,i,r,!1),this._tileClippingMaskIDs=n}_renderTileMasks(t,i,r,a){let n=this.context,s=n.gl,o=this.style.projection,l=this.transform,h=this.useProgram("clippingMask");for(let u of i){let i=t[u.key],c=this.style.map.terrain&&this.style.map.terrain.getTerrainData(u),d=o.getMeshFromTileID(this.context,u.canonical,a,!0,"stencil"),p=l.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!r,applyTerrainMatrix:!0});h.draw(n,s.TRIANGLES,tI.disabled,new tE({func:s.ALWAYS,mask:0},i,255,s.KEEP,s.KEEP,s.REPLACE),tP.disabled,r?tM.disabled:tM.backCCW,null,c,p,"$clipping",d.vertexBuffer,d.indexBuffer,d.segments)}}_renderTilesDepthBuffer(){let t=this.context,i=t.gl,r=this.style.projection,a=this.transform,n=this.useProgram("depth"),s=this.getDepthModeFor3D();for(let o of eP(a,{tileSize:a.tileSize})){let l=this.style.map.terrain&&this.style.map.terrain.getTerrainData(o),h=r.getMeshFromTileID(this.context,o.canonical,!0,!0,"raster"),u=a.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(t,i.TRIANGLES,s,tE.disabled,tP.disabled,tM.backCCW,null,l,u,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,i=this.context.gl;return new tE({func:i.NOTEQUAL,mask:255},t,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(t){let i=this.context.gl;return new tE({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let i=this.context.gl,r=t.sort((t,i)=>i.overscaledZ-t.overscaledZ),a=r[r.length-1].overscaledZ,n=r[0].overscaledZ-a+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let t={};for(let r=0;r<n;r++)t[r+a]=new tE({func:i.GEQUAL,mask:255},r+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=n,[t,r]}return[{[a]:tE.disabled},r]}stencilConfigForOverlapTwoPass(t){let i=this.context.gl,r=t.sort((t,i)=>
51i.overscaledZ-t.overscaledZ),a=r[r.length-1].overscaledZ,n=r[0].overscaledZ-a+1;if(this.clearStencil(),n>1){let t={},s={};for(let r=0;r<n;r++)t[r+a]=new tE({func:i.GREATER,mask:255},n+1+r,255,i.KEEP,i.KEEP,i.REPLACE),s[r+a]=new tE({func:i.GREATER,mask:255},1+r,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*n+1,[t,s,r]}return this.nextStencilID=3,[{[a]:new tE({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[a]:new tE({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},r]}colorModeForRenderPass(){let t=this.context.gl;if(this._showOverdrawInspector){let r=1/8;return new tP([t.CONSTANT_COLOR,t.ONE],new i.bp(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?tP.unblended:tP.alphaBlended}getDepthModeForSublayer(t,i,r){if(!this.opaquePassEnabledForLayer())return tI.disabled;let a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new tI(r||this.context.gl.LEQUAL,i,[a,a])}getDepthModeFor3D(){return new tI(this.context.gl.LEQUAL,tI.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,r){var a,n,s,o,l,h,u,c,d;let p,f,m,_,g,y,x,b,w,T,S,P,M,I;this.style=t,this.options=r,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(v()),this.imageManager.beginFrame();let E=this.style._order,C=this.style.tileManagers,A={},D={},z={},k={isRenderingToTexture:!1,isRenderingGlobe:(null==(a=t.projection)?void 0:a.transitionState)>0};for(let t in C){let i=C[t];i.used&&i.prepare(this.context),A[t]=i.getVisibleCoordinates(!1),D[t]=A[t].slice().reverse(),z[t]=i.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<E.length;t++)if(this.style._layers[E[t]].is3D()){this.opaquePassCutoff=t;break}for(let t of(this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen",E)){let i=this.style._layers[t];if(!i.hasOffscreenPass()||i.isHidden(this.transform.zoom))continue;let r=D[i.source];("custom"===i.type||r.length)&&this.renderLayer(this,C[i.source],i,r,k)}if(null==(n=this.style.projection)||n.updateGPUdependent({context:this.context,useProgram:t=>this.useProgram(t)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?i.bp.black:i.bp.transparent,depth:1}),this.clearStencil(),this.style.sky&&(s=this.style.sky,y=(g=this.context).gl,o=this.style.map.transform,l=this.pixelRatio,p=Math.cos(o.rollInRadians),f=Math.sin(o.rollInRadians),m=eg(o),_=o.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition,x={u_sky_color:s.properties.get("sky-color"),u_horizon_color:s.properties.get("horizon-color"),u_horizon:[(o.width/2-m*f)*l,(o.height/2+m*p)*l],u_horizon_normal:[-f,p],u_sky_horizon_blend:s.properties.get("sky-horizon-blend")*o.height/2*l,u_sky_blend:_},b=new tI(y.LEQUAL,tI.ReadWrite,[0,1]),w=tE.disabled,T=this.colorModeForRenderPass(),S=this.useProgram("sky"),P=rF(g,s),S.draw(g,y.TRIANGLES,b,w,T,tM.disabled,x,null,void 0,"sky",P.vertexBuffer,P.indexBuffer,P.segments)),this._showOverdrawInspector=r.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=E.length-1;this.currentLayer>=0;this.currentLayer--){let t=this.style._layers[E[this.currentLayer]],i=C[t.source],r=A[t.source];this._renderTileClippingMasks(t,r,!1),this.renderLayer(this,i,t,r,k)}this.renderPass="translucent";let R=!1;for(this.currentLayer=0;this.currentLayer<E.length;this.currentLayer++){let t=this.style._layers[E[this.currentLayer]],i=C[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t,k))continue;this.opaquePassEnabledForLayer()||R||(R=!0,k.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let r=("symbol"===t.type?z:D)[t.source];this._renderTileClippingMasks(t,A[t.source],!!this.renderToTexture),this.renderLayer(this,i,t,r,k)}if(k.isRenderingGlobe&&function(t,r,a){var n;let s,o,l,h=t.context,u=h.gl,c=t.useProgram("atmosphere"),d=new tI(u.LEQUAL,tI.ReadOnly,[0,1]),p=t.transform,f=(n=t.transform,o=[-(s=a.properties.get("position")).x,-s.y,-s.z],l=i.ar(new Float64Array(16)),"map"===a.properties.get("anchor")&&(i.bg(l,l,n.rollInRadians),i.bh(l,l,-n.pitchInRadians),i.bg(l,l,n.bearingInRadians),i.bh(l,l,n.center.lat*Math.PI/180),i.bJ(l,l,-n.center.lng*Math.PI/180)
51),i.cg(o,o,l),o),m=p.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),_=r.properties.get("atmosphere-blend")*m.projectionTransition;if(0===_)return;let g=tN(p.worldSize,p.center.lat),y=p.inverseProjectionMatrix,x=new Float64Array(4);x[3]=1,i.aH(x,x,p.modelViewProjectionMatrix),x[0]/=x[3],x[1]/=x[3],x[2]/=x[3],x[3]=1,i.aH(x,x,y),x[0]/=x[3],x[1]/=x[3],x[2]/=x[3],x[3]=1;let v={u_sun_pos:f,u_atmosphere_blend:_,u_globe_position:[x[0],x[1],x[2]],u_globe_radius:g,u_inv_proj_matrix:y},b=rF(h,r);c.draw(h,u.TRIANGLES,d,tE.disabled,tP.alphaBlended,tM.disabled,v,null,null,"atmosphere",b.vertexBuffer,b.indexBuffer,b.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let t,r,a,n,s,o=(h=this.style,u=this.transform.zoom,t=null,a=(r=Object.values(h._layers).flatMap(t=>t.source&&!t.isHidden(u)?[h.tileManagers[t.source]]:[])).filter(t=>"vector"===t.getSource().type),n=r.filter(t=>"vector"!==t.getSource().type),s=i=>{(!t||t.getSource().maxzoom<i.getSource().maxzoom)&&(t=i)},a.forEach(t=>
51s(t)),t||n.forEach(t=>s(t)),t);o&&function(t,r,a){for(let n=0;n<a.length;n++)!function(t,r,a){var n;let s,o,l,h=t.context,u=h.gl,c=t.useProgram("debug"),d=tI.disabled,p=tE.disabled,f=t.colorModeForRenderPass(),m="$debug",_=t.style.map.terrain&&t.style.map.terrain.getTerrainData(a);h.activeTexture.set(u.TEXTURE0);let g=r.getTileByID(a.key).latestRawTileData,y=Math.floor((g&&g.byteLength||0)/1024),x=512/Math.min(r.getTile(a).tileSize,512)*(a.overscaledZ/t.transform.zoom)*.5,v=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(v+=` => ${a.overscaledZ}`),n=`${v} ${y}kB`,t.initDebugOverlayCanvas(),s=t.debugOverlayCanvas,o=t.context.gl,(l=t.debugOverlayCanvas.getContext("2d")).clearRect(0,0,s.width,s.height),l.shadowColor="white",l.shadowBlur=2,l.lineWidth=1.5,l.strokeStyle="white",l.textBaseline="top",l.font="bold 36px Open Sans, sans-serif",l.fillText(n,5,5),l.strokeText(n,5,5),t.debugOverlayTexture.update(s),t.debugOverlayTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE);let b=t.transform.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!0,applyTerrainMatrix:!0});c.draw(h,u.TRIANGLES,d,p,tP.alphaBlended,tM.disabled,ip(i.bp.transparent,x),null,b,m,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),c.draw(h,u.LINE_STRIP,d,p,f,tM.disabled,ip(i.bp.red),_,b,m,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}(t,r,a[n])}(this,o,o.getVisibleCoordinates())}this.options.showPadding&&(M=this.transform.padding,rz(this,this.transform.height-(M.top||0),3,rI),rz(this,M.bottom||0,3,rE),rk(this,M.left||0,3,rC),rk(this,this.transform.width-(M.right||0),3,rA),I=this.transform.centerPoint,c=I.x,rR(this,c-1,(d=this.transform.height-I.y)-10,2,20,rD),rR(this,c-10,d-1,20,2,rD)),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;let r=this.terrainFacilitator.matrix,a=this.transform.modelViewProjectionMatrix,n=this.terrainFacilitator.dirty;n||(n=t?!i.cj(r,a):!i.ck(r,a)),n||(n=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),n&&(i.cl(r,a),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(t,r){let a=t.context,n=a.gl,s=t.transform,o=tP.unblended,l=new tI(n.LEQUAL,tI.ReadWrite,[0,1]),h=r.tileManager.getRenderableTiles(),u=t.useProgram("terrainDepth");for(let c of(a.bindFramebuffer.set(r.getFramebuffer("depth").framebuffer),a.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),a.clear({color:i.bp.transparent,depth:1}),h)){let t=r.getTerrainMesh(c.tileID),i=r.getTerrainData(c.tileID),h=s.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),d={u_ele_delta:r.getMeshFrameDelta(s.zoom)};u.draw(a,n.TRIANGLES,l,tE.disabled,o,tM.backCCW,d,i,h,"terrain",t.vertexBuffer,t.indexBuffer,t.segments)}a.bindFramebuffer.set(null),a.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain),function(t,r){let a=t.context,n=a.gl,s=t.transform,o=tP.unblended,l=new tI(n.LEQUAL,tI.ReadWrite,[0,1]),h=r.getCoordsTexture(),u=r.tileManager.getRenderableTiles(),c=t.useProgram("terrainCoords");for(let d of(a.bindFramebuffer.set(r.getFramebuffer("coords").framebuffer),a.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),a.clear({color:i.bp.transparent,depth:1}),r.coordsIndex=[],u)){let t=r.getTerrainMesh(d.tileID),i=r.getTerrainData(d.tileID);a.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,h.texture);let u={u_terrain_coords_id:(255-r.coordsIndex.length)/255,u_texture:0,u_ele_delta:r.getMeshFrameDelta(s.zoom)},p=s.getProjectionData({overscaledTileID:d.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});c.draw(a,n.TRIANGLES,l,tE.disabled,o,tM.backCCW,u,i,p,"terrain",t.vertexBuffer,t.indexBuffer,t.segments),r.coordsIndex.push(d.tileID.key)}a.bindFramebuffer.set(null),a.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain))}renderLayer(t,r,a,n,s){a.isHidden(this.transform.zoom)||("background"===a.type||"custom"===a.type||(n||[]).length)&&(this.id=a.id,i.cm(a)?function(t,r,a,n,s,o){if("translucent"!==t.renderPass)return;let{isRenderingToTexture:l}=o,h=tE.disabled,u=t.colorModeForRenderPass();(a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,r,a,n,s,o,l,h,u){let c=r.transform,d=r.
51style.map.terrain,p="map"===s,f="map"===o;for(let s of t){let t=n.getTile(s),o=t.getBucket(a);if(!o||!o.text||!o.text.segments.get().length)continue;let m=i.ay(o.textSizeData,c.zoom),_=i.aN(t,1,r.transform.zoom),g=eL(p,r.transform,_),y="none"!==a.layout.get("icon-text-fit")&&o.hasIconData();if(m){let r=Math.pow(2,c.zoom-t.tileID.overscaledZ),a=d?(t,i)=>d.getElevation(s,t,i):null;!function(t,r,a,n,s,o,l,h,u,c,d,p){let f=t.text.placedSymbolArray,m=t.text.dynamicLayoutVertexArray,_=t.icon.dynamicLayoutVertexArray,g={};m.clear();for(let _=0;_<f.length;_++){let y=f.get(_),x=y.hidden||!y.crossTileID||t.allowVerticalPlacement&&!y.placedOrientation?null:n[y.crossTileID];if(x){let n=new i.P(y.anchorX,y.anchorY),f={getElevation:p,width:s.width,height:s.height,pitchedLabelPlaneMatrix:o,pitchWithMap:a,transform:s,tileAnchorPoint:n,translation:c,unwrappedTileID:d},_=a?eZ(n.x,n.y,f):eG(n.x,n.y,f),v=.5+s.cameraToCenterDistance/_.signedDistanceFromCamera*.5,b=i.aA(t.textSizeData,h,y)*v/i.aM;a&&(b*=t.tilePixelRatio/l);let{width:w,height:T,anchor:S,textOffset:P,textBoxScale:M}=x,I=function(t,r,a,n,s,o){let{horizontalAlign:l,verticalAlign:h}=i.aS(t);return new i.P((-(l-.5)*r/s+n[0])*o,(-(h-.5)*a/s+n[1])*o)}(S,w,T,P,M,b),E=s.getPitchedTextCorrection(n.x+c[0],n.y+c[1],d),C=function(t,r,a,n,s,o){let l=r.tileAnchorPoint.add(new i.P(r.translation[0],r.translation[1]));if(r.pitchWithMap){let t=n.mult(o);a||(t=t.rotate(-s));let i=l.add(t);return eB(i.x,i.y,r.pitchedLabelPlaneMatrix,r.getElevation).point}if(a){let i=eG(r.tileAnchorPoint.x+1,r.tileAnchorPoint.y,r).point.sub(t),a=Math.atan(i.y/i.x)+(i.x<0?Math.PI:0);return t.add(n.rotate(a))}return t.add(n)}(_.point,f,r,I,-s.bearingInRadians,E),A=t.allowVerticalPlacement&&y.placedOrientation===i.az.vertical?Math.PI/2:0;for(let t=0;t<y.numGlyphs;t++)i.aG(m,C,A);u&&y.associatedIconIndex>=0&&(g[y.associatedIconIndex]={shiftedAnchor:C,angle:A})}else eX(y.numGlyphs,m)}if(u){_.clear();let r=t.icon.placedSymbolArray;for(let t=0;t<r.length;t++){let a=r.get(t);if(a.hidden)eX(a.numGlyphs,_);else{let r=g[t];if(r)for(let t=0;t<a.numGlyphs;t++)i.aG(_,r.shiftedAnchor,r.angle);else eX(a.numGlyphs,_)}}t.icon.dynamicLayoutVertexBuffer.updateData(_)}t.text.dynamicLayoutVertexBuffer.updateData(m)}(o,p,f,u,c,g,r,m,y,i.aO(c,t,l,h),s.toUnwrapped(),a)}}}(n,t,a,r,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),s),0!==a.paint.get("icon-opacity").constantOr(1)&&rm(t,r,a,n,!1,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),a.layout.get("icon-rotation-alignment"),a.layout.get("icon-pitch-alignment"),a.layout.get("icon-keep-upright"),h,u,l),0!==a.paint.get("text-opacity").constantOr(1)&&rm(t,r,a,n,!0,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),a.layout.get("text-keep-upright"),h,u,l),r.map.showCollisionBoxes&&(rp(t,r,a,n,!0),rp(t,r,a,n,!1))}(t,r,a,n,this.style.placement.variableOffsets,s):i.cn(a)?function(t,r,a,n,s){if("translucent"!==t.renderPass)return;let{isRenderingToTexture:o}=s,l=a.paint.get("circle-opacity"),h=a.paint.get("circle-stroke-width"),u=a.paint.get("circle-stroke-opacity"),c=!a.layout.get("circle-sort-key").isConstant();if(0===l.constantOr(1)&&(0===h.constantOr(1)||0===u.constantOr(1)))return;let d=t.context,p=d.gl,f=t.transform,m=t.getDepthModeForSublayer(0,tI.ReadOnly),_=tE.disabled,g=t.colorModeForRenderPass(),y=[],x=f.getCircleRadiusCorrection();for(let s=0;s<n.length;s++){let l=n[s],h=r.getTile(l),u=h.getBucket(a);if(!u)continue;let d=a.paint.get("circle-translate"),p=a.paint.get("circle-translate-anchor"),m=i.aO(f,h,d,p),_=u.programConfigurations.get(a.id),g=t.useProgram("circle",_),v=u.layoutVertexBuffer,b=u.indexBuffer,w=t.style.map.terrain&&t.style.map.terrain.getTerrainData(l),T={programConfiguration:_,program:g,layoutVertexBuffer:v,indexBuffer:b,uniformValues:iu(t,h,a,m,x),terrainData:w,projectionData:f.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!o,applyTerrainMatrix:!0})};if(c)for(let t of u.segments.get())y.push({segments:new i.aX([t]),sortKey:t.sortKey,state:T});else y.push({segments:u.segments,sortKey:0,state:T})}for(let i of(c&&y.sort((t,i)=>t.sortKey-i.sortKey),y)){let{programConfiguration:r,program:n,layoutVertexBuffer:s,indexBuffer:o,uniformValues:l,terrainData:h,projectionData:u}=i.state;n.draw(d,p.TRIANGLES,m,_,g,tM.backCCW,l,h,u,a.id,s,o,i.segments,a.paint,t.transform.zoom,r)}}(t,r,a,n,s):i.co(a)?function(t,r,a,n,s){if(0===a.paint.get("heatmap-opacity"))return;let o=t.context,{isRenderingToTexture:l,isRenderingGlobe:h}=s;if(t.style.map.terrain){for(let s of n){let n=r.getTile(s);r.hasRenderableParent(s)||("offscreen"===t.renderPass?function(t,r,a,n,s){let o=t.context,l=o.gl,h=tE.disabled,u=new tP([l.O
51NE,l.ONE],i.bp.transparent,[!0,!0,!0,!0]),c=r.getBucket(a);if(!c)return;let d=n.key,p=a.heatmapFbos.get(d);p||(p=rg(o,r.tileSize,r.tileSize),a.heatmapFbos.set(d,p)),o.bindFramebuffer.set(p.framebuffer),o.viewport.set([0,0,r.tileSize,r.tileSize]),o.clear({color:i.bp.transparent});let f=c.programConfigurations.get(a.id),m=t.useProgram("heatmap",f,!s),_=t.transform.getProjectionData({overscaledTileID:r.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=t.style.map.terrain.getTerrainData(n);m.draw(o,l.TRIANGLES,tI.disabled,h,u,tM.disabled,im(r,t.transform.zoom,a.paint.get("heatmap-intensity"),1),g,_,a.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,a.paint,t.transform.zoom,f)}(t,n,a,s,h):"translucent"===t.renderPass&&function(t,i,r,a,n){let s=t.context,o=s.gl,l=t.transform;s.setColorMode(t.colorModeForRenderPass());let h=ry(s,i),u=r.key,c=i.heatmapFbos.get(u);if(!c)return;s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,c.colorAttachment.get()),s.activeTexture.set(o.TEXTURE1),h.bind(o.LINEAR,o.CLAMP_TO_EDGE);let d=l.getProjectionData({overscaledTileID:r,applyTerrainMatrix:n,applyGlobeMatrix:!a});t.useProgram("heatmapTexture").draw(s,o.TRIANGLES,tI.disabled,tE.disabled,t.colorModeForRenderPass(),tM.disabled,i_(t,i,0,1),null,d,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,i.paint,l.zoom),c.destroy(),i.heatmapFbos.delete(u)}(t,a,s,l,h))}o.viewport.set([0,0,t.width,t.height])}else{let s,o,l;"offscreen"===t.renderPass?function(t,r,a,n){let s,o,l=t.context,h=l.gl,u=t.transform,c=tE.disabled,d=new tP([h.ONE,h.ONE],i.bp.transparent,[!0,!0,!0,!0]);s=l.gl,l.activeTexture.set(s.TEXTURE1),l.viewport.set([0,0,t.width/4,t.height/4]),(o=a.heatmapFbos.get(i.cd))?(s.bindTexture(s.TEXTURE_2D,o.colorAttachment.get()),l.bindFramebuffer.set(o.framebuffer)):(o=rg(l,t.width/4,t.height/4),a.heatmapFbos.set(i.cd,o)),l.clear({color:i.bp.transparent});for(let i=0;i<n.length;i++){let s=n[i];if(r.hasRenderableParent(s))continue;let o=r.getTile(s),p=o.getBucket(a);if(!p)continue;let f=p.programConfigurations.get(a.id),m=t.useProgram("heatmap",f),_=u.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),g=u.getCircleRadiusCorrection();m.draw(l,h.TRIANGLES,tI.disabled,c,d,tM.backCCW,im(o,u.zoom,a.paint.get("heatmap-intensity"),g),null,_,a.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,a.paint,u.zoom,f)}l.viewport.set([0,0,t.width,t.height])}(t,r,a,n):"translucent"===t.renderPass&&(o=(s=t.context).gl,s.setColorMode(t.colorModeForRenderPass()),(l=a.heatmapFbos.get(i.cd))&&(s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,l.colorAttachment.get()),s.activeTexture.set(o.TEXTURE1),ry(s,a).bind(o.LINEAR,o.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(s,o.TRIANGLES,tI.disabled,tE.disabled,t.colorModeForRenderPass(),tM.disabled,i_(t,a,0,1),null,null,a.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,a.paint,t.transform.zoom)))}}(t,r,a,n,s):i.cp(a)?function(t,i,r,a,n){let s;if("translucent"!==t.renderPass)return;let{isRenderingToTexture:o}=n,l=r.paint.get("line-opacity"),h=r.paint.get("line-width");if(0===l.constantOr(1)||0===h.constantOr(1))return;let u=t.getDepthModeForSublayer(0,tI.ReadOnly),c=t.colorModeForRenderPass(),d=r.paint.get("line-dasharray"),p=d.constantOr(1),f=r.paint.get("line-pattern"),m=f.constantOr(1),_=r.paint.get("line-gradient"),g=r.getCrossfadeParameters();s=m?"linePattern":p&&_?"lineGradientSDF":p?"lineSDF":_?"lineGradient":"line";let y=t.context,x=y.gl,v=t.transform,b=!0;for(let n of a){let a,l=i.getTile(n);if(m&&!l.patternsLoaded())continue;let h=l.getBucket(r);if(!h)continue;let w=h.programConfigurations.get(r.id),T=t.context.program.get(),S=t.useProgram(s,w),P=b||S.program!==T,M=t.style.map.terrain&&t.style.map.terrain.getTerrainData(n),I=f.constantOr(null),E=d&&d.constantOr(null);if(I&&l.imageAtlas){let t=l.imageAtlas,i=t.patternPositions[I.to.toString()],r=t.patternPositions[I.from.toString()];i&&r&&w.setConstantPatternPositions(i,r)}else if(E){let i="round"===r.layout.get("line-cap"),a=t.lineAtlas.getDash(E.to,i),n=t.lineAtlas.getDash(E.from,i);w.setConstantDashPositions(a,n)}let C=v.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),A=v.getPixelScale();m?(a=iw(t,l,r,A,g),y.activeTexture.set(x.TEXTURE0),l.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),w.updatePaintBuffers(g)):p&&_?(a=iS(t,l,r,A,g,h.lineClipsArray.length),function(t,i,r,a,n,s,o,l,h){let u=s.gradients[n.id],c=u.texture;n.gradientVersion!==u.version&&(c=rx(t,i,r,a,n,s,o,u)),r.activeTexture.set(a.TEXTURE0),c.bind(n.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE),r.activeTexture.set(a.TEXTURE1),t.lineAtlas.bind(r),l.updatePaintBuffers(h)}(t,i,y,x,r,h,n,w,g)):p?(a=iT(t,l,r,A,g),(P||t.lineAtlas.dirty)&&(y.activeTexture.set(x.TEXTURE0),t.lineAtlas.bind(y)),w.updatePaintBuffers(g)):_?(a=ib(t,l,r,A,h.lineClipsArray.length),function(t,i,r,a,n,s,o){let l=s.gradients[n.id],h=l.texture;n.gradientVersion!==l.version&&(h=rx(t,i,r,a,n,s,o,l)),r.activeTexture.set(a.TEXTURE0),h.bind(n.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE)}(t,i,y,x,r,h,n)):a=iv(t,l,r,A);let D=t.stencilModeForClipping(n);S.draw(y,x.TRIANGLES,u,D,c,tM.disabled,a,M,C,r.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,r.paint,t.transform.zoom,w,h.layoutVertexBuffer2),b=!1}}(t,r,a,n,s):i.cq(a)?function(t,r,a,n,s){let o=a.paint.get("fill-color"),l=a.paint.get("fill-opacity");if(0===l.constantOr(1))return;let{isRenderingToTexture:h}=s,u=t.colorModeForRenderPass(),c=a.paint.get("fill-pattern"),d=t.opaquePassEnabledForLayer()&&!c.constantOr(1)&&1===o.constantOr(i.bp.transparent).a&&1===l.constantOr(0)?"opaque":"translucent";if(t.renderPass===d){let i=t.getDepthModeForSublayer(1,"opaque"===t.renderPass?tI.ReadWrite:tI.ReadOnly);rb(t,r,a,n,i,u,!1,h)}if("translucent"===t.renderPass&&a.paint.get("fill-antialias")){let i=t.getDepthModeForSublayer(2*!!a.getPaintProperty("fill-outline-color"),tI.ReadOnly);rb(t,r,a,n,i,u,!0,h)}}(t,r,a,n,s):i.cr(a)?function(t,i,r,a,n){let s=r.paint.get("fill-extrusion-opacity");if(0===s)return;let{isRenderingToTexture:o}=n;
51if("translucent"===t.renderPass){let n=new tI(t.context.gl.LEQUAL,tI.ReadWrite,t.depthRangeFor3D);if(1!==s||r.paint.get("fill-extrusion-pattern").constantOr(1))rw(t,i,r,a,n,tE.disabled,tP.disabled,o),rw(t,i,r,a,n,t.stencilModeFor3D(),t.colorModeForRenderPass(),o);else{let s=t.colorModeForRenderPass();rw(t,i,r,a,n,tE.disabled,s,o)}}}(t,r,a,n,s):i.cs(a)?function(t,r,a,n,s){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;let{isRenderingToTexture:o}=s,l=t.context,h=t.style.projection.useSubdivision,u=t.getDepthModeForSublayer(0,tI.ReadOnly),c=t.colorModeForRenderPass();if("offscreen"===t.renderPass)!function(t,r,a,n,s,o,l){let h=t.context,u=h.gl;for(let c of a){let a=r.getTile(c),d=a.dem;if(!d||!d.data||!a.needsHillshadePrepare)continue;let p=d.dim,f=d.stride,m=d.getPixels();if(h.activeTexture.set(u.TEXTURE1),h.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture=a.demTexture||t.getTileTexture(f),a.demTexture){let t=a.demTexture;t.update(m,{premultiply:!1}),t.bind(u.NEAREST,u.CLAMP_TO_EDGE)}else a.demTexture=new i.T(h,m,u.RGBA,{premultiply:!1}),a.demTexture.bind(u.NEAREST,u.CLAMP_TO_EDGE);h.activeTexture.set(u.TEXTURE0);let _=a.fbo;if(!_){let t=new i.T(h,{width:p,height:p,data:null},u.RGBA);t.bind(u.LINEAR,u.CLAMP_TO_EDGE),(_=a.fbo=h.createFramebuffer(p,p,!0,!1)).colorAttachment.set(t.texture)}h.bindFramebuffer.set(_.framebuffer),h.viewport.set([0,0,p,p]),t.useProgram("hillshadePrepare").draw(h,u.TRIANGLES,s,o,l,tM.disabled,iy(a.tileID,d),null,null,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),a.needsHillshadePrepare=!1}}(t,r,n,a,u,tE.disabled,c),l.viewport.set([0,0,t.width,t.height]);else if("translucent"===t.renderPass)if(h){let[i,s,l]=t.stencilConfigForOverlapTwoPass(n);rT(t,r,a,l,i,u,c,!1,o),rT(t,r,a,l,s,u,c,!0,o)}else{let[i,s]=t.getStencilConfigForOverlapAndUpdateStencilID(n);rT(t,r,a,s,i,u,c,!1,o)}}(t,r,a,n,s):i.ct(a)?function(t,i,r,a,n){if("translucent"!==t.renderPass||!a.length)return;let{isRenderingToTexture:s}=n,o=t.style.projection.useSubdivision,l=t.getDepthModeForSublayer(0,tI.ReadOnly),h=t.colorModeForRenderPass();if(o){let[n,o,u]=t.stencilConfigForOverlapTwoPass(a);rS(t,i,r,u,n,l,h,!1,s),rS(t,i,r,u,o,l,h,!0,s)}else{let[n,o]=t.getStencilConfigForOverlapAndUpdateStencilID(a);rS(t,i,r,o,n,l,h,!1,s)}}(t,r,a,n,s):i.bU(a)?function(t,i,r,a,n){if("translucent"!==t.renderPass||0===r.paint.get("raster-opacity")||!a.length)return;let{isRenderingToTexture:s}=n,o=i.getSource(),l=t.style.projection.useSubdivision;if(o instanceof ea)rM(t,i,r,a,null,!1,!1,o.tileCoords,o.flippedWindingOrder,s);else if(l){let[n,o,l]=t.stencilConfigForOverlapTwoPass(a);rM(t,i,r,l,n,!1,!0,rP,!1,s),rM(t,i,r,l,o,!0,!0,rP,!1,s)}else{let[n,o]=t.getStencilConfigForOverlapAndUpdateStencilID(a);rM(t,i,r,o,n,!1,!0,rP,!1,s)}}(t,r,a,n,s):i.cu(a)?function(t,i,r,a){let n=i.paint.get("background-color"),s=i.paint.get("background-opacity");if(0===s)return;let{isRenderingToTexture:o}=a,l=t.context,h=l.gl,u=t.style.projection,c=t.transform,d=c.tileSize,p=i.paint.get("background-pattern");if(t.isPatternMissing(p))return;let f=!p&&1===n.a&&1===s&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==f)return;let m=tE.disabled,_=t.getDepthModeForSublayer(0,"opaque"===f?tI.ReadWrite:tI.ReadOnly),g=t.colorModeForRenderPass(),y=t.useProgram(p?"backgroundPattern":"background"),x=r||eP(c,{tileSize:d,terrain:t.style.map.terrain});p&&(l.activeTexture.set(h.TEXTURE0),t.imageManager.bind(t.context));let v=i.getCrossfadeParameters();for(let r of x){let a=c.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),f=p?iz(s,t,p,{tileID:r,tileSize:d},v):iD(s,n),x=t.style.map.terrain&&t.style.map.terrain.getTerrainData(r),b=u.getMeshFromTileID(l,r.canonical,!1,!0,"raster");y.draw(l,h.TRIANGLES,_,m,g,tM.backCCW,f,x,a,i.id,b.vertexBuffer,b.indexBuffer,b.segments)}}(t,a,n,s):i.cv(a)&&function(t,i,r){let{isRenderingGlobe:a}=r,n=t.context,s=i.implementation,o=t.style.projection,l=t.transform,h=l.getProjectionDataForCustomLayer(a),u={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:o.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793; 52uniform mat4 u_projection_matrix; 53${o.shaderPreludeCode.vertexSource}`,define:o.shaderDefine},defaultProjectionData:h},c=s.renderingMode?s.renderingMode:"2d";if("offscreen"===t.renderPass){let i=s.prerender;i&&(t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),i.call(s,n.gl,u),n.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),n.setStencilMode(tE.disabled);let i="3d"===c?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,tI.ReadOnly);n.setDepthMode(i),s.render(n.gl,u),n.setDirty(),t.setBaseState(),n.bindFramebuffer.set(null)}}(t,a,s))}saveTileTexture(t){let i=this._tileTextures[t.size[0]];i?i.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){let i=this._tileTextures[t];return i&&i.length>0?i.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let i=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!i||!r}useProgram(t,i,r=!1,a=[]){this.cache=this.cache||{};let n=!!this.style.map.terrain,s=this.style.projection,o=r?ts.projectionMercator:s.shaderPreludeCode,l=r?tu:s.shaderDefine,h=t+(i?i.cacheKey:"")+`/${r?tc:s.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(n?"/terrain":"")+(a?`/${a.join("/")}`:"");
53return this.cache[h]||(this.cache[h]=new ii(this.context,ts[t],i,iR[t],this._showOverdrawInspector,n,o,l,a)),this.cache[h]}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(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,i;if(this._tileTextures){for(let t in this._tileTextures){let i=this._tileTextures[t];if(i)for(let t of i)t.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&&(null==(t=this.tileExtentMesh.vertexBuffer)||t.destroy()),this.tileExtentMesh&&(null==(i=this.tileExtentMesh.indexBuffer)||i.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(let t in this.cache){let i=this.cache[t];i&&i.program&&this.context.gl.deleteProgram(i.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:i}=this.context.gl;return this.width!==t||this.height!==i}}function rO(t,i){let r,a=!1,n=null,s=null,o=()=>{n=null,a&&(t.apply(s,r),n=setTimeout(o,i),a=!1)};return(...t)=>(a=!0,s=this,r=t,n||o(),n)}class rV{constructor(t){this._getCurrentHash=()=>{let t=window.location.hash.replace("#","");if(this._hashName){let i;return t.split("&").map(t=>t.split("=")).forEach(t=>{t[0]===this._hashName&&(i=t)}),(i&&i[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let i=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getCurrentHash();if(0===t.length)return;let i=t.join("/"),r=i;r.split("&").length>0&&(r=r.split("&")[0]),this._hashName&&(r=`${this._hashName}=${i}`);let a=window.location.hash.replace(r,"");a.startsWith("#&")?a=a.slice(0,1)+a.slice(2):"#"===a&&(a="");let n=window.location.href.replace(/(#.+)?$/,a);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=rO(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){let i=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,a=Math.pow(10,Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10)),n=Math.round(i.lng*a)/a,s=Math.round(i.lat*a)/a,o=this._map.getBearing(),l=this._map.getPitch(),h="";if(h+=t?`/${n}/${s}/${r}`:`${r}/${s}/${n}
53`,(o||l)&&(h+="/"+Math.round(10*o)/10),l&&(h+=`/${Math.round(l)}`),this._hashName){let t=this._hashName,i=!1,r=window.location.hash.slice(1).split("&").map(r=>{let a=r.split("=")[0];return a===t?(i=!0,`${a}=${h}`):r}).filter(t=>t);return i||r.push(`${t}=${h}`),`#${r.join("&")}`}return`#${h}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new i.V(+t[2],+t[1])}catch(t){return!1}let r=+t[0],a=+(t[3]||0),n=+(t[4]||0);return r>=this._map.getMinZoom()&&r<=this._map.getMaxZoom()&&a>=-180&&a<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}let rj={linearity:.3,easing:i.cw(0,0,.3,1)},rN=i.e({deceleration:2500,maxSpeed:1400},rj),rU=i.e({deceleration:20,maxSpeed:1400},rj),rG=i.e({deceleration:1e3,maxSpeed:360},rj),rq=i.e({deceleration:1e3,maxSpeed:90},rj),rZ=i.e({deceleration:1e3,maxSpeed:360},rj);class r${constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:v(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,i=v();for(;t.length>0&&i-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let r={zoom:0,bearing:0,pitch:0,roll:0,pan:new i.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:t}of this._inertiaBuffer)r.zoom+=t.zoomDelta||0,r.bearing+=t.bearingDelta||0,r.pitch+=t.pitchDelta||0,r.roll+=t.rollDelta||0,t.panDelta&&r.pan._add(t.panDelta),t.around&&(r.around=t.around),t.pinchAround&&(r.pinchAround=t.pinchAround);let a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(r.pan.mag()){let s=rH(r.pan.mag(),a,i.e({},rN,t||{})),o=r.pan.mult(s.amount/r.pan.mag()),l=this._map.cameraHelper.handlePanInertia(o,this._map.transform);n.center=l.easingCenter,n.offset=l.easingOffset,rW(n,s)}if(r.zoom){let t=rH(r.zoom,a,rU);n.zoom=this._map.transform.zoom+t.amount,rW(n,t)}if(r.bearing){let t=rH(r.bearing,a,rG);n.bearing=this._map.transform.bearing+i.an(t.amount,-179,179),rW(n,t)}if(r.pitch){let t=rH(r.pitch,a,rq);n.pitch=this._map.transform.pitch+t.amount,rW(n,t)}if(r.roll){let t=rH(r.roll,a,rZ);n.roll=this._map.transform.roll+i.an(t.amount,-179,179),rW(n,t)}if(n.zoom||n.bearing){let t=void 0===r.pinchAround?r.around:r.pinchAround;n.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),i.e(n,{noMoveStart:!0})}}function rW(t,i){(!t.duration||t.duration<i.duration)&&(t.duration=i.duration,t.easing=i.easing)}function rH(t,r,a){let{maxSpeed:n,linearity:s,deceleration:o}=a,l=i.an(t*s/(r/1e3),-n,n),h=Math.abs(l)/(o*s);return{easing:a.easing,duration:1e3*h,amount:h/2*l}}class rX extends i.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,a,n={}){a=a instanceof MouseEvent?a:new MouseEvent(t,a);const s=b.mousePos(r.getCanvas(),a),o=r.unproject(s);super(t,i.e({point:s,lngLat:o,originalEvent:a},n)),this._defaultPrevented=!1,this.target=r}}class rY extends i.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,a){const n="touchend"===t?a.changedTouches:a.touches,s=b.touchPos(r.getCanvasContainer(),n),o=s.map(t=>r.unproject(t)),l=s.reduce((t,i,r,a)=>t.add(i.div(a.length)),new i.P(0,0));super(t,{points:s,point:l,lngLats:o,lngLat:r.unproject(l),originalEvent:a}),this._defaultPrevented=!1}}class rK extends i.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r){super(t,{originalEvent:r}),this._defaultPrevented=!1}}class rJ{constructor(t,i){this._map=t,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new rK(t.type,this._map,t))}mousedown(t,i){return this._mousedownPos=i,this._firePreventable(new rX(t.type,this._map,t))}mouseup(t){this._map.fire(new rX(t.type,this._map,t))}click(t,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new rX(t.type,this._map,t))}dblclick(t){return this._firePreventable(new rX(t.type,this._map,t))}mouseover(t){this._map.fire(new rX(t.type,this._map,t))}mouseout(t){this._map.fire(new rX(t.type,this._map,t))}touchstart(t){return this._firePreventable(new rY(t.type,this._map,t))}touchmove(t){this._map.fire(new rY(t.type,this._map,t))}touchend(t){this._map.fire(new rY(t.type,this._map,t))}touchcancel(t){this._map.fire(new rY(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class rQ{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new rX(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new rX("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new rX(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class r0{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(i.P.convert(t),this._map.terrain)}}class r1{constructor(t,i){this._map=t,this._tr=new r0(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,i){this.isEnabled()&&t.shiftKey&&0===t.button&&(b.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(t,i){if(!this._active||this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=i,this._box||(this._box=b.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));let a=Math.min(r.x,i.x),n=Math.max(r.x,i.x),s=Math.min(r.y,i.y),o=Math.max(r.y,i.y);b.setTransform(this._box,`translate(${a}px,${s}px)`),this._box.style.width=n-a+"px",this._box.style.height=o-s+"px"}mouseupWindow(t,r){if(!this._active||0!==t.button)return;let a=this._startPos;if(this.reset(),b.suppressClick(),a.x!==r.x||a.y!==r.y)return this._map.fire(new i.l("boxzoomend",{originalEvent:t})),{cameraAnimation:t=>t.fitScreenCoordinates(a,r,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(b.remove(this._box),this._box=null),b.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,r){return this._map.fire(new i.l(t,{originalEvent:r}))}}function r2(t,i){if(t.length!==i.length)throw Error(`The number of touches and points are not equal - touches ${t.length}, points ${i.length}`);let r={};for(let a=0;a<t.length;a++)r[t[a].identifier]=i[a];return r}class r3{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,r,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(t){let r=new i.P(0,0);for(let i of t)r._add(i);return r.div(t.length)}(r),this.touches=r2(a,r)))}touchmove(t,i,r){if(this.aborted||!this.centroid)return;let a=r2(r,i);for(let t in this.touches){let i=a[t];(!i||i.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,i,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){let t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class r5{constructor(t){this.singleTap=new r3(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,i,r){this.singleTap.touchstart(t,i,r)}touchmove(t,i,r){this.singleTap.touchmove(t,i,r)}touchend(t,i,r){let a=this.singleTap.touchend(t,i,r);
53if(a){let i=t.timeStamp-this.lastTime<500,r=!this.lastTap||30>this.lastTap.dist(a);if(i&&r||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class r4{constructor(t){this._tr=new r0(t),this._zoomIn=new r5({numTouches:1,numTaps:2}),this._zoomOut=new r5({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,i,r){this._zoomIn.touchstart(t,i,r),this._zoomOut.touchstart(t,i,r)}touchmove(t,i,r){this._zoomIn.touchmove(t,i,r),this._zoomOut.touchmove(t,i,r)}touchend(t,i,r){let a=this._zoomIn.touchend(t,i,r),n=this._zoomOut.touchend(t,i,r),s=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:s.zoom+1,around:s.unproject(a)},{originalEvent:t})}):n?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:s.zoom-1,around:s.unproject(n)},{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 r6{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){let i=this._moveFunction(...t);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(t,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,i){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);let a=Array.isArray(i)?i[0]:i;return!this._moved&&a.dist(r)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=a,this._move(r,a))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&b.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}}let r8={0:1,2:2};class r9{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){let i=b.mouseButton(t);this._eventButton=i}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){let i;return i=r8[this._eventButton],void 0!==t.buttons&&(t.buttons&i)===i}isValidEndEvent(t){return b.mouseButton(t)===this._eventButton}}class r7{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_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 ae{constructor(t=new r9({checkCorrectEvent:()=>!0}),i=new r7){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(t,i,r){return t instanceof MouseEvent?i(t):"u">typeof TouchEvent&&t instanceof TouchEvent?r(t):void 0}startMove(t){this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.startMove(t),t=>this.oneFingerTouchMoveStateManager.startMove(t))}endMove(t){this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.endMove(t),t=>this.oneFingerTouchMoveStateManager.endMove(t))}isValidStartEvent(t){return this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidStartEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t))}isValidMoveEvent(t){return this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidMoveEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t))}isValidEndEvent(t){return this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidEndEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t))}}let at=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}};class ai{constructor(t,i){this._clickTolerance=t.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new i.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,i,r){return this._calculateTransform(t,i,r)}touchmove(t,i,r){if(this._active){if(!this._shouldBePrevented(r.length))return t.preventDefault(),this._calculateTransform(t,i,r);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,i,r){this._calculateTransform(t,i,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,r,a){a.length>0&&(this._active=!0);let n=r2(a,r),s=new i.P(0,0),o=new i.P(0,0),l=0;for(let t in n){let i=n[t],r=this._touches[t];r&&(s._add(i),o._add(i.sub(r)),l++,n[t]=i)}if(this._touches=n,this._shouldBePrevented(l)||!o.mag())return;let h=o.div(l);return this._sum._add(h),this._sum.mag()<this._clickTolerance?void 0:{around:s.div(l),panDelta:h}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ar{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,i,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([i[0],i[1]]))}touchmove(t,i,r){if(!this._firstTwoTouches)return;t.preventDefault();let[a,n]=this._firstTwoTouches,s=aa(r,i,a),o=aa(r,i,n);if(!s||!o)return;let l=this._aroundCenter?null:s.add(o).div(2);return this._move([s,o],l,t)}touchend(t,i,r){if(!this._firstTwoTouches)return;let[a,n]=this._firstTwoTouches,s=aa(r,i,a),o=aa(r,i,n);s&&o||(this._active&&b.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function aa(t,i,r){for(let a=0;a<t.length;a++)if(t[a].identifier===r)return i[a]}function an(t,i){return Math.log(t/i)/Math.LN2}class as extends ar{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,i){let r=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(.1>Math.abs(an(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:an(this._distance,r),pinchAround:i}}}function ao(t,i){return 180*t.angleWith(i)/Math.PI}class al extends ar{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,i,r){let a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ao(this._vector,a),pinchAround:i}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());let i=25/(Math.PI*this._minDiameter)*360;return Math.abs(ao(t,this._startVector))<i}}function ah(t){return Math.abs(t.y)>Math.abs(t.x)}class au extends ar{constructor(t){super(),this._currentTouchCount=0,this._map=t}
53reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,i,r){super.touchstart(t,i,r),this._currentTouchCount=r.length}_start(t){this._lastPoints=t,ah(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,i,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let a=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(a,n,r.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:-((a.y+n.y)/2*.5)}):void 0}gestureBeginsVertically(t,i,r){if(void 0!==this._valid)return this._valid;let a=t.mag()>=2,n=i.mag()>=2;if(!a&&!n)return;if(!a||!n)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;let s=t.y>0==i.y>0;return ah(t)&&ah(i)&&s}}let ac=100,ad=15,ap=10;class af{constructor(t){this._tr=new r0(t),this._panStep=ac,this._bearingStep=ad,this._pitchStep=ap,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let i=0,r=0,a=0,n=0,s=0;switch(t.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?a=1:(t.preventDefault(),s=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(r=0,a=0),{cameraAnimation:o=>{let l=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:am,zoom:i?Math.round(l.zoom)+i*(t.shiftKey?2:1):l.zoom,bearing:l.bearing+r*this._bearingStep,pitch:l.pitch+a*this._pitchStep,offset:[-n*this._panStep,-s*this._panStep],center:l.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 am(t){return t*(2-t)}let a_=1/450;class ag{constructor(t,i){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new r0(t),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=a_}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}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 i=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,r=v(),a=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%4.000244140625==0?this._type="wheel":0!==i&&4>Math.abs(i)?this._type="trackpad":a>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=200>Math.abs(a*i)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,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);let r=b.mousePos(this._map.getCanvas(),t),a=this._tr;this._aroundPoint=this._aroundCenter?a.transform.locationToScreenPoint(i.V.convert(a.center)):r,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let i=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=i),"number"==typeof this._targetZoom&&(this._targetZoom+=i)}if(0!==this._delta){let r="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,a=2/(1+Math.exp(-Math.abs(this._delta*r)));this._delta<0&&0!==a&&(a=1/a);let n="number"!=typeof this._targetZoom?t.scale:i.aq(this._targetZoom);this._targetZoom=t.applyConstrain(t.getCameraLngLat(),i.at(n*a)).zoom,"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let r="number"!=typeof this._targetZoom?t.zoom:this._targetZoom,a=this._startZoom,n=this._easing,s,o=!1;if("wheel"===this._type&&a&&n){let t=Math.min((v()-this._lastWheelEventTime+5)/200,1),l=n(t);s=i.G.number(a,r,l),t<1?this._frameId||(this._frameId=!0):o=!0}else s=r,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout(()=>
53{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=s,{noInertia:!0,needsRenderFrame:!o,zoomDelta:s-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let r=i.cy;if(this._prevEase){let t=this._prevEase,a=(v()-t.start)/t.duration,n=t.easing(a+.01)-t.easing(a),s=.27/Math.sqrt(n*n+1e-4)*.01,o=Math.sqrt(.0729-s*s);r=i.cw(s,o,.25,1)}return this._prevEase={start:v(),duration:t,easing:r},r}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ay{constructor(t,i){this._clickZoom=t,this._tapZoom=i}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 ax{constructor(t){this._tr=new r0(t),this.reset()}reset(){this._active=!1}dblclick(t,i){return t.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(i)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class av{constructor(){this._tap=new r5({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,i,r){if(!this._swipePoint)if(this._tapTime){let a=i[0],n=t.timeStamp-this._tapTime<500,s=30>this._tapPoint.dist(a);n&&s?r.length>0&&(this._swipePoint=a,this._swipeTouch=r[0].identifier):this.reset()}else this._tap.touchstart(t,i,r)}touchmove(t,i,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let a=i[0],n=a.y-this._swipePoint.y;return this._swipePoint=a,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(t,i,r)}touchend(t,i,r){if(this._tapTime)this._swipePoint&&0===r.length&&this.reset();else{let a=this._tap.touchend(t,i,r);a&&(this._tapTime=t.timeStamp,this._tapPoint=a)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ab{constructor(t,i,r){this._el=t,this._mousePan=i,this._touchPan=r}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 aw{constructor(t,i,r,a){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=i,this._mousePitch=r,this._mouseRoll=a}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 aT{constructor(t,i,r,a){this._el=t,this._touchZoom=i,this._touchRotate=r,this._tapDragZoom=a,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 aS{constructor(t,i){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=b.create("div","maplibregl-cooperative-gesture-screen",t);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),a=document.createElement("div");a.className="maplibregl-desktop-message",a.textContent=i,this._container.appendChild(a);let n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=r,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(b.remove(this._container),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,r){this._enabled&&(this._map.fire(new i.l("cooperativegestureprevented",{gestureType:t,originalEvent:r})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let aP=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate;class aM extends i.l{}function aI(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}class aE{constructor(t,r){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,r)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;let a="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},s={},o={};for(let{handlerName:l,handler:h,allowed:u}of this._handlers){let c;
53if(h.isEnabled()){if(this._blockedByActive(o,u,l))h.reset();else if(h[r||t.type]){if(i.cz(t,r||t.type)){let i=b.mousePos(this._map.getCanvas(),t);c=h[r||t.type](t,i)}else if(i.cA(t,r||t.type)){let i=this._getMapTouches(t.touches),a=b.touchPos(this._map.getCanvas(),i);c=h[r||t.type](t,a,i)}else i.cB(r||t.type)||(c=h[r||t.type](t));this.mergeHandlerResult(n,s,c,l,a),c&&c.needsRenderFrame&&this._triggerRenderFrame()}(c||h.isActive())&&(o[l]=h)}}let l={};for(let t in this._previousActiveHandlers)o[t]||(l[t]=a);this._previousActiveHandlers=o,(Object.keys(l).length||aI(n))&&(this._changes.push([n,s,l]),this._triggerRenderFrame()),(Object.keys(o).length||aI(n))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:h}=n;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new r$(t),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r);const a=this._el;for(const[t,i,r]of(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],[document,"mousemove",{capture:!0}],[document,"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],[window,"blur",void 0]],this._listeners))b.addEventListener(t,i,t===document?this.handleWindowEvent:this.handleEvent,r)}destroy(){for(let[t,i,r]of this._listeners)b.removeEventListener(t,i,t===document?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(t){let r=this._map,a=r.getCanvasContainer();this._add("mapEvent",new rJ(r,t));let n=r.boxZoom=new r1(r,t);this._add("boxZoom",n),t.interactive&&t.boxZoom&&n.enable();let s=r.cooperativeGestures=new aS(r,t.cooperativeGestures);this._add("cooperativeGestures",s),t.cooperativeGestures&&s.enable();let o=new r4(r),l=new ax(r);r.doubleClickZoom=new ay(l,o),this._add("tapZoom",o),this._add("clickZoom",l),t.interactive&&t.doubleClickZoom&&r.doubleClickZoom.enable();let h=new av;this._add("tapDragZoom",h);let u=r.touchPitch=new au(r);this._add("touchPitch",u),t.interactive&&t.touchPitch&&r.touchPitch.enable(t.touchPitch);let c=()=>r.project(r.getCenter()),d=function({enable:t,clickTolerance:r,aroundCenter:a=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:s=.8},o){return new r6({clickTolerance:r,move:(t,r)=>{let l=o();if(a&&Math.abs(l.y-t.y)>n)return{bearingDelta:i.cx(new i.P(t.x,r.y),r,l)};let h=(r.x-t.x)*s;return a&&r.y<l.y&&(h=-h),{bearingDelta:h}},moveStateManager:new r9({checkCorrectEvent:t=>0===b.mouseButton(t)&&t.ctrlKey||2===b.mouseButton(t)&&!t.ctrlKey}),enable:t,assignEvents:at})}(t,c),p=function({enable:t,clickTolerance:i,pitchDegreesPerPixelMoved:r=-.5}){return new r6({clickTolerance:i,move:(t,i)=>({pitchDelta:(i.y-t.y)*r}),moveStateManager:new r9({checkCorrectEvent:t=>0===b.mouseButton(t)&&t.ctrlKey||2===b.mouseButton(t)}),enable:t,assignEvents:at})}(t),f=function({enable:t,clickTolerance:i,rollDegreesPerPixelMoved:r=.3},a){return new r6({clickTolerance:i,move:(t,i)=>{let n=a(),s=(i.x-t.x)*r;return i.y<n.y&&(s=-s),{rollDelta:s}},moveStateManager:new r9({checkCorrectEvent:t=>2===b.mouseButton(t)&&t.ctrlKey}),enable:t,assignEvents:at})}(t,c);r.dragRotate=new aw(t,d,p,f),this._add("mouseRotate",d,["mousePitch"]),this._add("mousePitch",p,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),t.interactive&&t.dragRotate&&r.dragRotate.enable();let m=function({enable:t,clickTolerance:i}){return new r6({clickTolerance:i,move:(t,i)=>({around:i,panDelta:i.sub(t)}),activateOnStart:!0,moveStateManager:new r9({checkCorrectEvent:t=>0===b.mouseButton(t)&&!t.ctrlKey}),enable:t,assignEvents:at})}(t),_=new ai(t,r);r.dragPan=new ab(a,m,_),this._add("mousePan",m),this._add("touchPan",_,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&r.dragPan.enable(t.dragPan);let g=new al,y=new as;r.touchZoomRotate=new aT(a,y,g,h),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&r.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new rQ(r));let x=r.scrollZoom=new ag(r,()=>
53this._triggerRenderFrame());this._add("scrollZoom",x,["mousePan"]),t.interactive&&t.scrollZoom&&r.scrollZoom.enable(t.scrollZoom);let v=r.keyboard=new af(r);this._add("keyboard",v),t.interactive&&t.keyboard&&r.keyboard.enable()}_add(t,i,r){this._handlers.push({handlerName:t,handler:i,allowed:r}),this._handlersById[t]=i}stop(t){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{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!!aP(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,i,r){for(let a in t)if(a!==r&&(!i||0>i.indexOf(a)))return!0;return!1}_getMapTouches(t){let i=[];for(let r of t)this._el.contains(r.target)&&i.push(r);return i}mergeHandlerResult(t,r,a,n,s){if(!a)return;i.e(t,a);let o={handlerName:n,originalEvent:a.originalEvent||s};void 0!==a.zoomDelta&&(r.zoom=o),void 0!==a.panDelta&&(r.drag=o),void 0!==a.rollDelta&&(r.roll=o),void 0!==a.pitchDelta&&(r.pitch=o),void 0!==a.bearingDelta&&(r.rotate=o)}_applyChanges(){let t={},r={},a={};for(let[n,s,o]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new i.P(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(t.rollDelta=(t.rollDelta||0)+n.rollDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),i.e(r,s),i.e(a,o);this._updateMapTransform(t,r,a),this._changes=[]}_updateMapTransform(t,i,r){let a=this._map,n=a._getTransformForUpdate(),s=a.terrain;if(!(aI(t)||s&&this._terrainMovement))return this._fireEvents(i,r,!0);a._stop(!0);let{panDelta:o,zoomDelta:l,bearingDelta:h,pitchDelta:u,rollDelta:c,around:d,pinchAround:p}=t;void 0!==p&&(d=p),d=d||a.transform.centerPoint,s&&!n.isPointOnMapSurface(d)&&(d=n.centerPoint);let f={panDelta:o,zoomDelta:l,rollDelta:c,pitchDelta:u,bearingDelta:h,around:d};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(d)&&(d=n.centerPoint);let m=.01>d.distSqr(n.centerPoint)?n.center:n.screenPointToLocation(o?d.sub(o):d);this._handleMapControls({terrain:s,tr:n,deltasForHelper:f,preZoomAroundLoc:m,combinedEventsInProgress:i,panDelta:o}),a._applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,r,!0)}_handleMapControls({terrain:t,tr:i,deltasForHelper:r,preZoomAroundLoc:a,combinedEventsInProgress:n,panDelta:s}){let o=this._map.cameraHelper;(o.handleMapControlsRollPitchBearingZoom(r,i),t)?o.useGlobeControls?(!this._terrainMovement&&(n.drag||n.zoom)&&(this._terrainMovement=!0,this._map._elevationFreeze=!0),o.handleMapControlsPan(r,i,a)):!this._terrainMovement&&(n.drag||n.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,o.handleMapControlsPan(r,i,a)):n.drag&&this._terrainMovement&&s?i.setCenter(i.screenPointToLocation(i.centerPoint.sub(s))):o.handleMapControlsPan(r,i,a):o.handleMapControlsPan(r,i,a)}_fireEvents(t,r,a){let n,s=aP(this._eventsInProgress),o=aP(t),l={};for(let i in t){let{originalEvent:r}=t[i];this._eventsInProgress[i]||(l[`${i}start`]=r),this._eventsInProgress[i]=t[i]}for(let t in!s&&o&&this._fireEvent("movestart",o.originalEvent),l)this._fireEvent(t,l[t]);for(let i in o&&this._fireEvent("move",o.originalEvent),t){let{originalEvent:r}=t[i];this._fireEvent(i,r)}let h={};for(let t in this._eventsInProgress){let{handlerName:i,originalEvent:a}=this._eventsInProgress[t];this._handlersById[i].isActive()||(delete this._eventsInProgress[t],n=r[i]||a,h[`${t}end`]=n)}for(let t in h)this._fireEvent(t,h[t]);let u=aP(this._eventsInProgress),c=(s||o)&&!u;if(c&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let t=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(t)}if(a&&c){this._updatingCamera=!0;let t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),r=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;t&&(t.essential||!y.prefersReducedMotion)?(r(t.bearing||this._map.getBearing())&&
53(t.bearing=0),t.freezeElevation=!0,this._map.easeTo(t,{originalEvent:n})):(this._map.fire(new i.l("moveend",{originalEvent:n})),r(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,r){this._map.fire(new i.l(t,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new aM("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class aC extends i.E{constructor(t,i,r){super(),this._renderFrameCallback=()=>{let t=Math.min((v()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=r.bearingSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(t,i){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=i}getCenter(){return new i.V(this.transform.center.lng,this.transform.center.lat)}setCenter(t,i){return this.jumpTo({center:t},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,i){return this.jumpTo({elevation:t},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,r,a){return t=i.P.convert(t).mult(-1),this.panTo(this.transform.center,i.e({offset:t},r),a)}panTo(t,r,a){return this.easeTo(i.e({center:t},r),a)}getZoom(){return this.transform.zoom}setZoom(t,i){return this.jumpTo({zoom:t},i),this}zoomTo(t,r,a){return this.easeTo(i.e({zoom:t},r),a)}zoomIn(t,i){return this.zoomTo(this.getZoom()+1,t,i),this}zoomOut(t,i){return this.zoomTo(this.getZoom()-1,t,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,r){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new i.l("movestart",r)).fire(new i.l("move",r)).fire(new i.l("moveend",r))),this}getBearing(){return this.transform.bearing}setBearing(t,i){return this.jumpTo({bearing:t},i),this}getPadding(){return this.transform.padding}setPadding(t,i){return this.jumpTo({padding:t},i),this}rotateTo(t,r,a){return this.easeTo(i.e({bearing:t},r),a)}resetNorth(t,r){return this.rotateTo(0,i.e({duration:1e3},t),r),this}resetNorthPitch(t,r){return this.easeTo(i.e({bearing:0,pitch:0,roll:0,duration:1e3},t),r),this}snapToNorth(t,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,i):this}getPitch(){return this.transform.pitch}setPitch(t,i){return this.jumpTo({pitch:t},i),this}getRoll(){return this.transform.roll}setRoll(t,i){return this.jumpTo({roll:t},i),this}cameraForBounds(t,i){t=Y.convert(t).adjustAntiMeridian();let r=i&&i.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),r,i)}_cameraForBoxAndBearing(t,r,a,n){let s={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=i.e({padding:s,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){let t=n.padding;n.padding={top:t,bottom:t,right:t,left:t}}let o=i.e(s,n.padding);n.padding=o;let l=this.transform,h=new Y(t,r);return this.cameraHelper.cameraForBoxAndBearing(n,o,h,a,l)}fitBounds(t,i,r){return this._fitInternal(this.cameraForBounds(t,i),i,r)}fitScreenCoordinates(t,r,a,n,s){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(i.P.convert(t)),this.transform.screenPointToLocation(i.P.convert(r)),a,n),n,s)}_fitInternal(t,r,a){return t?(delete(r=i.e(t,r)).padding,r.linear?this.easeTo(r,a):this.flyTo(r,a)):this}jumpTo(t,r){this.stop();let a=this._getTransformForUpdate(),n=!1,s=!1,o=!1,l=a.zoom;this.cameraHelper.handleJumpToCenterZoom(a,t);let h=a.zoom!==l;return"elevation"in t&&a.elevation!==+t.elevation&&a.setElevation(+t.elevation),"bearing"in t&&a.bearing!==+t.bearing&&(n=!0,a.setBearing(+t.bearing)),"pitch"in t&&a.pitch!==+t.pitch&&(s=!0,a.setPitch(+t.pitch)),"roll"in t&&a.roll!==+t.roll&&(o=!0,a.setRoll(+t.roll)),null==t.padding||a.isPaddingEqual(t.padding)||a.setPadding(t.padding),this._applyUpdatedTransform(a),this.fire(new i.l("movestart",r)).fire(new i.l("move",r)),h&&this.fire(new i.l("zoomstart",r)).fire(new i.l("zoom",r)).fire(new i.l("zoomend",r)),n&&this.fire(new i.l("rotatestart",r)).fire(new i.l("rotate",r)).fire(new i.l("rotateend",r)),s&&this.fire(new i.l("pitchstart",r)).fire(new i.l("pitch",r)).fire(new i.l("pitchend",r)),o&&this.fire(new i.l("rollstart",r)).fire(new i.l("roll",r)).fire(new i.l("rollend",r)),this.fire(new i.l("moveend",r))}calculateCameraOptionsFromTo(t,r,a,n=0){let s=i.a9.fromLngLat(t,r),o=i.a9.fromLngLat(a,n),l=o.x-s.x,h=o.y-s.y,u=o.z-s.z,c=Math.hypot(l,h,u);if(0===c)throw Error("Can't calculate camera options with same From and To");let d=Math.hypot(l,h),p=i.at(this.transform.cameraToCenterDistance/c/this.transform.tileSize),f=180*Math.atan2(l,-h)/Math.PI,m=180*Math.acos(d/c)/Math.PI;return m=u<0?90-m:90+m,{center:o.toLngLat(),elevation:n,zoom:p,pitch:m,bearing:f}}calculateCameraOptionsFromCameraLngLatAltRotation(t,i,r,a,n){let s=this.transform.calculateCenterFromCameraLngLatAlt(t,i,r,a);return{center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:r,pitch:a,roll:n}}easeTo(t,r){let a,n;this._stop(!1,t.easeId),(!1===(t=i.e({offset:[0,0],duration:500,easing:i.cy},t)).animate||!t.essential&&y.prefersReducedMotion)&&(t.duration=0);let s=this._getTransformForUpdate(),o=this.getBearing(),l=s.pitch,h=s.roll,u="bearing"in t?this._normalizeBearing(t.bearing,o):o,c="pitch"in t?+t.pitch:l,d="roll"in t?this._normalizeBearing(t.roll,h):h,p="padding"in t?t.padding:s.padding,f
53=i.P.convert(t.offset);t.around&&(a=i.V.convert(t.around),n=s.locationToScreenPoint(a));let m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},_=this.cameraHelper.handleEaseTo(s,{bearing:u,pitch:c,roll:d,padding:p,around:a,aroundPoint:n,offsetAsPoint:f,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||o!==u,this._pitching=this._pitching||c!==l,this._rolling=this._rolling||d!==h,this._padding=!s.isPaddingEqual(p),this._zooming=this._zooming||_.isZooming,this._easeId=t.easeId,this._prepareEase(r,t.noMoveStart,m),this.terrain&&this._prepareElevation(_.elevationCenter),this._ease(i=>{_.easeFunc(i),this.terrain&&!t.freezeElevation&&this._updateElevation(i),this._applyUpdatedTransform(s),this._fireMoveEvents(r)},i=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r,i)},t),this}_prepareEase(t,r,a={}){this._moving=!0,r||a.moving||this.fire(new i.l("movestart",t)),this._zooming&&!a.zooming&&this.fire(new i.l("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new i.l("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new i.l("pitchstart",t)),this._rolling&&!a.rolling&&this.fire(new i.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){void 0!==this._elevationStart&&void 0!==this._elevationCenter||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let r=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&r!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(i-(r-(i*t+this._elevationStart))/(1-t)),this._elevationTarget=r}this.transform.setElevation(i.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{};let i=t.getCameraLngLat(),r=t.getCameraAltitude(),a=this.terrain?this.terrain.getElevationForLngLatZoom(i,t.zoom):0;if(r<a){let r=this.calculateCameraOptionsFromTo(i,a,t.center,t.elevation);return{pitch:r.pitch,zoom:r.zoom}}return{}}_applyUpdatedTransform(t){let i=[];if(i.push(t=>this._elevateCameraIfInsideTerrain(t)),this.transformCameraUpdate&&i.push(t=>this.transformCameraUpdate(t)),!i.length)return;let r=t.clone();for(let t of i){let i=r.clone(),{center:a,zoom:n,roll:s,pitch:o,bearing:l,elevation:h}=t(i);a&&i.setCenter(a),void 0!==h&&i.setElevation(h),void 0!==n&&i.setZoom(n),void 0!==s&&i.setRoll(s),void 0!==o&&i.setPitch(o),void 0!==l&&i.setBearing(l),r.apply(i,!1)}this.transform.apply(r,!1)}_fireMoveEvents(t){this.fire(new i.l("move",t)),this._zooming&&this.fire(new i.l("zoom",t)),this._rotating&&this.fire(new i.l("rotate",t)),this._pitching&&this.fire(new i.l("pitch",t)),this._rolling&&this.fire(new i.l("roll",t))}_afterEase(t,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;let a=this._zooming,n=this._rotating,s=this._pitching,o=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,a&&this.fire(new i.l("zoomend",t)),n&&this.fire(new i.l("rotateend",t)),s&&this.fire(new i.l("pitchend",t)),o&&this.fire(new i.l("rollend",t)),this.fire(new i.l("moveend",t))}flyTo(t,r){if(!t.essential&&y.prefersReducedMotion){let a=i.U(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(a,r)}this.stop(),t=i.e({offset:[0,0],speed:1.2,curve:1.42,easing:i.cy},t);let a=this._getTransformForUpdate(),n=a.bearing,s=a.pitch,o=a.roll,l=a.padding,h="bearing"in t?this._normalizeBearing(t.bearing,n):n,u="pitch"in t?+t.pitch:s,c="roll"in t?this._normalizeBearing(t.roll,o):o,d="padding"in t?t.padding:a.padding,p=i.P.convert(t.offset),f=a.centerPoint.add(p),m=a.screenPointToLocation(f),_=this.cameraHelper.handleFlyTo(a,{bearing:h,pitch:u,roll:c,padding:d,locationAtOffset:m,offsetAsPoint:p,center:t.center,minZoom:t.minZoom,zoom:t.zoom}),g=t.curve,x=Math.max(a.width,a.height),v=x/_.scaleOfZoom,b=_.pixelPathLength;"number"==typeof _.scaleOfMinZoom&&(g=Math.sqrt(x/_.scaleOfMinZoom/b*2));let w=g*g;function T(t){let i=(v*v-x*x+(t?-1:1)*w*w*b*b)/(2*(t?v:x)*w*b);return Math.log(Math.sqrt(i*i+1)-i)}function S(t){return(Math.exp(t)-Math.exp(-t))/2}function P(t){return(Math.exp(t)+Math.exp(-t))/2}let M=T(!1),I=function(t){return P(M)/P(M+g*t)},E=function(t){var i;
53return x*((P(M)*(S(i=M+g*t)/P(i))-S(M))/w)/b},C=(T(!0)-M)/g;if(2e-6>Math.abs(b)||!isFinite(C)){if(1e-6>Math.abs(x-v))return this.easeTo(t,r);let i=v<x?-1:1;C=Math.abs(Math.log(v/x))/g,E=()=>0,I=t=>Math.exp(i*g*t)}return t.duration="duration"in t?+t.duration:1e3*C/("screenSpeed"in t?t.screenSpeed/g:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=n!==h,this._pitching=u!==s,this._rolling=c!==o,this._padding=!a.isPaddingEqual(d),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(_.targetCenter),this._ease(m=>{let g=m*C,y=1/I(g),x=E(g);this._rotating&&a.setBearing(i.G.number(n,h,m)),this._pitching&&a.setPitch(i.G.number(s,u,m)),this._rolling&&a.setRoll(i.G.number(o,c,m)),this._padding&&(a.interpolatePadding(l,d,m),f=a.centerPoint.add(p)),_.easeFunc(m,y,x,f),this.terrain&&!t.freezeElevation&&this._updateElevation(m),this._applyUpdatedTransform(a),this._fireMoveEvents(r)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,i){var r;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,i)}return t||null==(r=this.handlers)||r.stop(!1),this}_ease(t,i,r){!1===r.animate||0===r.duration?(t(1),i()):(this._easeStart=v(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,r){let a=Math.abs((t=i.W(t,-180,180))-r);return Math.abs(t-360-r)<a&&(t-=360),Math.abs(t+360-r)<a&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(i.V.convert(t),this.transform):null}}let aA={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class aD{constructor(t=aA){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{t&&("metadata"===t.sourceDataType||"visibility"===t.sourceDataType||"style"===t.dataType||"terrain"===t.type)&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?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=b.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=b.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=b.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(){b.remove(this._container),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,i){let r=this._map._getUIString(`AttributionControl.${i}`);t.title=r,t.setAttribute("aria-label",r)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(t=>"string"!=typeof t?"":t)):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}let i=this._map.style.tileManagers;for(let r in i){let a=i[r];if(a.used||a.usedForTerrain){let i=a.getSource();i.attribution&&0>t.indexOf(i.attribution)&&t.push(i.attribution)}}(t=t.filter(t=>String(t).trim())).sort((t,i)=>t.length-i.length);let r=(t=t.filter((i,r)=>{for(let a=r+1;a<t.length;a++)if(t[a].indexOf(i)>=0)return!1;return!0})).join(" | ");r!==this._attribHTML&&(this._attribHTML=r,t.length?(this._innerContainer.innerHTML=b.sanitize(r),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class az{constructor(t={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let i=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&i.classList.add("maplibregl-compact"):i.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=b.create("div","maplibregl-ctrl");let i=b.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){b.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ak{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let i=++this._id;return this._queue.push({callback:t,id:i,cancelled:!1}),i}remove(t){let i=this._currentlyRunning;for(let r of i?this._queue.concat(i):this._queue)if(r.id===t)return void(r.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let i=this._currentlyRunning=this._queue;
53for(let r of(this._queue=[],i))if(!r.cancelled&&(r.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var aR=i.aU([{name:"a_pos3d",type:"Int16",components:3}]);class aL extends i.E{constructor(t){super(),this._lastTilesetChange=v(),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,r){this.tileManager.update(t,r),this._renderableTilesKeys=[];let a={};for(let n of eP(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:r,calculateTileZoom:this.tileManager._source.calculateTileZoom}))a[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),i.c7(n.terrainRttPosMatrix32f,0,i.a5,i.a5,0,0,1),this._tiles[n.key]=new ep(n,this.tileSize),this._lastTilesetChange=v());for(let t in this._tiles)a[t]||delete this._tiles[t]}freeRtt(t){for(let i in this._tiles){let r=this._tiles[i];(!t||r.tileID.equals(t)||r.tileID.isChildOf(t)||t.isChildOf(r.tileID))&&(r.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,i){return i?this._getTerrainCoordsForTileRanges(t,i):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){let r={};for(let a of this._renderableTilesKeys){let n=this._tiles[a].tileID,s=t.clone(),o=i.bk();if(n.canonical.equals(t.canonical))i.c7(o,0,i.a5,i.a5,0,0,1);else if(n.canonical.isChildOf(t.canonical)){let r=n.canonical.z-t.canonical.z,a=n.canonical.x-(n.canonical.x>>r<<r),s=n.canonical.y-(n.canonical.y>>r<<r),l=i.a5>>r;i.c7(o,0,l,l,0,0,1),i.O(o,o,[-a*l,-s*l,0])}else{if(!t.canonical.isChildOf(n.canonical))continue;{let r=t.canonical.z-n.canonical.z,a=t.canonical.x-(t.canonical.x>>r<<r),s=t.canonical.y-(t.canonical.y>>r<<r),l=i.a5>>r;i.c7(o,0,i.a5,i.a5,0,0,1),i.O(o,o,[a*l,s*l,0]),i.Q(o,o,[1/2**r,1/2**r,0])}}s.terrainRttPosMatrix32f=new Float32Array(o),r[a]=s}return r}_getTerrainCoordsForTileRanges(t,r){let a={};for(let n of this._renderableTilesKeys){let s=this._tiles[n].tileID;if(!this._isWithinTileRanges(s,r))continue;let o=t.clone(),l=i.bk();if(s.canonical.z===t.canonical.z){let r=t.canonical.x-s.canonical.x+t.wrap*(1<<t.canonical.z),a=t.canonical.y-s.canonical.y;i.c7(l,0,i.a5,i.a5,0,0,1),i.O(l,l,[r*i.a5,a*i.a5,0])}else if(s.canonical.z>t.canonical.z){let r=s.canonical.z-t.canonical.z,a=s.canonical.x-(s.canonical.x>>r<<r)+t.wrap*(1<<s.canonical.z),n=s.canonical.y-(s.canonical.y>>r<<r),o=t.canonical.x-(s.canonical.x>>r),h=t.canonical.y-(s.canonical.y>>r),u=i.a5>>r;i.c7(l,0,u,u,0,0,1),i.O(l,l,[-a*u+o*i.a5,-n*u+h*i.a5,0])}else{let r=t.canonical.z-s.canonical.z,a=t.canonical.x-(t.canonical.x>>r<<r)+t.wrap*(1<<t.canonical.z),n=t.canonical.y-(t.canonical.y>>r<<r),o=(t.canonical.x>>r)-s.canonical.x,h=(t.canonical.y>>r)-s.canonical.y,u=i.a5<<r;i.c7(l,0,u,u,0,0,1),i.O(l,l,[a*i.a5+o*u,n*i.a5+h*u,0])}o.terrainRttPosMatrix32f=new Float32Array(l),a[n]=o}return a}getSourceTile(t,i){let r=this.tileManager._source,a=t.overscaledZ-this.deltaZoom;if(a>r.maxzoom&&(a=r.maxzoom),a<r.minzoom)return;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(a).key);let n=this.findTileInCaches(this._sourceTileCache[t.key]);if(!(null==n?void 0:n.dem)&&i)for(;a>=r.minzoom&&!(null==n?void 0:n.dem);)n=this.findTileInCaches(t.scaledTo(a--).key);return n}findTileInCaches(t){let i=this.tileManager.getTileByID(t);return i||(i=this.tileManager._outOfViewCache.getByKey(t))}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,i){let r=i[t.canonical.z];return!!r&&(t.wrap>r.minWrap||t.wrap<r.maxWrap||t.canonical.x>=r.minTileXWrapped&&t.canonical.x<=r.maxTileXWrapped&&t.canonical.y>=r.minTileY&&t.canonical.y<=r.maxTileY)}}class aF{constructor(t,i,r){this._meshCache={},this.painter=t,this.tileManager=new aL(i),this.options=r,this.exaggeration="number"==typeof r.exaggeration?r.exaggeration:1,this.qual
53ityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,r,a,n=i.a5){var s;if(!(r>=0&&r<n&&a>=0&&a<n))return 0;let o=this.getTerrainData(t),l=null==(s=o.tile)?void 0:s.dem;if(!l)return 0;let h=i.cC([],[r/n*i.a5,a/n*i.a5],o.u_terrain_matrix),u=[h[0]*l.dim,h[1]*l.dim],c=Math.floor(u[0]),d=Math.floor(u[1]),p=u[0]-c,f=u[1]-d;return l.get(c,d)*(1-p)*(1-f)+l.get(c+1,d)*p*(1-f)+l.get(c,d+1)*(1-p)*f+l.get(c+1,d+1)*p*f}getElevationForLngLatZoom(t,r){if(!i.cD(r,t.wrap()))return 0;let{tileID:a,mercatorX:n,mercatorY:s}=this._getOverscaledTileIDFromLngLatZoom(t,r);return this.getElevation(a,n%i.a5,s%i.a5,i.a5)}getElevationForLngLat(t,i){let r=eP(i,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),a=0;for(let t of r)t.canonical.z>a&&(a=Math.min(t.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,a)}getElevation(t,r,a,n=i.a5){return this.getDEMElevation(t,r,a,n)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){let t=this.painter.context,r=new i.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new i.T(t,r,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new i.T(t,new i.R({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=i.ar([])}let r=this.tileManager.getSourceTile(t,!0);if(r&&r.dem&&(!r.demTexture||r.needsTerrainPrepare)){let t=this.painter.context;r.demTexture=this.painter.getTileTexture(r.dem.stride),r.demTexture?r.demTexture.update(r.dem.getPixels(),{premultiply:!1}):r.demTexture=new i.T(t,r.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),r.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),r.needsTerrainPrepare=!1}let a=r&&r.toString()+r.tileID.key+t.key;if(a&&!this._demMatrixCache[a]){let a=this.tileManager.getSource().maxzoom,n=t.canonical.z-r.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=a?n=t.canonical.z-a:i.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let s=t.canonical.x-(t.canonical.x>>n<<n),o=t.canonical.y-(t.canonical.y>>n<<n),l=i.cE(new Float64Array(16),[1/(i.a5<<n),1/(i.a5<<n),0]);i.O(l,l,[s*i.a5,o*i.a5,0]),this._demMatrixCache[t.key]={matrix:l,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:r&&r.dem&&r.dem.dim||1,u_terrain_matrix:a?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:r&&r.dem&&r.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(r&&r.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:r}}getFramebuffer(t){let r=this.painter,a=r.width/devicePixelRatio,n=r.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==a||this._fbo.height!==n)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new i.T(r.context,{width:a,height:n,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new i.T(r.context,{width:a,height:n,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=r.context.createFramebuffer(a,n,!0,!1),this._fbo.depthAttachment.set(r.context.createRenderbuffer(r.context.gl.DEPTH_COMPONENT16,a,n))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let r=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,i=0;t<this._coordsTextureSize;t++)for(let a=0;a<this._coordsTextureSize;a++,i+=4)r[i+0]=255&a,r[i+1]=255&t,r[i+2]=a>>8<<4|t>>8,r[i+3]=0;let a=new i.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(r.buffer)),n=new i.T(t,a,t.gl.RGBA,{premultiply:!1});return n.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);let r=new Uint8Array(4),a=this.painter.context,n=a.gl,s=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),o=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),l=Math.round(this.painter.height/devicePixelRatio);a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(s,l-o-1,1,1,n.RGBA,n.UNSIGNED_BYTE,r),a.bindFramebuffer.set(null);let h=r[0]+(r[2]>>4<<8),u=r[1]+((15&r[2])<<8),c=this.coordsIndex[255-r[3]],d=c&&this.tileManager.getTileByID(c);if(!d)return null;let p=this._coordsTextureSize,f=(1<<d.tileID.canonical.z)*p;return new i.a9((d.tileID.canonical.x*p+h)/f+d.tileID.wrap,(d.tileID.canonical.y*p+u)/f,this.getElevation(d.tileID,h,u,p))}depthAtPoint(t){let i=new Uint8Array(4),r=this.painter.context,a=r.gl;return r.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),a.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,a.RGBA,a.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null),(i[0]/0x1000000+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(t){var r;let a=(null==(r=this.painter.style.projection)?void 0:r.transitionState)>0,n=a&&0===t.canonical.y,s=a&&t.canonical.y===(1<<t.canonical.z)-1,o=`m_${n?"n":""}_${s?"s":""}`;if(this._meshCache[o])return this._meshCache[o];let l=this.painter.context,h=new i.cF,u=new i.aY,c=this.meshSize,d=i.a5/c,p=c*c;for(let t=0;t<=c;t++)for(let i=0;i<=c;i++)h.emplaceBack(i*d,t*d,0);for(let t=0;t<p;t+=c+1)for(let i=0;i<c;i++)u.emplaceBack(i+t,c+i+t+1,c+i+t+2),u.emplaceBack(i+t,c+i+t+2,i+t+1);
53let f=h.length,m=f+(c+1),_=(c+1)*c,g=n?i.br:0,y=+!n,x=s?i.bs:i.a5,v=+!s;for(let t=0;t<=c;t++)h.emplaceBack(t*d,g,y);for(let t=0;t<=c;t++)h.emplaceBack(t*d,x,v);for(let t=0;t<c;t++)u.emplaceBack(_+t,m+t,m+t+1),u.emplaceBack(_+t,m+t+1,_+t+1),u.emplaceBack(0+t,f+t+1,f+t),u.emplaceBack(0+t,0+t+1,f+t+1);let b=h.length,w=b+2*(c+1);for(let t of[0,1])for(let r=0;r<=c;r++)for(let a of[0,1])h.emplaceBack(t*i.a5,r*d,a);for(let t=0;t<2*c;t+=2)u.emplaceBack(b+t,b+t+1,b+t+3),u.emplaceBack(b+t,b+t+3,b+t+2),u.emplaceBack(w+t,w+t+3,w+t+1),u.emplaceBack(w+t,w+t+2,w+t+3);let T=new tl(l.createVertexBuffer(h,aR.members),l.createIndexBuffer(u),i.aX.simpleSegment(0,0,h.length,u.length));return this._meshCache[o]=T,T}getMeshFrameDelta(t){return 2*Math.PI*i.bE/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,r){var a;if(!i.cD(r,t.wrap()))return 0;let{tileID:n}=this._getOverscaledTileIDFromLngLatZoom(t,r);return null!=(a=this.getMinMaxElevation(n).minElevation)?a:0}getMinMaxElevation(t){let i=this.getTerrainData(t).tile,r={minElevation:null,maxElevation:null};return i&&i.dem&&(r.minElevation=i.dem.min*this.exaggeration,r.maxElevation=i.dem.max*this.exaggeration),r}_getOverscaledTileIDFromLngLatZoom(t,r){let a=i.a9.fromLngLat(t.wrap()),n=(1<<r)*i.a5,s=a.x*n,o=a.y*n,l=Math.floor(s/i.a5),h=Math.floor(o/i.a5);return{tileID:new i.a2(r,0,r,l,h),mercatorX:s,mercatorY:o}}}class aB{constructor(t,i,r){this._context=t,this._size=i,this._tileSize=r,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){let r=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),a=new i.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),r.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),r.colorAttachment.set(a.texture),{id:t,fbo:r,texture:a,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(i=>t.id!==i),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(let t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw Error("No free RenderPool available, call freeAllObjects() required!");let t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(let t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some(t=>!t.inUse)}}let aO={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class aV{constructor(t,i){this.painter=t,this.terrain=i,this.pool=new aB(t.context,30,i.tileManager.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,i){for(let r in this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter(r=>!t._layers[r].isHidden(i)),this._coordsAscending={},t.tileManagers){this._coordsAscending[r]={};let i=t.tileManagers[r].getVisibleCoordinates(),a=t.tileManagers[r].getSource(),n=a instanceof ea?a.terrainTileRanges:null;for(let t of i){let i=this.terrain.tileManager.getTerrainCoords(t,n);for(let t in i)this._coordsAscending[r][t]||(this._coordsAscending[r][t]=[]),this._coordsAscending[r][t].push(i[t])}}for(let i of(this._coordsAscendingStr={},t._order)){let r=t._layers[i],a=r.source;if(aO[r.type]&&!this._coordsAscendingStr[a])for(let t in this._coordsAscendingStr[a]={},this._coordsAscending[a])this._coordsAscendingStr[a][t]=this._coordsAscending[a][t].map(t=>t.key).sort().join()}for(let t of this._renderableTiles)for(let i in this._coordsAscendingStr){let r=this._coordsAscendingStr[i][t.tileID.key];r&&r!==t.rttCoords[i]&&(t.rtt=[])}}renderLayer(t,r){if(t.isHidden(this.painter.transform.zoom))return!1;let a=Object.assign(Object.assign({},r),{isRenderingToTexture:!0}),n=t.type,s=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(aO[n]&&(this._prevType&&aO[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!o))return!0;
53if(aO[this._prevType]||aO[n]&&o){this._prevType=n;let t=this._stacks.length-1,r=this._stacks[t]||[];for(let n of this._renderableTiles){if(this.pool.isFull()&&(rL(this.painter,this.terrain,this._rttTiles,a),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[t]){let i=this.pool.getObjectForId(n.rtt[t].id);if(i.stamp===n.rtt[t].stamp){this.pool.useObject(i);continue}}let o=this.pool.getOrCreateFreeObject();this.pool.useObject(o),this.pool.stampObject(o),n.rtt[t]={id:o.id,stamp:o.stamp},s.context.bindFramebuffer.set(o.fbo.framebuffer),s.context.clear({color:i.bp.transparent,stencil:0}),s.currentStencilSource=void 0;for(let t=0;t<r.length;t++){let i=s.style._layers[r[t]],l=i.source?this._coordsAscending[i.source][n.tileID.key]:[n.tileID];s.context.viewport.set([0,0,o.fbo.width,o.fbo.height]),s._renderTileClippingMasks(i,l,!0),s.renderLayer(s,s.style.tileManagers[i.source],i,l,a),i.source&&(n.rttCoords[i.source]=this._coordsAscendingStr[i.source][n.tileID.key])}}return rL(this.painter,this.terrain,this._rttTiles,a),this._rttTiles=[],this.pool.freeAllObjects(),aO[n]}return!1}}let aj={"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":"Reset bearing to 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"},aN={hash:!1,interactive:!0,bearingSnap:7,attributionControl:aA,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:i.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},aU={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class aG{constructor(t,r,a=!1){this.mousedown=t=>{this.startMove(t,b.mousePos(this.element,t)),b.addEventListener(window,"mousemove",this.mousemove),b.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=t=>{this.move(t,b.mousePos(this.element,t))},this.mouseup=t=>{this._rotatePitchHandler.dragEnd(t),this.offTemp()},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=b.touchPos(this.element,t.targetTouches)[0],this.startMove(t,this._startPos),b.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),b.addEventListener(window,"touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=b.touchPos(this.element,t.targetTouches)[0],this.move(t,this._lastPos))},this.touchend=t=>{0===t.targetTouches.length&&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=r;const n=new ae;this._rotatePitchHandler=new r6({clickTolerance:3,move:(t,n)=>{let s=r.getBoundingClientRect(),o=new i.P((s.bottom-s.top)/2,(s.right-s.left)/2);return{bearingDelta:i.cx(new i.P(t.x,n.y),n,o),pitchDelta:a?-.5*(n.y-t.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=t,b.addEventListener(r,"mousedown",this.mousedown),b.addEventListener(r,"touchstart",this.touchstart,{passive:!1}),b.addEventListener(r,"touchcancel",this.reset)}startMove(t,i){this._rotatePitchHandler.dragStart(t,i),b.disableDrag()}move(t,i){let r=this.map,{bearingDelta:a,pitchDelta:n}=this._rotatePitchHandler.dragMove(t,i)||{};a&&r.setBearing(r.getBearing()+a),n&&r.setPitch(r.getPitch()+n)}off(){let t=this.element;b.removeEventListener(t,"mousedown",this.mousedown),b.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),b.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),b.removeEventListener(window,"touchend",this.touchend),b.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){b.enableDrag(),b.removeEventListener(window,"mousemove",this.mousemove),b.removeEventListener(window,"mouseup",this.mouseup),b.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),b.removeEventListener(window,"touchend",this.touchend)}}function aq(t,r,a,n=!1){if(n||!a.getCoveringTilesDetailsProvider().allowWorldCopies())return null==t?void 0:t.wrap();let s=new i.V(t.lng,t.lat);
53if(t=new i.V(t.lng,t.lat),r){let n=new i.V(t.lng-360,t.lat),s=new i.V(t.lng+360,t.lat),o=a.locationToScreenPoint(t).distSqr(r);a.locationToScreenPoint(n).distSqr(r)<o?t=n:a.locationToScreenPoint(s).distSqr(r)<o&&(t=s)}for(;Math.abs(t.lng-a.center.lng)>180;){let i=a.locationToScreenPoint(t);if(i.x>=0&&i.y>=0&&i.x<=a.width&&i.y<=a.height)break;t.lng>a.center.lng?t.lng-=360:t.lng+=360}return t.lng!==s.lng&&a.isPointOnMapSurface(a.locationToScreenPoint(t))?t:s}let aZ={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 a$(t,i,r){let a=t.classList;for(let t in aZ)a.remove(`maplibregl-${r}-anchor-${t}`);a.add(`maplibregl-${r}-anchor-${i}`)}class aW extends i.E{constructor(t){if(super(),this._onKeyPress=t=>{let i=t.code,r=t.charCode||t.keyCode;"Space"!==i&&"Enter"!==i&&32!==r&&13!==r||this.togglePopup()},this._onMapClick=t=>{let i=t.originalEvent.target,r=this._element;this._popup&&(i===r||r.contains(i))&&this.togglePopup()},this._update=t=>{if(!this._map)return;let i=this._map.loaded()&&!this._map.isMoving();"terrain"!==(null==t?void 0:t.type)&&("render"!==(null==t?void 0:t.type)||i)||this._map.once("render",this._update),this._lngLat=aq(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 r="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let a="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?a="rotateX(0deg)":"map"===this._pitchAlignment&&(a=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t&&"moveend"!==t.type||(this._pos=this._pos.round()),b.setTransform(this._element,`${aZ[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a} ${r}`),y.frameAsync(new AbortController).then(()=>{this._updateOpacity(t&&"moveend"===t.type)}).catch(()=>{})},this._onMove=t=>{if(!this._isDragging){let i=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=i}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new i.l("dragstart"))),this.fire(new i.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),"active"===this._state&&this.fire(new i.l("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.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&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(null==t?void 0:t.opacity,null==t?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=i.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=b.create("div");const r=b.createNS("http://www.w3.org/2000/svg","svg");r.setAttributeNS(null,"display","block"),r.setAttributeNS(null,"height","41px"),r.setAttributeNS(null,"width","27px"),r.setAttributeNS(null,"viewBox","0 0 27 41");const a=b.createNS("http://www.w3.org/2000/svg","g");
53a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");const n=b.createNS("http://www.w3.org/2000/svg","g");n.setAttributeNS(null,"fill-rule","nonzero");const s=b.createNS("http://www.w3.org/2000/svg","g");for(const t of(s.setAttributeNS(null,"transform","translate(3.0, 29.0)"),s.setAttributeNS(null,"fill","#000000"),[{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 i=b.createNS("http://www.w3.org/2000/svg","ellipse");i.setAttributeNS(null,"opacity","0.04"),i.setAttributeNS(null,"cx","10.5"),i.setAttributeNS(null,"cy","5.80029008"),i.setAttributeNS(null,"rx",t.rx),i.setAttributeNS(null,"ry",t.ry),s.appendChild(i)}const o=b.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"fill",this._color);const l=b.createNS("http://www.w3.org/2000/svg","path");l.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"),o.appendChild(l);const h=b.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"opacity","0.25"),h.setAttributeNS(null,"fill","#000000");const u=b.createNS("http://www.w3.org/2000/svg","path");u.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"),h.appendChild(u);const c=b.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"transform","translate(6.0, 7.0)"),c.setAttributeNS(null,"fill","#FFFFFF");const d=b.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"transform","translate(8.0, 8.0)");const p=b.createNS("http://www.w3.org/2000/svg","circle");p.setAttributeNS(null,"fill","#000000"),p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"cx","5.5"),p.setAttributeNS(null,"cy","5.5"),p.setAttributeNS(null,"r","5.4999962");const f=b.createNS("http://www.w3.org/2000/svg","circle");f.setAttributeNS(null,"fill","#FFFFFF"),f.setAttributeNS(null,"cx","5.5"),f.setAttributeNS(null,"cy","5.5"),f.setAttributeNS(null,"r","5.4999962"),d.appendChild(p),d.appendChild(f),n.appendChild(s),n.appendChild(o),n.appendChild(h),n.appendChild(c),n.appendChild(d),r.appendChild(n),r.setAttributeNS(null,"height",41*this._scale+"px"),r.setAttributeNS(null,"width",27*this._scale+"px"),this._element.appendChild(r),this._offset=i.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),a$(this._element,this._anchor,"marker"),t&&t.className)for(const i of t.className.split(" "))this._element.classList.add(i);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.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),b.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=i.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)){let i=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
530,-38.1],"bottom-left":[i,-1*(24.6+i)],"bottom-right":[-i,-1*(24.6+i)],left:[13.5,-24.6],right:[-13.5,-24.6]}: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(){let t=this._popup;return this._element.style.opacity===this._opacityWhenCovered||t&&(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map))),this}_updateOpacity(t=!1){var r,a;let n=null==(r=this._map)?void 0:r.terrain,s=this._map.transform.isLocationOccluded(this._lngLat);if(!n||s){let t=s?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==t&&(this._element.style.opacity=t))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let o=this._map,l=o.terrain.depthAtPoint(this._pos),h=o.terrain.getElevationForLngLat(this._lngLat,o.transform);if(o.transform.lngLatToCameraDepth(this._lngLat,h)-l<.006)return void(this._element.style.opacity=this._opacity);let u=-this._offset.y/o.transform.pixelsPerMeter,c=Math.sin(o.getPitch()*Math.PI/180)*u,d=o.terrain.depthAtPoint(new i.P(this._pos.x,this._pos.y-this._offset.y)),p=o.transform.lngLatToCameraDepth(this._lngLat,h+c)-d>.006;(null==(a=this._popup)?void 0:a.isOpen())&&p&&this._popup.remove(),this._element.style.opacity=p?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=i.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&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,i){return(void 0===this._opacity||void 0===t&&void 0===i)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=t),void 0!==i&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}let aH={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},aX=0,aY=!1,aK={maxWidth:100,unit:"metric"};function aJ(t,i,r){let a=r&&r.maxWidth||100,n=t._container.clientHeight/2,s=t._container.clientWidth/2,o=t.unproject([s-a/2,n]),l=t.unproject([s+a/2,n]),h=Math.min(a,Math.round(t.project(l).x-t.project(o).x),t._container.clientWidth),u=o.distanceTo(l);if(r&&"imperial"===r.unit){let r=3.2808*u;r>5280?aQ(i,h,r/5280,t._getUIString("ScaleControl.Miles")):aQ(i,h,r,t._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?aQ(i,h,u/1852,t._getUIString("ScaleControl.NauticalMiles")):u>=1e3?aQ(i,h,u/1e3,t._getUIString("ScaleControl.Kilometers")):aQ(i,h,u,t._getUIString("ScaleControl.Meters"))}function aQ(t,i,r,a){var n;let s,o,l,h=(s=Math.pow(10,`${Math.floor(r)}`.length-1),o=r/s,s*(o=o>=10?10:o>=5?5:o>=3?3:o>=2?2:o>=1?1:(l=Math.pow(10,Math.ceil(-Math.log(n=o)/Math.LN10)),Math.round(n*l)/l)));t.style.width=h/r*i+"px",t.innerHTML=`${h} ${a}`}let a0={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0};t.AJAXError=i.cI,t.Event=i.l,t.Evented=i.E,t.LngLat=i.V,t.MercatorCoordinate=i.a9,t.Point=i.P,t.addProtocol=i.cJ,t.config=i.c,t.removeProtocol=i.cK,t.AttributionControl
53=aD,t.BoxZoomHandler=r1,t.CanvasSource=es,t.CooperativeGesturesHandler=aS,t.DoubleClickZoomHandler=ay,t.DragPanHandler=ab,t.DragRotateHandler=aw,t.EdgeInsets=tp,t.FullscreenControl=class extends i.E{constructor(t={}){super(),this._onFullscreenChange=()=>{var t;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null==(t=null==i?void 0:i.shadowRoot)?void 0:t.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:i.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(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=b.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){b.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let t=this._fullscreenButton=b.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);b.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_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 i.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new i.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},t.GeoJSONSource=er,t.GeolocateControl=class extends i.E{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new i.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_ERROR":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 Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new i.l("geolocate",t)),this._finish()}},this._updateCamera=t=>{let r=new i.V(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,n=this._map.getBearing(),s=i.e({bearing:n},this.options.fitBoundsOptions),o=Y.fromLngLat(r,a);this._map.fitBounds(o,s,{geolocateSource:!0})},this._updateMarker=t=>{if(t){let r=new i.V(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).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(1===t.code){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;let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&aY)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new i.l("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=b.create("button","maplibregl-ctrl-geolocate",this._container),b.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(!1===t){i.w("Geolocation support is not available so the GeolocateControl will be disabled.");let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{let t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
53se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=b.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new aW({element:this._dotElement}),this._circleElement=b.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new aW({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",t=>{let r=(null==t?void 0:t[0])instanceof ResizeObserverEntry;t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r||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 i.l("trackuserlocationend")),this.fire(new i.l("userlocationlostfocus")))})}},this.options=i.e({},aH,t)}onAdd(t){return this._map=t,this._container=b.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return i._(this,arguments,void 0,function*(t=!1){if(void 0!==u&&!t)return u;if(void 0===window.navigator.permissions)return u=!!window.navigator.geolocation;try{let t=yield window.navigator.permissions.query({name:"geolocation"});u="denied"!==t.state}catch(t){u=!!window.navigator.geolocation}return u})})().then(t=>this._finishSetupUI(t)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(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(),b.remove(this._container),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,aX=0,aY=!1}_isOutOfMapMaxBounds(t){let i=this._map.getMaxBounds(),r=t.coords;return i&&(r.longitude<i.getWest()||r.longitude>i.getEast()||r.latitude<i.getSouth()||r.latitude>i.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",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 Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let t=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&t))return;let i=this._map.project(t),r=this._map.unproject([i.x+100,i.y]),a=t.distanceTo(r)/100,n=2*this._accuracy/a;this._circleElement.style.width=`${n.toFixed(2)}px`,this._circleElement.style.height=`${n.toFixed(2)}px`}trigger(){if(!this._setup)return i.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 i.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":aX--,aY=!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 i.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 i.l("trackuserlocationstart")),this.fire(new i.l("userlocationfocus"));break;default:throw 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 Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++aX>1?(t={maximumAge:6e5,timeout:0},aY=!0):(t=this.options.positionOptions,aY=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}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","fal
53se"),this.options.showUserLocation&&this._updateMarker(null)}},t.GlobeControl=class{constructor(){this._toggleProjection=()=>{var t;let i=null==(t=this._map.getProjection())?void 0:t.type;this._map.setProjection("mercator"!==i&&i?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var t;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null==(t=this._map.getProjection())?void 0:t.type)?(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(t){return this._map=t,this._container=b.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=b.create("button","maplibregl-ctrl-globe",this._container),b.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._container}onRemove(){b.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},t.Hash=rV,t.ImageSource=ea,t.KeyboardHandler=af,t.LngLatBounds=Y,t.LogoControl=az,t.Map=class extends aC{constructor(t){var r,a;i.cG.mark(i.cH.create);const n=Object.assign(Object.assign(Object.assign({},aN),t),{canvasContextAttributes:Object.assign(Object.assign({},aN.canvasContextAttributes),t.canvasContextAttributes)});if(null!=n.minZoom&&null!=n.maxZoom&&n.minZoom>n.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=n.minPitch&&null!=n.maxPitch&&n.minPitch>n.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=n.minPitch&&n.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=n.maxPitch&&n.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");const s=new tv,o=new tS;if(void 0!==n.minZoom&&s.setMinZoom(n.minZoom),void 0!==n.maxZoom&&s.setMaxZoom(n.maxZoom),void 0!==n.minPitch&&s.setMinPitch(n.minPitch),void 0!==n.maxPitch&&s.setMaxPitch(n.maxPitch),void 0!==n.renderWorldCopies&&s.setRenderWorldCopies(n.renderWorldCopies),null!==n.transformConstrain&&s.setConstrainOverride(n.transformConstrain),super(s,o,{bearingSnap:n.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ak,this._controls=[],this._mapId=i.af(),this._lostContextStyle={style:null,images:null},this._contextLost=t=>{for(let i of(t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),Object.values(this.style._layers)))if("custom"===i.type&&console.warn(`Custom layer with id '${i.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),i._listeners)for(let[t]of Object.entries(i._listeners))console.warn(`Custom layer with id '${i.id}' had event listeners for event '${t}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this._lostContextStyle=this._getStyleAndImages(),this.style.destroy(),this.style=null,this.fire(new i.l("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{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 i.l("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=n.interactive,this._maxTileCacheSize=n.maxTileC
53acheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},n.canvasContextAttributes),this._trackResize=!0===n.trackResize,this._bearingSnap=n.bearingSnap,this._centerClampedToGround=n.centerClampedToGround,this._refreshExpiredTiles=!0===n.refreshExpiredTiles,this._fadeDuration=n.fadeDuration,this._crossSourceCollisions=!0===n.crossSourceCollisions,this._collectResourceTiming=!0===n.collectResourceTiming,this._locale=Object.assign(Object.assign({},aj),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this._zoomLevelsToOverscale=n.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=n.transformCameraUpdate,this.transformConstrain=n.transformConstrain,this.cancelPendingTileRequestsWhileZooming=!0===n.cancelPendingTileRequestsWhileZooming,void 0!==n.reduceMotion&&(y.prefersReducedMotion=n.reduceMotion),this._imageQueueHandle=p.addThrottleControl(()=>this.isMoving()),this._requestManager=new E(n.transformRequest),"string"==typeof n.container){if(this._container=document.getElementById(n.container),!this._container)throw Error(`Container '${n.container}' not found.`)}else{if(!(n.container instanceof HTMLElement))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=n.container}if(n.maxBounds&&this.setMaxBounds(n.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}),"u">typeof window){addEventListener("online",this._onWindowOnline,!1);let t=!1;const i=rO(t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())},50);this._resizeObserver=new ResizeObserver(r=>{t?i(r):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new aE(this,n),this._hash=n.hash&&new rV("string"==typeof n.hash&&n.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,roll:n.roll}),n.bounds&&(this.resize(),this.fitBounds(n.bounds,i.e({},n.fitBoundsOptions,{duration:0}))));const l="string"==typeof n.style||"globe"!==(null==(a=null==(r=n.style)?void 0:r.projection)?void 0:a.type);this.resize(null,l),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new aD("boolean"==typeof n.attributionControl?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new az,n.logoPosition),this.on("style.load",()=>{if(l||this._resizeTransform(),this.transform.unmodified){let t=i.U(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t)}}),this.on("data",t=>{this._update("style"===t.dataType),this.fire(new i.l(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new i.l(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new i.l("sourcedataabort",t))})}_getMapId(){return this._mapId}setGlobalStateProperty(t,i){return this.style.setGlobalStateProperty(t,i),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,r){if(void 0===r&&(r=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new i.k(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let a=t.onAdd(this);this._controls.push(t);let n=this._controlPositions[r];return -1!==r.indexOf("bottom")?n.insertBefore(a,n.firstChild):n.appendChild(a),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new i.k(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(t);return r>-1&&this._controls.splice(r,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}coveringTiles(t){return eP(this.transform,t)}calculateCameraOptionsFromTo(t,i,r,a){return null==a&&this.terrain&&(a=this.terrain.getElevationForLngLat(r,this.transform)),super.calculateCameraOptionsFromTo(t,i,r,a)}resize(t,r=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(r);let a=!this._moving;return a&&(this.stop(),this.fire(new i.l("movestart",t)).fire(new i.l("move",t))),this.fire(new i.l("resize",t)),a&&this.fire(new i.l("moveend",t)),this}_resizeInternal(t=!0){let[i,r]=this._containerDimensions(),a=this._getClampedPixelRatio(i,r);if(this._resizeCanvas(i,r,a),this.painter.resize(i,r,a),this.painter.overLimit()){let t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];let a=this._getClampedPixelRatio(i,r);this._resizeCanvas(i,r,a),this.painter.resize(i,r,a)}this._resizeTransform(t)}_resizeTransform(t=!0){var i;let[r,a]=this._containerDimensions();this.transform.resize(r,a,t),null==(i=this._requestedCameraState)||i.resize(r,a,t)}_getClampedPixelRatio(t,i){let{0:r,1:a}=this._maxCanvasSize,n=this.getPixelRatio(),s=t*n,o=i*n;return Math.min(s>r?r/s:1,o>a?a/o:1)*n}getPixelRatio(){var t;return null!=(t=this._overridePixelRatio)?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(Y.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom){let i=this._getTransformForUpdate();return i.setMinZoom(t),this._applyUpdatedTransform(i),this._update(),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom){let i=this._getTransformForUpdate();
53return i.setMaxZoom(t),this._applyUpdatedTransform(i),this._update(),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.setMinPitch(t),this._update(),this.getPitch()<t&&this.setPitch(t),this;throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>180)throw Error("maxPitch must be less than or equal to 180");if(t>=this.transform.minPitch)return this.transform.setMaxPitch(t),this._update(),this.getPitch()>t&&this.setPitch(t),this;throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.setRenderWorldCopies(t),this._update()}setTransformConstrain(t){return this.transform.setConstrainOverride(t),this._update()}project(t){return this.transform.locationToScreenPoint(i.V.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.screenPointToLocation(i.P.convert(t),this.terrain)}isMoving(){var t;return this._moving||(null==(t=this.handlers)?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null==(t=this.handlers)?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null==(t=this.handlers)?void 0:t.isRotating())}_createDelegatedListener(t,i,r){if("mouseenter"===t||"mouseover"===t){let a=!1,n=n=>{let s=i.filter(t=>this.getLayer(t)),o=0!==s.length?this.queryRenderedFeatures(n.point,{layers:s}):[];o.length?a||(a=!0,r.call(this,new rX(t,this,n.originalEvent,{features:o}))):a=!1};return{layers:i,listener:r,delegates:{mousemove:n,mouseout:()=>{a=!1}}}}if("mouseleave"===t||"mouseout"===t){let a=!1,n=n=>{let s=i.filter(t=>this.getLayer(t));(0!==s.length?this.queryRenderedFeatures(n.point,{layers:s}):[]).length?a=!0:a&&(a=!1,r.call(this,new rX(t,this,n.originalEvent)))},s=i=>{a&&(a=!1,r.call(this,new rX(t,this,i.originalEvent)))};return{layers:i,listener:r,delegates:{mousemove:n,mouseout:s}}}{let a=t=>{let a=i.filter(t=>this.getLayer(t)),n=0!==a.length?this.queryRenderedFeatures(t.point,{layers:a}):[];n.length&&(t.features=n,r.call(this,t),delete t.features)};return{layers:i,listener:r,delegates:{[t]:a}}}}_saveDelegatedListener(t,i){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(i)}_removeDelegatedListener(t,i,r){if(!this._delegatedListeners||!this._delegatedListeners[t])return;let a=this._delegatedListeners[t];for(let t=0;t<a.length;t++){let n=a[t];if(n.listener===r&&n.layers.length===i.length&&n.layers.every(t=>i.includes(t))){for(let t in n.delegates)this.off(t,n.delegates[t]);return void a.splice(t,1)}}}on(t,i,r){if(void 0===r)return super.on(t,i);let a="string"==typeof i?[i]:i,n=this._createDelegatedListener(t,a,r);for(let i in this._saveDelegatedListener(t,n),n.delegates)this.on(i,n.delegates[i]);return{unsubscribe:()=>{this._removeDelegatedListener(t,a,r)}}}once(t,i,r){if(void 0===r)return super.once(t,i);let a="string"==typeof i?[i]:i,n=this._createDelegatedListener(t,a,r);for(let i in n.delegates){let s=n.delegates[i];n.delegates[i]=(...i)=>{this._removeDelegatedListener(t,a,r),s(...i)}}for(let i in this._saveDelegatedListener(t,n),n.delegates)this.once(i,n.delegates[i]);return this}off(t,i,r){return void 0===r?super.off(t,i):(this._removeDelegatedListener(t,"string"==typeof i?[i]:i,r),this)}queryRenderedFeatures(t,r){let a;if(!this.style)return[];let n=t instanceof i.P||Array.isArray(t),s=n?t:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(n?{}:t)||{},s instanceof i.P||"number"==typeof s[0])a=[i.P.convert(s)];else{let t=i.P.convert(s[0]),r=i.P.convert(s[1]);a=[t,new i.P(r.x,t.y),r,new i.P(t.x,r.y),t]}return this.style.queryRenderedFeatures(a,r,this.transform)}querySourceFeatures(t,i){return this.style.querySourceFeatures(t,i)}setStyle(t,r){return!1!==(r=i.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
53idateStyle},r)).diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(t,r))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let i=this._locale[t];if(null==i)throw Error(`Missing UI string '${t}'`);return i}_updateStyle(t,i){var r,a;if(i.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(t,i));let n=this.style&&i.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new t6(this,i||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,i,n):this.style.loadJSON(t,i,n)):(null==(a=null==(r=this.style)?void 0:r.projection)||a.destroy(),delete this.style),this}_lazyInitEmptyStyle(){this.style||(this.style=new t6(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,r){if("string"==typeof t){let a=this._requestManager.transformRequest(t,"Style");i.j(a,new AbortController).then(t=>{this._updateDiff(t.data,r)}).catch(t=>{t&&this.fire(new i.k(t))})}else"object"==typeof t&&this._updateDiff(t,r)}_updateDiff(t,r){try{this.style.setState(t,r)&&this._update(!0)}catch(a){i.w(`Unable to perform style diff: ${a.message||a.error||a}. Rebuilding the style from scratch.`),this._updateStyle(t,r)}}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():i.w("There is no style added to the map.")}addSource(t,i){return this._lazyInitEmptyStyle(),this.style.addSource(t,i),this._update(!0)}isSourceLoaded(t){let r=this.style&&this.style.tileManagers[t];if(void 0!==r)return r.loaded();this.fire(new i.k(Error(`There is no tile manager with ID '${t}'`)))}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){let r=this.style.tileManagers[t.source];if(!r)throw Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);for(let a in null===this.terrain&&r.reload(),this.style._layers){let r=this.style._layers[a];"hillshade"===r.type&&r.source===t.source&&i.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."),"color-relief"===r.type&&r.source===t.source&&i.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 aF(this.painter,r,t),this.painter.renderToTexture=new aV(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=i=>{var r;"style"===i.dataType?this.terrain.tileManager.freeRtt():"source"===i.dataType&&i.tile&&(i.sourceId!==t.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))),"image"===(null==(r=i.source)?void 0:r.type)?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.tileManager.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new i.l("terrain",{terrain:t})),this}getTerrain(){var t,i;return null!=(i=null==(t=this.terrain)?void 0:t.options)?i:null}areTilesLoaded(){for(let t of Object.values(this.style&&this.style.tileManagers))if(!t.areTilesLoaded())return!1;return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}setSourceTileLodParams(t,i,r){if(r){let a=this.getSource(r);if(!a)throw Error(`There is no source with ID "${r}", cannot set LOD parameters`);a.calculateTileZoom=ew(Math.max(1,t),Math.max(1,i))}else for(let r in this.style.tileManagers)this.style.tileManagers[r].getSource().calculateTileZoom=ew(Math.max(1,t),Math.max(1,i));return this._update(!0),this}refreshTiles(t,r){let a=this.style.tileManagers[t];if(!a)throw Error(`There is no tile manager with ID "${t}", cannot refresh tile`);void 0===r?a.reload(!0):a.refreshTiles(r.map(t=>new i.ac(t.z,t.x,t.y)))}addImage(t,r,a={}){let{pixelRatio:n=1,sdf:s=!1,stretchX:o,stretchY:l,content:h,textFitWidth:u,textFitHeight:c}=a;if(this._lazyInitEmptyStyle(),!(r instanceof HTMLImageElement||i.b(r))){if(void 0===r.width||void 0===r.height)return this.fire(new i.k(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`")));{let{width:a,height:d,data:p}=r;return this.style.addImage(t,{data:new i.R({width:a,height:d},new Uint8Array(p)),pixelRatio:n,stretchX:o,stretchY:l,content:h,textFitWidth:u,textFitHeight:c,sdf:s,version:0,userImage:r}),r.onAdd&&r.onAdd(this,t),this}}{let{width:a,height:d,data:p}=y.getImageData(r);this.style.addImage(t,{data:new i.R({width:a,height:d},p),pixelRatio:n,stretchX:o,stretchY:l,content:h,textFitWidth:u,textFitHeight:c,sdf:s,version:0})}}updateImage(t,r){let a=this.style.getImage(t);if(!a)return this.fire(new i.k(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:n,height:s,data:o}=r instanceof HTMLImageElement||i.b(r)?y.getImageData(r):r;if(void 0===n||void 0===s)return this.fire(new i.k(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(n!==a.data.width||s!==a.data.height)return this.fire(new i.k(Error("The width and height of the updated image must be that same as the previous version of the image")));let l=!(r instanceof HTMLImageElement||i.b(r));return a.data.replace(o,l),this.style.updateImage(t,a),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new i.k(Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return p.getImage(this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,i){return this._lazyInitEmptyStyle(),this.style.addLayer(t,i),this._update(!0)}moveLayer(t,i){return this.style.moveLayer(t,i),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,i,r){return this.style.setLayerZoomRange(t,i,r),this._update(!0)}setFilter(t,i,r={}){return this.style.setFilter(t,i,r),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,i,r,a={}){return this.style.setPaintProperty(t,i,r,a),this._update(!0)}getPaintProperty(t,i){return this.style.getPaintProperty(t,i)}setLayoutProperty(t,i,r,a={}){return this.style.setLayoutProperty(t,i,r,a),this._update(!0)}getLayoutProperty(t,i){return this.style.getLayoutProperty(t,i)}setGlyphs(t,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,i,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,i,r,t=>{t||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,i,t=>{t||this._update(!0)}),this}setLight(t,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,i),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,i={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,i),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,i){return this.style.setFeatureState(t,i),this._update()}removeFeatureState(t,i){return this.style.removeFeatureState(t,i),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,i=0;return this._container&&(t=this._container.clientWidth||400,i=this._container.clientHeight||300),[t,i]}_setupContainer(){let t=this._container;t.classList.add("maplibregl-map");let i=this._canvasContainer=b.create("div","maplibregl-canvas-container",t);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=b.create("canvas","maplibregl-canvas",i),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","regi
53on");let r=this._containerDimensions(),a=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],a);let n=this._controlContainer=b.create("div","maplibregl-control-container",t),s=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(t=>{s[t]=b.create("div",`maplibregl-ctrl-${t} `,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,i,r){this._canvas.width=Math.floor(r*t),this._canvas.height=Math.floor(r*i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`}_setupPainter(){let t=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),i=null;this._canvas.addEventListener("webglcontextcreationerror",r=>{i={requestedAttributes:t},r&&(i.statusMessage=r.statusMessage,i.type=r.type)},{once:!0});let r=null;if(!(r=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,t):this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t))){let t="Failed to initialize WebGL";throw i?(i.message=t,Error(JSON.stringify(i))):Error(t)}this.painter=new rB(r,this.transform),w.testSupport(r)}migrateProjection(t,r){super.migrateProjection(t,r),this.painter.transform=t,this.fire(new i.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded&&(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){var r,a,n,s,o;let l=this._idleTriggered?this._fadeDuration:0,h=(null==(r=this.style.projection)?void 0:r.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let t=this.transform.zoom,r=v();this.style.zoomHistory.update(t,r);let a=new i.H(t,{now:r,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=a.crossFadingFactor();1===n&&n===this._crossFadingFactor||(u=!0,this._crossFadingFactor=n),this.style.update(a)}let c=(null==(a=this.style.projection)?void 0:a.transitionState)>0!==h;null==(n=this.style.projection)||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null==(s=this.style.projection)?void 0:s.transitionState,null==(o=this.style.projection)?void 0:o.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||c)&&(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,l,this._crossSourceCollisions,c),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,showPadding:this.showPadding}),this.fire(new i.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,i.cG.mark(i.cH.load),this.fire(new i.l("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new i.l("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,i.cG.mark(i.cH.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t;for(let t of(this._hash&&this._hash.remove(),this._controls))t.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"u">typeof window&&removeEventListener("online",this._onWindowOnline,!1),p.removeThrottleControl(this._imageQueueHandle),null==(t=this._resizeObserver)||t.disconnect();let r=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==r?void 0:r.loseContext)&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),b.remove(this._canvasContainer),b.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),i.cG.clearMetrics(),this._removed=!0,this.fire(new i.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,y.frame(this._frameRequest,t=>{i.cG.frame(t),this._frameRequest=null;try{this._render(t)}catch(t){if(!i.Z(t)&&t.message!==ru)throw t}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return _}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}}
53,t.MapMouseEvent=rX,t.MapTouchEvent=rY,t.MapWheelEvent=rK,t.Marker=aW,t.NavigationControl=class{constructor(t){this._updateZoomButtons=()=>{let t=this._map.getZoom(),i=t===this._map.getMaxZoom(),r=t===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.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,i)=>{let r=this._map._getUIString(`NavigationControl.${i}`);t.title=r,t.setAttribute("aria-label",r)},this.options=i.e({},aU,t),this._container=b.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})),b.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})),b.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=b.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,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 aG(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){b.remove(this._container),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(t,i){let r=b.create("button",t,this._container);return r.type="button",r.addEventListener("click",i),r}},t.Popup=class extends i.E{constructor(t){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&b.remove(this._content),this._container&&(b.remove(this._container),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._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new i.l("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=b.create("div","maplibregl-popup",this._map.getContainer()),this._tip=b.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let t of this.options.className.split(" "))this._container.classList.add(t);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=aq(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!t)return;let r=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationToScreenPoint(this._lngLat));
53let a=this.options.anchor,n=function t(r){if(r){if("number"==typeof r){let t=Math.round(Math.abs(r)/Math.SQRT2);return{center:new i.P(0,0),top:new i.P(0,r),"top-left":new i.P(t,t),"top-right":new i.P(-t,t),bottom:new i.P(0,-r),"bottom-left":new i.P(t,-t),"bottom-right":new i.P(-t,-t),left:new i.P(r,0),right:new i.P(-r,0)}}if(r instanceof i.P||Array.isArray(r)){let t=i.P.convert(r);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:i.P.convert(r.center||[0,0]),top:i.P.convert(r.top||[0,0]),"top-left":i.P.convert(r["top-left"]||[0,0]),"top-right":i.P.convert(r["top-right"]||[0,0]),bottom:i.P.convert(r.bottom||[0,0]),"bottom-left":i.P.convert(r["bottom-left"]||[0,0]),"bottom-right":i.P.convert(r["bottom-right"]||[0,0]),left:i.P.convert(r.left||[0,0]),right:i.P.convert(r.right||[0,0])}}return t(new i.P(0,0))}(this.options.offset);if(!a){var s,o,l,h,u;let t,i=this._container.offsetWidth,c=this._container.offsetHeight,d=(s=this.options.padding)?{top:null!=(o=s.top)?o:0,right:null!=(l=s.right)?l:0,bottom:null!=(h=s.bottom)?h:0,left:null!=(u=s.left)?u:0}:{top:0,right:0,bottom:0,left:0};t=r.y+n.bottom.y<c+d.top?["top"]:r.y>this._map.transform.height-c-d.bottom?["bottom"]:[],r.x<i/2+d.left?t.push("left"):r.x>this._map.transform.width-i/2-d.right&&t.push("right"),a=0===t.length?"bottom":t.join("-")}let c=r.add(n[a]);this.options.subpixelPositioning||(c=c.round()),b.setTransform(this._container,`${aZ[a]} translate(${c.x}px,${c.y}px)`),a$(this._container,a,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=i.e(Object.create(a0),t)}addTo(t){return this._map&&this.remove(),this._map=t,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._onMouseMove),this._map.on("mouseup",this._onMouseUp),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 i.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=i.V.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),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._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){let i,r=document.createDocumentFragment(),a=document.createElement("body");for(a.innerHTML=t;i=a.firstChild;)r.appendChild(i);return this.setDOMContent(r)}getMaxWidth(){var t;return null==(t=this._container)?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=b.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}setPadding(t){this.options.padding=t,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=b.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;
53let t=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");t&&t.focus()}},t.RasterDEMTileSource=ee,t.RasterTileSource=Q,t.ScaleControl=class{constructor(t){this._onMove=()=>{aJ(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,aJ(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},aK),t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=b.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){b.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},t.ScrollZoomHandler=ag,t.Style=t6,t.TerrainControl=class{constructor(t){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=t}onAdd(t){return this._map=t,this._container=b.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=b.create("button","maplibregl-ctrl-terrain",this._container),b.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(){b.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},t.TwoFingersTouchPitchHandler=au,t.TwoFingersTouchRotateHandler=al,t.TwoFingersTouchZoomHandler=as,t.TwoFingersTouchZoomRotateHandler=aT,t.VectorTileSource=J,t.VideoSource=en,t.addSourceType=(t,r)=>i._(void 0,void 0,void 0,function*(){if(el(t))throw Error(`A source type called "${t}" already exists.`);eo[t]=r}),t.clearPrewarmedResources=function(){let t=o;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(N),o=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()"))},t.createTileMesh=tk,t.getMaxParallelImageRequests=function(){return i.c.MAX_PARALLEL_IMAGE_REQUESTS},t.getRTLTextPluginStatus=function(){return ed().getRTLTextPluginStatus()},t.getVersion=function(){return _},t.getWorkerCount=function(){return U.workerCount},t.getWorkerUrl=function(){return i.c.WORKER_URL},t.importScriptInWorkers=function(t){return $().broadcast("IS",t)},t.isTimeFrozen=function(){return x.isFrozen()},t.now=v,t.prewarm=function(){q().acquire(N)},t.restoreNow=function(){x.restoreNow()},t.setMaxParallelImageRequests=function(t){i.c.MAX_PARALLEL_IMAGE_REQUESTS=t},t.setNow=function(t){x.setNow(t)},t.setRTLTextPlugin=function(t,i){return ed().setRTLTextPlugin(t,i)},t.setWorkerCount=function(t){U.workerCount=t},t.setWorkerUrl=function(t){i.c.WORKER_URL=t}}),t}()}}]);
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.