1/*! For license information please see d94c0b71-3af770b0661d1a1702b6.js.LICENSE.txt */ 2(self.webpackChunkatlas=self.webpackChunkatlas||[]).push([[3343],{16443:function(t){t.exports=function(){"use strict";var t={},e={};function i(i,r,n){if(e[i]=n,"index"===i){var s="var sharedModule = {}; ("+e.shared+")(sharedModule); ("+e.worker+")(sharedModule);",o={};return e.shared(o),e.index(t,o),"undefined"!=typeof window&&t.setWorkerUrl(window.URL.createObjectURL(new Blob([s],{type:"text/javascript"}))),t}}return i("shared",["exports"],(function(t){function e(t,e,i,r){return new(i||(i=Promise))((function(n,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((r=r.apply(t,e||[])).next())}))}function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r,n;function s(){if(n)return r;function t(t,e){this.x=t,this.y=e}return n=1,r=t,t.prototype={clone:function(){return new t(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),r=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=r,this},_rotateAround:function(t,e){var i=Math.cos(t),r=Math.sin(t),n=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-r*(this.y-e.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},t.convert=function(e){return e instanceof t?e:Array.isArray(e)?new t(e[0],e[1]):e},r}"function"==typeof SuppressedError&&SuppressedError;var o,a,l=i(s()),c=function(){if(a)return o;function t(t,e,i,r){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=r}return a=1,o=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,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,r=0;r<8;r++){var n=this.sampleCurveX(i)-t;if(Math.abs(n)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=n/s}var o=0,a=1;for(i=t,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-t)<e));r++)t>n?o=i:a=i,i=.5*(a-o)+o;return i}
2,solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},o}(),h=i(c);let u,d;function p(){return null==u&&(u="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),u}function f(){if(null==d&&(d=!1,p())){const t=5,e=new OffscreenCanvas(t,t).getContext("2d",{willReadFrequently:!0});if(e){for(let r=0;r<t*t;r++){const i=4*r;e.fillStyle=`rgb(${i},${i+1},${i+2})`,e.fillRect(r%t,Math.floor(r/t),1,1)}const i=e.getImageData(0,0,t,t).data;for(let e=0;e<t*t*4;e++)if(e%4!=3&&i[e]!==e){d=!0;break}}}return d||!1}var m,_=1e-6,g="undefined"!=typeof Float32Array?Float32Array:Array;function y(){var t=new g(9);return g!=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 x(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 v(){var t=new g(3);return g!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function b(t,e,i){var r=new g(3);return r[0]=t,r[1]=e,r[2]=i,r}function w(t,e,i){var r=e[0],n=e[1],s=e[2],o=e[3];return t[0]=i[0]*r+i[4]*n+i[8]*s+i[12]*o,t[1]=i[1]*r+i[5]*n+i[9]*s+i[13]*o,t[2]=i[2]*r+i[6]*n+i[10]*s+i[14]*o,t[3]=i[3]*r+i[7]*n+i[11]*s+i[15]*o,t}function T(){var t=new g(4);return g!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function P(){var t=new g(2);return g!=Float32Array&&(t[0]=0,t[1]=0),t}function M(t,e){var i=new g(2);return i[0]=t,i[1]=e,i}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),v(),m=new g(4),g!=Float32Array&&(m[0]=0,m[1]=0,m[2]=0,m[3]=0),v(),b(1,0,0),b(0,1,0),T(),T(),y(),P();const S=8192;function I(t,e,i){return e*(S/(t.tileSize*Math.pow(2,i-t.tileID.overscaledZ)))}function C(t,e){return(t%e+e)%e}function A(t,e,i){return t*(1-i)+e*i}function E(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}function z(t,e,i,r){const n=new h(t,e,i,r);return t=>n.solve(t)}const k=z(.25,.1,.25,1);function D(t,e,i){return Math.min(i,Math.max(e,t))}function R(t,e,i){const r=i-e,n=((t-e)%r+r)%r+e;return n===e?i:n}function L(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}let F=1;function B(t,e,i){const r={};for(const n in t)r[n]=e.call(this,t[n],n,t);return r}function O(t,e,i){const r={};for(const n in t)e.call(this,t[n],n,t)&&(r[n]=t[n]);return r}function j(t){return Array.isArray(t)?t.map(j):"object"==typeof t&&t?B(t,j):t}const V={};function N(t){V[t]||("undefined"!=typeof console&&console.warn(t),V[t]=!0)}function Z(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function U(t){return"undefined"!=typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}let G=null;function $(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const q="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function W(t,i,r,n,s){return e(this,void 0,void 0,(function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const e=new VideoFrame(t,{timestamp:0});try{const o=null==e?void 0:e.format;if(!o||!o.startsWith("BGR")&&!o.startsWith("RGB"))throw new Error(`Unrecognized format ${o}`);const a=o.startsWith("BGR"),l=new Uint8ClampedArray(n*s*4);if(yield e.copyTo(l,function(t,e,i,r,n){const s=4*Math.max(1,0),o=(Math.max(0,i)-i)*r*4+s,a=4*r,l=Math.max(0,e),c=Math.max(0,i);return{rect:{x:l,y:c,width:Math.min(t.width,e+r)-l,height:Math.min(t.height,i+n)-c},layout:[{offset:o,stride:a}]}}(t,i,r,n,s)),a)for(let t=0;t<l.length;t+=4){const e=l[t];l[t]=l[t+2],l[t+2]=e}return l}finally{e.close()}}))}let H,X;function K(t,e,i,r){return t.addEventListener(e,i,r),{unsubscribe:()=>{t.removeEventListener(e,i,r)}}}function Y(t){return t/Math.PI*180}const J={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Q={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},tt="AbortError";function et(){return new Error(tt)}const it={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};
2function rt(t){return it.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}const nt="global-dispatcher";class st extends Error{constructor(t,e,i,r){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=r}}const ot=()=>U(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,at=function(t,i){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){const e=rt(t.url);if(e)return e(t,i);if(U(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:nt},i)}if(!(/^file:/.test(r=t.url)||/^file:/.test(ot())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(t,i){return e(this,void 0,void 0,(function*(){const e=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:ot(),signal:i.signal});let r,n;"json"!==t.type||e.headers.has("Accept")||e.headers.set("Accept","application/json");try{r=yield fetch(e)}catch(e){throw new st(0,e.message,t.url,new Blob)}if(!r.ok){const e=yield r.blob();throw new st(r.status,r.statusText,t.url,e)}n="arrayBuffer"===t.type||"image"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text();const s=yield n;if(i.signal.aborted)throw et();return{data:s,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}}))}(t,i);if(U(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:nt},i)}var r;return function(t,e){return new Promise(((i,r)=>{var n;const s=new XMLHttpRequest;s.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(s.responseType="arraybuffer");for(const e in t.headers)s.setRequestHeader(e,t.headers[e]);"json"===t.type&&(s.responseType="text",(null===(n=t.headers)||void 0===n?void 0:n.Accept)||s.setRequestHeader("Accept","application/json")),s.withCredentials="include"===t.credentials,s.onerror=()=>{r(new Error(s.statusText))},s.onload=()=>{if(!e.signal.aborted)if((s.status>=200&&s.status<300||0===s.status)&&null!==s.response){let e=s.response;if("json"===t.type)try{e=JSON.parse(s.response)}catch(t){return void r(t)}i({data:e,cacheControl:s.getResponseHeader("Cache-Control"),expires:s.getResponseHeader("Expires")})}else{const e=new Blob([s.response],{type:s.getResponseHeader("Content-Type")});r(new st(s.status,s.statusText,t.url,e))}},e.signal.addEventListener("abort",(()=>{s.abort(),r(et())})),s.send(t.body)}))}(t,i)};function lt(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;const e=new URL(t),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function ct(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function ht(t,e,i){if(i&&i[t]){const r=i[t].indexOf(e);-1!==r&&i[t].splice(r,1)}}class ut{constructor(t,e={}){L(this,e),this.type=t}}class dt extends ut{constructor(t,e={}){super("error",L({error:t},e))}}class pt{on(t,e){return this._listeners=this._listeners||{},ct(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return ht(t,e,this._listeners),ht(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},ct(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new ut(t,e||{}));const i=t.type;if(this.listens(i)){t.target=this;const e=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of e)i.call(this,t);const r=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const s of r)ht(i,s,this._oneTimeListeners),s.call(this,t);const n=this._eventedParent;n&&(L(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(t))}else t instanceof dt&&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,e){return this._eventedParent=t,this._eventedParentData=e,this}}var ft={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"}
vendor: 4,691 bytes, line 2
2,bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},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},"*":{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:"*"},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:{},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_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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","property-type":"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","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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:{}
vendor: 12,137 bytes, line 2
2,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","property-type":"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","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},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:"*",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"]
vendor: 14,086 bytes, line 2
2}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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"}}};const
2mt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function _t(t,e){const i={};for(const r in t)"ref"!==r&&(i[r]=t[r]);return mt.forEach((t=>{t in e&&(i[t]=e[t])})),i}function gt(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!gt(t[i],e[i]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t)if(!gt(t[i],e[i]))return!1;return!0}return t===e}function yt(t,e){t.push(e)}function xt(t,e,i){yt(i,{command:"addSource",args:[t,e[t]]})}function vt(t,e,i){yt(e,{command:"removeSource",args:[t]}),i[t]=!0}function bt(t,e,i,r){vt(t,i,r),xt(t,e,i)}function wt(t,e,i){let r;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&"data"!==r&&!gt(t[i][r],e[i][r]))return!1;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&"data"!==r&&!gt(t[i][r],e[i][r]))return!1;return!0}function Tt(t,e,i,r,n,s){t=t||{},e=e||{};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(gt(t[o],e[o])||i.push({command:s,args:[r,o,e[o],n]}));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&!Object.prototype.hasOwnProperty.call(t,o)&&(gt(t[o],e[o])||i.push({command:s,args:[r,o,e[o],n]}))}function Pt(t){return t.id}function Mt(t,e){return t[e.id]=e,t}class St{constructor(t,e,i,r){this.message=(t?`${t}: `:"")+i,r&&(this.identifier=r),null!=e&&e.__line__&&(this.line=e.__line__)}}function It(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}
2class Ct extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class At{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[i,r]of e)this.bindings[i]=r}concat(t){return new At(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const Et={kind:"null"},zt={kind:"number"},kt={kind:"string"},Dt={kind:"boolean"},Rt={kind:"color"},Lt={kind:"projectionDefinition"},Ft={kind:"object"},Bt={kind:"value"},Ot={kind:"collator"},jt={kind:"formatted"},Vt={kind:"padding"},Nt={kind:"resolvedImage"},Zt={kind:"variableAnchorOffsetCollection"};function Ut(t,e){return{kind:"array",itemType:t,N:e}}function Gt(t){if("array"===t.kind){const e=Gt(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const $t=[Et,zt,kt,Dt,Rt,Lt,jt,Ft,Ut(Bt),Vt,Nt,Zt];function qt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!qt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of $t)if(!qt(t,e))return null}return`Expected ${Gt(t)} but found ${Gt(e)} instead.`}function Wt(t,e){return e.some((e=>e.kind===t.kind))}function Ht(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function Xt(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const Kt=.96422,Yt=.82521,Jt=4/29,Qt=6/29,te=3*Qt*Qt,ee=Qt*Qt*Qt,ie=Math.PI/180,re=180/Math.PI;function ne(t){return(t%=360)<0&&(t+=360),t}function se([t,e,i,r]){let n,s;const o=ae((.2225045*(t=oe(t))+.7168786*(e=oe(e))+.0606169*(i=oe(i)))/1);t===e&&e===i?n=s=o:(n=ae((.4360747*t+.3850649*e+.1430804*i)/Kt),s=ae((.0139322*t+.0971045*e+.7141733*i)/Yt));const a=116*o-16;return[a<0?0:a,500*(n-o),200*(o-s),r]}function oe(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ae(t){return t>ee?Math.pow(t,1/3):t/te+Jt}function le([t,e,i,r]){let n=(t+16)/116,s=isNaN(e)?n:n+e/500,o=isNaN(i)?n:n-i/200;return n=1*he(n),s=Kt*he(s),o=Yt*he(o),[ce(3.1338561*s-1.6168667*n-.4906146*o),ce(-.9787684*s+1.9161415*n+.033454*o),ce(.0719453*s-.2289914*n+1.4052427*o),r]}
2function ce(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function he(t){return t>Qt?t*t*t:te*(t-Jt)}function ue(t){return parseInt(t.padEnd(2,t),16)/255}function de(t,e){return pe(e?t/100:t,0,1)}function pe(t,e,i){return Math.min(Math.max(e,t),i)}function fe(t){return!t.some(Number.isNaN)}const me={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 _e(t,e,i){return t+i*(e-t)}function ge(t,e,i){return t.map(((t,r)=>_e(t,e[r],i)))}class ye{constructor(t,e,i,r=1,n=!0){this.r=t,this.g=e,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[t,e,i,r]))}static parse(t){if(t instanceof ye)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=me[t];if(e){const[t,i,r]=e;return[t/255,i/255,r/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let i=1;return[ue(t.slice(i,i+=e)),ue(t.slice(i,i+=e)),ue(t.slice(i,i+=e)),ue(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,i,r,n,s,o,a,l,c,h,u,d]=e,p=[n||" ",a||" ",h].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const t=[r,o,c].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[pe(+i/e,0,1),pe(+s/e,0,1),pe(+l/e,0,1),u?de(+u,d):1];if(fe(t))return t}}return}}const i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[t,e,r,n,s,o,a,l,c]=i,h=[r||" ",s||" ",a].join("");if(" "===h||" /"===h||",,"===h||",,,"===h){const t=[+e,pe(+n,0,100),pe(+o,0,100),l?de(+l,c):1];if(fe(t))return function([t,e,i,r]){function n(r){const n=(r+t/30)%12,s=e*Math.min(i,1-i);return i-s*Math.max(-1,Math.min(n-3,9-n,1))}return t=ne(t),e/=100,i/=100,[n(0),n(8),n(4),r]}(t)}}}(t);return e?new ye(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[t/n,e/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,r,n]=se(t),s=Math.sqrt(i*i+r*r);return[Math.round(1e4*s)?ne(Math.atan2(r,i)*re):NaN,s,e,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",se(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,r]=this.rgb;return`rgba(${[t,e,i].map((t=>Math.round(255*t))).join(",")},${r})`}static interpolate(t,e,i,r="rgb"){switch(r){case"rgb":{const[r,n,s,o]=ge(t.rgb,e.rgb,i);return new ye(r,n,s,o,!1)}case"hcl":{const[r,n,s,o]=t.hcl,[a,l,c,h]=e.hcl;let u,d;if(isNaN(r)||isNaN(a))isNaN(r)?isNaN(a)?u=NaN:(u=a,1!==s&&0!==s||(d=l)):(u=r,1!==c&&0!==c||(d=n));else{let t=a-r;a>r&&t>180?t-=360:a<r&&r-a>180&&(t+=360),u=r+i*t}const[p,f,m,_]=function([t,e,i,r]){return t=isNaN(t)?0:t*ie,le([i,Math.cos(t)*e,Math.sin(t)*e,r])}
2([u,null!=d?d:_e(n,l,i),_e(s,c,i),_e(o,h,i)]);return new ye(p,f,m,_,!1)}case"lab":{const[r,n,s,o]=le(ge(t.lab,e.lab,i));return new ye(r,n,s,o,!1)}}}}ye.black=new ye(0,0,0,1),ye.white=new ye(1,1,1,1),ye.transparent=new ye(0,0,0,0),ye.red=new ye(1,0,0,1);class xe{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const ve=["bottom","center","top"];class be{constructor(t,e,i,r,n,s){this.text=t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=s}}class we{constructor(t){this.sections=t}static fromString(t){return new we([new be(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 we?t:we.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class Te{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Te)return t;if("number"==typeof t)return new Te([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)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 Te(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new Te(ge(t.values,e.values,i))}}class Pe{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Me=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Se{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Se)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const i=t[e],r=t[e+1];if("string"!=typeof i||!Me.has(i))return;if(!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new Se(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){const r=t.values,n=e.values;if(r.length!==n.length)throw new Pe(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const s=[];for(let o=0;o<r.length;o+=2){if(r[o]!==n[o])throw new Pe(`Cannot interpolate values containing mismatched anchors. from[${o}]: ${r[o]}, to[${o}]: ${n[o]}`);s.push(r[o]);const[t,e]=r[o+1],[a,l]=n[o+1];s.push([_e(t,a,i),_e(e,l,i)])}return new Se(s)}}class Ie{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Ie({name:t,available:!1}):null}}class Ce{constructor(t,e,i){this.from=t,this.to=e,this.transition=i}static interpolate(t,e,i){return new Ce(t,e,i)}static parse(t){return t instanceof Ce?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new Ce(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new Ce(t.from,t.to,t.transition):"string"==typeof t?new Ce(t,t,1):void 0}}function Ae(t,e,i,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[t,e,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[t,e,i,r]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ee(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof Ce||t instanceof ye||t instanceof xe||t instanceof we||t instanceof Te||t instanceof Se||t instanceof Ie)return!0;if(Array.isArray(t)){for(const e of t)if(!Ee(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Ee(t[e]))return!1;return!0}return!1}function ze(t){if(null===t)return Et;if("string"==typeof t)return kt;if("boolean"==typeof t)return Dt;if("number"==typeof t)return zt;if(t instanceof ye)return Rt;if(t instanceof Ce)return Lt;if(t instanceof xe)return Ot;if(t instanceof we)return jt;if(t instanceof Te)return Vt;if(t instanceof Se)return Zt;if(t instanceof Ie)return Nt;if(Array.isArray(t)){const e=t.length;let i;for(const r of t){const t=ze(r);if(i){if(i===t)continue;i=Bt;break}i=t}return Ut(i||Bt,e)}return Ft}function ke(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof ye||t instanceof Ce||t instanceof we||t instanceof Te||t instanceof Se||t instanceof Ie?t.toString():JSON.stringify(t)}class De{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ee(t[1]))return e.error("invalid value");const i=t[1];let r=ze(i);const n=e.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new De(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Re={string:kt,number:zt,boolean:Dt,object:Ft};class Le{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,r=1;const n=t[0];if("array"===n){let n,s;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in Re)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);n=Re[i],r++}else n=Bt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],r++}i=Ut(n,s)}else{if(!Re[n])throw new Error(`Types doesn't contain name = ${n}`);i=Re[n]}const s=[];for(;r<t.length;r++){const i=e.parse(t[r],r,Bt);if(!i)return null;s.push(i)}return new Le(i,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!qt(this.type,ze(i)))return i;if(e===this.args.length-1)throw new Pe(`Expected value to be of type ${Gt(this.type)}, but found ${Gt(ze(i))} instead.`)}throw new Error}
2eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Fe={"to-boolean":Dt,"to-color":Rt,"to-number":zt,"to-string":kt};class Be{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(!Fe[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const r=Fe[i],n=[];for(let s=1;s<t.length;s++){const i=e.parse(t[s],s,Bt);if(!i)return null;n.push(i)}return new Be(r,n)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,i;for(const r of this.args){if(e=r.evaluate(t),i=null,e instanceof ye)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Ae(e[0],e[1],e[2],e[3]),!i))return new ye(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Pe(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const i of this.args){e=i.evaluate(t);const r=Te.parse(e);if(r)return r}throw new Pe(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const i of this.args){e=i.evaluate(t);const r=Se.parse(e);if(r)return r}throw new Pe(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const r=Number(e);if(!isNaN(r))return r}throw new Pe(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return we.fromString(ke(this.args[0].evaluate(t)));case"resolvedImage":return Ie.fromString(ke(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return ke(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Oe=["Unknown","Point","LineString","Polygon"];class je{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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?Oe[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=ye.parse(t)),e}}class Ve{constructor(t,e,i=[],r,n=new At,s=[]){this.registry=t,this.path=i,this.key=i.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=s,this.expectedType=r,this._isConstant=e}parse(t,e,i,r,n={}){return e?this.concat(e,i,r)._parse(t,n):this._parse(t,n)}_parse(t,e){function i(t,e,i){return"assert"===i?new Le(e,[t]):"coerce"===i?new Be(e,[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", []].');const r=t[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[r];if(n){let r=n.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,n=r.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"!==n.kind&&"array"!==n.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==n.kind&&"string"!==n.kind)if("padding"!==t.kind||"value"!==n.kind&&"number"!==n.kind&&"array"!==n.kind)if("variableAnchorOffsetCollection"!==t.kind||"value"!==n.kind&&"array"!==n.kind){if(this.checkSubtype(t,n))return null}else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"assert")}if(!(r instanceof De)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const e=new je;try{r=new De(r.type,r.evaluate(e))}catch(t){return this.error(t.message),null}}return r}return this.error(`Unknown expression "${r}". 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,e,i){const r="number"==typeof t?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new Ve(this.registry,this._isConstant,r,e||null,n,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new Ct(i,t))}checkSubtype(t,e){const i=qt(t,e);return i&&this.error(i),i}}class Ne{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n<t.length-1;n+=2){const r=t[n];if("string"!=typeof r)return e.error(`Expected string, but found ${typeof r} instead.`,n);if(/[^a-zA-Z0-9_]/.test(r))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;i.push([r,s])}const r=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return r?new Ne(i,r):null}outputDefined(){return this.result.outputDefined()}}class Ze{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new Ze(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}
vendor: 4,170 bytes, line 2
2class Ue{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,zt),r=e.parse(t[2],2,Ut(e.expectedType||Bt));return i&&r?new Ue(r.type.itemType,i,r):null}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new Pe(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new Pe(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Pe(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Ge{constructor(t,e){this.type=Dt,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,Bt),r=e.parse(t[2],2,Bt);return i&&r?Wt(i.type,[Dt,kt,zt,Et,Bt])?new Ge(i,r):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Gt(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Ht(e,["boolean","string","number","null"]))throw new Pe(`Expected first argument to be of type boolean, string, number or null, but found ${Gt(ze(e))} instead.`);if(!Ht(i,["string","array"]))throw new Pe(`Expected second argument to be of type array or string, but found ${Gt(ze(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class $e{constructor(t,e,i){this.type=zt,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,Bt),r=e.parse(t[2],2,Bt);if(!i||!r)return null;if(!Wt(i.type,[Dt,kt,zt,Et,Bt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Gt(i.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,zt);return n?new $e(i,r,n):null}return new $e(i,r)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Ht(e,["boolean","string","number","null"]))throw new Pe(`Expected first argument to be of type boolean, string, number or null, but found ${Gt(ze(e))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(t)),Ht(i,["string"])){const t=i.indexOf(e,r);return-1===t?-1:[...i.slice(0,t)].length}if(Ht(i,["array"]))return i.indexOf(e,r);throw new Pe(`Expected second argument to be of type array or string, but found ${Gt(ze(i))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class qe{constructor(t,e,i,r,n,s){this.inputType=t,this.type=e,this.input=i,this.cases=r,this.outputs=n,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n={},s=[];for(let l=2;l<t.length-1;l+=2){let o=t[l];const a=t[l+1];Array.isArray(o)||(o=[o]);const c=e.concat(l);if(0===o.length)return c.error("Expected at least one branch label.");for(const t of o){if("number"!=typeof t&&"string"!=typeof t)return c.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,ze(t)))return null}else i=ze(t);if(void 0!==n[String(t)])return c.error("Branch labels must be unique.");n[String(t)]=s.length}const h=e.parse(a,l,r);if(!h)return null;r=r||h.type,s.push(h)}const o=e.parse(t[1],1,Bt);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,r);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(i,o.type)?null:new qe(i,r,o,n,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(ze(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}
2eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class We{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const r=[];for(let s=1;s<t.length-1;s+=2){const n=e.parse(t[s],s,Dt);if(!n)return null;const o=e.parse(t[s+1],s+1,i);if(!o)return null;r.push([n,o]),i=i||o.type}const n=e.parse(t[t.length-1],t.length-1,i);if(!n)return null;if(!i)throw new Error("Can't infer output type");return new We(i,r,n)}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}}class He{constructor(t,e,i,r){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,Bt),r=e.parse(t[2],2,zt);if(!i||!r)return null;if(!Wt(i.type,[Ut(Bt),kt,Bt]))return e.error(`Expected first argument to be of type array or string, but found ${Gt(i.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,zt);return n?new He(i.type,i,r,n):null}return new He(i.type,i,r)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);let r;if(this.endIndex&&(r=this.endIndex.evaluate(t)),Ht(e,["string"]))return[...e].slice(i,r).join("");if(Ht(e,["array"]))return e.slice(i,r);throw new Pe(`Expected first argument to be of type array or string, but found ${Gt(ze(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Xe(t,e){const i=t.length-1;let r,n,s=0,o=i,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),r=t[a],n=t[a+1],r<=e){if(a===i||e<n)return a;s=a+1}else{if(!(r>e))throw new Pe("Input is not a number.");o=a-1}return 0}class Ke{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[r,n]of i)this.labels.push(r),this.outputs.push(n)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,zt);if(!i)return null;const r=[];let n=null;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(let s=1;s<t.length;s+=2){const i=1===s?-1/0:t[s],o=t[s+1],a=s,l=s+1;if("number"!=typeof i)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(r.length&&r[r.length-1][0]>=i)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=e.parse(o,l,n);if(!c)return null;n=n||c.type,r.push([i,c])}return new Ke(n,i,r)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const n=e.length;return r>=e[n-1]?i[n-1].evaluate(t):i[Xe(e,r)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Ye(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Je,Qe,ti=function(){if(Qe)return Je;function t(t,e,i,r){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=r}return Qe=1,Je=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,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,r=0;r<8;r++){var n=this.sampleCurveX(i)-t;if(Math.abs(n)<e)return i;var s=this.sampleCurveDerivativeX(i);
2if(Math.abs(s)<1e-6)break;i-=n/s}var o=0,a=1;for(i=t,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-t)<e));r++)t>n?o=i:a=i,i=.5*(a-o)+o;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},Je}(),ei=Ye(ti);class ii{constructor(t,e,i,r,n){this.type=t,this.operator=e,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[s,o]of n)this.labels.push(s),this.outputs.push(o)}static interpolationFactor(t,e,i,r){let n=0;if("exponential"===t.name)n=ri(e,t.base,i,r);else if("linear"===t.name)n=ri(e,1,i,r);else if("cubic-bezier"===t.name){const s=t.controlPoints;n=new ei(s[0],s[1],s[2],s[3]).solve(ri(e,1,i,r))}return n}static parse(t,e){let[i,r,n,...s]=t;if(!Array.isArray(r)||0===r.length)return e.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const t=r[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:t}}else{if("cubic-bezier"!==r[0])return e.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const t=r.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(n=e.parse(n,2,zt),!n)return null;const o=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=Rt:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let l=0;l<s.length;l+=2){const t=s[l],i=s[l+1],r=l+3,n=l+4;if("number"!=typeof t)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(o.length&&o[o.length-1][0]>=t)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=e.parse(i,n,a);if(!c)return null;a=a||c.type,o.push([t,c])}return Xt(a,zt)||Xt(a,Lt)||Xt(a,Rt)||Xt(a,Vt)||Xt(a,Zt)||Xt(a,Ut(zt))?new ii(a,i,r,n,o):e.error(`Type ${Gt(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const n=e.length;if(r>=e[n-1])return i[n-1].evaluate(t);const s=Xe(e,r),o=ii.interpolationFactor(this.interpolation,r,e[s],e[s+1]),a=i[s].evaluate(t),l=i[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return _e(a,l,o);case"color":return ye.interpolate(a,l,o);case"padding":return Te.interpolate(a,l,o);case"variableAnchorOffsetCollection":return Se.interpolate(a,l,o);case"array":return ge(a,l,o);case"projectionDefinition":return Ce.interpolate(a,l,o)}case"interpolate-hcl":return ye.interpolate(a,l,o,"hcl");case"interpolate-lab":return ye.interpolate(a,l,o,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function ri(t,e,i,r){const n=r-i,s=t-i;return 0===n?0:1===e?s/n:(Math.pow(e,s)-1)/(Math.pow(e,n)-1)}const ni={color:ye.interpolate,number:_e,padding:Te.interpolate,variableAnchorOffsetCollection:Se.interpolate,array:ge};class si{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=null;const r=e.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const o of t.slice(1)){const t=e.parse(o,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,n.push(t)}if(!i)throw new Error("No output type");const s=r&&n.some((t=>qt(r,t.type)));return new si(s?Bt:i,n)}evaluate(t){let e,i=null,r=0;for(const n of this.args)if(r++,i=n.evaluate(t),i&&i instanceof Ie&&!i.available&&(e||(e=i.name),i=null,r===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}function oi(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function ai(t,e,i,r){return 0===r.compare(e,i)}function li(t,e,i){const r="=="!==t&&"!="!==t;
vendor: 3,597 bytes, line 2
2return class n{constructor(t,e,i){this.type=Dt,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let s=e.parse(t[1],1,Bt);if(!s)return null;if(!oi(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${Gt(s.type)}'.`);let o=e.parse(t[2],2,Bt);if(!o)return null;if(!oi(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${Gt(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${Gt(s.type)}' and '${Gt(o.type)}'.`);r&&("value"===s.type.kind&&"value"!==o.type.kind?s=new Le(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new Le(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,Ot),!a)return null}return new n(s,o,a)}evaluate(n){const s=this.lhs.evaluate(n),o=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const e=ze(s),i=ze(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new Pe(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const t=ze(s),i=ze(o);if("string"!==t.kind||"string"!==i.kind)return e(n,s,o)}return this.collator?i(n,s,o,this.collator.evaluate(n)):e(n,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const ci=li("==",(function(t,e,i){return e===i}),ai),hi=li("!=",(function(t,e,i){return e!==i}),(function(t,e,i,r){return!ai(0,e,i,r)})),ui=li("<",(function(t,e,i){return e<i}),(function(t,e,i,r){return r.compare(e,i)<0})),di=li(">",(function(t,e,i){return e>i}),(function(t,e,i,r){return r.compare(e,i)>0})),pi=li("<=",(function(t,e,i){return e<=i}),(function(t,e,i,r){return r.compare(e,i)<=0})),fi=li(">=",(function(t,e,i){return e>=i}),(function(t,e,i,r){return r.compare(e,i)>=0}));class mi{constructor(t,e,i){this.type=Ot,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const r=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,Dt);if(!r)return null;const n=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,Dt);if(!n)return null;let s=null;return i.locale&&(s=e.parse(i.locale,1,kt),!s)?null:new mi(r,n,s)}evaluate(t){return new xe(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 _i{constructor(t,e,i,r,n){this.type=kt,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=n}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,zt);if(!i)return null;const r=t[2];if("object"!=typeof r||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=e.parse(r.locale,1,kt),!n))return null;let s=null;if(r.currency&&(s=e.parse(r.currency,1,kt),!s))return null;let o=null;if(r["min-fraction-digits"]&&(o=e.parse(r["min-fraction-digits"],1,zt),
2!o))return null;let a=null;return r["max-fraction-digits"]&&(a=e.parse(r["max-fraction-digits"],1,zt),!a)?null:new _i(i,n,s,o,a)}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 gi{constructor(t){this.type=jt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const r=[];let n=!1;for(let s=1;s<=t.length-1;++s){const i=t[s];if(n&&"object"==typeof i&&!Array.isArray(i)){n=!1;let t=null;if(i["font-scale"]&&(t=e.parse(i["font-scale"],1,zt),!t))return null;let s=null;if(i["text-font"]&&(s=e.parse(i["text-font"],1,Ut(kt)),!s))return null;let o=null;if(i["text-color"]&&(o=e.parse(i["text-color"],1,Rt),!o))return null;let a=null;if(i["vertical-align"]){if("string"==typeof i["vertical-align"]&&!ve.includes(i["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${i["vertical-align"]}' instead.`);if(a=e.parse(i["vertical-align"],1,kt),!a)return null}const l=r[r.length-1];l.scale=t,l.font=s,l.textColor=o,l.verticalAlign=a}else{const i=e.parse(t[s],1,Bt);if(!i)return null;const o=i.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:i,scale:null,font:null,textColor:null,verticalAlign:null})}}return new gi(r)}evaluate(t){return new we(this.sections.map((e=>{const i=e.content.evaluate(t);return ze(i)===Nt?new be("",i,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new be(ke(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class yi{constructor(t){this.type=Nt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,kt);return i?new yi(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=Ie.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class xi{constructor(t){this.type=zt,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${Gt(i.type)} instead.`):new xi(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new Pe(`Expected value to be of type string or array, but found ${Gt(ze(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const vi=8192;function bi(t,e){const i=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(i*n*vi),Math.round(r*n*vi)]}function wi(t,e){const i=Math.pow(2,e.z);return[(n=(t[0]/vi+e.x)/i,360*n-180),(r=(t[1]/vi+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,n}function Ti(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Pi(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Mi(t,e,i){const r=t[0]-e[0],n=t[1]-e[1],s=t[0]-i[0],o=t[1]-i[1];return r*o-s*n==0&&r*s<=0&&n*o<=0}
2function Si(t,e,i,r){return 0!=(n=[r[0]-i[0],r[1]-i[1]])[0]*(s=[e[0]-t[0],e[1]-t[1]])[1]-n[1]*s[0]&&!(!ki(t,e,i,r)||!ki(i,r,t,e));var n,s}function Ii(t,e,i){for(const r of i)for(let i=0;i<r.length-1;++i)if(Si(t,e,r[i],r[i+1]))return!0;return!1}function Ci(t,e,i=!1){let r=!1;for(const a of e)for(let e=0;e<a.length-1;e++){if(Mi(t,a[e],a[e+1]))return i;(s=a[e])[1]>(n=t)[1]!=(o=a[e+1])[1]>n[1]&&n[0]<(o[0]-s[0])*(n[1]-s[1])/(o[1]-s[1])+s[0]&&(r=!r)}var n,s,o;return r}function Ai(t,e){for(const i of e)if(Ci(t,i))return!0;return!1}function Ei(t,e){for(const i of t)if(!Ci(i,e))return!1;for(let i=0;i<t.length-1;++i)if(Ii(t[i],t[i+1],e))return!1;return!0}function zi(t,e){for(const i of e)if(Ei(t,i))return!0;return!1}function ki(t,e,i,r){const n=r[0]-i[0],s=r[1]-i[1],o=(t[0]-i[0])*s-n*(t[1]-i[1]),a=(e[0]-i[0])*s-n*(e[1]-i[1]);return o>0&&a<0||o<0&&a>0}function Di(t,e,i){const r=[];for(let n=0;n<t.length;n++){const s=[];for(let r=0;r<t[n].length;r++){const o=bi(t[n][r],i);Ti(e,o),s.push(o)}r.push(s)}return r}function Ri(t,e,i){const r=[];for(let n=0;n<t.length;n++){const s=Di(t[n],e,i);r.push(s)}return r}function Li(t,e,i,r){if(t[0]<i[0]||t[0]>i[2]){const e=.5*r;let n=t[0]-i[0]>e?-r:i[0]-t[0]>e?r:0;0===n&&(n=t[0]-i[2]>e?-r:i[2]-t[0]>e?r:0),t[0]+=n}Ti(e,t)}function Fi(t,e,i,r){const n=Math.pow(2,r.z)*vi,s=[r.x*vi,r.y*vi],o=[];for(const a of t)for(const t of a){const r=[t.x+s[0],t.y+s[1]];Li(r,e,i,n),o.push(r)}return o}function Bi(t,e,i,r){const n=Math.pow(2,r.z)*vi,s=[r.x*vi,r.y*vi],o=[];for(const l of t){const t=[];for(const i of l){const r=[i.x+s[0],i.y+s[1]];Ti(e,r),t.push(r)}o.push(t)}if(e[2]-e[0]<=n/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const r of t)Li(r,e,i,n)}var a;return o}class Oi{constructor(t,e){this.type=Dt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ee(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const i of e.features){const{type:e,coordinates:r}=i.geometry;"Polygon"===e&&t.push(r),"MultiPolygon"===e&&t.push(...r)}if(t.length)return new Oi(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Oi(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Oi(e,e)}return e.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,e){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const s=Di(e.coordinates,r,n),o=Fi(t.geometry(),i,r,n);if(!Pi(i,r))return!1;for(const t of o)if(!Ci(t,s))return!1}if("MultiPolygon"===e.type){const s=Ri(e.coordinates,r,n),o=Fi(t.geometry(),i,r,n);if(!Pi(i,r))return!1;for(const t of o)if(!Ai(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const s=Di(e.coordinates,r,n),o=Bi(t.geometry(),i,r,n);if(!Pi(i,r))return!1;for(const t of o)if(!Ei(t,s))return!1}if("MultiPolygon"===e.type){const s=Ri(e.coordinates,r,n),o=Bi(t.geometry(),i,r,n);if(!Pi(i,r))return!1;for(const t of o)if(!zi(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let ji=class{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,r=e[t];for(;t>0;){const n=t-1>>1,s=e[n];if(i(r,s)>=0)break;e[t]=s,t=n}e[t]=r}_down(t){const{data:e,compare:i}=this,r=this.length>>1,n=e[t];for(;t<r;){let r=1+(t<<1);const s=r+1;if(s<this.length&&i(e[s],e[r])<0&&(r=s),i(e[r],n)>=0)break;e[t]=e[r],t=r}e[t]=n}};function Vi(t,e,i=0,r=t.length-1,n=Zi){for(;r>i;){if(r-i>600){const s=r-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);Vi(t,e,Math.max(i,Math.floor(e-o*l/s+c)),Math.min(r,Math.floor(e+(s-o)*l/s+c)),n)}const s=t[e];let o=i,a=r;for(Ni(t,i,e),n(t[r],s)>0&&Ni(t,i,r);o<a;){for(Ni(t,o,a),o++,a--;n(t[o],s)<0;)o++;for(;
2n(t[a],s)>0;)a--}0===n(t[i],s)?Ni(t,i,a):(a++,Ni(t,a,r)),a<=e&&(i=a+1),e<=a&&(r=a-1)}}function Ni(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}function Zi(t,e){return t<e?-1:t>e?1:0}function Ui(t,e){if(t.length<=1)return[t];const i=[];let r,n;for(const s of t){const t=$i(s);0!==t&&(s.area=Math.abs(t),void 0===n&&(n=t<0),n===t<0?(r&&i.push(r),r=[s]):r.push(s))}if(r&&i.push(r),e>1)for(let s=0;s<i.length;s++)i[s].length<=e||(Vi(i[s],e,1,i[s].length-1,Gi),i[s]=i[s].slice(0,e));return i}function Gi(t,e){return e.area-t.area}function $i(t){let e=0;for(let i,r,n=0,s=t.length,o=s-1;n<s;o=n++)i=t[n],r=t[o],e+=(r.x-i.x)*(i.y+r.y);return e}const qi=1/298.257223563,Wi=qi*(2-qi),Hi=Math.PI/180;class Xi{constructor(t){const e=6378.137*Hi*1e3,i=Math.cos(t*Hi),r=1/(1-Wi*(1-i*i)),n=Math.sqrt(r);this.kx=e*n*i,this.ky=e*n*r*(1-Wi)}distance(t,e){const i=this.wrap(t[0]-e[0])*this.kx,r=(t[1]-e[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(t,e){let i,r,n,s,o=1/0;for(let a=0;a<t.length-1;a++){let l=t[a][0],c=t[a][1],h=this.wrap(t[a+1][0]-l)*this.kx,u=(t[a+1][1]-c)*this.ky,d=0;0===h&&0===u||(d=(this.wrap(e[0]-l)*this.kx*h+(e[1]-c)*this.ky*u)/(h*h+u*u),d>1?(l=t[a+1][0],c=t[a+1][1]):d>0&&(l+=h/this.kx*d,c+=u/this.ky*d)),h=this.wrap(e[0]-l)*this.kx,u=(e[1]-c)*this.ky;const p=h*h+u*u;p<o&&(o=p,i=l,r=c,n=a,s=d)}return{point:[i,r],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 Ki(t,e){return e[0]-t[0]}function Yi(t){return t[1]-t[0]+1}function Ji(t,e){return t[1]>=t[0]&&t[1]<e}function Qi(t,e){if(t[0]>t[1])return[null,null];const i=Yi(t);if(e){if(2===i)return[t,null];const e=Math.floor(i/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===i)return[t,null];const r=Math.floor(i/2)-1;return[[t[0],t[0]+r],[t[0]+r+1,t[1]]]}function tr(t,e){if(!Ji(e,t.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let r=e[0];r<=e[1];++r)Ti(i,t[r]);return i}function er(t){const e=[1/0,1/0,-1/0,-1/0];for(const i of t)for(const t of i)Ti(e,t);return e}function ir(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function rr(t,e,i){if(!ir(t)||!ir(e))return NaN;let r=0,n=0;return t[2]<e[0]&&(r=e[0]-t[2]),t[0]>e[2]&&(r=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]<e[1]&&(n=e[1]-t[3]),i.distance([0,0],[r,n])}function nr(t,e,i){const r=i.pointOnLine(e,t);return i.distance(t,r.point)}function sr(t,e,i,r,n){const s=Math.min(nr(t,[i,r],n),nr(e,[i,r],n)),o=Math.min(nr(i,[t,e],n),nr(r,[t,e],n));return Math.min(s,o)}function or(t,e,i,r,n){if(!Ji(e,t.length)||!Ji(r,i.length))return 1/0;let s=1/0;for(let o=e[0];o<e[1];++o){const e=t[o],a=t[o+1];for(let t=r[0];t<r[1];++t){const r=i[t],o=i[t+1];if(Si(e,a,r,o))return 0;s=Math.min(s,sr(e,a,r,o,n))}}return s}function ar(t,e,i,r,n){if(!Ji(e,t.length)||!Ji(r,i.length))return NaN;let s=1/0;for(let o=e[0];o<=e[1];++o)for(let e=r[0];e<=r[1];++e)if(s=Math.min(s,n.distance(t[o],i[e])),0===s)return s;return s}function lr(t,e,i){if(Ci(t,e,!0))return 0;let r=1/0;for(const n of e){const e=n[0],s=n[n.length-1];if(e!==s&&(r=Math.min(r,nr(t,[s,e],i)),0===r))return r;const o=i.pointOnLine(n,t);if(r=Math.min(r,i.distance(t,o.point)),0===r)return r}return r}function cr(t,e,i,r){if(!Ji(e,t.length))return NaN;for(let s=e[0];s<=e[1];++s)if(Ci(t[s],i,!0))return 0;let n=1/0;for(let s=e[0];s<e[1];++s){const e=t[s],o=t[s+1];for(const t of i)for(let i=0,s=t.length,a=s-1;i<s;a=i++){const s=t[a],l=t[i];if(Si(e,o,s,l))return 0;n=Math.min(n,sr(e,o,s,l,r))}}return n}function hr(t,e){for(const i of t)for(const t of i)if(Ci(t,e,!0))return!0;return!1}function ur(t,e,i,r=1/0){const n=er(t),s=er(e);if(r!==1/0&&rr(n,s,i)>=r)return r;if(Pi(n,s)){if(hr(t,e))return 0}else if(hr(e,t))return 0;let o=1/0;for(const a of t)for(let t=0,r=a.length,n=r-1;t<r;n=t++){const r=a[n],s=a[t];for(const t of e)for(let e=0,n=t.length,a=n-1;e<n;a=e++){const n=t[a],l=t[e];if(Si(r,s,n,l))return 0;o=Math.min(o,sr(r,s,n,l,i))}}return o}function dr(t,e,i,r,n,s){if(!s)return;const o=rr(tr(r,s),n,i);o<e&&t.push([o,s,[0,0]])}function pr(t,e,i,r,n,s,o){if(!s||!o)return;const a=rr(tr(r,s),tr(n,o),i);a<e&&t.push([a,s,o])}function fr(t,e,i,r,n=1/0){let s=Math.min(r.distance(t[0],i[0][0]),n);if(0===s)return s;const o=new ji([[0,[0,t.length-1],[0,0]]],Ki),a=er(i);for(;o.length>0;){const n=o.pop();if(n[0]>=s)continue;const l=n[1],c=e?50:100;if(Yi(l)<=c){if(!Ji(l,t.length))return NaN;if(e){const e=cr(t,l,i,r);if(isNaN(e)||0===e)return e;s=Math.min(s,e)}else for(let e=l[0];e<=l[1];++e){const n=lr(t[e],i,r);if(s=Math.min(s,n),0===s)return 0}}else{const i=Qi(l,e);dr(o,s,r,t,a,i[0]),dr(o,s,r,t,a,i[1])}}return s}function mr(t,e,i,r,n,s=1/0){let o=Math.min(s,n.distance(t[0],i[0]));if(0===o)return o;const a=new ji([[0,[0,t.length-1],[0,i.length-1]]],Ki);for(;a.length>0;){const s=a.pop();if(s[0]>=o)continue;const l=s[1],c=s[2],h=e?50:100,u=r?50:100;if(Yi(l)<=h&&Yi(c)<=u){if(!Ji(l,t.length)&&Ji(c,i.length))return NaN;let s;if(e&&r)s=or(t,l,i,c,n),o=Math.min(o,s);else if(e&&!r){const e=t.slice(l[0],l[1]+1);for(let t=c[0];t<=c[1];++t)if(s=nr(i[t],e,n),o=Math.min(o,s),0===o)return o}else if(!e&&r){const e=i.slice(c[0],c[1]+1);for(let i=l[0];i<=l[1];++i)if(s=nr(t[i],e,n),o=Math.min(o,s),0===o)return o}else s=ar(t,l,i,c,n),o=Math.min(o,s)}else{const s=Qi(l,e),h=Qi(c,r);pr(a,o,n,t,i,s[0],h[0]),pr(a,o,n,t,i,s[0],h[1]),pr(a,o,n,t,i,s[1],h[0]),pr(a,o,n,t,i,s[1],h[1])}}return o}
2function _r(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 gr{constructor(t,e){this.type=zt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ee(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new gr(e,e.features.map((t=>_r(t.geometry))).flat());if("Feature"===e.type)return new gr(e,_r(e.geometry));if("type"in e&&"coordinates"in e)return new gr(e,_r(e))}return e.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,e){const i=t.geometry(),r=i.flat().map((e=>wi([e.x,e.y],t.canonical)));if(0===i.length)return NaN;const n=new Xi(r[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,mr(r,!1,[o.coordinates],!1,n,s));break;case"LineString":s=Math.min(s,mr(r,!1,o.coordinates,!0,n,s));break;case"Polygon":s=Math.min(s,fr(r,!1,o.coordinates,n,s))}if(0===s)return s}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=t.geometry(),r=i.flat().map((e=>wi([e.x,e.y],t.canonical)));if(0===i.length)return NaN;const n=new Xi(r[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,mr(r,!0,[o.
2coordinates],!1,n,s));break;case"LineString":s=Math.min(s,mr(r,!0,o.coordinates,!0,n,s));break;case"Polygon":s=Math.min(s,fr(r,!0,o.coordinates,n,s))}if(0===s)return s}return s}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const i=t.geometry();if(0===i.length||0===i[0].length)return NaN;const r=Ui(i,0).map((e=>e.map((e=>e.map((e=>wi([e.x,e.y],t.canonical))))))),n=new Xi(r[0][0][0][1]);let s=1/0;for(const o of e)for(const t of r){switch(o.type){case"Point":s=Math.min(s,fr([o.coordinates],!1,t,n,s));break;case"LineString":s=Math.min(s,fr(o.coordinates,!0,t,n,s));break;case"Polygon":s=Math.min(s,ur(t,o.coordinates,n,s))}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const yr={"==":ci,"!=":hi,">":di,"<":ui,">=":fi,"<=":pi,array:Le,at:Ue,boolean:Le,case:We,coalesce:si,collator:mi,format:gi,image:yi,in:Ge,"index-of":$e,interpolate:ii,"interpolate-hcl":ii,"interpolate-lab":ii,length:xi,let:Ne,literal:De,match:qe,number:Le,"number-format":_i,object:Le,slice:He,step:Ke,string:Le,"to-boolean":Be,"to-color":Be,"to-number":Be,"to-string":Be,var:Ze,within:Oi,distance:gr};class xr{constructor(t,e,i,r){this.name=t,this.type=e,this._evaluate=i,this.args=r}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const i=t[0],r=xr.definitions[i];if(!r)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,s=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[l,c]of o){a=new Ve(e.registry,Pr,e.path,null,e.scope);const r=[];let s=!1;for(let e=1;e<t.length;e++){const i=t[e],n=Array.isArray(l)?l[e-1]:l.type,o=a.parse(i,1+r.length,n);if(!o){s=!0;break}r.push(o)}if(!s)if(Array.isArray(l)&&l.length!==r.length)a.error(`Expected ${l.length} arguments, but found ${r.length} instead.`);else{for(let t=0;t<r.length;t++){const e=Array.isArray(l)?l[t]:l.type,i=r[t];a.concat(t+1).checkSubtype(e,i.type)}if(0===a.errors.length)return new xr(i,n,c,r)}}if(1===o.length)e.errors.push(...a.errors);else{const i=(o.length?o:s).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(Gt).join(", ")})`:`(${Gt(e.type)}...)`;var e})).join(" | "),r=[];for(let n=1;n<t.length;n++){const i=e.parse(t[n],1+r.length);if(!i)return null;r.push(Gt(i.type))}e.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(t,e){xr.definitions=e;for(const i in e)t[i]=xr}}function vr(t,[e,i,r,n]){e=e.evaluate(t),i=i.evaluate(t),r=r.evaluate(t);const s=n?n.evaluate(t):1,o=Ae(e,i,r,s);if(o)throw new Pe(o);return new ye(e/255,i/255,r/255,s,!1)}function br(t,e){return t in e}function wr(t,e){const i=e[t];return void 0===i?null:i}function Tr(t){return{type:t}}function Pr(t){if(t instanceof Ze)return Pr(t.boundExpression);if(t instanceof xr&&"error"===t.name)return!1;if(t instanceof mi)return!1;if(t instanceof Oi)return!1;if(t instanceof gr)return!1;const e=t instanceof Be||t instanceof Le;let i=!0;return t.eachChild((t=>{i=e?i&&Pr(t):i&&t instanceof De})),!!i&&Mr(t)&&Ir(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Mr(t){if(t instanceof xr){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Oi)return!1;if(t instanceof gr)return!1;let e=!0;return t.eachChild((t=>{e&&!Mr(t)&&(e=!1)})),e}function Sr(t){if(t instanceof xr&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Sr(t)&&(e=!1)})),e}function Ir(t,e){if(t instanceof xr&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!Ir(t,e)&&(i=!1)})),i}function Cr(t){return{result:"success",value:t}}function Ar(t){return{result:"error",value:t}}function Er(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function zr(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function kr(t){return!!t.expression&&t.expression.interpolated}function Dr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Rr(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Lr(t){return t}function Fr(t,e){const i="color"===e.type,r=t.stops&&"object"==typeof t.stops[0][0],n=r||!(r||void 0!==t.property),s=t.type||(kr(e)?"exponential":"interval");if(i||"padding"===e.type){const r=i?ye.parse:Te.parse;(t=It({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],r(t[1])]))),t.default=r(t.default?t.default:e.default)}if(t.colorSpace&&"rgb"!==(o=t.colorSpace)&&"hcl"!==o&&"lab"!==o)throw new Error(`Unknown color space: "${t.colorSpace}"`);var o;let a,l,c;if("exponential"===s)a=Vr;else if("interval"===s)a=jr;else if("categorical"===s){a=Or,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);a=Nr}if(r){const i={},r=[];for(let e=0;e<t.stops.length;e++){const n=t.stops[e],s=n[0].zoom;void 0===i[s]&&(i[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},r.push(s)),i[s].stops.push([n[0].value,n[1]])}const n=[];for(const t of r)n.push([i[t].zoom,Fr(i[t],e)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:ii.interpolationFactor.bind(void 0,s),zoomStops:n.map((t=>t[0])),evaluate:({zoom:i},r)=>Vr({stops:n,base:t.base},e,i).evaluate(i,r)}}if(n){const i="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:ii.interpolationFactor.bind(void 0,i),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:i})=>a(t,e,i,l,c)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[t.property]:void 0;return void 0===n?Br(t.default,e.default):a(t,e,n,l,c)}}}function Br(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function Or(t,e,i,r,n){return Br(typeof i===n?r[i]:void 0,t.default,e.default)}function jr(t,e,i){if("number"!==Dr(i))return Br(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];const n=Xe(t.stops.map((t=>t[0])),i);return t.stops[n][1]}function Vr(t,e,i){const r=void 0!==t.base?t.base:1;if("number"!==Dr(i))return Br(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const s=Xe(t.stops.map((t=>
2t[0])),i),o=function(t,e,i,r){const n=r-i,s=t-i;return 0===n?0:1===e?s/n:(Math.pow(e,s)-1)/(Math.pow(e,n)-1)}(i,r,t.stops[s][0],t.stops[s+1][0]),a=t.stops[s][1],l=t.stops[s+1][1],c=ni[e.type]||Lr;return"function"==typeof a.evaluate?{evaluate(...e){const i=a.evaluate.apply(void 0,e),r=l.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==r)return c(i,r,o,t.colorSpace)}}:c(a,l,o,t.colorSpace)}function Nr(t,e,i){switch(e.type){case"color":i=ye.parse(i);break;case"formatted":i=we.fromString(i.toString());break;case"resolvedImage":i=Ie.fromString(i.toString());break;case"padding":i=Te.parse(i);break;default:Dr(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0)}return Br(i,t.default,e.default)}xr.register(yr,{error:[{kind:"error"},[kt],(t,[e])=>{throw new Pe(e.evaluate(t))}],typeof:[kt,[Bt],(t,[e])=>Gt(ze(e.evaluate(t)))],"to-rgba":[Ut(zt,4),[Rt],(t,[e])=>{const[i,r,n,s]=e.evaluate(t).rgb;return[255*i,255*r,255*n,s]}],rgb:[Rt,[zt,zt,zt],vr],rgba:[Rt,[zt,zt,zt,zt],vr],has:{type:Dt,overloads:[[[kt],(t,[e])=>br(e.evaluate(t),t.properties())],[[kt,Ft],(t,[e,i])=>br(e.evaluate(t),i.evaluate(t))]]},get:{type:Bt,overloads:[[[kt],(t,[e])=>wr(e.evaluate(t),t.properties())],[[kt,Ft],(t,[e,i])=>wr(e.evaluate(t),i.evaluate(t))]]},"feature-state":[Bt,[kt],(t,[e])=>wr(e.evaluate(t),t.featureState||{})],properties:[Ft,[],t=>t.properties()],"geometry-type":[kt,[],t=>t.geometryType()],id:[Bt,[],t=>t.id()],zoom:[zt,[],t=>t.globals.zoom],"heatmap-density":[zt,[],t=>t.globals.heatmapDensity||0],"line-progress":[zt,[],t=>t.globals.lineProgress||0],accumulated:[Bt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[zt,Tr(zt),(t,e)=>{let i=0;for(const r of e)i+=r.evaluate(t);return i}],"*":[zt,Tr(zt),(t,e)=>{let i=1;for(const r of e)i*=r.evaluate(t);return i}],"-":{type:zt,overloads:[[[zt,zt],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[zt],(t,[e])=>-e.evaluate(t)]]},"/":[zt,[zt,zt],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[zt,[zt,zt],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[zt,[],()=>Math.LN2],pi:[zt,[],()=>Math.PI],e:[zt,[],()=>Math.E],"^":[zt,[zt,zt],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[zt,[zt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[zt,[zt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[zt,[zt],(t,[e])=>Math.log(e.evaluate(t))],log2:[zt,[zt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[zt,[zt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[zt,[zt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[zt,[zt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[zt,[zt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[zt,[zt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[zt,[zt],(t,[e])=>Math.atan(e.evaluate(t))],min:[zt,Tr(zt),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[zt,Tr(zt),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[zt,[zt],(t,[e])=>Math.abs(e.evaluate(t))],round:[zt,[zt],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[zt,[zt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[zt,[zt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Dt,[kt,Bt],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[Dt,[Bt],(t,[e])=>t.id()===e.value],"filter-type-==":[Dt,[kt],(t,[e])=>t.geometryType()===e.value],"filter-<":[Dt,[kt,Bt],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[Dt,[Bt],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i<r}],"filter->":[Dt,[kt,Bt],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[Dt,[Bt],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i>r}],"filter-<=":[Dt,[kt,Bt],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[Dt,[Bt],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i<=r}],"filter->=":[Dt,[kt,Bt],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[Dt,[Bt],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i>=r}],"filter-has":[Dt,[Bt],(t,[e])=>e.value in t.properties()],"filter-has-id":[Dt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[Dt,[Ut(kt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Dt,[Ut(Bt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Dt,[kt,Ut(Bt)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Dt,[kt,Ut(Bt)],(t,[e,i])=>
vendor: 4,933 bytes, line 2
2function(t,e,i,r){for(;i<=r;){const n=i+r>>1;if(e[n]===t)return!0;e[n]>t?r=n-1:i=n+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Dt,overloads:[[[Dt,Dt],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[Tr(Dt),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:Dt,overloads:[[[Dt,Dt],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[Tr(Dt),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[Dt,[Dt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Dt,[kt],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[kt,[kt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[kt,[kt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[kt,Tr(Bt),(t,e)=>e.map((e=>ke(e.evaluate(t)))).join("")],"resolved-locale":[kt,[Ot],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Zr{constructor(t,e){var i;this.expression=t,this._warningHistory={},this._evaluator=new je,this._defaultValue=e?"color"===(i=e).type&&Rr(i.default)?new ye(0,0,0,0):"color"===i.type?ye.parse(i.default)||null:"padding"===i.type?Te.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?Se.parse(i.default)||null:"projectionDefinition"===i.type?Ce.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,r,n,s){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,r,n,s){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s||null;try{const 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 Pe(`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,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Ur(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in yr}function Gr(t,e){const i=new Ve(yr,Pr,[],e?function(t){const e={color:Rt,string:kt,number:zt,enum:kt,boolean:Dt,formatted:jt,padding:Vt,projectionDefinition:Lt,resolvedImage:Nt,variableAnchorOffsetCollection:Zt};return"array"===t.type?Ut(e[t.value]||Bt,t.length):e[t.type]}(e):void 0),r=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?Cr(new Zr(r,e)):Ar(i.errors)}class $r{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Sr(e.expression)}evaluateWithoutErrorHandling(t,e,i,r,n,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,s)}evaluate(t,e,i,r,n,s){return this._styleExpression.evaluate(t,e,i,r,n,s)}}class qr{constructor(t,e,i,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Sr(e.expression),this.interpolationType=r}evaluateWithoutErrorHandling(t,e,i,r,n,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,s)}evaluate(t,e,i,r,n,s){return this._styleExpression.evaluate(t,e,i,r,n,s)}interpolationFactor(t,e,i){return this.interpolationType?ii.interpolationFactor(this.interpolationType,t,e,i):0}}function Wr(t,e){const i=Gr(t,e);if("error"===i.result)return i;const r=i.value.expression,n=Mr(r);if(!n&&!Er(e))return Ar([new Ct("","data expressions not supported")]);const s=Ir(r,["zoom"]);if(!s&&!zr(e))return Ar([new Ct("","zoom expressions not supported")]);const o=Xr(r);return o||s?o instanceof Ct?Ar([o]):o instanceof ii&&!kr(e)?Ar([new Ct("",'"interpolate" expressions cannot be used with this property')]):Cr(o?new qr(n?"camera":"composite",i.value,o.labels,o instanceof ii?o.interpolation:void 0):new $r(n?"constant":"source",i.value)):Ar([new Ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Hr{constructor(t,e){this._parameters=t,this._specification=e,It(this,Fr(this._parameters,this._specification))}static deserialize(t){return new Hr(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Xr(t){let e=null;if(t instanceof Ne)e=Xr(t.result);else if(t instanceof si){for(const i of t.args)if(e=Xr(i),e)break}else(t instanceof Ke||t instanceof ii)&&t.input instanceof xr&&"zoom"===t.input.name&&(e=t);return e instanceof Ct||t.eachChild((t=>{const i=Xr(t);i instanceof Ct?e=i:!e&&i?e=new Ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new Ct
2("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Kr(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(const e of t.slice(1))if(!Kr(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Yr={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Jr(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Kr(t)||(t=en(t));const e=Gr(t,Yr);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,i,r)=>e.value.evaluate(t,i,{},r),needGeometry:tn(t)}}function Qr(t,e){return t<e?-1:t>e?1:0}function tn(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(tn(t[e]))return!0;return!1}function en(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?rn(t[1],t[2],"=="):"!="===e?on(rn(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?rn(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(en))):"all"===e?["all"].concat(t.slice(1).map(en)):"none"===e?["all"].concat(t.slice(1).map(en).map(on)):"in"===e?nn(t[1],t.slice(2)):"!in"===e?on(nn(t[1],t.slice(2))):"has"===e?sn(t[1]):"!has"!==e||on(sn(t[1]));var i}function rn(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function nn(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Qr)]]:["filter-in-small",t,["literal",e]]}}function sn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function on(t){return["!",t]}function an(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const i of t)e+=`${an(i)},`;return`${e}]`}const i=Object.keys(t).sort();let r="{";for(let n=0;n<i.length;n++)r+=`${JSON.stringify(i[n])}:${an(t[i[n]])},`;return`${r}}`}function ln(t){let e="";for(const i of mt)e+=`/${an(t[i])}`;return e}function cn(t){const e=t.value;return e?[new St(t.key,e,"constants have been deprecated as of v8")]:[]}function hn(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function un(t){if(Array.isArray(t))return t.map(un);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=un(t[i]);return e}return hn(t)}function dn(t){const e=t.key,i=t.value,r=t.valueSpec||{},n=t.objectElementValidators||{},s=t.style,o=t.styleSpec,a=t.validateSpec;let l=[];const c=Dr(i);if("object"!==c)return[new St(e,i,`object expected, ${c} found`)];for(const h in i){const t=h.split(".")[0],c=r[t]||r["*"];let u;if(n[t])u=n[t];else if(r[t])u=a;else if(n["*"])u=n["*"];else{if(!r["*"]){l.push(new St(e,i[h],`unknown property "${h}"`));continue}u=a}l=l.concat(u({key:(e?`${e}.`:e)+h,value:i[h],valueSpec:c,style:s,styleSpec:o,object:i,objectKey:h,validateSpec:a},i))}for(const h in r)n[h]||r[h].required&&void 0===r[h].default&&void 0===i[h]&&l.push(new St(e,i,`missing required property "${h}"`));return l}function pn(t){const e=t.value,i=t.valueSpec,r=t.style,n=t.styleSpec,s=t.key,o=t.arrayElementValidator||t.validateSpec;if("array"!==Dr(e))return[new St(s,e,`array expected, ${Dr(e)} found`)];if(i.length&&e.length!==i.length)return[new St(s,e,`array length ${i.length} expected, length ${e.length} found`)];if(i["min-length"]&&e.length<i["min-length"])return[new St(s,e,`array length at least ${i["min-length"]} expected, length ${e.length} found`)];let a={type:i.value,values:i.values};n.$version<7&&(a.function=i.function),"object"===Dr(i.value)&&(a=i.value);let l=[];for(let c=0;c<e.length;c++)l=l.concat(o({array:e,arrayIndex:c,value:e[c],valueSpec:a,validateSpec:t.validateSpec,style:r,styleSpec:n,key:`${s}[${c}]`}));return l}function fn(t){const e=t.key,i=t.value,r=t.valueSpec;let n=Dr(i);return"number"===n&&i!=i&&(n="NaN"),"number"!==n?[new St(e,i,`number expected, ${n} found`)]:"minimum"in r&&i<r.minimum?[new St(e,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new St(e,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function mn(t){const e=t.valueSpec,i=hn(t.value.type);let r,n,s,o={};const a="categorical"!==i&&void 0===t.value.property,l=!a,c="array"===Dr(t.value.stops)&&"array"===Dr(t.value.stops[0])&&"object"===Dr(t.value.stops[0][0]),h=dn({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"===i)return[new St(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const r=t.value;return e=e.concat(pn({key:t.key,value:r,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:u})),"array"===Dr(r)&&0===r.length&&e.push(new St(t.key,r,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&a&&h.push(new St(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||h.push(new St(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!kr(t.valueSpec)&&h.push(new St(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Er(t.valueSpec)?h.push(new St(t.key,t.value,"property functions not supported")):a&&!zr(t.valueSpec)&&h.push(new St(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==t.value.property||h.push(new St(t.key,t.value,'"property" property is required')),h;function u(t){let i=[];const r=t.value,a=t.key;if("array"!==Dr(r))return[new St(a,r,`array expected, ${Dr(r)} found`)];if(2!==r.length)return[new St(a,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==Dr(r[0]))return[new St(a,r,`object expected, ${Dr(r[0])} found`)];if(void 0===r[0].zoom)return[new St(a,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new St(a,r,"object stop key must have value")];if(s&&s>hn(r[0].zoom))return[new St(a,r[0].zoom,"stop zoom values must appear in ascending order")];hn(r[0].zoom)!==s&&(s=hn(r[0].zoom),n=void 0,o={}),i=i.concat(dn({key:`${a}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:fn,value:d}}))}else i=i.concat(d({key:`${a}[0]`,value:r[0],validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},r));
vendor: 4,417 bytes, line 2
2return Ur(un(r[1]))?i.concat([new St(`${a}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(t.validateSpec({key:`${a}[1]`,value:r[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function d(t,s){const a=Dr(t.value),l=hn(t.value),c=null!==t.value?t.value:s;if(r){if(a!==r)return[new St(t.key,c,`${a} stop domain type must match previous stop domain type ${r}`)]}else r=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new St(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let r=`number expected, ${a} found`;return Er(e)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new St(t.key,c,r)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==n&&l<n?[new St(t.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===i&&l in o?[new St(t.key,c,"stop domain values must be unique")]:(o[l]=!0,[])):[new St(t.key,c,`integer expected, found ${l}`)]}}function _n(t){const e=("property"===t.expressionContext?Wr:Gr)(un(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new St(`${t.key}${e.key}`,t.value,e.message)));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new St(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&&!Sr(i))return[new St(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Sr(i))return[new St(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Ir(i,["zoom","feature-state"]))return[new St(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Mr(i))return[new St(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function gn(t){const e=t.key,i=t.value,r=t.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(hn(i))&&n.push(new St(e,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(hn(i))&&n.push(new St(e,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function yn(t){return Kr(un(t.value))?_n(It({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xn(t)}function xn(t){const e=t.value,i=t.key;if("array"!==Dr(e))return[new St(i,e,`array expected, ${Dr(e)} found`)];const r=t.styleSpec;let n,s=[];if(e.length<1)return[new St(i,e,"filter array must have at least 1 element")];switch(s=s.concat(gn({key:`${i}[0]`,value:e[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),hn(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===hn(e[1])&&s.push(new St(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new St(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=Dr(e[1]),"string"!==n&&s.push(new St(`${i}[1]`,e[1],`string expected, ${n} found`)));for(let o=2;o<e.length;o++)n=Dr(e[o]),"$type"===hn(e[1])?s=s.concat(gn({key:`${i}[${o}]`,value:e[o],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&s.push(new St(`${i}[${o}]`,e[o],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let r=1;r<e.length;r++)s=s.concat(xn({key:`${i}[${r}]`,value:e[r],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":n=Dr(e[1]),2!==e.length?s.push(new St(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==n&&s.push(new St(`${i}[1]`,e[1],`string expected, ${n} found`))}return s}function vn(t,e){const i=t.key,r=t.validateSpec,n=t.style,s=t.styleSpec,o=t.value,a=t.objectKey,l=s[`${e}_${t.layerType}`];if(!l)return[];const c=a.match(/^(.*)-transition$/);if("paint"===e&&c&&l[c[1]]&&l[c[1]].transition)return r({key:i,value:o,valueSpec:s.transition,style:n,styleSpec:s}
2);const h=t.valueSpec||l[a];if(!h)return[new St(i,o,`unknown property "${a}"`)];let u;if("string"===Dr(o)&&Er(h)&&!h.tokens&&(u=/^{([^}]+)}$/.exec(o)))return[new St(i,o,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];const d=[];return"symbol"===t.layerType&&("text-field"===a&&n&&!n.glyphs&&d.push(new St(i,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&Rr(un(o))&&"identity"===hn(o.type)&&d.push(new St(i,o,'"text-font" does not support identity functions'))),d.concat(r({key:t.key,value:o,valueSpec:h,style:n,styleSpec:s,expressionContext:"property",propertyType:e,propertyKey:a}))}function bn(t){return vn(t,"paint")}function wn(t){return vn(t,"layout")}function Tn(t){let e=[];const i=t.value,r=t.key,n=t.style,s=t.styleSpec;i.type||i.ref||e.push(new St(r,i,'either "type" or "ref" is required'));let o=hn(i.type);const a=hn(i.ref);if(i.id){const s=hn(i.id);for(let o=0;o<t.arrayIndex;o++){const t=n.layers[o];hn(t.id)===s&&e.push(new St(r,i.id,`duplicate layer id "${i.id}", previously used at line ${t.id.__line__}`))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in i&&e.push(new St(r,i[t],`"${t}" is prohibited for ref layers`))})),n.layers.forEach((e=>{hn(e.id)===a&&(t=e)})),t?t.ref?e.push(new St(r,i.ref,"ref cannot reference another ref layer")):o=hn(t.type):e.push(new St(r,i.ref,`ref layer "${a}" not found`))}else if("background"!==o)if(i.source){const t=n.sources&&n.sources[i.source],s=t&&hn(t.type);t?"vector"===s&&"raster"===o?e.push(new St(r,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==s&&"hillshade"===o?e.push(new St(r,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===s&&"raster"!==o?e.push(new St(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==s||i["source-layer"]?"raster-dem"===s&&"hillshade"!==o?e.push(new St(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==o||!i.paint||!i.paint["line-gradient"]||"geojson"===s&&t.lineMetrics||e.push(new St(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new St(r,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new St(r,i.source,`source "${i.source}" not found`))}else e.push(new St(r,i,'missing required property "source"'));return e=e.concat(dn({key:r,value:i,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${r}.type`,value:i.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:yn,layout:t=>dn({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>wn(It({layerType:o},t))}}),paint:t=>dn({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>bn(It({layerType:o},t))}})}})),e}function Pn(t){const e=t.value,i=t.key,r=Dr(e);return"string"!==r?[new St(i,e,`string expected, ${r} found`)]:[]}const Mn={promoteId:function({key:t,value:e}){if("string"===Dr(e))return Pn({key:t,value:e});{const i=[];for(const r in e)i.push(...Pn({key:`${t}.${r}`,value:e[r]}));return i}}};function Sn(t){const e=t.value,i=t.key,r=t.styleSpec,n=t.style,s=t.validateSpec;if(!e.type)return[new St(i,e,'"type" is required')];const o=hn(e.type);let a;switch(o){case"vector":case"raster":return a=dn({key:i,value:e,valueSpec:r[`source_${o.replace("-","_")}`],style:t.style,styleSpec:r,objectElementValidators:Mn,validateSpec:s}),a;case"raster-dem":return a=function(t){var e;const i=null!==(e=t.sourceName)&&void 0!==e?e:"",r=t.value,n=t.styleSpec,s=n.source_raster_dem,o=t.style;let a=[];const l=Dr(r);if(void 0===r)return a;
2if("object"!==l)return a.push(new St("source_raster_dem",r,`object expected, ${l} found`)),a;const c="custom"===hn(r.encoding),h=["redFactor","greenFactor","blueFactor","baseShift"],u=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const d in r)!c&&h.includes(d)?a.push(new St(d,r[d],`In "${i}": "${d}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):s[d]?a=a.concat(t.validateSpec({key:d,value:r[d],valueSpec:s[d],validateSpec:t.validateSpec,style:o,styleSpec:n})):a.push(new St(d,r[d],`unknown property "${d}"`));return a}({sourceName:i,value:e,style:t.style,styleSpec:r,validateSpec:s}),a;case"geojson":if(a=dn({key:i,value:e,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:s,objectElementValidators:Mn}),e.cluster)for(const t in e.clusterProperties){const[r,n]=e.clusterProperties[t],s="string"==typeof r?[r,["accumulated"],["get",t]]:r;a.push(..._n({key:`${i}.${t}.map`,value:n,expressionContext:"cluster-map"})),a.push(..._n({key:`${i}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return a;case"video":return dn({key:i,value:e,valueSpec:r.source_video,style:n,validateSpec:s,styleSpec:r});case"image":return dn({key:i,value:e,valueSpec:r.source_image,style:n,validateSpec:s,styleSpec:r});case"canvas":return[new St(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return gn({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function In(t){const e=t.value,i=t.styleSpec,r=i.light,n=t.style;let s=[];const o=Dr(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new St("light",e,`object expected, ${o} found`)]),s;for(const a in e){const o=a.match(/^(.*)-transition$/);s=s.concat(o&&r[o[1]]&&r[o[1]].transition?t.validateSpec({key:a,value:e[a],valueSpec:i.transition,validateSpec:t.validateSpec,style:n,styleSpec:i}):r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new St(a,e[a],`unknown property "${a}"`)])}return s}function Cn(t){const e=t.value,i=t.styleSpec,r=i.sky,n=t.style,s=Dr(e);if(void 0===e)return[];if("object"!==s)return[new St("sky",e,`object expected, ${s} found`)];let o=[];for(const a in e)o=o.concat(r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],style:n,styleSpec:i}):[new St(a,e[a],`unknown property "${a}"`)]);return o}function An(t){const e=t.value,i=t.styleSpec,r=i.terrain,n=t.style;let s=[];const o=Dr(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new St("terrain",e,`object expected, ${o} found`)]),s;for(const a in e)s=s.concat(r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new St(a,e[a],`unknown property "${a}"`)]);return s}function En(t){let e=[];const i=t.value,r=t.key;if(Array.isArray(i)){const n=[],s=[];for(const o in i)i[o].id&&n.includes(i[o].id)&&e.push(new St(r,i,`all the sprites' ids must be unique, but ${i[o].id} is duplicated`)),n.push(i[o].id),i[o].url&&s.includes(i[o].url)&&e.push(new St(r,i,`all the sprites' URLs must be unique, but ${i[o].url} is duplicated`)),s.push(i[o].url),e=e.concat(dn({key:`${r}[${o}]`,value:i[o],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return Pn({key:r,value:i})}const zn={"*":()=>[],array:pn,boolean:function(t){const e=t.value,i=t.key,r=Dr(e);return"boolean"!==r?[new St(i,e,`boolean expected, ${r} found`)]:[]},number:fn,color:function(t){const e=t.key,i=t.value,r=Dr(i);return"string"!==r?[new St(e,i,`color expected, ${r} found`)]:ye.parse(String(i))?[]:[new St(e,i,`color expected, "${i}" found`)]},constants:cn,enum:gn,filter:yn,function:mn,layer:Tn,object:dn,source:Sn,light:In,sky:Cn,terrain:An,projection:function(t){const e=t.value,i=t.styleSpec,r=i.projection,n=t.style,s=Dr(e);if(void 0===e)return[];if("object"!==s)return[new St("projection",e,`object expected, ${s} found`)];let o=[];for(const a in e)o=o.concat(r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],style:n,styleSpec:i}):[new St(a,e[a],`unknown property "${a}"`)]);return o},projectionDefinition:function(t){const e=t.key;let i=t.value;i=i instanceof String?i.valueOf():i;const r=Dr(i);return"array"!==r||function(t){return Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]}(i)||function(t){return!!["interpolate","step","literal"].includes(t[0])}(i)?["array","string"].includes(r)?[]:[new St(e,i,`projection expected, invalid type "${r}" found`)]:[new St(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:Pn,formatted:function(t){return 0===Pn(t).length?[]:_n(t)},resolvedImage:function(t){return 0===Pn(t).length?[]:_n(t)},padding:function(t){const e=t.key,i=t.value;
2if("array"===Dr(i)){if(i.length<1||i.length>4)return[new St(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const r={type:"number"};let n=[];for(let s=0;s<i.length;s++)n=n.concat(t.validateSpec({key:`${e}[${s}]`,value:i[s],validateSpec:t.validateSpec,valueSpec:r}));return n}return fn({key:e,value:i,valueSpec:{}})},variableAnchorOffsetCollection:function(t){const e=t.key,i=t.value,r=Dr(i),n=t.styleSpec;if("array"!==r||i.length<1||i.length%2!=0)return[new St(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let o=0;o<i.length;o+=2)s=s.concat(gn({key:`${e}[${o}]`,value:i[o],valueSpec:n.layout_symbol["text-anchor"]})),s=s.concat(pn({key:`${e}[${o+1}]`,value:i[o+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return s},sprite:En};function kn(t){const e=t.value,i=t.valueSpec,r=t.styleSpec;return t.validateSpec=kn,i.expression&&Rr(hn(e))?mn(t):i.expression&&Ur(un(e))?_n(t):i.type&&zn[i.type]?zn[i.type](t):dn(It({},t,{valueSpec:i.type?r[i.type]:i}))}function Dn(t){const e=t.value,i=t.key,r=Pn(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new St(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new St(i,e,'"glyphs" url must include a "{range}" token'))),r}function Rn(t,e=ft){let i=[];return i=i.concat(kn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:kn,objectElementValidators:{glyphs:Dn,"*":()=>[]}})),t.constants&&(i=i.concat(cn({key:"constants",value:t.constants}))),Fn(i)}function Ln(t){return function(e){return t({...e,validateSpec:kn})}}function Fn(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function Bn(t){return function(...e){return Fn(t.apply(this,e))}}Rn.source=Bn(Ln(Sn)),Rn.sprite=Bn(Ln(En)),Rn.glyphs=Bn(Ln(Dn)),Rn.light=Bn(Ln(In)),Rn.sky=Bn(Ln(Cn)),Rn.terrain=Bn(Ln(An)),Rn.layer=Bn(Ln(Tn)),Rn.filter=Bn(Ln(yn)),Rn.paintProperty=Bn(Ln(bn)),Rn.layoutProperty=Bn(Ln(wn));const On=Rn,jn=On.light,Vn=On.sky,Nn=On.paintProperty,Zn=On.layoutProperty;function Un(t,e){let i=!1;if(e&&e.length)for(const r of e)t.fire(new dt(new Error(r.message))),i=!0;return i}class Gn{constructor(t,e,i){const r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(e=n[1])+2*(i=n[2]);for(let t=0;t<this.d*this.d;t++){const e=n[3+t],i=n[3+t+1];r.push(e===i?null:n.subarray(e,i))}const s=n[3+r.length+1];this.keys=n.subarray(n[3+r.length],s),this.bboxes=n.subarray(s),this.insert=this._insertReadonly}else{this.d=e+2*i;for(let t=0;t<this.d*this.d;t++)r.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;const n=i/e*t;this.min=-n,this.max=t+n}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,i,r,n,s){this.cells[n].push(s)}query(t,e,i,r,n){const s=this.min,o=this.max;if(t<=s&&e<=s&&o<=i&&o<=r&&!n)return Array.prototype.slice.call(this.keys);{const s=[];return this._forEachCell(t,e,i,r,this._queryCell,s,{},n),s}}_queryCell(t,e,i,r,n,s,o,a){const l=this.cells[n];if(null!==l){const n=this.keys,c=this.bboxes;for(let h=0;h<l.length;h++){const u=l[h];if(void 0===o[u]){const l=4*u;(a?a(c[l+0],c[l+1],c[l+2],c[l+3]):t<=c[l+2]&&e<=c[l+3]&&i>=c[l+0]&&r>=c[l+1])?(o[u]=!0,s.push(n[u])):o[u]=!1}}}}_forEachCell(t,e,i,r,n,s,o,a){const l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),h=this._convertToCellCoord(i),u=this._convertToCellCoord(r);for(let d=l;d<=h;d++)for(let l=c;l<=u;l++){const c=this.d*l+d;if((!a||a(this._convertFromCellCoord(d),this._convertFromCellCoord(l),this._convertFromCellCoord(d+1),this._convertFromCellCoord(l+1)))&&n.call(this,t,e,i,r,c,s,o,a))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;const t=this.cells,e=3+this.cells.length+1+1;let i=0;for(let s=0;s<this.cells.length;s++)i+=this.cells[s].length;const r=new Int32Array(e+i+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let n=e;for(let s=0;s<t.length;s++){const e=t[s];r[3+s]=n,r.set(e,n),n+=e.length}return r[3+t.length]=n,r.set(this.keys,n),n+=this.keys.length,r[3+t.length+1]=n,r.set(this.bboxes,n),n+=this.bboxes.length,r.buffer}static serialize(t,e){const i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}}static deserialize(t){return new Gn(t.buffer)}}const $n={};function qn(t,e,i={}){if($n[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),$n[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}qn("Object",Object),qn("TransferableGridIndex",Gn),qn("Color",ye),qn("Error",Error),qn("AJAXError",st),qn("ResolvedImage",Ie),qn("StylePropertyFunction",Hr),qn("StyleExpression",Zr,{omit:["_evaluator"]}),qn("ZoomDependentExpression",qr),qn("ZoomConstantExpression",$r),qn("CompoundExpression",xr,{omit:["_evaluate"]});for(const od in yr)yr[od]._classRegistryKey||qn(`Expression_${od}`,yr[od]);function Wn(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function Hn(t){return t.$name||t.constructor._classRegistryKey}function Xn(t){return!function(t){if(null===t||"object"!=typeof t)return!1;const e=Hn(t);return!(!e||"Object"===e)}(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||Wn(t)||$(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function Kn(t,e){if(Xn(t))return(Wn(t)||$(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const i=[];for(const r of t)i.push(Kn(r,e));return i}if("object"!=typeof t)throw new Error("can't serialize object of type "+typeof t);const i=Hn(t);
2if(!i)throw new Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!$n[i])throw new Error(`${i} is not registered.`);const{klass:r}=$n[i],n=r.serialize?r.serialize(t,e):{};if(r.serialize){if(e&&n===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const r in t){if(!t.hasOwnProperty(r))continue;if($n[i].omit.indexOf(r)>=0)continue;const s=t[r];n[r]=$n[i].shallow.indexOf(r)>=0?s:Kn(s,e)}t instanceof Error&&(n.message=t.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(n.$name=i),n}function Yn(t){if(Xn(t))return t;if(Array.isArray(t))return t.map(Yn);if("object"!=typeof t)throw new Error("can't deserialize object of type "+typeof t);const e=Hn(t)||"Object";if(!$n[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=$n[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const r=Object.create(i.prototype);for(const n of Object.keys(t)){if("$name"===n)continue;const i=t[n];r[n]=$n[e].shallow.indexOf(n)>=0?i:Yn(i)}return r}class Jn{constructor(){this.first=!0}update(t,e){const i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}}const Qn={"Latin-1 Supplement":t=>t>=128&&t<=255,"Hangul Jamo":t=>t>=4352&&t<=4607,Khmer:t=>t>=6016&&t<=6143,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Kanbun:t=>t>=12688&&t<=12703,"CJK Strokes":t=>t>=12736&&t<=12783,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Hangul Syllables":t=>t>=44032&&t<=55215,"Private Use Area":t=>t>=57344&&t<=63743,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function ts(t){for(const e of t)if(os(e.charCodeAt(0)))return!0;return!1}function es(t){for(const e of t)if(!ns(e.charCodeAt(0)))return!1;return!0}function is(t){const e=t.map((t=>{try{return new RegExp(`\\p{sc=${t}}`,"u").source}catch(t){return null}})).filter((t=>t));return new RegExp(e.join("|"),"u")}const rs=is(["Arab","Dupl","Mong","Ougr","Syrc"]);function ns(t){return!rs.test(String.fromCodePoint(t))}const ss=is(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function os(t){return!(746!==t&&747!==t&&(t<4352||!(Qn["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Qn["CJK Compatibility"](t)||Qn["CJK Strokes"](t)||!(!Qn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Qn["Enclosed CJK Letters and Months"](t)||Qn["Ideographic Description Characters"](t)||Qn.Kanbun(t)||Qn.Katakana(t)&&12540!==t||!(!Qn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Qn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Qn["Vertical Forms"](t)||Qn["Yijing Hexagram Symbols"](t)||/\p{sc=Cans}/u.test(String.fromCodePoint(t))||/\p{sc=Hang}/u.test(String.fromCodePoint(t))||ss.test(String.fromCodePoint(t)))))}function as(t){return!(os(t)||function(t){return!!(Qn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Qn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Qn["Letterlike Symbols"](t)||Qn["Number Forms"](t)||Qn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Qn["Control Pictures"](t)&&9251!==t||Qn["Optical Character Recognition"](t)||Qn["Enclosed Alphanumerics"](t)||Qn["Geometric Shapes"](t)||Qn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Qn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Qn["CJK Symbols and Punctuation"](t)||Qn.Katakana(t)||Qn["Private Use Area"](t)||Qn["CJK Compatibility Forms"](t)||Qn["Small Form Variants"](t)||Qn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}
2const ls=is(["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 cs(t){return ls.test(String.fromCodePoint(t))}function hs(t,e){return!(!e&&cs(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Qn.Khmer(t))}function us(t){for(const e of t)if(cs(e.charCodeAt(0)))return!0;return!1}const ds=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(ds.isParsed())throw new 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 e(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if("loading"!==t.pluginStatus)return this.setState(t),t;const e=t.pluginURL,r=new Promise((t=>{this.loadScriptResolve=t}));i(e);const n=new Promise((t=>setTimeout((()=>t()),this.TIMEOUT)));if(yield Promise.race([r,n]),this.isParsed()){const t={pluginStatus:"loaded",pluginURL:e};return this.setState(t),t}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${e}`)}))}};class ps{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Jn,this.transition={})}isSupportedScript(t){return function(t,e){for(const i of t)if(!hs(i.charCodeAt(0),e))return!1;return!0}(t,"loaded"===ds.getRTLTextPluginStatus())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}}}class fs{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Rr(t))return new Hr(t,e);if(Ur(t)){const i=Wr(t,e);if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return i.value}{let i=t;return"color"===e.type&&"string"==typeof t?i=ye.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)?i=Se.parse(t):"projectionDefinition"===e.type&&"string"==typeof t&&(i=Ce.parse(t)):i=Te.parse(t),{kind:"constant",evaluate:()=>i}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class ms{constructor(t){this.property=t,this.value=new fs(t,void 0)}transitioned(t,e){return new gs(this.property,this.value,e,L({},t.transition,this.transition),t.now)}untransitioned(){return new gs(this.property,this.value,null,{},0)}}class _s{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return j(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ms(this._values[t].property)),this._values[t].value=new fs(this._values[t].property,null===e?void 0:j(e))}getTransition(t){return j(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ms(this._values[t].property)),this._values[t].transition=j(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i);const r=this.getTransition(e);void 0!==r&&(t[`${e}-transition`]=r)}return t}transitioned(t,e){const i=new ys(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(t,e._values[r]);return i}untransitioned(){const t=new ys(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class gs{constructor(t,e,i,r,n){this.property=t,this.value=e,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,t.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){const r=t.now||0,n=this.value.possiblyEvaluate(t,e,i),s=this.prior;if(s){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return s.possiblyEvaluate(t,e,i);{const o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,i),n,E(o))}}return n}}class ys{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const r=new bs(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class xs{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return void 0!==this._values[t].value}getValue(t){return j(this._values[t].value)}setValue(t,e){this._values[t]=new fs(this._values[t].property,null===e?void 0:j(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){const r=new bs(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}}class vs{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,i,r){return this.property.evaluate(this.value,this.parameters,t,e,i,r)}}class bs{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class ws{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,i){const r=ni[this.specification.type];return r?r(t,e,i):t}}class Ts{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,r){return new vs(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,r)}:t.expression,e)}interpolate(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new vs(this,{kind:"constant",value:void 0},t.parameters);const r=ni[this.specification.type];if(r){const n=r(t.value.value,e.value.value,i);return new vs(this,{kind:"constant",value:n},t.parameters)}return t}evaluate(t,e,i,r,n,s){return"constant"===t.kind?t.value:t.evaluate(e,i,r,n,s)}}class Ps extends Ts{possiblyEvaluate(t,e,i,r){if(void 0===t.value)return new vs(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,r),s="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n,o=this._calculate(s,s,s,e);return new vs(this,{kind:"constant",value:o},e)}if("camera"===t.expression.kind){const i=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new vs(this,{kind:"constant",value:i},e)}return new vs(this,t.expression,e)}evaluate(t,e,i,r,n,s){if("source"===t.kind){const o=t.evaluate(e,i,r,n,s);return this._calculate(o,o,o,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,r),t.evaluate({zoom:Math.floor(e.zoom)},i,r),t.evaluate({zoom:Math.floor(e.zoom)+1},i,r),e):t.value}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class Ms{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){if(void 0!==t.value){if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,r);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new ps(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ps(Math.floor(e.zoom),e)),t.expression.evaluate(new ps(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class Ss{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){return!!t.expression.evaluate(e,null,{},i,r)}interpolate(){return!1}}class Is{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const i=t[e];i.specification.overridable&&this.overridableProperties.push(e);const r=this.defaultPropertyValues[e]=new fs(i,void 0),n=this.defaultTransitionablePropertyValues[e]=new ms(i);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}}}qn("DataDrivenProperty",Ts),qn("DataConstantProperty",ws),qn("CrossFadedDataDrivenProperty",Ps),qn("CrossFadedProperty",Ms),qn("ColorRampProperty",Ss);const Cs="-transition";class As extends pt{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"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),e.layout&&(this._unevaluatedLayout=new xs(e.layout)),e.paint)){this._transitionablePaint=new _s(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new bs(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,i={}
2){null!=e&&this._validate(Zn,`layers.${this.id}.layout.${t}`,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(Cs)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if(null!=e&&this._validate(Nn,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(Cs))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const i=this._transitionablePaint._values[t],r="cross-faded-data-driven"===i.property.specification["property-type"],n=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const o=this._transitionablePaint._values[t].value;return o.isDataDriven()||n||r||this._handleOverridablePaintPropertyUpdate(t,s,o)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}
vendor: 13,097 bytes, line 2
2serialize(){const 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),O(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,i,r,n={}){return(!n||!1!==n.validate)&&Un(this,t.call(On,{key:e,layerType:this.type,objectKey:i,value:r,styleSpec:ft,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof vs&&Er(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const Es={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class zs{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ks{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ds(t,e=1){let i=0,r=0;return{members:t.map((t=>{const n=Es[t.type].BYTES_PER_ELEMENT,s=i=Rs(i,Math.max(e,n)),o=t.components||1;return r=Math.max(r,n),i+=n*o,{name:t.name,type:t.type,components:o,offset:s}})),size:Rs(i,Math.max(r,e)),alignment:e}}function Rs(t,e){return Math.ceil(t/e)*e}class Ls extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.int16[r+0]=e,this.int16[r+1]=i,t}}Ls.prototype.bytesPerElement=4,qn("StructArrayLayout2i4",Ls);class Fs extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.int16[n+0]=e,this.int16[n+1]=i,this.int16[n+2]=r,t}}Fs.prototype.bytesPerElement=6,qn("StructArrayLayout3i6",Fs);class Bs extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,t}}Bs.prototype.bytesPerElement=8,qn("StructArrayLayout4i8",Bs);class Os extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n,s)}emplace(t,e,i,r,n,s,o){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=s,this.int16[a+5]=o,t}}Os.prototype.bytesPerElement=12,qn("StructArrayLayout2i4i12",Os);class js extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n,s)}emplace(t,e,i,r,n,s,o){const a=4*t,l=8*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=s,this.uint8[l+7]=o,t}}js.prototype.bytesPerElement=8,qn("StructArrayLayout2i4ub8",js);class Vs extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.float32[r+0]=e,this.float32[r+1]=i,t}}Vs.prototype.bytesPerElement=8,qn("StructArrayLayout2f8",Vs);class Ns extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s,o,a,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,t,e,i,r,n,s,o,a,l,c)}emplace(t,e,i,r,n,s,o,a,l,c,h){const u=10*t;return this.uint16[u+0]=e,this.uint16[u+1]=i,this.uint16[u+2]=r,this.uint16[u+3]=n,this.uint16[u+4]=s,this.uint16[u+5]=o,this.uint16[u+6]=a,this.uint16[u+7]=l,this.uint16[u+8]=c,this.uint16[u+9]=h,t}}Ns.prototype.bytesPerElement=20,qn("StructArrayLayout10ui20",Ns);class Zs extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s,o,a,l,c,h,u){const d=this.length;return this.resize(d+1),this.emplace(d,t,e,i,r,n,s,o,a,l,c,h,u)}emplace(t,e,i,r,n,s,o,a,l,c,h,u,d){const p=12*t;return this.int16[p+0]=e,this.int16[p+1]=i,this.int16[p+2]=r,this.int16[p+3]=n,this.uint16[p+4]=s,this.uint16[p+5]=o,this.uint16[p+6]=a,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=h,this.int16[p+10]=u,this.int16[p+11]=d,t}}Zs.prototype.bytesPerElement=24,qn("StructArrayLayout4i4ui4i24",Zs);class Us extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.float32[n+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}}Us.prototype.bytesPerElement=12,qn("StructArrayLayout3f12",Us);class Gs extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}Gs.prototype.bytesPerElement=4,qn("StructArrayLayout1ul4",Gs);class $s extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s,o,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,r,n,s,o,a,l)}emplace(t,e,i,r,n,s,o,a,l,c){const h=10*t,u=5*t;return this.int16[h+0]=e,this.int16[h+1]=i,this.int16[h+2]=r,this.int16[h+3]=n,this.int16[h+4]=s,this.int16[h+5]=o,this.uint32[u+3]=a,this.uint16[h+8]=l,this.uint16[h+9]=c,t}}$s.prototype.bytesPerElement=20,qn("StructArrayLayout6i1ul2ui20",$s);class qs extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n,s)}emplace(t,e,i,r,n,s,o){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=s,this.int16[a+5]=o,t}}qs.prototype.bytesPerElement=12,qn("StructArrayLayout2i2i2i12",qs);class Ws extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r,n)}emplace(t,e,i,r,n,s){const o=4*t,a=8*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=r,this.int16[a+6]=n,this.int16[a+7]=s,t}}Ws.prototype.bytesPerElement=16,qn("StructArrayLayout2f1f2i16",Ws);class Hs extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n,s)}emplace(t,e,i,r,n,s,o){const a=16*t,l=4*t,c=8*t;return this.uint8[a+0]=e,this.uint8[a+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.int16[c+6]=s,this.int16[c+7]=o,t}}Hs.prototype.bytesPerElement=16,qn("StructArrayLayout2ub2f2i16",Hs);class Xs extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,this.uint16[n+2]=r,t}}Xs.prototype.bytesPerElement=6,qn("StructArrayLayout3ui6",Xs);class Ks extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s,o,a,l,c,h,u,d,p,f,m,_){const g=this.length;return this.resize(g+1),this.emplace(g,t,e,i,r,n,s,o,a,l,c,h,u,d,p,f,m,_)}emplace(t,e,i,r,n,s,o,a,l,c,h,u,d,p,f,m,_,g){const y=24*t,x=12*t,v=48*t;return this.int16[y+0]=e,this.int16[y+1]=i,this.uint16[y+2]=r,this.uint16[y+3]=n,this.uint32[x+2]=s,this.uint32[x+3]=o,this.uint32[x+4]=a,this.uint16[y+10]=l,this.uint16[y+11]=c,this.uint16[y+12]=h,this.float32[x+7]=u,this.float32[x+8]=d,this.uint8[v+36]=p,this.uint8[v+37]=f,this.uint8[v+38]=m,this.uint32[x+10]=_,this.int16[y+22]=g,t}}Ks.prototype.bytesPerElement=48,qn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ks);class Ys extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,s,o,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,P,M,S,I){const C=this.length;return this.resize(C+1),this.emplace(C,t,e,i,r,n,s,o,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,P,M,S,I)}emplace(t,e,i,r,n,s,o,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,P,M,S,I,C){const A=32*t,E=16*t;return this.int16[A+0]=e,this.int16[A+1]=i,this.int16[A+2]=r,this.int16[A+3]=n,this.int16[A+4]=s,this.int16[A+5]=o,this.int16[A+6]=a,this.int16[A+7]=l,this.uint16[A+8]=c,this.uint16[A+9]=h,this.uint16[A+10]=u,this.uint16[A+11]=d,this.uint16[A+12]=p,this.uint16[A+13]=f,this.uint16[A+14]=m,this.uint16[A+15]=_,this.uint16[A+16]=g,this.uint16[A+17]=y,this.uint16[A+18]=x,this.uint16[A+19]=v,this.uint16[A+20]=b,this.uint16[A+21]=w,this.uint16[A+22]=T,this.uint32[E+12]=P,this.float32[E+13]=M,this.float32[E+14]=S,this.uint16[A+30]=I,this.uint16[A+31]=C,t}}Ys.prototype.bytesPerElement=64,qn("StructArrayLayout8i15ui1ul2f2ui64",Ys);class Js extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Js.prototype.bytesPerElement=4,qn("StructArrayLayout1f4",Js);class Qs extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.uint16[6*t+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}}Qs.prototype.bytesPerElement=12,qn("StructArrayLayout1ui2f12",Qs);class to extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=i,this.uint16[n+3]=r,t}}to.prototype.bytesPerElement=8,qn("StructArrayLayout1ul2ui8",to);class eo extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,t}}eo.prototype.bytesPerElement=4,qn("StructArrayLayout2ui4",eo);class io extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}io.prototype.bytesPerElement=2,qn("StructArrayLayout1ui2",io);class ro extends ks{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}
2emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=i,this.float32[s+2]=r,this.float32[s+3]=n,t}}ro.prototype.bytesPerElement=16,qn("StructArrayLayout4f16",ro);class no extends zs{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new l(this.anchorPointX,this.anchorPointY)}}no.prototype.size=20;class so extends $s{get(t){return new no(this,t)}}qn("CollisionBoxArray",so);class oo extends zs{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]}}oo.prototype.size=48;class ao extends Ks{get(t){return new oo(this,t)}}qn("PlacedSymbolArray",ao);class lo extends zs{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]}}lo.prototype.size=64;class co extends Ys{get(t){return new lo(this,t)}}qn("SymbolInstanceArray",co);class ho extends Js{getoffsetX(t){return this.float32[1*t+0]}}qn("GlyphOffsetArray",ho);class uo extends Fs{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}qn("SymbolLineVertexArray",uo);class po extends zs{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]}}po.prototype.size=12;class fo extends Qs{get(t){return new po(this,t)}}qn("TextAnchorOffsetArray",fo);class mo extends zs{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]}}mo.prototype.size=8;class _o extends to{get(t){return new mo(this,t)}}qn("FeatureIndexArray",_o);class go extends Ls{}class yo extends Ls{}class xo extends Ls{}class vo extends Os{}class bo extends js{}class wo extends Vs{}class To extends Ns{}class Po extends Zs{}class Mo extends Us{}class So extends Gs{}class Io extends qs{}class Co extends Hs{}class Ao extends Xs{}class Eo extends eo{}const zo=Ds([{name:"a_pos",components:2,type:"Int16"}],4),{members:ko}=zo;class Do{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,e,i,r){const n=this.segments[this.segments.length-1];return t>Do.MAX_VERTEX_ARRAY_LENGTH&&N(`Max vertices per segment is ${Do.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Do.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+t>Do.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r?this.createNewSegment(e,i,r):n}createNewSegment(t,e,i){const r={vertexOffset:t.length,primitiveOffset:e.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==i&&(r.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(t,e,i){return this.prepareSegment(0,t,e,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,r){return new Do([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function Ro(t,e){return 256*(t=D(Math.floor(t),0,255))+D(Math.floor(e),0,255)}Do.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,qn("SegmentVector",Do);const Lo=Ds([{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"}]);var Fo,Bo,Oo,jo={exports:{}},Vo={exports:{}},No={exports:{}},Zo=function(){if(Oo)return jo.exports;Oo=1;var t=(Fo||(Fo=1,Vo.exports=function(t,e){var i,r,n,s,o,a,l,c;for(r=t.length-(i=3&t.length),n=e,o=3432918353,a=461845907,c=0;c<r;)l=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,n=27492+(65535&(s=5*(65535&(n=(n^=l=(6
vendor: 12,508 bytes, line 2
25535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return n^=t.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),Vo.exports),e=(Bo||(Bo=1,No.exports=function(t,e){for(var i,r=t.length,n=e^r,s=0;r>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++s;switch(r){case 3:n^=(255&t.charCodeAt(s+2))<<16;case 2:n^=(255&t.charCodeAt(s+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(s)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),No.exports);return jo.exports=t,jo.exports.murmur3=t,jo.exports.murmur2=e,jo.exports}(),Uo=i(Zo);class Go{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,r){this.ids.push($o(t)),this.positions.push(e,i,r)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=$o(t);let i=0,r=this.ids.length-1;for(;i<r;){const t=i+r>>1;this.ids[t]>=e?r=t:i=t+1}const n=[];for(;this.ids[i]===e;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(t,e){const i=new Float64Array(t.ids),r=new Uint32Array(t.positions);return qo(i,r,0,i.length-1),e&&e.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(t){const e=new Go;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function $o(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Uo(String(t))}function qo(t,e,i,r){for(;i<r;){const n=t[i+r>>1];let s=i-1,o=r+1;for(;;){do{s++}while(t[s]<n);do{o--}while(t[o]>n);if(s>=o)break;Wo(t,s,o),Wo(e,3*s,3*o),Wo(e,3*s+1,3*o+1),Wo(e,3*s+2,3*o+2)}o-i<r-o?(qo(t,e,i,o),i=o+1):(qo(t,e,o+1,r),r=o)}}function Wo(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}qn("FeaturePositionMap",Go);class Ho{constructor(t,e){this.gl=t.gl,this.location=e}}class Xo extends Ho{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Ko extends Ho{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class Yo extends Ho{constructor(t,e){super(t,e),this.current=ye.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))}}const Jo=new Float32Array(16);function Qo(t){return[Ro(255*t.r,255*t.g),Ro(255*t.b,255*t.a)]}class ta{constructor(t,e,i){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return"color"===this.type?new Yo(t,e):new Xo(t,e)}}class ea{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,i,r){const n="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;n&&t.set(n)}getBinding(t,e,i){return"u_pattern"===i.substr(0,9)?new Ko(t,e):new Xo(t,e)}}class ia{constructor(t,e,i,r){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(t,e,i,r,n){const s=this.paintVertexArray.length,o=this.expression.evaluate(new ps(0),e,{},r,[],n);this.paintVertexArray.resize(t),this._setPaintValue(s,t,o)}updatePaintArray(t,e,i,r){const n=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(t,e,n)}_setPaintValue(t,e,i){if("color"===this.type){const r=Qo(i);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r[0],r[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}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 ra{constructor(t,e,i,r,n,s){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new s}populatePaintArray(t,e,i,r,n){const s=this.expression.evaluate(new ps(this.zoom),e,{},r,[],n),o=this.expression.evaluate(new ps(this.zoom+1),e,{},r,[],n),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,s,o)}updatePaintArray(t,e,i,r){const n=this.expression.evaluate({zoom:this.zoom},i,r),s=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(t,e,n,s)}_setPaintValue(t,e,i,r){if("color"===this.type){const n=Qo(i),s=Qo(r);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,n[0],n[1],s[0],s[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),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()}setUniform(t,e){const i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,r=D(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(r)}getBinding(t,e,i){return new Xo(t,e)}}class na{constructor(t,e,i,r,n,s){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=r,this.layerId=s,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,i){const r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,e.patterns&&e.patterns[this.layerId],i)}updatePaintArray(t,e,i,r,n){this._setPaintValues(t,e,i.patterns&&i.patterns[this.layerId],n)}_setPaintValues(t,e,i,r){if(!r||!i)return;const{min:n,mid:s,max:o}=i,a=r[n],l=r[s],c=r[o];if(a&&l&&c)for(let h=t;h<e;h++)this.zoomInPaintVertexArray.emplace(h,l.tl[0],l.tl[1],l.br[0],l.br[1],a.tl[0],a.tl[1],a.br[0],a.br[1],l.pixelRatio,a.pixelRatio),this.zoomOutPaintVertexArray.emplace(h,l.tl[0],l.tl[1],l.br[0],l.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],l.pixelRatio,c.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Lo.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Lo.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class sa{constructor(t,e,i){this.binders={},this._buffers=[];const r=[];for(const n in t.paint._values){if(!i(n))continue;const s=t.paint.get(n);if(!(s instanceof vs&&Er(s.property.specification)))continue;const o=aa(n,t.type),a=s.value,l=s.property.specification.type,c=s.property.useIntegerZoom,h=s.property.specification["property-type"],u="cross-faded"===h||"cross-faded-data-driven"===h;if("constant"===a.kind)this.binders[n]=u?new ea(a.value,o):new ta(a.value,o,l),r.push(`/u_${n}`);else if("source"===a.kind||u){const i=la(n,l,"source");this.binders[n]=u?new na(a,l,c,e,i,t.id):new ia(a,o,l,i),r.push(`/a_${n}`)}else{const t=la(n,l,"composite");this.binders[n]=new ra(a,o,l,c,e,t),r.push(`/z_${n}`)}}this.cacheKey=r.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof ia||e instanceof ra?e.maxValue:0}populatePaintArrays(t,e,i,r,n){for(const s in this.binders){const o=this.binders[s];(o instanceof ia||o instanceof ra||o instanceof na)&&o.populatePaintArray(t,e,i,r,n)}}setConstantPatternPositions(t,e){for(const i in this.binders){const r=this.binders[i];r instanceof ea&&r.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,i,r,n){let s=!1;for(const o in t){const a=e.getPositions(o);for(const e of a){const a=i.feature(e.index);for(const i in this.binders){const l=this.binders[i];if((l instanceof ia||l instanceof ra||l instanceof na)&&!0===l.expression.isStateDependent){const c=r.paint.get(i);l.expression=c.value,l.updatePaintArray(e.start,e.end,a,t[o],n),s=!0}}}}return s}defines(){const t=[];for(const e in this.binders){const i=this.binders[e];(i instanceof ta||i instanceof ea)&&t.push(...i.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof ia||i instanceof ra)for(let e=0;e<i.paintVertexAttributes.length;e++)t.push(i.paintVertexAttributes[e].name);else if(i instanceof na)for(let e=0;e<Lo.members.length;e++)t.push(Lo.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof ta||i instanceof ea||i instanceof ra)for(const e of i.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const i=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof ta||n instanceof ea||n instanceof ra)for(const s of n.uniformNames)if(e[s]){const o=n.getBinding(t,e[s],s);i.push({name:s,property:r,binding:o})}}return i}setUniforms(t,e,i,r){for(const{name:n,property:s,binding:o}of e)this.binders[s].setUniform(o,r,i.get(s),n)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const i=this.binders[e];if(t&&i instanceof na){const e=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(i instanceof ia||i instanceof ra)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(const e in this.binders){const i=this.binders[e];(i instanceof ia||i instanceof ra||i instanceof na)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof ia||e instanceof ra||e instanceof na)&&e.destroy()}}}class oa{constructor(t,e,i=()=>!0){this.programConfigurations={};for(const r of t)this.programConfigurations[r.id]=new sa(r,e,i);this.needsUpload=!1,this._featureMap=new Go,this._bufferOffset=0}populatePaintArrays(t,e,i,r,n,s){for(const o in this.programConfigurations)this.programConfigurations[o].populatePaintArrays(t,e,r,n,s);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,r){for(const n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,r)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function aa(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["ga
2pwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function la(t,e,i){const r={color:{source:Vs,composite:ro},number:{source:Js,composite:Vs}},n=function(t){return{"line-pattern":{source:To,composite:To},"fill-pattern":{source:To,composite:To},"fill-extrusion-pattern":{source:To,composite:To}}[t]}(t);return n&&n[i]||r[e][i]}qn("ConstantBinder",ta),qn("CrossFadedConstantBinder",ea),qn("SourceExpressionBinder",ia),qn("CrossFadedCompositeBinder",na),qn("CompositeExpressionBinder",ra),qn("ProgramConfiguration",sa,{omit:["_buffers"]}),qn("ProgramConfigurationSet",oa);const ca=Math.pow(2,14)-1,ha=-ca-1;function ua(t){const e=S/t.extent,i=t.loadGeometry();for(let r=0;r<i.length;r++){const t=i[r];for(let i=0;i<t.length;i++){const r=t[i],n=Math.round(r.x*e),s=Math.round(r.y*e);r.x=D(n,ha,ca),r.y=D(s,ha,ca),(n<r.x||n>r.x+1||s<r.y||s>r.y+1)&&N("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function da(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?ua(t):[]}}const pa=-32768;function fa(t,e,i,r,n){t.emplaceBack(pa+8*e+r,pa+8*i+n)}class ma{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.hasPattern=!1,this.layoutVertexArray=new yo,this.indexArray=new Ao,this.segments=new Do,this.programConfigurations=new oa(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){const r=this.layers[0],n=[];let s=null,o=!1,a="heatmap"===r.type;if("circle"===r.type){const t=r;s=t.layout.get("circle-sort-key"),o=!s.isConstant(),a=a||"map"===t.paint.get("circle-pitch-alignment")}const l=a?e.subdivisionGranularity.circle:1;for(const{feature:c,id:h,index:u,sourceLayerIndex:d}of t){const t=this.layers[0]._featureFilter.needGeometry,e=da(c,t);if(!this.layers[0]._featureFilter.filter(new ps(this.zoom),e,i))continue;const r=o?s.evaluate(e,{},i):void 0,a={id:h,properties:c.properties,type:c.type,sourceLayerIndex:d,index:u,geometry:t?e.geometry:ua(c),patterns:{},sortKey:r};n.push(a)}o&&n.sort(((t,e)=>t.sortKey-e.sortKey));for(const c of n){const{geometry:r,index:n,sourceLayerIndex:s}=c,o=t[n].feature;this.addFeature(c,r,n,i,l),e.featureIndex.insert(o,r,n,s,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ko),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,r,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 new Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}const o=s.length;for(const a of e)for(const e of a){const i=e.x,r=e.y;if(i<0||i>=S||r<0||r>=S)continue;const n=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,t.sortKey),a=n.vertexLength;for(let t=0;t<o;t++)for(let e=0;e<o;e++)fa(this.layoutVertexArray,i,r,s[e],s[t]);for(let t=0;t<o-1;t++)for(let e=0;e<o-1;e++){const i=a+t*o+e,r=a+(t+1)*o+e;this.indexArray.emplaceBack(i,r+1,i+1),this.indexArray.emplaceBack(i,r,r+1)}n.vertexLength+=o*o,n.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},r)}}function _a(t,e){for(let i=0;i<t.length;i++)if(Ma(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(Ma(t,e[i]))return!0;return!!va(t,e)}function ga(t,e,i){return!!Ma(t,e)||!!wa(e,t,i)}function ya(t,e){if(1===t.length)return Pa(e,t[0]);for(let i=0;i<e.length;i++){const r=e[i];for(let e=0;e<r.length;e++)if(Ma(t,r[e]))return!0}for(let i=0;i<t.length;i++)if(Pa(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(va(t,e[i]))return!0;return!1}function xa(t,e,i){if(t.length>1){if(va(t,e))return!0;for(let r=0;r<e.length;r++)if(wa(e[r],t,i))return!0}for(let r=0;r<t.length;r++)if(wa(t[r],e,i))return!0;return!1}function va(t,e){if(0===t.length||0===e.length)return!1;for(let i=0;i<t.length-1;i++){const r=t[i],n=t[i+1];for(let t=0;t<e.length-1;t++)if(ba(r,n,e[t],e[t+1]))return!0}return!1}function ba(t,e,i,r){return Z(t,i,r)!==Z(e,i,r)&&Z(t,e,i)!==Z(t,e,r)}function wa(t,e,i){const r=i*i;if(1===e.length)return t.distSqr(e[0])<r;for(let n=1;n<e.length;n++)if(Ta(t,e[n-1],e[n])<r)return!0;return!1}
2function Ta(t,e,i){const r=e.distSqr(i);if(0===r)return t.distSqr(e);const n=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/r;return t.distSqr(n<0?e:n>1?i:i.sub(e)._mult(n)._add(e))}function Pa(t,e){for(let i=0;i<t.length;i++)if(Ma(t[i],e))return!0;return!1}function Ma(t,e){let i=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){const s=t[r],o=t[n];s.y>e.y!=o.y>e.y&&e.x<(o.x-s.x)*(e.y-s.y)/(o.y-s.y)+s.x&&(i=!i)}return i}function Sa(t,e,i){const r=i[0],n=i[2];if(t.x<r.x&&e.x<r.x||t.x>n.x&&e.x>n.x||t.y<r.y&&e.y<r.y||t.y>n.y&&e.y>n.y)return!1;const s=Z(t,e,i[0]);return s!==Z(t,e,i[1])||s!==Z(t,e,i[2])||s!==Z(t,e,i[3])}function Ia(t,e,i){const r=e.paint.get(t).value;return"constant"===r.kind?r.value:i.programConfigurations.get(e.id).getMaxValue(t)}function Ca(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Aa(t,e,i,r,n){if(!e[0]&&!e[1])return t;const s=l.convert(e)._mult(n);"viewport"===i&&s._rotate(-r);const o=[];for(let a=0;a<t.length;a++)o.push(t[a].sub(s));return o}let Ea,za;qn("CircleBucket",ma,{omit:["layers"]});var ka={get paint(){return za=za||new Is({"circle-radius":new Ts(ft.paint_circle["circle-radius"]),"circle-color":new Ts(ft.paint_circle["circle-color"]),"circle-blur":new Ts(ft.paint_circle["circle-blur"]),"circle-opacity":new Ts(ft.paint_circle["circle-opacity"]),"circle-translate":new ws(ft.paint_circle["circle-translate"]),"circle-translate-anchor":new ws(ft.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ws(ft.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ws(ft.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ts(ft.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ts(ft.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ts(ft.paint_circle["circle-stroke-opacity"])})},get layout(){return Ea=Ea||new Is({"circle-sort-key":new Ts(ft.layout_circle["circle-sort-key"])})}};class Da extends As{constructor(t){super(t,ka)}createBucket(t){return new ma(t)}queryRadius(t){const e=t;return Ia("circle-radius",this,e)+Ia("circle-stroke-width",this,e)+Ca(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:s,unwrappedTileID:o,getElevation:a}){const l=Aa(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,s),c=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),h="map"===this.paint.get("circle-pitch-alignment"),u=h?l:function(t,e,i,r){return t.map((t=>Ra(t,e,i,r)))}(l,n,o,a),d=h?c*s:c;for(const p of r)for(const t of p){const e=h?t:Ra(t,n,o,a);let i=d;const r=n.projectTileCoordinates(t.x,t.y,o,a).signedDistanceFromCamera;if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=r/n.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=n.cameraToCenterDistance/r),ga(u,e,i))return!0}return!1}}function Ra(t,e,i,r){const n=e.projectTileCoordinates(t.x,t.y,i,r).point;return new l((.5*n.x+.5)*e.width,(.5*-n.y+.5)*e.height)}class La extends ma{}let Fa;qn("HeatmapBucket",La,{omit:["layers"]});var Ba={get paint(){return Fa=Fa||new Is({"heatmap-radius":new Ts(ft.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ts(ft.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ws(ft.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ss(ft.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ws(ft.paint_heatmap["heatmap-opacity"])})}};function Oa(t,{width:e,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*i*r)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${e*i*r}`)}else n=new Uint8Array(e*i*r);return t.width=e,t.height=i,t.data=n,t}function ja(t,{width:e,height:i},r){if(e===t.width&&i===t.height)return;const n=Oa({},{width:e,height:i},r);Va(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},r),t.width=e,t.height=i,t.data=n.data}function Va(t,e,i,r,n,s){if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,a=e.data;if(o===a)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){const c=((i.y+l)*t.width+i.x)*s,h=((r.y+l)*e.width+r.x)*s;for(let t=0;t<n.width*s;t++)a[h+t]=o[c+t]}return e}class Na{constructor(t,e){Oa(this,t,1,e)}resize(t){ja(this,t,1)}clone(){return new Na({width:this.width,height:this.height},new Uint8Array(this.data))}
2static copy(t,e,i,r,n){Va(t,e,i,r,n,1)}}class Za{constructor(t,e){Oa(this,t,4,e)}resize(t){ja(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Za({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){Va(t,e,i,r,n,4)}}function Ua(t){const e={},i=t.resolution||256,r=t.clips?t.clips.length:1,n=t.image||new Za({width:i,height:r});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const s=(i,r,s)=>{e[t.evaluationKey]=s;const o=t.expression.evaluate(e);n.data[i+r+0]=Math.floor(255*o.r/o.a),n.data[i+r+1]=Math.floor(255*o.g/o.a),n.data[i+r+2]=Math.floor(255*o.b/o.a),n.data[i+r+3]=Math.floor(255*o.a)};if(t.clips)for(let o=0,a=0;o<r;++o,a+=4*i)for(let e=0,r=0;e<i;e++,r+=4){const n=e/(i-1),{start:l,end:c}=t.clips[o];s(a,r,l*(1-n)+c*n)}else for(let o=0,a=0;o<i;o++,a+=4)s(0,a,o/(i-1));return n}qn("AlphaImage",Na),qn("RGBAImage",Za);const Ga="big-fb";class $a extends As{createBucket(t){return new La(t)}constructor(t){super(t,Ba),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ua({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Ga)&&this.heatmapFbos.delete(Ga)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}let qa;var Wa={get paint(){return qa=qa||new Is({"hillshade-illumination-direction":new ws(ft.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ws(ft.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ws(ft.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ws(ft.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ws(ft.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ws(ft.paint_hillshade["hillshade-accent-color"])})}};class Ha extends As{constructor(t){super(t,Wa)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}const Xa=Ds([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ka}=Xa;function Ya(t,e,i){const r=i.patternDependencies;let n=!1;for(const s of e){const e=s.paint.get(`${t}-pattern`);e.isConstant()||(n=!0);const i=e.constantOr(null);i&&(n=!0,r[i.to]=!0,r[i.from]=!0)}return n}function Ja(t,e,i,r,n){const s=n.patternDependencies;for(const o of e){const e=o.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:r-1},i,{},n.availableImages),a=e.evaluate({zoom:r},i,{},n.availableImages),l=e.evaluate({zoom:r+1},i,{},n.availableImages);t=t&&t.name?t.name:t,a=a&&a.name?a.name:a,l=l&&l.name?l.name:l,s[t]=!0,s[a]=!0,s[l]=!0,i.patterns[o.id]={min:t,mid:a,max:l}}}return i}function Qa(t,e,i,r,n){let s;if(n===function(t,e,i,r){let n=0;for(let s=e,o=i-r;s<i;s+=r)n+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return n}(t,e,i,r)>0)for(let o=e;o<i;o+=r)s=bl(o/r|0,t[o],t[o+1],s);else for(let o=i-r;o>=e;o-=r)s=bl(o/r|0,t[o],t[o+1],s);return s&&ml(s,s.next)&&(wl(s),s=s.next),s}function tl(t,e){if(!t)return t;e||(e=t);let i,r=t;do{if(i=!1,r.steiner||!ml(r,r.next)&&0!==fl(r.prev,r,r.next))r=r.next;else{if(wl(r),r=e=r.prev,r===r.next)break;i=!0}}while(i||r!==e);return e}function el(t,e,i,r,n,s,o){if(!t)return;!o&&s&&function(t,e,i,r){let n=t;do{0===n.z&&(n.z=cl(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){let e,i=1;do{let r,n=t;t=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let t=0;t<i&&(a++,o=o.nextZ,o);t++);let l=i;for(;a>0||l>0&&o;)0!==a&&(0===l||!o||n.z<=o.z)?(r=n,n=n.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=o}s.nextZ=null,i*=2}while(e>1)}(n)}(t,r,n,s);let a=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(s?rl(t,r,n,s):il(t))e.push(l.i,t.i,c.i),wl(t),t=c.next,a=c.next;else if((t=c)===a){o?1===o?el(t=nl(tl(t),e),e,i,r,n,s,2):2===o&&sl(t,e,i,r,n,s):el(tl(t),e,i,r,n,s,1);break}}}function il(t){const e=t.prev,i=t,r=t.next;if(fl(e,i,r)>=0)return!1;const n=e.x,s=i.x,o=r.x,a=e.y,l=i.y,c=r.y,h=Math.min(n,s,o),u=Math.min(a,l,c),d=Math.max(n,s,o),p=Math.max(a,l,c);let f=r.next;for(;f!==e;){if(f.x>=h&&f.x<=d&&f.y>=u&&f.y<=p&&dl(n,a,s,l,o,c,f.x,f.y)&&fl(f.prev,f,f.next)>=0)return!1;
2f=f.next}return!0}function rl(t,e,i,r){const n=t.prev,s=t,o=t.next;if(fl(n,s,o)>=0)return!1;const a=n.x,l=s.x,c=o.x,h=n.y,u=s.y,d=o.y,p=Math.min(a,l,c),f=Math.min(h,u,d),m=Math.max(a,l,c),_=Math.max(h,u,d),g=cl(p,f,e,i,r),y=cl(m,_,e,i,r);let 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!==o&&dl(a,h,l,u,c,d,x.x,x.y)&&fl(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==o&&dl(a,h,l,u,c,d,v.x,v.y)&&fl(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!==o&&dl(a,h,l,u,c,d,x.x,x.y)&&fl(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!==o&&dl(a,h,l,u,c,d,v.x,v.y)&&fl(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function nl(t,e){let i=t;do{const r=i.prev,n=i.next.next;!ml(r,n)&&_l(r,i,i.next,n)&&xl(r,n)&&xl(n,r)&&(e.push(r.i,i.i,n.i),wl(i),wl(i.next),i=t=n),i=i.next}while(i!==t);return tl(i)}function sl(t,e,i,r,n,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&pl(o,t)){let a=vl(o,t);return o=tl(o,o.next),a=tl(a,a.next),el(o,e,i,r,n,s,0),void el(a,e,i,r,n,s,0)}t=t.next}o=o.next}while(o!==t)}function ol(t,e){let i=t.x-e.x;return 0===i&&(i=t.y-e.y,0===i)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function al(t,e){const i=function(t,e){let i=e;const r=t.x,n=t.y;let s,o=-1/0;if(ml(t,i))return i;do{if(ml(t,i.next))return i.next;if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){const t=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=r&&t>o&&(o=t,s=i.x<i.next.x?i:i.next,t===r))return s}i=i.next}while(i!==e);if(!s)return null;const a=s,l=s.x,c=s.y;let h=1/0;i=s;do{if(r>=i.x&&i.x>=l&&r!==i.x&&ul(n<c?r:o,n,l,c,n<c?o:r,n,i.x,i.y)){const e=Math.abs(n-i.y)/(r-i.x);xl(i,t)&&(e<h||e===h&&(i.x>s.x||i.x===s.x&&ll(s,i)))&&(s=i,h=e)}i=i.next}while(i!==a);return s}(t,e);if(!i)return e;const r=vl(i,t);return tl(r,r.next),tl(i,i.next)}function ll(t,e){return fl(t.prev,t,e.prev)<0&&fl(e.next,t,t.next)<0}function cl(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function hl(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function ul(t,e,i,r,n,s,o,a){return(n-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(i-o)*(e-a)&&(i-o)*(s-a)>=(n-o)*(r-a)}function dl(t,e,i,r,n,s,o,a){return!(t===o&&e===a)&&ul(t,e,i,r,n,s,o,a)}function pl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&_l(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(xl(t,e)&&xl(e,t)&&function(t,e){let i=t,r=!1;const n=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(fl(t.prev,t,e.prev)||fl(t,e.prev,e))||ml(t,e)&&fl(t.prev,t,t.next)>0&&fl(e.prev,e,e.next)>0)}function fl(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ml(t,e){return t.x===e.x&&t.y===e.y}function _l(t,e,i,r){const n=yl(fl(t,e,i)),s=yl(fl(t,e,r)),o=yl(fl(i,r,t)),a=yl(fl(i,r,e));return n!==s&&o!==a||!(0!==n||!gl(t,i,e))||!(0!==s||!gl(t,r,e))||!(0!==o||!gl(i,t,r))||!(0!==a||!gl(i,e,r))}function gl(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function yl(t){return t>0?1:t<0?-1:0}function xl(t,e){return fl(t.prev,t,t.next)<0?fl(t,e,t.next)>=0&&fl(t,t.prev,e)>=0:fl(t,e,t.prev)<0||fl(t,t.next,e)<0}function vl(t,e){const i=Tl(t.i,t.x,t.y),r=Tl(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function bl(t,e,i,r){const n=Tl(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function wl(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 Tl(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Pl{constructor(t,e){if(e>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class Ml{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}Ml.noSubdivision=new Ml({fill:new Pl(0,0),line:new Pl(0,0),tile:new Pl(0,0),stencil:new Pl(0,0),circle:1}),qn("SubdivisionGranularityExpression",Pl),qn("SubdivisionGranularitySetting",Ml);const Sl=-32768,Il=32767;class Cl{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=S/t,this._canonical=e}_getKey(t,e){return(t+=32768)<<16|(e+=32768)}_vertexToIndex(t,e){if(t<-32768||e<-32768||t>32767||e>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const i=0|Math.round(t),r=0|Math.round(e),n=this._getKey(i,r);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);const s=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,s),this._vertexBuffer.push(i,r),s}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(t,e){const i=[];for(let r=0;r<e.length;r+=3){const n=e[r],s=e[r+1],o=e[r+2],a=t[2*n],l=t[2*n+1];(t[2*s]-a)*(t[2*o+1]-l)-(t[2*s+1]-l)*(t[2*o]-a)>0?(i.push(n),i.push(o),i.push(s)):(i.push(n),i.push(s),i.push(o))}return i}(this._vertexBuffer,t);const e=[],i=t.length;for(let r=0;r<i;r+=3){const i=[t[r+0],t[r+1],t[r+2]],n=[this._vertexBuffer[2*t[r+0]+0],this._vertexBuffer[2*t[r+0]+1],this._vertexBuffer[2*t[r+1]+0],this._vertexBuffer[2*t[r+1]+1],this._vertexBuffer[2*t[r+2]+0],this._vertexBuffer[2*t[r+2]+1]];let s=1/0,o=1/0,a=-1/0,l=-1/0;for(let t=0;t<3;t++){const e=n[2*t],i=n[2*t+1];s=Math.min(s,e),a=Math.max(a,e),o=Math.min(o,i),l=Math.max(l,i)}if(s===a||o===l)continue;const c=Math.floor(s/this._granularityCellSize),h=Math.ceil(a/this._granularityCellSize),u=Math.floor(o/this._granularityCellSize),d=Math.ceil(l/this._granularityCellSize);if(c!==h||u!==d)for(let t=u;t<d;t++){const r=this._scanlineGenerateVertexRingForCellRow(t,n,i);zl(this._vertexBuffer,r,e)}else e.push(...i)}return e}_scanlineGenerateVertexRingForCellRow(t,e,i){const r=t*this._granularityCellSize,n=r+this._granularityCellSize,s=[];for(let o=0;o<3;o++){const t=e[2*o],a=e[2*o+1],l=e[2*(o+1)%6],c=e[(2*(o+1)+1)%6],h=e[2*(o+2)%6],u=e[(2*(o+2)+1)%6],d=l-t,p=c-a,f=0===d,m=0===p,_=(r-a
2)/p,g=(n-a)/p,y=Math.min(_,g),x=Math.max(_,g);if(!m&&(y>=1||x<=0)||m&&(a<r||a>n)){c>=r&&c<=n&&s.push(i[(o+1)%3]);continue}!m&&y>0&&s.push(this._vertexToIndex(t+d*y,a+p*y));const v=t+d*Math.max(y,0),b=t+d*Math.min(x,1);f||this._generateIntraEdgeVertices(s,t,a,l,c,v,b),!m&&x<1&&s.push(this._vertexToIndex(t+d*x,a+p*x)),(m||c>=r&&c<=n)&&s.push(i[(o+1)%3]),!m&&(c<=r||c>=n)&&this._generateInterEdgeVertices(s,t,a,l,c,h,u,b,r,n)}return s}_generateIntraEdgeVertices(t,e,i,r,n,s,o){const a=r-e,l=n-i,c=0===l,h=c?Math.min(e,r):Math.min(s,o),u=c?Math.max(e,r):Math.max(s,o),d=Math.floor(h/this._granularityCellSize)+1,p=Math.ceil(u/this._granularityCellSize)-1;if(c?e<r:s<o)for(let f=d;f<=p;f++){const r=f*this._granularityCellSize;t.push(this._vertexToIndex(r,i+l*(r-e)/a))}else for(let f=p;f>=d;f--){const r=f*this._granularityCellSize;t.push(this._vertexToIndex(r,i+l*(r-e)/a))}}_generateInterEdgeVertices(t,e,i,r,n,s,o,a,l,c){const h=n-i,u=s-r,d=o-n,p=(l-n)/d,f=(c-n)/d,m=Math.min(p,f),_=Math.max(p,f),g=r+u*m;let y=Math.floor(Math.min(g,a)/this._granularityCellSize)+1,x=Math.ceil(Math.max(g,a)/this._granularityCellSize)-1,v=a<g;const b=0===d;if(b&&(o===l||o===c))return;if(b||m>=1||_<=0){const t=i-o,r=s+(e-s)*Math.min((l-o)/t,(c-o)/t);y=Math.floor(Math.min(r,a)/this._granularityCellSize)+1,x=Math.ceil(Math.max(r,a)/this._granularityCellSize)-1,v=a<r}const w=h>0?c:l;if(v)for(let T=y;T<=x;T++)t.push(this._vertexToIndex(T*this._granularityCellSize,w));else for(let T=x;T>=y;T--)t.push(this._vertexToIndex(T*this._granularityCellSize,w))}_generateOutline(t){const e=[];for(const i of t){const t=El(i,this._granularity,!0),r=this._pointArrayToIndices(t),n=[];for(let e=1;e<r.length;e++)n.push(r[e-1]),n.push(r[e]);e.push(n)}return e}_handlePoles(t){let e=!1,i=!1;this._canonical&&(0===this._canonical.y&&(e=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(e||i)&&this._fillPoles(t,e,i)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let e=0;e<t.length;e+=2){const i=t[e+1];i===Sl&&(t[e+1]=-32767),i===Il&&(t[e+1]=32766)}}_generatePoleQuad(t,e,i,r,n,s){r>n!=(s===Sl)?(t.push(e),t.push(i),t.push(this._vertexToIndex(r,s)),t.push(i),t.push(this._vertexToIndex(n,s)),t.push(this._vertexToIndex(r,s))):(t.push(i),t.push(e),t.push(this._vertexToIndex(r,s)),t.push(this._vertexToIndex(n,s)),t.push(i),t.push(this._vertexToIndex(r,s)))}_fillPoles(t,e,i){const r=this._vertexBuffer,n=S,s=t.length;for(let o=2;o<s;o+=3){const s=t[o-2],a=t[o-1],l=t[o],c=r[2*s],h=r[2*s+1],u=r[2*a],d=r[2*a+1],p=r[2*l],f=r[2*l+1];e&&(0===h&&0===d&&this._generatePoleQuad(t,s,a,c,u,Sl),0===d&&0===f&&this._generatePoleQuad(t,a,l,u,p,Sl),0===f&&0===h&&this._generatePoleQuad(t,l,s,p,c,Sl)),i&&(h===n&&d===n&&this._generatePoleQuad(t,s,a,c,u,Il),d===n&&f===n&&this._generatePoleQuad(t,a,l,u,p,Il),f===n&&h===n&&this._generatePoleQuad(t,l,s,p,c,Il))}}_initializeVertices(t){for(let e=0;e<t.length;e+=2)this._vertexToIndex(t[e],t[e+1])}subdividePolygonInternal(t,e){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:i,holeIndices:r}=function(t){const e=[],i=[];for(const r of t)if(0!==r.length){r!==t[0]&&e.push(i.length/2);for(let t=0;t<r.length;t++)i.push(r[t].x),i.push(r[t].y)}return{flattened:i,holeIndices:e}}(t);let n;this._initializeVertices(i);try{const t=function(t,e,i=2){const r=e&&e.length,n=r?e[0]*i:t.length;let s=Qa(t,0,n,i,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(r&&(s=function(t,e,i,r){const n=[];for(let s=0,o=e.length;s<o;s++){const i=Qa(t,e[s]*r,s<o-1?e[s+1]*r:t.length,r,!1);i===i.next&&(i.steiner=!0),n.push(hl(i))}n.sort(ol);for(let s=0;s<n.length;s++)i=al(n[s],i);return i}(t,e,s,i)),t.length>80*i){a=1/0,l=1/0;let e=-1/0,r=-1/0;for(let s=i;s<n;s+=i){const i=t[s],n=t[s+1];i<a&&(a=i),n<l&&(l=n),i>e&&(e=i),n>r&&(r=n)}c=Math.max(e-a,r-l),c=0!==c?32767/c:0}return el(s,o,i,a,l,c,0),o}(i,r),e=this._convertIndices(i,t);n=this._subdivideTrianglesScanline(e)}catch(t){console.error(t)}let s=[];return e&&(s=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:s}}_convertIndices(t,e){const i=[];for(let r=0;r<e.length;r++)i.push(this._vertexToIndex(t[2*e[r]],t[2*e[r]+1]));return i}_pointArrayToIndices(t){const e=[];for(let i=0;i<t.length;i++){const r=t[i];e.push(this._vertexToIndex(r.x,r.y))}return e}}function Al(t,e,i,r=!0){return new Cl(i,e).subdividePolygonInternal(t,r)}function El(t,e,i=!1){if(!t||t.length<1)return[];if(t.length<2)return[];const r=t[0],n=t[t.length-1],s=i&&(r.x!==n.x||r.y!==n.y);if(e<2)return s?[...t,t[0]]:[...t];const o=Math.floor(S/e),a=[];a.push(new l(t[0].x,t[0].y));const c=t.length,h=s?c:c-1;for(let u=0;u<h;u++){const e=t[u],i=u<c-1?t[u+1]:t[0],r=e.x,n=e.y,s=i.x,h=i.y,d=r!==s,p=n!==h;if(!d&&!p)continue;const f=s-r,m=h-n,_=Math.abs(f),g=Math.abs(m);let y=r,x=n;for(;;){const t=f>0?(Math.floor(y/o)+1)*o:(Math.ceil(y/o)-1)*o,e=m>
20?(Math.floor(x/o)+1)*o:(Math.ceil(x/o)-1)*o,i=Math.abs(y-t),r=Math.abs(x-e),n=Math.abs(y-s),c=Math.abs(x-h),u=d?i/_:Number.POSITIVE_INFINITY,v=p?r/g:Number.POSITIVE_INFINITY;if((n<=i||!d)&&(c<=r||!p))break;if(u<v&&d||!p){y=t,x+=m*u;const e=new l(y,Math.round(x));a[a.length-1].x===e.x&&a[a.length-1].y===e.y||a.push(e)}else{y+=f*v,x=e;const t=new l(Math.round(y),x);a[a.length-1].x===t.x&&a[a.length-1].y===t.y||a.push(t)}}const v=new l(s,h);a[a.length-1].x===v.x&&a[a.length-1].y===v.y||a.push(v)}return a}function zl(t,e,i){if(0===e.length)throw new Error("Subdivision vertex ring is empty.");let r=0,n=t[2*e[0]];for(let l=1;l<e.length;l++){const i=t[2*e[l]];i<n&&(n=i,r=l)}const s=e.length;let o=r,a=(o+1)%s;for(;;){const r=o-1>=0?o-1:s-1,n=(a+1)%s,l=t[2*e[r]],c=t[2*e[n]],h=t[2*e[o]],u=t[2*e[o]+1],d=t[2*e[a]+1];let p=!1;if(l<c)p=!0;else if(l>c)p=!1;else{const i=d-u,s=-(t[2*e[a]]-h),o=u<d?1:-1;((l-h)*i+(t[2*e[r]+1]-u)*s)*o>((c-h)*i+(t[2*e[n]+1]-u)*s)*o&&(p=!0)}if(p){const t=e[r],n=e[o],l=e[a];t!==n&&t!==l&&n!==l&&i.push(l,n,t),o--,o<0&&(o=s-1)}else{const t=e[n],r=e[o],l=e[a];t!==r&&t!==l&&r!==l&&i.push(l,r,t),a++,a>=s&&(a=0)}if(r===n)break}}function kl(t,e,i,r,n,s,o,a,l){const c=n.length/2,h=o&&a&&l;if(c<Do.MAX_VERTEX_ARRAY_LENGTH){const u=e.prepareSegment(c,i,r),d=u.vertexLength;for(let t=0;t<s.length;t+=3)r.emplaceBack(d+s[t],d+s[t+1],d+s[t+2]);let p,f;u.vertexLength+=c,u.primitiveLength+=s.length/3,h&&(f=o.prepareSegment(c,i,a),p=f.vertexLength,f.vertexLength+=c);for(let e=0;e<n.length;e+=2)t(n[e],n[e+1]);if(h)for(let t=0;t<l.length;t++){const e=l[t];for(let t=1;t<e.length;t+=2)a.emplaceBack(p+e[t-1],p+e[t]);f.primitiveLength+=e.length/2}}else!function(t,e,i,r,n,s){const o=[];for(let u=0;u<r.length/2;u++)o.push(-1);const a={count:0};let l=0,c=t.getOrCreateLatestSegment(e,i),h=c.vertexLength;for(let u=2;u<n.length;u+=3){const d=n[u-2],p=n[u-1],f=n[u];let m=o[d]<l,_=o[p]<l,g=o[f]<l;c.vertexLength+((m?1:0)+(_?1:0)+(g?1:0))>Do.MAX_VERTEX_ARRAY_LENGTH&&(c=t.createNewSegment(e,i),l=a.count,m=!0,_=!0,g=!0,h=0);const y=Dl(o,r,s,a,d,m,c),x=Dl(o,r,s,a,p,_,c),v=Dl(o,r,s,a,f,g,c);i.emplaceBack(h+y-l,h+x-l,h+v-l),c.primitiveLength++}}(e,i,r,n,s,t),h&&function(t,e,i,r,n,s){const o=[];for(let u=0;u<r.length/2;u++)o.push(-1);const a={count:0};let l=0,c=t.getOrCreateLatestSegment(e,i),h=c.vertexLength;for(let u=0;u<n.length;u++){const d=n[u];for(let p=1;p<n[u].length;p+=2){const n=d[p-1],u=d[p];let f=o[n]<l,m=o[u]<l;c.vertexLength+((f?1:0)+(m?1:0))>Do.MAX_VERTEX_ARRAY_LENGTH&&(c=t.createNewSegment(e,i),l=a.count,f=!0,m=!0,h=0);const _=Dl(o,r,s,a,n,f,c),g=Dl(o,r,s,a,u,m,c);i.emplaceBack(h+_-l,h+g-l),c.primitiveLength++}}}(o,i,a,n,l,t),e.forceNewSegmentOnNextPrepare(),null==o||o.forceNewSegmentOnNextPrepare()}function Dl(t,e,i,r,n,s,o){if(s){const s=r.count;return i(e[2*n],e[2*n+1]),t[n]=r.count,r.count++,o.vertexLength++,s}return t[n]}class Rl{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.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new xo,this.indexArray=new Ao,this.indexArray2=new Eo,this.programConfigurations=new oa(t.layers,t.zoom),this.segments=new Do,this.segments2=new Do,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=Ya("fill",this.layers,e);const r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),s=[];for(const{feature:o,id:a,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,h=da(o,t);if(!this.layers[0]._featureFilter.filter(new ps(this.zoom),h,i))continue;const u=n?r.evaluate(h,{},i,e.availableImages):void 0,d={id:a,properties:o.properties,type:o.type,sourceLayerIndex:c,index:l,geometry:t?h.geometry:ua(o),patterns:{},sortKey:u};s.push(d)}n&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const o of s){const{geometry:r,index:n,sourceLayerIndex:s}=o;if(this.hasPattern){const t=Ja("fill",this.layers,o,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(o,r,n,i,{},e.subdivisionGranularity);e.featureIndex.insert(t[n].feature,r,n,s,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,e,i,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,Ka),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,i,r,n,s){for(const o of Ui(e,500)){const t=Al(o,r,s.fill.getGranularityForZoomLevel(r.z)),e=this.layoutVertexArray;kl(((t,i)=>{e.emplaceBack(t,i)}),this.segments,this.layoutVertexArray,this.indexArray,t.verticesFlattened,t.indicesTriangles,this.segments2,this.indexArray2,t.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)}}let Ll,Fl;qn("FillBucket",Rl,{omit:["layers","patternFeatures"]});var Bl={get paint(){return Fl=Fl||new Is({"fill-antialias":new ws(ft.paint_fill["fill-antialias"]),"fill-opacity":new Ts(ft.paint_fill["fill-opacity"]),"fill-color":new Ts(ft.paint_fill["fill-color"]),"fill-outline-color":new Ts(ft.paint_fill["fill-outline-color"]),"fill-translate":new ws(ft.paint_fill["fill-translate"]),"fill-translate-anchor":new ws(ft.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ps(ft.paint_fill["fill-pattern"])})},get layout(){return Ll=Ll||new Is({"fill-sort-key":new Ts(ft.layout_fill["fill-sort-key"])})}};class Ol extends As{constructor(t){super(t,Bl)}recalculate(t,e){super.recalculate(t,e);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Rl(t)}queryRadius(){return Ca(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:i,pixelsToTileUnits:r}){return ya(Aa(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r),e)}isTileClipped(){return!0}}const jl=Ds([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Vl=Ds([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Nl}=jl;var Zl,Ul,Gl,$l,ql,Wl,Hl,Xl={};function Kl(){if(Ul)return Zl;Ul=1;var t=s();function e(t,e,r,n,s){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=s,t.readFields(i,this,e)}function i(t,e,i){1==t?e.id=i.readVarint():2==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos<i;){var r=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[r]=n}}(i,e):3==t?e.type=i.readVarint():4==t&&(e._geometry=i.pos)}function r(t){for(var e,i,r=0,n=0,s=t.length,o=s-1;n<s;o=n++)r+=((i=t[o]).x-(e=t[n]).x)*(e.y+i.y);return r}return Zl=e,e.types=["Unknown","Point","LineString","Polygon"],e.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var i,r=e.readVarint()+e.pos,n=1,s=0,o=0,a=0,l=[];e.pos<r;){if(s<=0){var c=e.readVarint();n=7&c,s=c>>3}if(s--,1===n||2===n)o+=e.readSVarint(),a+=e.readSVarint(),1===n&&(i&&l.push(i),i=[]),i.push(new t(o,a));else{if(7!==n)throw new Error("unknown command "+n);i&&i.push(i[0].clone())}}return i&&l.push(i),l},e.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,r=0,n=0,s=0,o=1/0,a=-1/0,l=1/0,c=-1/0;t.pos<e;){if(r<=0){var h=t.readVarint();i=7&h,r=h>>3}if(r--,1===i||2===i)(n+=t.readSVarint())<o&&(o=n),n>a&&(a=n),(s+=t.readSVarint())<l&&(l=s),s>c&&(c=s);else if(7!==i)throw new Error("unknown command "+i)}return[o,l,a,c]},e.prototype.toGeoJSON=function(t,i,n){var s,o,a=this.extent*Math.pow(2,n),l=this.extent*t,c=this.extent*i,h=this.loadGeometry(),u=e.types[this.type];function d(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+l)/a-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+c)/a)*Math.PI/180)
2)-90]}}switch(this.type){case 1:var p=[];for(s=0;s<h.length;s++)p[s]=h[s][0];d(h=p);break;case 2:for(s=0;s<h.length;s++)d(h[s]);break;case 3:for(h=function(t){var e=t.length;if(e<=1)return[t];for(var i,n,s=[],o=0;o<e;o++){var a=r(t[o]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(i&&s.push(i),i=[t[o]]):i.push(t[o]))}return i&&s.push(i),s}(h),s=0;s<h.length;s++)for(o=0;o<h[s].length;o++)d(h[s][o])}1===h.length?h=h[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:h},properties:this.properties};return"id"in this&&(f.id=this.id),f},Zl}function Yl(){if($l)return Gl;$l=1;var t=Kl();function e(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(i,this,e),this.length=this._features.length}function i(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():5===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):3===t?e._keys.push(i.readString()):4===t&&e._values.push(function(t){for(var e=null,i=t.readVarint()+t.pos;t.pos<i;){var r=t.readVarint()>>3;e=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}return e}(i))}return Gl=e,e.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var i=this._pbf.readVarint()+this._pbf.pos;return new t(this._pbf,i,this.extent,this._keys,this._values)},Gl}function Jl(){return Hl||(Hl=1,Xl.VectorTile=function(){if(Wl)return ql;Wl=1;var t=Yl();function e(e,i,r){if(3===e){var n=new t(r,r.readVarint()+r.pos);n.length&&(i[n.name]=n)}}return ql=function(t,i){this.layers=t.readFields(e,{},i)},ql}(),Xl.VectorTileFeature=Kl(),Xl.VectorTileLayer=Yl()),Xl}var Ql=i(Jl());const tc=Ql.VectorTileFeature.types,ec=Math.pow(2,13);function ic(t,e,i,r,n,s,o,a){t.emplaceBack(e,i,2*Math.floor(r*ec)+o,n*ec*2,s*ec*2,Math.round(a))}class rc{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.hasPattern=!1,this.layoutVertexArray=new vo,this.centroidVertexArray=new go,this.indexArray=new Ao,this.programConfigurations=new oa(t.layers,t.zoom),this.segments=new Do,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.features=[],this.hasPattern=Ya("fill-extrusion",this.layers,e);for(const{feature:r,id:n,index:s,sourceLayerIndex:o}of t){const t=this.layers[0]._featureFilter.needGeometry,a=da(r,t);if(!this.layers[0]._featureFilter.filter(new ps(this.zoom),a,i))continue;const l={id:n,sourceLayerIndex:o,index:s,geometry:t?a.geometry:ua(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(Ja("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,s,i,{},e.subdivisionGranularity),e.featureIndex.insert(r,l.geometry,s,o,this.index,!0)}}addFeatures(t,e,i){for(const r of this.features){const{geometry:n}=r;this.addFeature(r,n,r.index,e,i,t.subdivisionGranularity)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}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,Nl),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Vl.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,i,r,n,s){for(const o of Ui(e,500)){const e={x:0,y:0,sampleCount:0},i=this.layoutVertexArray.length;this.processPolygon(e,r,t,o,s);const n=this.layoutVertexArray.length-i,a=Math.floor(e.x/e.sampleCount),l=Math.floor(e.y/e.sampleC
2ount);for(let t=0;t<n;t++)this.centroidVertexArray.emplaceBack(a,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)}processPolygon(t,e,i,r,n){if(r.length<1)return;if(oc(r[0]))return;for(const h of r)0!==h.length&&nc(t,h);const s={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=n.fill.getGranularityForZoomLevel(e.z),a="Polygon"===tc[i.type];for(const h of r){if(0===h.length)continue;if(oc(h))continue;const t=El(h,o,a);this._generateSideFaces(t,s)}if(!a)return;const l=Al(r,e,o,!1),c=this.layoutVertexArray;kl(((t,e)=>{ic(c,t,e,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let i=0;for(let r=1;r<t.length;r++){const n=t[r],s=t[r-1];if(sc(n,s))continue;e.segment.vertexLength+4>Do.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const o=n.sub(s)._perp()._unit(),a=s.dist(n);i+a>32768&&(i=0),ic(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,0,i),ic(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,1,i),i+=a,ic(this.layoutVertexArray,s.x,s.y,o.x,o.y,0,0,i),ic(this.layoutVertexArray,s.x,s.y,o.x,o.y,0,1,i);const l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}}function nc(t,e){for(let i=0;i<e.length;i++){const r=e[i];i===e.length-1&&e[0].x===r.x&&e[0].y===r.y||(t.x+=r.x,t.y+=r.y,t.sampleCount++)}}function sc(t,e){return t.x===e.x&&(t.x<0||t.x>S)||t.y===e.y&&(t.y<0||t.y>S)}function oc(t){return t.every((t=>t.x<0))||t.every((t=>t.x>S))||t.every((t=>t.y<0))||t.every((t=>t.y>S))}let ac;qn("FillExtrusionBucket",rc,{omit:["layers","features"]});var lc={get paint(){return ac=ac||new Is({"fill-extrusion-opacity":new ws(ft["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ts(ft["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ws(ft["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ws(ft["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ps(ft["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ts(ft["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ts(ft["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new ws(ft["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class cc extends As{constructor(t){super(t,lc)}createBucket(t){return new rc(t)}queryRadius(){return Ca(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:s,pixelPosMatrix:o}){const a=Aa(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,s),c=this.paint.get("fill-extrusion-height").evaluate(e,i),h=this.paint.get("fill-extrusion-base").evaluate(e,i),u=function(t,e){const i=[];for(const r of t){const t=[r.x,r.y,0,1];w(t,t,e),i.push(new l(t[0]/t[3],t[1]/t[3]))}return i}(a,o),d=function(t,e,i,r){const n=[],s=[],o=r[8]*e,a=r[9]*e,c=r[10]*e,h=r[11]*e,u=r[8]*i,d=r[9]*i,p=r[10]*i,f=r[11]*i;for(const m of t){const t=[],e=[];for(const i of m){const n=i.x,s=i.y,m=r[0]*n+r[4]*s+r[12],_=r[1]*n+r[5]*s+r[13],g=r[2]*n+r[6]*s+r[14],y=r[3]*n+r[7]*s+r[15],x=g+c,v=y+h,b=m+u,w=_+d,T=g+p,P=y+f,M=new l((m+o)/v,(_+a)/v);M.z=x/v,t.push(M);const S=new l(b/P,w/P);S.z=T/P,e.push(S)}n.push(t),s.push(e)}return[n,s]}(r,h,c,o);return function(t,e,i){let r=1/0;ya(i,e)&&(r=uc(i,e[0]));for(let n=0;n<e.length;n++){const s=e[n],o=t[n];for(let t=0;t<s.length-1;t++){const e=s[t],n=[e,s[t+1],o[t+1],o[t],e];_a(i,n)&&(r=Math.min(r,uc(i,n)))}}return r!==1/0&&r}(d[0],d[1],u)}}function hc(t,e){return t.x*e.x+t.y*e.y}function uc(t,e){if(1===t.length){let i=0;const r=e[i++];let n;for(;!n||r.equals(n);)if(n=e[i++],!n)return 1/0;for(;i<e.length;i++){const s=e[i],o=t[0],a=n.sub(r),l=s.sub(r),c=o.sub(r),h=hc(a,a),u=hc(a,l),d=hc(l,l),p=hc(c,a),f=hc(c,l),m=h*d-u*u,_=(d*p-u*f)/m,g=(h*f-u*p)/m,y=r.z*(1-_-g)+n.z*_+s.z*g;if(isFinite(y))return y}return 1/0}{let t=1/0;for(const i of e)t=Math.min(t,i.z);return t}}const dc=Ds([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:pc}=dc,fc=Ds([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:mc}=fc,_c=Ql.VectorTileFeature.types,gc=Math.cos(Math.PI/180*37.5),yc=Math.pow(2,14)/.5;class xc{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.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={}
vendor: 4,293 bytes, line 2
2,this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new bo,this.layoutVertexArray2=new wo,this.indexArray=new Ao,this.programConfigurations=new oa(t.layers,t.zoom),this.segments=new Do,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=Ya("line",this.layers,e);const r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),s=[];for(const{feature:o,id:a,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,e=da(o,t);if(!this.layers[0]._featureFilter.filter(new ps(this.zoom),e,i))continue;const h=n?r.evaluate(e,{},i):void 0,u={id:a,properties:o.properties,type:o.type,sourceLayerIndex:c,index:l,geometry:t?e.geometry:ua(o),patterns:{},sortKey:h};s.push(u)}n&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const o of s){const{geometry:r,index:n,sourceLayerIndex:s}=o;if(this.hasPattern){const t=Ja("line",this.layers,o,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(o,r,n,i,{},e.subdivisionGranularity);e.featureIndex.insert(t[n].feature,r,n,s,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,e,i,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,mc)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,pc),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,e,i,r,n,s){const o=this.layers[0].layout,a=o.get("line-join").evaluate(t,{}),l=o.get("line-cap"),c=o.get("line-miter-limit"),h=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const u of e)this.addLine(u,t,a,l,c,h,r,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)}addLine(t,e,i,r,n,s,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=El(t,o?a.line.getGranularityForZoomLevel(o.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const l="Polygon"===_c[e.type];let c=t.length;for(;c>=2&&t[c-1].equals(t[c-2]);)c--;let h=0;for(;h<c-1&&t[h].equals(t[h+1]);)h++;if(c<(l?3:2))return;"bevel"===i&&(n=1.05);const u=this.overscaling<=16?15*S/(512*this.overscaling):0,d=this.segments.prepareSegment(10*c,this.layoutVertexArray,this.indexArray);let p,f,m,_,g;this.e1=this.e2=-1,l&&(p=t[c-2],g=t[h].sub(p)._unit()._perp());for(let y=h;y<c;y++){if(m=y===c-1?l?t[h+1]:void 0:t[y+1],m&&t[y].equals(m))continue;g&&(_=g),p&&(f=p),p=t[y],g=m?m.sub(p)._unit()._perp():_,_=_||g;let e=_.add(g);0===e.x&&0===e.y||e._unit();const o=_.x*g.x+_.y*g.y,a=e.x*g.x+e.y*g.y,x=0!==a?1/a:1/0,v=2*Math.sqrt(2-2*a),b=a<gc&&f&&m,w=_.x*g.y-_.y*g.x>0;if(b&&y>h){const t=p.dist(f);if(t>2*u){const e=p.sub(p.sub(f)._mult(u/t)._round());this.updateDistance(f,e),this.addCurrentVertex(e,_,0,0,d),f=e}}const T=f&&m;let P=T?i:l?"butt":r;if(T&&"round"===P&&(x<s?P="miter":x<=2&&(P="fakeround")),"miter"===P&&x>n&&(P="bevel"),"bevel"===P&&(x>2&&(P="flipbevel"),x<n&&(P="miter")),f&&this.updateDistance(f,p),"miter"===P)e._mult(x),this.addCurrentVertex(p,e,0,0,d);else if("flipbevel"===P){if(x>100)e=g.mult(-1);else{const t=x*_.add(g).mag()/_.sub(g).mag();e._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(p,e,0,0,d),this.addCurrentVertex(p,e.mult(-1),0,0,d)}else if("bevel"===P||"fakeround"===P){const t=-Math.sqrt(x*x-1),e=w?t:0,i=w?0:t;
2if(f&&this.addCurrentVertex(p,_,e,i,d),"fakeround"===P){const t=Math.round(180*v/Math.PI/20);for(let e=1;e<t;e++){let i=e/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+o*(o*(3.55645-1.43519*o)-3.2452))*t*t+(.848013+o*(.215638*o-1.06021)))}const r=g.sub(_)._mult(i)._add(_)._unit()._mult(w?-1:1);this.addHalfVertex(p,r.x,r.y,!1,w,0,d)}}m&&this.addCurrentVertex(p,g,-e,-i,d)}else if("butt"===P)this.addCurrentVertex(p,e,0,0,d);else if("square"===P){const t=f?1:-1;this.addCurrentVertex(p,e,t,t,d)}else"round"===P&&(f&&(this.addCurrentVertex(p,_,0,0,d),this.addCurrentVertex(p,_,1,1,d,!0)),m&&(this.addCurrentVertex(p,g,-1,-1,d,!0),this.addCurrentVertex(p,g,0,0,d)));if(b&&y<c-1){const t=p.dist(m);if(t>2*u){const e=p.add(m.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,g,0,0,d),p=e}}}}addCurrentVertex(t,e,i,r,n,s=!1){const o=e.y*r-e.x,a=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,s,!1,i,n),this.addHalfVertex(t,o,a,s,!0,-r,n),this.distance>yc/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,i,r,n,s))}addHalfVertex({x:t,y:e},i,r,n,s,o,a){const l=.5*(this.lineClips?this.scaledDistance*(yc-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(n?1:0),(e<<1)+(s?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===o?0:o<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,c,this.e2),a.primitiveLength++),s?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}let vc,bc;qn("LineBucket",xc,{omit:["layers","patternFeatures"]});var wc={get paint(){return bc=bc||new Is({"line-opacity":new Ts(ft.paint_line["line-opacity"]),"line-color":new Ts(ft.paint_line["line-color"]),"line-translate":new ws(ft.paint_line["line-translate"]),"line-translate-anchor":new ws(ft.paint_line["line-translate-anchor"]),"line-width":new Ts(ft.paint_line["line-width"]),"line-gap-width":new Ts(ft.paint_line["line-gap-width"]),"line-offset":new Ts(ft.paint_line["line-offset"]),"line-blur":new Ts(ft.paint_line["line-blur"]),"line-dasharray":new Ms(ft.paint_line["line-dasharray"]),"line-pattern":new Ps(ft.paint_line["line-pattern"]),"line-gradient":new Ss(ft.paint_line["line-gradient"])})},get layout(){return vc=vc||new Is({"line-cap":new ws(ft.layout_line["line-cap"]),"line-join":new Ts(ft.layout_line["line-join"]),"line-miter-limit":new ws(ft.layout_line["line-miter-limit"]),"line-round-limit":new ws(ft.layout_line["line-round-limit"]),"line-sort-key":new Ts(ft.layout_line["line-sort-key"])})}};class Tc extends Ts{possiblyEvaluate(t,e){return e=new ps(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,r){return e=L({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,r)}}let Pc;class Mc extends As{constructor(t){super(t,wc),this.gradientVersion=0,Pc||(Pc=new Tc(wc.paint.properties["line-width"].specification),Pc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof Ke,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Pc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new xc(t)}queryRadius(t){const e=t,i=Sc(Ia("line-width",this,e),Ia("line-gap-width",this,e)),r=Ia("line-offset",this,e);return i/2+Math.abs(r)+Ca(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:s}){const o=Aa(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,s),a=s/2*Sc(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),c=this.paint.get("line-offset").evaluate(e,i);return c&&(r=function(t,e){const i=[];for(let r=0;r<t.length;r++){const n=t[r],s=[];for(let t=0;t<n.length;t++){const i=n[t-1],r=n[t],o=n[t+1],a=0===t?new l(0,0):r.sub(i)._unit()._perp(),c=t===n.length-1?new l(0,0):o.sub(r)._unit()._perp(),h=a._add(c)._unit(),u=h.x*c.x+h.y*c.y;0!==u&&h._mult(1/u),s.push(h._mult(e)._add(r))}i.push(s)}return i}
2(r,c*s)),function(t,e,i){for(let r=0;r<e.length;r++){const n=e[r];if(t.length>=3)for(let e=0;e<n.length;e++)if(Ma(t,n[e]))return!0;if(xa(t,n,i))return!0}return!1}(o,r,a)}isTileClipped(){return!0}}function Sc(t,e){return e>0?e+2*t:t}const Ic=Ds([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Cc=Ds([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ds([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Ac=Ds([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Ds([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Ec=Ds([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),zc=Ds([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function kc(t,e,i){return t.sections.forEach((t=>{t.text=function(t,e,i){const r=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?t=t.toLocaleUpperCase():"lowercase"===r&&(t=t.toLocaleLowerCase()),ds.applyArabicShaping&&(t=ds.applyArabicShaping(t)),t}(t.text,e,i)})),t}Ds([{name:"triangle",components:3,type:"Uint16"}]),Ds([{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"}]),Ds([{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"}]),Ds([{type:"Float32",name:"offsetX"}]),Ds([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ds([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Dc={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹"};var Rc,Lc,Fc,Bc=24,Oc={};
vendor: 8,377 bytes, line 2
2function jc(){return Rc||(Rc=1,Oc.read=function(t,e,i,r,n){var s,o,a=8*n-r-1,l=(1<<a)-1,c=l>>1,h=-7,u=i?n-1:0,d=i?-1:1,p=t[e+u];for(u+=d,s=p&(1<<-h)-1,p>>=-h,h+=a;h>0;s=256*s+t[e+u],u+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=r;h>0;o=256*o+t[e+u],u+=d,h-=8);if(0===s)s=1-c;else{if(s===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),s-=c}return(p?-1:1)*o*Math.pow(2,s-r)},Oc.write=function(t,e,i,r,n,s){var o,a,l,c=8*s-n-1,h=(1<<c)-1,u=h>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:s-1,f=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=h):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(e*l-1)*Math.pow(2,n),o+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;t[i+p]=255&a,p+=f,a/=256,n-=8);for(o=o<<n|a,c+=n;c>0;t[i+p]=255&o,p+=f,o/=256,c-=8);t[i+p-f]|=128*m}),Oc}function Vc(){if(Fc)return Lc;Fc=1,Lc=e;var t=jc();function e(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}e.Varint=0,e.Fixed64=1,e.Bytes=2,e.Fixed32=5;var i=4294967296,r=1/i,n="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");function s(t){return t.type===e.Bytes?t.readVarint()+t.pos:t.pos+1}function o(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function a(t,e,i){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=t;n--)i.buf[n+r]=i.buf[n]}function l(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function c(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function h(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function u(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function d(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function p(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function f(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function m(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function _(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function g(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function y(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function x(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}return e.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,s=this.pos;this.type=7&r,t(n,e,this),this.pos===s&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=g(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=x(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=g(this.buf,this.pos)+g(this.buf,this.pos+4)*i;return this.pos+=8,t},readSFixed64:function(){var t=g(this.buf,this.pos)+x(this.buf,this.pos+4)*i;return this.pos+=8,t},readFloat:function(){var e=t.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=t.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(t){var e,i,r=this.buf;return e=127&(i=r[this.pos++]),i<128?e:(e|=(127&(i=r[this.pos++]))<<7,i<128?e:(e|=(127&(i=r[this.pos++]))<<14,i<128?e:(e|=(127&(i=r[this.pos++]))<<21,i<128?e:function(t,e,i){var r,n,s=i.buf;if(r=(112&(n=s[i.pos++]))>>4,n<128)return o(t,r,e);if(r|=(127&(n=s[i.pos++]))<<3,n<128)return o(t,r,e);if(r|=(127&(n=s[i.pos++]))<<10,n<128)return o(t,r,e);if(r|=(127&(n=s[i.pos++]))<<17,n<128)return o(t,r,e);if(r|=(127&(n=s[i.pos++]))<<24,n<128)return o(t,r,e);if(r|=(1&(n=s[i.pos++]))<<31,n<128)return o(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&n?function(t,e,i){return n.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var r="",n=e;n<i;){var s,o,a,l=t[n],c=null,h=l>239?4:l>223?3:l>191?2:1;if(n+h>i)break;1===h?l<128&&(c=l):2===h?128==(192&(s=t[n+1]))&&(c=(31&l)<<6|63&s)<=127&&(c=null):3===h?(o=t[n+2],128==(192&(s=t[n+1]))&&128==(192&o)&&((c=(15&l)<<12|(63&s)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===h&&(o=t[n+2],a=t[n+3],128==(192&(s=t[n+1]))&&128==(192&o)&&128==(192&a)&&((c=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,h=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),n+=h}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,i){if(this.type!==e.Bytes)return t.push(this.readVarint(i));var r=s(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(i));return t},readPackedSVarint:function(t){if(this.type!==e.Bytes)return t.push(this.readSVarint());var i=s(this);for(t=t||[];this.pos<i;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==e.Bytes)return t.push(this.readBoolean());var i=s(this);for(t=t||[];this.pos<i;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==e.Bytes)return t.push(this.readFloat());var i=s(this);for(t=t||[];this.pos<i;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==e.Bytes)return t.push(this.readDouble());var i=s(this);for(t=t||[];this.pos<i;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==e.Bytes)return t.push(this.readFixed32());var i=s(this);for(t=t||[];this.pos<i;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==e.Bytes)return t.push(this.readSFixed32());var i=s(this);for(t=t||[];this.pos<i;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==e.Bytes)return t.push(this.readFixed64());var i=s(this);for(t=t||[];this.pos<i;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==e.Bytes)return t.push(this.readSFixed64());var i=s(this);for(t=t||[];this.pos<i;)t.push(this.readSFixed64());return t},skip:function(t){var i=7&t;if(i===e.Varint)for(;this.buf[this.pos++]>127;);else if(i===e.Bytes)this.pos=this.readVarint()+this.pos;else if(i===e.Fixed32)this.pos+=4;else{if(i!==e.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),y(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),y(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),y(this.buf,-1&t,this.pos),y(this.buf,Math.floor(t*r),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),y(this.buf,-1&t,this.pos),y(this.buf,Math.floor(t*r),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,r;if(t>=0?(i=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){var i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;
2this.pos=function(t,e,i){for(var r,n,s=0;s<e.length;s++){if((r=e.charCodeAt(s))>55295&&r<57344){if(!n){r>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):n=r;continue}if(r<56320){t[i++]=239,t[i++]=191,t[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(t[i++]=239,t[i++]=191,t[i++]=189,n=null);r<128?t[i++]=r:(r<2048?t[i++]=r>>6|192:(r<65536?t[i++]=r>>12|224:(t[i++]=r>>18|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128),t[i++]=63&r|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&a(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),t.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),t.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var r=this.pos-i;r>=128&&a(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,i,r){this.writeTag(t,e.Bytes),this.writeRawMessage(i,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,l,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,c,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,d,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,h,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,u,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,p,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,f,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,m,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,_,e)},writeBytesField:function(t,i){this.writeTag(t,e.Bytes),this.writeBytes(i)},writeFixed32Field:function(t,i){this.writeTag(t,e.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(t,i){this.writeTag(t,e.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(t,i){this.writeTag(t,e.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(t,i){this.writeTag(t,e.Fixed64),this.writeSFixed64(i)},writeVarintField:function(t,i){this.writeTag(t,e.Varint),this.writeVarint(i)},writeSVarintField:function(t,i){this.writeTag(t,e.Varint),this.writeSVarint(i)},writeStringField:function(t,i){this.writeTag(t,e.Bytes),this.writeString(i)},writeFloatField:function(t,i){this.writeTag(t,e.Fixed32),this.writeFloat(i)},writeDoubleField:function(t,i){this.writeTag(t,e.Fixed64),this.writeDouble(i)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}},Lc}var Nc=i(Vc());const Zc=3;function Uc(t,e,i){1===t&&i.readMessage(Gc,e)}function Gc(t,e,i){if(3===t){const{id:t,bitmap:r,width:n,height:s,left:o,top:a,advance:l}=i.readMessage($c,{});e.push({id:t,bitmap:new Na({width:n+2*Zc,height:s+2*Zc},r),metrics:{width:n,height:s,left:o,top:a,advance:l}})}}function $c(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}const qc=Zc;function Wc(t){let e=0,i=0;for(const o of t)e+=o.w*o.h,i=Math.max(i,o.w);t.sort(((t,e)=>e.h-t.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let n=0,s=0;for(const o of t)for(let t=r.length-1;t>=0;t--){const e=r[t];if(!(o.w>e.w||o.h>e.h)){if(o.x=e.x,o.y=e.y,s=Math.max(s,o.y+o.h),n=Math.max(n,o.x+o.w),o.w===e.w&&o.h===e.h){const e=r.pop();t<r.length&&(r[t]=e)}else o.h===e.h?(e.x+=o.w,e.w-=o.w):o.w===e.w?(e.y+=o.h,e.h-=o.h):(r.push({x:e.x+o.w,y:e.y,w:e.w-o.w,h:o.h}),e.y+=o.h,e.h-=o.h);break}}return{w:n,h:s,fill:e/(n*s)||0}}const Hc=1;class Xc{constructor(t,{pixelRatio:e,version:i,stretchX:r,stretchY:n,content:s,textFitWidth:o,textFitHeight:a}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=r,this.stretchY=n,this.content=s,this.version=i,this.textFitWidth=o,this.textFitHeight=a}get tl(){return[this.paddedRect.x+Hc,this.paddedRect.y+Hc]}get br(){return[this.paddedRect.x+this.paddedRect.w-Hc,this.paddedRect.y+this.paddedRect.h-Hc]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Hc)/this.pixelRatio,(this.paddedRect.h-2*Hc)/this.pixelRatio]}}class Kc{constructor(t,e){const i={},r={};this.haveRenderCallbacks=[];const n=[];this.addImages(t,i,n),this.addImages(e,r,n);const{w:s,h:o}=Wc(n),a=new Za({width:s||1,height:o||1});for(const l in t){const e=t[l],r=i[l].paddedRect;Za.copy(e.data,a,{x:0,y:0},{x:r.x+Hc,y:r.y+Hc},e.data)}for(const l in e){const t=e[l],i=r[l].paddedRect,n=i.x+Hc,s=i.y+Hc,o=t.data.width,c=t.data.height;Za.copy(t.data,a,{x:0,y:0},{x:n,y:s},t.data),Za.copy(t.data,a,{x:0,y:c-1},{x:n,y:s-1},{width:o,height:1}),Za.copy(t.data,a,{x:0,y:0},{x:n,y:s+c},{width:o,height:1}),Za.copy(t.data,a,{x:o-1,y:0},{x:n-1,y:s},{width:1,height:c}),Za.copy(t.data,a,{x:0,y:0},{x:n+o,y:s},{width:1,height:c})}this.image=a,this.iconPositions=i,this.patternPositions=r}addImages(t,e,i){for(const r in t){const n=t[r],s={x:0,y:0,w:n.data.width+2*Hc,h:n.data.height+2*Hc};i.push(s),e[r]=new Xc(s,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)}patchUpdatedImage(t,e,i){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[r,n]=t.tl;i.update(e.data,void 0,{x:r,y:n})}}var Yc;qn("ImagePosition",Xc),qn("ImageAtlas",Kc),t.ah=void 0,(Yc=t.ah||(t.ah={}))[Yc.none=0]="none",Yc[Yc.horizontal=1]="horizontal",Yc[Yc.vertical=2]="vertical",Yc[Yc.horizontalOnly=3]="horizontalOnly";const Jc=-17;class Qc{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,e,i){const r=new Qc;return r.scale=t||1,r.fontStack=e,r.verticalAlign=i||"bottom",r}static forImage(t,e){const i=new Qc;return i.imageName=t,i.verticalAlign=e||"bottom",i}}class th{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const i=new th;for(let r=0;r<t.sections.length;r++){const n=t.sections[r];n.image?i.addImageSection(n):i.addTextSection(n,e)}return i}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e="";for(let i=0;i<t.length;i++){const r=t.charCodeAt(i+1)||null,n=t.charCodeAt(i-1)||null;e+=r&&as(r)&&!Dc[t[i+1]]||n&&as(n)&&!Dc[t[i-1]]||!Dc[t[i]]?t[i]:Dc[t[i]]}return e}(this.text)}trim(){let t=0;for(let i=0;i<this.text.length&&ih[this.text.charCodeAt(i)];i++)t++;let e=this.text.length;for(let i=this.text.length-1;i>=0&&i>=t&&ih[this.text.charCodeAt(i)];i--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const i=new th;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}getMaxImageSize(t){let e=0,i=0;for(let r=0;r<this.length();r++){const n=this.getSection(r);if(n.imageName){const r=t[n.imageName];if(!r)continue;const s=r.displaySize;e=Math.max(e,s[0]),i=Math.max(i,s[1])}}return{maxImageWidth:e,maxImageHeight:i}}addTextSection(t,e){this.text+=t.text,this.sections.push(Qc.forText(t.scale,t.fontStack||e,t.verticalAlign));const i=this.sections.length-1;for(let r=0;r<t.text.length;++r)this.sectionIndex.push(i)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void N("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(Qc.forImage(e,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):N("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function eh(e,i,r,n,s,o,a,l,c,h,u,d,p,f,m){const _=th.fromFeature(e,s);let g;d===t.ah.vertical&&_.verticalizePunctuation();const{processBidirectionalText:y,processStyledBidirectionalText:x}=ds;if(y&&1===_.sections.length){g=[];const t=y(_.toString(),hh(_,h,o,i,n,f));for(const e of t){const t=new th;t.text=e,t.sections=_.sections;for(let i=0;i<e.length;
2i++)t.sectionIndex.push(0);g.push(t)}}else if(x){g=[];const t=x(_.text,_.sectionIndex,hh(_,h,o,i,n,f));for(const e of t){const t=new th;t.text=e[0],t.sectionIndex=e[1],t.sections=_.sections,g.push(t)}}else g=function(t,e){const i=[],r=t.text;let n=0;for(const s of e)i.push(t.substring(n,s)),n=s;return n<r.length&&i.push(t.substring(n,r.length)),i}(_,hh(_,h,o,i,n,f));const v=[],b={positionedLines:v,text:_.toString(),top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:d,iconsInText:!1,verticalizable:!1};return function(t,e,i,r,n,s,o,a,l,c,h,u){let d=0,p=0,f=0,m=0;const _="right"===a?1:"left"===a?0:.5,g=Bc/u;let y=0;for(const b of n){b.trim();const n=b.getMaxScale(),o={positionedGlyphs:[],lineOffset:0};t.positionedLines[y]=o;const a=o.positionedGlyphs;let u=0;if(!b.length()){p+=s,++y;continue}const x=dh(r,b,g);for(let s=0;s<b.length();s++){const o=b.getSection(s),f=b.getSectionIndex(s),m=b.getCharCode(s),_=fh(l,h,m);let y;if(o.imageName){if(t.iconsInText=!0,o.scale=o.scale*g,y=_h(o,_,n,x,r),!y)continue;u=Math.max(u,y.imageOffset)}else if(y=mh(o,m,_,x,e,i),!y)continue;const{rect:v,metrics:w,baselineOffset:T}=y;a.push({glyph:m,imageName:o.imageName,x:d,y:p+T+Jc,vertical:_,scale:o.scale,fontStack:o.fontStack,sectionIndex:f,metrics:w,rect:v}),_?(t.verticalizable=!0,d+=(o.imageName?w.advance:Bc)*o.scale+c):d+=w.advance*o.scale+c}0!==a.length&&(f=Math.max(d-c,f),gh(a,0,a.length-1,_)),d=0,o.lineOffset=Math.max(u,(n-1)*Bc);const v=s*n+u;p+=v,m=Math.max(v,m),++y}const{horizontalAlign:x,verticalAlign:v}=uh(o);(function(t,e,i,r,n,s,o,a,l){const c=(e-i)*n;let h=0;h=s!==o?-a*r-Jc:-r*l*o+.5*o;for(const u of t)for(const t of u.positionedGlyphs)t.x+=c,t.y+=h})(t.positionedLines,_,x,v,f,m,s,p,n.length),t.top+=-v*p,t.bottom=t.top+p,t.left+=-x*f,t.right=t.left+f}(b,i,r,n,g,a,l,c,d,h,p,m),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(v)&&b}const ih={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},rh={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},nh={40:!0};function sh(t,e,i,r,n,s){if(e.imageName){const t=r[e.imageName];return t?t.displaySize[0]*e.scale*Bc/s+n:0}{const r=i[e.fontStack],s=r&&r[t];return s?s.metrics.advance*e.scale+n:0}}function oh(t,e,i,r){const n=Math.pow(t-e,2);return r?t<e?n/2:2*n:n+Math.abs(i)*i}function ah(t,e,i){let r=0;return 10===t&&(r-=1e4),i&&(r+=150),40!==t&&65288!==t||(r+=50),41!==e&&65289!==e||(r+=50),r}function lh(t,e,i,r,n,s){let o=null,a=oh(e,i,n,s);for(const l of r){const t=oh(e-l.x,i,n,s)+l.badness;t<=a&&(o=l,a=t)}return{index:t,x:e,priorBreak:o,badness:a}}function ch(t){return t?ch(t.priorBreak).concat(t.index):[]}function hh(t,e,i,r,n,s){if(!t)return[];const o=[],a=function(t,e,i,r,n,s){let o=0;for(let a=0;a<t.length();a++){const i=t.getSection(a);o+=sh(t.getCharCode(a),i,r,n,e,s)}return o/Math.max(1,Math.ceil(o/i))}(t,e,i,r,n,s),l=t.text.indexOf("â")>=0;let c=0;for(let u=0;u<t.length();u++){const i=t.getSection(u),d=t.getCharCode(u);if(ih[d]||(c+=sh(d,i,r,n,e,s)),u<t.length()-1){const e=!((h=d)<11904)&&(!!Qn["CJK Compatibility Forms"](h)||!!Qn["CJK Compatibility"](h)||!!Qn["CJK Strokes"](h)||!!Qn["CJK Symbols and Punctuation"](h)||!!Qn["Enclosed CJK Letters and Months"](h)||!!Qn["Halfwidth and Fullwidth Forms"](h)||!!Qn["Ideographic Description Characters"](h)||!!Qn["Vertical Forms"](h)||ss.test(String.fromCodePoint(h)));(rh[d]||e||i.imageName||u!==t.length()-2&&nh[t.getCharCode(u+1)])&&o.push(lh(u+1,c,a,o,ah(d,t.getCharCode(u+1),e&&l),!1))}}var h;return ch(lh(t.length(),c,a,o,0,!0))}function uh(t){let e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function dh(t,e,i){const r=e.getMaxScale()*Bc,{maxImageWidth:n,maxImageHeight:s}=e.getMaxImageSize(t),o=Math.max(r,s*i);return{verticalLineContentWidth:Math.max(r,n*i),horizontalLineContentHeight:o}}function ph(t){switch(t){case"top":return 0;case"center":return.5;default:return 1}}function fh(e,i,r){return!(e===t.ah.horizontal||!i&&!os(r)||i&&(ih[r]||(n=r,/\p{sc=Arab}/u.test(String.fromCodePoint(n)))));var n}
2function mh(t,e,i,r,n,s){const o=s[t.fontStack],a=function(t,e,i,r){if(t&&t.rect)return t;const n=e[i.fontStack],s=n&&n[r];return s?{rect:null,metrics:s.metrics}:null}(o&&o[e],n,t,e);if(null===a)return null;let l;if(i)l=r.verticalLineContentWidth-t.scale*Bc;else{const e=ph(t.verticalAlign);l=(r.horizontalLineContentHeight-t.scale*Bc)*e}return{rect:a.rect,metrics:a.metrics,baselineOffset:l}}function _h(t,e,i,r,n){const s=n[t.imageName];if(!s)return null;const o=s.paddedRect,a=s.displaySize,l={width:a[0],height:a[1],left:Hc,top:-3,advance:e?a[1]:a[0]};let c;if(e)c=r.verticalLineContentWidth-a[1]*t.scale;else{const e=ph(t.verticalAlign);c=(r.horizontalLineContentHeight-a[1]*t.scale)*e}return{rect:o,metrics:l,baselineOffset:c,imageOffset:(e?a[0]:a[1])*t.scale-Bc*i}}function gh(t,e,i,r){if(0===r)return;const n=t[i],s=(t[i].x+n.metrics.advance*n.scale)*r;for(let o=e;o<=i;o++)t[o].x-=s}function yh(t,e,i){const{horizontalAlign:r,verticalAlign:n}=uh(i),s=e[0]-t.displaySize[0]*r,o=e[1]-t.displaySize[1]*n;return{image:t,top:o,bottom:o+t.displaySize[1],left:s,right:s+t.displaySize[0]}}function xh(t){var e,i;let r=t.left,n=t.top,s=t.right-r,o=t.bottom-n;const a=null!==(e=t.image.textFitWidth)&&void 0!==e?e:"stretchOrShrink",l=null!==(i=t.image.textFitHeight)&&void 0!==i?i:"stretchOrShrink",c=(t.image.content[2]-t.image.content[0])/(t.image.content[3]-t.image.content[1]);if("proportional"===l){if("stretchOnly"===a&&s/o<c||"proportional"===a){const t=Math.ceil(o*c);r*=t/s,s=t}}else if("proportional"===a&&"stretchOnly"===l&&0!==c&&s/o>c){const t=Math.ceil(s/c);n*=t/o,o=t}return{x1:r,y1:n,x2:r+s,y2:n+o}}function vh(t,e,i,r,n,s){const o=t.image;let a;if(o.content){const t=o.content,e=o.pixelRatio||1;a=[t[0]/e,t[1]/e,o.displaySize[0]-t[2]/e,o.displaySize[1]-t[3]/e]}const l=e.left*s,c=e.right*s;let h,u,d,p;"width"===i||"both"===i?(p=n[0]+l-r[3],u=n[0]+c+r[1]):(p=n[0]+(l+c-o.displaySize[0])/2,u=p+o.displaySize[0]);const f=e.top*s,m=e.bottom*s;return"height"===i||"both"===i?(h=n[1]+f-r[0],d=n[1]+m+r[2]):(h=n[1]+(f+m-o.displaySize[1])/2,d=h+o.displaySize[1]),{image:o,top:h,right:u,bottom:d,left:p,collisionPadding:a}}const bh=255,wh=128,Th=bh*wh;function Ph(t,e){const{expression:i}=e;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new ps(t+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:r}=i;let n=0;for(;n<e.length&&e[n]<=t;)n++;n=Math.max(0,n-1);let s=n;for(;s<e.length&&e[s]<t+1;)s++;s=Math.min(e.length-1,s);const o=e[n],a=e[s];return"composite"===i.kind?{kind:"composite",minZoom:o,maxZoom:a,interpolationType:r}:{kind:"camera",minZoom:o,maxZoom:a,minSize:i.evaluate(new ps(o)),maxSize:i.evaluate(new ps(a)),interpolationType:r}}}function Mh(t,e,i){let r="never";const n=t.get(e);return n?r=n:t.get(i)&&(r="always"),r}const Sh=Ql.VectorTileFeature.types,Ih=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ch(t,e,i,r,n,s,o,a,l,c,h,u,d){const p=a?Math.min(Th,Math.round(a[0])):0,f=a?Math.min(Th,Math.round(a[1])):0;t.emplaceBack(e,i,Math.round(32*r),Math.round(32*n),s,o,(p<<1)+(l?1:0),f,16*c,16*h,256*u,256*d)}function Ah(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function Eh(t){for(const e of t.sections)if(us(e.text))return!0;return!1}class zh{constructor(t){this.layoutVertexArray=new Po,this.indexArray=new Ao,this.programConfigurations=t,this.segments=new Do,this.dynamicLayoutVertexArray=new Mo,this.opacityVertexArray=new So,this.hasVisibleVertices=!1,this.placedSymbolArray=new ao}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ic.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Cc.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Ih,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&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())}}qn("SymbolBuffers",zh);class kh{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new Do,this.collisionVertexArray=new Co}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Ac.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}qn("CollisionBuffers",kh);class Dh{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.s
2ourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ph(this.zoom,i["text-size"]),this.iconSizeData=Ph(this.zoom,i["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),s=r.get("symbol-z-order");this.canOverlap="never"!==Mh(r,"text-overlap","text-allow-overlap")||"never"!==Mh(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==s&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===s||"auto"===s&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((e=>t.ah[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID}createArrays(){this.text=new zh(new oa(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new zh(new oa(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new ho,this.lineVertexArray=new uo,this.symbolInstances=new co,this.textAnchorOffsets=new fo}calculateGlyphDependencies(t,e,i,r,n){for(let s=0;s<t.length;s++)if(e[t.charCodeAt(s)]=!0,(i||r)&&n){const i=Dc[t.charAt(s)];
2i&&(e[i.charCodeAt(0)]=!0)}}populate(e,i,r){const n=this.layers[0],s=n.layout,o=s.get("text-font"),a=s.get("text-field"),l=s.get("icon-image"),c=("constant"!==a.value.kind||a.value.value instanceof we&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),h="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,u=s.get("symbol-sort-key");if(this.features=[],!c&&!h)return;const d=i.iconDependencies,p=i.glyphDependencies,f=i.availableImages,m=new ps(this.zoom);for(const{feature:_,id:g,index:y,sourceLayerIndex:x}of e){const e=n._featureFilter.needGeometry,i=da(_,e);if(!n._featureFilter.filter(m,i,r))continue;let a,l;if(e||(i.geometry=ua(_)),c){const t=n.getValueAndResolveTokens("text-field",i,r,f),e=we.factory(t),s=this.hasRTLText=this.hasRTLText||Eh(e);(!s||"unavailable"===ds.getRTLTextPluginStatus()||s&&ds.isParsed())&&(a=kc(e,n,i))}if(h){const t=n.getValueAndResolveTokens("icon-image",i,r,f);l=t instanceof Ie?t:Ie.fromString(t)}if(!a&&!l)continue;const v=this.sortFeaturesByKey?u.evaluate(i,{},r):void 0;if(this.features.push({id:g,text:a,icon:l,index:y,sourceLayerIndex:x,geometry:i.geometry,properties:_.properties,type:Sh[_.type],sortKey:v}),l&&(d[l.name]=!0),a){const e=o.evaluate(i,{},r).join(","),n="viewport"!==s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.ah.vertical)>=0;for(const t of a.sections)if(t.image)d[t.image.name]=!0;else{const i=ts(a.toString()),r=t.fontStack||e,s=p[r]=p[r]||{};this.calculateGlyphDependencies(t.text,s,n,this.allowVerticalPlacement,i)}}}"line"===s.get("symbol-placement")&&(this.features=function(t){const e={},i={},r=[];let n=0;function s(e){r.push(t[e]),n++}function o(t,e,n){const s=i[t];return delete i[t],i[e]=s,r[s].geometry[0].pop(),r[s].geometry[0]=r[s].geometry[0].concat(n[0]),s}function a(t,i,n){const s=e[i];return delete e[i],e[t]=s,r[s].geometry[0].shift(),r[s].geometry[0]=n[0].concat(r[s].geometry[0]),s}function l(t,e,i){const r=i?e[0][e[0].length-1]:e[0][0];return`${t}:${r.x}:${r.y}`}for(let c=0;c<t.length;c++){const h=t[c],u=h.geometry,d=h.text?h.text.toString():null;if(!d){s(c);continue}const p=l(d,u),f=l(d,u,!0);if(p in i&&f in e&&i[p]!==e[f]){const t=a(p,f,u),n=o(p,f,r[t].geometry);delete e[p],delete i[f],i[l(d,r[n].geometry,!0)]=n,r[t].geometry=null}else p in i?o(p,f,u):f in e?a(p,f,u):(s(c),e[p]=n-1,i[f]=n-1)}return r.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i))}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,e){const i=this.lineVertexArray.length;if(void 0!==t.segment){let i=t.dist(e[t.segment+1]),r=t.dist(e[t.segment]);const n={};for(let s=t.segment+1;s<e.length;s++)n[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s<e.length-1&&(i+=e[s+1].dist(e[s]));for(let s=t.segment||0;s>=0;s--)n[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:r},s>0&&(r+=e[s-1].dist(e[s]));for(let t=0;t<e.length;t++){const e=n[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,i,r,n,s,o,a,l,c,h,u,d){const p=e.indexArray,f=e.layoutVertexArray,m=e.segments.prepareSegment(4*i.length,f,p,this.canOverlap?o.sortKey:void 0),_=this.glyphOffsetArray.length,g=m.vertexLength,y=this.allowVerticalPlacement&&a===t.ah.vertical?Math.PI/2:0,x=o.text&&o.text.sections;for(let t=0;t<i.length;t++){const{tl:n,tr:s,bl:a,br:c,tex:h,pixelOffsetTL:u,pixelOffsetBR:_,minFontScaleX:g,minFontScaleY:v,glyphOffset:b,isSDF:w,sectionIndex:T}=i[t],P=m.vertexLength,M=b[1];Ch(f,l.x,l.y,n.x,M+n.y,h.x,h.y,r,w,u.x,u.y,g,v),Ch(f,l.x,l.y,s.x,M+s.y,h.x+h.w,h.y,r,w,_.x,u.y,g,v),Ch(f,l.x,l.y,a.x,M+a.y,h.x,h.y+h.h,r,w,u.x,_.y,g,v),Ch(f,l.x,l.y,c.x,M+c.y,h.x+h.w,h.y+h.h,r,w,_.x,_.y,g,v),Ah(e.dynamicLayoutVertexArray,l,y),p.emplaceBack(P,P+2,P+1),p.emplaceBack(P
2+1,P+2,P+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),t!==i.length-1&&T===i[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(f.length,o,o.index,{},d,x&&x[T])}e.placedSymbolArray.emplaceBack(l.x,l.y,_,this.glyphOffsetArray.length-_,g,c,h,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],a,0,!1,0,u)}_addCollisionDebugVertex(t,e,i,r,n,s){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,r,n,Math.round(s.x),Math.round(s.y))}addCollisionDebugVertices(t,e,i,r,n,s,o){const a=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),c=a.vertexLength,h=n.layoutVertexArray,u=n.collisionVertexArray,d=o.anchorX,p=o.anchorY;this._addCollisionDebugVertex(h,u,s,d,p,new l(t,e)),this._addCollisionDebugVertex(h,u,s,d,p,new l(i,e)),this._addCollisionDebugVertex(h,u,s,d,p,new l(i,r)),this._addCollisionDebugVertex(h,u,s,d,p,new l(t,r)),a.vertexLength+=4;const f=n.indexArray;f.emplaceBack(c,c+1),f.emplaceBack(c+1,c+2),f.emplaceBack(c+2,c+3),f.emplaceBack(c+3,c),a.primitiveLength+=4}addDebugCollisionBoxes(t,e,i,r){for(let n=t;n<e;n++){const t=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,r?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new kh(Io,Ec.members,Eo),this.iconCollisionBox=new kh(Io,Ec.members,Eo);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,i,r,n,s,o,a,l){const c={};for(let h=e;h<i;h++){const e=t.get(h);c.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.textFeatureIndex=e.featureIndex;break}for(let h=r;h<n;h++){const e=t.get(h);c.verticalTextBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.verticalTextFeatureIndex=e.featureIndex;break}for(let h=s;h<o;h++){const e=t.get(h);c.iconBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.iconFeatureIndex=e.featureIndex;break}for(let h=a;h<l;h++){const e=t.get(h);c.verticalIconBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.verticalIconFeatureIndex=e.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const i=t.placedSymbolArray.get(e),r=i.vertexStartIndex+4*i.numGlyphs;for(let n=i.vertexStartIndex;n<r;n+=4)t.indexArray.emplaceBack(n,n+2,n+1),t.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),i=Math.cos(t),r=[],n=[],s=[];for(let o=0;o<this.symbolInstances.length;++o){s.push(o);const t=this.symbolInstances.get(o);r.push(0|Math.round(e*t.anchorX+i*t.anchorY)),n.push(t.featureIndex)}return s.sort(((t,e)=>r[t]-r[e]||n[e]-n[t])),s}addToSortKeyRanges(t,e){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>
21)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,i)=>{t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Rh,Lh;qn("SymbolBucket",Dh,{omit:["layers","collisionBoxArray","features","compareText"]}),Dh.MAX_GLYPHS=65535,Dh.addDynamicAttributes=Ah;var Fh={get paint(){return Lh=Lh||new Is({"icon-opacity":new Ts(ft.paint_symbol["icon-opacity"]),"icon-color":new Ts(ft.paint_symbol["icon-color"]),"icon-halo-color":new Ts(ft.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ts(ft.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ts(ft.paint_symbol["icon-halo-blur"]),"icon-translate":new ws(ft.paint_symbol["icon-translate"]),"icon-translate-anchor":new ws(ft.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ts(ft.paint_symbol["text-opacity"]),"text-color":new Ts(ft.paint_symbol["text-color"],{runtimeType:Rt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Ts(ft.paint_symbol["text-halo-color"]),"text-halo-width":new Ts(ft.paint_symbol["text-halo-width"]),"text-halo-blur":new Ts(ft.paint_symbol["text-halo-blur"]),"text-translate":new ws(ft.paint_symbol["text-translate"]),"text-translate-anchor":new ws(ft.paint_symbol["text-translate-anchor"])})},get layout(){return Rh=Rh||new Is({"symbol-placement":new ws(ft.layout_symbol["symbol-placement"]),"symbol-spacing":new ws(ft.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ws(ft.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ts(ft.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ws(ft.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new ws(ft.layout_symbol["icon-allow-overlap"]),"icon-overlap":new ws(ft.layout_symbol["icon-overlap"]),"icon-ignore-placement":new ws(ft.layout_symbol["icon-ignore-placement"]),"icon-optional":new ws(ft.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ws(ft.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ts(ft.layout_symbol["icon-size"]),"icon-text-fit":new ws(ft.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ws(ft.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ts(ft.layout_symbol["icon-image"]),"icon-rotate":new Ts(ft.layout_symbol["icon-rotate"]),"icon-padding":new Ts(ft.layout_symbol["icon-padding"]),"icon-keep-upright":new ws(ft.layout_symbol["icon-keep-upright"]),"icon-offset":new Ts(ft.layout_symbol["icon-offset"]),"icon-anchor":new Ts(ft.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ws(ft.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ws(ft.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ws(ft.layout_symbol["text-rotation-alignment"]),"text-field":new Ts(ft.layout_symbol["text-field"]),"text-font":new Ts(ft.layout_symbol["text-font"]),"text-size":new Ts(ft.layout_symbol["text-size"]),"text-max-width":new Ts(ft.layout_symbol["text-max-width"]),"text-line-height":new ws(ft.layout_symbol["text-line-height"]),"text-letter-spacing":new Ts(ft.layout_symbol["text-letter-spacing"]),"text-justify":new Ts(ft.layout_symbol["text-justify"]),"text-radial-offset":new Ts(ft.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ws(ft.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ts(ft.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ts(ft.layout_symbol["text-anchor"]),"text-max-angle":new ws(ft.layout_symbol["text-max-angle"]),"text-writing-mode":new ws(ft.layout_symbol["text-writing-mode"]),"text-rotate":new Ts(ft.layout_symbol["text-rotate"]),"text-padding":new ws(ft.layout_symbol["text-padding"]),"text-keep-upright":new ws(ft.layout_symbol["text-keep-upright"]),"text-transform":new Ts(ft.layout_symbol["text-transform"]),"text-offset":new Ts(ft.layout_symbol["text-offset"]),"text-allow-overlap":new ws(ft.layout_symbol["text-allow-overlap"]),"text-overlap":new ws(ft.layout_symbol["text-overlap"]),"text-ignore-placement":new ws(ft.layout_symbol["text-ignore-placement"]),"text-optional":new ws(ft.layout_symbol["text-optional"])})}};class Bh{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Et,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}qn("FormatSectionOverride",Bh,{omit:["defaultValue"]});class Oh extends As{constructor(t){super(t,Fh)}recalculate(t,e){if(super.recalculate(t,e),"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")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const i of t)e.indexOf(i)<0&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}
2getValueAndResolveTokens(t,e,i,r){const n=this.layout.get(t).evaluate(e,{},i,r),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||Ur(s.value)||!n?n:function(t,e){return e.replace(/{([^{}]+)}/g,((e,i)=>t&&i in t?String(t[i]):""))}(e.properties,n)}createBucket(t){return new Dh(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Fh.paint.overridableProperties){if(!Oh.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new Bh(e),r=new Zr(i,e.property.specification);let n=null;n="constant"===e.value.kind||"source"===e.value.kind?new $r("source",r):new qr("composite",r,e.value.zoomStops),this.paint._values[t]=new vs(e.property,n,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&Oh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),r=Fh.paint.properties[e];let n=!1;const s=t=>{for(const e of t)if(r.overrides&&r.overrides.hasOverride(e))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof we)s(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{n||(e instanceof De&&ze(e.value)===jt?s(e.value.sections):e instanceof gi?s(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return n}}let jh;var Vh={get paint(){return jh=jh||new Is({"background-color":new ws(ft.paint_background["background-color"]),"background-pattern":new Ms(ft.paint_background["background-pattern"]),"background-opacity":new ws(ft.paint_background["background-opacity"])})}};class Nh extends As{constructor(t){super(t,Vh)}}let Zh;var Uh={get paint(){return Zh=Zh||new Is({"raster-opacity":new ws(ft.paint_raster["raster-opacity"]),"raster-hue-rotate":new ws(ft.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ws(ft.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ws(ft.paint_raster["raster-brightness-max"]),"raster-saturation":new ws(ft.paint_raster["raster-saturation"]),"raster-contrast":new ws(ft.paint_raster["raster-contrast"]),"raster-resampling":new ws(ft.paint_raster["raster-resampling"]),"raster-fade-duration":new ws(ft.paint_raster["raster-fade-duration"])})}};class Gh extends As{constructor(t){super(t,Uh)}}class $h extends As{constructor(t){super(t,{}),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 new Error("Custom layers cannot be serialized")}}class qh{constructor(t){this._methodToThrottle=t,this._triggered=!1,"undefined"!=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=()=>{}}}const Wh={once:!0},Hh=6371008.8;class Xh{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Xh(R(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,i=this.lat*e,r=t.lat*e,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return Hh*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof Xh)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Xh(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Xh(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Kh=2*Math.PI*Hh;function Yh(t){return Kh*Math.cos(t*Math.PI/180)}function Jh(t){return(180+t)/360}function Qh(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function tu(t,e){return t/Yh(e)}function eu(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180)
2)-90}function iu(t,e){return t*Yh(eu(e))}class ru{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){const i=Xh.convert(t);return new ru(Jh(i.lng),Qh(i.lat),tu(e,i.lat))}toLngLat(){return new Xh(360*this.x-180,eu(this.y))}toAltitude(){return iu(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Kh*(t=eu(this.y),1/Math.cos(t*Math.PI/180));var t}}function nu(t,e,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}class su{constructor(t,e,i){if(!function(t,e,i){return!(t<0||t>25||i<0||i>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}(t,e,i))throw new Error(`x=${e}, y=${i}, 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=e,this.y=i,this.key=lu(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){const r=(s=this.y,o=this.z,a=nu(256*(n=this.x),256*(s=Math.pow(2,o)-s-1),o),l=nu(256*(n+1),256*(s+1),o),a[0]+","+a[1]+","+l[0]+","+l[1]);var n,s,o,a,l;const c=function(t,e,i){let r,n="";for(let s=t;s>0;s--)r=1<<s-1,n+=(e&r?1:0)+(i&r?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"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,r)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new l((t.x*e-this.x)*S,(t.y*e-this.y)*S)}toString(){return`${this.z}/${this.x}/${this.y}`}}class ou{constructor(t,e){this.wrap=t,this.canonical=e,this.key=lu(t,e.z,e.z,e.x,e.y)}}class au{constructor(t,e,i,r,n){if(this.terrainRttPosMatrix32f=null,t<i)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new su(i,+r,+n),this.key=lu(e,t,i,r,n)}clone(){return new au(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 new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new au(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new au(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-t;return t>this.canonical.z?lu(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):lu(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new au(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new au(e,this.wrap,e,i,r),new au(e,this.wrap,e,i+1,r),new au(e,this.wrap,e,i,r+1),new au(e,this.wrap,e,i+1,r+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 au(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new au(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 ou(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new ru(t.x-this.wrap,t.y))}}function lu(t,e,i,r,n){(t*=2)<0&&(t=-1*t-1);const s=1<<i;return(s*s*t+s*n+r).toString(36)+i.toString(36)+e.toString(36)}qn("CanonicalTileID",su),qn("OverscaledTileID",au,{omit:["terrainRttPosMatrix32f"]});class cu{constructor(t,e,i,r=1,n=1,s=1,o=0){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i))return void N(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;const a=this.dim=e.height-2;switch(this.data=new Uint32Array(e.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;
2case"custom":this.redFactor=r,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 l=0;l<a;l++)this.data[this._idx(-1,l)]=this.data[this._idx(0,l)],this.data[this._idx(a,l)]=this.data[this._idx(a-1,l)],this.data[this._idx(l,-1)]=this.data[this._idx(l,0)],this.data[this._idx(l,a)]=this.data[this._idx(l,a-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(a,-1)]=this.data[this._idx(a-1,0)],this.data[this._idx(-1,a)]=this.data[this._idx(0,a-1)],this.data[this._idx(a,a)]=this.data[this._idx(a-1,a-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let l=0;l<a;l++)for(let t=0;t<a;t++){const e=this.get(l,t);e>this.max&&(this.max=e),e<this.min&&(this.min=e)}}get(t,e){const i=new Uint8Array(this.data.buffer),r=4*this._idx(t,e);return this.unpack(i[r],i[r+1],i[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}
2unpack(t,e,i){return t*this.redFactor+e*this.greenFactor+i*this.blueFactor-this.baseShift}getPixels(){return new Za({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let r=e*this.dim,n=e*this.dim+this.dim,s=i*this.dim,o=i*this.dim+this.dim;switch(e){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:s=o-1;break;case 1:o=s+1}const a=-e*this.dim,l=-i*this.dim;for(let c=s;c<o;c++)for(let e=r;e<n;e++)this.data[this._idx(e,c)]=t.data[this._idx(e+a,c+l)]}}qn("DEMData",cu);class hu{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class uu{constructor(t,e,i,r,n){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=r,this.properties=t.properties,this.id=n}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class du{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Gn(S,16,0),this.grid3D=new Gn(S,16,0),this.featureIndexArray=new _o,this.promoteId=e}insert(t,e,i,r,n,s){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);const a=s?this.grid3D:this.grid;for(let l=0;l<e.length;l++){const t=e[l],i=[1/0,1/0,-1/0,-1/0];for(let e=0;e<t.length;e++){const r=t[e];i[0]=Math.min(i[0],r.x),i[1]=Math.min(i[1],r.y),i[2]=Math.max(i[2],r.x),i[3]=Math.max(i[3],r.y)}i[0]<S&&i[1]<S&&i[2]>=0&&i[3]>=0&&a.insert(o,i[0],i[1],i[2],i[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ql.VectorTile(new Nc(this.rawTileData)).layers,this.sourceLayerCoder=new hu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,r){this.loadVTLayers();const n=t.params,s=S/t.tileSize/t.scale,o=Jr(n.filter),a=t.queryGeometry,c=t.queryPadding*s,h=fu(a),u=this.grid.query(h.minX-c,h.minY-c,h.maxX+c,h.maxY+c),d=fu(t.cameraQueryGeometry),p=this.grid3D.query(d.minX-c,d.minY-c,d.maxX+c,d.maxY+c,((e,i,r,n)=>function(t,e,i,r,n){for(const o of t)if(e<=o.x&&i<=o.y&&r>=o.x&&n>=o.y)return!0;const s=[new l(e,i),new l(e,n),new l(r,n),new l(r,i)];if(t.length>2)for(const o of s)if(Ma(t,o))return!0;for(let o=0;o<t.length-1;o++)if(Sa(t[o],t[o+1],s))return!0;return!1}(t.cameraQueryGeometry,e-c,i-c,r+c,n+c)));for(const l of p)u.push(l);u.sort(mu);const f={};let m;for(let l=0;l<u.length;l++){const c=u[l];if(c===m)continue;m=c;const h=this.featureIndexArray.get(c);let d=null;this.loadMatchingFeature(f,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,o,n.layers,n.availableImages,e,i,r,((e,i,r)=>(d||(d=ua(e)),i.queryIntersectsFeature({queryGeometry:a,feature:e,featureState:r,geometry:d,zoom:this.z,transform:t.transform,pixelsToTileUnits:s,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation}))))}return f}loadMatchingFeature(t,e,i,r,n,s,o,a,l,c,h){const u=this.bucketLayerIDs[e];if(s&&!u.some((t=>s.has(t))))return;const d=this.sourceLayerCoder.decode(i),p=this.vtLayers[d].feature(r);if(n.needGeometry){const t=da(p,!0);if(!n.filter(new ps(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new ps(this.tileID.overscaledZ),p))return;const f=this.getId(p,d);for(let m=0;m<u.length;m++){const e=u[m];if(s&&!s.has(e))continue;const i=a[e];if(!i)continue;let n={};f&&c&&(n=c.getState(i.sourceLayer||"_geojsonTileLayer",f));const d=L({},l[e]);d.paint=pu(d.paint,i.paint,p,n,o),d.layout=pu(d.layout,i.layout,p,n,o);const _=!h||h(p,i,n);if(!_)continue;const g=new uu(p,this.z,this.x,this.y,f);g.layer=d;let y=t[e];void 0===y&&(y=t[e]=[]),y.push({featureIndex:r,feature:g,intersectionZ:_})}}lookupSymbolFeatures(t,e,i,r,n,s,o,a){const l={};this.loadVTLayers();const c=Jr(n);
2for(const h of t)this.loadMatchingFeature(l,i,r,h,c,s,o,a,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const i of e)if(t===i)return!0;return!1}getId(t,e){var i;let r=t.id;return this.promoteId&&(r=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof r&&(r=Number(r)),void 0===r&&(null===(i=t.properties)||void 0===i?void 0:i.cluster)&&this.promoteId&&(r=Number(t.properties.cluster_id))),r}}function pu(t,e,i,r,n){return B(t,((t,s)=>{const o=e instanceof bs?e.get(s):null;return o&&o.evaluate?o.evaluate(i,r,n):o}))}function fu(t){let e=1/0,i=1/0,r=-1/0,n=-1/0;for(const s of t)e=Math.min(e,s.x),i=Math.min(i,s.y),r=Math.max(r,s.x),n=Math.max(n,s.y);return{minX:e,minY:i,maxX:r,maxY:n}}function mu(t,e){return e-t}function _u(t,e,i,r,n){const s=[];for(let o=0;o<t.length;o++){const a=t[o];let c;for(let t=0;t<a.length-1;t++){let o=a[t],h=a[t+1];o.x<e&&h.x<e||(o.x<e?o=new l(e,o.y+(e-o.x)/(h.x-o.x)*(h.y-o.y))._round():h.x<e&&(h=new l(e,o.y+(e-o.x)/(h.x-o.x)*(h.y-o.y))._round()),o.y<i&&h.y<i||(o.y<i?o=new l(o.x+(i-o.y)/(h.y-o.y)*(h.x-o.x),i)._round():h.y<i&&(h=new l(o.x+(i-o.y)/(h.y-o.y)*(h.x-o.x),i)._round()),o.x>=r&&h.x>=r||(o.x>=r?o=new l(r,o.y+(r-o.x)/(h.x-o.x)*(h.y-o.y))._round():h.x>=r&&(h=new l(r,o.y+(r-o.x)/(h.x-o.x)*(h.y-o.y))._round()),o.y>=n&&h.y>=n||(o.y>=n?o=new l(o.x+(n-o.y)/(h.y-o.y)*(h.x-o.x),n)._round():h.y>=n&&(h=new l(o.x+(n-o.y)/(h.y-o.y)*(h.x-o.x),n)._round()),c&&o.equals(c[c.length-1])||(c=[o],s.push(c)),c.push(h)))))}}return s}qn("FeatureIndex",du,{omit:["rawTileData","sourceLayerCoder"]});class gu extends l{constructor(t,e,i,r){super(t,e),this.angle=i,void 0!==r&&(this.segment=r)}clone(){return new gu(this.x,this.y,this.angle,this.segment)}}function yu(t,e,i,r,n){if(void 0===e.segment||0===i)return!0;let s=e,o=e.segment+1,a=0;for(;a>-i/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const l=[];let c=0;for(;a<i/2;){const e=t[o],i=t[o+1];if(!i)return!1;let s=t[o-1].angleTo(e)-e.angleTo(i);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:s}),c+=s;a-l[0].distance>r;)c-=l.shift().angleDelta;if(c>n)return!1;o++,a+=e.dist(i)}return!0}function xu(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function vu(t,e,i){return t?.6*e*i:0}function bu(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function wu(t,e,i,r,n,s){const o=vu(i,n,s),a=bu(i,r)*s;let l=0;const c=xu(t)/2;for(let h=0;h<t.length-1;h++){const i=t[h],r=t[h+1],n=i.dist(r);if(l+n>c){const s=(c-l)/n,u=ni.number(i.x,r.x,s),d=ni.number(i.y,r.y,s),p=new gu(u,d,r.angleTo(i),h);return p._round(),!o||yu(t,p,a,o,e)?p:void 0}l+=n}}function Tu(t,e,i,r,n,s,o,a,l){const c=vu(r,s,o),h=bu(r,n),u=h*o,d=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;
2return e-u<e/4&&(e=u+e/4),Pu(t,d?e/2*a%e:(h/2+2*s)*o*a%e,e,c,i,u,d,!1,l)}function Pu(t,e,i,r,n,s,o,a,l){const c=s/2,h=xu(t);let u=0,d=e-i,p=[];for(let f=0;f<t.length-1;f++){const e=t[f],o=t[f+1],a=e.dist(o),m=o.angleTo(e);for(;d+i<u+a;){d+=i;const _=(d-u)/a,g=ni.number(e.x,o.x,_),y=ni.number(e.y,o.y,_);if(g>=0&&g<l&&y>=0&&y<l&&d-c>=0&&d+c<=h){const e=new gu(g,y,m,f);e._round(),r&&!yu(t,e,s,r,n)||p.push(e)}}u+=a}return a||p.length||o||(p=Pu(t,u/2,i,r,n,s,o,!0,l)),p}qn("Anchor",gu);const Mu=Hc;function Su(t,e,i,r){const n=[],s=t.image,o=s.pixelRatio,a=s.paddedRect.w-2*Mu,c=s.paddedRect.h-2*Mu;let h={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom};const u=s.stretchX||[[0,a]],d=s.stretchY||[[0,c]],p=(t,e)=>t+e[1]-e[0],f=u.reduce(p,0),m=d.reduce(p,0),_=a-f,g=c-m;let y=0,x=f,v=0,b=m,w=0,T=_,P=0,M=g;if(s.content&&r){const e=s.content,i=e[2]-e[0],r=e[3]-e[1];(s.textFitWidth||s.textFitHeight)&&(h=xh(t)),y=Iu(u,0,e[0]),v=Iu(d,0,e[1]),x=Iu(u,e[0],e[2]),b=Iu(d,e[1],e[3]),w=e[0]-y,P=e[1]-v,T=i-x,M=r-b}const S=h.x1,I=h.y1,C=h.x2-S,A=h.y2-I,E=(t,r,n,a)=>{const c=Au(t.stretch-y,x,C,S),h=Eu(t.fixed-w,T,t.stretch,f),u=Au(r.stretch-v,b,A,I),d=Eu(r.fixed-P,M,r.stretch,m),p=Au(n.stretch-y,x,C,S),_=Eu(n.fixed-w,T,n.stretch,f),g=Au(a.stretch-v,b,A,I),E=Eu(a.fixed-P,M,a.stretch,m),z=new l(c,u),k=new l(p,u),D=new l(p,g),R=new l(c,g),L=new l(h/o,d/o),F=new l(_/o,E/o),B=e*Math.PI/180;if(B){const t=Math.sin(B),e=Math.cos(B),i=[e,-t,t,e];z._matMult(i),k._matMult(i),R._matMult(i),D._matMult(i)}const O=t.stretch+t.fixed,j=r.stretch+r.fixed;return{tl:z,tr:k,bl:R,br:D,tex:{x:s.paddedRect.x+Mu+O,y:s.paddedRect.y+Mu+j,w:n.stretch+n.fixed-O,h:a.stretch+a.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:L,pixelOffsetBR:F,minFontScaleX:T/o/C,minFontScaleY:M/o/A,isSDF:i}};if(r&&(s.stretchX||s.stretchY)){const t=Cu(u,_,f),e=Cu(d,g,m);for(let i=0;i<t.length-1;i++){const r=t[i],s=t[i+1];for(let t=0;t<e.length-1;t++)n.push(E(r,e[t],s,e[t+1]))}}else n.push(E({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:a+1},{fixed:0,stretch:c+1}));return n}function Iu(t,e,i){let r=0;for(const n of t)r+=Math.max(e,Math.min(i,n[1]))-Math.max(e,Math.min(i,n[0]));return r}function Cu(t,e,i){const r=[{fixed:-1,stretch:0}];for(const[n,s]of t){const t=r[r.length-1];r.push({fixed:n-t.stretch,stretch:t.stretch}),r.push({fixed:n-t.stretch,stretch:t.stretch+(s-n)})}return r.push({fixed:e+Mu,stretch:i}),r}function Au(t,e,i,r){return t/e*i+r}function Eu(t,e,i,r){return t-e*i/r}class zu{constructor(t,e,i,r,n,s,o,a,c,h){var u;if(this.boxStartIndex=t.length,c){let t=s.top,e=s.bottom;const i=s.collisionPadding;i&&(t-=i[1],e+=i[3]);let r=e-t;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{const c=(null===(u=s.image)||void 0===u?void 0:u.content)&&(s.image.textFitWidth||s.image.textFitHeight)?xh(s):{x1:s.left,y1:s.top,x2:s.right,y2:s.bottom};c.y1=c.y1*o-a[0],c.y2=c.y2*o+a[2],c.x1=c.x1*o-a[3],c.x2=c.x2*o+a[1];const d=s.collisionPadding;if(d&&(c.x1-=d[0]*o,c.y1-=d[1]*o,c.x2+=d[2]*o,c.y2+=d[3]*o),h){const t=new l(c.x1,c.y1),e=new l(c.x2,c.y1),i=new l(c.x1,c.y2),r=new l(c.x2,c.y2),n=h*Math.PI/180;t._rotate(n),e._rotate(n),i._rotate(n),r._rotate(n),c.x1=Math.min(t.x,e.x,i.x,r.x),c.x2=Math.max(t.x,e.x,i.x,r.x),c.y1=Math.min(t.y,e.y,i.y,r.y),c.y2=Math.max(t.y,e.y,i.y,r.y)}t.emplaceBack(e.x,e.y,c.x1,c.y1,c.x2,c.y2,i,r,n)}this.boxEndIndex=t.length}}class ku{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,r=e[t];for(;t>0;){const n=t-1>>1,s=e[n];if(i(r,s)>=0)break;e[t]=s,t=n}e[t]=r}_down(t){const{data:e,compare:i}=this,r=this.length>>1,n=e[t];for(;t<r;){let r=1+(t<<1);const s=r+1;if(s<this.length&&i(e[s],e[r])<0&&(r=s),i(e[r],n)>=0)break;e[t]=e[r],t=r}e[t]=n}}function Du(t,e=1,i=!1){let r=1/0,n=1/0,s=-1/0,o=-1/0;const a=t[0];for(let l=0;l<a.length;l++){const t=a[l];(!l||t.x<r)&&(r=t.x),(!l||t.y<n)&&(n=t.y),(!l||t.x>s)&&(s=t.x),(!l||t.y>o)&&(o=t.y)}const c=Math.min(s-r,o-n);let h=c/2;const u=new ku([],Ru);if(0===c)return new l(r,n);for(let l=r;l<s;l+=c)for(let e=n;e<o;e+=c)u.push(new Lu(l+h,e+h,h,t));let d=function(t){let e=0,i=0,r=0;const n=t[0];for(let s=0,o=n.length,a=o-1;s<o;a=s++){const t=n[s],o=n[a],l=t.x*o.y-o.x*t.y;i+=(t.x+o.x)*l,r+=(t.y+o.y)*l,e+=3*l}return new Lu(i/e,r/e,0,t)}(t),p=u.length;for(;u.length;){const r=u.pop();(r.d>d.d||!d.d)&&(d=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,p)),r.max-d.d<=e||(h=r.h/2,u.push(new Lu(r.p.x-h,r.p.y-h,h,t)),u.push(new Lu(r.p.x+h,r.p.y-h,h,t)),u.push(new Lu(r.p.x-h,r.p.y+h,h,t)),u.push(new Lu(r.p.x+h,r.p.y+h,h,t)),p+=4)}return i&&(console.log(`num probes: ${p}`),console.log(`best distance: ${d.d}`)),d.p}function Ru(t,e){return e.max-t.max}function Lu(t,e,i,r){this.p=new l(t,e),this.h=i,this.d=function(t,e){let i=!1,r=1/0;for(let n=0;n<e.length;n++){const s=e[n];for(let e=0,n=s.length,o=n-1;e<n;o=e++){const n=s[e],a=s[o];n.y>t.y!=a.y>t.y&&t.x<(a.x-n.x)*(t.y-n.y)/(a.y-n.y)+n.x&&(i=!i),r=Math.min(r,Ta(t,n,a))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}var Fu;t.ay=void 0,(Fu=t.ay||(t.ay={}))[Fu.center=1]="center",Fu[Fu.left=2]="left",Fu[Fu.right=3]="right",Fu[Fu.top=4]="top",Fu[Fu.bottom=5]="bottom",Fu[Fu["top-left"]=6]="top-left",Fu[Fu["top-right"]=7]="top-right",Fu[Fu["bottom-left"]=8]="bottom-left",Fu[Fu["bottom-right"]=9]="bottom-right";const Bu=7,Ou=Number.POSITIVE_INFINITY;
2function ju(t,e){return e[1]!==Ou?function(t,e,i){let r=0,n=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":n=i-Bu;break;case"bottom-right":case"bottom-left":case"bottom":n=-i+Bu}switch(t){case"top-right":case"bottom-right":case"right":r=-e;break;case"top-left":case"bottom-left":case"left":r=e}return[r,n]}(t,e[0],e[1]):function(t,e){let i=0,r=0;e<0&&(e=0);const n=e/Math.SQRT2;switch(t){case"top-right":case"top-left":r=n-Bu;break;case"bottom-right":case"bottom-left":r=-n+Bu;break;case"bottom":r=-e+Bu;break;case"top":r=e-Bu}switch(t){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=e;break;case"right":i=-e}return[i,r]}(t,e[0])}function Vu(t,e,i){var r;const n=t.layout,s=null===(r=n.get("text-variable-anchor-offset"))||void 0===r?void 0:r.evaluate(e,{},i);if(s){const t=s.values,e=[];for(let i=0;i<t.length;i+=2){const r=e[i]=t[i],n=t[i+1].map((t=>t*Bc));r.startsWith("top")?n[1]-=Bu:r.startsWith("bottom")&&(n[1]+=Bu),e[i+1]=n}return new Se(e)}const o=n.get("text-variable-anchor");if(o){let r;r=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(e,{},i)*Bc,Ou]:n.get("text-offset").evaluate(e,{},i).map((t=>t*Bc));const s=[];for(const t of o)s.push(t,ju(t,r));return new Se(s)}return null}function Nu(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 Zu(e,i,r,n,s,o,a,l,c,h,u,d){let p=o.textMaxSize.evaluate(i,{});void 0===p&&(p=a);const f=e.layers[0].layout,m=f.get("icon-offset").evaluate(i,{},u),_=Gu(r.horizontal),g=a/24,y=e.tilePixelRatio*g,x=e.tilePixelRatio*p/24,v=e.tilePixelRatio*l,b=e.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*e.tilePixelRatio,T=function(t,e,i,r=1){const n=t.get("icon-padding").evaluate(e,{},i),s=n&&n.values;return[s[0]*r,s[1]*r,s[2]*r,s[3]*r]}(f,i,u,e.tilePixelRatio),P=f.get("text-max-angle")/180*Math.PI,M="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),I="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),C=f.get("symbol-placement"),A=b/2,E=f.get("icon-text-fit");let z;n&&"none"!==E&&(e.allowVerticalPlacement&&r.vertical&&(z=vh(n,r.vertical,E,f.get("icon-text-fit-padding"),m,g)),_&&(n=vh(n,_,E,f.get("icon-text-fit-padding"),m,g)));const k=u?d.line.getGranularityForZoomLevel(u.z):1,D=(l,d)=>{d.x<0||d.x>=S||d.y<0||d.y>=S||function(e,i,r,n,s,o,a,l,c,h,u,d,p,f,m,_,g,y,x,v,b,w,T,P,M){const S=e.addToLineVertexArray(i,r);let I,C,A,E,z=0,k=0,D=0,R=0,L=-1,F=-1;const B={};let O=Uo("");if(e.allowVerticalPlacement&&n.vertical){const t=l.layout.get("text-rotate").evaluate(b,{},P)+90;A=new zu(c,i,h,u,d,n.vertical,p,f,m,t),a&&(E=new zu(c,i,h,u,d,a,g,y,m,t))}if(s){const r=l.layout.get("icon-rotate").evaluate(b,{}),n="none"!==l.layout.get("icon-text-fit"),o=Su(s,r,T,n),p=a?Su(a,r,T,n):void 0;C=new zu(c,i,h,u,d,s,g,y,!1,r),z=4*o.length;const f=e.iconSizeData;let m=null;"source"===f.kind?(m=[wh*l.layout.get("icon-size").evaluate(b,{})],m[0]>Th&&N(`${e.layerIds[0]}: Value for "icon-size" is >= ${bh}. Reduce your "icon-size".`)):"composite"===f.kind&&(m=[wh*w.compositeIconSizes[0].evaluate(b,{},P),wh*w.compositeIconSizes[1].evaluate(b,{},P)],(m[0]>Th||m[1]>Th)&&N(`${e.layerIds[0]}: Value for "icon-size" is >= ${bh}. Reduce your "icon-size".`)),e.addSymbols(e.icon,o,m,v,x,b,t.ah.none,i,S.lineStartIndex,S.lineLength,-1,P),L=e.icon.placedSymbolArray.length-1,p&&(k=4*p.length,e.addSymbols(e.icon,p,m,v,x,b,t.ah.vertical,i,S.lineStartIndex,S.lineLength,-1,P),F=e.icon.placedSymbolArray.length-1)}const j=Object.keys(n.horizontal);for(const N of j){const r=n.horizontal[N];if(!I){O=Uo(r.text);const t=l.layout.get("text-rotate").evaluate(b,{},P);I=new zu(c,i,h,u,d,r,p,f,m,t)}const s=1===r.positionedLines.length;if(D+=Uu(e,i,r,o,l,m,b,_,S,n.vertical?t.ah.horizontal:t.ah.horizontalOnly,s?j:[N],B,L,w,P),s)break}n.vertical&&(R+=Uu(e,i,n.vertical,o,l,m,b,_,S,t.ah.vertical,["vertical"],B,F,w,P));const V=I?I.boxStartIndex:e.collisionBoxArray.length,Z=I?I.boxEndIndex:e.collisionBoxArray.length,U=A?A.boxStartIndex:e.collisionBoxArray.length,G=A?A.boxEndIndex:e.collisionBoxArray.length,$=C?C.boxStartIndex:e.collisionBoxArray.length,q=C?C.boxEndIndex:e.collisionBoxArray.length,W=E?E.boxStartIndex:e.collisionBoxArray.length,H=E?E.boxEndIndex:e.collisionBoxArray.length;let X=-1;const K=(t,e)=>
2t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;X=K(I,X),X=K(A,X),X=K(C,X),X=K(E,X);const Y=X>-1?1:0;Y&&(X*=M/Bc),e.glyphOffsetArray.length>=Dh.MAX_GLYPHS&&N("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,b.sortKey);const J=Vu(l,b,P),[Q,tt]=function(e,i){const r=e.length,n=null==i?void 0:i.values;if((null==n?void 0:n.length)>0)for(let s=0;s<n.length;s+=2){const i=n[s+1];e.emplaceBack(t.ay[n[s]],i[0],i[1])}return[r,e.length]}(e.textAnchorOffsets,J);e.symbolInstances.emplaceBack(i.x,i.y,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical||-1,L,F,O,V,Z,U,G,$,q,W,H,h,D,R,z,k,Y,0,p,X,Q,tt)}(e,d,l,r,n,s,z,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,y,[w,w,w,w],M,c,v,T,I,m,i,o,h,u,a)};if("line"===C)for(const t of _u(i.geometry,0,0,S,S)){const i=El(t,k),s=Tu(i,b,P,r.vertical||_,n,24,x,e.overscaling,S);for(const t of s)_&&$u(e,_.text,A,t)||D(i,t)}else if("line-center"===C){for(const t of i.geometry)if(t.length>1){const e=El(t,k),i=wu(e,P,r.vertical||_,n,24,x);i&&D(e,i)}}else if("Polygon"===i.type)for(const t of Ui(i.geometry,0)){const e=Du(t,16);D(El(t[0],k,!0),new gu(e.x,e.y,0))}else if("LineString"===i.type)for(const t of i.geometry){const e=El(t,k);D(e,new gu(e[0].x,e[0].y,0))}else if("Point"===i.type)for(const t of i.geometry)for(const e of t)D([e],new gu(e.x,e.y,0))}function Uu(t,e,i,r,n,s,o,a,c,h,u,d,p,f,m){const _=function(t,e,i,r,n,s,o,a){const c=r.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,h=[];for(const u of e.positionedLines)for(const t of u.positionedGlyphs){if(!t.rect)continue;const r=t.rect||{};let s=qc+1,d=!0,p=1,f=0;const m=(n||a)&&t.vertical,_=t.metrics.advance*t.scale/2;if(a&&e.verticalizable&&(f=u.lineOffset/2-(t.imageName?-(Bc-t.metrics.width*t.scale)/2:(t.scale-1)*Bc)),t.imageName){const e=o[t.imageName];d=e.sdf,p=e.pixelRatio,s=Hc/p}const g=n?[t.x+_,t.y]:[0,0];let y=n?[0,0]:[t.x+_+i[0],t.y+i[1]-f],x=[0,0];m&&(x=y,y=[0,0]);const v=t.metrics.isDoubleResolution?2:1,b=(t.metrics.left-s)*t.scale-_+y[0],w=(-t.metrics.top-s)*t.scale+y[1],T=b+r.w/v*t.scale/p,P=w+r.h/v*t.scale/p,M=new l(b,w),S=new l(T,w),I=new l(b,P),C=new l(T,P);if(m){const e=new l(-_,_-Jc),i=-Math.PI/2,r=Bc/2-_,n=new l(5-Jc-r,-(t.imageName?r:0)),s=new l(...x);M._rotateAround(i,e)._add(n)._add(s),S._rotateAround(i,e)._add(n)._add(s),I._rotateAround(i,e)._add(n)._add(s),C._rotateAround(i,e)._add(n)._add(s)}if(c){const t=Math.sin(c),e=Math.cos(c),i=[e,-t,t,e];M._matMult(i),S._matMult(i),I._matMult(i),C._matMult(i)}const A=new l(0,0),E=new l(0,0);h.push({tl:M,tr:S,bl:I,br:C,tex:r,writingMode:e.writingMode,glyphOffset:g,sectionIndex:t.sectionIndex,isSDF:d,pixelOffsetTL:A,pixelOffsetBR:E,minFontScaleX:0,minFontScaleY:0})}return h}(0,i,a,n,s,o,r,t.allowVerticalPlacement),g=t.textSizeData;let y=null;"source"===g.kind?(y=[wh*n.layout.get("text-size").evaluate(o,{})],y[0]>Th&&N(`${t.layerIds[0]}: Value for "text-size" is >= ${bh}. Reduce your "text-size".`)):"composite"===g.kind&&(y=[wh*f.compositeTextSizes[0].evaluate(o,{},m),wh*f.compositeTextSizes[1].evaluate(o,{},m)],(y[0]>Th||y[1]>Th)&&N(`${t.layerIds[0]}: Value for "text-size" is >= ${bh}. Reduce your "text-size".`)),t.addSymbols(t.text,_,y,a,s,o,h,e,c.lineStartIndex,c.lineLength,p,m);for(const l of u)d[l]=t.text.placedSymbolArray.length-1;return 4*_.length}function Gu(t){for(const e in t)return t[e];return null}function $u(t,e,i,r){const n=t.compareText;if(e in n){const t=n[e];for(let e=t.length-1;e>=0;e--)if(r.dist(t[e])<i)return!0}else n[e]=[];return n[e].push(r),!1}const qu=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Wu{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,i]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=qu[15&i];if(!n)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new Wu(o,s,n,t)}constructor(t,e=64,i=Float64Array,r){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const n=qu.indexOf(this.ArrayType),s=2*t*this.ArrayType.BYTES_PER_ELEMENT,o=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-
2o%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+s+o+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,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]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=e,i}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Hu(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:s,nodeSize:o}=this,a=[0,n.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,h=a.pop()||0,u=a.pop()||0;if(h-u<=o){for(let o=u;o<=h;o++){const a=s[2*o],c=s[2*o+1];a>=t&&a<=i&&c>=e&&c<=r&&l.push(n[o])}continue}const d=u+h>>1,p=s[2*d],f=s[2*d+1];p>=t&&p<=i&&f>=e&&f<=r&&l.push(n[d]),(0===c?t<=p:e<=f)&&(a.push(u),a.push(d-1),a.push(1-c)),(0===c?i>=p:r>=f)&&(a.push(d+1),a.push(h),a.push(1-c))}return l}within(t,e,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:s}=this,o=[0,r.length-1,0],a=[],l=i*i;for(;o.length;){const c=o.pop()||0,h=o.pop()||0,u=o.pop()||0;if(h-u<=s){for(let i=u;i<=h;i++)Ju(n[2*i],n[2*i+1],t,e)<=l&&a.push(r[i]);continue}const d=u+h>>1,p=n[2*d],f=n[2*d+1];Ju(p,f,t,e)<=l&&a.push(r[d]),(0===c?t-i<=p:e-i<=f)&&(o.push(u),o.push(d-1),o.push(1-c)),(0===c?t+i>=p:e+i>=f)&&(o.push(d+1),o.push(h),o.push(1-c))}return a}}function Hu(t,e,i,r,n,s){if(n-r<=i)return;const o=r+n>>1;Xu(t,e,o,r,n,s),Hu(t,e,i,r,o-1,1-s),Hu(t,e,i,o+1,n,1-s)}function Xu(t,e,i,r,n,s){for(;n>r;){if(n-r>600){const o=n-r+1,a=i-r+1,l=Math.log(o),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(o-c)/o)*(a-o/2<0?-1:1);Xu(t,e,i,Math.max(r,Math.floor(i-a*c/o+h)),Math.min(n,Math.floor(i+(o-a)*c/o+h)),s)}const o=e[2*i+s];let a=r,l=n;for(Ku(t,e,r,i),e[2*n+s]>o&&Ku(t,e,r,n);a<l;){for(Ku(t,e,a,l),a++,l--;e[2*a+s]<o;)a++;for(;e[2*l+s]>o;)l--}e[2*r+s]===o?Ku(t,e,r,l):(l++,Ku(t,e,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function Ku(t,e,i,r){Yu(t,i,r),Yu(e,2*i,2*r),Yu(e,2*i+1,2*r+1)}function Yu(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}function Ju(t,e,i,r){const n=t-i,s=e-r;return n*n+s*s}var Qu;t.ck=void 0,(Qu=t.ck||(t.ck={})).create="create",Qu.load="load",Qu.fullLoad="fullLoad";let td=null,ed=[];const id=1e3/60,rd="loadTime",nd="fullLoadTime",sd={mark(t){performance.mark(t)},frame(t){const e=t;null!=td&&ed.push(e-td),td=e},clearMetrics(){td=null,ed=[],performance.clearMeasures(rd),performance.clearMeasures(nd);for(const e in t.ck)performance.clearMarks(t.ck[e])},getPerformanceMetrics(){performance.measure(rd,t.ck.create,t.ck.load),performance.measure(nd,t.ck.create,t.ck.fullLoad);const e=performance.getEntriesByName(rd)[0].duration,i=performance.getEntriesByName(nd)[0].duration,r=ed.length,n=1/(ed.reduce(((t,e)=>t+e),0)/r/1e3),s=ed.filter((t=>t>id)).reduce(((t,e)=>t+(e-id)/id),0);return{loadTime:e,fullLoadTime:i,fps:n,percentDroppedFrames:s/(r+s)*100,totalFrames:r}}};t.$=ru,t.A=g,t.B=ni,t.C=ps,t.D=ws,t.E=pt,t.F=Vn,t.G=function(t){if(null==G){const e=t.navigator?t.navigator.userAgent:null;G=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return G},t.H=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new qh((()=>this.process())),this.subscription=K(this.target,"message",(t=>this.receive(t)),!1),this.globalScope=U(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}sendAsync(t,e){return new Promise(((i,r)=>{const n=Math.round(1e18*Math.random()).toString(36).substring(0,10),s=e?K(e.signal,"abort",(()=>{null==s||s.unsubscribe(),delete this.resolveRejects[n];const e={id:n,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(e)}),Wh):null;this.resolveRejects[n]={resolve:t=>{null==s||s.unsubscribe(),i(t)},reject:t=>{null==s||s.unsubscribe(),r(t)}};const o=[],a=Object.assign(Object.assign({},t),{id:n,sourceMapId:this.mapId,origin:location.origin,data:Kn(t.data,o)});
2this.target.postMessage(a,{transfer:o})}))}receive(t){const e=t.data,i=e.id;if(!("file://"!==e.origin&&"file://"!==location.origin&&"resource://android"!==e.origin&&"resource://android"!==location.origin&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if("<cancel>"===e.type){delete this.tasks[i];const t=this.abortControllers[i];return delete this.abortControllers[i],void(t&&t.abort())}if(U(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(0===this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,i){return e(this,void 0,void 0,(function*(){if("<response>"===i.type){const e=this.resolveRejects[t];if(delete this.resolveRejects[t],!e)return;return void(i.error?e.reject(Yn(i.error)):e.resolve(Yn(i.data)))}if(!this.messageHandlers[i.type])return void this.completeTask(t,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const e=Yn(i.data),r=new AbortController;this.abortControllers[t]=r;try{const n=yield this.messageHandlers[i.type](i.sourceMapId,e,r);this.completeTask(t,null,n)}catch(e){this.completeTask(t,e)}}))}completeTask(t,e,i){const r=[];delete this.abortControllers[t];const n={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Kn(e):null,data:Kn(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},t.I=Xc,t.J=nt,t.K=function(){var t=new g(16);return g!=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.L=function(t,e,i){var r,n,s,o,a,l,c,h,u,d,p,f,m=i[0],_=i[1],g=i[2];return e===t?(t[12]=e[0]*m+e[4]*_+e[8]*g+e[12],t[13]=e[1]*m+e[5]*_+e[9]*g+e[13],t[14]=e[2]*m+e[6]*_+e[10]*g+e[14],t[15]=e[3]*m+e[7]*_+e[11]*g+e[15]):(n=e[1],s=e[2],o=e[3],a=e[4],l=e[5],c=e[6],h=e[7],u=e[8],d=e[9],p=e[10],f=e[11],t[0]=r=e[0],t[1]=n,t[2]=s,t[3]=o,t[4]=a,t[5]=l,t[6]=c,t[7]=h,t[8]=u,t[9]=d,t[10]=p,t[11]=f,t[12]=r*m+a*_+u*g+e[12],t[13]=n*m+l*_+d*g+e[13],t[14]=s*m+c*_+p*g+e[14],t[15]=o*m+h*_+f*g+e[15]),t},t.M=function(t,e,i){var r=i[0],n=i[1],s=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.N=function(t,e,i){var r=e[0],n=e[1],s=e[2],o=e[3],a=e[4],l=e[5],c=e[6],h=e[7],u=e[8],d=e[9],p=e[10],f=e[11],m=e[12],_=e[13],g=e[14],y=e[15],x=i[0],v=i[1],b=i[2],w=i[3];return t[0]=x*r+v*a+b*u+w*m,t[1]=x*n+v*l+b*d+w*_,t[2]=x*s+v*c+b*p+w*g,t[3]=x*o+v*h+b*f+w*y,t[4]=(x=i[4])*r+(v=i[5])*a+(b=i[6])*u+(w=i[7])*m,t[5]=x*n+v*l+b*d+w*_,t[6]=x*s+v*c+b*p+w*g,t[7]=x*o+v*h+b*f+w*y,t[8]=(x=i[8])*r+(v=i[9])*a+(b=i[10])*u+(w=i[11])*m,t[9]=x*n+v*l+b*d+w*_,t[10]=x*s+v*c+b*p+w*g,t[11]=x*o+v*h+b*f+w*y,t[12]=(x=i[12])*r+(v=i[13])*a+(b=i[14])*u+(w=i[15])*m,t[13]=x*n+v*l+b*d+w*_,t[14]=x*s+v*c+b*p+w*g,t[15]=x*o+v*h+b*f+w*y,t},t.O=function(t,e){const i={};for(let r=0;r<e.length;r++){const n=e[r];n in t&&(i[n]=t[n])}return i},t.P=l,t.Q=Xh,t.R=Za,t.S=Qh,t.T=_s,t.U=Jh,t.V=p,t.W=f,t.X=W,t.Y=au,t.Z=S,t._=e,t.a=it,t.a$=function(t,e,i){var r=Math.sin(i),n=Math.cos(i),s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*n+c*r,t[5]=o*n+h*r,t[6]=a*n+u*r,t[7]=l*n+d*r,t[8]=c*n-s*r,t[9]=h*n-o*r,t[10]=u*n-a*r,t[11]=d*n-l*r,t},t.a0=25,t.a1=su,t.a2=t=>{const e=window.document.createElement("video");return e.muted=!0,new Promise((i=>{e.onloadstart=()=>{i(e)};for(const r of t){const t=window.document.createElement("source");lt(r)||(e.crossOrigin="Anonymous"),t.src=r,e.appendChild(t)}}))},t.a3=St,t.a4=function(){return F++},t.a5=so,t.a6=Dh,t.a7=Jr,t.a8=da,t.a9=uu,t.aA=Nu,t.aB=uh,t.aC=Wu,t.aD=Ds,t.aE=Ml,t.aF=go,t.aG=Do,t.aH=Ao,t.aI=function(t){return Math.pow(2,t)},t.aJ=85.051129,t.aK=tu,t.aL=R,t.aM=Y,t.aN=iu,t.aO=function(t,e,
2i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t},t.aP=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t},t.aQ=function(t){var e=new g(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.aR=function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t},t.aS=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t},t.aT=function(t,e){var i=e[0],r=e[1],n=e[2],s=i*i+r*r+n*n;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t},t.aU=function(t,e,i){var r=e[0],n=e[1],s=e[2],o=i[0],a=i[1],l=i[2];return t[0]=n*l-s*a,t[1]=s*o-r*l,t[2]=r*a-n*o,t},t.aV=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.aW=ou,t.aX=lu,t.aY=function(t,e,i,r,n){var s,o=1/Math.tan(e/2);return t[0]=o/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,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?(t[10]=(n+r)*(s=1/(r-n)),t[14]=2*n*r*s):(t[10]=-1,t[14]=-2*r),t},t.aZ=function(t){var e=new g(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.a_=function(t,e,i){var r=Math.sin(i),n=Math.cos(i),s=e[0],o=e[1],a=e[2],l=e[3],c=e[4],h=e[5],u=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*n+c*r,t[1]=o*n+h*r,t[2]=a*n+u*r,t[3]=l*n+d*r,t[4]=c*n-s*r,t[5]=h*n-o*r,t[6]=u*n-a*r,t[7]=d*n-l*r,t},t.aa=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,i,r,n)=>{const s=r||n;return e[i]=!s||s.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e},t.ab=function(t){return Math.log(t)/Math.LN2},t.ac=function(t){var e=t[0],i=t[1];return e*e+i*i},t.ad=function(t){return t*Math.PI/180},t.ae=D,t.af=function(t,e){const i=[];for(const r in t)r in e||i.push(r);return i},t.ag=function(t,e){let i=0,r=0;if("constant"===t.kind)r=t.layoutSize;else if("source"!==t.kind){const{interpolationType:n,minZoom:s,maxZoom:o}=t,a=n?D(ii.interpolationFactor(n,e,s,o),0,1):0;"camera"===t.kind?r=ni.number(t.minSize,t.maxSize,a):i=a}return{uSizeT:i,uSize:r}},t.ai=function(t,{uSize:e,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===t.kind?r/wh:"composite"===t.kind?ni.number(r/wh,n/wh,i):e},t.aj=function(t,e){var i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],u=e[9],d=e[10],p=e[11],f=e[12],m=e[13],_=e[14],g=e[15],y=i*a-r*o,x=i*l-n*o,v=i*c-s*o,b=r*l-n*a,w=r*c-s*a,T=n*c-s*l,P=h*m-u*f,M=h*_-d*f,S=h*g-p*f,I=u*_-d*m,C=u*g-p*m,A=d*g-p*_,E=y*A-x*C+v*I+b*S-w*M+T*P;return E?(t[0]=(a*A-l*C+c*I)*(E=1/E),t[1]=(n*C-r*A-s*I)*E,t[2]=(m*T-_*w+g*b)*E,t[3]=(d*w-u*T-p*b)*E,t[4]=(l*S-o*A-c*M)*E,t[5]=(i*A-n*S+s*M)*E,t[6]=(_*v-f*T-g*x)*E,t[7]=(h*T-d*v+p*x)*E,t[8]=(o*C-a*S+c*P)*E,t[9]=(r*S-i*C-s*P)*E,t[10]=(f*w-m*v+g*y)*E,t[11]=(u*v-h*w-p*y)*E,t[12]=(a*M-o*I-l*P)*E,t[13]=(i*I-r*M+n*P)*E,t[14]=(m*x-f*b-_*y)*E,t[15]=(h*b-u*x+d*y)*E,t):null},t.ak=P,t.al=function(t){return Math.hypot(t[0],t[1])},t.am=function(t){return t[0]=0,t[1]=0,t},t.an=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},t.ao=Ah,t.ap=w,t.aq=function(t,e,i,r){const n=e.y-t.y,s=e.x-t.x,o=r.y-i.y,a=r.x-i.x,c=o*s-a*n;if(0===c)return null;const h=(a*(t.y-i.y)-o*(t.x-i.x))/c;return new l(t.x+h*s,t.y+h*n)},t.ar=_u,t.as=_a,t.at=x,t.au=function(t){let e=1/0,i=1/0,r=-1/0,n=-1/0;for(const s of t)e=Math.min(e,s.x),i=Math.min(i,s.y),r=Math.max(r,s.x),n=Math.max(n,s.y);return[e,i,r,n]},t.av=Bc,t.aw=I,t.ax=function(t,e,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];const s=n?"map"===r?-t.bearingInRadians:0:"viewport"===r?t.bearingInRadians:0;if(s){const t=Math.sin(s),e=Math.cos(s);i=[i[0]*e-i[1]*t,i[0]*t+i[1]*e]}return[n?i[0]:I(e,i[0],t.zoom),n?i[1]:I(e,i[1],t.zoom)]},t.az=Mh,t.b=$,t.b$=t=>"symbol"===t.type,t.b0=function(){const t=new Float32Array(16);return x(t),t},t.b1=function(){const t=new Float64Array(16);return x(t),t},t.b2=function(){return new Float64Array(16)}
2,t.b3=function(t,e,i){const r=new Float64Array(4);return function(t,e,i,r){var n=.5*Math.PI/180;e*=n,i*=n,r*=n;var s=Math.sin(e),o=Math.cos(e),a=Math.sin(i),l=Math.cos(i),c=Math.sin(r),h=Math.cos(r);t[0]=s*l*h-o*a*c,t[1]=o*a*h+s*l*c,t[2]=o*l*c-s*a*h,t[3]=o*l*h+s*a*c}(r,t,e-90,i),r},t.b4=function(t,e,i,r){var n,s,o,a,l,c=e[0],h=e[1],u=e[2],d=e[3],p=i[0],f=i[1],m=i[2],g=i[3];return(s=c*p+h*f+u*m+d*g)<0&&(s=-s,p=-p,f=-f,m=-m,g=-g),1-s>_?(n=Math.acos(s),o=Math.sin(n),a=Math.sin((1-r)*n)/o,l=Math.sin(r*n)/o):(a=1-r,l=r),t[0]=a*c+l*p,t[1]=a*h+l*f,t[2]=a*u+l*m,t[3]=a*d+l*g,t},t.b5=function(t){const e=new Float64Array(9);var i,r,n,s,o,a,l,c,h,u,d,p,f,m,_,g,y,x;u=(n=(r=t)[0])*(l=n+n),d=(s=r[1])*l,f=(o=r[2])*l,m=o*(c=s+s),g=(a=r[3])*l,y=a*c,x=a*(h=o+o),(i=e)[0]=1-(p=s*c)-(_=o*h),i[3]=d-x,i[6]=f+y,i[1]=d+x,i[4]=1-u-_,i[7]=m-g,i[2]=f-y,i[5]=m+g,i[8]=1-u-p;const v=Y(-Math.asin(D(e[2],-1,1)));let b,w;return Math.hypot(e[5],e[8])<.001?(b=0,w=-Y(Math.atan2(e[3],e[4]))):(b=Y(0===e[5]&&0===e[8]?0:Math.atan2(e[5],e[8])),w=Y(0===e[1]&&0===e[0]?0:Math.atan2(e[1],e[0]))),{roll:b,pitch:v+90,bearing:w}},t.b6=function(t,e){return t.roll==e.roll&&t.pitch==e.pitch&&t.bearing==e.bearing},t.b7=ye,t.b8=Xo,t.b9=Sl,t.bA=function(t,e){if(!t)return[{command:"setStyle",args:[e]}];let i=[];try{if(!gt(t.version,e.version))return[{command:"setStyle",args:[e]}];gt(t.center,e.center)||i.push({command:"setCenter",args:[e.center]}),gt(t.centerAltitude,e.centerAltitude)||i.push({command:"setCenterAltitude",args:[e.centerAltitude]}),gt(t.zoom,e.zoom)||i.push({command:"setZoom",args:[e.zoom]}),gt(t.bearing,e.bearing)||i.push({command:"setBearing",args:[e.bearing]}),gt(t.pitch,e.pitch)||i.push({command:"setPitch",args:[e.pitch]}),gt(t.roll,e.roll)||i.push({command:"setRoll",args:[e.roll]}),gt(t.sprite,e.sprite)||i.push({command:"setSprite",args:[e.sprite]}),gt(t.glyphs,e.glyphs)||i.push({command:"setGlyphs",args:[e.glyphs]}),gt(t.transition,e.transition)||i.push({command:"setTransition",args:[e.transition]}),gt(t.light,e.light)||i.push({command:"setLight",args:[e.light]}),gt(t.terrain,e.terrain)||i.push({command:"setTerrain",args:[e.terrain]}),gt(t.sky,e.sky)||i.push({command:"setSky",args:[e.sky]}),gt(t.projection,e.projection)||i.push({command:"setProjection",args:[e.projection]});const r={},n=[];!function(t,e,i,r){let n;for(n in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)||vt(n,i,r));for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)?gt(t[n],e[n])||("geojson"===t[n].type&&"geojson"===e[n].type&&wt(t,e,n)?yt(i,{command:"setGeoJSONSourceData",args:[n,e[n].data]}):bt(n,e,i,r)):xt(n,e,i))}(t.sources,e.sources,n,r);const s=[];t.layers&&t.layers.forEach((t=>{"source"in t&&r[t.source]?i.push({command:"removeLayer",args:[t.id]}):s.push(t)})),i=i.concat(n),function(t,e,i){e=e||[];const r=(t=t||[]).map(Pt),n=e.map(Pt),s=t.reduce(Mt,{}),o=e.reduce(Mt,{}),a=r.slice(),l=Object.create(null);let c,h,u,d,p;for(let f=0,m=0;f<r.length;f++)c=r[f],Object.prototype.hasOwnProperty.call(o,c)?m++:(yt(i,{command:"removeLayer",args:[c]}),a.splice(a.indexOf(c,m),1));for(let f=0,m=0;f<n.length;f++)c=n[n.length-1-f],a[a.length-1-f]!==c&&(Object.prototype.hasOwnProperty.call(s,c)?(yt(i,{command:"removeLayer",args:[c]}),a.splice(a.lastIndexOf(c,a.length-m),1)):m++,d=a[a.length-f],yt(i,{command:"addLayer",args:[o[c],d]}),a.splice(a.length-f,0,c),l[c]=!0);for(let f=0;f<n.length;f++)if(c=n[f],h=s[c],u=o[c],!l[c]&&!gt(h,u))if(gt(h.source,u.source)&>(h["source-layer"],u["source-layer"])&>(h.type,u.type)){for(p in Tt(h.layout,u.layout,i,c,null,"setLayoutProperty"),Tt(h.paint,u.paint,i,c,null,"setPaintProperty"),gt(h.filter,u.filter)||yt(i,{command:"setFilter",args:[c,u.filter]}),gt(h.minzoom,u.minzoom)&>(h.maxzoom,u.maxzoom)||yt(i,{command:"setLayerZoomRange",args:[c,u.minzoom,u.maxzoom]}),h)Object.prototype.hasOwnProperty.call(h,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?Tt(h[p],u[p],i,c,p.slice(6),"setPaintProperty"):gt(h[p],u[p])||yt(i,{command:"setLayerProperty",args:[c,p,u[p]]}));for(p in u)Object.prototype.hasOwnProperty.call(u,p)&&!Object.prototype.hasOwnProperty.call(h,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?Tt(h[p],u[p],i,c,p.slice(6),"setPaintProperty"):gt(h[p],u[p])||yt(i,{command:"setLayerProperty",args:[c,p,u[p]]}))}else yt(i,{command:"removeLayer",args:[c]}),d=a[a.lastIndexOf(c)+1],yt(i,{command:"addLayer",args:[u,d]})}(s,e.layers,i)}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:"setStyle",args:[e]}]}return i},t.bB=function(t){const e=[],i=t.id;return void 0===i&&e.push({message:`layers.${i}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},t.bC=function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(!t(e[r],i[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(e).length!==Object.keys(i).length)return!1;for(const r in e)if(!t(e[r],i[r]))return!1;return!0}return e===i},t.bD=B,t.bE=O,t.bF=class extends Ho{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.bG=Yo,t.bH=class extends Ho{constructor(t,e){super(t,e),this.current=Jo}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 e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.bI=Ko,t.bJ=class extends Ho{constructor(t,e){super(t,e),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.bK=class extends Ho{constructor(t,e){super(t,e),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.bL=y,t.bM=function(t,e){var i=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}
2,t.bN=function(t,e,i){var r=e[0],n=e[1],s=e[2];return t[0]=r*i[0]+n*i[3]+s*i[6],t[1]=r*i[1]+n*i[4]+s*i[7],t[2]=r*i[2]+n*i[5]+s*i[8],t},t.bO=function(t,e,i,r,n,s,o){var a=1/(e-i),l=1/(r-n),c=1/(s-o);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+i)*a,t[13]=(n+r)*l,t[14]=(o+s)*c,t[15]=1,t},t.bP=class extends Ws{},t.bQ=zc,t.bR=class extends Xs{},t.bS=Ga,t.bT=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.bU=Ua,t.bV=function(t,e,i){var r=e[0],n=e[1],s=e[2],o=i[3]*r+i[7]*n+i[11]*s+i[15];return t[0]=(i[0]*r+i[4]*n+i[8]*s+i[12])/(o=o||1),t[1]=(i[1]*r+i[5]*n+i[9]*s+i[13])/o,t[2]=(i[2]*r+i[6]*n+i[10]*s+i[14])/o,t},t.bW=class extends Bs{},t.bX=class extends io{},t.bY=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},t.bZ=function(t,e){var i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],h=t[8],u=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],y=t[15],x=e[0],v=e[1],b=e[2],w=e[3],T=e[4],P=e[5],M=e[6],S=e[7],I=e[8],C=e[9],A=e[10],E=e[11],z=e[12],k=e[13],D=e[14],R=e[15];return Math.abs(i-x)<=_*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(r-v)<=_*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-b)<=_*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(s-w)<=_*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(o-T)<=_*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(a-P)<=_*Math.max(1,Math.abs(a),Math.abs(P))&&Math.abs(l-M)<=_*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(c-S)<=_*Math.max(1,Math.abs(c),Math.abs(S))&&Math.abs(h-I)<=_*Math.max(1,Math.abs(h),Math.abs(I))&&Math.abs(u-C)<=_*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(d-A)<=_*Math.max(1,Math.abs(d),Math.abs(A))&&Math.abs(p-E)<=_*Math.max(1,Math.abs(p),Math.abs(E))&&Math.abs(f-z)<=_*Math.max(1,Math.abs(f),Math.abs(z))&&Math.abs(m-k)<=_*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(g-D)<=_*Math.max(1,Math.abs(g),Math.abs(D))&&Math.abs(y-R)<=_*Math.max(1,Math.abs(y),Math.abs(R))},t.b_=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.ba=Il,t.bb=Pl,t.bc=A,t.bd=E,t.be=Ce,t.bf=function(t,e,i,r,n){return A(r,n,D((t-e)/(i-e),0,1))},t.bg=C,t.bh=function(){return new Float64Array(4)},t.bi=function(){return new Float64Array(3)},t.bj=function(t,e,i,r){var n=[],s=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],s[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),s[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),s[2]=n[2],t[0]=s[0]+i[0],t[1]=s[1]+i[1],t[2]=s[2]+i[2],t},t.bk=function(t,e,i,r){var n=[],s=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],s[0]=n[0],s[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),s[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),t[0]=s[0]+i[0],t[1]=s[1]+i[1],t[2]=s[2]+i[2],t},t.bl=function(t,e,i,r){var n=[],s=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],s[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),s[1]=n[1],s[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),t[0]=s[0]+i[0],t[1]=s[1]+i[1],t[2]=s[2]+i[2],t},t.bm=function(t,e,i){var r=Math.sin(i),n=Math.cos(i),s=e[0],o=e[1],a=e[2],l=e[3],c=e[8],h=e[9],u=e[10],d=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*n-c*r,t[1]=o*n-h*r,t[2]=a*n-u*r,t[3]=l*n-d*r,t[8]=s*r+c*n,t[9]=o*r+h*n,t[10]=a*r+u*n,t[11]=l*r+d*n,t},t.bn=function(t,e){const i=C(t,360),r=C(e,360),n=r-i,s=r>i?n-360:n+360;return Math.abs(n)<Math.abs(s)?n:s},t.bo=function(t){return t[0]=0,t[1]=0,t[2]=0,t},t.bp=function(t,e,i,r){const n=Math.sqrt(t*t+e*e),s=Math.sqrt(i*i+r*r);t/=n,e/=n,i/=s,r/=s;const o=Math.acos(t*i+e*r);return-e*i+t*r>0?o:-o},t.bq=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]},t.br=Hh,t.bs=function(t,e){const i=C(t,2*Math.PI),r=C(e,2*Math.PI);return Math.min(Math.abs(i-r),Math.abs(i-r+2*Math.PI),Math.abs(i-r-2*Math.PI))},t.bt=function(t){return Math.hypot(t[0],t[1],t[2])},t.bu=function(){const t={},e=ft.$version;for(const i in ft.$root){const r=ft.$root[i];if(r.required){let n=null;n="version"===i?e:"array"===r.type?[]:{},null!=n&&(t[i]=n)}}return t},t.bv=Jn,t.bw=ot,t.bx=function(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=_t(t[i],e[t[i].ref]));return t},t.by=function(t){if("custom"===t.type)return new $h(t);switch(t.type){case"background":return new Nh(t);case"circle":return new Da(t);case"fill":return new Ol(t);case"fill-extrusion":return new cc(t);case"heatmap":return new $a(t);case"hillshade":return new Ha(t);case"line":return new Mc(t);case"raster":return new Gh(t);case"symbol":return new Oh(t)}},t.bz=j,t.c=et,t.c0=t=>"circle"===t.type,t.c1=t=>"heatmap"===t.type,t.c2=t=>"line"===t.type,t.c3=t=>"fill"===t.type,t.c4=t=>"fill-extrusion"===t.type,t.c5=t=>"hillshade"===t.type,t.c6=t=>"raster"===t.type,t.c7=t=>"background"===t.type,t.c8=t=>"custom"===t.type,t.c9=z,t.cA=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.cB=function(t,i,r,n,s){return e(this,void 0,void 0,(function*(){if(f())try{return yield W(t,i,r,n,s)}catch(t){}
2return function(t,e,i,r,n){const s=t.width,o=t.height;H&&X||(H=new OffscreenCanvas(s,o),X=H.getContext("2d",{willReadFrequently:!0})),H.width=s,H.height=o,X.drawImage(t,0,0,s,o);const a=X.getImageData(e,i,r,n);return X.clearRect(0,0,s,o),a.data}(t,i,r,n,s)}))},t.cC=cu,t.cD=i,t.cE=s,t.cF=Jl,t.cG=Vc,t.cH=Gr,t.cI=ds,t.ca=function(t,e,i){const r=M(e.x-i.x,e.y-i.y),n=M(t.x-i.x,t.y-i.y);var s,o;return Y(Math.atan2(r[0]*n[1]-r[1]*n[0],(s=r)[0]*(o=n)[0]+s[1]*o[1]))},t.cb=k,t.cc=function(t,e){return Q[e]&&(t instanceof MouseEvent||t instanceof WheelEvent)},t.cd=function(t,e){return J[e]&&"touches"in t},t.ce=function(t){return J[t]||Q[t]},t.cf=function(t,e,i){var r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t},t.cg=function(t,e){const{x:i,y:r}=ru.fromLngLat(e);return!(t<0||t>25||r<0||r>=1||i<0||i>=1)},t.ch=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.ci=class extends Fs{},t.cj=sd,t.cl=function(t){return t.message===tt},t.cm=st,t.cn=function(t,e){it.REGISTERED_PROTOCOLS[t]=e},t.co=function(t){delete it.REGISTERED_PROTOCOLS[t]},t.cp=function(t,e){const i={};for(let n=0;n<t.length;n++){const r=e&&e[t[n].id]||ln(t[n]);e&&(e[t[n].id]=r);let s=i[r];s||(s=i[r]=[]),s.push(t[n])}const r=[];for(const n in i)r.push(i[n]);return r},t.cq=qn,t.cr=hu,t.cs=du,t.ct=Kc,t.cu=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=S/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const i=e.bucket.layers[0],r=i.layout,n=i._unevaluatedLayout._values,s={layoutIconSize:n["icon-size"].possiblyEvaluate(new ps(e.bucket.zoom+1),e.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new ps(e.bucket.zoom+1),e.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new ps(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.textSizeData;s.compositeTextSizes=[n["text-size"].possiblyEvaluate(new ps(t),e.canonical),n["text-size"].possiblyEvaluate(new ps(i),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.iconSizeData;s.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new ps(t),e.canonical),n["icon-size"].possiblyEvaluate(new ps(i),e.canonical)]}const o=r.get("text-line-height")*Bc,a="viewport"!==r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement"),l=r.get("text-keep-upright"),c=r.get("text-size");for(const h of e.bucket.features){const n=r.get("text-font").evaluate(h,{},e.canonical).join(","),u=c.evaluate(h,{},e.canonical),d=s.layoutTextSize.evaluate(h,{},e.canonical),p=s.layoutIconSize.evaluate(h,{},e.canonical),f={horizontal:{},vertical:void 0},m=h.text;let _,g=[0,0];if(m){const s=m.toString(),c=r.get("text-letter-spacing").evaluate(h,{},e.canonical)*Bc,p=es(s)?c:0,_=r.get("text-anchor").evaluate(h,{},e.canonical),y=Vu(i,h,e.canonical);if(!y){const t=r.get("text-radial-offset").evaluate(h,{},e.canonical);g=t?ju(_,[t*Bc,Ou]):r.get("text-offset").evaluate(h,{},e.canonical).map((t=>t*Bc))}let x=a?"center":r.get("text-justify").evaluate(h,{},e.canonical);const v="point"===r.get("symbol-placement")?r.get("text-max-width").evaluate(h,{},e.canonical)*Bc:1/0,b=()=>{e.bucket.allowVerticalPlacement&&ts(s)&&(f.vertical=eh(m,e.glyphMap,e.glyphPositions,e.imagePositions,n,v,o,_,"left",p,g,t.ah.vertical,!0,d,u))};if(!a&&y){const i=new Set;if("auto"===x)for(let t=0;t<y.values.length;t+=2)i.add(Nu(y.values[t]));else i.add(x);let r=!1;for(const s of i)if(!f.horizontal[s])if(r)f.horizontal[s]=f.horizontal[0];else{const i=eh(m,e.glyphMap,e.glyphPositions,e.imagePositions,n,v,o,"center",s,p,g,t.ah.horizontal,!1,d,u);i&&(f.horizontal[s]=i,r=1===i.positionedLines.length)}b()}else{"auto"===x&&(x=Nu(_));const i=eh(m,e.glyphMap,e.glyphPositions,e.imagePositions,n,v,o,_,x,p,g,t.ah.horizontal,!1,d,u);i&&(f.horizontal[x]=i),b(),ts(s)&&a&&l&&(f.vertical=eh(m,e.glyphMap,e.glyphPositions,e.imagePositions,n,v,o,_,x,p,g,t.ah.vertical,!1,d,u))}}let y=!1;if(h.icon&&h.icon.name){const t=e.imageMap[h.icon.name];t&&(_=yh(e.imagePositions[h.icon.name],r.get("icon-offset").evaluate(h,{},e.canonical),r.get("icon-anchor").evaluate(h,{},e.canonical)),y=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=y:e.bucket.sdfIcons!==y&&N("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.bucket.pixelRatio||0!==r.get("icon-rotate").constantOr(1))&&(e.bucket.iconsNeedLinear=!0))}const x=Gu(f.horizontal)||f.vertical;e.bucket.iconsInText=!!x&&x.iconsInText,(x||_)&&Zu(e.bucket,h,f,_,e.imageMap,s,d,p,g,y,e.canonical,e.subdivisionGranularity)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()},t.cv=xc,t.cw=Rl,t.cx=rc,t.cy=Ql,t.cz=Nc,t.d=lt,t.e=L,t.f=t=>e(void 0,void 0,void 0,(function*(){if(0===t.byteLength)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(t)],{type:"image/png"});try{return createImageBitmap(e)}catch(t){throw new 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=rt,t.h=t=>new Promise(((e,i)=>{const r=new Image;r.onload=()=>{e(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>{r.src=q}))},r.onerror=()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const n=new Blob([new Uint8Array(t)],{type:"image/png"});r.src=t.byteLength?URL.createObjectURL(n):q})),t.i=U,t.j=(t,e)=>at(L(t,{type:"json"}),e),t.k=dt,t.l=ut,t.m=at,t.n=(t,e)=>at(L(t,{type:"arrayBuffer"}),e),t.o=function(t){return new Nc(t).readFields(Uc,[])},t.p=Wc,t.q=Na,t.r=Is,t.s=K,t.t=jn,t.u=Qn,t.v=ft,t.w=N,t.x=Un,t.y=On,t.z=function([t,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(i),y:t*Math.sin(e)*Math.sin(i),z:t*Math.cos(i)}}})),i("worker",["./shared"],(function(t){class e{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,i){for(const n of e){this._layerConfigs[n.id]=n;const e=this._layers[n.id]=t.by(n);e._featureFilter=t.a7(e.filter),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(const t of i)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const r=t.cp(Object.values(this._layerConfigs),this.keyCache);for(const t of r){const e=t.map((t=>this._layers[t.id])),i=e[0];if("none"===i.visibility)continue;const r=i.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]={});const s=i.sourceLayer||"_geojsonTileLayer";let o=n[s];o||(o=n[s]=[]),o.push(e)}}}class i{constructor(e){const i={},r=[];for(const t in e){const n=e[t],s=i[t]={};for(const t in n){const e=n[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;
2const i={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};r.push(i),s[t]={rect:i,metrics:e.metrics}}}const{w:n,h:s}=t.p(r),o=new t.q({width:n||1,height:s||1});for(const a in e){const r=e[a];for(const e in r){const n=r[+e];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const s=i[a][e].rect;t.q.copy(n.bitmap,o,{x:0,y:0},{x:s.x+1,y:s.y+1},n.bitmap)}}this.image=o,this.positions=i}}t.cq("GlyphAtlas",i);class r{constructor(e){this.tileID=new t.Y(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[]}parse(e,r,s,o,a){return t._(this,void 0,void 0,(function*(){this.status="parsing",this.data=e,this.collisionBoxArray=new t.a5;const l=new t.cr(Object.keys(e.layers).sort()),c=new t.cs(this.tileID,this.promoteId);c.bucketLayerIDs=[];const h={},u={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:s,subdivisionGranularity:a},d=r.familiesBySource[this.source];for(const i in d){const r=e.layers[i];if(!r)continue;1===r.version&&t.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const o=l.encode(i),a=[];for(let t=0;t<r.length;t++){const e=r.feature(t),n=c.getId(e,i);a.push({feature:e,id:n,index:t,sourceLayerIndex:o})}for(const e of d[i]){const i=e[0];i.source!==this.source&&t.w(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"!==i.visibility&&(n(e,this.zoom,s),(h[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(a,u,this.tileID.canonical),c.bucketLayerIDs.push(e.map((t=>t.id))))}}const p=t.bD(u.glyphDependencies,(t=>Object.keys(t).map(Number)));this.inFlightDependencies.forEach((t=>null==t?void 0:t.abort())),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){const t=new AbortController;this.inFlightDependencies.push(t),f=o.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},t)}const m=Object.keys(u.iconDependencies);let _=Promise.resolve({});if(m.length){const t=new AbortController;this.inFlightDependencies.push(t),_=o.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"icons"}},t)}const g=Object.keys(u.patternDependencies);let y=Promise.resolve({});if(g.length){const t=new AbortController;this.inFlightDependencies.push(t),y=o.sendAsync({type:"GI",data:{icons:g,source:this.source,tileID:this.tileID,type:"patterns"}},t)}const[x,v,b]=yield Promise.all([f,_,y]),w=new i(x),T=new t.ct(v,b);for(const e in h){const i=h[e];i instanceof t.a6?(n(i.layers,this.zoom,s),t.cu({bucket:i,glyphMap:x,glyphPositions:w.positions,imageMap:v,imagePositions:T.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:u.subdivisionGranularity})):i.hasPattern&&(i instanceof t.cv||i instanceof t.cw||i instanceof t.cx)&&(n(i.layers,this.zoom,s),i.addFeatures(u,this.tileID.canonical,T.patternPositions))}return this.status="done",{buckets:Object.values(h).filter((t=>!t.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:w.image,imageAtlas:T,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?v:null,glyphPositions:this.returnDependencies?w.positions:null}}))}}function n(e,i,r){const n=new t.C(i);for(const t of e)t.recalculate(n,r)}class s{constructor(t,e,i){this.actor=t,this.layerIndex=e,this.availableImages=i,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(e,i){return t._(this,void 0,void 0,(function*(){const r=yield t.n(e.request,i);try{return{vectorTile:new t.cy.VectorTile(new t.cz(r.data)),rawData:r.data,cacheControl:r.cacheControl,expires:r.expires}}catch(t){const n=new Uint8Array(r.data);let s=`Unable to parse the tile at ${e.request.url}, `;throw s+=31===n[0]&&139===n[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${t.message}`,new Error(s)}}))}loadTile(e){return t._(this,void 0,void 0,(function*(){const i=e.uid,n=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.cA(e.request),s=new r(e);this.loading[i]=s;const o=new AbortController;s.abort=o;try{const r=yield this.loadVectorTile(e,o);if(delete this.loading[i],!r)return null;const a=r.rawData,l={};r.expires&&(l.expires=r.expires),r.cacheControl&&(l.cacheControl=r.cacheControl);const c={};if(n){const t=n.finish();t&&(c.resourceTiming=JSON.parse(JSON.stringify(t)))}s.vectorTile=r.vectorTile;const h=s.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);this.loaded[i]=s,this.fetching[i]={rawTileData:a,cacheControl:l,resourceTiming:c};try{const e=yield h;return t.e({rawTileData:a.slice(0)},e,l,c)}finally{delete this.fetching[i]}}catch(t){throw delete this.loading[i],s.status="done",this.loaded[i]=s,t}}))}reloadTile(e){return t._(this,void 0,void 0,(function*(){const i=e.uid;if(!this.loaded||!this.loaded[i])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const r=this.loaded[i];if(r.showCollisionBoxes=e.showCollisionBoxes,"parsing"===r.status){const n=yield r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);let s;if(this.fetching[i]){const{rawTileData:e,cacheControl:r,resourceTiming:o}=this.fetching[i];delete this.fetching[i],s=t.e({rawTileData:e.slice(0)},n,r,o)}else s=n;return s}if("done"===r.status&&r.vectorTile)return r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity)}))}abortTile(e){return t._(this,void 0,void 0,(function*(){const t=this.loading,i=e.uid;t&&t[i]&&t[i].abort&&(t[i].abort.abort(),delete t[i])}))}removeTile(e){return t._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[e.uid]&&delete this.loaded[e.uid]}))}}class o{constructor(){this.loaded={}}loadTile(e){return t._(this,void 0,void 0,(function*(){const{uid:i,encoding:r,rawImageData:n,redFactor:s,greenFactor:o,blueFactor:a,baseShift:l}=e,c=n.width+2,h=n.height+2,u=t.b(n)?new t.R({width:c,height:h},yield t.cB(n,-1,-1,c,h)):n,d=new t.cC(i,u,r,s,o,a,l);return this.loaded=this.loaded||{},this.loaded[i]=d,d}))}removeTile(t){const e=this.loaded,i=t.uid;e&&e[i]&&delete e[i]}}var a,l,c=function(){if(l)return a;function t(t,i){if(0!==t.length){e(t[0],i);for(var r=1;r<t.length;r++)e(t[r],!i)}}function e(t,e){for(var i=0,r=0,n=0,s=t.length,o=s-1;n<s;o=n++){var a=(t[n][0]-t[o][0])*(t[o][1]+t[n][1]),l=i+a;r+=Math.abs(i)>=Math.abs(a)?i-l+a:a-l+i,i=l}i+r>=0!=!!e&&t.reverse()}return l=1,a=function e(i,r){var n,s=i&&i.type;if("FeatureCollection"===s)for(n=0;n<i.features.length;n++)e(i.features[n],r);else if("GeometryCollection"===s)for(n=0;n<i.geometries.length;n++)e(i.geometries[n],r);else if("Feature"===s)e(i.geometry,r);else if("Polygon"===s)t(i.coordinates,r);else if("MultiPolygon"===s)for(n=0;n<i.coordinates.length;n++)t(i.coordinates[n],r);return i}}(),h=t.cD(c);const u=t.cy.VectorTileFeature.prototype.toGeoJSON;class d{constructor(e){this._feature=e,this.extent=t.Z,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=p
2arseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const i of this._feature.geometry)e.push([new t.P(i[0],i[1])]);return e}{const e=[];for(const i of this._feature.geometry){const r=[];for(const e of i)r.push(new t.P(e[0],e[1]));e.push(r)}return e}}toGeoJSON(t,e,i){return u.call(this,t,e,i)}}class p{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.Z,this.length=e.length,this._features=e}feature(t){return new d(this._features[t])}}var f,m,_,g={exports:{}},y=function(){if(_)return g.exports;_=1;var e=t.cG(),i=function(){if(m)return f;m=1;var e=t.cE(),i=t.cF().VectorTileFeature;function r(t,e){this.options=e||{},this.features=t,this.length=t.length}function n(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}return f=r,r.prototype.feature=function(t){return new n(this.features[t],this.options.extent)},n.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var i=0;i<t.length;i++){for(var r=t[i],n=[],s=0;s<r.length;s++)n.push(new e(r[s][0],r[s][1]));this.geometry.push(n)}return this.geometry},n.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,i=-1/0,r=1/0,n=-1/0,s=0;s<t.length;s++)for(var o=t[s],a=0;a<o.length;a++){var l=o[a];e=Math.min(e,l.x),i=Math.max(i,l.x),r=Math.min(r,l.y),n=Math.max(n,l.y)}return[e,r,i,n]},n.prototype.toGeoJSON=i.prototype.toGeoJSON,f}();function r(t){var i=new e;return function(t,e){for(var i in t.layers)e.writeMessage(3,n,t.layers[i])}(t,i),i.finish()}function n(t,e){var i;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<t.length;i++)r.feature=t.feature(i),e.writeMessage(2,s,r);var n=r.keys;for(i=0;i<n.length;i++)e.writeStringField(3,n[i]);var o=r.values;for(i=0;i<o.length;i++)e.writeMessage(4,h,o[i])}function s(t,e){var i=t.feature;void 0!==i.id&&e.writeVarintField(1,i.id),e.writeMessage(2,o,t),e.writeVarintField(3,i.type),e.writeMessage(4,c,i)}function o(t,e){var i=t.feature,r=t.keys,n=t.values,s=t.keycache,o=t.valuecache;for(var a in i.properties){var l=i.properties[a],c=s[a];if(null!==l){void 0===c&&(r.push(a),s[a]=c=r.length-1),e.writeVarint(c);var h=typeof l;"string"!==h&&"boolean"!==h&&"number"!==h&&(l=JSON.stringify(l));var u=h+":"+l,d=o[u];void 0===d&&(n.push(l),o[u]=d=n.length-1),e.writeVarint(d)}}}function a(t,e){return(e<<3)+(7&t)}function l(t){return t<<1^t>>31}function c(t,e){for(var i=t.loadGeometry(),r=t.type,n=0,s=0,o=i.length,c=0;c<o;c++){var h=i[c],u=1;1===r&&(u=h.length),e.writeVarint(a(1,u));for(var d=3===r?h.length-1:h.length,p=0;p<d;p++){1===p&&1!==r&&e.writeVarint(a(2,d-1));var f=h[p].x-n,m=h[p].y-s;e.writeVarint(l(f)),e.writeVarint(l(m)),n+=f,s+=m}3===r&&e.writeVarint(a(7,1))}}function h(t,e){var i=typeof t;"string"===i?e.writeStringField(1,t):"boolean"===i?e.writeBooleanField(7,t):"number"===i&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}return g.exports=r,g.exports.fromVectorTileJs=r,g.exports.fromGeojsonVt=function(t,e){e=e||{};var n={};for(var s in t)n[s]=new i(t[s].features,e),n[s].name=s,n[s].version=e.version,n[s].extent=e.extent;return r({layers:n})},g.exports.GeoJSONWrapper=i,g.exports}(),x=t.cD(y);const v={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},b=Math.fround||(w=new Float32Array(1),t=>(w[0]=+t,w[0]));var w;const T=3,P=5,M=6;class S{constructor(t){this.options=Object.assign(Object.create(v),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:i,maxZoom:r}=this.options;e&&console.time("total time");const n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;const s=[];for(let a=0;a<t.length;a++){const e=t[a];if(!e.geometry)continue;const[i,r]=e.geometry.coordinates,n=b(A(i)),o=b(E(r));s.push(n,o,1/0,a,-1,1),this.options.reduce&&s.push(0)}let o=this.trees[r+1]=this._createTree(s);e&&console.timeEnd(n);for(let a=r;a>=i;a--){const t=+Date.now();o=this.trees[a]=this._createTree(this._cluster(o,a)),e&&console.log("z%d: %d clusters in %dms",a,o.numItems,+Date.now()-t)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let i=((t[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,t[1]));let n=180===t[2]?180:((t[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,n=180;else if(i>n){const t=this.getClusters([i,r,180,s],e),o=this.getClusters([-180,r,n,s],e);return t.concat(o)}const o=this.trees[this._limitZoom(e)],a=o.range(A(i),E(s),A(n),E(r)),l=o.data,c=[];for(const h of a){const t=this.stride*h;c.push(l[t+P]>1?I(l,t,this.clusterProps):this.points[l[t+T]])}return c}getChildren(t){const e=this._getOriginId(t),i=this._getOriginZoom(t),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const s=n.data;if(e*this.stride>=s.length)throw new Error(r);const o=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=n.within(s[e*this.stride],s[e*this.stride+1],o),l=[];for(const c of a){const e=c*this.stride;s[e+4]===t&&l.push(s[e+P]>1?I(s,e,this.clusterProps):this.points[s[e+T]])}if(0===l.length)throw new Error(r);return l}getLeaves(t,e,i){const r=[];return this._appendLeaves(r,t,e=e||10,i=i||0,0),r}getTile(t,e,i){const r=this.trees[this._limitZoom(t)],n=Math.pow(2,t),{extent:s,radius:o}=this.options,a=o/s,l=(i-a)/n,c=(i+1+a)/n,h={features:[]};return this._addTileFeatures(r.range((e-a)/n,l,(e+1+a)/n,c),r.data,e,i,n,h),0===e&&this._addTileFeatures(r.range(1-a/n,l,1,c),r.data,n,i,n,h),e===n-1&&this._addTileFeatures(r.range(0,l,a/n,c),r.data,-1,i,n,h),h.features.length?h:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const i=this.getChildren(t);if(e++,1!==i.length)break;t=i[0].properties.cluster_id}return e}_appendLeaves(t,e,i,r,n){const s=this.getChildren(e);for(const o of s){const e=o.properties;if(e&&e.cluster?n+e.point_count<=r?n+=e.point_count:n=this._appendLeaves(t,e.cluster_id,i,r,n):n<r?n++:t.push(o),t.length===i)break}return n}_createTree(e){const i=new t.aC(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let t=0;t<e.length;t+=this.stride)i.add(e[t],e[t+1]);return i.finish(),i.data=e,i}_addTileFeatures(t,e,i,r,n,s){for(const o of t){const t=o*this.stride,a=e[t+P]>1;let l,c,h;if(a)l=C(e,t,this.clusterProps),c=e[t],h=e[t+1];else{const i=this.points[e[t+T]];l=i.properties;const[r,n]=i.geometry.coordinates;c=A(r),h=E(n)}const u={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(h*n-r))]],tags:l};let d;d=a||this.options.generateId?e[t+T]:this.points[e[t+T]].id,void 0!==d&&(u.id=d),s.features.push(u)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:i,extent:r,reduce:n,minPoints:s}=this.options,o=i/(r*Math.pow(2,e)),a=t.data,l=[],c=this.stride;for(let h=0;h<a.length;h+=c){if(a[h+2]<=e)continue;a[h+2]=e;const i=a[h],r=a[h+1],u=t.within(a[h],a[h+1],o),d=a[h+P];let p=d;for(const t of u){const i=t*c;a[i+2]>e&&(p+=a[i+P])}if(p>d&&p>=s){let t,s=i*d,o=r*d,f=-1;const m=(h/c<<5)+(e+1)+this.points.length;for(const i of u){const r=i*c;if(a[r+2]<=e)continue;a[r+2]=e;const l=a[r+P];s+=a[r]*l,o+=a[r+1]*l,a[r+4]=m,n&&(t||(t=this._map(a,h,!0),f=this.clusterProps.length,this.clusterProps.push(t)),n(t,this._map(a,r)))}a[h+4]=m,l.push(s/p,o/p,1/0,m,-1,p),n&&l.push(f)}else{for(let t=0;t<c;t++)l.push(a[h+t]);if(p>1)for(const t of u){const i=t*c;if(!(a[i+2]<=e)){a[i+2]=e;for(let t=0;t<c;t++)l.push(a[i+t])}}}}return l}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,i){if(t[e+P]>1){const r=this.clusterProps[t[e+M]];return i?Object.assign({},r):r}const r=this.points[t[e+T]].properties,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function I(t,e,i){return{type:"Feature",id:t[e+T],properties:C(t,e,i),geometry:{type:"Point",coordinates:[(r=t[e],360*(r-.5)),z(t[e+1])]}};var r}function C(t,e,i){const r=t[e+P],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,s=t[e+M],o=-1===s?{}:Object.assign({},i[s]);return Object.assign(o,{cluster:!0,cluster_id:t[e+T],point_count:r,point_count_abbreviated:n})}function A(t){return t/360+.5}function E(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function z(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function k(t,e,i,r){let n=r;const s=e+(i-e>>1);let o,a=i-e;const l=t[e],c=t[e+1],h=t[i],u=t[i+1];for(let d=e+3;d<i;d+=3){const e=D(t[d],t[d+1],l,c,h,u);if(e>n)o=d,n=e;else if(e===n){const t=Math.abs(d-s);t<a&&(o=d,a=t)}}n>r&&(o-e>3&&k(t,e,o,r),t[o+2]=n,i-o>3&&k(t,o,i,r))}function D(t,e,i,r,n,s){let o=n-i,a=s-r;if(0!==o||0!==a){const l=((t-i)*o+(e-r)*a)/(o*o+a*a);l>1?(i=n,r=s):l>0&&(i+=o*l,r+=a*l)}return o=t-i,a=e-r,o*o+a*a}function R(t,e,i,r){const n={id:null==t?null:t,type:e,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===e||"MultiPoint"===e||"LineString"===e)L(n,i);else if("Polygon"===e)L(n,i[0]);else if("MultiLineString"===e)for(const s of i)L(n,s);else if("MultiPolygon"===e)for(const s of i)L(n,s[0]);return n}function L(t,e){for(let i=0;i<e.length;i+=3)t.minX=Math.min(t.minX,e[i]),t.minY=Math.min(t.minY,e[i+1]),t.maxX=Math.max(t.maxX,e[i]),t.maxY=Math.max(t.maxY,e[i+1])}function F(t,e,i,r){if(!e.geometry)return;const n=e.geometry.coordinates;if(n&&0===n.length)return;const s=e.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);let a=[],l=e.id;if(i.promoteId?l=e.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===s)B(n,a);else if("MultiPoint"===s)for(const c of n)B(c,a);else if("LineString"===s)O(n,a,o,!1);else if("MultiLineString"===s){if(i.lineMetrics){for(const i of n)a=[],O(i,a,o,!1),t.push(R(l,"LineString",a,e.properties));return}j(n,a,o,!1)}else if("Polygon"===s)j(n,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(const n of e.geometry.geometries)F(t,{id:l,geometry:n,properties:e.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of n){const e=[];j(t,e,o,!0),a.push(e)}}t.push(R(l,s,a,e.properties))}function B(t,e){e.push(V(t[0]),N(t[1]),0)}function O(t,e,i,r){let n,s,o=0;for(let l=0;l<t.length;l++){const i=V(t[l][0]),a=N(t[l][1]);e.push(i,a,0),l>0&&(o+=r?(n*a-i*s)/2:Math.sqrt(Math.pow(i-n,2)+Math.pow(a-s,2))),n=i,s=a}const a=e.length-3;e[2]=1,k(e,0,a,i),e[a+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function j(t,e,i,r){for(let n=0;n<t.length;n++){const s=[];O(t[n],s,i,r),e.push(s)}}function V(t){return t/360+.5}function N(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}
2function Z(t,e,i,r,n,s,o,a){if(r/=e,s>=(i/=e)&&o<r)return t;if(o<i||s>=r)return null;const l=[];for(const c of t){const t=c.geometry;let e=c.type;const s=0===n?c.minX:c.minY,o=0===n?c.maxX:c.maxY;if(s>=i&&o<r){l.push(c);continue}if(o<i||s>=r)continue;let h=[];if("Point"===e||"MultiPoint"===e)U(t,h,i,r,n);else if("LineString"===e)G(t,h,i,r,n,!1,a.lineMetrics);else if("MultiLineString"===e)q(t,h,i,r,n,!1);else if("Polygon"===e)q(t,h,i,r,n,!0);else if("MultiPolygon"===e)for(const a of t){const t=[];q(a,t,i,r,n,!0),t.length&&h.push(t)}if(h.length){if(a.lineMetrics&&"LineString"===e){for(const t of h)l.push(R(c.id,e,t,c.tags));continue}"LineString"!==e&&"MultiLineString"!==e||(1===h.length?(e="LineString",h=h[0]):e="MultiLineString"),"Point"!==e&&"MultiPoint"!==e||(e=3===h.length?"Point":"MultiPoint"),l.push(R(c.id,e,h,c.tags))}}return l.length?l:null}function U(t,e,i,r,n){for(let s=0;s<t.length;s+=3){const o=t[s+n];o>=i&&o<=r&&W(e,t[s],t[s+1],t[s+2])}}function G(t,e,i,r,n,s,o){let a=$(t);const l=0===n?H:X;let c,h,u=t.start;for(let _=0;_<t.length-3;_+=3){const d=t[_],p=t[_+1],f=t[_+2],m=t[_+3],g=t[_+4],y=0===n?d:p,x=0===n?m:g;let v=!1;o&&(c=Math.sqrt(Math.pow(d-m,2)+Math.pow(p-g,2))),y<i?x>i&&(h=l(a,d,p,m,g,i),o&&(a.start=u+c*h)):y>r?x<r&&(h=l(a,d,p,m,g,r),o&&(a.start=u+c*h)):W(a,d,p,f),x<i&&y>=i&&(h=l(a,d,p,m,g,i),v=!0),x>r&&y<=r&&(h=l(a,d,p,m,g,r),v=!0),!s&&v&&(o&&(a.end=u+c*h),e.push(a),a=$(t)),o&&(u+=c)}let d=t.length-3;const p=t[d],f=t[d+1],m=0===n?p:f;m>=i&&m<=r&&W(a,p,f,t[d+2]),d=a.length-3,s&&d>=3&&(a[d]!==a[0]||a[d+1]!==a[1])&&W(a,a[0],a[1],a[2]),a.length&&e.push(a)}function $(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function q(t,e,i,r,n,s){for(const o of t)G(o,e,i,r,n,s,!1)}function W(t,e,i,r){t.push(e,i,r)}function H(t,e,i,r,n,s){const o=(s-e)/(r-e);return W(t,s,i+(n-i)*o,1),o}function X(t,e,i,r,n,s){const o=(s-i)/(n-i);return W(t,e+(r-e)*o,s,1),o}function K(t,e){const i=[];for(let r=0;r<t.length;r++){const n=t[r],s=n.type;let o;if("Point"===s||"MultiPoint"===s||"LineString"===s)o=Y(n.geometry,e);else if("MultiLineString"===s||"Polygon"===s){o=[];for(const t of n.geometry)o.push(Y(t,e))}else if("MultiPolygon"===s){o=[];for(const t of n.geometry){const i=[];for(const r of t)i.push(Y(r,e));o.push(i)}}i.push(R(n.id,s,o,n.tags))}return i}function Y(t,e){const i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(let r=0;r<t.length;r+=3)i.push(t[r]+e,t[r+1],t[r+2]);return i}function J(t,e){if(t.transformed)return t;const i=1<<t.z,r=t.x,n=t.y;for(const s of t.features){const t=s.geometry,o=s.type;if(s.geometry=[],1===o)for(let a=0;a<t.length;a+=2)s.geometry.push(Q(t[a],t[a+1],e,i,r,n));else for(let a=0;a<t.length;a++){const o=[];for(let s=0;s<t[a].length;s+=2)o.push(Q(t[a][s],t[a][s+1],e,i,r,n));s.geometry.push(o)}}return t.transformed=!0,t}function Q(t,e,i,r,n,s){return[Math.round(i*(t*r-n)),Math.round(i*(e*r-s))]}function tt(t,e,i,r,n){const s=e===n.maxZoom?0:n.tolerance/((1<<e)*n.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:i,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const a of t)et(o,a,s,n);return o}function et(t,e,i,r){const n=e.geometry,s=e.type,o=[];if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),"Point"===s||"MultiPoint"===s)for(let a=0;a<n.length;a+=3)o.push(n[a],n[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)it(o,n,t,i,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(let a=0;a<n.length;a++)it(o,n[a],t,i,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(let a=0;a<n.length;a++){const e=n[a];for(let r=0;r<e.length;r++)it(o,e[r],t,i,!0,0===r)}if(o.length){let i=e.tags||null;if("LineString"===s&&r.lineMetrics){i={};for(const t in e.tags)i[t]=e.tags[t];i.mapbox_clip_start=n.start/n.size,i.mapbox_clip_end=n.end/n.size}const a={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:i};null!==e.id&&(a.id=e.id),t.features.push(a)}}function it(t,e,i,r,n,s){const o=r*r;if(r>0&&e.size<(n?o:r))return void(i.numPoints+=e.length/3);const a=[];for(let l=0;l<e.length;l+=3)(0===r||e[l+2]>o)&&(i.numSimplified++,a.push(e[l],e[l+1])),i.numPoints++;n&&function(t,e){let i=0;for(let r=0,n=t.length,s=n-2;r<n;s=r,r+=2)i+=(t[r]-t[s])*(t[r+1]+t[s+1]);if(i>0===e)for(let r=0,n=t.length;r<n/2;r+=2){const e=t[r],i=t[r+1];t[r]=t[n-2-r],t[r+1]=t[n-1-r],t[n-2-r]=e,t[n-1-r]=i}}(a,s),t.push(a)}const rt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};
2class nt{constructor(t,e){const i=(e=this.options=function(t,e){for(const i in e)t[i]=e[i];return t}(Object.create(rt),e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=function(t,e){const i=[];if("FeatureCollection"===t.type)for(let r=0;r<t.features.length;r++)F(i,t.features[r],e,r);else F(i,"Feature"===t.type?t:{geometry:t},e);return i}(t,e);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,e){const i=e.buffer/e.extent;let r=t;const n=Z(t,1,-1-i,i,0,-1,2,e),s=Z(t,1,1-i,2+i,0,-1,2,e);return(n||s)&&(r=Z(t,1,-i,1+i,0,-1,2,e)||[],n&&(r=K(n,1).concat(r)),s&&(r=r.concat(K(s,-1)))),r}(r,e),r.length&&this.splitTile(r,0,0,0),i&&(r.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,e,i,r,n,s,o){const a=[t,e,i,r],l=this.options,c=l.debug;for(;a.length;){r=a.pop(),i=a.pop(),e=a.pop(),t=a.pop();const h=1<<e,u=st(e,i,r);let d=this.tiles[u];if(!d&&(c>1&&console.time("creation"),d=this.tiles[u]=tt(t,e,i,r,l),this.tileCoords.push({z:e,x:i,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,i,r,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const t=`z${e}`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(d.source=t,null==n){if(e===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===n)continue;if(null!=n){const t=n-e;if(i!==s>>t||r!==o>>t)continue}}if(d.source=null,0===t.length)continue;c>1&&console.time("clipping");const p=.5*l.buffer/l.extent,f=.5-p,m=.5+p,_=1+p;let g=null,y=null,x=null,v=null,b=Z(t,h,i-p,i+m,0,d.minX,d.maxX,l),w=Z(t,h,i+f,i+_,0,d.minX,d.maxX,l);t=null,b&&(g=Z(b,h,r-p,r+m,1,d.minY,d.maxY,l),y=Z(b,h,r+f,r+_,1,d.minY,d.maxY,l),b=null),w&&(x=Z(w,h,r-p,r+m,1,d.minY,d.maxY,l),v=Z(w,h,r+f,r+_,1,d.minY,d.maxY,l),w=null),c>1&&console.timeEnd("clipping"),a.push(g||[],e+1,2*i,2*r),a.push(y||[],e+1,2*i,2*r+1),a.push(x||[],e+1,2*i+1,2*r),a.push(v||[],e+1,2*i+1,2*r+1)}}getTile(t,e,i){t=+t,e=+e,i=+i;const r=this.options,{extent:n,debug:s}=r;if(t<0||t>24)return null;const o=1<<t,a=st(t,e=e+o&o-1,i);if(this.tiles[a])return J(this.tiles[a],n);s>1&&console.log("drilling down to z%d-%d-%d",t,e,i);let l,c=t,h=e,u=i;for(;!l&&c>0;)c--,h>>=1,u>>=1,l=this.tiles[st(c,h,u)];return l&&l.source?(s>1&&(console.log("found parent tile z%d-%d-%d",c,h,u),console.time("drilling down")),this.splitTile(l.source,c,h,u,t,e,i),s>1&&console.timeEnd("drilling down"),this.tiles[a]?J(this.tiles[a],n):null):null}}function st(t,e,i){return 32*((1<<t)*i+e)+t}function ot(t,e){return e?t.properties[e]:t.id}function at(t,e){if(null==t)return!0;if("Feature"===t.type)return null!=ot(t,e);if("FeatureCollection"===t.type){const i=new Set;for(const r of t.features){const t=ot(r,e);if(null==t)return!1;if(i.has(t))return!1;i.add(t)}return!0}return!1}function lt(t,e){const i=new Map;if(null==t);else if("Feature"===t.type)i.set(ot(t,e),t);else for(const r of t.features)i.set(ot(r,e),r);return i}class ct extends s{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(e,i){return t._(this,void 0,void 0,(function*(){const t=e.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const i=this._geoJSONIndex.getTile(t.z,t.x,t.y);if(!i)return null;const r=new p(i.features);let n=x(r);return 0===n.byteOffset&&n.byteLength===n.buffer.byteLength||(n=new Uint8Array(n)),{vectorTile:r,rawData:n.buffer}}))}loadData(e){return t._(this,void 0,void 0,(function*(){var i;null===(i=this._pendingRequest)||void 0===i||i.abort();const r=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.cA(e.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(e,this._pendingRequest),this._geoJSONIndex=e.cluster?new S(function({superclusterOptions:e,clusterProperties:i}){if(!i||!e)return e;const r={},n={},s={accumulated:null,zoom:0},o={properties:null},a=Object.keys(i);for(const l of a){const[e,s]=i[l],o=t.cH(s),a=t.cH("string"==typeof e?[e,["accumulated"],["get",l]]:e);r[l]=o.value,n[l]=a.value}return e.map=t=>{o.properties=t;const e={};for(const i of a)e[i]=r[i].evaluate(s,o);return e},e.reduce=(t,e)=>{o.properties=e;for(const i of a)s.accumulated=t[i],t[i]=n[i].evaluate(s,o)},e}(e)).load((yield this._pendingData).features):(n=yield this._pendingData,new nt(n,e.geojsonVtOptions)),this.loaded={};const i={};if(r){const t=r.finish();t&&(i.resourceTiming={},i.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}return i}catch(e){if(delete this._pendingRequest,t.cl(e))return{abandoned:!0};throw e}var n}))}getData(){return t._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(t){const e=this.loaded;return e&&e[t.uid]?super.reloadTile(t):this.loadTile(t)}loadAndProcessGeoJSON(e,i){return t._(this,void 0,void 0,(function*(){let r=yield this.loadGeoJSON(e,i);if(delete this._pendingRequest,"object"!=typeof r)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`);if(h(r,!0),e.filter){const i=t.cH(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const n=r.features.filter((t=>i.value.evaluate({zoom:0},t)));r={type:"FeatureCollection",features:n}}return r}))}loadGeoJSON(e,i){return t._(this,void 0,void 0,(function*(){const{promoteId:r}=e;if(e.request){const n=yield t.j(e.request,i);return this._dataUpdateable=at(n.data,r)?lt(n.data,r):void 0,n.data}if("string"==typeof e.data)try{const t=JSON.parse(e.data);return this._dataUpdateable=at(t,r)?lt(t,r):void 0,t}catch(t){throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`)}if(!e.dataDiff)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${e.source}`);
2return function(t,e,i){var r,n,s,o;if(e.removeAll&&t.clear(),e.remove)for(const a of e.remove)t.delete(a);if(e.add)for(const a of e.add){const e=ot(a,i);null!=e&&t.set(e,a)}if(e.update)for(const a of e.update){let e=t.get(a.id);if(null==e)continue;const i=!a.removeAllProperties&&((null===(r=a.removeProperties)||void 0===r?void 0:r.length)>0||(null===(n=a.addOrUpdateProperties)||void 0===n?void 0:n.length)>0);if((a.newGeometry||a.removeAllProperties||i)&&(e=Object.assign({},e),t.set(a.id,e),i&&(e.properties=Object.assign({},e.properties))),a.newGeometry&&(e.geometry=a.newGeometry),a.removeAllProperties)e.properties={};else if((null===(s=a.removeProperties)||void 0===s?void 0:s.length)>0)for(const t of a.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(o=a.addOrUpdateProperties)||void 0===o?void 0:o.length)>0)for(const{key:t,value:r}of a.addOrUpdateProperties)e.properties[t]=r}}(this._dataUpdateable,e.dataDiff,r),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}))}removeSource(e){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)}}class ht{constructor(e){this.self=e,this.actor=new t.H(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(t,e)=>{if(this.externalWorkerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.externalWorkerSourceTypes[t]=e},this.self.addProtocol=t.cn,this.self.removeProtocol=t.co,this.self.registerRTLTextPlugin=e=>{t.cI.setMethods(e)},this.actor.registerMessageHandler("LDT",((t,e)=>this._getDEMWorkerSource(t,e.source).loadTile(e))),this.actor.registerMessageHandler("RDT",((e,i)=>t._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(e,i.source).removeTile(i)})))),this.actor.registerMessageHandler("GCEZ",((e,i)=>t._(this,void 0,void 0,(function*(){return this._getWorkerSource(e,i.type,i.source).getClusterExpansionZoom(i)})))),this.actor.registerMessageHandler("GCC",((e,i)=>t._(this,void 0,void 0,(function*(){return this._getWorkerSource(e,i.type,i.source).getClusterChildren(i)})))),this.actor.registerMessageHandler("GCL",((e,i)=>t._(this,void 0,void 0,(function*(){return this._getWorkerSource(e,i.type,i.source).getClusterLeaves(i)})))),this.actor.registerMessageHandler("LD",((t,e)=>this._getWorkerSource(t,e.type,e.source).loadData(e))),this.actor.registerMessageHandler("GD",((t,e)=>this._getWorkerSource(t,e.type,e.source).getData())),this.actor.registerMessageHandler("LT",((t,e)=>this._getWorkerSource(t,e.type,e.source).loadTile(e))),this.actor.registerMessageHandler("RT",((t,e)=>this._getWorkerSource(t,e.type,e.source).reloadTile(e))),this.actor.registerMessageHandler("AT",((t,e)=>this._getWorkerSource(t,e.type,e.source).abortTile(e))),this.actor.registerMessageHandler("RMT",((t,e)=>this._getWorkerSource(t,e.type,e.source).removeTile(e))),this.actor.registerMessageHandler("RS",((e,i)=>t._(this,void 0,void 0,(function*(){if(!this.workerSources[e]||!this.workerSources[e][i.type]||!this.workerSources[e][i.type][i.source])return;const t=this.workerSources[e][i.type][i.source];delete this.workerSources[e][i.type][i.source],void 0!==t.removeSource&&t.removeSource(i)})))),this.actor.registerMessageHandler("RM",(e=>t._(this,void 0,void 0,(function*(){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e]})))),this.actor.registerMessageHandler("SR",((e,i)=>t._(this,void 0,void 0,(function*(){this.referrer=i})))),this.actor.registerMessageHandler("SRPS",((t,e)=>this._syncRTLPluginState(t,e))),this.actor.registerMessageHandler("IS",((e,i)=>t._(this,void 0,void 0,(function*(){this.self.importScripts(i)})))),this.actor.registerMessageHandler("SI",((t,e)=>this._setImages(t,e))),this.actor.registerMessageHandler("UL",((e,i)=>t._(this,void 0,void 0,(function*(){this._getLayerIndex(e).update(i.layers,i.removedIds)})))),this.actor.registerMessageHandler("SL",((e,i)=>t._(this,void 0,void 0,(function*(){this._getLayerIndex(e).replace(i)}))))}_setImages(e,i){return t._(this,void 0,void 0,(function*(){this.availableImages[e]=i;for(const t in this.workerSources[e]){const r=this.workerSources[e][t];for(const t in r)r[t].availableImages=i}}))}_syncRTLPluginState(e,i){return t._(this,void 0,void 0,(function*(){return yield t.cI.syncState(i,this.self.importScripts)}))}_getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}_getLayerIndex(t){let i=this.layerIndexes[t];
2return i||(i=this.layerIndexes[t]=new e),i}_getWorkerSource(t,e,i){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][i]){const r={sendAsync:(e,i)=>(e.targetMapId=t,this.actor.sendAsync(e,i))};switch(e){case"vector":this.workerSources[t][e][i]=new s(r,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][i]=new ct(r,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][i]=new this.externalWorkerSourceTypes[e](r,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][i]}_getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new o),this.demWorkerSources[t][e]}}return t.i(self)&&(self.worker=new ht(self)),ht})),i("index",["exports","./shared"],(function(t,e){var i="5.3.1";function r(){var t=new e.A(4);return e.A!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}let n,s;const o={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t,i,r){const n=requestAnimationFrame((t=>{s(),i(t)})),{unsubscribe:s}=e.s(t.signal,"abort",(()=>{s(),cancelAnimationFrame(n),r(e.c())}),!1)},frameAsync(t){return new Promise(((e,i)=>{this.frame(t,e,i)}))},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:t=>(n||(n=document.createElement("a")),n.href=t,n.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==s&&(s=matchMedia("(prefers-reduced-motion: reduce)")),s.matches)}};class a{static testProp(t){if(!a.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in a.docStyle)return t[e];return t[0]}static create(t,e,i){const r=window.document.createElement(t);return void 0!==e&&(r.className=e),i&&i.appendChild(r),r}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){a.docStyle&&a.selectProp&&(a.userSelect=a.docStyle[a.selectProp],a.docStyle[a.selectProp]="none")}static enableDrag(){a.docStyle&&a.selectProp&&(a.docStyle[a.selectProp]=a.userSelect)}static setTransform(t,e){t.style[a.transformProp]=e}static addEventListener(t,e,i,r={}){t.addEventListener(e,i,"passive"in r?r:r.capture)}static removeEventListener(t,e,i,r={}){t.removeEventListener(e,i,"passive"in r?r:r.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",a.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",a.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",a.suppressClickInternal,!0)}),0)}static getScale(t){const e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,i,r){const n=i.boundingClientRect;return new e.P((r.clientX-n.left)/i.x-t.clientLeft,(r.clientY-n.top)/i.y-t.clientTop)}static mousePos(t,e){const i=a.getScale(t);return a.getPoint(t,i,e)}static touchPos(t,e){const i=[],r=a.getScale(t);for(let n=0;n<e.length;n++)i.push(a.getPoint(t,r,e[n]));return i}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}static sanitize(t){const e=(new DOMParser).parseFromString(t,"text/html").body||document.createElement("body"),i=e.querySelectorAll("script");for(const r of i)r.remove();return a.clean(e),e.innerHTML}static isPossiblyDangerous(t,e){const i=e.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!i.includes("javascript:")&&!i.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const e=t.children;for(const i of e)a.removeAttributes(i),a.clean(i)}static removeAttributes(t){for(const{name:e,value:i}of t.attributes)a.isPossiblyDangerous(e,i)&&t.removeAttribute(e)}}a.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,a.selectProp=a.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),a.transformProp=a.testProp(["transform","WebkitTransform"]);const l={supported:!1,testSupport:function(t){!u&&h&&(d?p(t):c=t)}};let c,h,u=!1,d=!1;function p(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,h),t.isContextLost())return;
2l.supported=!0}catch(t){}t.deleteTexture(e),u=!0}var f;"undefined"!=typeof document&&(h=document.createElement("img"),h.onload=()=>{c&&p(c),c=null,d=!0},h.onerror=()=>{u=!0,c=null},h.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(t){let i,r,n,s;t.resetRequestQueue=()=>{i=[],r=0,n=0,s={}},t.addThrottleControl=t=>{const e=n++;return s[e]=t,e},t.removeThrottleControl=t=>{delete s[t],a()},t.getImage=(t,r,n=!0)=>new Promise(((s,o)=>{l.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),e.e(t,{type:"image"}),i.push({abortController:r,requestParameters:t,supportImageRefresh:n,state:"queued",onError:t=>{o(t)},onSuccess:t=>{s(t)}}),a()}));const o=t=>e._(this,void 0,void 0,(function*(){t.state="running";const{requestParameters:i,supportImageRefresh:n,onError:s,onSuccess:o,abortController:l}=t,h=!1===n&&!e.i(self)&&!e.g(i.url)&&(!i.headers||Object.keys(i.headers).reduce(((t,e)=>t&&"accept"===e),!0));r++;const u=h?c(i,l):e.m(i,l);try{const i=yield u;delete t.abortController,t.state="completed",i.data instanceof HTMLImageElement||e.b(i.data)?o(i):i.data&&o({data:yield(d=i.data,"function"==typeof createImageBitmap?e.f(d):e.h(d)),cacheControl:i.cacheControl,expires:i.expires})}catch(e){delete t.abortController,s(e)}finally{r--,a()}var d})),a=()=>{const t=(()=>{for(const t of Object.keys(s))if(s[t]())return!0;return!1})()?e.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:e.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let e=r;e<t&&i.length>0;e++){const t=i.shift();t.abortController.signal.aborted?e--:o(t)}},c=(t,i)=>new Promise(((r,n)=>{const s=new Image,o=t.url,a=t.credentials;a&&"include"===a?s.crossOrigin="use-credentials":(a&&"same-origin"===a||!e.d(o))&&(s.crossOrigin="anonymous"),i.signal.addEventListener("abort",(()=>{s.src="",n(e.c())})),s.fetchPriority="high",s.onload=()=>{s.onerror=s.onload=null,r({data:s})},s.onerror=()=>{s.onerror=s.onload=null,i.signal.aborted||n(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},s.src=o}))}(f||(f={})),f.resetRequestQueue();class m{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function _(t){const e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){const i=[];for(const{id:r,url:n}of t){const t=`${r}${n}`;-1===i.indexOf(t)&&(i.push(t),e.push({id:r,url:n}))}}return e}function g(t,e,i){try{const r=new URL(t);return r.pathname+=`${e}${i}`,r.toString()}catch(e){throw new Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class y{constructor(t,e,i,r){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,r)}update(t,i,r){const{width:n,height:s}=t,o=!(this.size&&this.size[0]===n&&this.size[1]===s||r),{context:a}=this,{gl:l}=a;if(this.useMipmap=Boolean(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),o)this.size=[n,s],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.b(t)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,t):l.texImage2D(l.TEXTURE_2D,0,this.format,n,s,0,this.format,l.UNSIGNED_BYTE,t.data);else{const{x:i,y:o}=r||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.b(t)?l.texSubImage2D(l.TEXTURE_2D,0,i,o,l.RGBA,l.UNSIGNED_BYTE,t):l.texSubImage2D(l.TEXTURE_2D,0,i,o,n,s,l.RGBA,l.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),a.pixelStoreUnpackFlipY.setDefault(),a.pixelStoreUnpack.setDefault(),a.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(t,e,i){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),i!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function x(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class v extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,promiseResolve:e}of this.requestors)e(this._getImagesForIds(t));this.requestors=[]}}getImage(t){const i=this.images[t];if(i&&!i.data&&i.spriteData){const t=i.spriteData;i.data=new e.R({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),i.spriteData=null}return i}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);
2this._validate(t,e)&&(this.images[t]=e)}_validate(t,i){let r=!0;const n=i.data||i.spriteData;return this._validateStretch(i.stretchX,n&&n.width)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,n&&n.height)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "content" value`))),r=!1),r}_validateStretch(t,e){if(!t)return!0;let i=0;for(const r of t){if(r[0]<i||r[1]<r[0]||e<r[1])return!1;i=r[1]}return!0}_validateContent(t,e){if(!t)return!0;if(4!==t.length)return!1;const i=e.spriteData,r=i&&i.width||e.data.width,n=i&&i.height||e.data.height;return!(t[0]<0||r<t[0]||t[1]<0||n<t[1]||t[2]<0||r<t[2]||t[3]<0||n<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,e,i=!0){const r=this.getImage(t);if(i&&(r.data.width!==e.data.width||r.data.height!==e.data.height))throw new Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=r.version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((e,i)=>{let r=!0;if(!this.isLoaded())for(const n of t)this.images[n]||(r=!1);this.isLoaded()||r?e(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:e})}))}_getImagesForIds(t){const i={};for(const r of t){let t=this.getImage(r);t||(this.fire(new e.l("styleimagemissing",{id:r})),t=this.getImage(r)),t?i[r]={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:Boolean(t.userImage&&t.userImage.render)}:e.w(`Image "${r}" 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 i}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(t){const i=this.patterns[t],r=this.getImage(t);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{const i={w:r.data.width+2,h:r.data.height+2,x:0,y:0},n=new e.I(i,r);this.patterns[t]={bin:i,position:n}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new y(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const e in this.patterns)t.push(this.patterns[e].bin);const{w:i,h:r}=e.p(t),n=this.atlasImage;n.resize({width:i||1,height:r||1});for(const s in this.patterns){const{bin:t}=this.patterns[s],i=t.x+1,r=t.y+1,o=this.getImage(s).data,a=o.width,l=o.height;e.R.copy(o,n,{x:0,y:0},{x:i,y:r},{width:a,height:l}),e.R.copy(o,n,{x:0,y:l-1},{x:i,y:r-1},{width:a,height:1}),e.R.copy(o,n,{x:0,y:0},{x:i,y:r+l},{width:a,height:1}),e.R.copy(o,n,{x:a-1,y:0},{x:i-1,y:r},{width:1,height:l}),e.R.copy(o,n,{x:0,y:0},{x:i+a,y:r},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const i of t){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const t=this.getImage(i);t||e.w(`Image with ID: "${i}" was not found`),x(t)&&this.updateImage(i,t)}}}const b=1e20;function w(t,e,i,r,n,s,o,a,l){for(let c=e;c<e+r;c++)T(t,i*s+c,s,n,o,a,l);for(let c=i;c<i+n;c++)T(t,c*s+e,1,r,o,a,l)}function T(t,e,i,r,n,s,o){s[0]=0,o[0]=-1e20,o[1]=b,n[0]=t[e];for(let a=1,l=0,c=0;a<r;a++){n[a]=t[e+a*i];const r=a*a;do{const t=s[l];c=(n[a]-n[t]+r-t*t)/(a-t)/2}while(c<=o[l]&&--l>-1);l++,s[l]=a,o[l]=c,o[l+1]=b}for(let a=0,l=0;a<r;a++){for(;o[l+1]<a;)l++;const r=s[l],c=a-r;t[e+a*i]=n[r]+c*c}}class P{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(t){return e._(this,void 0,void 0,(function*(){const e=[];for(const n in t)for(const i of t[n])e.push(this._getAndCacheGlyphsPromise(n,i));const i=yield Promise.all(e),r={};for(const{stack:t,id:n,glyph:s}of i)r[t]||(r[t]={}),r[t][n]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return r}))}
2_getAndCacheGlyphsPromise(t,i){return e._(this,void 0,void 0,(function*(){let e=this.entries[t];e||(e=this.entries[t]={glyphs:{},requests:{},ranges:{}});let r=e.glyphs[i];if(void 0!==r)return{stack:t,id:i,glyph:r};if(r=this._tinySDF(e,t,i),r)return e.glyphs[i]=r,{stack:t,id:i,glyph:r};const n=Math.floor(i/256);if(256*n>65535)throw new Error("glyphs > 65535 not supported");if(e.ranges[n])return{stack:t,id:i,glyph:r};if(!this.url)throw new Error("glyphsUrl is not set");if(!e.requests[n]){const i=P.loadGlyphRange(t,n,this.url,this.requestManager);e.requests[n]=i}const s=yield e.requests[n];for(const t in s)this._doesCharSupportLocalGlyph(+t)||(e.glyphs[+t]=s[+t]);return e.ranges[n]=!0,{stack:t,id:i,glyph:s[i]||null}}))}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(t))||e.u["CJK Unified Ideographs"](t)||e.u["Hangul Syllables"](t)||e.u.Hiragana(t)||e.u.Katakana(t)||e.u["CJK Symbols and Punctuation"](t)||e.u["Halfwidth and Fullwidth Forms"](t))}_tinySDF(t,i,r){const n=this.localIdeographFontFamily;if(!n)return;if(!this._doesCharSupportLocalGlyph(r))return;let s=t.tinySDF;if(!s){let e="400";/bold/i.test(i)?e="900":/medium/i.test(i)?e="500":/light/i.test(i)&&(e="200"),s=t.tinySDF=new P.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:n,fontWeight:e})}const o=s.draw(String.fromCharCode(r));return{id:r,bitmap:new e.q({width:o.width||60,height:o.height||60},o.data),metrics:{width:o.glyphWidth/2||24,height:o.glyphHeight/2||24,left:o.glyphLeft/2+.5||0,top:o.glyphTop/2-27.5||-8,advance:o.glyphAdvance/2||24,isDoubleResolution:!0}}}}P.loadGlyphRange=function(t,i,r,n){return e._(this,void 0,void 0,(function*(){const s=256*i,o=s+255,a=n.transformRequest(r.replace("{fontstack}",t).replace("{range}",`${s}-${o}`),"Glyphs"),l=yield e.n(a,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${i}, ${s}-${o}`);const c={};for(const t of e.o(l.data))c[t.id]=t;return c}))},P.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:s="normal",fontStyle:o="normal"}={}){this.buffer=e,this.cutoff=r,this.radius=i;const a=this.size=t+4*e,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${o} ${s} ${t}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:s}=this.ctx.measureText(t),o=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-n))),l=Math.min(this.size-this.buffer,o+Math.ceil(r)),c=a+2*this.buffer,h=l+2*this.buffer,u=Math.max(c*h,0),d=new Uint8ClampedArray(u),p={data:d,width:c,height:h,glyphWidth:a,glyphHeight:l,glyphTop:o,glyphLeft:0,glyphAdvance:e};if(0===a||0===l)return p;const{ctx:f,buffer:m,gridInner:_,gridOuter:g}=this;f.clearRect(m,m,a,l),f.fillText(t,m,m+o);const y=f.getImageData(m,m,a,l);g.fill(b,0,u),_.fill(0,0,u);for(let x=0;x<l;x++)for(let t=0;t<a;t++){const e=y.data[4*(x*a+t)+3]/255;if(0===e)continue;const i=(x+m)*c+t+m;if(1===e)g[i]=0,_[i]=b;else{const t=.5-e;g[i]=t>0?t*t:0,_[i]=t<0?t*t:0}}w(g,0,0,c,h,c,this.f,this.v,this.z),w(_,m,m,a,l,c,this.f,this.v,this.z);for(let x=0;x<u;x++){const t=Math.sqrt(g[x])-Math.sqrt(_[x]);d[x]=Math.round(255-255*(t/this.radius+this.cutoff))}return p}};class M{constructor(){this.specification=e.v.light.position}possiblyEvaluate(t,i){return e.z(t.expression.evaluate(i))}interpolate(t,i,r){return{x:e.B.number(t.x,i.x,r),y:e.B.number(t.y,i.y,r),z:e.B.number(t.z,i.z,r)}}}let S;class I extends e.E{constructor(t){super(),S=S||new e.r({anchor:new e.D(e.v.light.anchor),position:new M,color:new e.D(e.v.light.color),intensity:new e.D(e.v.light.intensity)}),this._transitionable=new e.T(S),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,i={}
2){if(!this._validate(e.t,t,i))for(const e in t){const i=t[e];e.endsWith("-transition")?this._transitionable.setTransition(e.slice(0,-11),i):this._transitionable.setValue(e,i)}}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,i,r){return(!r||!1!==r.validate)&&e.x(this,t.call(e.y,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.v}))}}const C=new e.r({"sky-color":new e.D(e.v.sky["sky-color"]),"horizon-color":new e.D(e.v.sky["horizon-color"]),"fog-color":new e.D(e.v.sky["fog-color"]),"fog-ground-blend":new e.D(e.v.sky["fog-ground-blend"]),"horizon-fog-blend":new e.D(e.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new e.D(e.v.sky["sky-horizon-blend"]),"atmosphere-blend":new e.D(e.v.sky["atmosphere-blend"])});class A extends e.E{constructor(t){super(),this._transitionable=new e.T(C),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new e.C(0))}setSky(t,i={}){if(!this._validate(e.F,t,i)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const e in t){const i=t[e];e.endsWith("-transition")?this._transitionable.setTransition(e.slice(0,-11),i):this._transitionable.setValue(e,i)}}}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,i,r={}){return!1!==(null==r?void 0:r.validate)&&e.x(this,t.call(e.y,e.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.v})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class E{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){const i=t.join(",")+String(e);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(t,e)),this.dashEntry[i]}getDashRanges(t,e,i){const r=[];let n=t.length%2==1?-t[t.length-1]*i:0,s=t[0]*i,o=!0;r.push({left:n,right:s,isDash:o,zeroLength:0===t[0]});let a=t[0];for(let l=1;l<t.length;l++){o=!o;const e=t[l];n=a*i,a+=e,s=a*i,r.push({left:n,right:s,isDash:o,zeroLength:0===e})}return r}addRoundDash(t,e,i){const r=e/2;for(let n=-i;n<=i;n++){const e=this.width*(this.nextRow+i+n);let s=0,o=t[s];for(let a=0;a<this.width;a++){a/o.right>1&&(o=t[++s]);const l=Math.abs(a-o.left),c=Math.abs(a-o.right),h=Math.min(l,c);let u;const d=n/i*(r+1);if(o.isDash){const t=r-Math.abs(d);u=Math.sqrt(h*h+t*t)}else u=r-Math.sqrt(h*h+d*d);this.data[e+a]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(t){for(let o=t.length-1;o>=0;--o){const e=t[o],i=t[o+1];e.zeroLength?t.splice(o,1):i&&i.isDash===e.isDash&&(i.left=e.left,t.splice(o,1))}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const r=this.width*this.nextRow;let n=0,s=t[n];for(let o=0;o<this.width;o++){o/s.right>1&&(s=t[++n]);const e=Math.abs(o-s.left),i=Math.abs(o-s.right),a=Math.min(e,i);this.data[r+o]=Math.max(0,Math.min(255,(s.isDash?a:-a)+128))}}addDash(t,i){const r=i?7:0,n=2*r+1;if(this.nextRow+n>this.height)return e.w("LineAtlas out of space"),null;let s=0;for(let e=0;e<t.length;e++)s+=t[e];if(0!==s){const e=this.width/s,n=this.getDashRanges(t,this.width,e);i?this.addRoundDash(n,e,r):this.addRegularDash(n)}const o={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:s};return this.nextRow+=n,this.dirty=!0,o}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}const z="maplibre_preloaded_worker_pool";class k{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<k.workerCount;)this.workers.push(new Worker(e.a.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEac
2h((t=>{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[z]}numActive(){return Object.keys(this.active).length}}const D=Math.floor(o.hardwareConcurrency/2);let R,L;function F(){return R||(R=new k),R}k.workerCount=e.G(globalThis)?Math.max(Math.min(D,3),1):1;class B{constructor(t,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;const r=this.workerPool.acquire(i);for(let n=0;n<r.length;n++){const t=new e.H(r[n],i);t.name=`Worker ${n}`,this.actors.push(t)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,e){const i=[];for(const r of this.actors)i.push(r.sendAsync({type:t,data:e}));return Promise.all(i)}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,e){for(const i of this.actors)i.registerMessageHandler(t,e)}}function O(){return L||(L=new B(F(),e.J),L.registerMessageHandler("GR",((t,i,r)=>e.m(i,r)))),L}function j(t,i){const r=e.K();return e.L(r,r,[1,1,0]),e.M(r,r,[.5*t.width,.5*t.height,1]),t.calculatePosMatrix?e.N(r,r,t.calculatePosMatrix(i.toUnwrapped())):r}function V(t,e,i,r,n,s,o){var a;const l=function(t,e,i){if(t)for(const r of t){const t=e[r];if(t&&t.source===i&&"fill-extrusion"===t.type)return!0}else for(const r in e){const t=e[r];if(t.source===i&&"fill-extrusion"===t.type)return!0}return!1}(null!==(a=null==n?void 0:n.layers)&&void 0!==a?a:null,e,t.id),c=s.maxPitchScaleFactor(),h=t.tilesIn(r,c,l);h.sort(N);const u=[];for(const d of h)u.push({wrappedTileID:d.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(e,i,t._state,d.queryGeometry,d.cameraQueryGeometry,d.scale,n,s,c,j(t.transform,d.tileID),o?(t,e)=>o(d.tileID,t,e):void 0)});return function(t,e){for(const i in t)for(const r of t[i])Z(r,e);return t}(function(t){const e={},i={};for(const r of t){const t=r.queryResults,n=r.wrappedTileID,s=i[n]=i[n]||{};for(const i in t){const r=t[i],n=s[i]=s[i]||{},o=e[i]=e[i]||[];for(const t of r)n[t.featureIndex]||(n[t.featureIndex]=!0,o.push(t))}}return e}(u),t)}function N(t,e){const i=t.tileID,r=e.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function Z(t,e){const i=t.feature,r=e.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}function U(t,i,r){return e._(this,void 0,void 0,(function*(){let n=t;if(t.url?n=(yield e.j(i.transformRequest(t.url,"Source"),r)).data:yield o.frameAsync(r),!n)return null;const s=e.O(e.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 G{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):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 e.Q?new e.Q(t.lng,t.lat):e.Q.convert(t),this}setSouthWest(t){return this._sw=t instanceof e.Q?new e.Q(t.lng,t.lat):e.Q.convert(t),this}extend(t){const i=this._sw,r=this._ne;let n,s;if(t instanceof e.Q)n=t,s=t;else{if(!(t instanceof G))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(G.convert(t)):this.extend(e.Q.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(e.Q.convert(t)):this;if(n=t._sw,s=t._ne,!n||!s)return this}return i||r?(i.lng=Math.min(n.lng,i.lng),i.lat=Math.min(n.lat,i.lat),r.lng=Math.max(s.lng,r.lng),r.lat=Math.max(s.lat,r.lat)):(this._sw=new e.Q(n.lng,n.lat),this._ne=new e.Q(s.lng,s.lat)),this}getCenter(){return new e.Q((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 e.Q(this.getWest(),this.getNorth())}getSouthEast(){return new e.Q(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:i,lat:r}=e.Q.convert(t);let n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(t){return t instanceof G?t:t?new G(t):t}static fromLngLat(t,i=0){const r=360*i/40075017,n=r/Math.cos(Math.PI/180*t.lat);return new G(new e.Q(t.lng-n,t.lat-r),new e.Q(t.lng+n,t.lat+r))}adjustAntiMeridian(){const t=new e.Q(this._sw.lng,this._sw.lat),i=new e.Q(this._ne.lng,this._ne.lat);return new G(t,t.lng>i.lng?new e.Q(i.lng+360,i.lat):i)}}class ${constructor(t,e,i){this.bounds=G.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24}
2validateBounds(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){const i=Math.pow(2,t.z),r=Math.floor(e.U(this.bounds.getWest())*i),n=Math.floor(e.S(this.bounds.getNorth())*i),s=Math.ceil(e.U(this.bounds.getEast())*i),o=Math.ceil(e.S(this.bounds.getSouth())*i);return t.x>=r&&t.x<s&&t.y>=n&&t.y<o}}class q extends e.E{constructor(t,i,r,n){if(super(),this.id=t,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.e(this,e.O(i,["url","scheme","tileSize","promoteId"])),this._options=e.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield U(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t&&(e.e(this,t),t.bounds&&(this.tileBounds=new $(t.bounds,this.minzoom,this.maxzoom)),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.l("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new e.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 e.e({},this._options)}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(e,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
2ype,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise(((e,i)=>{t.reloadPromise={resolve:e,reject:i}}))}else t.actor=this.dispatcher.getActor(),r="LT";t.abortController=new AbortController;try{const e=yield t.actor.sendAsync({type:r,data:i},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,e)}catch(e){if(delete t.abortController,t.aborted)return;if(e&&404!==e.status)throw e;this._afterTileLoadWorkerResponse(t,null)}}))}_afterTileLoadWorkerResponse(t,e){if(e&&e.resourceTiming&&(t.resourceTiming=e.resourceTiming),e&&this.map._refreshExpiredTiles&&t.setExpiryData(e),t.loadVectorData(e,this.map.painter),t.reloadPromise){const e=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(e.resolve).catch(e.reject)}}abortTile(t){return e._(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 e._(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 W extends e.E{constructor(t,i,r,n){super(),this.id=t,this.dispatcher=r,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=e.e({type:"raster"},i),e.e(this,e.O(i,["url","scheme","tileSize"]))}load(){return e._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield U(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(e.e(this,i),i.bounds&&(this.tileBounds=new $(i.bounds,this.minzoom,this.maxzoom)),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this.fire(new e.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 e.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const i=yield f.getImage(this.map._requestManager.transformRequest(e,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i&&i.data){this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const e=this.map.painter.context,r=e.gl,n=i.data;t.texture=this.map.painter.getTileTexture(n.width),t.texture?t.texture.update(n,{useMipmap:!0}):(t.texture=new y(e,n,r.RGBA,{useMipmap:!0}),t.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}}))}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class H extends W{constructor(t,i,r,n){super(t,i,r,n),this.type="raster-dem",this.maxzoom=22,this._options=e.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(t){return e._(this,void 0,void 0,(function*(){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this.map._requestManager.transformRequest(i,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const i=yield f.getImage(r,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i&&i.data){const r=i.data;this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const n=e.b(r)&&e.V()?r:yield this.readImageNow(r),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();const e=yield t.actor.sendAsync({type:"LDT",data:s});t.dem=e,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}
2catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}}))}readImageNow(t){return e._(this,void 0,void 0,(function*(){if("undefined"!=typeof VideoFrame&&e.W()){const i=t.width+2,r=t.height+2;try{return new e.R({width:i,height:r},yield e.X(t,-1,-1,i,r))}catch(t){}}return o.getImageData(t,1)}))}_getNeighboringTiles(t){const i=t.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,s=0===i.x?t.wrap-1:t.wrap,o=(i.x+1+r)%r,a=i.x+1===r?t.wrap+1:t.wrap,l={};return l[new e.Y(t.overscaledZ,s,i.z,n,i.y).key]={backfilled:!1},l[new e.Y(t.overscaledZ,a,i.z,o,i.y).key]={backfilled:!1},i.y>0&&(l[new e.Y(t.overscaledZ,s,i.z,n,i.y-1).key]={backfilled:!1},l[new e.Y(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.Y(t.overscaledZ,a,i.z,o,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new e.Y(t.overscaledZ,s,i.z,n,i.y+1).key]={backfilled:!1},l[new e.Y(t.overscaledZ,t.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new e.Y(t.overscaledZ,a,i.z,o,i.y+1).key]={backfilled:!1}),l}unloadTile(t){return e._(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}}))}))}}class X extends e.E{constructor(t,i,r,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._pendingLoads=0,this.actor=r.getActor(),this.setEventedParent(n),this._data=i.data,this._options=e.e({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,void 0!==i.clusterMaxZoom&&this.maxzoom<=i.clusterMaxZoom&&e.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=e.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==i.buffer?i.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==i.tolerance?i.tolerance:.375),extent:e.Z,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:e.Z,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(t){return t*(e.Z/this.tileSize)}load(){return e._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}getData(){return e._(this,void 0,void 0,(function*(){const t=e.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})}))}getCoordinatesFromGeometry(t){return"GeometryCollection"===t.type?t.geometries.map((t=>t.coordinates)).flat(1/0):t.coordinates.flat(1/0)}getBounds(){return e._(this,void 0,void 0,(function*(){const t=new G,e=yield this.getData();let i;switch(e.type){case"FeatureCollection":i=e.features.map((t=>this.getCoordinatesFromGeometry(t.geometry))).flat(1/0);break;case"Feature":i=this.getCoordinatesFromGeometry(e.geometry);break;default:i=this.getCoordinatesFromGeometry(e)}if(0==i.length)return t;for(let r=0;r<i.length-1;r+=2)t.extend([i[r],i[r+1]]);return t}))}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(void 0!==t.clusterRadius&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),void 0!==t.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),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.t
2ype,clusterId:t,source:this.id}})}getClusterLeaves(t,e,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:e,offset:i}})}_updateWorkerData(t){return e._(this,void 0,void 0,(function*(){const i=e.e({type:this.type},this.workerOptions);t?i.dataDiff=t:"string"==typeof this._data?(i.request=this.map._requestManager.transformRequest(o.resolveURL(this._data),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new e.l("dataloading",{dataType:"source"}));try{const t=yield this.actor.sendAsync({type:"LD",data:i});if(this._pendingLoads--,this._removed||t.abandoned)return void this.fire(new e.l("dataabort",{dataType:"source"}));let r=null;t.resourceTiming&&t.resourceTiming[this.id]&&(r=t.resourceTiming[this.id].slice(0));const n={dataType:"source"};this._collectResourceTiming&&r&&r.length>0&&e.e(n,{resourceTiming:r}),this.fire(new e.l("data",Object.assign(Object.assign({},n),{sourceDataType:"metadata"}))),this.fire(new e.l("data",Object.assign(Object.assign({},n),{sourceDataType:"content"})))}catch(t){if(this._pendingLoads--,this._removed)return void this.fire(new e.l("dataabort",{dataType:"source"}));this.fire(new e.k(t))}}))}loaded(){return 0===this._pendingLoads}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.actor?"RT":"LT";t.actor=this.actor;const i={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;const r=yield this.actor.sendAsync({type:e,data:i},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(r,this.map.painter,"RT"===e)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return e._(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 e.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class K extends e.E{constructor(t,e,i,r){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=e}load(t){return e._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const e=yield f.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,e&&e.data&&(this.image=e.data,t&&(this.coordinates=t),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,this.fire(new e.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):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const i=t.map(e.$.fromLngLat);var r;return this.tileID=function(t){let i=1/0,r=1/0,n=-1/0,s=-1/0;for(const e of t)i=Math.min(i,e.x),r=Math.min(r,e.y),n=Math.max(n,e.x),s=Math.max(s,e.y);const o=Math.max(n-i,s-r),a=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),l=Math.pow(2,a);return new e.a1(a,Math.floor((i+n)/2*l),Math.floor((r+s)/2*l))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.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 e.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,i=t.gl;this.texture||(this.texture=new y(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new e.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return e._(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 i=1/0,r=1/0,n=-1/0,s=-1/0;for(const e of t)i=Math.min(i,e.x),r=Math.min(r,e.y),n=Math.max(n,e.x),s=Math.max(s,e.y);const o={};for(let a=0;a<=e.a0;a++){const t=Math.pow(2,a),e=Math.floor(i*t),l=Math.floor(r*t),c=Math.floor(n*t),h=Math.floor(s*t);o[a]={minTileX:e,minTileY:l,maxTileX:c,maxTileY:h}}return o}}class Y extends K{constructor(t,e,i,r){super(t,e,i,r),this.roundZoom=!0,this.type="video",this.options=e}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const e of t.urls)this.urls.push(this.map._requestManager.transformRequest(e,"Source").url);try{const t=yield e.a2(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 e.k(t))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const i=this.video.seekable;t<i.start(0)||t>i.end(0)?this.fire(new e.k(new e.a3(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.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;const t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new y(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new e.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 J extends K{constructor(t,i,r,n){super(t,i,r,n),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new e.k(new e.a3(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.k(new e.a3(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new e.k(new e.a3(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new e.k(new e.a3(`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 e.k(new e.a3(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){return e._(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 e.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,r=i.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new y(i,this.canvas,r.RGBA,{premultiply:!0});let n=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,n=!0)}n&&this.fire(new e.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Q={},tt=t=>{switch(t){case"geojson":return X;case"image":return K;case"raster":return W;case"raster-dem":return H;case"vector":return q;case"video":return Y;case"canvas":return J}return Q[t]},et="RTLPluginLoaded";class it extends e.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=O()}_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 e._(this,arguments,void 0,(function*(t,e=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=o.resolveURL(t),!this.url)throw new Error(`requested url ${t}
2 is invalid`);if("unavailable"===this.status){if(!e)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()}))}_requestImport(){return e._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new e.l(et))}))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let rt=null;function nt(){return rt||(rt=new it),rt}class st{constructor(t,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=e.a4(),this.uses=0,this.tileSize=i,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"}registerFadeDuration(t){const e=t+this.timeAdded;e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,i,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){const i={};if(!e)return i;for(const r of t){const t=r.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){r.layers=t,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=r}}return i}(t.buckets,null==i?void 0:i.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.a6){if(this.hasSymbolBuckets=!0,!r)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.a6&&i.hasRTLText){this.hasRTLText=!0,nt().lazyLoad();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new e.a5}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const i in this.buckets){const e=this.buckets[i];e.uploadPending()&&e.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new y(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new y(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,r,n,s,o,a,l,c,h){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:s,tileSize:this.tileSize,pixelPosMatrix:c,transform:a,params:o,queryPadding:this.queryPadding*l,getElevation:h},t,e,i):{}}querySourceFeatures(t,i){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const n=r.loadVTLayers(),s=i&&i.sourceLayer?i.sourceLayer:"",o=n._geojsonTileLayer||n[s];if(!o)return;const a=e.a7(i&&i.filter),{z:l,x:c,y:h}=this.tileID.canonical,u={z:l,x:c,y:h};for(let d=0;d<o.length;d++){const i=o.feature(d);if(a.needGeometry){const t=e.a8(i,!0);if(!a.filter(new e.C(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!a.filter(new e.C(this.tileID.overscaledZ),i))continue;const n=r.getId(i,s),p=new e.a9(i,l,c,h,n);p.tile=u,t.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const i=this.expirationTime;if(t.cacheControl){const i=e.aa(t.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(i)if(this.expirationTime<i)e=!0;else{const r=this.expirationTime-i;r?this.expirationTime=t+Math.max(r,3e4):e=!0}else e=!0;e?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const r in this.buckets){if(!e.style.hasLayer(r))continue;const n=this.buckets[r],s=n.layers[0].sourceLayer||"_geojsonTileLayer",o=i[s],a=t[s];if(!o||!a||0===Object.keys(a).length)continue;n.update(a,o,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<o.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=o.now()+t}
2setDependencies(t,e){const i={};for(const r of e)i[r]=!0;this.dependencies[t]=i}hasDependency(t,e){for(const i of t){const t=this.dependencies[i];if(t)for(const i of e)if(t[i])return!0}return!1}}class ot{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){const r=t.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const n={value:e,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout((()=>{this.remove(t,n)}),i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const 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){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,r=void 0===e?0:this.data[i].indexOf(e),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const i in this.data)for(const r of this.data[i])t(r.value)||e.push(r);for(const i of e)this.remove(i.value.tileID,i)}}class at{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,i,r){const n=String(i);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},e.e(this.stateChanges[t][n],r),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==n&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][n]){this.deletedStates[t][n]={};for(const e in this.state[t][n])r[e]||(this.deletedStates[t][n][e]=null)}else for(const e in r)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][e]&&delete this.deletedStates[t][n][e]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const r=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][r]&&(this.deletedStates[t][r]=this.deletedStates[t][r]||{},this.deletedStates[t][r][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][r])for(i in this.deletedStates[t][r]={},this.stateChanges[t][r])this.deletedStates[t][r][i]=null;else this.deletedStates[t][r]=null;else this.deletedStates[t]=null}getState(t,i){const r=String(i),n=e.e({},(this.state[t]||{})[r],(this.stateChanges[t]||{})[r]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){const e=this.deletedStates[t][i];if(null===e)return{};for(const t in e)delete n[t]}return n}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,i){const r={};for(const n in this.stateChanges){this.state[n]=this.state[n]||{};const t={};for(const i in this.stateChanges[n])this.state[n][i]||(this.state[n][i]={}),e.e(this.state[n][i],this.stateChanges[n][i]),t[i]=this.state[n][i];r[n]=t}for(const n in this.deletedStates){this.state[n]=this.state[n]||{};const t={};if(null===this.deletedStates[n])for(const e in this.state[n])t[e]={},this.state[n][e]={};else for(const e in this.deletedStates[n]){if(null===this.deletedStates[n][e])this.state[n][e]={};else for(const t of Object.keys(this.deletedStates[n][e]))delete this.state[n][e][t];t[e]=this.state[n][e]}r[n]=r[n]||{},e.e(r[n],t)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const e in t)t[e].setFeatureState(r,i)}}function lt(t,e,i){const r=e.intersectsFrustum(t);if(!i)return r;const n=e.intersectsPlane(i);return 0===r||0===n?0:2===r&&2===n?2:1}function ct(t,i,r,n,s){let o=t;const a=Math.atan(i/r),l=Math.hypot(i,r);return o=t+e.ab(n/l/Math.max(.5,Math.cos(e.ad(s/2)))),o+=1*e.ab(Math.cos(a))/2,o+=e.ae(t-o,-0,0),o}function ht(t,i){const r=(i.roundZoom?Math.round:Math.floor)(t.zoom+e.ab(t.tileSize/i.tileSize));return Math.max(0,r)}function ut(t,i){const r=t.getCameraFrustum(),n=t.getClippingPlane(),s=t.screenPointToMercatorCoordinate(t.getCameraPoint()),o=e.$.fromLngLat(t.center,t.elevation);s.z=o.z+Math.cos(t.pitchInRadians)*t.cameraToCenterDistance/t.worldSize;const a=t.getCoveringTilesDetailsProvider(),l=a.allowVariableZoom(t,i),c=ht(t,i),h=i.minzoom||0,u=void 0!==i.maxzoom?i.maxzoom:t.maxZoom,d=Math.min(Math.max(0,c),u),p=Math.pow(2,d),f=[p*s.x,p*s.y,0],m=[p*o.x,p*o.y,0],_=Math.hypot(o.x-s.x,o.y-s.y),g=Math.abs(o.z-s.z),y=Math.hypot(_,g),x=t=>({zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),v=[],b=[];if(t.renderWorldCopies&&a.allowWorldCopies())for(let e=1;e<=3;e++)v.push(x(-e)),v.push(x(e));for(v.push(x(0));v.length>0;){const p=v.pop(),_=p.x,x=p.y;let w=p.fullyVisible;const T={x:_,y:x,z:p.zoom},P=a.getTileAABB(T,p.wrap,t.elevation,i);if(!w){const t=lt(r,P,n);if(0===t)continue;w=2===t}const M=a.distanceToTile2d(s.x,s.y,T,P);let S=c;l&&(S=(i.calculateTileZoom||ct)(t.zoom+e.ab(t.tileSize/i.tileSize),M,g,y,t.fov)),S=(i.roundZoom?Math.round:Math.floor)(S),S=Math.max(0,S);const I=Math.min(S,u);
2if(p.wrap=a.getWrap(o,T,p.wrap),p.zoom>=I){if(p.zoom<h)continue;const t=d-p.zoom,r=f[0]-.5-(_<<t),n=f[1]-.5-(x<<t),s=i.reparseOverscaled?Math.max(p.zoom,S):p.zoom;b.push({tileID:new e.Y(p.zoom===u?s:p.zoom,p.wrap,p.zoom,_,x),distanceSq:e.ac([m[0]-.5-_,m[1]-.5-x]),tileDistanceToCamera:Math.sqrt(r*r+n*n)})}else for(let t=0;t<4;t++)v.push({zoom:p.zoom+1,x:(_<<1)+t%2,y:(x<<1)+(t>>1),wrap:p.wrap,fullyVisible:w})}return b.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}class dt extends e.E{constructor(t,e,i){super(),this.id=t,this.dispatcher=i,this.on("data",(t=>this._dataHandler(t))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((t,e,i,r)=>{const n=new(tt(e.type))(t,e,i,r);if(n.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${n.id}`);return n})(t,e,i,this),this._tiles={},this._cache=new ot(0,(t=>this._unloadTile(t))),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new at,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){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!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(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,i,r){return e._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,i,r)}catch(i){t.state="errored",404!==i.status?this._source.fire(new e.k(i,{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 e.l("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(pt).map((t=>t.key))}getRenderableIds(t){const i=[];for(const e in this._tiles)this._isIdRenderable(e,t)&&i.push(this._tiles[e]);return t?i.sort(((t,i)=>{const r=t.tileID,n=i.tileID,s=new e.P(r.canonical.x,r.canonical.y)._rotate(-this.transform.bearingInRadians),o=new e.P(n.canonical.x,n.canonical.y)._rotate(-this.transform.bearingInRadians);return r.overscaledZ-n.overscaledZ||o.y-s.y||o.x-s.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(pt).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(t){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)(t||"errored"!==this._tiles[e].state)&&this._reloadTile(e,"reloading")}}_reloadTile(t,i){return e._(this,void 0,void 0,(function*(){const e=this._tiles[t];e&&("loading"!==e.state&&(e.state=i),yield this._loadTile(e,t,i))}))}_tileLoaded(t,i,r){t.timeAdded=o.now(),"expired"===r&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),"raster-dem"===this.getSource().type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new e.l("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let r=0;r<e.length;r++){const n=e[r];if(t.neighboringTiles&&t.neighboringTiles[n]){const e=this.getTileByID(n);i(t,e),i(e,t)}}function i(t,e){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let i=e.tileID.canonical.x-t.tileID.canonical.x;const r=e.tileID.canonical.y-t.tileID.canonical.y,n=Math.pow(2,t.tileID.canonical.z),s=e.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,r),t.neighboringTiles&&t.neighboringTiles[s]&&(t.neighboringTiles[s].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,r){for(const n in this._tiles){let s=this._tiles[n];if(r[n]||!s.hasData()||s.tileID.overscaledZ<=e||s.tileID.overscaledZ>i)continue;let o=s.tileID;for(;s&&s.tileID.overscaledZ>e+1;){const t=s.tileID.scaledTo(s.tileID.overscaledZ-1);s=this._tiles[t.key],s&&s.hasData()&&(o=t)}let a=o;for(;a.overscaledZ>e;)if(a=a.scaledTo(a.overscaledZ-1),t[a.key]||t[a.canonical.key]){r[o.key]=o;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),r=this._getLoadedTile(e);
2if(r)return r}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const i=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(i*r*(null===this._maxTileCacheZoomLevels?e.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),s="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(s)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(e,this._tiles[e])}}_updateCoveredAndRetainedTiles(t,e,i,r,n,s){const a={},l={},c=Object.keys(t),h=o.now();for(const o of c){const i=t[o],r=this._tiles[o];if(!r||0!==r.fadeEndTime&&r.fadeEndTime<=h)continue;const n=this.findLoadedParent(i,e),s=this.findLoadedSibling(i),c=n||s||null;c&&(this._addTile(c.tileID),a[c.tileID.key]=c.tileID),l[o]=i}this._retainLoadedChildren(l,r,i,t);for(const o in a)t[o]||(this._coveredTiles[o]=!0,t[o]=a[o]);if(s){const e={},i={};for(const t of n)this._tiles[t.key].hasData()?e[t.key]=t:i[t.key]=t;for(const r in i){const n=i[r].children(this._source.maxzoom);this._tiles[n[0].key]&&this._tiles[n[1].key]&&this._tiles[n[2].key]&&this._tiles[n[3].key]&&(e[n[0].key]=t[n[0].key]=n[0],e[n[1].key]=t[n[1].key]=n[1],e[n[2].key]=t[n[2].key]=n[2],e[n[3].key]=t[n[3].key]=n[3],delete i[r])}for(const r in i){const n=i[r],s=this.findLoadedParent(n,this._source.minzoom),o=this.findLoadedSibling(n),a=s||o||null;if(a){e[a.tileID.key]=t[a.tileID.key]=a.tileID;for(const t in e)e[t].isChildOf(a.tileID)&&delete e[t]}}for(const t in this._tiles)e[t]||(this._coveredTiles[t]=!0)}}update(t,i){if(!this._sourceLoaded||this._paused)return;let r;this.transform=t,this.terrain=i,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new e.Y(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y))):(r=ut(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter((t=>this._source.hasTile(t))))):r=[];const n=ht(t,this._source),s=Math.max(n-dt.maxOverzooming,this._source.minzoom),o=Math.max(n+dt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of r)if(e.canonical.z>this._source.minzoom){const i=e.scaledTo(e.canonical.z-1);t[i.key]=i;const r=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[r.key]=r}r=r.concat(Object.values(t))}const a=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new e.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(r,n);ft(this._source.type)&&this._updateCoveredAndRetainedTiles(l,s,o,n,r,i);for(const e in l)this._tiles[e].clearFadeHold();const c=e.af(this._tiles,l);for(const e of c){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(e)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){var i;const r={},n={},s=Math.max(e-dt.maxOverzooming,this._source.minzoom),o=Math.max(e+dt.maxUnderzooming,this._source.minzoom),a={};for(const l of t){const t=this._addTile(l);r[l.key]=l,t.hasData()||e<this._source.maxzoom&&(a[l.key]=l)}this._retainLoadedChildren(a,e,o,r);for(const l of t){let t=this._tiles[l.key];if(t.hasData())continue;if(e+1>this._source.maxzoom){const t=l.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){r[t.key]=t;continue}}else{const t=l.children(this._source.maxzoom);
2if(r[t[0].key]&&r[t[1].key]&&r[t[2].key]&&r[t[3].key])continue}let o=t.wasRequested();for(let e=l.overscaledZ-1;e>=s;--e){const s=l.scaledTo(e);if(n[s.key])break;if(n[s.key]=!0,t=this.getTile(s),!t&&o&&(t=this._addTile(s)),t){const e=t.hasData();if((e||!(null===(i=this.map)||void 0===i?void 0:i.cancelPendingTileRequestsWhileZooming)||o)&&(r[s.key]=s),o=t.wasRequested(),e)break}}}return r}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,r=this._tiles[t].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}e.push(r.key);const t=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;r=t}for(const t of e)this._loadedParentTiles[t]=i}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const e=this._tiles[t].tileID,i=this._getLoadedTile(e);this._loadedSiblingTiles[e.key]=i}}_addTile(t){let i=this._tiles[t.key];if(i)return i;i=this._cache.getAndRemove(t),i&&(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));const r=i;return i||(i=new st(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(i,t.key,i.state)),i.uses++,this._tiles[t.key]=i,r||this._source.fire(new e.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),i))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}_dataHandler(t){const e=t.sourceDataType;"source"===t.dataType&&"metadata"===e&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===e&&(this.reload(t.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,i,r){const n=[],s=this.transform;if(!s)return n;const o=r?s.getCameraQueryGeometry(t):t,a=t.map((t=>s.screenPointToMercatorCoordinate(t,this.terrain))),l=o.map((t=>s.screenPointToMercatorCoordinate(t,this.terrain))),c=this.getIds();let h=1/0,u=1/0,d=-1/0,p=-1/0;for(const e of l)h=Math.min(h,e.x),u=Math.min(u,e.y),d=Math.max(d,e.x),p=Math.max(p,e.y);for(let f=0;f<c.length;f++){const t=this._tiles[c[f]];if(t.holdingForFade())continue;const r=t.tileID,o=Math.pow(2,s.zoom-t.tileID.overscaledZ),m=i*t.queryPadding*e.Z/t.tileSize/o,_=[r.getTilePoint(new e.$(h,u)),r.getTilePoint(new e.$(d,p))];if(_[0].x-m<e.Z&&_[0].y-m<e.Z&&_[1].x+m>=0&&_[1].y+m>=0){const e=a.map((t=>r.getTilePoint(t))),i=l.map((t=>r.getTilePoint(t)));n.push({tile:t,tileID:r,queryGeometry:e,cameraQueryGeometry:i,scale:o})}}return n}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));return this.transform&&this.transform.populateCache(e),e}hasTransition(){if(this._source.hasTransition())return!0;if(ft(this._source.type)){const t=o.now();for(const e in this._tiles)if(this._tiles[e].fadeEndTime>=t)return!0}return!1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const r=this._tiles[t];r&&r.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter((i=>!i.hasDependency(t,e)))}}
2function pt(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function ft(t){return"raster"===t||"image"===t||"video"===t}dt.maxOverzooming=10,dt.maxUnderzooming=3;class mt{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=e.ae(t,0,1);let i=1,r=this._distances[i];const n=t*this.paddedLength+this.padding;for(;r<n&&i<this._distances.length;)r=this._distances[++i];const s=i-1,o=this._distances[s],a=r-o,l=a>0?(n-o)/a:0;return this.points[s].mult(1-l).add(this.points[i].mult(l))}}function _t(t,e){let i=!0;return"always"===t||"never"!==t&&"never"!==e||(i=!1),i}class gt{constructor(t,e,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let s=0;s<this.xCellCount*this.yCellCount;s++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(t,e,i,r){this._forEachCell(e-r,i-r,e+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(r)}_insertBoxCell(t,e,i,r,n,s){this.boxCells[n].push(s)}_insertCircleCell(t,e,i,r,n,s){this.circleCells[n].push(s)}_query(t,e,i,r,n,s,o){if(i<0||t>this.width||r<0||e>this.height)return[];const a=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:t,y1:e,x2:i,y2:r}];for(let t=0;t<this.boxKeys.length;t++)a.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++){const e=this.circles[3*t],i=this.circles[3*t+1],r=this.circles[3*t+2];a.push({key:this.circleKeys[t],x1:e-r,y1:i-r,x2:e+r,y2:i+r})}}else this._forEachCell(t,e,i,r,this._queryCell,a,{hitTest:n,overlapMode:s,seenUids:{box:{},circle:{}}},o);return a}query(t,e,i,r){return this._query(t,e,i,r,!1,null)}hitTest(t,e,i,r,n,s){return this._query(t,e,i,r,!0,n,s).length>0}hitTestCircle(t,e,i,r,n){const s=t-i,o=t+i,a=e-i,l=e+i;if(o<0||s>this.width||l<0||a>this.height)return!1;const c=[];return this._forEachCell(s,a,o,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:r,circle:{x:t,y:e,radiu
2s:i},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(t,e,i,r,n,s,o,a){const{seenUids:l,hitTest:c,overlapMode:h}=o,u=this.boxCells[n];if(null!==u){const n=this.bboxes;for(const o of u)if(!l.box[o]){l.box[o]=!0;const u=4*o,d=this.boxKeys[o];if(t<=n[u+2]&&e<=n[u+3]&&i>=n[u+0]&&r>=n[u+1]&&(!a||a(d))&&(!c||!_t(h,d.overlapMode))&&(s.push({key:d,x1:n[u],y1:n[u+1],x2:n[u+2],y2:n[u+3]}),c))return!0}}const d=this.circleCells[n];if(null!==d){const n=this.circles;for(const o of d)if(!l.circle[o]){l.circle[o]=!0;const u=3*o,d=this.circleKeys[o];if(this._circleAndRectCollide(n[u],n[u+1],n[u+2],t,e,i,r)&&(!a||a(d))&&(!c||!_t(h,d.overlapMode))){const t=n[u],e=n[u+1],i=n[u+2];if(s.push({key:d,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),c)return!0}}}return!1}_queryCellCircle(t,e,i,r,n,s,o,a){const{circle:l,seenUids:c,overlapMode:h}=o,u=this.boxCells[n];if(null!==u){const t=this.bboxes;for(const e of u)if(!c.box[e]){c.box[e]=!0;const i=4*e,r=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!a||a(r))&&!_t(h,r.overlapMode))return s.push(!0),!0}}const d=this.circleCells[n];if(null!==d){const t=this.circles;for(const e of d)if(!c.circle[e]){c.circle[e]=!0;const i=3*e,r=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!a||a(r))&&!_t(h,r.overlapMode))return s.push(!0),!0}}}_forEachCell(t,e,i,r,n,s,o,a){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(r);for(let d=l;d<=h;d++)for(let l=c;l<=u;l++)if(n.call(this,t,e,i,r,this.xCellCount*l+d,s,o,a))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,e,i,r,n,s){const o=r-t,a=n-e,l=i+s;return l*l>o*o+a*a}_circleAndRectCollide(t,e,i,r,n,s,o){const a=(s-r)/2,l=Math.abs(t-(r+a));if(l>a+i)return!1;const c=(o-n)/2,h=Math.abs(e-(n+c));if(h>c+i)return!1;if(l<=a||h<=c)return!0;const u=l-a,d=h-c;return u*u+d*d<=i*i}}function yt(t,i,n){const s=e.K();if(!t){const{vecSouth:t,vecEast:e}=vt(i),n=r();n[0]=e[0],n[1]=e[1],n[2]=t[0],n[3]=t[1],o=n,(d=(l=(a=n)[0])*(u=a[3])-(h=a[2])*(c=a[1]))&&(o[0]=u*(d=1/d),o[1]=-c*d,o[2]=-h*d,o[3]=l*d),s[0]=n[0],s[1]=n[1],s[4]=n[2],s[5]=n[3]}var o,a,l,c,h,u,d;return e.M(s,s,[1/n,1/n,1]),s}function xt(t,i,r,n){if(t){const t=e.K();if(!i){const{vecSouth:e,vecEast:i}=vt(r);t[0]=i[0],t[1]=i[1],t[4]=e[0],t[5]=e[1]}return e.M(t,t,[n,n,1]),t}return r.pixelsToClipSpaceMatrix}function vt(t){const i=Math.cos(t.rollInRadians),r=Math.sin(t.rollInRadians),n=Math.cos(t.pitchInRadians),s=Math.cos(t.bearingInRadians),o=Math.sin(t.bearingInRadians),a=e.ak();a[0]=-s*n*r-o*i,a[1]=-o*n*r+s*i;
2const l=e.al(a);l<1e-9?e.am(a):e.an(a,a,1/l);const c=e.ak();c[0]=s*n*i-o*r,c[1]=o*n*i+s*r;const h=e.al(c);return h<1e-9?e.am(c):e.an(c,c,1/h),{vecEast:c,vecSouth:a}}function bt(t,i,r,n){let s;n?(s=[t,i,n(t,i),1],e.ap(s,s,r)):(s=[t,i,0,1],Ot(s,s,r));const o=s[3];return{point:new e.P(s[0]/o,s[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function wt(t,e){return.5+t/e*.5}function Tt(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function Pt(t,i,r,n,s,o,a,l,c,h,u,d,p){const f=r?t.textSizeData:t.iconSizeData,m=e.ag(f,i.transform.zoom),_=[256/i.width*2+1,256/i.height*2+1],g=r?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;g.clear();const y=t.lineVertexArray,x=r?t.text.placedSymbolArray:t.icon.placedSymbolArray,v=i.transform.width/i.transform.height;let b=!1;for(let w=0;w<x.length;w++){const r=x.get(w);if(r.hidden||r.writingMode===e.ah.vertical&&!b){Bt(r.numGlyphs,g);continue}b=!1;const T=new e.P(r.anchorX,r.anchorY),P={getElevation:p,pitchedLabelPlaneMatrix:n,lineVertexArray:y,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:i.transform,tileAnchorPoint:T,unwrappedTileID:c,width:h,height:u,translation:d},M=kt(r.anchorX,r.anchorY,P);if(!Tt(M.point,_)){Bt(r.numGlyphs,g);continue}const S=wt(i.transform.cameraToCenterDistance,M.signedDistanceFromCamera),I=e.ai(f,m,r),C=o?I*i.transform.getPitchedTextCorrection(r.anchorX,r.anchorY,c)/S:I*S,A=It({projectionContext:P,pitchedLabelPlaneMatrixInverse:s,symbol:r,fontSize:C,flip:!1,keepUpright:a,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:l});b=A.useVertical,(A.notEnoughRoom||b||A.needsFlipping&&It({projectionContext:P,pitchedLabelPlaneMatrixInverse:s,symbol:r,fontSize:C,flip:!0,keepUpright:a,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:l}).notEnoughRoom)&&Bt(r.numGlyphs,g)}r?t.text.dynamicLayoutVertexBuffer.updateData(g):t.icon.dynamicLayoutVertexBuffer.updateData(g)}function Mt(t,e,i,r,n,s,o,a){const l=s.glyphStartIndex+s.numGlyphs,c=s.lineStartIndex,h=s.lineStartIndex+s.lineLength,u=e.getoffsetX(s.glyphStartIndex),d=e.getoffsetX(l-1),p=Lt(t*u,i,r,n,s.segment,c,h,a,o);if(!p)return null;const f=Lt(t*d,i,r,n,s.segment,c,h,a,o);return f?a.projectionCache.anyProjectionOccluded?null:{first:p,last:f}:null}function St(t,i,r,n){return t===e.ah.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*n?{useVertical:!0}:(t===e.ah.vertical?i.y<r.y:i.x>r.x)?{needsFlipping:!0}:null}function It(t){const{projectionContext:i,pitchedLabelPlaneMatrixInverse:r,symbol:n,fontSize:s,flip:o,keepUpright:a,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:h,rotateToLine:u}=t,d=s/24,p=n.lineOffsetX*d,f=n.lineOffsetY*d;let m;if(n.numGlyphs>1){const t=n.glyphStartIndex+n.numGlyphs,e=n.lineStartIndex,s=n.lineStartIndex+n.lineLength,c=Mt(d,l,p,f,o,n,u,i);if(!c)return{notEnoughRoom:!0};const _=zt(c.first.point.x,c.first.point.y,i,r),g=zt(c.last.point.x,c.last.point.y,i,r);if(a&&!o){const t=St(n.writingMode,_,g,h);if(t)return t}m=[c.first];for(let r=n.glyphStartIndex+1;r<t-1;r++)m.push(Lt(d*l.getoffsetX(r),p,f,o,n.segment,e,s,i,u));m.push(c.last)}else{if(a&&!o){const t=Et(i.tileAnchorPoint.x,i.tileAnchorPoint.y,i).point,s=n.lineStartIndex+n.segment+1,o=new e.P(i.lineVertexArray.getx(s),i.lineVertexArray.gety(s)),a=Et(o.x,o.y,i),l=a.signedDistanceFromCamera>0?a.point:Ct(i.tileAnchorPoint,o,t,1,i),c=zt(t.x,t.y,i,r),u=zt(l.x,l.y,i,r),d=St(n.writingMode,c,u,h);if(d)return d}const t=Lt(d*l.getoffsetX(n.glyphStartIndex),p,f,o,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,i,u);if(!t||i.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};m=[t]}for(const _ of m)e.ao(c,_.point,_.angle);return{}}function Ct(t,e,i,r,n){const s=t.add(t.sub(e)._unit()),o=Et(s.x,s.y,n).point,a=i.sub(o);return i.add(a._mult(r/a.mag()))}function At(t,i,r){const n=i.projectionCache;if(n.projections[t])return n.projections[t];const s=new e.P(i.lineVertexArray.getx(t),i.lineVertexArray.gety(t)),o=Et(s.x,s.y,i);if(o.signedDistanceFromCamera>0)return n.projections[t]=o.point,n.anyProjectionOccluded=n.anyProjectionOccluded||o.isOccluded,o.point;const a=t-r.direction;return Ct(0===r.distanceFromAnchor?i.tileAnchorPoint:new e.P(i.lineVertexArray.getx(a),i.lineVertexArray.gety(a)),s,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,i)}function Et(t,e,i){const r=t+i.translation[0],n=e+i.translation[1];let s;
2return i.pitchWithMap?(s=bt(r,n,i.pitchedLabelPlaneMatrix,i.getElevation),s.isOccluded=!1):(s=i.transform.projectTileCoordinates(r,n,i.unwrappedTileID,i.getElevation),s.point.x=(.5*s.point.x+.5)*i.width,s.point.y=(.5*-s.point.y+.5)*i.height),s}function zt(t,i,r,n){if(r.pitchWithMap){const s=[t,i,0,1];return e.ap(s,s,n),r.transform.projectTileCoordinates(s[0]/s[3],s[1]/s[3],r.unwrappedTileID,r.getElevation).point}return{x:t/r.width*2-1,y:i/r.height*2-1}}function kt(t,e,i){return i.transform.projectTileCoordinates(t,e,i.unwrappedTileID,i.getElevation)}function Dt(t,e,i){return t._unit()._perp()._mult(e*i)}function Rt(t,i,r,n,s,o,a,l,c){if(l.projectionCache.offsets[t])return l.projectionCache.offsets[t];const h=r.add(i);if(t+c.direction<n||t+c.direction>=s)return l.projectionCache.offsets[t]=h,h;const u=At(t+c.direction,l,c),d=Dt(u.sub(r),a,c.direction),p=r.add(d),f=u.add(d);return l.projectionCache.offsets[t]=e.aq(o,h,p,f)||h,l.projectionCache.offsets[t]}function Lt(t,e,i,r,n,s,o,a,l){const c=r?t-e:t+e;let h=c>0?1:-1,u=0;r&&(h*=-1,u=Math.PI),h<0&&(u+=Math.PI);let d,p=h>0?s+n:s+n+1;a.projectionCache.cachedAnchorPoint?d=a.projectionCache.cachedAnchorPoint:(d=Et(a.tileAnchorPoint.x,a.tileAnchorPoint.y,a).point,a.projectionCache.cachedAnchorPoint=d);let f,m,_=d,g=d,y=0,x=0;const v=Math.abs(c),b=[];let w;for(;y+x<=v;){if(p+=h,p<s||p>=o)return null;y+=x,g=_,m=f;const t={absOffsetX:v,direction:h,distanceFromAnchor:y,previousVertex:g};if(_=At(p,a,t),0===i)b.push(g),w=_.sub(g);else{let e;const r=_.sub(g);e=0===r.mag()?Dt(At(p+h,a,t).sub(_),i,h):Dt(r,i,h),m||(m=g.add(e)),f=Rt(p,e,_,s,o,m,i,a,t),b.push(m),w=f.sub(m)}x=w.mag()}const T=w._mult((v-y)/x)._add(m||g),P=u+Math.atan2(_.y-g.y,_.x-g.x);return b.push(T),{point:T,angle:l?P:0,path:b}}const Ft=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Bt(t,e){for(let i=0;i<t;i++){const t=e.length;e.resize(t+4),e.float32.set(Ft,3*t)}}function Ot(t,e,i){const r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t[3]=i[3]*r+i[7]*n+i[15],t}const jt=100;class Vt{constructor(t,e=new gt(t.width+200,t.height+200,25),i=new gt(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+jt,this.screenBottomBoundary=t.height+jt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,i,r,n,s,o,a,l,c,h,u){const d=this.projectAndGetPerspectiveRatio(t.anchorPointX+a[0],t.anchorPointY+a[1],n,c,u),p=i*d.perspectiveRatio;let f;if(s||o)f=this._projectCollisionBox(t,p,r,n,s,o,a,d,c,h,u);else{const e=d.x+(h?h.x*p:0),i=d.y+(h?h.y*p:0);f={allPointsOccluded:!1,box:[e+t.x1*p,i+t.y1*p,e+t.x2*p,i+t.y2*p]}}const[m,_,g,y]=f.box,x=s?f.allPointsOccluded:d.isOccluded;let v=x;return v||(v=d.perspectiveRatio<this.perspectiveRatioCutoff),v||(v=!this.isInsideGrid(m,_,g,y)),v||"always"!==e&&this.grid.hitTest(m,_,g,y,e,l)?{box:[m,_,g,y],placeable:!1,offscreen:!1,occluded:x}:{box:[m,_,g,y],placeable:!0,offscreen:this.isOffscreen(m,_,g,y),occluded:x}}placeCollisionCircles(t,i,r,n,s,o,a,l,c,h,u,d,p,f){const m=[],_=new e.P(i.anchorX,i.anchorY),g=this.getPerspectiveRatio(_.x,_.y,o,f),y=(c?s*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,o)/g:s*g)/e.av,x={getElevation:f,pitchedLabelPlaneMatrix:a,lineVertexArray:r,pitchWithMap:c,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:_,unwrappedTileID:o,width:this.transform.width,height:this.transform.height,translation:p},v=Mt(y,n,i.lineOffsetX*y,i.lineOffsetY*y,!1,i,!1,x);let b=!1,w=!1,T=!0;if(v){const i=.5*u*g+d,r=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),s=new mt,o=v.first,a=v.last;let p=[];for(let t=o.path.length-1;t>=1;t--)p.push(o.path[t]);for(let t=1;t<a.path.length;t++)p.push(a.path[t]);const f=2.5*i;if(c){const t=this.projectPathToScreenSpace(p,x);p=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let _=[];
2if(p.length>0){const t=p[0].clone(),i=p[0].clone();for(let e=1;e<p.length;e++)t.x=Math.min(t.x,p[e].x),t.y=Math.min(t.y,p[e].y),i.x=Math.max(i.x,p[e].x),i.y=Math.max(i.y,p[e].y);_=t.x>=r.x&&i.x<=n.x&&t.y>=r.y&&i.y<=n.y?[p]:i.x<r.x||t.x>n.x||i.y<r.y||t.y>n.y?[]:e.ar([p],r.x,r.y,n.x,n.y)}for(const e of _){s.reset(e,.25*i);let r=0;r=s.length<=.5*i?1:Math.ceil(s.paddedLength/f)+1;for(let e=0;e<r;e++){const n=e/Math.max(r-1,1),o=s.lerp(n),a=o.x+jt,c=o.y+jt;m.push(a,c,i,0);const u=a-i,d=c-i,p=a+i,f=c+i;if(T=T&&this.isOffscreen(u,d,p,f),w=w||this.isInsideGrid(u,d,p,f),"always"!==t&&this.grid.hitTestCircle(a,c,i,t,h)&&(b=!0,!l))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!l&&b||!w||g<this.perspectiveRatioCutoff?[]:m,offscreen:T,collisionDetected:b}}projectPathToScreenSpace(t,i){const r=function(t,i){const r=e.K();return e.aj(r,i.pitchedLabelPlaneMatrix),t.map((t=>{const e=bt(t.x,t.y,r,i.getElevation),n=i.transform.projectTileCoordinates(e.point.x,e.point.y,i.unwrappedTileID,i.getElevation);return n.point.x=(.5*n.point.x+.5)*i.width,n.point.y=(.5*-n.point.y+.5)*i.height,n}))}(t,i);return function(t){let e=0,i=0,r=0,n=0;for(let s=0;s<t.length;s++)t[s].isOccluded?(r=s+1,n=0):(n++,n>i&&(i=n,e=r));return t.slice(e,e+i)}(r)}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let r=1/0,n=1/0,s=-1/0,o=-1/0;for(const h of t){const t=new e.P(h.x+jt,h.y+jt);r=Math.min(r,t.x),n=Math.min(n,t.y),s=Math.max(s,t.x),o=Math.max(o,t.y),i.push(t)}const a=this.grid.query(r,n,s,o).concat(this.ignoredGrid.query(r,n,s,o)),l={},c={};for(const h of a){const t=h.key;if(void 0===l[t.bucketInstanceId]&&(l[t.bucketInstanceId]={}),l[t.bucketInstanceId][t.featureIndex])continue;const r=[new e.P(h.x1,h.y1),new e.P(h.x2,h.y1),new e.P(h.x2,h.y2),new e.P(h.x1,h.y2)];e.as(i,r)&&(l[t.bucketInstanceId][t.featureIndex]=!0,void 0===c[t.bucketInstanceId]&&(c[t.bucketInstanceId]=[]),c[t.bucketInstanceId].push(t.featureIndex))}return c}insertCollisionBox(t,e,i,r,n,s){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:s,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,r,n,s){const o=i?this.ignoredGrid:this.grid,a={bucketInstanceId:r,featureIndex:n,collisionGroupID:s,overlapMode:e};for(let l=0;l<t.length;l+=4)o.insertCircle(a,t[l],t[l+1],t[l+2])}projectAndGetPerspectiveRatio(t,i,r,n,s){if(s){let r;n?(r=[t,i,n(t,i),1],e.ap(r,r,s)):(r=[t,i,0,1],Ot(r,r,s));const o=r[3];return{x:(r[0]/o+1)/2*this.transform.width+jt,y:(-r[1]/o+1)/2*this.transform.height+jt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/o*.5,isOccluded:!1,signedDistanceFromCamera:o}}{const e=this.transform.projectTileCoordinates(t,i,r,n);return{x:(e.point.x+1)/2*this.transform.width+jt,y:(1-e.point.y)/2*this.transform.height+jt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/e.signedDistanceFromCamera*.5,isOccluded:e.isOccluded,signedDistanceFromCamera:e.signedDistanceFromCamera}}}getPerspectiveRatio(t,e,i,r){const n=this.transform.projectTileCoordinates(t,e,i,r);return.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(t,e,i,r){return i<jt||t>=this.screenRightBoundary||r<jt||e>this.screenBottomBoundary}isInsideGrid(t,e,i,r){return i>=0&&t<this.gridRightBoundary&&r>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const t=e.at([]);return e.L(t,t,[-100,-100,0]),t}_projectCollisionBox(t,i,r,n,s,o,a,l,c,h,u){let d=1,p=0,f=0,m=1;const _=t.anchorPointX+a[0],g=t.anchorPointY+a[1];if(o&&!s){const t=this.projectAndGetPerspectiveRatio(_+1,g,n,c,u),e=t.x-l.x,i=Math.atan((t.y-l.y)/e)+(e<0?Math.PI:0),r=Math.sin(i),s=Math.cos(i);d=s,p=r,f=-r,m=s}else if(!o&&s){const t=vt(this.transform);d=t.vecEast[0],p=t.vecEast[1],f=t.vecSouth[0],m=t.vecSouth[1]}let y=l.x,x=l.y,v=i;s&&(y=_,x=g,v=Math.pow(2,-(this.transform.zoom-r.overscaledZ)),v*=this.transform.getPitchedTextCorrection(_,g,n),h||(v*=e.ae(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),h&&(y+=d*h.x*v+f*h.y*v,x+=p*h.x*v+m*h.y*v);const b=t.x1*v,w=t.x2*v,T=(b+w)/2,P=t.y1*v,M=t.y2*v,S=(P+M)/2,I=[{offsetX:b,offsetY:P},{offsetX:T,offsetY:P},{offsetX:w,offsetY:P},{offsetX:w,offsetY:S},{offsetX:w,offsetY:M},{offsetX:T,offsetY:M},{offsetX:b,offsetY:M},{offsetX:b,offsetY:S}];let C=[];for(const{offsetX:E,offsetY:z}of I)C.push(new e.P(y+d*E+f*z,x+p*E+m*z));let A=!1;if(s){const t=C.map((t=>this.projectAndGetPerspectiveRatio(t.x,t.y,n,c,u)));A=t.some((t=>!t.isOccluded)),C=t.map((t=>new e.P(t.x,t.y)))}else A=!0;return{box:e.au(C),allPointsOccluded:!A}}}class Nt{constructor(t,e,i,r){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class Zt{constructor(t,e,i,r,n){this.text=new Nt(t?t.text:null,e,i,n),this.icon=new Nt(t?t.icon:null,e,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ut{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}}class Gt{constructor(t,e,i,r,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class $t{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function qt(t,i,r,n,s){const{horizontalAlign:o,verticalAlign:a}=e.aB(t);return new e.P(-(o-.5)*i+n[0]*s,-(a-.5)*r+n[1]*s)}class Wt{constructor(t,e,i,r,n){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new Vt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new $t(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const e=this.terrain;return e?(i,r)=>e.getElevation(t,i,r):null}getBucketParts(t,i,r,n){const s=r.getBucket(i),o=r.latestFeatureIndex;if(!s||!o||i.id!==s.layerIds[0])return;const a=r.collisionBoxArray,l=s.layers[0].layout,c=s.layers[0].paint,h=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ
2),u=r.tileSize/e.Z,d=r.tileID.toUnwrapped(),p="map"===l.get("text-rotation-alignment"),f=e.aw(r,1,this.transform.zoom),m=e.ax(this.collisionIndex.transform,r,c.get("text-translate"),c.get("text-translate-anchor")),_=e.ax(this.collisionIndex.transform,r,c.get("icon-translate"),c.get("icon-translate-anchor")),g=yt(p,this.transform,f);this.retainedQueryData[s.bucketInstanceId]=new Gt(s.bucketInstanceId,o,s.sourceLayerIndex,s.index,r.tileID);const y={bucket:s,layout:l,translationText:m,translationIcon:_,unwrappedTileID:d,pitchedLabelPlaneMatrix:g,scale:h,textPixelRatio:u,holdingForFade:r.holdingForFade(),collisionBoxArray:a,partiallyEvaluatedTextSize:e.ag(s.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(s.sourceID)};if(n)for(const e of s.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=e;t.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:s.symbolInstances.length,parameters:y})}attemptAnchorPlacement(t,i,r,n,s,o,a,l,c,h,u,d,p,f,m,_,g,y,x,v){const b=e.ay[t.textAnchor],w=[t.textOffset0,t.textOffset1],T=qt(b,r,n,w,s),P=this.collisionIndex.placeCollisionBox(i,d,l,c,h,a,o,_,u.predicate,x,T,v);if((!y||this.collisionIndex.placeCollisionBox(y,d,l,c,h,a,o,g,u.predicate,x,T,v).placeable)&&P.placeable){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(t=this.prevPlacement.variableOffsets[p.crossTileID].anchor),0===p.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:w,width:r,height:n,anchor:b,textBoxScale:s,prevAnchor:t},this.markUsedJustification(f,b,p,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,p),this.placedOrientations[p.crossTileID]=m),{shift:T,placedGlyphBoxes:P}}}placeLayerBucketPart(t,i,r){const{bucket:n,layout:s,translationText:o,translationIcon:a,unwrappedTileID:l,pitchedLabelPlaneMatrix:c,textPixelRatio:h,holdingForFade:u,collisionBoxArray:d,partiallyEvaluatedTextSize:p,collisionGroup:f}=t.parameters,m=s.get("text-optional"),_=s.get("icon-optional"),g=e.az(s,"text-overlap","text-allow-overlap"),y="always"===g,x=e.az(s,"icon-overlap","icon-allow-overlap"),v="always"===x,b="map"===s.get("text-rotation-alignment"),w="map"===s.get("text-pitch-alignment"),T="none"!==s.get("icon-text-fit"),P="viewport-y"===s.get("symbol-z-order"),M=y&&(v||!n.hasIconData()||_),S=v&&(y||!n.hasTextData()||m);!n.collisionArrays&&d&&n.deserializeCollisionBoxes(d);const I=this.retainedQueryData[n.bucketInstanceId].tileID,C=this._getTerrainElevationFunc(I),A=this.transform.getFastPathSimpleProjectionMatrix(I),E=(t,d,v)=>{var P,E;if(i[t.crossTileID])return;if(u)return void(this.placements[t.crossTileID]=new Ut(!1,!1,!1));let z=!1,k=!1,D=!0,R=null,L={box:null,placeable:!1,offscreen:null,occluded:!1},F={placeable:!1},B=null,O=null,j=null,V=0,N=0,Z=0;d.textFeatureIndex?V=d.textFeatureIndex:t.useRuntimeCollisionCircles&&(V=t.featureIndex),d.verticalTextFeatureIndex&&(N=d.verticalTextFeatureIndex);const U=d.textBox;if(U){const i=i=>{let r=e.ah.horizontal;if(n.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,r=e,this.markUsedOrientation(n,r,t))}return r},s=(i,r)=>{if(n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const t of n.writingModes)if(t===e.ah.vertical?(L=r(),F=L):L=i(),L&&L.placeable)break}else L=i()},c=t.textAnchorOffsetStartIndex,u=t.textAnchorOffsetEndIndex;if(u===c){const r=(e,i)=>{const r=this.collisionIndex.placeCollisionBox(e,g,h,I,l,w,b,o,f.predicate,C,void 0,A);return r&&r.placeable&&(this.markUsedOrientation(n,i,t),this.placedOrientations[t.crossTileID]=i),r};s((()=>r(U,e.ah.horizontal)),(()=>{const i=d.verticalTextBox;return n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&i?r(i,e.ah.vertical):{box:null,offscreen:null}})),i(L&&L.placeable)}else{let p=e.ay[null===(E=null===(P=this.prevPlacement)||void 0===P?void 0:P.variableOffsets[t.crossTileID])||void 0===E?void 0:E.anchor];const m=(e,i,s)=>{const d=e.x2-e.x1,m=e.y2-e.y1,_=t.textBoxScale,y=T&&"never"===x?i:null;let v=null,P="never"===g?1:2,M="never";p&&P++;for(let r=0;r<P;r++){for(let i=c;i<u;i++){const r=n.textAnchorOffsets.get(i);if(p&&r.textAnchor!==p)continue;const c=this.attemptAnchorPlacement(r,e,d,m,_,b,w,h,I,l,f,M,t,n,s,o,a,y,C);if(c&&(v=c.placedGlyphBoxes,v&&v.placeable))return z=!0,R=c.shift,v}p?p=null:M=g}return r&&!v&&(v={box:this.collisionIndex.placeCollisionBox(U,"always",h,I,l,w,b,o,f.predicate,C,void 0,A).box,offscreen:!1,placeable:!1,occluded:!1}),v};s((()=>m(U,d.iconBox,e.ah.horizontal)),(()=>{const i=d.verticalTextBox;return n.allowVerticalPlacement&&(!L||!L.placeable)&&t.numVerticalGlyphVertices>0&&i?m(i,d.verticalIconBox,e.ah.vertical):{box:null,occluded:!0,offscreen:null}})),L&&(z=L.placeable,D=L.offscreen);const _=i(L&&L.placeable);if(!z&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(n,e.anchor,t,_))}}}if(B=L,z=B&&B.placeable,D=B&&B.offscreen,t.useRuntimeCollisionCircles){const i=n.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),a=e.ai(n.textSizeData,p,i),h=s.get("text-padding");O=this.collisionIndex.placeCollisionCircles(g,i,n.lineVertexArray,n.glyphOffsetArray,a,l,c,r,w,f.predicate,t.collisionCircleDiameter,h,o,C),O.circles.length&&O.collisionDetected&&!r&&e.w("Collisions detected, but collision boxes are not shown"),z=y||O.circles.length>0&&!O.collisionDetected,D=D&&O.offscreen}if(d.iconFeatureIndex&&(Z=d.iconFeatureIndex),d.iconBox){const t=t=>this.collisionIndex.placeCollisionBox(t,x,h,I,l,w,b,a,f.predicate,C,T&&R?R:void 0,A);F&&F.placeable&&d.verticalIconBox?(j=t(d.verticalIconBox),k=j.placeable):(j=t(d.iconBox),k=j.placeable),D=D&&j.offscreen}const G=m||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,$=_||0===t.numIconVertices;G||$?$?G||(k=k&&z):z=k&&z:k=z=k&&z;const q=k&&j.placeable;if(z&&B.placeable&&this.collisionIndex.insertCollisionBox(B.box,g,s.get("text-ignore-placement"),n.bucketInstanceId,F&&F.placeable&&N?N:V,f.ID),q&&this.collisionIndex.insertCollisionBox(j.box,x,s.get("icon-ignore-placement"),n.bucketInstanceId,Z,f.ID),O&&z&&this.collisionIndex.insertCollisionCircles(O.circles,g,s.get("text-ignore-placement"),n.bucketInstanceId,V,f.ID),r&&this.storeCollisionData(n.bucketInstanceId,v,d,B,j,O),0===t.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new Ut((z||M)&&!(null==B?void 0:B.occluded),(k||S)&&!(null==j?void 0:j.occluded),D||n.justReloaded),i[t.crossTileID]=!0};if(P){if(0!==t.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");
2const e=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let t=e.length-1;t>=0;--t){const i=e[t];E(n.symbolInstances.get(i),n.collisionArrays[i],i)}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)E(n.symbolInstances.get(e),n.collisionArrays[e],e);n.justReloaded=!1}storeCollisionData(t,e,i,r,n,s){if(i.textBox||i.iconBox){let s,o;this.collisionBoxArrays.has(t)?s=this.collisionBoxArrays.get(t):(s=new Map,this.collisionBoxArrays.set(t,s)),s.has(e)?o=s.get(e):(o={text:null,icon:null},s.set(e,o)),i.textBox&&(o.text=r.box),i.iconBox&&(o.icon=n.box)}if(s){let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=[]);for(let t=0;t<s.circles.length;t+=4)e.push(s.circles[t+0]-jt),e.push(s.circles[t+1]-jt),e.push(s.circles[t+2]),e.push(s.collisionDetected?1:0)}}markUsedJustification(t,i,r,n){let s;s=n===e.ah.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[e.aA(i)];const o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(const e of o)e>=0&&(t.text.placedSymbolArray.get(e).crossTileID=s>=0&&e!==s?0:r.crossTileID)}markUsedOrientation(t,i,r){const n=i===e.ah.horizontal||i===e.ah.horizontalOnly?i:0,s=i===e.ah.vertical?i:0,o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(const e of o)t.text.placedSymbolArray.get(e).placedOrientation=n;r.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=s)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const r=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},s=e?e.variableOffsets:{},o=e?e.placedOrientations:{};for(const a in this.placements){const t=this.placements[a],e=n[a];e?(this.opacities[a]=new Zt(e,r,t.text,t.icon),i=i||t.text!==e.text.placed||t.icon!==e.icon.placed):(this.opacities[a]=new Zt(null,r,t.text,t.icon,t.skipFade),i=i||t.text||t.icon)}for(const a in n){const t=n[a];if(!this.opacities[a]){const e=new Zt(t,r,!1,!1);e.isHidden()||(this.opacities[a]=e,i=i||t.text.placed||t.icon.placed)}}for(const a in s)this.variableOffsets[a]||!this.opacities[a]||this.opacities[a].isHidden()||(this.variableOffsets[a]=s[a]);for(const a in o)this.placedOrientations[a]||!this.opacities[a]||this.opacities[a].isHidden()||(this.placedOrientations[a]=o[a]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const i={};for(const r of e){const e=r.getBucket(t);e&&r.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(t,i,r,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();const s=t.layers[0],o=s.layout,a=new Zt(null,0,!1,!1,!0),l=o.get("text-allow-overlap"),c=o.get("icon-allow-overlap"),h=s._unevaluatedLayout.hasValue("text-variable-anchor")||s._unevaluatedLayout.hasValue("text-variable-anchor-offset"),u="map"===o.get("text-rotation-alignment"),d="map"===o.get("text-pitch-alignment"),p="none"!==o.get("icon-text-fit"),f=new Zt(null,0,l&&(c||!t.hasIconData()||o.get("icon-optional")),c&&(l||!t.hasTextData()||o.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);const m=(t,e,i)=>{for(let r=0;r<e/4;r++)t.opacityVertexArray.emplaceBack(i);t.hasVisibleVertices=t.hasVisibleVertices||i!==re},_=this.collisionBoxArrays.get(t.bucketInstanceId);for(let g=0;g<t.symbolInstances.length;g++){const i=t.symbolInstances.get(g),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:s,crossTileID:o}=i;let l=this.opacities[o];r[o]?l=a:l||(l=f,this.opacities[o]=l),r[o]=!0;const c=i.numIconVertices>0,y=this.placedOrientations[i.crossTileID],x=y===e.ah.vertical,v=y===e.ah.horizontal||y===e.ah.horizontalOnly;if(n>0||s>0){const e=ie(l.text);m(t.text,n,x?re:e),m(t.text,s,v?re:e);const r=l.text.isHidden();[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEac
2h((e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=r||x?1:0)})),i.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).hidden=r||v?1:0);const o=this.variableOffsets[i.crossTileID];o&&this.markUsedJustification(t,o.anchor,i,y);const a=this.placedOrientations[i.crossTileID];a&&(this.markUsedJustification(t,"left",i,a),this.markUsedOrientation(t,a,i))}if(c){const e=ie(l.icon),r=!(p&&i.verticalPlacedIconSymbolIndex&&x);i.placedIconSymbolIndex>=0&&(m(t.icon,i.numIconVertices,r?e:re),t.icon.placedSymbolArray.get(i.placedIconSymbolIndex).hidden=l.icon.isHidden()),i.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,i.numVerticalIconVertices,r?re:e),t.icon.placedSymbolArray.get(i.verticalPlacedIconSymbolIndex).hidden=l.icon.isHidden())}const b=_&&_.has(g)?_.get(g):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const i=t.collisionArrays[g];if(i){let r=new e.P(0,0);if(i.textBox||i.verticalTextBox){let e=!0;if(h){const t=this.variableOffsets[o];t?(r=qt(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),u&&r._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):e=!1}if(i.textBox||i.verticalTextBox){let n;
2i.textBox&&(n=x),i.verticalTextBox&&(n=v),Ht(t.textCollisionBox.collisionVertexArray,l.text.placed,!e||n,b.text,r.x,r.y)}}if(i.iconBox||i.verticalIconBox){const e=Boolean(!v&&i.verticalIconBox);let n;i.iconBox&&(n=e),i.verticalIconBox&&(n=!e),Ht(t.iconCollisionBox.collisionVertexArray,l.icon.placed,n,b.icon,p?r.x:0,p?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 new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return 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,e){const i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}}function Ht(t,e,i,r,n,s){r&&0!==r.length||(r=[0,0,0,0]);const o=r[0]-jt,a=r[1]-jt,l=r[2]-jt,c=r[3]-jt;t.emplaceBack(e?1:0,i?1:0,n||0,s||0,o,a),t.emplaceBack(e?1:0,i?1:0,n||0,s||0,l,a),t.emplaceBack(e?1:0,i?1:0,n||0,s||0,l,c),t.emplaceBack(e?1:0,i?1:0,n||0,s||0,o,c)}const Xt=Math.pow(2,25),Kt=Math.pow(2,24),Yt=Math.pow(2,17),Jt=Math.pow(2,16),Qt=Math.pow(2,9),te=Math.pow(2,8),ee=Math.pow(2,1);function ie(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Xt+e*Kt+i*Yt+e*Jt+i*Qt+e*te+i*ee+e}const re=0;class ne{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,e,i,r,n){const s=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(s,r,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort(((t,e)=>t.sortKey-e.sortKey)));this._currentPartIndex<s.length;)if(e.placeLayerBucketPart(s[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0;return!1}}class se{constructor(t,e,i,r,n,s,o,a){this.placement=new Wt(t,e,s,o,a),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(t,e,i){const r=o.now(),n=()=>!this._forceFullPlacement&&o.now()-r>2;for(;this._currentPlacementIndex>=0;){const r=e[t[this._currentPlacementIndex]],s=this.placement.collisionIndex.transform.zoom;if("symbol"===r.type&&(!r.minzoom||r.minzoom<=s)&&(!r.maxzoom||r.maxzoom>s)){if(this._inProgressLayer||(this._inProgressLayer=new ne(r)),this._inProgressLayer.continuePlacement(i[r.source],this.placement,this._showCollisionBoxes,r,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const oe=512/e.Z/2;class ae{constructor(t,i,r){this.tileID=t,this.bucketInstanceId=r,this._symbolsByKey={};const n=new Map;for(let e=0;e<i.length;e++){const t=i.get(e),r=t.key,s=n.get(r);s?s.push(t):n.set(r,[t])}for(const[s,o]of n){const t={positions:o.map((t=>({x:Math.floor(t.anchorX*oe),y:Math.floor(t.anchorY*oe)}))),crossTileIDs:o.map((t=>t.crossTileID))};if(t.positions.length>128){const i=new e.aC(t.positions.length,16,Uint16Array);for(const{x:e,y:r}of t.positions)i.add(e,r);i.finish(),delete t.positions,t.index=i}this._symbolsByKey[s]=t}}getScaledCoordinates(t,i){const{x:r,y:n,z:s}=this.tileID.canonical,{x:o,y:a,z:l}=i.canonical,c=oe/Math.pow(2,l-s),h=(a*e.Z+t.anchorY)*c,u=n*e.Z*oe;return{x:Math.floor((o*e.Z+t.anchorX)*c-r*e.Z*oe),y:Math.floor(h-u)}}
2findMatches(t,e,i){const r=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let n=0;n<t.length;n++){const s=t.get(n);if(s.crossTileID)continue;const o=this._symbolsByKey[s.key];if(!o)continue;const a=this.getScaledCoordinates(s,e);if(o.index){const t=o.index.range(a.x-r,a.y-r,a.x+r,a.y+r).sort();for(const e of t){const t=o.crossTileIDs[e];if(!i[t]){i[t]=!0,s.crossTileID=t;break}}}else if(o.positions)for(let t=0;t<o.positions.length;t++){const e=o.positions[t],n=o.crossTileIDs[t];if(Math.abs(e.x-a.x)<=r&&Math.abs(e.y-a.y)<=r&&!i[n]){i[n]=!0,s.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class le{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ce{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const i in this.indexes){const t=this.indexes[i],r={};for(const i in t){const n=t[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),r[n.tileID.key]=n}this.indexes[i]=r}this.lng=t}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let n=0;n<e.symbolInstances.length;n++)e.symbolInstances.get(n).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const r=this.usedCrossTileIDs[t.overscaledZ];for(const n in this.indexes){const i=this.indexes[n];if(Number(n)>t.overscaledZ)for(const n in i){const s=i[n];s.tileID.isChildOf(t)&&s.findMatches(e.symbolInstances,t,r)}else{const s=i[t.scaledTo(Number(n)).key];s&&s.findMatches(e.symbolInstances,t,r)}}for(let n=0;n<e.symbolInstances.length;n++){const t=e.symbolInstances.get(n);t.crossTileID||(t.crossTileID=i.generate(),r[t.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new ae(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const i of e.getCrossTileIDsLists())for(const e of i)delete this.usedCrossTileIDs[t][e]}removeStaleBuckets(t){let e=!1;for(const i in this.indexes){const r=this.indexes[i];for(const n in r)t[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],e=!0)}return e}}class he{constructor(){this.layerIndexes={},this.crossTileIDs=new le,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i){let r=this.layerIndexes[t.id];void 0===r&&(r=this.layerIndexes[t.id]=new ce);let n=!1;const s={};r.handleWrapJump(i);for(const o of e){const e=o.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(o.tileID,e,this.crossTileIDs)&&(n=!0),s[e.bucketInstanceId]=!0)}return r.removeStaleBuckets(s)&&(n=!0),n}pruneUnusedLayers(t){const e={};t.forEach((t=>{e[t]=!0}));for(const i in this.layerIndexes)e[i]||delete this.layerIndexes[i]}}var ue="void main() {fragColor=vec4(1.0);}";const de={prelude:pe("#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:pe("","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:pe("","#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:pe("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:pe("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:pe("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:pe(ue,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:pe("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:pe("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:pe("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:pe("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);}"),debug:pe("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));}
2"),depth:pe(ue,"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:pe("#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:pe("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:pe("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:pe("#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=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:pe("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);
2\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:pe("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:pe("#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)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;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))/pow(2.0,exaggeration+(19.2562-u_zoom));fragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.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:pe("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
2\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;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_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;\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:pe("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);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);}"),lineGradient:pe("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);
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);}"),linePattern:pe("#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:pe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;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\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\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);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_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_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;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\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\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\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:pe("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:pe("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:pe("#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:pe("#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: i
2nitialize 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;fragColor=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:pe("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:pe("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:pe("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:pe("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:pe("in 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:pe("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 pe(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/in ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=s?s.concat(n):n,a={};return{fragmentSource:t=t.replace(i,((t,e,i,r,n)=>(a[n]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = u_${n};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,i,r,n)=>{const s="float"===r?"vec2":"vec4",o=n.match(/color/)?"color":s;return a[n]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${s} a_${n};\nout ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${o}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${s} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = unpack_mix_${o}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`})),staticAttributes:r,staticUniforms:o}}class fe{constructor(t,e,i){this.vertexBuffer=t,this.indexBuffer=e,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var me=e.aD([{name:"a_pos",type:"Int16",components:2}]);const _e="#define PROJECTION_MERCATOR",ge="mercator";class ye{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return ge}get shaderDefine(){return _e}get shaderPreludeCode(){return de.projectionMercator}get vertexShaderPreludeCode(){return de.projectionMercator.vertexSource}get subdivisionGranularity(){return e.aE.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,i,r,n,s){if(this._cachedMesh)return this._cachedMesh;const o=new e.aF;o.emplaceBack(0,0),o.emplaceBack(e.Z,0),o.emplaceBack(0,e.Z),o.emplaceBack(e.Z,e.Z);const a=t.createVertexBuffer(o,me.members),l=e.aG.simpleSegment(0,0,4,2),c=new e.aH;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);const h=t.createIndexBuffer(c);return this._cachedMesh=new fe(a,h,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}function xe(t,i){const r=e.ae(i.lat,-85.051129,e.aJ);return new e.P(e.U(i.lng)*t,e.S(r)*t)}function ve(t,i){return new e.$(i.x/t,i.y/t).toLngLat()}function be(t){return t.cameraToCenterDistance*Math.min(.85*Math.tan(e.ad(90-t.pitch)),Math.tan(e.ad(89.25-t.pitch)))}function we(t,i){const r=t.canonical,n=i/e.aI(r.z),s=r.x+Math.pow(2,r.z)*t.wrap,o=e.at(new Float64Array(16));return e.L(o,o,[s*n,r.y*n,0]),e.M(o,o,[n/e.Z,n/e.Z,1]),o}function Te(t,i,r,n,s){const o=e.$.fromLngLat(t,i),a=s*e.aK(1,t.lat),l=a*Math.cos(e.ad(r)),c=Math.sqrt(a*a-l*l),h=c*Math.sin(e.ad(-n)),u=c*Math.cos(e.ad(-n));return new e.$(o.x+h,o.y+u,o.z+l)}class Pe{constructor(t=0,e=0,i=0,r=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=r}interpolate(t,i,r){return null!=i.top&&null!=t.top&&(this.top=e.B.number(t.top,i.top,r)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.B.number(t.bottom,i.bottom,r)),null!=i.left&&null!=t.left&&(this.left=e.B.number(t.left,i.left,r)),null!=i.right&&null!=t.right&&(this.right=e.B.number(t.right,i.right,r)),this}getCenter(t,i){const r=e.ae((this.left+t-this.right)/2,0,t),n=e.ae((this.top+i-this.bottom)/2,0,i);return new e.P(r,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Pe(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Me(t,e){if(!t.renderWorldCopies||t.lngRange)return;const i=e.lng-t.center.lng;e.lng+=i>180?-360:i<-180?360:0}function Se(t){return Math.max(0,Math.floor(t))}class Ie{constructor(t,i,r,n,s,o){this._callbacks=t,this._tileSize=512,this._renderWorldCopies=void 0===o||!!o,this._minZoom=i||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==s?60:s,this.setMaxBounds(),this._width=0,this._height=0,this._center=new e.Q(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Se(this._zoom),this._scale=e.aI(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Pe,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,i,r){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=Se(this._zoom),this._scale=e.aI(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 Pe(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=!r&&t.autoCalculateNearFarZ,i&&this._constrain(),this._calcMatrices()}
2get 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.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.getConstrained(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 worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const i=e.aL(t,-180,180)*Math.PI/180;var n,s,o,a,l,c,h,u,d;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=r(),n=this._rotationMatrix,o=-this._bearingInRadians,a=(s=this._rotationMatrix)[0],l=s[1],c=s[2],h=s[3],u=Math.sin(o),d=Math.cos(o),n[0]=a*d+c*u,n[1]=l*d+h*u,n[2]=a*-u+c*d,n[3]=l*-u+h*d)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){const i=e.ae(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){const e=t/180*Math.PI;this._rollInRadians!==e&&(this._unmodified=!1,this._rollInRadians=e,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return e.aM(this._fovInRadians)}setFov(t){t=e.ae(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=e.ad(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){const i=this.getConstrained(this._center,t).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=e.aI(i),this._constrain(),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._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),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,e){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=e,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()}resize(t,e,i=!0){this._width=t,this._height=e,i&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new G([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._constrain()):(this._lngRange=null,this._latRange=[-85.051129,e.aJ])}getConstrained(t,e){return this._callbacks.getConstrained(t,e)}getCameraQueryGeometry(t,i){if(1===i.length)return[i[0],t];{let r=t.x,n=t.y,s=t.x,o=t.y;for(const t of i)r=Math.min(r,t.x),n=Math.min(n,t.y),s=Math.max(s,t.x),o=Math.max(o,t.y);return[new e.P(r,n),new e.P(s,n),new e.P(s,o),new e.P(r,o),new e.P(r,n)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:e,zoom:i}=this.getConstrained(this.center,this.zoom);this.setCenter(e),this.setZoom(i),this._unmodified=t,this._constraining=!1}
2_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=e.at(new Float64Array(16));e.M(t,t,[this._width/2,-this._height/2,1]),e.L(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=e.at(new Float64Array(16)),e.M(t,t,[1,-1,1]),e.L(t,t,[-1,-1,0]),e.M(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,i,r,n){const s=void 0!==r?r:this.bearing,o=n=void 0!==n?n:this.pitch,a=e.$.fromLngLat(t,i),l=-Math.cos(e.ad(o)),c=Math.sin(e.ad(o)),h=c*Math.sin(e.ad(s)),u=-c*Math.cos(e.ad(s));let d=this.elevation;const p=i-d;let f;l*p>=0||Math.abs(l)<.1?(f=1e4,d=i+f*l):f=-p/l;let m,_,g=e.aN(1,a.y),y=0;do{if(y+=1,y>10)break;_=f/g,m=new e.$(a.x+h*_,a.y+u*_),g=1/m.meterInMercatorCoordinateUnits()}while(Math.abs(f-_*g)>1e-12);return{center:m.toLngLat(),elevation:d,zoom:e.ab(this.height/2/Math.tan(this.fovInRadians/2)/_/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const i=e.aK(1,this.center.lat)*this.worldSize,r=this.cameraToCenterDistance/i,n=e.$.fromLngLat(this.center,this.elevation),s=Te(this.center,this.elevation,this.pitch,this.bearing,r);this._elevation=t;const o=this.calculateCenterFromCameraLngLatAlt(s.toLngLat(),e.aN(s.z,n.y),this.bearing,this.pitch);this._elevation=o.elevation,this._center=o.center,this.setZoom(o.zoom)}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const t=e.aK(1,this.center.lat)*this.worldSize;return Te(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];const i=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/i,t.canonical.y/i,1/i/e.Z,1/i/e.Z]}}class Ce{constructor(t,i){this.min=t,this.max=i,this.center=e.aO([],e.aP([],this.min,this.max),.5)}quadrant(t){const i=[t%2==0,t<2],r=e.aQ(this.min),n=e.aQ(this.max);for(let e=0;e<i.length;e++)r[e]=i[e]?this.min[e]:this.center[e],n[e]=i[e]?this.center[e]:this.max[e];return n[2]=this.max[2],new Ce(r,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 e=!0;for(let i=0;i<t.planes.length;i++){const r=this.intersectsPlane(t.planes[i]);if(0===r)return 0;1===r&&(e=!1)}return e?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 e=t[3],i=t[3];for(let r=0;r<3;r++)t[r]>0?(e+=t[r]*this.min[r],i+=t[r]*this.max[r]):(i+=t[r]*this.min[r],e+=t[r]*this.max[r]);return e>=0?2:i<0?0:1}}class Ae{distanceToTile2d(t,e,i,r){const n=r.distanceX([t,e]),s=r.distanceY([t,e]);return Math.hypot(n,s)}getWrap(t,e,i){return i}getTileAABB(t,i,r,n){var s,o;let a=r,l=r;if(n.terrain){const c=new e.Y(t.z,i,t.z,t.x,t.y),h=n.terrain.getMinMaxElevation(c);a=null!==(s=h.minElevation)&&void 0!==s?s:r,l=null!==(o=h.maxElevation)&&void 0!==o?o:r}const c=1<<t.z;return new Ce([i+t.x/c,t.y/c,a],[i+(t.x+1)/c,(t.y+1)/c,l])}allowVariableZoom(t,i){const r=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,n=e.ae(78.5-r/2,0,60);return!!i.terrain||t.pitch>n}allowWorldCopies(){return!0}recalculateCache(){}}class Ee{constructor(t,e,i){this.points=t,this.planes=e,this.aabb=i}static fromInvProjectionMatrix(t,i=1,r=0){const n=Math.pow(2,r),s=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((r=>{const s=1/(r=e.ap([],r,t))[3]/i*n;return e.aR(r,r,[s,s,1/r[3],s])})),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const i=e.aS([],s[t[0]],s[t[1]]),r=e.aS([],s[t[2]],s[t[1]]),n=e.aT([],e.aU([],i,r)),o=-e.aV(n,s[t[1]]);return n.concat(o)})),a=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],l=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const e of s)for(let t=0;t<3;t++)a[t]=Math.min(a[t],e[t]),l[t]=Math.max(l[t],e[t]);return new Ee(s,o,new Ce(a,l))}}
2class ze{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,e,i){return this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,i=!0){this._helper.resize(t,e,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}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 nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,e){}constructor(t,e,i,r,n){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new Ie({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,e)=>this.getConstrained(t,e)},t,e,i,r,n),this._coveringTilesDetailsProvider=new Ae}clone(){const t=new ze;return t.apply(this),t}apply(t,e,i){this._helper.apply(t,e,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){const i=[new e.aW(0,t)];if(this._helper._renderWorldCopies){const r=this.screenPointToMercatorCoordinate(new e.P(0,0)),n=this.screenPointToMercatorCoordinate(new e.P(this._helper._width,0)),s=this.screenPointToMercatorCoordinate(new e.P(this._helper._width,this._helper._height)),o=this.screenPointToMercatorCoordinate(new e.P(0,this._helper._height)),a=Math.floor(Math.min(r.x,n.x,s.x,o.x)),l=Math.floor(Math.max(r.x,n.x,s.x,o.x)),c=1;for(let h=a-c;h<=l+c;h++)0!==h&&i.push(new e.aW(h,t))}return i}getCameraFrustum(){return Ee.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const e=this.screenPointToLocation(this.centerPoint,t),i=t?t.getElevationForLngLatZoom(e,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(t,i){const r=e.aK(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(i,r),s=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,r),o=e.$.fromLngLat(t),a=new e.$(o.x-(n.x-s.x),o.y-(n.y-s.y));this.setCenter(null==a?void 0:a.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,i){return i?this.coordinatePoint(e.$.fromLngLat(t),i.getElevationForLngLatZoom(t,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(e.$.fromLngLat(t))}screenPointToLocation(t,e){var i;return null===(i=this.screenPointToMercatorCoordinate(t,e))||void 0===i?void 0:i.toLngLat()}screenPointToMercatorCoordinate(t,e){if(e){const i=e.pointCoordinate(t);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,i){const r=i||0,n=[t.x,t.y,0,1],s=[t.x,t.y,1,1];e.ap(n,n,this._pixelMatrixInverse),e.ap(s,s,this._pixelMatrixInverse);const o=n[3],a=s[3],l=n[1]/o,c=s[1]/a,h=n[2]/o,u=s[2]/a,d=h===u?0:(r-h)/(u-h);return new e.$(e.B.number(n[0]/o,s[0]/a,d)/this.worldSize,e.B.number(l,c,d)/this.worldSize,r)}coordinatePoint(t,i=0,r=this._pixelMatrix){const n=[t.x*this.worldSize,t.y*this.worldSize,i,1];return e.ap(n,n,r),new e.P(n[0]/n[3],n[1]/n[3])}getBounds(){const t=Math.max(0,this._helper._height/2-be(this));return(new G).extend(this.screenPointToLocation(new e.P(0,t))).extend(this.screenPointToLocation(new e.P(this._helper._width,t))).extend(this.screenPointToLocation(new e.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new e.P(0,this._helper._height)))}
2isPointOnMapSurface(t,e){return e?null!=e.pointCoordinate(t):t.y>this.height/2-be(this)}calculatePosMatrix(t,i=!1,r){var n;const s=null!==(n=t.key)&&void 0!==n?n:e.aX(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),o=i?this._alignedPosMatrixCache:this._posMatrixCache;if(o.has(s)){const t=o.get(s);return r?t.f32:t.f64}const a=we(t,this.worldSize);e.N(a,i?this._alignedProjMatrix:this._viewProjMatrix,a);const l={f64:a,f32:new Float32Array(a)};return o.set(s,l),r?l.f32:l.f64}calculateFogMatrix(t){const i=t.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);const n=we(t,this.worldSize);return e.N(n,this._fogMatrix,n),r.set(i,new Float32Array(n)),r.get(i)}getConstrained(t,i){i=e.ae(+i,this.minZoom,this.maxZoom);const r={center:new e.Q(t.lng,t.lat),zoom:i};let n=this._helper._lngRange;this._helper._renderWorldCopies||null!==n||(n=[-179.9999999999,180-1e-10]);const s=this.tileSize*e.aI(r.zoom);let o=0,a=s,l=0,c=s,h=0,u=0;const{x:d,y:p}=this.size;if(this._helper._latRange){const t=this._helper._latRange;o=e.S(t[1])*s,a=e.S(t[0])*s,a-o<p&&(h=p/(a-o))}n&&(l=e.aL(e.U(n[0])*s,0,s),c=e.aL(e.U(n[1])*s,0,s),c<l&&(c+=s),c-l<d&&(u=d/(c-l)));const{x:f,y:m}=xe(s,t);let _,g;const y=Math.max(u||0,h||0);if(y){const t=new e.P(u?(c+l)/2:f,h?(a+o)/2:m);return r.center=ve(s,t).wrap(),r.zoom+=e.ab(y),r}if(this._helper._latRange){const t=p/2;m-t<o&&(g=o+t),m+t>a&&(g=a-t)}if(n){const t=(l+c)/2;let i=f;
2this._helper._renderWorldCopies&&(i=e.aL(f,t-s/2,t+s/2));const r=d/2;i-r<l&&(_=l+r),i+r>c&&(_=c-r)}if(void 0!==_||void 0!==g){const t=new e.P(null!=_?_:f,null!=g?g:m);r.center=ve(s,t).wrap()}return r}calculateCenterFromCameraLngLatAlt(t,e,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,r)}_calculateNearFarZIfNeeded(t,i,r){if(!this._helper.autoCalculateNearFarZ)return;const n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),s=t-n*this._helper._pixelPerMeter/Math.cos(i),o=n<0?s:t,a=Math.PI/2+this.pitchInRadians,l=e.ad(this.fov)*(Math.abs(Math.cos(e.ad(this.roll)))*this.height+Math.abs(Math.sin(e.ad(this.roll)))*this.width)/this.height*(.5+r.y/this.height),c=Math.sin(l)*o/Math.sin(e.ae(Math.PI-a-l,.01,Math.PI-.01)),h=be(this),u=Math.atan(h/this._helper.cameraToCenterDistance),d=e.ad(.75),p=u>d?2*u*(.5+r.y/(2*h)):d,f=Math.sin(p)*o/Math.sin(e.ae(Math.PI-a-p,.01,Math.PI-.01)),m=Math.min(c,f);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*m+o),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,i=xe(this.worldSize,this.center),r=i.x,n=i.y;this._helper._pixelPerMeter=e.aK(1,this.center.lat)*this.worldSize;const s=e.ad(Math.min(this.pitch,89.25)),o=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(s));let a;this._calculateNearFarZIfNeeded(o,s,t),a=new Float64Array(16),e.aY(a,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),e.aj(this._invProjMatrix,a),a[8]=2*-t.x/this._helper._width,a[9]=2*t.y/this._helper._height,this._projectionMatrix=e.aZ(a),e.M(a,a,[1,-1,1]),e.L(a,a,[0,0,-this._helper.cameraToCenterDistance]),e.a_(a,a,-this.rollInRadians),e.a$(a,a,this.pitchInRadians),e.a_(a,a,-this.bearingInRadians),e.L(a,a,[-r,-n,0]),this._mercatorMatrix=e.M([],a,[this.worldSize,this.worldSize,this.worldSize]),e.M(a,a,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=e.N(new Float64Array(16),this.clipSpaceToPixelsMatrix,a),e.L(a,a,[0,0,-this.elevation]),this._viewProjMatrix=a,this._invViewProjMatrix=e.aj([],a);const l=[0,0,-1,1];e.ap(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),e.aY(this._fogMatrix,this.fovInRadians,this.width/this.height,o,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,e.M(this._fogMatrix,this._fogMatrix,[1,-1,1]),e.L(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),e.a_(this._fogMatrix,this._fogMatrix,-this.rollInRadians),e.a$(this._fogMatrix,this._fogMatrix,this.pitchInRadians),e.a_(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),e.L(this._fogMatrix,this._fogMatrix,[-r,-n,0]),e.M(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),e.L(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=e.N(new Float64Array(16),this.clipSpaceToPixelsMatrix,a);const c=this._helper._width%2/2,h=this._helper._height%2/2,u=Math.cos(this.bearingInRadians),d=Math.sin(-this.bearingInRadians),p=r-Math.round(r)+u*c+d*h,f=n-Math.round(n)+u*h+d*c,m=new Float64Array(a);if(e.L(m,m,[p>.5?p-1:p,f>.5?f-1:f,0]),this._alignedProjMatrix=m,a=e.aj(new Float64Array(16),this._pixelMatrix),!a)throw new Error("failed to invert matrix");this._pixelMatrixInverse=a,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new e.P(0,0)),i=[t.x*this.worldSize,t.y*this.worldSize,0,1];return e.ap(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=e.aK(1,this.center.lat)*this.worldSize;return Te(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,i){const r=e.$.fromLngLat(t),n=[r.x*this.worldSize,r.y*this.worldSize,i,1];return e.ap(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(t){const{overscaledTileID:i,aligned:r,applyTerrainMatrix:n}=t,s=this._helper.getMercatorTileCoordinates(i),o=i?this.calculatePosMatrix(i,r,!0):null;let a;return a=i&&i.terrainRttPosMatrix32f&&n?i.terrainRttPosMatrix32f:o||e.b0(),{mainMatrix:a,tileMercatorCoords:s,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:a}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}
2getPitchedTextCorrection(t,e,i){return 1}transformLightDirection(t){return e.aQ(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,i,r,n){const s=this.calculatePosMatrix(r);let o;n?(o=[t,i,n(t,i),1],e.ap(o,o,s)):(o=[t,i,0,1],Ot(o,o,s));const a=o[3];return{point:new e.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}populateCache(t){for(const e of t)this.calculatePosMatrix(e)}getMatrixForModel(t,i){const r=e.$.fromLngLat(t,i),n=r.meterInMercatorCoordinateUnits(),s=e.b1();return e.L(s,s,[r.x,r.y,r.z]),e.a_(s,s,Math.PI),e.a$(s,s,Math.PI/2),e.M(s,s,[-n,n,n]),s}getProjectionDataForCustomLayer(t=!0){const i=new e.Y(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:t}),n=we(i,this.worldSize);e.N(n,this._viewProjMatrix,n),r.tileMercatorCoords=[0,0,1,1];const s=[e.Z,e.Z,this.worldSize/this._helper.pixelsPerMeter],o=e.b2();return e.M(o,n,s),r.fallbackMatrix=o,r.mainMatrix=o,r}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function ke(){e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function De(t){if(t.useSlerp)if(t.k<1){const i=e.b3(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),r=e.b3(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),n=new Float64Array(4);e.b4(n,i,r,t.k);const s=e.b5(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(e.B.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(e.B.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(e.B.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k))}function Re(t,i,r,n,s){const o=s.padding,a=xe(s.worldSize,r.getNorthWest()),l=xe(s.worldSize,r.getNorthEast()),c=xe(s.worldSize,r.getSouthEast()),h=xe(s.worldSize,r.getSouthWest
2()),u=e.ad(-n),d=a.rotate(u),p=l.rotate(u),f=c.rotate(u),m=h.rotate(u),_=new e.P(Math.max(d.x,p.x,m.x,f.x),Math.max(d.y,p.y,m.y,f.y)),g=new e.P(Math.min(d.x,p.x,m.x,f.x),Math.min(d.y,p.y,m.y,f.y)),y=_.sub(g),x=(s.width-(o.left+o.right+i.left+i.right))/y.x,v=(s.height-(o.top+o.bottom+i.top+i.bottom))/y.y;if(v<0||x<0)return void ke();const b=Math.min(e.ab(s.scale*Math.min(x,v)),t.maxZoom),w=e.P.convert(t.offset),T=new e.P((i.left-i.right)/2,(i.top-i.bottom)/2).rotate(e.ad(n)),P=w.add(T).mult(s.scale/e.aI(b));return{center:ve(s.worldSize,a.add(c).div(2).sub(P)),zoom:b,bearing:n}}class Le{get useGlobeControls(){return!1}handlePanInertia(t,e){return{easingOffset:t,easingCenter:e.center}}handleMapControlsRollPitchBearingZoom(t,e){t.bearingDelta&&e.setBearing(e.bearing+t.bearingDelta),t.pitchDelta&&e.setPitch(e.pitch+t.pitchDelta),t.rollDelta&&e.setRoll(e.roll+t.rollDelta),t.zoomDelta&&e.setZoom(e.zoom+t.zoomDelta)}handleMapControlsPan(t,e,i){t.around.distSqr(e.centerPoint)<.01||e.setLocationAtPoint(i,t.around)}cameraForBoxAndBearing(t,e,i,r,n){return Re(t,e,i,r,n)}handleJumpToCenterZoom(t,i){t.zoom!==(void 0!==i.zoom?+i.zoom:t.zoom)&&t.setZoom(+i.zoom),void 0!==i.center&&t.setCenter(e.Q.convert(i.center))}handleEaseTo(t,i){const r=t.zoom,n=t.padding,s={roll:t.roll,pitch:t.pitch,bearing:t.bearing},o={roll:void 0===i.roll?t.roll:i.roll,pitch:void 0===i.pitch?t.pitch:i.pitch,bearing:void 0===i.bearing?t.bearing:i.bearing},a=void 0!==i.zoom,l=!t.isPaddingEqual(i.padding);let c=!1;const h=a?+i.zoom:t.zoom;let u=t.centerPoint.add(i.offsetAsPoint);const d=t.screenPointToLocation(u),{center:p,zoom:f}=t.getConstrained(e.Q.convert(i.center||d),null!=h?h:r);Me(t,p);const m=xe(t.worldSize,d),_=xe(t.worldSize,p).sub(m),g=e.aI(f-r);return c=f!==r,{easeFunc:a=>{if(c&&t.setZoom(e.B.number(r,f,a)),e.b6(s,o)||De({startEulerAngles:s,endEulerAngles:o,tr:t,k:a,useSlerp:s.roll!=o.roll}),l&&(t.interpolatePadding(n,i.padding,a),u=t.centerPoint.add(i.offsetAsPoint)),i.around)t.setLocationAtPoint(i.around,i.aroundPoint);else{const i=e.aI(t.zoom-r),n=f>r?Math.min(2,g):Math.max(.5,g),s=Math.pow(n,1-a),o=ve(t.worldSize,m.add(_.mult(a*s)).mult(i));t.setLocationAtPoint(t.renderWorldCopies?o.wrap():o,u)}},isZooming:c,elevationCenter:p}}handleFlyTo(t,i){const r=void 0!==i.zoom,n=t.zoom,s=t.getConstrained(e.Q.convert(i.center||i.locationAtOffset),r?+i.zoom:n),o=s.center,a=s.zoom;Me(t,o);const l=xe(t.worldSize,i.locationAtOffset),c=xe(t.worldSize,o).sub(l),h=c.mag(),u=e.aI(a-n);let d;if(void 0!==i.minZoom){const r=Math.min(+i.minZoom,n,a),s=t.getConstrained(o,r).zoom;d=e.aI(s-n)}return{easeFunc:(i,r,s,h)=>{t.setZoom(1===i?a:n+e.ab(r));const u=1===i?o:ve(t.worldSize,l.add(c.mult(s)).mult(r));t.setLocationAtPoint(t.renderWorldCopies?u.wrap():u,h)},scaleOfZoom:u,targetCenter:o,scaleOfMinZoom:d,pixelPathLength:h}}}class Fe{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i}}Fe.Replace=[1,0],Fe.disabled=new Fe(Fe.Replace,e.b7.transparent,[!1,!1,!1,!1]),Fe.unblended=new Fe(Fe.Replace,e.b7.transparent,[!0,!0,!0,!0]),Fe.alphaBlended=new Fe([1,771],e.b7.transparent,[!0,!0,!0,!0]);const Be=2305;class Oe{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i}}Oe.disabled=new Oe(!1,1029,Be),Oe.backCCW=new Oe(!0,1029,Be),Oe.frontCCW=new Oe(!0,1028,Be);class je{constructor(t,e,i){this.func=t,this.mask=e,this.range=i}}je.ReadOnly=!1,je.ReadWrite=!0,je.disabled=new je(519,je.ReadOnly,[0,1]);const Ve=7680;class Ne{constructor(t,e,i,r,n,s){this.test=t,this.ref=e,this.mask=i,this.fail=r,this.depthFail=n,this.pass=s}}Ne.disabled=new Ne({func:519,mask:0},0,0,Ve,Ve,Ve);const Ze=new WeakMap;function Ue(t){var e;if(Ze.has(t))return Ze.get(t);{const i=null===(e=t.getParameter(t.VERSION))||void 0===e?void 0:e.startsWith("WebGL 2.0");return Ze.set(t,i),i}}class Ge{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 i=t.context,r=i.gl;this._texFormat=r.RGBA,this._texType=r.UNSIGNED_BYTE;const n=new e.aF;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);const s=new e.aH;s.emplaceBack(0,1,2),this._fullscreenTriangle=new fe(i.createVertexBuffer(n,me.members),i.createIndexBuffer(s),e.aG.simpleSegment(0,0,n.length,s.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(r.TEXTURE1);const o=r.createTexture();r.bindTexture(r.TEXTURE_2D,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(o),Ue(r)&&(this._pbo=r.createBuffer(),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.bufferData(r.PIXEL_PACK_BUFFER,4,r.STREAM_READ),r.bindBuffer(r.PIXEL_PACK_BUFFER,null))}destroy(){const t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,e){const i=this._updateCount;return this._readbackQueue?i>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():i>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,e),this._updateCount++,this._measuredError}_bindFramebuffer(){const t=this._cachedRenderContext.context,e=t.gl;t.activeTexture.set(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,i){const r=this._cachedRenderContext.context,n=r.gl;if(this._bindFramebuffer(),r.viewport.set([0,0,this._texWidth,this._texHeight]),r.clear({color:e.b7.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(r,n.TRIANGLES,je.disabled,Ne.disabled,Fe.unblended,Oe.disabled,((t,e)=>
2({u_input:t,u_output_expected:e}))(t,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Ue(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);const 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(){const t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Ue(t)){const i=t.clientWaitSync(this._readbackQueue.sync,0,0);if(i===t.WAIT_FAILED)return e.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===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=Ge._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let e=0;return e+=t[0]/256,e+=t[1]/65536,e+=t[2]/16777216,t[3]<127&&(e=-e),e/128}}const $e=e.Z/128;function qe(t,i){const r=void 0!==t.granularity?Math.max(t.granularity,1):1,n=r+(t.generateBorders?2:0),s=r+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),o=n+1,a=s+1,l=t.generateBorders?-1:0,c=t.generateBorders||t.extendToNorthPole?-1:0,h=r+(t.generateBorders?1:0),u=r+(t.generateBorders||t.extendToSouthPole?1:0),d=o*a,p=n*s*6,f=o*a>65536;if(f&&"16bit"===i)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const m=f||"32bit"===i,_=new Int16Array(2*d);let g=0;for(let v=c;v<=u;v++)for(let i=l;i<=h;i++){let n=i/r*e.Z;-1===i&&(n=-64),i===r+1&&(n=e.Z+$e);let s=v/r*e.Z;-1===v&&(s=t.extendToNorthPole?e.b9:-64),v===r+1&&(s=t.extendToSouthPole?e.ba:e.Z+$e),_[g++]=n,_[g++]=s}const y=m?new Uint32Array(p):new Uint16Array(p);let x=0;for(let e=0;e<s;e++)for(let t=0;t<n;t++){const i=t+1+e*o,r=t+(e+1)*o,n=t+1+(e+1)*o;y[x++]=t+e*o,y[x++]=r,y[x++]=i,y[x++]=i,y[x++]=r,y[x++]=n}return{vertices:_.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:m}}const We=new e.aE({fill:new e.bb(128,2),line:new e.bb(512,0),tile:new e.bb(128,32),stencil:new e.bb(128,1),circle:3});class He{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 de.projectionGlobe}get vertexShaderPreludeCode(){return de.projectionMercator.vertexSource}get subdivisionGranularity(){return We}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new Ge(t));const i=e.S(this._errorQueryLatitudeDegrees),r=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,n=this._errorMeasurement.updateErrorLoop(i,r),s=o.now();n!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=n,this._errorMeasurementLastChangeTime=s);const a=Math.min(Math.max((s-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=e.bc(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,e.bd(a))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,e,i,r,n){const s=("stencil"===n?We.stencil:We.tile).getGranularityForZoomLevel(e.z);return this._getMesh(t,{granularity:s,generateBorders:i,extendToNorthPole:0===e.y&&r,extendToSouthPole:e.y===(1<<e.z)-1&&r})}_getMesh(t,i){const r=this._getMeshKey(i);if(r in this._tileMeshCache)return this._tileMeshCache[r];const n=function(t,i){const r=qe(i,"16bit"),n=e.aF.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),s=e.aH.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3});return new fe(t.createVertexBuffer(n,me.members),t.createIndexBuffer(s),e.aG.simpleSegment(0,0,n.length,s.length))}(t,i);return this._tileMeshCache[r]=n,n}recalculate(t){}hasTransition(){const t=o.now();let e=!1;return e=e||(t-this._errorMeasurementLastChangeTime)/1e3<.7,e=e||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,e}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}const Xe=new e.r({type:new e.D(e.v.projection.type)});class Ke extends e.E{constructor(t){super(),this._transitionable=new e.T(Xe),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new e.C(0)),this._mercatorProjection=new ye,this._verticalPerspectiveProjection=new He}get transitionState(){const 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 e.be){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,e,i,r,n){return this.currentProjection.getMeshFromTileID(t,e,i,r,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 Ye(t){const e=ti(t.worldSize,t.center.lat);return 2*Math.PI*e}function Je(t,i,r,n,s){const o=1/(1<<s),a=i/e.Z*o+n*o,l=e.bg((t/e.Z*o+r*o)*Math.PI*2+Math.PI,2*Math.PI),c=2*Math.atan(Math.exp(Math.PI-a*Math.PI*2))-.5*Math.PI,h=Math.cos(c),u=new Float64Array(3);return u[0]=Math.sin(l)*h,u[1]=Math.sin(c),u[2]=Math.cos(l)*h,u}function Qe(t){return function(t,e){const i=Math.cos(e),r=new Float64Array(3);return r[0]=Math.sin(t)*i,r[1]=Math.sin(e),r[2]=Math.cos(t)*i,r}(t.lng*Math.PI/180,t.lat*Math.PI/180)}function ti(t,e){return t/(2*Math.PI)/Math.cos(e*Math.PI/180)}function ei(t){const i=Math.asin(t[1])/Math.PI*180,r=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(r>1e-6){const n=t[0]/r,s=Math.acos(t[2]/r),o=(n>0?s:-s)/Math.PI*180;return new e.Q(e.aL(o,-180,180),i)}return new e.Q(0,i)}function ii(t){return Math.cos(t*Math.PI/180)}function ri(t,i){const r=ii(t),n=ii(i);return e.ab(n/r)}function ni(t,i){const r=t.rotate(i.bearingInRadians),n=i.zoom+ri(i.center.lat,0),s=e.bc(1/ii(i.center.lat),1/ii(Math.min(Math.abs(i.center.lat),60)),e.bf(n,7,3,0,1)),o=360/Ye({worldSize:i.worldSize,center:{lat:i.center.lat}});return new e.Q(i.center.lng-r.x*o*s,e.ae(i.center.lat+r.y*o,-85.051129,e.aJ))}function si(t){const e=.5*t,i=Math.sin(e),r=Math.cos(e);return Math.log(i+r)-Math.log(r-i)}function oi(t,i,r,n){const s=t.lat+r*n;if(Math.abs(r)>1){const o=(Math.sign(t.lat+r)!==Math.sign(t.lat)?-Math.abs(t.lat):Math.abs(t.lat))*Math.PI/180,a=Math.abs(t.lat+r)*Math.PI/180,l=si(o+n*(a-o)),c=si(o),h=si(a);return new e.Q(t.lng+i*((l-c)/(h-c)),s)}return new e.Q(t.lng+i*n,s)}class ai{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._aabbFactory=t}recalculateCache(){if(!this._hadAnyChanges)return;const t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileAABB(t,e,i,r){const n=`${t.z}_${t.x}_${t.y}`,s=this._cache.get(n);if(s)return s;const o=this._cachePrevious.get(n);if(o)return this._cache.set(n,o),o;const a=this._aabbFactory(t,e,i,r);return this._cache.set(n,a),this._hadAnyChanges=!0,a}}function li(t,e,i){const r=t-e;return r<0?-r:Math.max(0,r-i)}function ci(t,e,i,r,n){const s=t-i;let o;return o=s<0?Math.min(-s,1+s-n):s>1?Math.min(Math.max(s-n,0),1-s):0,Math.max(o,li(e,r,n))}class hi{constructor(){this._aabbCache=new ai(this._computeTileAABB)}recalculateCache(){this._aabbCache.recalculateCache()}distanceToTile2d(t,e,i,r){const n=1<<i.z,s=1/n,o=i.x/n,a=i.y/n;let l=2;return l=Math.min(l,ci(t,e,o,a,s)),l=Math.min(l,ci(t,e,o+.5,-a-s,s)),l=Math.min(l,ci(t,e,o+.5,2-a-s,s)),l}getWrap(t,e,i){const r=1<<e.z,n=1/r,s=e.x/r,o=li(t.x,s,n),a=li(t.x,s-1,n),l=li(t.x,s+1,n),c=Math.min(o,a,l);return c===l?1:c===a?-1:0}allowVariableZoom(t,e){return ht(t,e)>4}allowWorldCopies(){return!1}getTileAABB(t,e,i,r){return this._aabbCache.getTileAABB(t,e,i,r)}_computeTileAABB(t,i,r,n){if(t.z<=0)return new Ce([-1,-1,-1],[1,1,1]);if(1===t.z)return new Ce([0===t.x?-1:0,0===t.y?0:-1,-1],[0===t.x?0:1,0===t.y?1:0,1]);{const i=[Je(0,0,t.x,t.y,t.z),Je(e.Z,0,t.x,t.y,t.z),Je(e.Z,e.Z,t.x,t.y,t.z),Je(0,e.Z,t.x,t.y,t.z)],r=[1,1,1],n=[-1,-1,-1];for(const t of i)for(let e=0;e<3;e++)r[e]=Math.min(r[e],t[e]),n[e]=Math.max(n[e],t[e]);if(0===t.y||t.y===(1<<t.z)-1){const e=[0,0===t.y?1:-1,0];for(let t=0;t<3;t++)r[t]=Math.min(r[t],e[t]),n[t]=Math.max(n[t],e[t])}return new Ce(r,n)}}}
2class ui{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,e,i){return this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e){this._helper.resize(t,e)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}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 nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(){this._cachedClippingPlane=e.bh(),this._projectionMatrix=e.b1(),this._globeViewProjMatrix32f=e.b0(),this._globeViewProjMatrixNoCorrection=e.b1(),this._globeViewProjMatrixNoCorrectionInverted=e.b1(),this._globeProjMatrixInverted=e.b1(),this._cameraPosition=e.bi(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new Ie({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,e)=>this.getConstrained(t,e)}),this._coveringTilesDetailsProvider=new hi}clone(){const t=new ui;return t.apply(this),t}apply(t,e){this._globeLatitudeErrorCorrectionRadians=e||0,this._helper.apply(t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const t=e.bi();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){const{overscaledTileID:e,applyGlobeMatrix:i}=t,r=this._helper.getMercatorTileCoordinates(e);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:r,clippingPlane:this._cachedClippingPlane,projectionTransition:i?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const i=this.pitchInRadians,r=this.cameraToCenterDistance/t,n=Math.sin(i)*r,s=Math.cos(i)*r+1,o=1/Math.sqrt(n*n+s*s)*1;let a=-n,l=s;const c=Math.sqrt(a*a+l*l);a/=c,l/=c;const h=[0,a,l];return e.bj(h,h,[0,0,0],-this.bearingInRadians),e.bk(h,h,[0,0,0],-1*this.center.lat*Math.PI/180),e.bl
2(h,h,[0,0,0],this.center.lng*Math.PI/180),e.aO(h,h,.25),[...h,.25*-o]}isLocationOccluded(t){return!this.isSurfacePointVisible(Qe(t))}transformLightDirection(t){const i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,n=Math.cos(r),s=[Math.sin(i)*n,Math.sin(r),Math.cos(i)*n],o=[s[2],0,-s[0]],a=[0,0,0];e.aU(a,o,s),e.aT(o,o),e.aT(a,a);const l=[0,0,0];return e.aT(l,[o[0]*t[0]+a[0]*t[1]+s[0]*t[2],o[1]*t[0]+a[1]*t[1]+s[1]*t[2],o[2]*t[0]+a[2]*t[1]+s[2]*t[2]]),l}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,i,r){const n=function(t,i,r){const n=1/(1<<r.z);return new e.$(t/e.Z*n+r.x*n,i/e.Z*n+r.y*n)}(t,i,r.canonical),s=(o=n.y,[e.bg(n.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-.5*Math.PI]);var o;return this.getCircleRadiusCorrection()/Math.cos(s[1])}projectTileCoordinates(t,i,r,n){const s=r.canonical,o=Je(t,i,s.x,s.y,s.z),a=1+(n?n(t,i):0)/e.br,l=[o[0]*a,o[1]*a,o[2]*a,1];e.ap(l,l,this._globeViewProjMatrixNoCorrection);const c=this._cachedClippingPlane,h=c[0]*o[0]+c[1]*o[1]+c[2]*o[2]+c[3]<0;return{point:new e.P(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:h}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const t=ti(this.worldSize,this.center.lat),i=e.b2(),r=e.b2();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),e.aY(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const n=this.centerOffset;i[8]=2*-n.x/this._helper._width,i[9]=2*n.y/this._helper._height,this._projectionMatrix=e.aZ(i),this._globeProjMatrixInverted=e.b2(),e.aj(this._globeProjMatrixInverted,i),e.L(i,i,[0,0,-this.cameraToCenterDistance]),e.a_(i,i,this.rollInRadians),e.a$(i,i,-this.pitchInRadians),e.a_(i,i,this.bearingInRadians),e.L(i,i,[0,0,-t]);const s=e.bi();s[0]=t,s[1]=t,s[2]=t,e.a$(r,i,this.center.lat*Math.PI/180),e.bm(r,r,-this.center.lng*Math.PI/180),e.M(r,r,s),this._globeViewProjMatrixNoCorrection=r,e.a$(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),e.bm(i,i,-this.center.lng*Math.PI/180),e.M(i,i,s),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=e.b2(),e.aj(this._globeViewProjMatrixNoCorrectionInverted,r);const o=e.bi();this._cameraPosition=e.bi(),this._cameraPosition[2]=this.cameraToCenterDistance/t,e.bj(this._cameraPosition,this._cameraPosition,o,-this.rollInRadians),e.bk(this._cameraPosition,this._cameraPosition,o,this.pitchInRadians),e.bj(this._cameraPosition,this._cameraPosition,o,-this.bearingInRadians),e.aP(this._cameraPosition,this._cameraPosition,[0,0,1]),e.bk(this._cameraPosition,this._cameraPosition,o,-this.center.lat*Math.PI/180),e.bl(this._cameraPosition,this._cameraPosition,o,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const a=e.aZ(this._globeViewProjMatrixNoCorrectionInverted);e.M(a,a,[1,1,-1]),this._cachedFrustum=Ee.fromInvProjectionMatrix(a)}calculateFogMatrix(t){e.w("calculateFogMatrix is not supported on globe projection.");const i=e.b2();return e.at(i),i}getVisibleUnwrappedCoordinates(t){return[new e.aW(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&e.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,i){if(!this._globeViewProjMatrixNoCorrection)return 1;const r=Qe(t);e.aO(r,r,1+i/e.br);const n=e.bh();return e.ap(n,[r[0],r[1],r[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(t){}getBounds(){const t=.5*this.width,i=.5*this.height,r=[new e.P(0,0),new e.P(t,0),new e.P(this.width,0),new e.P(this.width,i),new e.P(this.width,this.height),new e.P(t,this.height),new e.P(0,this.height),new e.P(0,i)],n=[];for(const e of r)n.push(this.unprojectScreenPoint(e));let s=0,o=0,a=0,l=0;const c=this.center;for(const u of n){const t=e.bn(c.lng,u.lng),i=e.bn(c.lat,u.lat);t<o&&(o=t),t>s&&(s=t),i<l&&(l=i),i>a&&(a=i)}const h=[c.lng+o,c.lat+l,c.lng+s,c.lat+a];return this.isSurfacePointOnScreen([0,1,0])&&(h[3]=90,h[0]=-180,h[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(h[1]=-90,h[0]=-180,h[2]=180),new G(h)}getConstrained(t,i){const r=e.ae(t.lat,-85.051129,e.aJ),n=e.ae(+i,this.minZoom+ri(0,r),this.maxZoom);return{center:new e.Q(t.lng,r),zoom:n}}calculateCenterFromCameraLngLatAlt(t,e,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,r)}setLocationAtPoint(t,i){const r=Qe(this.unprojectScreenPoint(i)),n=Qe(t),s=e.bi();e.bo(s);const o=e.bi();e.bl(o,r,s,-this.center.lng*Math.PI/180),e.bk(o,o,s,this.center.lat*Math.PI/180);const a=n[0]*n[0]+n[2]*n[2],l=o[0]*o[0];if(a<l)return;const c=Math.sqrt(a-l),h=-c,u=e.bp(n[0],n[2],o[0],c),d=e.bp(n[0],n[2],o[0],h),p=e.bi();e.bl(p,n,s,-u);const f=e.bp(p[1],p[2],o[1],o[2]),m=e.bi();e.bl(m,n,s,-d);const _=e.bp(m[1],m[2],o[1],o[2]),g=.5*Math.PI,y=f>=-g&&f<=g,x=_>=-g&&_<=g;let v,b;if(y&&x){const t=this.center.lng*Math.PI/180,i=this.center.lat*Math.PI/180;e.bs(u,t)+e.bs(f,i)<e.bs(d,t)+e.bs(_,i)?(v=u,b=f):(v=d,b=_)}else if(y)v=u,b=f;else{if(!x)return;v=d,b=_}const w=v/Math.PI*180,T=b/Math.PI*180,P=this.center.lat;this.setCenter(new e.Q(w,e.ae(T,-90,90))),this.setZoom(this.zoom+ri(P,this.center.lat))}locationToScreenPoint(t,i){const r=Qe(t);if(i){const n=i.getElevationForLngLatZoom(t,this._helper._tileZoom);e.aO(r,r,1+n/e.br)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(t){const i=e.bh();return e.ap(i,[...t,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new e.P((.5*i[0]+.5)*this.width,(.5*-i[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,i){if(i){const e=i.pointCoordinate(t);if(e)return e}return e.$.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,e){var i;return null===(i=this.screenPointToMercatorCoordinate(t,e))||void 0===i?void 0:i.toLngLat()}
2isPointOnMapSurface(t,e){const i=this._cameraPosition,r=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(i,r)}getRayDirectionFromPixel(t){const i=e.bh();i[0]=t.x/this.width*2-1,i[1]=-1*(t.y/this.height*2-1),i[2]=1,i[3]=1,e.ap(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];const r=e.bi();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];const n=e.bi();return e.aT(n,r),n}isSurfacePointVisible(t){const e=this._cachedClippingPlane;return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;const i=e.bh();return e.ap(i,[...t,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(t,i){const r=e.aV(t,i),n=e.bi(),s=e.bi();e.aO(s,i,r),e.aS(n,t,s);const o=1-e.aV(n,n);if(o<0)return null;const a=e.aV(t,t)-1,l=-r+(r<0?1:-1)*Math.sqrt(o),c=a/l,h=l;return{tMin:Math.min(c,h),tMax:Math.max(c,h)}}unprojectScreenPoint(t){const i=this._cameraPosition,r=this.getRayDirectionFromPixel(t),n=this.rayPlanetIntersection(i,r);if(n){const t=e.bi();e.aP(t,i,[r[0]*n.tMin,r[1]*n.tMin,r[2]*n.tMin]);const s=e.bi();return e.aT(s,t),ei(s)}const s=this._cachedClippingPlane[0]*r[0]+this._cachedClippingPlane[1]*r[1]+this._cachedClippingPlane[2]*r[2],o=-e.bq(this._cachedClippingPlane,i)/s,a=e.bi();if(o>0)e.aP(a,i,[r[0]*o,r[1]*o,r[2]*o]);else{const t=e.bi();e.aP(t,i,[2*r[0],2*r[1],2*r[2]]);const n=e.bq(this._cachedClippingPlane,t);e.aS(a,t,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}const l=e.bi();return e.aT(l,a),ei(l)}getMatrixForModel(t,i){const r=e.Q.convert(t),n=1/e.br,s=e.b1();return e.bm(s,s,r.lng/180*Math.PI),e.a$(s,s,-r.lat/180*Math.PI),e.L(s,s,[0,0,1+i/e.br]),e.a$(s,s,.5*Math.PI),e.M(s,s,[n,n,n]),s}getProjectionDataForCustomLayer(t=!0){const i=this.getProjectionData({overscaledTileID:new e.Y(0,0,0,0,0),applyGlobeMatrix:t});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(t){}}class di{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,e,i){return this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,i=!0){this._helper.resize(t,e,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}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 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,e){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=e,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().recalculateCache(),this._mercatorTransform.getCoveringTilesDetailsProvider().recalculateCache()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new Ie({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,e)=>this.getConstrained(t,e)}),this._globeness=1,this._mercatorTransform=new ze,this._verticalPerspectiveTransform=new ui}clone(){const t=new di;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this),t}apply(t){this._helper.apply(t),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){const e=this._mercatorTransform.getProjectionData(t),i=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:e.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:e.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return e.bc(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return e.bc(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,i,r){const n=this._mercatorTransform.getPitchedTextCorrection(t,i,r),s=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,i,r);return e.bc(n,s,this._globeness)}projectTileCoordinates(t,e,i,r){return this.currentTransform.projectTileCoordinates(t,e,i,r)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,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,e){return this.currentTransform.lngLatToCameraDepth(t,e)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}getConstrained(t,e){return this.currentTransform.getConstrained(t,e)}calculateCenterFromCameraLngLatAlt(t,e,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,r)}setLocationAtPoint(t,e){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,e),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(t,e),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(t,e){return this.currentTransform.locationToScreenPoint(t,e)}screenPointToMercatorCoordinate(t,e){return this.currentTransform.screenPointToMercatorCoordinate(t,e)}screenPointToLocation(t,e){return this.currentTransform.screenPointToLocation(t,e)}
2isPointOnMapSurface(t,e){return this.currentTransform.isPointOnMapSurface(t,e)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,e){return this.currentTransform.getMatrixForModel(t,e)}getProjectionDataForCustomLayer(t=!0){const e=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return e;const i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return i.fallbackMatrix=e.mainMatrix,i}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class pi{get useGlobeControls(){return!0}handlePanInertia(t,i){const r=ni(t,i);return Math.abs(r.lng-i.center.lng)>180&&(r.lng=i.center.lng+179.5*Math.sign(r.lng-i.center.lng)),{easingCenter:r,easingOffset:new e.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,i){const r=t.around,n=i.screenPointToLocation(r);t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta);const s=i.zoom;t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta);const o=i.zoom-s;if(0===o)return;const a=e.bn(i.center.lng,n.lng),l=a/(Math.abs(a/180)+1),c=e.bn(i.center.lat,n.lat),h=i.getRayDirectionFromPixel(r),u=i.cameraPosition,d=-1*e.aV(u,h),p=e.bi();e.aP(p,u,[h[0]*d,h[1]*d,h[2]*d]);const f=e.bt(p)-1,m=Math.exp(.5*-Math.max(f-.3,0)),_=ti(i.worldSize,i.center.lat)/Math.min(i.width,i.height),g=e.bf(_,.9,.5,1,.25),y=(1-e.aI(-o))*Math.min(m,g),x=i.center.lat,v=i.zoom,b=new e.Q(i.center.lng+l*y,e.ae(i.center.lat+c*y,-85.051129,e.aJ));i.setLocationAtPoint(n,r);const w=i.center,T=e.bf(Math.abs(a),45,85,0,1),P=e.bf(_,.75,.35,0,1),M=Math.pow(Math.max(T,P),.25),S=e.bn(w.lng,b.lng),I=e.bn(w.lat,b.lat);i.setCenter(new e.Q(w.lng+S*M,w.lat+I*M).wrap()),i.setZoom(v+ri(x,i.center.lat))}handleMapControlsPan(t,e,i){if(!t.panDelta)return;const r=e.center.lat,n=e.zoom;e.setCenter(ni(t.panDelta,e).wrap()),e.setZoom(n+ri(r,e.center.lat))}cameraForBoxAndBearing(t,i,r,n,s){const o=Re(t,i,r,n,s),a=i.left/s.width*2-1,l=(s.width-i.right)/s.width*2-1,c=i.top/s.height*-2+1,h=(s.height-i.bottom)/s.height*-2+1,u=e.bn(r.getWest(),r.getEast())<0,d=u?r.getEast():r.getWest(),p=u?r.getWest():r.getEast(),f=Math.max(r.getNorth(),r.getSouth()),m=Math.min(r.getNorth(),r.getSouth()),_=d+.5*e.bn(d,p),g=f+.5*e.bn(f,m),y=s.clone();y.setCenter(o.center),y.setBearing(o.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(o.zoom);const x=y.modelViewProjectionMatrix,v=[Qe(r.getNorthWest()),Qe(r.getNorthEast()),Qe(r.getSouthWest
2()),Qe(r.getSouthEast()),Qe(new e.Q(p,g)),Qe(new e.Q(d,g)),Qe(new e.Q(_,f)),Qe(new e.Q(_,m))],b=Qe(o.center);let w=Number.POSITIVE_INFINITY;for(const e of v)a<0&&(w=pi.getLesserNonNegativeNonNull(w,pi.solveVectorScale(e,b,x,"x",a))),l>0&&(w=pi.getLesserNonNegativeNonNull(w,pi.solveVectorScale(e,b,x,"x",l))),c>0&&(w=pi.getLesserNonNegativeNonNull(w,pi.solveVectorScale(e,b,x,"y",c))),h<0&&(w=pi.getLesserNonNegativeNonNull(w,pi.solveVectorScale(e,b,x,"y",h)));if(Number.isFinite(w)&&0!==w)return o.zoom=y.zoom+e.ab(w),o;ke()}handleJumpToCenterZoom(t,i){const r=t.center.lat,n=t.getConstrained(i.center?e.Q.convert(i.center):t.center,t.zoom).center;t.setCenter(n.wrap());const s=void 0!==i.zoom?+i.zoom:t.zoom+ri(r,n.lat);t.zoom!==s&&t.setZoom(s)}handleEaseTo(t,i){const r=t.zoom,n=t.center,s=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},a={roll:void 0===i.roll?t.roll:i.roll,pitch:void 0===i.pitch?t.pitch:i.pitch,bearing:void 0===i.bearing?t.bearing:i.bearing},l=void 0!==i.zoom,c=!t.isPaddingEqual(i.padding);let h=!1;const u=i.center?e.Q.convert(i.center):n,d=t.getConstrained(u,r).center;Me(t,d);const p=t.clone();p.setCenter(d),p.setZoom(l?+i.zoom:r+ri(n.lat,u.lat)),p.setBearing(i.bearing);const f=new e.P(e.ae(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),e.ae(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));p.setLocationAtPoint(d,f);const m=(i.offset&&i.offsetAsPoint.mag())>0?p.center:d,_=l?+i.zoom:r+ri(n.lat,m.lat),g=r+ri(n.lat,0),y=_+ri(m.lat,0),x=e.bn(n.lng,m.lng),v=e.bn(n.lat,m.lat),b=e.aI(y-g);return h=_!==r,{easeFunc:r=>{if(e.b6(o,a)||De({startEulerAngles:o,endEulerAngles:a,tr:t,k:r,useSlerp:o.roll!=a.roll}),c&&t.interpolatePadding(s,i.padding,r),i.around)e.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(i.around,i.aroundPoint);else{const e=y>g?Math.min(2,b):Math.max(.5,b),i=Math.pow(e,1-r),s=oi(n,x,v,r*i);t.setCenter(s.wrap())}if(h){const i=e.B.number(g,y,r)+ri(0,t.center.lat);t.setZoom(i)}},isZooming:h,elevationCenter:m}}handleFlyTo(t,i){const r=void 0!==i.zoom,n=t.center,s=t.zoom,o=t.padding,a=!t.isPaddingEqual(i.padding),l=t.getConstrained(e.Q.convert(i.center||i.locationAtOffset),s).center,c=r?+i.zoom:t.zoom+ri(t.center.lat,l.lat),h=t.clone();h.setCenter(l),h.setZoom(c),h.setBearing(i.bearing);const u=new e.P(e.ae(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),e.ae(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));h.setLocationAtPoint(l,u);const d=h.center;Me(t,d);const p=function(t,i,r){const n=Qe(i),s=Qe(r),o=e.aV(n,s),a=Math.acos(o),l=Ye(t);return a/(2*Math.PI)*l}(t,n,d),f=s+ri(n.lat,0),m=c+ri(d.lat,0),_=e.aI(m-f);let g;if("number"==typeof i.minZoom){const r=+i.minZoom+ri(d.lat,0),n=Math.min(r,f,m)+ri(0,d.lat),s=t.getConstrained(d,n).zoom+ri(d.lat,0);g=e.aI(s-f)}const y=e.bn(n.lng,d.lng),x=e.bn(n.lat,d.lat);return{easeFunc:(r,s,l,h)=>{const u=oi(n,y,x,l);a&&t.interpolatePadding(o,i.padding,r);const p=1===r?d:u;t.setCenter(p.wrap());const m=f+e.ab(s);t.setZoom(1===r?c:m+ri(0,p.lat))},scaleOfZoom:_,targetCenter:d,scaleOfMinZoom:g,pixelPathLength:p}}static solveVectorScale(t,e,i,r,n){const s="x"===r?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],o=[i[3],i[7],i[11],i[15]],a=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],l=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],c=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],h=e[0]*o[0]+e[1]*o[1]+e[2]*o[2];return c+n*l===a+n*h||o[3]*(a-c)+s[3]*(h-l)+a*h==c*l?null:(c+s[3]-n*h-n*o[3])/(c-a-n*h+n*l)}static getLesserNonNegativeNonNull(t,e){return null!==e&&e>=0&&e<t?e:t}}class fi{constructor(t){this._globe=t,this._mercatorCameraHelper=new Le,this._verticalPerspectiveCameraHelper=new pi}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,e){return this.currentHelper.handlePanInertia(t,e)}handleMapControlsRollPitchBearingZoom(t,e){return this.currentHelper.handleMapControlsRollPitchBearingZoom(t,e)}handleMapControlsPan(t,e,i){this.currentHelper.handleMapControlsPan(t,e,i)}cameraForBoxAndBearing(t,e,i,r,n){return this.currentHelper.cameraForBoxAndBearing(t,e,i,r,n)}handleJumpToCenterZoom(t,e){this.currentHelper.handleJumpToCenterZoom(t,e)}handleEaseTo(t,e){return this.currentHelper.handleEaseTo(t,e)}handleFlyTo(t,e){return this.currentHelper.handleFlyTo(t,e)}}const mi=(t,i)=>e.x(t,i&&i.filter((t=>"source.canvas"!==t.identifier))),_i=e.bu();class gi extends e.E{constructor(t,i={}){super(),this._rtlPluginLoaded=()=>{for(const t in this.sourceCaches){const e=this.sourceCaches[t].getSource().type;"vector"!==e&&"geojson"!==e||this.sourceCaches[t].reload()}},this.map=t,this.dispatcher=new B(F(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((t,e)=>this.getGlyphs(t,e))),this.dispatcher.registerMessageHandler("GI",((t,e)=>this.getImages(t,e))),this.imageManager=new v,this.imageManager.setEventedParent(this),this.glyphManager=new P(t._requestManager,i.localIdeographFontFamily),this.lineAtlas=new E(256,512),this.crossTileSymbolIndex=new he,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new e.bv,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",e.bw()),nt().on(et,this._rtlPluginLoaded),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const r in this._layers){const t=this._layers[r];
2t.source===i.id&&this._validateLayer(t)}}))}loadURL(t,i={},r){this.fire(new e.l("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const n=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const s=this._loadStyleRequest;e.j(n,this._loadStyleRequest).then((t=>{this._loadStyleRequest=null,this._load(t.data,i,r)})).catch((t=>{this._loadStyleRequest=null,t&&!s.signal.aborted&&this.fire(new e.k(t))}))}loadJSON(t,i={},r){this.fire(new e.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,o.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(t,i,r)})).catch((()=>{}))}loadEmpty(){this.fire(new e.l("dataloading",{dataType:"style"})),this._load(_i,{validate:!1})}_load(t,i,r){var n,s;const o=i.transformStyle?i.transformStyle(r,t):t;if(!i.validate||!mi(this,e.y(o))){this._loaded=!0,this.stylesheet=o;for(const t in 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 I(this.stylesheet.light),this._setProjectionInternal((null===(n=this.stylesheet.projection)||void 0===n?void 0:n.type)||"mercator"),this.sky=new A(this.stylesheet.sky),this.map.setTerrain(null!==(s=this.stylesheet.terrain)&&void 0!==s?s:null),this.fire(new e.l("data",{dataType:"style"})),this.fire(new e.l("style.load"))}}_createLayers(){const t=e.bx(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(const i of t){const t=e.by(i);t.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=t}}_loadSprite(t,i=!1,r=void 0){let n;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(t,i,r,n){return e._(this,void 0,void 0,(function*(){const s=_(t),a=r>1?"@2x":"",l={},c={};for(const{id:t,url:r}of s){const s=i.transformRequest(g(r,a,".json"),"SpriteJSON");l[t]=e.j(s,n);const o=i.transformRequest(g(r,a,".png"),"SpriteImage");c[t]=f.getImage(o,n)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(t,i){return e._(this,void 0,void 0,(function*(){const e={};for(const r in t){e[r]={};const n=o.getImageCanvasContext((yield i[r]).data),s=(yield t[r]).data;for(const t in s){const{width:i,height:o,x:a,y:l,sdf:c,pixelRatio:h,stretchX:u,stretchY:d,content:p,textFitWidth:f,textFitHeight:m}=s[t];e[r][t]={data:null,pixelRatio:h,sdf:c,stretchX:u,stretchY:d,content:p,textFitWidth:f,textFitHeight:m,spriteData:{width:i,height:o,x:a,y:l,context:n}}}}return e}))}(l,c)}))}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((t=>{if(this._spriteRequest=null,t)for(const e in t){this._spritesImagesIds[e]=[];const r=this._spritesImagesIds[e]?this._spritesImagesIds[e].filter((e=>!(e in t))):[];for(const t of r)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const n in t[e]){const r="default"===e?n:`${e}:${n}`;this._spritesImagesIds[e].push(r),r in this.imageManager.images?this.imageManager.updateImage(r,t[e][n],!1):this.imageManager.addImage(r,t[e][n]),i&&(this._changedImages[r]=!0)}}})).catch((t=>{this._spriteRequest=null,n=t,this.fire(new e.k(n))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"})),r&&r(n)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}))}_validateLayer(t){const i=this.sourceCaches[t.source];if(!i)return;const r=t.sourceLayer;if(!r)return;const n=i.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(r))&&this.fire(new e.k(new Error(`Source layer "${r}" does not exist on source "${n.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,i=!1){const r=this._serializedAllLayers();if(!t||0===t.length)return Object.values(i?e.bz(r):r);const n=[];for(const s of t)if(r[s]){const t=i?e.bz(r[s]):r[s];n.push(t)}return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const i of e){const e=this._layers[i];"custom"!==e.type&&(t[i]=e.serialize())}return t}hasTransitions(){var t,e,i;if(null===(t=this.light)||void 0===t?void 0:t.hasTransition())return!0;
2if(null===(e=this.sky)||void 0===e?void 0:e.hasTransition())return!0;if(null===(i=this.projection)||void 0===i?void 0:i.hasTransition())return!0;for(const r in this.sourceCaches)if(this.sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const i=this._changed;if(i){const e=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(e.length||i.length)&&this._updateWorkerLayers(e,i);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const r in this._updatedPaintProps)this._layers[r].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const r={};for(const e in this.sourceCaches){const t=this.sourceCaches[e];r[e]=t.used,t.used=!1}for(const e of this._order){const i=this._layers[e];i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(const n in r){const t=this.sourceCaches[n];!!r[n]!=!!t.used&&t.fire(new e.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:n}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,i&&this.fire(new e.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,i={}){var r;this._checkLoaded();const n=this.serialize();if(t=i.transformStyle?i.transformStyle(n,t):t,(null===(r=i.validate)||void 0===r||r)&&mi(this,e.y(t)))return!1;(t=e.bz(t)).layers=e.bx(t.layers);const s=e.bA(n,t),o=this._getOperationsToPerform(s);if(o.unimplemented.length>0)throw new Error(`Unimplemented: ${o.unimplemented.join(", ")}.`);if(0===o.operations.length)return!1;for(const e of o.operations)e();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const e=[],i=[];for(const r of t)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":e.push((()=>this.addLayer.apply(this,r.args)));break;case"removeLayer":e.push((()=>this.removeLayer.apply(this,r.args)));break;case"setPaintProperty":e.push((()=>this.setPaintProperty.apply(this,r.args)));break;case"setLayoutProperty":e.push((()=>this.setLayoutProperty.apply(this,r.args)));break;case"setFilter":e.push((()=>this.setFilter.apply(this,r.args)));break;case"addSource":e.push((()=>this.addSource.apply(this,r.args)));break;case"removeSource":e.push((()=>this.removeSource.apply(this,r.args)));break;case"setLayerZoomRange":e.push((()=>this.setLayerZoomRange.apply(this,r.args)));break;case"setLight":e.push((()=>this.setLight.apply(this,r.args)));break;case"setGeoJSONSourceData":e.push((()=>this.setGeoJSONSourceData.apply(this,r.args)));break;case"setGlyphs":e.push((()=>this.setGlyphs.apply(this,r.args)));break;case"setSprite":e.push((()=>this.setSprite.apply(this,r.args)));break;case"setTerrain":e.push((()=>this.map.setTerrain.apply(this,r.args)));break;case"setSky":e.push((()=>this.setSky.apply(this,r.args)));break;case"setProjection":this.setProjection.apply(this,r.args);break;case"setTransition":e.push((()=>{}));break;default:i.push(r.command)}return{operations:e,unimplemented:i}}addImage(t,i){if(this.getImage(t))return this.fire(new e.k(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,i),this._afterImageUpdated(t)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new e.k(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,i,r={}){if(this._checkLoaded(),void 0!==this.sourceCaches[t])throw new Error(`Source "${t}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Ob
2ject.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(e.y.source,`sources.${t}`,i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const n=this.sourceCaches[t]=new dt(t,i,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.sourceCaches[t])throw new Error("There is no source with this ID");for(const r in this._layers)if(this._layers[r].source===t)return this.fire(new e.k(new Error(`Source "${t}" cannot be removed while layer "${r}" is using it.`)));const i=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],i.fire(new e.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const i=this.sourceCaches[t].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,i,r={}){this._checkLoaded();const n=t.id;if(this.getLayer(n))return void this.fire(new e.k(new Error(`Layer "${n}" already exists on this map.`)));let s;if("custom"===t.type){if(mi(this,e.bB(t)))return;s=e.by(t)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(n,t.source),t=e.bz(t),t=e.e(t,{source:n})),this._validate(e.y.layer,`layers.${n}`,t,{arrayIndex:-1},r))return;s=e.by(t),this._validateLayer(s),s.setEventedParent(this,{layer:{id:n}})}const o=i?this._order.indexOf(i):this._order.length;if(i&&-1===o)this.fire(new e.k(new Error(`Cannot add layer "${n}" before non-existing layer "${i}".`)));else{if(this._order.splice(o,0,n),this._layerOrderChanged=!0,this._layers[n]=s,this._removedLayers[n]&&s.source&&"custom"!==s.type){const t=this._removedLayers[n];delete this._removedLayers[n],t.type!==s.type?this._updatedSources[s.source]="clear":(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause())}this._updateLayer(s),s.onAdd&&s.onAdd(this.map)}}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===i)return;const r=this._order.indexOf(t);this._order.splice(r,1);const n=i?this._order.indexOf(i):this._order.length;i&&-1===n?this.fire(new e.k(new Error(`Cannot move layer "${t}" before non-existing layer "${i}".`))):(this._order.splice(n,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const i=this._layers[t];if(!i)return void this.fire(new e.k(new Error(`Cannot remove non-existing layer "${t}".`)));i.setEventedParent(null);const r=this._order.indexOf(t);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,i,r){this._checkLoaded();const n=this.getLayer(t);n?n.minzoom===i&&n.maxzoom===r||(null!=i&&(n.minzoom=i),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new e.k(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,i,r={}){this._checkLoaded();const n=this.getLayer(t);if(n){if(!e.bC(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(e.y.filter,`layers.${n.id}.filter`,i,null,r)||(n.filter=e.bz(i),this._updateLayer(n)))}else this.fire(new e.k(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return e.bz(this.getLayer(t).filter)}setLayoutProperty(t,i,r,n={}){this._checkLoaded();const s=this.getLayer(t);s?e.bC(s.getLayoutProperty(i),r)||(s.setLayoutProperty(i,r,n),this._updateLayer(s)):this.fire(new e.k(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,i){const r=this.getLayer(t);if(r)return r.getLayoutProperty(i);this.fire(new e.k(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,i,r,n={}){this._checkLoaded();const s=this.getLayer(t);s?e.bC(s.getPaintProperty(i),r)||(s.setPaintProperty(i,r,n)&&this._updateLayer(s),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new e.k(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(t,i){this._checkLoaded();const r=t.source,n=t.sourceLayer,s=this.sourceCaches[r];if(void 0===s)return void this.fire(new e.k(new Error(`The source '${r}' does not exist in the map's style.`)));
2const o=s.getSource().type;"geojson"===o&&n?this.fire(new e.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||n?(void 0===t.id&&this.fire(new e.k(new Error("The feature id parameter must be provided."))),s.setFeatureState(n,t.id,i)):this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,i){this._checkLoaded();const r=t.source,n=this.sourceCaches[r];if(void 0===n)return void this.fire(new e.k(new Error(`The source '${r}' does not exist in the map's style.`)));const s=n.getSource().type,o="vector"===s?t.sourceLayer:void 0;"vector"!==s||o?i&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new e.k(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(o,t.id,i):this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const i=t.source,r=t.sourceLayer,n=this.sourceCaches[i];if(void 0!==n)return"vector"!==n.getSource().type||r?(void 0===t.id&&this.fire(new e.k(new Error("The feature id parameter must be provided."))),n.getFeatureState(r,t.id)):void this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new e.k(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return e.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=e.bD(this.sourceCaches,(t=>t.serialize())),i=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,n=this.stylesheet;return e.bE({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:i,terrain:r},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},r=[];for(let s=this._order.length-1;s>=0;s--){const n=this._order[s];if(e(n)){i[n]=s;for(const e of t){const t=e[n];if(t)for(const e of t)r.push(e)}}}r.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const n=[];for(let s=this._order.length-1;s>=0;s--){const o=this._order[s];if(e(o))for(let t=r.length-1;t>=0;t--){const e=r[t].feature;if(i[e.layer.id]<s)break;n.push(e),r.pop()}else for(const e of t){const t=e[o];if(t)for(const e of t)n.push(e.feature)}}return n}queryRenderedFeatures(t,i,r){i&&i.filter&&this._validate(e.y.filter,"queryRenderedFeatures.filter",i.filter,null,i);const n={};if(i&&i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new e.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const t of i.layers){const i=this._layers[t];if(!i)return this.fire(new e.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];n[i.source]=!0}}const s=[];i.availableImages=this._availableImages;const o=this._serializedAllLayers(),a=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,l=Object.assign(Object.assign({},i),{layers:a});for(const e in this.sourceCaches)i.layers&&!n[e]||s.push(V(this.sourceCaches[e],this._layers,o,t,l,r,this.map.terrain?(t,e,i)=>this.map.terrain.getElevation(t,e,i):void 0));return this.placement&&s.push(function(t,e,i,r,n,s,o){const a={},l=s.queryRenderedSymbols(r),c=[];for(const h of Object.keys(l).map(Number))c.push(o[h]);c.sort(N);for(const h of c){const i=h.featureIndex.lookupSymbolFeatures(l[h.bucketInstanceId],e,h.bucketIndex,h.sourceLayerIndex,n.filter,n.layers,n.availableImages,t);for(const t in i){const e=a[t]=a[t]||[],r=i[t];r.sort(((t,e)=>{const i=h.featureSortOrder;if(i){const r=i.indexOf(t.featureIndex);return i.indexOf(e.featureIndex)-r}return e.featureIndex-t.featureIndex}));for(const t of r)e.push(t)}}
2return function(t,e,i){for(const r in t)for(const n of t[r])Z(n,i[e[r].source]);return t}(a,t,i)}(this._layers,o,this.sourceCaches,t,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(s)}querySourceFeatures(t,i){i&&i.filter&&this._validate(e.y.filter,"querySourceFeatures.filter",i.filter,null,i);const r=this.sourceCaches[t];return r?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),r=[],n={};for(let s=0;s<i.length;s++){const t=i[s],o=t.tileID.canonical.key;n[o]||(n[o]=!0,t.querySourceFeatures(r,e))}return r}(r,i):[]}getLight(){return this.light.getLight()}setLight(t,i={}){this._checkLoaded();const r=this.light.getLight();let n=!1;for(const o in t)if(!e.bC(t[o],r[o])){n=!0;break}if(!n)return;const s={now:o.now(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,i),this.light.updateTransitions(s)}getProjection(){var t;return null===(t=this.stylesheet)||void 0===t?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?void 0:t.sky}setSky(t,i={}){this._checkLoaded();const r=this.getSky();let n=!1;if(!t&&!r)return;if(t&&!r)n=!0;else if(!t&&r)n=!0;else for(const o in t)if(!e.bC(t[o],r[o])){n=!0;break}if(!n)return;const s={now:o.now(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,i),this.sky.updateTransitions(s)}_setProjectionInternal(t){const i=function(t){if(Array.isArray(t)){const e=new Ke({type:t});return{projection:e,transform:new di,cameraHelper:new fi(e)}}switch(t){case"mercator":return{projection:new ye,transform:new ze,cameraHelper:new Le};case"globe":{const t=new Ke({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:t,transform:new di,cameraHelper:new fi(t)}}case"vertical-perspective":return{projection:new He,transform:new ui,cameraHelper:new pi};default:return e.w(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new ye,transform:new ze,cameraHelper:new Le}}}(t);this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper);for(const e in this.sourceCaches)this.sourceCaches[e].reload()}_validate(t,i,r,n,s={}){return(!s||!1!==s.validate)&&mi(this,t.call(e.y,e.e({key:i,style:this.serialize(),value:r,styleSpec:e.v},n)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),nt().off(et,this._rtlPluginLoaded);for(const e in this._layers)this._layers[e].setEventedParent(null);for(const e in this.sourceCaches){const t=this.sourceCaches[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const e in this.sourceCaches)this.sourceCaches[e].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,e,i,r,n=!1){let s=!1,a=!1;const l={};for(const o of this._order){const e=this._layers[o];if("symbol"!==e.type)continue;if(!l[e.source]){const t=this.sourceCaches[e.source];l[e.source]=t.getRenderableIds(!0).map((e=>t.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)))}const i=this.crossTileSymbolIndex.addLayer(e,l[e.source],t.center.lng);s=s||i}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((n=n||this._layerOrderChanged||0===i)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.now(),t.zoom))&&(this.pauseablePlacement=new se(t,this.map.terrain,this._order,n,e,i,r,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(o.now()),a=!0),s&&this.pauseablePlacement.placement.setStale()),a||s)for(const o of this._order){const t=this._layers[o];
2"symbol"===t.type&&this.placement.updateLayerOpacities(t,l[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(o.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,i){return e._(this,void 0,void 0,(function*(){const t=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const e=this.sourceCaches[i.source];return e&&e.setDependencies(i.tileID.key,i.type,i.icons),t}))}getGlyphs(t,i){return e._(this,void 0,void 0,(function*(){const t=yield this.glyphManager.getGlyphs(i.stacks),e=this.sourceCaches[i.source];return e&&e.setDependencies(i.tileID.key,i.type,[""]),t}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,i={}){this._checkLoaded(),t&&this._validate(e.y.glyphs,"glyphs",t,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,i,r={},n){this._checkLoaded();const s=[{id:t,url:i}],o=[..._(this.stylesheet.sprite),...s];this._validate(e.y.sprite,"sprite",o,null,r)||(this.stylesheet.sprite=o,this._loadSprite(s,!0,n))}removeSprite(t){this._checkLoaded();const i=_(this.stylesheet.sprite);if(i.find((e=>e.id===t))){if(this._spritesImagesIds[t])for(const e of this._spritesImagesIds[t])this.imageManager.removeImage(e),this._changedImages[e]=!0;i.splice(i.findIndex((e=>e.id===t)),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}))}else this.fire(new e.k(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return _(this.stylesheet.sprite)}setSprite(t,i={},r){this._checkLoaded(),t&&this._validate(e.y.sprite,"sprite",t,null,i)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,r):(this._unloadSprite(),r&&r(null)))}}var yi=e.aD([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class xi{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,i,r,n,s,o,a,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==r.length;for(let h=0;!c&&h<r.length;h++)this.boundPaintVertexBuffers[h]!==r[h]&&(c=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==s||this.boundDynamicVertexBuffer!==o||this.boundDynamicVertexBuffer2!==a||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,i,r,n,s,o,a,l):(t.bindVertexArray.set(this.vao),o&&o.bind(),n&&n.dynamicDraw&&n.bind(),a&&a.bind(),l&&l.bind())}freshBind(t,e,i,r,n,s,o,a){const l=t.numAttributes,c=this.context,h=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=s,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=a,e.enableAttributes(h,t);for(const u of i)u.enableAttributes(h,t);s&&s.enableAttributes(h,t),o&&o.enableAttributes(h,t),a&&a.enableAttributes(h,t),e.bind(),e.setVertexAttribPointers(h,t,n);for(const u of i)u.bind(),u.setVertexAttribPointers(h,t,n);s&&(s.bind(),s.setVertexAttribPointers(h,t,n)),r&&r.bind(),o&&(o.bind(),o.setVertexAttribPointers(h,t,n)),a&&(a.bind(),a.setVertexAttribPointers(h,t,n)),c.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const vi=(t,i,r,n,s)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:i,u_fog_color:r?r.properties.get("fog-color"):e.b7.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:s?0:r?r.calculateFogBlendOpacity(n):0,u_horizon_color:r?r.properties.get("horizon-color"):e.b7.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:s?1:0}),bi={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 wi(t){const e=[];for(let i=0;i<t.length;i++){if(null===t[i])continue;const r=t[i].split(" ");e.push(r.pop())}return e}class Ti{constructor(t,i,r,n,s,o,a,l){const c=t.gl;this.program=c.createProgram();const h=wi(i.staticAttributes),u=r?r.getBinderAttributes():[],d=h.concat(u),p=de.prelude.staticUniforms?wi(de.prelude.staticUniforms):[],f=a.staticUniforms?wi(a.staticUniforms):[],m=i.staticUniforms?wi(i.staticUniforms):[],_=r?r.getBinderUniforms():[],g=p.concat(f).concat(m).concat(_),y=[];for(const e of g)y.indexOf(e)<0&&y.push(e);const x=r?r.defines():[];Ue(c)&&x.unshift("#version 300 es"),s&&x.push("#define OVERDRAW_INSPECTOR;"),o&&x.push("#define TERRAIN3D;"),l&&x.push(l);let v=x.concat(de.prelude.fragmentSource,a.fragmentSource,i.fragmentSource).join("\n"),b=x.concat(de.prelude.vertexSource,a.vertexSource,i.vertexSource).join("\n");Ue(c)||(v=function(t){return t.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(v),b=function(t){return t.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(b));const w=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);if(c.shaderSource(w,v),c.compileShader(w),!c.getShaderParameter(w,c.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${c.getShaderInfoLog(w)}`);c.attachShader(this.program,w);const T=c.createShader(c.VERTEX_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);
2if(c.shaderSource(T,b),c.compileShader(T),!c.getShaderParameter(T,c.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${c.getShaderInfoLog(T)}`);c.attachShader(this.program,T),this.attributes={};const P={};this.numAttributes=d.length;for(let e=0;e<this.numAttributes;e++)d[e]&&(c.bindAttribLocation(this.program,e,d[e]),this.attributes[d[e]]=e);if(c.linkProgram(this.program),!c.getProgramParameter(this.program,c.LINK_STATUS))throw new Error(`Program failed to link: ${c.getProgramInfoLog(this.program)}`);c.deleteShader(T),c.deleteShader(w);for(let e=0;e<y.length;e++){const t=y[e];if(t&&!P[t]){const e=c.getUniformLocation(this.program,t);e&&(P[t]=e)}}this.fixedUniforms=n(t,P),this.terrainUniforms=((t,i)=>({u_depth:new e.bF(t,i.u_depth),u_terrain:new e.bF(t,i.u_terrain),u_terrain_dim:new e.b8(t,i.u_terrain_dim),u_terrain_matrix:new e.bH(t,i.u_terrain_matrix),u_terrain_unpack:new e.bI(t,i.u_terrain_unpack),u_terrain_exaggeration:new e.b8(t,i.u_terrain_exaggeration)}))(t,P),this.projectionUniforms=((t,i)=>({u_projection_matrix:new e.bH(t,i.u_projection_matrix),u_projection_tile_mercator_coords:new e.bI(t,i.u_projection_tile_mercator_coords),u_projection_clipping_plane:new e.bI(t,i.u_projection_clipping_plane),u_projection_transition:new e.b8(t,i.u_projection_transition),u_projection_fallback_matrix:new e.bH(t,i.u_projection_fallback_matrix)}))(t,P),this.binderUniforms=r?r.getUniforms(t,P):[]}draw(t,e,i,r,n,s,o,a,l,c,h,u,d,p,f,m,_,g,y){const x=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(r),t.setColorMode(n),t.setCullFace(s),a){t.activeTexture.set(x.TEXTURE2),x.bindTexture(x.TEXTURE_2D,a.depthTexture),t.activeTexture.set(x.TEXTURE3),x.bindTexture(x.TEXTURE_2D,a.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(a[t])}if(l)for(const b in l)this.projectionUniforms[bi[b]].set(l[b]);if(o)for(const b in this.fixedUniforms)this.fixedUniforms[b].set(o[b]);m&&m.setUniforms(t,this.binderUniforms,p,{zoom:f});let v=0;switch(e){case x.LINES:v=2;break;case x.TRIANGLES:v=3;break;case x.LINE_STRIP:v=1}for(const b of d.get()){const i=b.vaos||(b.vaos={});(i[c]||(i[c]=new xi)).bind(t,this,h,m?m.getPaintVertexBuffers():[],u,b.vertexOffset,_,g,y),x.drawElements(e,b.primitiveLength*v,x.UNSIGNED_SHORT,b.primitiveOffset*v*2)}}}function Pi(t,i,r){const n=1/e.aw(r,1,i.transform.tileZoom),s=Math.pow(2,r.tileID.overscaledZ),o=r.tileSize*Math.pow(2,i.transform.tileZoom)/s,a=o*(r.tileID.canonical.x+r.tileID.wrap*s),l=o*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,l>>16],u_pixel_coord_lower:[65535&a,65535&l]}}const Mi=(t,i,r,n)=>{const s=t.style.light,o=s.properties.get("position"),a=[o.x,o.y,o.z],l=e.bL();"viewport"===s.properties.get("anchor")&&e.bM(l,t.transform.bearingInRadians),e.bN(a,a,l);const c=t.transform.transformLightDirection(a),h=s.properties.get("color");return{u_lightpos:a,u_lightpos_globe:c,u_lightintensity:s.properties.get("intensity"),u_lightcolor:[h.r,h.g,h.b],u_vertical_gradient:+i,u_opacity:r,u_fill_translate:n}},Si=(t,i,r,n,s,o,a)=>e.e(Mi(t,i,r,n),Pi(o,t,a),{u_height_factor:-Math.pow(2,s.overscaledZ)/a.tileSize/8}),Ii=(t,i,r,n)=>e.e(Pi(i,t,r),{u_fill_translate:n}),Ci=(t,e)=>({u_world:t,u_fill_translate:e}),Ai=(t,i,r,n,s)=>e.e(Ii(t,i,r,s),{u_world:n}),Ei=(t,i,r,n,s)=>{const o=t.transform;let a,l,c=0;if("map"===r.paint.get("circle-pitch-alignment")){const t=e.aw(i,1,o.zoom);a=!0,l=[t,t],c=t/(e.Z*Math.pow(2,i.tileID.overscaledZ))*2*Math.PI*s}else a=!1,l=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_pitch_with_map:+a,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:c,u_translate:n}},zi=t=>({u_pixel_extrude_scale:[1/t.width,1/t.height]}),ki=t=>({u_viewport_size:[t.width,t.height]}),Di=(t,e=1)=>({u_color:t,u_overlay:0,u_overlay_scale:e}),Ri=(t,i,r,n)=>{const s=e.aw(t,1,i)/(e.Z*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:e.aw(t,1,i),u_intensity:r,u_globe_extrude_scale:s}},Li=(t,i,r,n)=>{const s=e.K();e.bO(s,0,t.width,t.height,0,0,1);const o=t.context.gl;return{u_matrix:s,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:r,u_color_ramp:n,u_opacity:i.paint.get("heatmap-opacity")}},Fi=(t,e,i)=>{const r=i.paint.get("hillshade-shadow-color"),n=i.paint.get("hillshade-highlight-color"),s=i.paint.get("hillshade-accent-color");let o=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);return"viewport"===i.paint.get("hillshade-illumination-anchor")&&(o+=t.transform.bearingInRadians),{u_image:0,u_latrange:Oi(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),o],u_shadow:r,u_highlight:n,u_accent:s}},Bi=(t,i)=>{const r=i.stride,n=e.K();return e.bO(n,0,e.Z,-8192,0,0,1),e.L(n,n,[0,-8192,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ,u_unpack:i.getUnpackVector()}};function Oi(t,i){const r=Math.pow(2,i.canonical.z),n=i.canonical.y;
2return[new e.$(0,n/r).toLngLat().lat,new e.$(0,(n+1)/r).toLngLat().lat]}const ji=(t,i,r,n)=>{const s=t.transform;return{u_translation:Gi(t,i,r),u_ratio:n/e.aw(i,1,s.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},Vi=(t,i,r,n,s)=>e.e(ji(t,i,r,n),{u_image:0,u_image_height:s}),Ni=(t,i,r,n,s)=>{const o=t.transform,a=Ui(i,o);return{u_translation:Gi(t,i,r),u_texsize:i.imageAtlasTexture.size,u_ratio:n/e.aw(i,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[a,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Zi=(t,i,r,n,s,o)=>{const a=t.lineAtlas,l=Ui(i,t.transform),c="round"===r.layout.get("line-cap"),h=a.getDash(s.from,c),u=a.getDash(s.to,c),d=h.width*o.fromScale,p=u.width*o.toScale;return e.e(ji(t,i,r,n),{u_patternscale_a:[l/d,-h.height/2],u_patternscale_b:[l/p,-u.height/2],u_sdfgamma:a.width/(256*Math.min(d,p)*t.pixelRatio)/2,u_image:0,u_tex_y_a:h.y,u_tex_y_b:u.y,u_mix:o.t})};function Ui(t,i){return 1/e.aw(t,1,i.tileZoom)}function Gi(t,i,r){return e.ax(t.transform,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}const $i=(t,e,i,r,n)=>{return{u_tl_parent:t,u_scale_parent:e,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(o=r.paint.get("raster-saturation"),o>0?1-1/(1.001-o):-o),u_contrast_factor:(s=r.paint.get("raster-contrast"),s>0?1/(1-s):1+s),u_spin_weights:qi(r.paint.get("raster-hue-rotate")),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]};var s,o};function qi(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const Wi=(t,e,i,r,n,s,o,a,l,c,h,u,d)=>{const p=o.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:p.width/p.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+h,u_pitch_with_map:+r,u_is_along_line:n,u_is_variable_anchor:s,u_texsize:u,u_texture:0,u_translation:c,u_pitched_scale:d}},Hi=(t,i,r,n,s,o,a,l,c,h,u,d,p,f)=>{const m=a.transform;return e.e(Wi(t,i,r,n,s,o,a,l,c,h,u,d,f),{u_gamma_scale:n?Math.cos(m.pitch*Math.PI/180)*m.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:1})},Xi=(t,i,r,n,s,o,a,l,c,h,u,d,p)=>e.e(Hi(t,i,r,n,s,o,a,l,c,h,!0,u,0,p),{u_texsize_icon:d,u_texture_icon:1}),Ki=(t,e)=>({u_opacity:t,u_color:e}),Yi=(t,i,r,n,s)=>e.e(function(t,i,r,n){const s=r.imageManager.getPattern(t.from.toString()),o=r.imageManager.getPattern(t.to.toString()),{width:a,height:l}=r.imageManager.getPixelSize(),c=Math.pow(2,n.tileID.overscaledZ),h=n.tileSize*Math.pow(2,r.transform.tileZoom)/c,u=h*(n.tileID.canonical.x+n.tileID.wrap*c),d=h*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:[a,l],u_mix:i.t,u_pattern_size_a:s.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:i.fromScale,u_scale_b:i.toScale,u_tile_units_to_pixels:1/e.aw(n,1,r.transform.tileZoom),u_pixel_coord_upper:[u>>16,d>>16],u_pixel_coord_lower:[65535&u,65535&d]}}(r,s,i,n),{u_opacity:t}),Ji=(t,e)=>{},Qi={fillExtrusion:(t,i)=>({u_lightpos:new e.bJ(t,i.u_lightpos),u_lightpos_globe:new e.bJ(t,i.u_lightpos_globe),u_lightintensity:new e.b8(t,i.u_lightintensity),u_lightcolor:new e.bJ(t,i.u_lightcolor),u_vertical_gradient:new e.b8(t,i.u_vertical_gradient),u_opacity:new e.b8(t,i.u_opacity),u_fill_translate:new e.bK(t,i.u_fill_translate)}),fillExtrusionPattern:(t,i)=>({u_lightpos:new e.bJ(t,i.u_lightpos),u_lightpos_globe:new e.bJ(t,i.u_lightpos_globe),u_lightintensity:new e.b8(t,i.u_lightintensity),u_lightcolor:new e.bJ(t,i.u_lightcolor),u_vertical_gradient:new e.b8(t,i.u_vertical_gradient),u_height_factor:new e.b8(t,i.u_height_factor),u_opacity:new e.b8(t,i.u_opacity),u_fill_translate:new e.bK(t,i.u_fill_translate),u_image:new e.bF(t,i.u_image),u_texsize:new e.bK(t,i.u_texsize),u_pixel_coord_upper:new e.bK(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.bK(t,i.u_pixel_coord_lower),u_scale:new e.bJ(t,i.u_scale),u_fade:new e.b8(t,i.u_fade)}),fill:(t,i)=>({u_fill_translate:new e.bK(t,i.u_fill_translate)}),fillPattern:(t,i)=>({u_image:new e.bF(t,i.u_image),u_texsize:new e.bK(t,i.u_texsize),u_pixel_coord_upper:new e.bK(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.bK(t,i.u_pixel_coord_lower),u_scale:new e.bJ(t,i.u_scale),u_fade:new e.b8(t,i.u_fade),u_fill_translate:new e.bK(t,i.u_fill_translate)}),fillOutline:(t,i)=>({u_world:new e.bK(t,i.u_world),u_fill_translate:new e.bK(t,i.u_fill_translate)}),fillOutlinePattern:(t,i)=>({u_world:new e.bK(t,i.u_world),u_image:new e.bF(t,i.u_image),u_texsize:new e.bK(t,i.u_texsize),u_pixel_coord_upper:new e.bK(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.bK(t,i.u_pixel_coord_lower),u_scale:new e.bJ(t,i.u_scale),u_fade:new e.b8(t,i.u_fade),u_fill_translate:new e.bK(t,i.u_fill_translate)}),circle:(t,i)=>({u_camera_to_center_distance:new e.b8(t,i.u_camera_to_center_distance),u_scale_with_map:new e.bF(t,i.u_scale_with_map),u_pitch_with_map:new e.bF(t,i.u_pitch_with_map),u_extrude_scale:new e.bK(t,i.u_extrude_scale),u_device_pixel_ratio:new e.b8(t,i.u_device_pixel_ratio),u_globe_extrude_scale:new e.b8(t,i.u_globe_extrude_scale),u_translate:new e.bK(t,i.u_translate)}),collisionBox:(t,i)=>({u_pixel_extrude_scale:new e.bK(t,i.u_pixel_extrude_scale)}),collisionCircle:(t,i)=>({u_viewport_size:new e.bK(t,i.u_viewport_size)}),debug:(t,i)=>
2({u_color:new e.bG(t,i.u_color),u_overlay:new e.bF(t,i.u_overlay),u_overlay_scale:new e.b8(t,i.u_overlay_scale)}),depth:Ji,clippingMask:Ji,heatmap:(t,i)=>({u_extrude_scale:new e.b8(t,i.u_extrude_scale),u_intensity:new e.b8(t,i.u_intensity),u_globe_extrude_scale:new e.b8(t,i.u_globe_extrude_scale)}),heatmapTexture:(t,i)=>({u_matrix:new e.bH(t,i.u_matrix),u_world:new e.bK(t,i.u_world),u_image:new e.bF(t,i.u_image),u_color_ramp:new e.bF(t,i.u_color_ramp),u_opacity:new e.b8(t,i.u_opacity)}),hillshade:(t,i)=>({u_image:new e.bF(t,i.u_image),u_latrange:new e.bK(t,i.u_latrange),u_light:new e.bK(t,i.u_light),u_shadow:new e.bG(t,i.u_shadow),u_highlight:new e.bG(t,i.u_highlight),u_accent:new e.bG(t,i.u_accent)}),hillshadePrepare:(t,i)=>({u_matrix:new e.bH(t,i.u_matrix),u_image:new e.bF(t,i.u_image),u_dimension:new e.bK(t,i.u_dimension),u_zoom:new e.b8(t,i.u_zoom),u_unpack:new e.bI(t,i.u_unpack)}),line:(t,i)=>({u_translation:new e.bK(t,i.u_translation),u_ratio:new e.b8(t,i.u_ratio),u_device_pixel_ratio:new e.b8(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.bK(t,i.u_units_to_pixels)}),lineGradient:(t,i)=>({u_translation:new e.bK(t,i.u_translation),u_ratio:new e.b8(t,i.u_ratio),u_device_pixel_ratio:new e.b8(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.bK(t,i.u_units_to_pixels),u_image:new e.bF(t,i.u_image),u_image_height:new e.b8(t,i.u_image_height)}),linePattern:(t,i)=>({u_translation:new e.bK(t,i.u_translation),u_texsize:new e.bK(t,i.u_texsize),u_ratio:new e.b8(t,i.u_ratio),u_device_pixel_ratio:new e.b8(t,i.u_device_pixel_ratio),u_image:new e.bF(t,i.u_image),u_units_to_pixels:new e.bK(t,i.u_units_to_pixels),u_scale:new e.bJ(t,i.u_scale),u_fade:new e.b8(t,i.u_fade)}),lineSDF:(t,i)=>({u_translation:new e.bK(t,i.u_translation),u_ratio:new e.b8(t,i.u_ratio),u_device_pixel_ratio:new e.b8(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.bK(t,i.u_units_to_pixels),u_patternscale_a:new e.bK(t,i.u_patternscale_a),u_patternscale_b:new e.bK(t,i.u_patternscale_b),u_sdfgamma:new e.b8(t,i.u_sdfgamma),u_image:new e.bF(t,i.u_image),u_tex_y_a:new e.b8(t,i.u_tex_y_a),u_tex_y_b:new e.b8(t,i.u_tex_y_b),u_mix:new e.b8(t,i.u_mix)}),raster:(t,i)=>({u_tl_parent:new e.bK(t,i.u_tl_parent),u_scale_parent:new e.b8(t,i.u_scale_parent),u_buffer_scale:new e.b8(t,i.u_buffer_scale),u_fade_t:new e.b8(t,i.u_fade_t),u_opacity:new e.b8(t,i.u_opacity),u_image0:new e.bF(t,i.u_image0),u_image1:new e.bF(t,i.u_image1),u_brightness_low:new e.b8(t,i.u_brightness_low),u_brightness_high:new e.b8(t,i.u_brightness_high),u_saturation_factor:new e.b8(t,i.u_saturation_factor),u_contrast_factor:new e.b8(t,i.u_contrast_factor),u_spin_weights:new e.bJ(t,i.u_spin_weights),u_coords_top:new e.bI(t,i.u_coords_top),u_coords_bottom:new e.bI(t,i.u_coords_bottom)}),symbolIcon:(t,i)=>({u_is_size_zoom_constant:new e.bF(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bF(t,i.u_is_size_feature_constant),u_size_t:new e.b8(t,i.u_size_t),u_size:new e.b8(t,i.u_size),u_camera_to_center_distance:new e.b8(t,i.u_camera_to_center_distance),u_pitch:new e.b8(t,i.u_pitch),u_rotate_symbol:new e.bF(t,i.u_rotate_symbol),u_aspect_ratio:new e.b8(t,i.u_aspect_ratio),u_fade_change:new e.b8(t,i.u_fade_change),u_label_plane_matrix:new e.bH(t,i.u_label_plane_matrix),u_coord_matrix:new e.bH(t,i.u_coord_matrix),u_is_text:new e.bF(t,i.u_is_text),u_pitch_with_map:new e.bF(t,i.u_pitch_with_map),u_is_along_line:new e.bF(t,i.u_is_along_line),u_is_variable_anchor:new e.bF(t,i.u_is_variable_anchor),u_texsize:new e.bK(t,i.u_texsize),u_texture:new e.bF(t,i.u_texture),u_translation:new e.bK(t,i.u_translation),u_pitched_scale:new e.b8(t,i.u_pitched_scale)}),symbolSDF:(t,i)=>({u_is_size_zoom_constant:new e.bF(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bF(t,i.u_is_size_feature_constant),u_size_t:new e.b8(t,i.u_size_t),u_size:new e.b8(t,i.u_size),u_camera_to_center_distance:new e.b8(t,i.u_camera_to_center_distance),u_pitch:new e.b8(t,i.u_pitch),u_rotate_symbol:new e.bF(t,i.u_rotate_symbol),u_aspect_ratio:new e.b8(t,i.u_aspect_ratio),u_fade_change:new e.b8(t,i.u_fade_change),u_label_plane_matrix:new e.bH(t,i.u_label_plane_matrix
2),u_coord_matrix:new e.bH(t,i.u_coord_matrix),u_is_text:new e.bF(t,i.u_is_text),u_pitch_with_map:new e.bF(t,i.u_pitch_with_map),u_is_along_line:new e.bF(t,i.u_is_along_line),u_is_variable_anchor:new e.bF(t,i.u_is_variable_anchor),u_texsize:new e.bK(t,i.u_texsize),u_texture:new e.bF(t,i.u_texture),u_gamma_scale:new e.b8(t,i.u_gamma_scale),u_device_pixel_ratio:new e.b8(t,i.u_device_pixel_ratio),u_is_halo:new e.bF(t,i.u_is_halo),u_translation:new e.bK(t,i.u_translation),u_pitched_scale:new e.b8(t,i.u_pitched_scale)}),symbolTextAndIcon:(t,i)=>({u_is_size_zoom_constant:new e.bF(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bF(t,i.u_is_size_feature_constant),u_size_t:new e.b8(t,i.u_size_t),u_size:new e.b8(t,i.u_size),u_camera_to_center_distance:new e.b8(t,i.u_camera_to_center_distance),u_pitch:new e.b8(t,i.u_pitch),u_rotate_symbol:new e.bF(t,i.u_rotate_symbol),u_aspect_ratio:new e.b8(t,i.u_aspect_ratio),u_fade_change:new e.b8(t,i.u_fade_change),u_label_plane_matrix:new e.bH(t,i.u_label_plane_matrix),u_coord_matrix:new e.bH(t,i.u_coord_matrix),u_is_text:new e.bF(t,i.u_is_text),u_pitch_with_map:new e.bF(t,i.u_pitch_with_map),u_is_along_line:new e.bF(t,i.u_is_along_line),u_is_variable_anchor:new e.bF(t,i.u_is_variable_anchor),u_texsize:new e.bK(t,i.u_texsize),u_texsize_icon:new e.bK(t,i.u_texsize_icon),u_texture:new e.bF(t,i.u_texture),u_texture_icon:new e.bF(t,i.u_texture_icon),u_gamma_scale:new e.b8(t,i.u_gamma_scale),u_device_pixel_ratio:new e.b8(t,i.u_device_pixel_ratio),u_is_halo:new e.bF(t,i.u_is_halo),u_translation:new e.bK(t,i.u_translation),u_pitched_scale:new e.b8(t,i.u_pitched_scale)}),background:(t,i)=>
2({u_opacity:new e.b8(t,i.u_opacity),u_color:new e.bG(t,i.u_color)}),backgroundPattern:(t,i)=>({u_opacity:new e.b8(t,i.u_opacity),u_image:new e.bF(t,i.u_image),u_pattern_tl_a:new e.bK(t,i.u_pattern_tl_a),u_pattern_br_a:new e.bK(t,i.u_pattern_br_a),u_pattern_tl_b:new e.bK(t,i.u_pattern_tl_b),u_pattern_br_b:new e.bK(t,i.u_pattern_br_b),u_texsize:new e.bK(t,i.u_texsize),u_mix:new e.b8(t,i.u_mix),u_pattern_size_a:new e.bK(t,i.u_pattern_size_a),u_pattern_size_b:new e.bK(t,i.u_pattern_size_b),u_scale_a:new e.b8(t,i.u_scale_a),u_scale_b:new e.b8(t,i.u_scale_b),u_pixel_coord_upper:new e.bK(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.bK(t,i.u_pixel_coord_lower),u_tile_units_to_pixels:new e.b8(t,i.u_tile_units_to_pixels)}),terrain:(t,i)=>({u_texture:new e.bF(t,i.u_texture),u_ele_delta:new e.b8(t,i.u_ele_delta),u_fog_matrix:new e.bH(t,i.u_fog_matrix),u_fog_color:new e.bG(t,i.u_fog_color),u_fog_ground_blend:new e.b8(t,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new e.b8(t,i.u_fog_ground_blend_opacity),u_horizon_color:new e.bG(t,
vendor: 5,762 bytes, line 2
2i.u_horizon_color),u_horizon_fog_blend:new e.b8(t,i.u_horizon_fog_blend),u_is_globe_mode:new e.b8(t,i.u_is_globe_mode)}),terrainDepth:(t,i)=>({u_ele_delta:new e.b8(t,i.u_ele_delta)}),terrainCoords:(t,i)=>({u_texture:new e.bF(t,i.u_texture),u_terrain_coords_id:new e.b8(t,i.u_terrain_coords_id),u_ele_delta:new e.b8(t,i.u_ele_delta)}),projectionErrorMeasurement:(t,i)=>({u_input:new e.b8(t,i.u_input),u_output_expected:new e.b8(t,i.u_output_expected)}),atmosphere:(t,i)=>({u_sun_pos:new e.bJ(t,i.u_sun_pos),u_atmosphere_blend:new e.b8(t,i.u_atmosphere_blend),u_globe_position:new e.bJ(t,i.u_globe_position),u_globe_radius:new e.b8(t,i.u_globe_radius),u_inv_proj_matrix:new e.bH(t,i.u_inv_proj_matrix)}),sky:(t,i)=>({u_sky_color:new e.bG(t,i.u_sky_color),u_horizon_color:new e.bG(t,i.u_horizon_color),u_horizon:new e.bK(t,i.u_horizon),u_horizon_normal:new e.bK(t,i.u_horizon_normal),u_sky_horizon_blend:new e.b8(t,i.u_sky_horizon_blend),u_sky_blend:new e.b8(t,i.u_sky_blend)})};class tr{constructor(t,e,i){this.context=t;const r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const er={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ir{constructor(t,e,i,r){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;const n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i=0;i<this.attributes.length;i++){const r=e.attributes[this.attributes[i].name];void 0!==r&&t.enableVertexAttribArray(r)}}setVertexAttribPointers(t,e,i){for(let r=0;r<this.attributes.length;r++){const n=this.attributes[r],s=e.attributes[n.name];void 0!==s&&t.vertexAttribPointer(s,n.components,t[er[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class rr{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 nr extends rr{getDefault(){return e.b7.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class sr extends rr{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class or extends rr{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class ar extends rr{getDefault(){return[!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class lr extends rr{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class cr extends rr{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class hr extends rr{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class ur extends rr{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class dr extends rr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class pr extends rr{getDefault(){return[0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class fr extends rr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class mr extends rr{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class _r extends rr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class gr extends rr{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class yr extends rr{getDefault(){return e.b7.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor
2(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class xr extends rr{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class vr extends rr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class br extends rr{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class wr extends rr{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Tr extends rr{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Pr extends rr{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Mr extends rr{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Sr extends rr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Ir extends rr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Cr extends rr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Ar extends rr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Er extends rr{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class zr extends rr{getDefault(){return null}set(t){var e;if(t===this.current&&!this.dirty)return;const i=this.gl;Ue(i)?i.bindVertexArray(t):null===(e=i.getExtension("OES_vertex_array_object"))||void 0===e||e.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class kr extends rr{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Dr extends rr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Rr extends rr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Lr extends rr{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class Fr extends Lr{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Br extends Lr{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Or extends Lr{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}const jr="Framebuffer is not complete";class Vr{constructor(t,e,i,r,n){this.context=t,this.width=e,this.height=i;const s=t.gl,o=this.framebuffer=s.createFramebuffer();if(this.colorAttachment=new Fr(t,o),r)this.depthAttachment=n?new Or(t,o):new Br(t,o);else if(n)throw new Error("Stencil cannot be set without depth");if(s.checkFramebufferStatus(s.FRAMEBUFFER)!==s.FRAMEBUFFER_COMPLETE)throw new Error(jr)}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class Nr{constructor(t){var e,i;if(this.gl=t,this.clearColor=new nr(this),this.clearDepth=new sr(this),this.clearStencil=new or(this),this.colorMask=new ar(this),this.depthMask=new lr(this),this.stencilMask=new cr(this),this.stencilFunc=new hr(this),this.stencilOp=new ur(this),this.stencilTest=new dr(this),this.depthRange=new pr(this),this.depthTest=new fr(this),this.depthFunc=new mr(this),this.blend=new _r(this),this.blendFunc=new gr(this),this.blendColor=new yr(this),this.blendEquation=new xr(this),this.cullFace=new vr(this),this.cullFaceSide=new br(this),this.frontFace=new wr(this),this.program=new Tr(this),this.activeTexture=new Pr(this),this.viewport=new Mr(this),this.bindFramebuffer=new Sr(this),this.bindRenderbuffer=new Ir(this),this.bindTexture=new Cr(this),this.bindVertexBuffer=new Ar(this),this.bindElementBuffer=new Er(this),this.bindVertexArray=new zr(this),this.pixelStoreUnpack=new kr(this),this.pixelStoreUnpackPremultiplyAlpha=new Dr(this),this.pixelStoreUnpackFlipY=new Rr(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),Ue(t)){this.HALF_FLOAT=t.HALF_FLOAT;const r=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(e=t.RGBA16F)&&void 0!==e?e:null==r?void 0:r.RGBA16F_EXT,this.RGB16F=null!==(i=t.RGB16F)&&void 0!==i?i:null==r?void 0:r.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const e=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==e?void 0:e.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,e){return new tr(this,t,e)}createVertexBuffer(t,e,i){return new ir(this,t,e,i)}createRenderbuffer(t,e,i){const r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),n}createFramebuffer(t,e,i,r){return new Vr(this,t,e,i,r)}clear({color:t,depth:e,stencil:i}){const r=this.gl;let n=0;t&&(n|=r.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(n|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==i&&(n|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.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){e.bC(t.blendFunction,Fe.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 Ue(this.gl)?this.gl.createVertexArray():null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return Ue(this.gl)?this.gl.deleteVertexArray(t):null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let Zr;function Ur(t,i,r,n,s){const o=t.context,a=t.transform,l=o.gl,c=t.useProgram("collisionBox"),h=[];let u=0,d=0;for(let e=0;e<n.length;e++){const p=n[e],f=i.getTile(p).getBucket(r);
2if(!f)continue;const m=s?f.textCollisionBox:f.iconCollisionBox,_=f.collisionCircleArray;_.length>0&&(h.push({circleArray:_,circleOffset:d,coord:p}),u+=_.length/4,d=u),m&&c.draw(o,l.LINES,je.disabled,Ne.disabled,t.colorModeForRenderPass(),Oe.disabled,zi(t.transform),t.style.map.terrain&&t.style.map.terrain.getTerrainData(p),a.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,null,t.transform.zoom,null,null,m.collisionVertexBuffer)}if(!s||!h.length)return;const p=t.useProgram("collisionCircle"),f=new e.bP;f.resize(4*u),f._trim();let m=0;for(const e of h)for(let t=0;t<e.circleArray.length/4;t++){const i=4*t,r=e.circleArray[i+0],n=e.circleArray[i+1],s=e.circleArray[i+2],o=e.circleArray[i+3];f.emplace(m++,r,n,s,o,0),f.emplace(m++,r,n,s,o,1),f.emplace(m++,r,n,s,o,2),f.emplace(m++,r,n,s,o,3)}(!Zr||Zr.length<2*u)&&(Zr=function(t){const i=2*t,r=new e.bR;r.resize(i),r._trim();for(let e=0;e<i;e++){const t=6*e;r.uint16[t+0]=4*e+0,r.uint16[t+1]=4*e+1,r.uint16[t+2]=4*e+2,r.uint16[t+3]=4*e+2,r.uint16[t+4]=4*e+3,r.uint16[t+5]=4*e+0}return r}(u));const _=o.createIndexBuffer(Zr,!0),g=o.createVertexBuffer(f,e.bQ.members,!0);for(const y of h){const i=ki(t.transform);p.draw(o,l.TRIANGLES,je.disabled,Ne.disabled,t.colorModeForRenderPass(),Oe.disabled,i,t.style.map.terrain&&t.style.map.terrain.getTerrainData(y.coord),null,r.id,g,_,e.aG.simpleSegment(0,2*y.circleOffset,y.circleArray.length,y.circleArray.length/2),null,t.transform.zoom,null,null,null)}g.destroy(),_.destroy()}const Gr=e.at(new Float32Array(16));function $r(t,i,r,n,s,o){const{horizontalAlign:a,verticalAlign:l}=e.aB(t);return new e.P((-(a-.5)*i/s+n[0])*o,(-(l-.5)*r/s+n[1])*o)}function qr(t,i,r,n,s,o){const a=i.tileAnchorPoint.add(new e.P(i.translation[0],i.translation[1]));if(i.pitchWithMap){let t=n.mult(o);r||(t=t.rotate(-s));const e=a.add(t);return bt(e.x,e.y,i.pitchedLabelPlaneMatrix,i.getElevation).point}if(r){const e=Et(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(t),r=Math.atan(e.y/e.x)+(e.x<0?Math.PI:0);return t.add(n.rotate(r))}return t.add(n)}function Wr(t,i,r,n,s,o,a,l,c,h,u,d){const p=t.text.placedSymbolArray,f=t.text.dynamicLayoutVertexArray,m=t.icon.dynamicLayoutVertexArray,_={};f.clear();for(let g=0;g<p.length;g++){const m=p.get(g),y=m.hidden||!m.crossTileID||t.allowVerticalPlacement&&!m.placedOrientation?null:n[m.crossTileID];if(y){const n=new e.P(m.anchorX,m.anchorY),p={getElevation:d,width:s.width,height:s.height,pitchedLabelPlaneMatrix:o,pitchWithMap:r,transform:s,tileAnchorPoint:n,translation:h,unwrappedTileID:u},g=r?kt(n.x,n.y,p):Et(n.x,n.y,p),x=wt(s.cameraToCenterDistance,g.signedDistanceFromCamera);let v=e.ai(t.textSizeData,l,m)*x/e.av;r&&(v*=t.tilePixelRatio/a);const{width:b,height:w,anchor:T,textOffset:P,textBoxScale:M}=y,S=$r(T,b,w,P,M,v),I=s.getPitchedTextCorrection(n.x+h[0],n.y+h[1],u),C=qr(g.point,p,i,S,-s.bearingInRadians,I),A=t.allowVerticalPlacement&&m.placedOrientation===e.ah.vertical?Math.PI/2:0;for(let t=0;t<m.numGlyphs;t++)e.ao(f,C,A);c&&m.associatedIconIndex>=0&&(_[m.associatedIconIndex]={shiftedAnchor:C,angle:A})}else Bt(m.numGlyphs,f)}if(c){m.clear();const i=t.icon.placedSymbolArray;for(let t=0;t<i.length;t++){const r=i.get(t);if(r.hidden)Bt(r.numGlyphs,m);else{const i=_[t];if(i)for(let t=0;t<r.numGlyphs;t++)e.ao(m,i.shiftedAnchor,i.angle);else Bt(r.numGlyphs,m)}}t.icon.dynamicLayoutVertexBuffer.updateData(m)}t.text.dynamicLayoutVertexBuffer.updateData(f)}function Hr(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function Xr(t,i,r,n,s,o,a,l,c,h,u,d,p){const f=t.context,m=f.gl,_=t.transform,g="map"===l,y="map"===c,x="viewport"!==l&&"point"!==r.layout.get("symbol-placement"),v=g&&!y&&!x,b=!r.layout.get("symbol-sort-key").isConstant();let w=!1;const T=t.getDepthModeForSublayer(0,je.ReadOnly),P=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),M=[],S=_.getCircleRadiusCorrection();for(const I of n){const n=i.getTile(I),l=n.getBucket(r);if(!l)continue;const c=s?l.text:l.icon;if(!c||!c.segments.get().length||!c.hasVisibleVertices)continue;const u=c.programConfigurations.get(r.id),d=s||l.sdfIcons,f=s?l.textSizeData:l.iconSizeData,T=y||0!==_.pitch,C=t.useProgram(Hr(d,s,l),u),A=e.ag(f,_.zoom),E=t.style.map.terrain&&t.style.map.terrain.getTerrainData(I);let z,k,D,R,L=[0,0],F=null;if(s)k=n.glyphAtlasTexture,D=m.LINEAR,z=n.glyphAtlasTexture.size,l.iconsInText&&(L=n.imageAtlasTexture.size,F=n.imageAtlasTexture,R=T||t.options.rotating||t.options.zooming||"composite"===f.kind||"camera"===f.kind?m.LINEAR:m.NEAREST);else{const e=1!==r.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear;k=n.imageAtlasTexture,D=d||t.options.rotating||t.options.zooming||e||T?m.LINEAR:m.NEAREST,z=n.imageAtlasTexture.size}const B=e.aw(n,1,t.transform.zoom),O=yt(g,t.transform,B),j=e.K();e.aj(j,O);const V=xt(y,g,t.transform,B),N=e.ax(_,n,o,a),Z=_.getProjectionData({overscaledTileID:I,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),U=P&&l.hasTextData(),G="none"!==r.layout.get("icon-text-fit")&&U&&l.hasIconData();if(x){const e=t.style.map.terrain?(e,i)=>t.style.map.terrain.getElevation(I,e,i):null,i="map"===r.layout.get("text-rotation-alignment");
2Pt(l,t,s,O,j,y,h,i,I.toUnwrapped(),_.width,_.height,N,e)}const $=s&&P||G,q=x||$?Gr:y?O:t.transform.clipSpaceToPixelsMatrix,W=d&&0!==r.paint.get(s?"text-halo-width":"icon-halo-width").constantOr(1);let H;H=d?l.iconsInText?Xi(f.kind,A,v,y,x,$,t,q,V,N,z,L,S):Hi(f.kind,A,v,y,x,$,t,q,V,N,s,z,0,S):Wi(f.kind,A,v,y,x,$,t,q,V,N,s,z,S);const X={program:C,buffers:c,uniformValues:H,projectionData:Z,atlasTexture:k,atlasTextureIcon:F,atlasInterpolation:D,atlasInterpolationIcon:R,isSDF:d,hasHalo:W};if(b&&l.canOverlap){w=!0;const t=c.segments.get();for(const i of t)M.push({segments:new e.aG([i]),sortKey:i.sortKey,state:X,terrainData:E})}else M.push({segments:c.segments,sortKey:0,state:X,terrainData:E})}w&&M.sort(((t,e)=>t.sortKey-e.sortKey));for(const e of M){const i=e.state;if(f.activeTexture.set(m.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,m.CLAMP_TO_EDGE),i.atlasTextureIcon&&(f.activeTexture.set(m.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),i.isSDF){const n=i.uniformValues;i.hasHalo&&(n.u_is_halo=1,Kr(i.buffers,e.segments,r,t,i.program,T,u,d,n,i.projectionData,e.terrainData)),n.u_is_halo=0}Kr(i.buffers,e.segments,r,t,i.program,T,u,d,i.uniformValues,i.projectionData,e.terrainData)}}function Kr(t,e,i,r,n,s,o,a,l,c,h){const u=r.context;n.draw(u,u.gl.TRIANGLES,s,o,a,Oe.backCCW,l,h,c,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,r.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Yr(t,i,r,n,s){const o=t.context,a=o.gl,l=Ne.disabled,c=new Fe([a.ONE,a.ONE],e.b7.transparent,[!0,!0,!0,!0]),h=i.getBucket(r);if(!h)return;const u=n.key;let d=r.heatmapFbos.get(u);d||(d=Qr(o,i.tileSize,i.tileSize),r.heatmapFbos.set(u,d)),o.bindFramebuffer.set(d.framebuffer),o.viewport.set([0,0,i.tileSize,i.tileSize]),o.clear({color:e.b7.transparent});const p=h.programConfigurations.get(r.id),f=t.useProgram("heatmap",p,!s),m=t.transform.getProjectionData({overscaledTileID:i.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),_=t.style.map.terrain.getTerrainData(n);f.draw(o,a.TRIANGLES,je.disabled,l,c,Oe.disabled,Ri(i,t.transform.zoom,r.paint.get("heatmap-intensity"),1),_,m,r.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,r.paint,t.transform.zoom,p)}function Jr(t,e,i,r,n){const s=t.context,o=s.gl,a=t.transform;s.setColorMode(t.colorModeForRenderPass());const l=tn(s,e),c=i.key,h=e.heatmapFbos.get(c);if(!h)return;s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,h.colorAttachment.get()),s.activeTexture.set(o.TEXTURE1),l.bind(o.LINEAR,o.CLAMP_TO_EDGE);const u=a.getProjectionData({overscaledTileID:i,applyTerrainMatrix:n,applyGlobeMatrix:!r});t.useProgram("heatmapTexture").draw(s,o.TRIANGLES,je.disabled,Ne.disabled,t.colorModeForRenderPass(),Oe.disabled,Li(t,e,0,1),null,u,e.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,e.paint,a.zoom),h.destroy(),e.heatmapFbos.delete(c)}function Qr(t,e,i){var r,n;const 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);const a=null!==(r=t.HALF_FLOAT)&&void 0!==r?r:s.UNSIGNED_BYTE,l=null!==(n=t.RGBA16F)&&void 0!==n?n:s.RGBA;s.texImage2D(s.TEXTURE_2D,0,l,e,i,0,s.RGBA,a,null);const c=t.createFramebuffer(e,i,!1,!1);return c.colorAttachment.set(o),c}function tn(t,e){return e.colorRampTexture||(e.colorRampTexture=new y(t,e.colorRamp,t.gl.RGBA)),e.colorRampTexture}function en(t,e,i,r,n){if(!i||!r||!r.imageAtlas)return;const s=r.imageAtlas.patternPositions;let o=s[i.to.toString()],a=s[i.from.toString()];if(!o&&a&&(o=a),!a&&o&&(a=o),!o||!a){const t=n.getPaintProperty(e);o=s[t],a=s[t]}o&&a&&t.setConstantPatternPositions(o,a)}function rn(t,i,r,n,s,o,a,l){const c=t.context.gl,h="fill-pattern",u=r.paint.get(h),d=u&&u.constantOr(1),p=r.getCrossfadeParameters();let f,m,_,g,y;const x=t.transform,v=r.paint.get("fill-translate"),b=r.paint.get("fill-translate-anchor");a?(m=d&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=c.LINES):(m=d?"fillPattern":"fill",f=c.TRIANGLES);const w=u.constantOr(null);for(const T of n){const u=i.getTile(T);if(d&&!u.patternsLoaded())continue;const P=u.getBucket(r);
2if(!P)continue;const M=P.programConfigurations.get(r.id),S=t.useProgram(m,M),I=t.style.map.terrain&&t.style.map.terrain.getTerrainData(T);d&&(t.context.activeTexture.set(c.TEXTURE0),u.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),M.updatePaintBuffers(p)),en(M,h,w,u,r);const C=x.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),A=e.ax(x,u,v,b);if(a){g=P.indexBuffer2,y=P.segments2;const e=[c.drawingBufferWidth,c.drawingBufferHeight];_="fillOutlinePattern"===m&&d?Ai(t,p,u,e,A):Ci(e,A)}else g=P.indexBuffer,y=P.segments,_=d?Ii(t,p,u,A):{u_fill_translate:A};let E;if("translucent"===t.renderPass&&l){const[e]=t.getStencilConfigForOverlapAndUpdateStencilID(n);E=e[T.overscaledZ]}else E=t.stencilModeForClipping(T);S.draw(t.context,f,s,E,o,Oe.backCCW,_,I,C,r.id,P.layoutVertexBuffer,g,y,r.paint,t.transform.zoom,M)}}function nn(t,i,r,n,s,o,a,l){const c=t.context,h=c.gl,u="fill-extrusion-pattern",d=r.paint.get(u),p=d.constantOr(1),f=r.getCrossfadeParameters(),m=r.paint.get("fill-extrusion-opacity"),_=d.constantOr(null),g=t.transform;for(const y of n){const n=i.getTile(y),d=n.getBucket(r);if(!d)continue;const x=t.style.map.terrain&&t.style.map.terrain.getTerrainData(y),v=d.programConfigurations.get(r.id),b=t.useProgram(p?"fillExtrusionPattern":"fillExtrusion",v);p&&(t.context.activeTexture.set(h.TEXTURE0),n.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),v.updatePaintBuffers(f));const w=g.getProjectionData({overscaledTileID:y,applyGlobeMatrix:!l,applyTerrainMatrix:!0});en(v,u,_,n,r);const T=e.ax(g,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),P=r.paint.get("fill-extrusion-vertical-gradient"),M=p?Si(t,P,m,T,y,f,n):Mi(t,P,m,T);b.draw(c,c.gl.TRIANGLES,s,o,a,Oe.backCCW,M,x,w,r.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,r.paint,t.transform.zoom,v,t.style.map.terrain&&d.centroidVertexBuffer)}}function sn(t,e,i,r,n,s,o,a,l){var c;const h=t.style.projection,u=t.context,d=t.transform,p=u.gl,f=t.useProgram("hillshade"),m=!t.options.moving;for(const _ of r){const r=e.getTile(_),g=r.fbo;if(!g)continue;const y=h.getMeshFromTileID(u,_.canonical,a,!0,"raster"),x=null===(c=t.style.map.terrain)||void 0===c?void 0:c.getTerrainData(_);u.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,g.colorAttachment.get());const v=d.getProjectionData({overscaledTileID:_,aligned:m,applyGlobeMatrix:!l,applyTerrainMatrix:!0});f.draw(u,p.TRIANGLES,s,n[_.overscaledZ],o,Oe.backCCW,Fi(t,r,i),x,v,i.id,y.vertexBuffer,y.indexBuffer,y.segments)}}const on=[new e.P(0,0),new e.P(e.Z,0),new e.P(e.Z,e.Z),new e.P(0,e.Z)];function an(t,e,i,r,n,s,o,a,l=!1,c=!1){const h=r[r.length-1].overscaledZ,u=t.context,d=u.gl,p=t.useProgram("raster"),f=t.transform,m=t.style.projection,_=t.colorModeForRenderPass(),g=!t.options.moving;for(const y of r){const r=t.getDepthModeForSublayer(y.overscaledZ-h,1===i.paint.get("raster-opacity")?je.ReadWrite:je.ReadOnly,d.LESS),x=e.getTile(y);x.registerFadeDuration(i.paint.get("raster-fade-duration"));const v=e.findLoadedParent(y,0),b=e.findLoadedSibling(y),w=ln(x,v||b||null,e,i,t.transform,t.style.map.terrain);let T,P;const M="nearest"===i.paint.get("raster-resampling")?d.NEAREST:d.LINEAR;u.activeTexture.set(d.TEXTURE0),x.texture.bind(M,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(d.TEXTURE1),v?(v.texture.bind(M,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),T=Math.pow(2,v.tileID.overscaledZ-x.tileID.overscaledZ),P=[x.tileID.canonical.x*T%1,x.tileID.canonical.y*T%1]):x.texture.bind(M,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),x.texture.useMipmap&&u.extTextureFilterAnisotropic&&t.transform.pitch>20&&d.texParameterf(d.TEXTURE_2D,u.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,u.extTextureFilterAnisotropicMax);const S=t.style.map.terrain&&t.style.map.terrain.getTerrainData(y),I=f.getProjectionData({overscaledTileID:y,aligned:g,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),C=$i(P||[0,0],T||1,w,i,a),A=m.getMeshFromTileID(u,y.canonical,s,o,"raster");p.draw(u,d.TRIANGLES,r,n?n[y.overscaledZ]:Ne.disabled,_,l?Oe.frontCCW:Oe.backCCW,C,S,I,i.id,A.vertexBuffer,A.indexBuffer,A.segments)}}function ln(t,i,r,n,s,a){const l=n.paint.get("raster-fade-duration");if(!a&&l>0){const n=o.now(),a=(n-t.timeAdded)/l,c=i?(n-i.timeAdded)/l:-1,h=r.getSource(),u=ht(s,{tileSize:h.tileSize,roundZoom:h.roun
2dZoom}),d=!i||Math.abs(i.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),p=d&&t.refreshedUponExpiration?1:e.ae(d?a:1-c,0,1);return t.refreshedUponExpiration&&a>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}const cn=new e.b7(1,0,0,1),hn=new e.b7(0,1,0,1),un=new e.b7(0,0,1,1),dn=new e.b7(1,0,1,1),pn=new e.b7(0,1,1,1);function fn(t,e,i,r){_n(t,0,e+i/2,t.transform.width,i,r)}function mn(t,e,i,r){_n(t,e-i/2,0,i,t.transform.height,r)}function _n(t,e,i,r,n,s){const o=t.context,a=o.gl;a.enable(a.SCISSOR_TEST),a.scissor(e*t.pixelRatio,i*t.pixelRatio,r*t.pixelRatio,n*t.pixelRatio),o.clear({color:s}),a.disable(a.SCISSOR_TEST)}function gn(t,i,r){const n=t.context,s=n.gl,o=t.useProgram("debug"),a=je.disabled,l=Ne.disabled,c=t.colorModeForRenderPass(),h="$debug",u=t.style.map.terrain&&t.style.map.terrain.getTerrainData(r);n.activeTexture.set(s.TEXTURE0);const d=i.getTileByID(r.key).latestRawTileData,p=Math.floor((d&&d.byteLength||0)/1024),f=i.getTile(r).tileSize,m=512/Math.min(f,512)*(r.overscaledZ/t.transform.zoom)*.5;let _=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(_+=` => ${r.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,r=t.context.gl,n=t.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(e,5,5),n.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(t,`${_} ${p}kB`);const g=t.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(n,s.TRIANGLES,a,l,Fe.alphaBlended,Oe.disabled,Di(e.b7.transparent,m),null,g,h,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),o.draw(n,s.LINE_STRIP,a,l,c,Oe.disabled,Di(e.b7.red),u,g,h,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function yn(t,e,i,r){const{isRenderingGlobe:n}=r,s=t.context,o=s.gl,a=t.transform,l=t.colorModeForRenderPass(),c=t.getDepthModeFor3D(),h=t.useProgram("terrain");s.bindFramebuffer.set(null),s.viewport.set([0,0,t.width,t.height]);for(const u of i){const i=e.getTerrainMesh(u.tileID),r=t.renderToTexture.getTexture(u),d=e.getTerrainData(u.tileID);s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,r.texture);const p=e.getMeshFrameDelta(a.zoom),f=a.calculateFogMatrix(u.tileID.toUnwrapped()),m=vi(p,f,t.style.sky,a.pitch,n),_=a.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});h.draw(s,o.TRIANGLES,c,Ne.disabled,l,Oe.backCCW,m,d,_,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}function xn(t,i){if(!i.mesh){const r=new e.aF;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);const n=new e.aH;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),i.mesh=new fe(t.createVertexBuffer(r,me.members),t.createIndexBuffer(n),e.aG.simpleSegment(0,0,r.length,n.length))}return i.mesh}class vn{constructor(t,i){this.context=new Nr(t),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:e.at(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=dt.maxUnderzooming+dt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new he}resize(t,e,i){if(this.width=Math.floor(t*i),this.height=Math.floor(e*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const r of this.style._order)this.style._layers[r].resize()}setup(){const t=this.context,i=new e.aF;i.emplaceBack(0,0),i.emplaceBack(e.Z,0),i.emplaceBack(0,e.Z),i.emplaceBack(e.Z,e.Z),this.tileExtentBuffer=t.createVertexBuffer(i,me.members),this.tileExtentSegments=e.aG.simpleSegment(0,0,4,2);const r=new e.aF;r.emplaceBack(0,0),r.emplaceBack(e.Z,0),r.emplaceBack(0,e.Z),r.emplaceBack(e.Z,e.Z),this.debugBuffer=t.createVertexBuffer(r,me.members),this.debugSegments=e.aG.simpleSegment(0,0,4,5);const n=new e.bW;n.emplaceBack(0,0,0,0),n.emplaceBack(e.Z,0,e.Z,0),n.emplaceBack(0,e.Z,0,e.Z),n.emplaceBack(e.Z,e.Z,e.Z,e.Z),this.rasterBoundsBuffer=t.createVertexBuffer(n,yi.members),this.rasterBoundsSegments=e.aG.simpleSegment(0,0,4,2);const s=new e.aF;s.emplaceBack(0,0),s.emplaceBack(e.Z,0),s.emplaceBack(0,e.Z),s.emplaceBack(e.Z,e.Z),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(s,me.members),this.rasterBoundsSegmentsPosOnly=e.aG.simpleSegment(0,0,4,5);const o=new e.aF;
2o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(o,me.members),this.viewportSegments=e.aG.simpleSegment(0,0,4,2);const a=new e.bX;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(a);const l=new e.aH;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);const c=this.context.gl;this.stencilClearMode=new Ne({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new fe(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const r=e.K();e.bO(r,0,this.width,this.height,0,0,1),e.M(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const n={mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r};this.useProgram("clippingMask",null,!0).draw(t,i.TRIANGLES,je.disabled,this.stencilClearMode,Fe.disabled,Oe.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e,i){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source,this.nextStencilID+e.length>256&&this.clearStencil();const r=this.context;r.setColorMode(Fe.disabled),r.setDepthMode(je.disabled);const n={};for(const s of e)n[s.key]=this.nextStencilID++;this._renderTileMasks(n,e,i,!0),this._renderTileMasks(n,e,i,!1),this._tileClippingMaskIDs=n}_renderTileMasks(t,e,i,r){const n=this.context,s=n.gl,o=this.style.projection,a=this.transform,l=this.useProgram("clippingMask");for(const c of e){const e=t[c.key],h=this.style.map.terrain&&this.style.map.terrain.getTerrainData(c),u=o.getMeshFromTileID(this.context,c.canonical,r,!0,"stencil"),d=a.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!0,applyTerrainMatrix:!0});l.draw(n,s.TRIANGLES,je.disabled,new Ne({func:s.ALWAYS,mask:0},e,255,s.KEEP,s.KEEP,s.REPLACE),Fe.disabled,i?Oe.disabled:Oe.backCCW,null,h,d,"$clipping",u.vertexBuffer,u.indexBuffer,u.segments)}}_renderTilesDepthBuffer(){const t=this.context,e=t.gl,i=this.style.projection,r=this.transform,n=this.useProgram("depth"),s=this.getDepthModeFor3D(),o=ut(r,{tileSize:r.tileSize});for(const a of o){const o=this.style.map.terrain&&this.style.map.terrain.getTerrainData(a),l=i.getMeshFromTileID(this.context,a.canonical,!0,!0,"raster"),c=r.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(t,e.TRIANGLES,s,Ne.disabled,Fe.disabled,Oe.backCCW,null,o,c,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new Ne({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Ne({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const t={};for(let i=0;i<n;i++)t[i+r]=new Ne({func:e.GEQUAL,mask:255},i+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=n,[t,i]}return[{[r]:Ne.disabled},i]}stencilConfigForOverlapTwoPass(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(this.clearStencil(),n>1){const t={},s={};for(let i=0;i<n;i++)t[i+r]=new Ne({func:e.GREATER,mask:255},n+1+i,255,e.KEEP,e.KEEP,e.REPLACE),s[i+r]=new Ne({func:e.GREATER,mask:255},1+i,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID=2*n+1,[t,s,i]}return this.nextStencilID=3,[{[r]:new Ne({func:e.GREATER,mask:255},2,255,e.KEEP,e.KEEP,e.REPLACE)},{[r]:new Ne({func:e.GREATER,mask:255},1,255,e.KEEP,e.KEEP,e.REPLACE)},i]}colorModeForRenderPass(){const t=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new Fe([t.CONSTANT_COLOR,t.ONE],new e.b7(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Fe.unblended:Fe.alphaBlended}getDepthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return je.disabled;const r=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new je(i||this.context.gl.LEQUAL,e,[r,r])}getDepthModeFor3D(){return new je(this.context.gl.LEQUAL,je.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,i){var r,n;this.style=t,this.options=i,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(o.now()),this.imageManager.beginFrame();const s=this.style._order,a=this.style.sourceCaches,l={},c={},h={},u={isRenderingToTexture:!1,isRenderingGlobe:(null===(r=t.projection)||void 0===r?void 0:r.transitionState)>0};for(const e in a){const t=a[e];t.used&&t.prepare(this.context),l[e]=t.getVisibleCoordinates(!1),c[e]=l[e].slice().reverse(),h[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;e<s.length;e++)if(this.style._layers[s[e]].is3D()){this.opaquePassCutoff=e;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const e of s){const t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;const i=c[t.source];("custom"===t.type||i.length)&&this.renderLayer(this,a[t.source],t,i,u)}if(null===(n=this.style.projection)||void 0===n||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:i.showOverdrawInspector?e.b7.black:e.b7.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(t,e){const i=t.context,r=i.gl,n=((t,e,
2i)=>{const r=Math.cos(e.rollInRadians),n=Math.sin(e.rollInRadians),s=be(e),o=e.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:t.properties.get("sky-color"),u_horizon_color:t.properties.get("horizon-color"),u_horizon:[(e.width/2-s*n)*i,(e.height/2+s*r)*i],u_horizon_normal:[-n,r],u_sky_horizon_blend:t.properties.get("sky-horizon-blend")*e.height/2*i,u_sky_blend:o}})(e,t.style.map.transform,t.pixelRatio),s=new je(r.LEQUAL,je.ReadWrite,[0,1]),o=Ne.disabled,a=t.colorModeForRenderPass(),l=t.useProgram("sky"),c=xn(i,e);l.draw(i,r.TRIANGLES,s,o,a,Oe.disabled,n,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[s[this.currentLayer]],e=a[t.source],i=l[t.source];this._renderTileClippingMasks(t,i,!1),this.renderLayer(this,e,t,i,u)}this.renderPass="translucent";let d=!1;for(this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const t=this.style._layers[s[this.currentLayer]],e=a[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t,u))continue;this.opaquePassEnabledForLayer()||d||(d=!0,u.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const i=("symbol"===t.type?h:c)[t.source];this._renderTileClippingMasks(t,l[t.source],!1),this.renderLayer(this,e,t,i,u)}if(u.isRenderingGlobe&&function(t,i,r){const n=t.context,s=n.gl,o=t.useProgram("atmosphere"),a=new je(s.LEQUAL,je.ReadOnly,[0,1]),l=t.transform,c=function(t,i){const r=t.properties.get("position"),n=[-r.x,-r.y,-r.z],s=e.at(new Float64Array(16));return"map"===t.properties.get("anchor")&&(e.a_(s,s,i.rollInRadians),e.a$(s,s,-i.pitchInRadians),e.a_(s,s,i.bearingInRadians),e.a$(s,s,i.center.lat*Math.PI/180),e.bm(s,s,-i.center.lng*Math.PI/180)),e.bV(n,n,s),n}(r,t.transform),h=l.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),u=i.properties.get("atmosphere-blend")*h.projectionTransition;if(0===u)return;const d=ti(l.worldSize,l.center.lat),p=l.inverseProjectionMatrix,f=new Float64Array(4);f[3]=1,e.ap(f,f,l.modelViewProjectionMatrix),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1,e.ap(f,f,p),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1;const m=((t,e,i,r,n)=>({u_sun_pos:t,u_atmosphere_blend:e,u_globe_position:i,u_globe_radius:r,u_inv_proj_matrix:n}))(c,u,[f[0],f[1],f[2]],d,p),_=xn(n,i);o.draw(n,s.TRIANGLES,a,Ne.disabled,Fe.alphaBlended,Oe.disabled,m,null,null,"atmosphere",_.vertexBuffer,_.indexBuffer,_.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const t=function(t,e){let i=null;const r=Object.values(t._layers).flatMap((i=>i.source&&!i.isHidden(e)?[t.sourceCaches[i.source]]:[])),n=r.filter((t=>"vector"===t.getSource().type)),s=r.filter((t=>"vector"!==t.getSource().type)),o=t=>{(!i||i.getSource().maxzoom<t.getSource().maxzoom)&&(i=t)};return n.forEach((t=>o(t))),i||s.forEach((t=>o(t))),i}(this.style,this.transform.zoom);t&&function(t,e,i){for(let r=0;r<i.length;r++)gn(t,e,i[r])}(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;fn(t,t.transform.height-(e.top||0),3,cn),fn(t,e.bottom||0,3,hn),mn(t,e.left||0,3,un),mn(t,t.transform.width-(e.right||0),3,dn);const i=t.transform.centerPoint;!function(t,e,i,r){_n(t,e-1,i-10,2,20,r),_n(t,e-10,i-1,20,2,r)}(t,i.x,t.transform.height-i.y,pn)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,r=this.transform.modelViewProjectionMatrix;let n=this.terrainFacilitator.dirty;n||(n=t?!e.bY(i,r):!e.bZ(i,r)),n||(n=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),n&&(e.b_(i,r),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(t,i){const r=t.context,n=r.gl,s=t.transform,o=Fe.unblended,a=new je(n.LEQUAL,je.ReadWrite,[0,1]),l=i.sourceCache.getRenderableTiles(),c=t.useProgram("terrainDepth");r.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.clear({color:e.b7.transparent,depth:1});for(const e of l){const t=i.getTerrainMesh(e.tileID),l=i.getTerrainData(e.tileID),h=s.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),u={u_ele_delta:i.getMeshFrameDelta(s.zoom)};c.draw(r,n.TRIANGLES,a,Ne.disabled,o,Oe.backCCW,u,l,h,"terrain",t.vertexBuffer,t.indexBuffer,t.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain),function(t,i){const r=t.context,n=r.gl,s=t.transform,o=Fe.unblended,a=new je(n.LEQUAL,je.ReadWrite,[0,1]),l=i.getCoordsTexture(),c=i.sourceCache.getRenderableTiles(),h=t.useProgram("terrainCoords");r.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.clear({color:e.b7.transparent,depth:1}),i.coordsIndex=[];for(const e of c){const t=i.getTerrainMesh(e.tileID),c=i.getTerrainData(e.tileID);r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,l.texture);const u={u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(s.zoom)},d=s.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});h.draw(r,n.TRIANGLES,a,Ne.disabled,o,Oe.backCCW,u,c,d,"terrain",t.vertexBuffer,t.indexBuffer,t.segments),i.coordsIndex.push(e.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain))}renderLayer(t,i,r,n,s){r.isHidden(this.transform.zoom)||("background"===r.type||"custom"===r.type||(n||[]).length)&&(this.id=r.id,e.b$(r)?function(t,i,r,n,s,o){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:a}=o,l=Ne.disabled,c=t.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,i,r,n,s,o,a,l,c){const h=i.transform,u=i.style.map.terrain,d="map"===s,p="map"===o;for(const f of t){const t=n.getTile(f),s=t.getBucket(r);
2if(!s||!s.text||!s.text.segments.get().length)continue;const o=e.ag(s.textSizeData,h.zoom),m=e.aw(t,1,i.transform.zoom),_=yt(d,i.transform,m),g="none"!==r.layout.get("icon-text-fit")&&s.hasIconData();if(o){const i=Math.pow(2,h.zoom-t.tileID.overscaledZ),r=u?(t,e)=>u.getElevation(f,t,e):null;Wr(s,d,p,c,h,_,i,o,g,e.ax(h,t,a,l),f.toUnwrapped(),r)}}}(n,t,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),s),0!==r.paint.get("icon-opacity").constantOr(1)&&Xr(t,i,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),l,c,a),0!==r.paint.get("text-opacity").constantOr(1)&&Xr(t,i,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),l,c,a),i.map.showCollisionBoxes&&(Ur(t,i,r,n,!0),Ur(t,i,r,n,!1))}(t,i,r,n,this.style.placement.variableOffsets,s):e.c0(r)?function(t,i,r,n,s){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:o}=s,a=r.paint.get("circle-opacity"),l=r.paint.get("circle-stroke-width"),c=r.paint.get("circle-stroke-opacity"),h=!r.layout.get("circle-sort-key").isConstant();if(0===a.constantOr(1)&&(0===l.constantOr(1)||0===c.constantOr(1)))return;const u=t.context,d=u.gl,p=t.transform,f=t.getDepthModeForSublayer(0,je.ReadOnly),m=Ne.disabled,_=t.colorModeForRenderPass(),g=[],y=p.getCircleRadiusCorrection();for(let x=0;x<n.length;x++){const s=n[x],a=i.getTile(s),l=a.getBucket(r);if(!l)continue;const c=r.paint.get("circle-translate"),u=r.paint.get("circle-translate-anchor"),d=e.ax(p,a,c,u),f=l.programConfigurations.get(r.id),m=t.useProgram("circle",f),_=l.layoutVertexBuffer,v=l.indexBuffer,b=t.style.map.terrain&&t.style.map.terrain.getTerrainData(s),w={programConfiguration:f,program:m,layoutVertexBuffer:_,indexBuffer:v,uniformValues:Ei(t,a,r,d,y),terrainData:b,projectionData:p.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!o,applyTerrainMatrix:!0})};if(h){const t=l.segments.get();for(const i of t)g.push({segments:new e.aG([i]),sortKey:i.sortKey,state:w})}else g.push({segments:l.segments,sortKey:0,state:w})}h&&g.sort(((t,e)=>t.sortKey-e.sortKey));for(const e of g){const{programConfiguration:i,program:n,layoutVertexBuffer:s,indexBuffer:o,uniformValues:a,terrainData:l,projectionData:c}=e.state;n.draw(u,d.TRIANGLES,f,m,_,Oe.backCCW,a,l,c,r.id,s,o,e.segments,r.paint,t.transform.zoom,i)}}(t,i,r,n,s):e.c1(r)?function(t,i,r,n,s){if(0===r.paint.get("heatmap-opacity"))return;const o=t.context,{isRenderingToTexture:a,isRenderingGlobe:l}=s;if(t.style.map.terrain){for(const e of n){const n=i.getTile(e);i.hasRenderableParent(e)||("offscreen"===t.renderPass?Yr(t,n,r,e,l):"translucent"===t.renderPass&&Jr(t,r,e,a,l))}o.viewport.set([0,0,t.width,t.height])}else"offscreen"===t.renderPass?function(t,i,r,n){const s=t.context,o=s.gl,a=t.transform,l=Ne.disabled,c=new Fe([o.ONE,o.ONE],e.b7.transparent,[!0,!0,!0,!0]);(function(t,i,r){const n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,i.width/4,i.height/4]);let s=r.heatmapFbos.get(e.bS);s?(n.bindTexture(n.TEXTURE_2D,s.colorAttachment.get()),t.bindFramebuffer.set(s.framebuffer)):(s=Qr(t,i.width/4,i.height/4),r.heatmapFbos.set(e.bS,s))})(s,t,r),s.clear({color:e.b7.transparent});for(let e=0;e<n.length;e++){const h=n[e];if(i.hasRenderableParent(h))continue;const u=i.getTile(h),d=u.getBucket(r);if(!d)continue;const p=d.programConfigurations.get(r.id),f=t.useProgram("heatmap",p),m=a.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),_=a.getCircleRadiusCorrection();f.draw(s,o.TRIANGLES,je.disabled,l,c,Oe.backCCW,Ri(u,a.zoom,r.paint.get("heatmap-intensity"),_),null,m,r.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,r.paint,a.zoom,p)}s.viewport.set([0,0,t.width,t.height])}(t,i,r,n):"translucent"===t.renderPass&&function(t,i){const r=t.context,n=r.gl;r.setColorMode(t.colorModeForRenderPass());const s=i.heatmapFbos.get(e.bS);s&&(r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,s.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1),tn(r,i).bind(n.LINEAR,n.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(r,n.TRIANGLES,je.disabled,Ne.disabled,t.colorModeForRenderPass(),Oe.disabled,Li(t,i,0,1),null,null,i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom))}(t,r)}(t,i,r,n,s):e.c2(r)?function(t,i,r,n,s){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:o}=s,a=r.paint.get("line-opacity"),l=r.paint.get("line-width");if(0===a.constantOr(1)||0===l.constantOr(1))return;const c=t.getDepthModeForSublayer(0,je.ReadOnly),h=t.colorModeForRenderPass(),u=r.paint.get("line-dasharray"),d=r.paint.get("line-pattern"),p=d.constantOr(1),f=r.paint.get("line-gradient"),m=r.getCrossfadeParameters(),_=p?"linePattern":u?"lineSDF":f?"lineGradient":"line",g=t.context,x=g.gl,v=t.transform;let b=!0;for(const w of n){const s=i.getTile(w);if(p&&!s.patternsLoaded())continue;const a=s.getBucket(r);
2if(!a)continue;const l=a.programConfigurations.get(r.id),T=t.context.program.get(),P=t.useProgram(_,l),M=b||P.program!==T,S=t.style.map.terrain&&t.style.map.terrain.getTerrainData(w),I=d.constantOr(null);if(I&&s.imageAtlas){const t=s.imageAtlas,e=t.patternPositions[I.to.toString()],i=t.patternPositions[I.from.toString()];e&&i&&l.setConstantPatternPositions(e,i)}const C=v.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),A=v.getPixelScale(),E=p?Ni(t,s,r,A,m):u?Zi(t,s,r,A,u,m):f?Vi(t,s,r,A,a.lineClipsArray.length):ji(t,s,r,A);if(p)g.activeTexture.set(x.TEXTURE0),s.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),l.updatePaintBuffers(m);else if(u&&(M||t.lineAtlas.dirty))g.activeTexture.set(x.TEXTURE0),t.lineAtlas.bind(g);else if(f){const n=a.gradients[r.id];let s=n.texture;if(r.gradientVersion!==n.version){let o=256;if(r.stepInterpolant){const r=i.getSource().maxzoom,n=w.canonical.z===r?Math.ceil(1<<t.transform.maxZoom-w.canonical.z):1;o=e.ae(e.bT(a.maxLineLength/e.Z*1024*n),256,g.maxTextureSize)}n.gradient=e.bU({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:o,image:n.gradient||void 0,clips:a.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new y(g,n.gradient,x.RGBA),n.version=r.gradientVersion,s=n.texture}g.activeTexture.set(x.TEXTURE0),s.bind(r.stepInterpolant?x.NEAREST:x.LINEAR,x.CLAMP_TO_EDGE)}let z;if(o){const[e]=t.getStencilConfigForOverlapAndUpdateStencilID(n);z=e[w.overscaledZ]}else z=t.stencilModeForClipping(w);P.draw(g,x.TRIANGLES,c,z,h,Oe.disabled,E,S,C,r.id,a.layoutVertexBuffer,a.indexBuffer,a.segments,r.paint,t.transform.zoom,l,a.layoutVertexBuffer2),b=!1}}(t,i,r,n,s):e.c3(r)?function(t,i,r,n,s){const o=r.paint.get("fill-color"),a=r.paint.get("fill-opacity");if(0===a.constantOr(1))return;const{isRenderingToTexture:l}=s,c=t.colorModeForRenderPass(),h=r.paint.get("fill-pattern"),u=t.opaquePassEnabledForLayer()&&!h.constantOr(1)&&1===o.constantOr(e.b7.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(t.renderPass===u){const e=t.getDepthModeForSublayer(1,"opaque"===t.renderPass?je.ReadWrite:je.ReadOnly);rn(t,i,r,n,e,c,!1,l)}if("translucent"===t.renderPass&&r.paint.get("fill-antialias")){const e=t.getDepthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,je.ReadOnly);rn(t,i,r,n,e,c,!0,l)}}(t,i,r,n,s):e.c4(r)?function(t,e,i,r,n){const s=i.paint.get("fill-extrusion-opacity");if(0===s)return;const{isRenderingToTexture:o}=n;if("translucent"===t.renderPass){const n=new je(t.context.gl.LEQUAL,je.ReadWrite,t.depthRangeFor3D);if(1!==s||i.paint.get("fill-extrusion-pattern").constantOr(1))nn(t,e,i,r,n,Ne.disabled,Fe.disabled,o),nn(t,e,i,r,n,t.stencilModeFor3D(),t.colorModeForRenderPass(),o);else{const s=t.colorModeForRenderPass();nn(t,e,i,r,n,Ne.disabled,s,o)}}}(t,i,r,n,s):e.c5(r)?function(t,e,i,r,n){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const{isRenderingToTexture:s}=n,o=t.context,a=t.style.projection.useSubdivision,l=t.getDepthModeForSublayer(0,je.ReadOnly),c=t.colorModeForRenderPass();if("offscreen"===t.renderPass)!function(t,e,i,r,n,s,o){const a=t.context,l=a.gl;for(const c of i){const i=e.getTile(c),h=i.dem;if(!h||!h.data)continue;if(!i.needsHillshadePrepare)continue;const u=h.dim,d=h.stride,p=h.getPixels();if(a.activeTexture.set(l.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(d),i.demTexture){const t=i.demTexture;t.update(p,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new y(a,p,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);a.activeTexture.set(l.TEXTURE0);let f=i.fbo;if(!f){const t=new y(a,{width:u,height:u,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),f=i.fbo=a.createFramebuffer(u,u,!0,!1),f.colorAttachment.set(t.texture)}a.bindFramebuffer.set(f.framebuffer),a.viewport.set([0,0,u,u]),t.useProgram("hillshadePrepare").draw(a,l.TRIANGLES,n,s,o,Oe.disabled,Bi(i.tileID,h),null,null,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),i.needsHillshadePrepare=!1}}(t,e,r,i,l,Ne.disabled,c),o.viewport.set([0,0,t.width,t.height]);else if("translucent"===t.renderPass)if(a){const[n,o,a]=t.stencilConfigForOverlapTwoPass(r);
2sn(t,e,i,a,n,l,c,!1,s),sn(t,e,i,a,o,l,c,!0,s)}else{const[n,o]=t.getStencilConfigForOverlapAndUpdateStencilID(r);sn(t,e,i,o,n,l,c,!1,s)}}(t,i,r,n,s):e.c6(r)?function(t,e,i,r,n){if("translucent"!==t.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!r.length)return;const{isRenderingToTexture:s}=n,o=e.getSource(),a=t.style.projection.useSubdivision;if(o instanceof K)an(t,e,i,r,null,!1,!1,o.tileCoords,o.flippedWindingOrder,s);else if(a){const[n,o,a]=t.stencilConfigForOverlapTwoPass(r);an(t,e,i,a,n,!1,!0,on,!1,s),an(t,e,i,a,o,!0,!0,on,!1,s)}else{const[n,o]=t.getStencilConfigForOverlapAndUpdateStencilID(r);an(t,e,i,o,n,!1,!0,on,!1,s)}}(t,i,r,n,s):e.c7(r)?function(t,e,i,r,n){const s=i.paint.get("background-color"),o=i.paint.get("background-opacity");if(0===o)return;const{isRenderingToTexture:a}=n,l=t.context,c=l.gl,h=t.style.projection,u=t.transform,d=u.tileSize,p=i.paint.get("background-pattern");if(t.isPatternMissing(p))return;const f=!p&&1===s.a&&1===o&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==f)return;const m=Ne.disabled,_=t.getDepthModeForSublayer(0,"opaque"===f?je.ReadWrite:je.ReadOnly),g=t.colorModeForRenderPass(),y=t.useProgram(p?"backgroundPattern":"background"),x=r||ut(u,{tileSize:d,terrain:t.style.map.terrain});p&&(l.activeTexture.set(c.TEXTURE0),t.imageManager.bind(t.context));const v=i.getCrossfadeParameters();for(const b of x){const e=u.getProjectionData({overscaledTileID:b,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),r=p?Yi(o,t,p,{tileID:b,tileSize:d},v):Ki(o,s),n=t.style.map.terrain&&t.style.map.terrain.getTerrainData(b),f=h.getMeshFromTileID(l,b.canonical,!1,!0,"raster");y.draw(l,c.TRIANGLES,_,m,g,Oe.backCCW,r,n,e,i.id,f.vertexBuffer,f.indexBuffer,f.segments)}}(t,0,r,n,s):e.c8(r)&&function(t,e,i,r){const{isRenderingGlobe:n}=r,s=t.context,o=i.implementation,a=t.style.projection,l=t.transform,c=l.getProjectionDataForCustomLayer(n),h={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:a.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${a.shaderPreludeCode.vertexSource}`,define:a.shaderDefine},defaultProjectionData:c},u=o.renderingMode?o.renderingMode:"2d";if("offscreen"===t.renderPass){const e=o.prerender;e&&(t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),e.call(o,s.gl,h),s.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),s.setStencilMode(Ne.disabled);const e="3d"===u?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,je.ReadOnly);s.setDepthMode(e),o.render(s.gl,h),s.setDirty(),t.setBaseState(),s.bindFramebuffer.set(null)}}(t,0,r,s))}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i}useProgram(t,e,i=!1){this.cache=this.cache||{};const r=!!this.style.map.terrain,n=this.style.projection,s=t+(e?e.cacheKey:"")+`/${i?ge:n.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(r?"/terrain":"");return this.cache[s]||(this.cache[s]=new Ti(this.context,de[t],e,Qi[t],this._showOverdrawInspector,r,i?de.projectionMercator:n.shaderPreludeCode,i?_e:n.shaderDefine)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new y(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}function bn(t,e){let i,r=!1,n=null,s=null;const o=()=>{n=null,r&&(t.apply(s,i),n=setTimeout(o,e),r=!1)};return(...t)=>(r=!0,s=this,i=t,n||o(),n)}class wn{constructor(t){this._getCurrentHash=()=>{const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((t=>
2t.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{const t=this._getCurrentHash();if(!this._isValidHash(t))return!1;const e=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:e,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{const t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{const t=this._getCurrentHash();if(0===t.length)return;const e=t.join("/");let i=e;i.split("&").length>0&&(i=i.split("&")[0]),this._hashName&&(i=`${this._hashName}=${e}`);let r=window.location.hash.replace(i,"");r.startsWith("#&")?r=r.slice(0,1)+r.slice(2):"#"===r&&(r="");let n=window.location.href.replace(/(#.+)?$/,r);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=bn(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,r),s=Math.round(e.lng*n)/n,o=Math.round(e.lat*n)/n,a=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${s}/${o}/${i}`:`${i}/${o}/${s}`,(a||l)&&(c+="/"+Math.round(10*a)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const r=i.split("=")[0];return r===t?(e=!0,`${r}=${c}`):i})).filter((t=>t));return e||i.push(`${t}=${c}`),`#${i.join("&")}`}return`#${c}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new e.Q(+t[2],+t[1])}catch(t){return!1}const i=+t[0],r=+(t[3]||0),n=+(t[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&r>=-180&&r<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}const Tn={linearity:.3,easing:e.c9(0,0,.3,1)},Pn=e.e({deceleration:2500,maxSpeed:1400},Tn),Mn=e.e({deceleration:20,maxSpeed:1400},Tn),Sn=e.e({deceleration:1e3,maxSpeed:360},Tn),In=e.e({deceleration:1e3,maxSpeed:90},Tn),Cn=e.e({deceleration:1e3,maxSpeed:360},Tn);class An{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:o.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,e=o.now();for(;t.length>0&&e-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,i.roll+=e.rollDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const s=zn(i.pan.mag(),r,e.e({},Pn,t||{})),o=i.pan.mult(s.amount/i.pan.mag()),a=this._map.cameraHelper.handlePanInertia(o,this._map.transform);n.center=a.easingCenter,n.offset=a.easingOffset,En(n,s)}if(i.zoom){const t=zn(i.zoom,r,Mn);n.zoom=this._map.transform.zoom+t.amount,En(n,t)}if(i.bearing){const t=zn(i.bearing,r,Sn);n.bearing=this._map.transform.bearing+e.ae(t.amount,-179,179),En(n,t)}if(i.pitch){const t=zn(i.pitch,r,In);n.pitch=this._map.transform.pitch+t.amount,En(n,t)}if(i.roll){const t=zn(i.roll,r,Cn);n.roll=this._map.transform.roll+e.ae(t.amount,-179,179),En(n,t)}if(n.zoom||n.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;n.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),e.e(n,{noMoveStart:!0})}}function En(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function zn(t,i,r){const{maxSpeed:n,linearity:s,deceleration:o}=r,a=e.ae(t*s/(i/1e3),-n,n),l=Math.abs(a)/(o*s);return{easing:r.easing,duration:1e3*l,amount:a*(l/2)}}class kn extends e.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r,n={}){r=r instanceof MouseEvent?r:new MouseEvent(t,r);const s=a.mousePos(i.getCanvas(),r),o=i.unproject(s);super(t,e.e({point:s,lngLat:o,originalEvent:r},n)),this._defaultPrevented=!1,this.target=i}}class Dn extends e.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r){const n="touchend"===t?r.changedTouches:r.touches,s=a.touchPos(i.getCanvasContainer(),n),o=s.map((t=>i.unproject(t))),l=s.reduce(((t,e,i,r)=>t.add(e.div(r.length))),new e.P(0,0));super(t,{points:s,point:l,lngLats:o,lngLat:i.unproject(l),originalEvent:r}),this._defaultPrevented=!1}}class Rn extends e.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}}class Ln{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Rn(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new kn(t.type,this._map,t))}mouseup(t){this._map.fire(new kn(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new kn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new kn(t.type,this._map,t))}mouseover(t){this._map.fire(new kn(t.type,this._map,t))}mouseout(t){this._map.fire(new kn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Dn(t.type,this._map,t))}touchmove(t){this._map.fire(new Dn(t.type,this._map,t))}touchend(t){this._map.fire(new Dn(t.type,this._map,t))}touchcancel(t){this._map.fire(new Dn(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Fn{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new kn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new kn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new kn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Bn{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(e.P.convert(t),this._map.terrain)}}class On{constructor(t,e){this._map=t,this._tr=new Bn(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(a.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const i=e;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;const r=this._startPos;this._lastPos=i,this._box||(this._box=a.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const n=Math.min(r.x,i.x),s=Math.max(r.x,i.x),o=Math.min(r.y,i.y),l=Math.max(r.y,i.y);a.setTransform(this._box,`translate(${n}px,${o}px)`),this._box.style.width=s-n+"px",this._box.style.height=l-o+"px"}mouseupWindow(t,i){if(!this._active)return;if(0!==t.button)return;const r=this._startPos,n=i;if(this.reset(),a.suppressClick(),r.x!==n.x||r.y!==n.y)return this._map.fire(new e.l("boxzoomend",{originalEvent:t})),{cameraAnimation:t=>t.fitScreenCoordinates(r,n,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&&(a.remove(this._box),this._box=null),a.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new e.l(t,{originalEvent:i}))}}function jn(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const i={};for(let r=0;r<t.length;r++)i[t[r].identifier]=e[r];return i}class Vn{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=function(t){const i=new e.P(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=jn(r,i)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const r=jn(i,e);for(const n in this.touches){const t=r[n];(!t||t.dist(this.touches[n])>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class Nn{constructor(t){this.singleTap=new Vn(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){const r=this.singleTap.touchend(t,e,i);if(r){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class Zn{constructor(t){this._tr=new Bn(t),this._zoomIn=new Nn({numTouches:1,numTaps:2}),this._zoomOut=new Nn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){const r=this._zoomIn.touchend(t,e,i),n=this._zoomOut.touchend(t,e,i),s=this._tr;return r?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:s.zoom+1,around:s.unproject(r)},{originalEvent:t})}):n?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.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 Un{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.rollDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(e)?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const r=Array.isArray(e)?e[0]:e;return!this._moved&&r.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=r,this._move(i,r))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&a.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Gn={0:1,2:2};class $n{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const e=a.mouseButton(t);this._eventButton=e}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(t,e){const i=Gn[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton)}
2isValidEndEvent(t){return a.mouseButton(t)===this._eventButton}}class qn{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 Wn{constructor(t=new $n({checkCorrectEvent:()=>!0}),e=new qn){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=e}_executeRelevantHandler(t,e,i){return t instanceof MouseEvent?e(t):"undefined"!=typeof TouchEvent&&t instanceof TouchEvent?i(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)))}}const Hn=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}};class Xn{constructor(t,e){this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._active){if(!this._shouldBePrevented(i.length))return t.preventDefault(),this._calculateTransform(t,e,i);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,i,r){r.length>0&&(this._active=!0);const n=jn(r,i),s=new e.P(0,0),o=new e.P(0,0);let a=0;for(const e in n){const t=n[e],i=this._touches[e];i&&(s._add(t),o._add(t.sub(i)),a++,n[e]=t)}if(this._touches=n,this._shouldBePrevented(a)||!o.mag())return;const l=o.div(a);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:s.div(a),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Kn{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,i){if(!this._firstTwoTouches)return;t.preventDefault();const[r,n]=this._firstTwoTouches,s=Yn(i,e,r),o=Yn(i,e,n);if(!s||!o)return;const a=this._aroundCenter?null:s.add(o).div(2);return this._move([s,o],a,t)}touchend(t,e,i){if(!this._firstTwoTouches)return;const[r,n]=this._firstTwoTouches,s=Yn(i,e,r),o=Yn(i,e,n);s&&o||(this._active&&a.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 Yn(t,e,i){for(let r=0;r<t.length;r++)if(t[r].identifier===i)return e[r]}function Jn(t,e){return Math.log(t/e)/Math.LN2}class Qn extends Kn{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Jn(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Jn(this._distance,i),pinchAround:e}}}function ts(t,e){return 180*t.angleWith(e)/Math.PI}class es extends Kn{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,e,i){const r=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ts(this._vector,r),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,i=ts(t,this._startVector);return Math.abs(i)<e}}function is(t){return Math.abs(t.y)>Math.abs(t.x)}class rs extends Kn{constructor(t){super(),this._currentTouchCount=0,this._map=t}
2reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,is(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const r=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const r=t.mag()>=2,n=e.mag()>=2;if(!r&&!n)return;if(!r||!n)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const s=t.y>0==e.y>0;return is(t)&&is(e)&&s}}const ns={panStep:100,bearingStep:15,pitchStep:10};class ss{constructor(t){this._tr=new Bn(t);const e=ns;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,r=0,n=0,s=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?r=1:(t.preventDefault(),s=-1);break;case 40:t.shiftKey?r=-1:(t.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:o=>{const a=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:os,zoom:e?Math.round(a.zoom)+e*(t.shiftKey?2:1):a.zoom,bearing:a.bearing+i*this._bearingStep,pitch:a.pitch+r*this._pitchStep,offset:[-n*this._panStep,-s*this._panStep],center:a.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 os(t){return t*(2-t)}const as=4.000244140625;class ls{constructor(t,e){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new Bn(t),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}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 e=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const i=o.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==e&&e%as==0?this._type="wheel":0!==e&&Math.abs(e)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(r*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=a.mousePos(this._map.getCanvas(),t),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(e.Q.convert(r.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){const e=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=e),"number"==typeof this._targetZoom&&(this._targetZoom+=e)}if(0!==this._delta){const i="wheel"===this._type&&Math.abs(this._delta)>as?this._wheelZoomRate:this._defaultZoomRate;let r=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==r&&(r=1/r);const n="number"!=typeof this._targetZoom?t.scale:e.aI(this._targetZoom);this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,e.ab(n*r))),"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"!=typeof this._targetZoom?t.zoom:this._targetZoom,r=this._startZoom,n=this._easing;let s,a=!1;if("wheel"===this._type&&r&&n){const t=o.now()-this._lastWheelEventTime,l=Math.min((t+5)/200,1),c=n(l);s=e.B.number(r,i,c),l<1?this._frameId||(this._frameId=!0):a=!0}else s=i,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout((()=>
2{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=s,{noInertia:!0,needsRenderFrame:!a,zoomDelta:s-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.cb;if(this._prevEase){const t=this._prevEase,r=(o.now()-t.start)/t.duration,n=t.easing(r+.01)-t.easing(r),s=.27/Math.sqrt(n*n+1e-4)*.01,a=Math.sqrt(.0729-s*s);i=e.c9(s,a,.25,1)}return this._prevEase={start:o.now(),duration:t,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class cs{constructor(t,e){this._clickZoom=t,this._tapZoom=e}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 hs{constructor(t){this._tr=new Bn(t),this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class us{constructor(){this._tap=new Nn({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,e,i){if(!this._swipePoint)if(this._tapTime){const r=e[0],n=t.timeStamp-this._tapTime<500,s=this._tapPoint.dist(r)<30;n&&s?i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(t,e,i)}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=e[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{const r=this._tap.touchend(t,e,i);r&&(this._tapTime=t.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ds{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}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 ps{constructor(t,e,i,r){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=e,this._mousePitch=i,this._mouseRoll=r}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 fs{constructor(t,e,i,r){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=r,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 ms{constructor(t,e){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=e,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=a.create("div","maplibregl-cooperative-gesture-screen",t);let e=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(e=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=e,this._container.appendChild(r);const n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=i,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(a.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,i){this._enabled&&(this._map.fire(new e.l("cooperativegestureprevented",{gestureType:t,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const _s=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate;class gs extends e.l{}function ys(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}class xs{constructor(t,i){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,i)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const r="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},s={},o={};for(const{handlerName:h,handler:u,allowed:d}of this._handlers){if(!u.isEnabled())continue;let l;if(this._blockedByActive(o,d,h))u.reset();else if(u[i||t.type]){if(e.cc(t,i||t.type)){const e=a.mousePos(this._map.getCanvas(),t);l=u[i||t.type](t,e)}else if(e.cd(t,i||t.type)){const e=this._getMapTouches(t.touches),r=a.touchPos(this._map.getCanvas(),e);l=u[i||t.type](t,r,e)}
2else e.ce(i||t.type)||(l=u[i||t.type](t));this.mergeHandlerResult(n,s,l,h,r),l&&l.needsRenderFrame&&this._triggerRenderFrame()}(l||u.isActive())&&(o[h]=u)}const l={};for(const e in this._previousActiveHandlers)o[e]||(l[e]=r);this._previousActiveHandlers=o,(Object.keys(l).length||ys(n))&&(this._changes.push([n,s,l]),this._triggerRenderFrame()),(Object.keys(o).length||ys(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:c}=n;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new An(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,n,s]of this._listeners)a.addEventListener(e,n,e===document?this.handleWindowEvent:this.handleEvent,s)}destroy(){for(const[t,e,i]of this._listeners)a.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){const i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new Ln(i,t));const n=i.boxZoom=new On(i,t);this._add("boxZoom",n),t.interactive&&t.boxZoom&&n.enable();const s=i.cooperativeGestures=new ms(i,t.cooperativeGestures);this._add("cooperativeGestures",s),t.cooperativeGestures&&s.enable();const o=new Zn(i),l=new hs(i);i.doubleClickZoom=new cs(l,o),this._add("tapZoom",o),this._add("clickZoom",l),t.interactive&&t.doubleClickZoom&&i.doubleClickZoom.enable();const c=new us;this._add("tapDragZoom",c);const h=i.touchPitch=new rs(i);this._add("touchPitch",h),t.interactive&&t.touchPitch&&i.touchPitch.enable(t.touchPitch);const u=()=>i.project(i.getCenter()),d=function({enable:t,clickTolerance:i,aroundCenter:r=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:s=.8},o){const l=new $n({checkCorrectEvent:t=>0===a.mouseButton(t)&&t.ctrlKey||2===a.mouseButton(t)&&!t.ctrlKey});return new Un({clickTolerance:i,move:(t,i)=>{const a=o();if(r&&Math.abs(a.y-t.y)>n)return{bearingDelta:e.ca(new e.P(t.x,i.y),i,a)};let l=(i.x-t.x)*s;return r&&i.y<a.y&&(l=-l),{bearingDelta:l}},moveStateManager:l,enable:t,assignEvents:Hn})}(t,u),p=function({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5}){const r=new $n({checkCorrectEvent:t=>0===a.mouseButton(t)&&t.ctrlKey||2===a.mouseButton(t)});return new Un({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:r,enable:t,assignEvents:Hn})}(t),f=function({enable:t,clickTolerance:e,rollDegreesPerPixelMoved:i=.3},r){const n=new $n({checkCorrectEvent:t=>2===a.mouseButton(t)&&t.ctrlKey});return new Un({clickTolerance:e,move:(t,e)=>{const n=r();let s=(e.x-t.x)*i;return e.y<n.y&&(s=-s),{rollDelta:s}},moveStateManager:n,enable:t,assignEvents:Hn})}(t,u);i.dragRotate=new ps(t,d,p,f),this._add("mouseRotate",d,["mousePitch"]),this._add("mousePitch",p,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),t.interactive&&t.dragRotate&&i.dragRotate.enable();const m=function({enable:t,clickTolerance:e}){const i=new $n({checkCorrectEvent:t=>0===a.mouseButton(t)&&!t.ctrlKey});return new Un({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:i,enable:t,assignEvents:Hn})}(t),_=new Xn(t,i);i.dragPan=new ds(r,m,_),this._add("mousePan",m),this._add("touchPan",_,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&i.dragPan.enable(t.dragPan);const g=new es,y=new Qn;i.touchZoomRotate=new fs(r,y,g,c),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&i.touchZoomRotate.enable(t.touchZoomRotate);const x=i.scrollZoom=new ls(i,(()=>
2this._triggerRenderFrame()));this._add("scrollZoom",x,["mousePan"]),t.interactive&&t.scrollZoom&&i.scrollZoom.enable(t.scrollZoom);const v=i.keyboard=new ss(i);this._add("keyboard",v),t.interactive&&t.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new Fn(i))}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(_s(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const r in t)if(r!==i&&(!e||e.indexOf(r)<0))return!0;return!1}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}mergeHandlerResult(t,i,r,n,s){if(!r)return;e.e(t,r);const o={handlerName:n,originalEvent:r.originalEvent||s};void 0!==r.zoomDelta&&(i.zoom=o),void 0!==r.panDelta&&(i.drag=o),void 0!==r.rollDelta&&(i.roll=o),void 0!==r.pitchDelta&&(i.pitch=o),void 0!==r.bearingDelta&&(i.rotate=o)}_applyChanges(){const t={},i={},r={};for(const[n,s,o]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new e.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),e.e(i,s),e.e(r,o);this._updateMapTransform(t,i,r),this._changes=[]}_updateMapTransform(t,e,i){const r=this._map,n=r._getTransformForUpdate(),s=r.terrain;if(!(ys(t)||s&&this._terrainMovement))return this._fireEvents(e,i,!0);r._stop(!0);let{panDelta:o,zoomDelta:a,bearingDelta:l,pitchDelta:c,rollDelta:h,around:u,pinchAround:d}=t;void 0!==d&&(u=d),u=u||r.transform.centerPoint,s&&!n.isPointOnMapSurface(u)&&(u=n.centerPoint);const p={panDelta:o,zoomDelta:a,rollDelta:h,pitchDelta:c,bearingDelta:l,around:u};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(u)&&(u=n.centerPoint);const f=u.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(o?u.sub(o):u);s?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(p,n),this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(o))):this._map.cameraHelper.handleMapControlsPan(p,n,f):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(p,n,f))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(p,n),this._map.cameraHelper.handleMapControlsPan(p,n,f)),r._applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_fireEvents(t,i,r){const n=_s(this._eventsInProgress),s=_s(t),a={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(a[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!n&&s&&this._fireEvent("movestart",s.originalEvent);for(const e in a)this._fireEvent(e,a[e]);s&&this._fireEvent("move",s.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i)}const l={};let c;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],c=i[t]||r,l[`${e}end`]=c)}for(const e in l)this._fireEvent(e,l[e]);const h=_s(this._eventsInProgress),u=(n||s)&&!h;if(u&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const t=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(t)}if(r&&u){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;!t||!t.essential&&o.prefersReducedMotion?(this._map.fire(new e.l("moveend",{originalEvent:c})),i(this._map.getBearing())&&this._map.resetNorth()):(i(t.bearing||this._map.getBearing())&&
2(t.bearing=0),t.freezeElevation=!0,this._map.easeTo(t,{originalEvent:c})),this._updatingCamera=!1}}_fireEvent(t,i){this._map.fire(new e.l(t,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new gs("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class vs extends e.E{constructor(t,e,i){super(),this._renderFrameCallback=()=>{const t=Math.min((o.now()-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=i.bearingSnap,this.cameraHelper=e,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,e){t.apply(this.transform),this.transform=t,this.cameraHelper=e}getCenter(){return new e.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,e){return this.jumpTo({elevation:t},e),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,i,r){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.e({offset:t},i),r)}panTo(t,i,r){return this.easeTo(e.e({center:t},i),r)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(t,i,r){return this.easeTo(e.e({zoom:t},i),r)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,i){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new e.l("movestart",i)).fire(new e.l("move",i)).fire(new e.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(t,i,r){return this.easeTo(e.e({bearing:t},i),r)}resetNorth(t,i){return this.rotateTo(0,e.e({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.e({bearing:0,pitch:0,roll:0,duration:1e3},t),i),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}getRoll(){return this.transform.roll}setRoll(t,e){return this.jumpTo({roll:t},e),this}cameraForBounds(t,e){t=G.convert(t).adjustAntiMeridian();const i=e&&e.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,e)}_cameraForBoxAndBearing(t,i,r,n){const s={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=e.e({padding:s,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){const t=n.padding;n.padding={top:t,bottom:t,right:t,left:t}}const o=e.e(s,n.padding);n.padding=o;const a=this.transform,l=new G(t,i);return this.cameraHelper.cameraForBoxAndBearing(n,o,l,r,a)}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(t,i,r,n,s){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(e.P.convert(t)),this.transform.screenPointToLocation(e.P.convert(i)),r,n),n,s)}_fitInternal(t,i,r){return t?(delete(i=e.e(t,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}jumpTo(t,i){this.stop();const r=this._getTransformForUpdate();let n=!1,s=!1,o=!1;const a=r.zoom;this.cameraHelper.handleJumpToCenterZoom(r,t);const l=r.zoom!==a;return"elevation"in t&&r.elevation!==+t.elevation&&r.setElevation(+t.elevation),"bearing"in t&&r.bearing!==+t.bearing&&(n=!0,r.setBearing(+t.bearing)),"pitch"in t&&r.pitch!==+t.pitch&&(s=!0,r.setPitch(+t.pitch)),"roll"in t&&r.roll!==+t.roll&&(o=!0,r.setRoll(+t.roll)),null==t.padding||r.isPaddingEqual(t.padding)||r.setPadding(t.padding),this._applyUpdatedTransform(r),this.fire(new e.l("movestart",i)).fire(new e.l("move",i)),l&&this.fire(new e.l("zoomstart",i)).fire(new e.l("zoom",i)).fire(new e.l("zoomend",i)),n&&this.fire(new e.l("rotatestart",i)).fire(new e.l("rotate",i)).fire(new e.l("rotateend",i)),s&&this.fire(new e.l("pitchstart",i)).fire(new e.l("pitch",i)).fire(new e.l("pitchend",
2i)),o&&this.fire(new e.l("rollstart",i)).fire(new e.l("roll",i)).fire(new e.l("rollend",i)),this.fire(new e.l("moveend",i))}calculateCameraOptionsFromTo(t,i,r,n=0){const s=e.$.fromLngLat(t,i),o=e.$.fromLngLat(r,n),a=o.x-s.x,l=o.y-s.y,c=o.z-s.z,h=Math.hypot(a,l,c);if(0===h)throw new Error("Can't calculate camera options with same From and To");const u=Math.hypot(a,l),d=e.ab(this.transform.cameraToCenterDistance/h/this.transform.tileSize),p=180*Math.atan2(a,-l)/Math.PI;let f=180*Math.acos(u/h)/Math.PI;return f=c<0?90-f:90+f,{center:o.toLngLat(),elevation:n,zoom:d,pitch:f,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(t,e,i,r,n){const s=this.transform.calculateCenterFromCameraLngLatAlt(t,e,i,r);return{center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:i,pitch:r,roll:n}}easeTo(t,i){this._stop(!1,t.easeId),(!1===(t=e.e({offset:[0,0],duration:500,easing:e.cb},t)).animate||!t.essential&&o.prefersReducedMotion)&&(t.duration=0);const r=this._getTransformForUpdate(),n=this.getBearing(),s=r.pitch,a=r.roll,l="bearing"in t?this._normalizeBearing(t.bearing,n):n,c="pitch"in t?+t.pitch:s,h="roll"in t?this._normalizeBearing(t.roll,a):a,u="padding"in t?t.padding:r.padding,d=e.P.convert(t.offset);let p,f;t.around&&(p=e.Q.convert(t.around),f=r.locationToScreenPoint(p));const m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},_=this.cameraHelper.handleEaseTo(r,{bearing:l,pitch:c,roll:h,padding:u,around:p,aroundPoint:f,offsetAsPoint:d,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||n!==l,this._pitching=this._pitching||c!==s,this._rolling=this._rolling||h!==a,this._padding=!r.isPaddingEqual(u),this._zooming=this._zooming||_.isZooming,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,m),this.terrain&&this._prepareElevation(_.elevationCenter),this._ease((e=>{_.easeFunc(e),this.terrain&&!t.freezeElevation&&this._updateElevation(e),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(e=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i,e)}),t),this}_prepareEase(t,i,r={}){this._moving=!0,i||r.moving||this.fire(new e.l("movestart",t)),this._zooming&&!r.zooming&&this.fire(new e.l("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new e.l("rotatestart",t)),this._pitching&&!r.pitching&&this.fire(new e.l("pitchstart",t)),this._rolling&&!r.rolling&&this.fire(new e.l("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&i!==this._elevationTarget){const e=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(e-(i-(e*t+this._elevationStart))/(1-t)),this._elevationTarget=i}this.transform.setElevation(e.B.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const e=t.getCameraLngLat(),i=t.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(e,t.zoom):0;if(i<r){const i=this.calculateCameraOptionsFromTo(e,r,t.center,t.elevation);return{pitch:i.pitch,zoom:i.zoom}}return{}}_applyUpdatedTransform(t){const e=[];if(e.push((t=>this._elevateCameraIfInsideTerrain(t))),this.transformCameraUpdate&&e.push((t=>this.transformCameraUpdate(t))),!e.length)return;const i=t.clone();for(const r of e){const t=i.clone(),{center:e,zoom:n,roll:s,pitch:o,bearing:a,elevation:l}=r(t);e&&t.setCenter(e),void 0!==l&&t.setElevation(l),void 0!==n&&t.setZoom(n),void 0!==s&&t.setRoll(s),void 0!==o&&t.setPitch(o),void 0!==a&&t.setBearing(a),i.apply(t)}this.transform.apply(i)}_fireMoveEvents(t){this.fire(new e.l("move",t)),this._zooming&&this.fire(new e.l("zoom",t)),this._rotating&&this.fire(new e.l("rotate",t)),this._pitching&&this.fire(new e.l("pitch",t)),this._rolling&&this.fire(new e.l("roll",t))}
2_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const r=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,r&&this.fire(new e.l("zoomend",t)),n&&this.fire(new e.l("rotateend",t)),s&&this.fire(new e.l("pitchend",t)),o&&this.fire(new e.l("rollend",t)),this.fire(new e.l("moveend",t))}flyTo(t,i){if(!t.essential&&o.prefersReducedMotion){const r=e.O(t,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(r,i)}this.stop(),t=e.e({offset:[0,0],speed:1.2,curve:1.42,easing:e.cb},t);const r=this._getTransformForUpdate(),n=r.bearing,s=r.pitch,a=r.roll,l=r.padding,c="bearing"in t?this._normalizeBearing(t.bearing,n):n,h="pitch"in t?+t.pitch:s,u="roll"in t?this._normalizeBearing(t.roll,a):a,d="padding"in t?t.padding:r.padding,p=e.P.convert(t.offset);let f=r.centerPoint.add(p);const m=r.screenPointToLocation(f),_=this.cameraHelper.handleFlyTo(r,{bearing:c,pitch:h,roll:u,padding:d,locationAtOffset:m,offsetAsPoint:p,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let g=t.curve;const y=Math.max(r.width,r.height),x=y/_.scaleOfZoom,v=_.pixelPathLength;"number"==typeof _.scaleOfMinZoom&&(g=Math.sqrt(y/_.scaleOfMinZoom/v*2));const b=g*g;function w(t){const e=(x*x-y*y+(t?-1:1)*b*b*v*v)/(2*(t?x:y)*b*v);return Math.log(Math.sqrt(e*e+1)-e)}function T(t){return(Math.exp(t)-Math.exp(-t))/2}function P(t){return(Math.exp(t)+Math.exp(-t))/2}const M=w(!1);let S=function(t){return P(M)/P(M+g*t)}
2,I=function(t){return y*((P(M)*(T(e=M+g*t)/P(e))-T(M))/b)/v;var e},C=(w(!0)-M)/g;if(Math.abs(v)<2e-6||!isFinite(C)){if(Math.abs(y-x)<1e-6)return this.easeTo(t,i);const e=x<y?-1:1;C=Math.abs(Math.log(x/y))/g,I=()=>0,S=t=>Math.exp(e*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!==c,this._pitching=h!==s,this._rolling=u!==a,this._padding=!r.isPaddingEqual(d),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(_.targetCenter),this._ease((o=>{const m=o*C,g=1/S(m),y=I(m);this._rotating&&r.setBearing(e.B.number(n,c,o)),this._pitching&&r.setPitch(e.B.number(s,h,o)),this._rolling&&r.setRoll(e.B.number(a,u,o)),this._padding&&(r.interpolatePadding(l,d,o),f=r.centerPoint.add(p)),_.easeFunc(o,g,y,f),this.terrain&&!t.freezeElevation&&this._updateElevation(o),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}return t||null===(i=this.handlers)||void 0===i||i.stop(!1),this}_ease(t,e,i){!1===i.animate||0===i.duration?(t(1),e()):(this._easeStart=o.now(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,i){t=e.aL(t,-180,180);const r=Math.abs(t-i);return Math.abs(t-360-i)<r&&(t-=360),Math.abs(t+360-i)<r&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(e.Q.convert(t),this.transform.tileZoom):null}}const bs={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class ws{constructor(t=bs){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=a.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=a.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=a.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(){a.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,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}_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){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const r in e){const i=e[r];if(i.used||i.usedForTerrain){const e=i.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let r=i+1;r<t.length;r++)if(t[r].indexOf(e)>=0)return!1;return!0}));const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=a.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ts{constructor(t={}){this._updateCompact=()=>{const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.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=a.create("div","maplibregl-ctrl");const e=a.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){a.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Ps{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;
2for(const r of i)if(r.id===t)return void(r.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ms=e.aD([{name:"a_pos3d",type:"Int16",components:3}]);class Ss extends e.E{constructor(t){super(),this._lastTilesetChange=o.now(),this.sourceCache=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.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,i){this.sourceCache.update(t,i),this._renderableTilesKeys=[];const r={};for(const n of ut(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))r[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),e.bO(n.terrainRttPosMatrix32f,0,e.Z,e.Z,0,0,1),this._tiles[n.key]=new st(n,this.tileSize),this._lastTilesetChange=o.now());for(const e in this._tiles)r[e]||delete this._tiles[e]}freeRtt(t){for(const e in this._tiles){const i=this._tiles[e];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,e){return e?this._getTerrainCoordsForTileRanges(t,e):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const i={};for(const r of this._renderableTilesKeys){const n=this._tiles[r].tileID,s=t.clone(),o=e.b2();if(n.canonical.equals(t.canonical))e.bO(o,0,e.Z,e.Z,0,0,1);else if(n.canonical.isChildOf(t.canonical)){const i=n.canonical.z-t.canonical.z,r=n.canonical.x-(n.canonical.x>>i<<i),s=n.canonical.y-(n.canonical.y>>i<<i),a=e.Z>>i;e.bO(o,0,a,a,0,0,1),e.L(o,o,[-r*a,-s*a,0])}else{if(!t.canonical.isChildOf(n.canonical))continue;{const i=t.canonical.z-n.canonical.z,r=t.canonical.x-(t.canonical.x>>i<<i),s=t.canonical.y-(t.canonical.y>>i<<i),a=e.Z>>i;e.bO(o,0,e.Z,e.Z,0,0,1),e.L(o,o,[r*a,s*a,0]),e.M(o,o,[1/2**i,1/2**i,0])}}s.terrainRttPosMatrix32f=new Float32Array(o),i[r]=s}return i}_getTerrainCoordsForTileRanges(t,i){const r={};for(const n of this._renderableTilesKeys){const s=this._tiles[n].tileID;if(!this._isWithinTileRanges(s,i))continue;const o=t.clone(),a=e.b2();if(s.canonical.z===t.canonical.z){const i=t.canonical.x-s.canonical.x,r=t.canonical.y-s.canonical.y;e.bO(a,0,e.Z,e.Z,0,0,1),e.L(a,a,[i*e.Z,r*e.Z,0])}else if(s.canonical.z>t.canonical.z){const i=s.canonical.z-t.canonical.z,r=s.canonical.x-(s.canonical.x>>i<<i),n=s.canonical.y-(s.canonical.y>>i<<i),o=t.canonical.x-(s.canonical.x>>i),l=t.canonical.y-(s.canonical.y>>i),c=e.Z>>i;e.bO(a,0,c,c,0,0,1),e.L(a,a,[-r*c+o*e.Z,-n*c+l*e.Z,0])}else{const i=t.canonical.z-s.canonical.z,r=t.canonical.x-(t.canonical.x>>i<<i),n=t.canonical.y-(t.canonical.y>>i<<i),o=(t.canonical.x>>i)-s.canonical.x,l=(t.canonical.y>>i)-s.canonical.y,c=e.Z<<i;e.bO(a,0,c,c,0,0,1),e.L(a,a,[r*e.Z+o*c,n*e.Z+l*c,0])}o.terrainRttPosMatrix32f=new Float32Array(a),r[n]=o}return r}getSourceTile(t,e){const i=this.sourceCache._source;let r=t.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r<i.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(r).key);let n=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!n||!n.dem)&&e)for(;r>=i.minzoom&&(!n||!n.dem);)n=this.sourceCache.getTileByID(t.scaledTo(r--).key);return n}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,e){return e[t.canonical.z]&&t.canonical.x>=e[t.canonical.z].minTileX&&t.canonical.x<=e[t.canonical.z].maxTileX&&t.canonical.y>=e[t.canonical.z].minTileY&&t.canonical.y<=e[t.canonical.z].maxTileY}}class Is{constructor(t,e,i){this._meshCache={},this.painter=t,this.sourceCache=new Ss(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qual
2ityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,i,r,n=e.Z){var s;if(!(i>=0&&i<n&&r>=0&&r<n))return 0;const o=this.getTerrainData(t),a=null===(s=o.tile)||void 0===s?void 0:s.dem;if(!a)return 0;const l=e.cf([],[i/n*e.Z,r/n*e.Z],o.u_terrain_matrix),c=[l[0]*a.dim,l[1]*a.dim],h=Math.floor(c[0]),u=Math.floor(c[1]),d=c[0]-h,p=c[1]-u;return a.get(h,u)*(1-d)*(1-p)+a.get(h+1,u)*d*(1-p)+a.get(h,u+1)*(1-d)*p+a.get(h+1,u+1)*d*p}getElevationForLngLatZoom(t,i){if(!e.cg(i,t.wrap()))return 0;const{tileID:r,mercatorX:n,mercatorY:s}=this._getOverscaledTileIDFromLngLatZoom(t,i);return this.getElevation(r,n%e.Z,s%e.Z,e.Z)}getElevation(t,i,r,n=e.Z){return this.getDEMElevation(t,i,r,n)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const t=this.painter.context,i=new e.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new y(t,i,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new y(t,new e.R({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=e.at([])}const i=this.sourceCache.getSourceTile(t,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const t=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new y(t,i.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),i.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const r=i&&i+i.tileID.key+t.key;if(r&&!this._demMatrixCache[r]){const r=this.sourceCache.sourceCache._source.maxzoom;let n=t.canonical.z-i.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=r?n=t.canonical.z-r:e.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const s=t.canonical.x-(t.canonical.x>>n<<n),o=t.canonical.y-(t.canonical.y>>n<<n),a=e.ch(new Float64Array(16),[1/(e.Z<<n),1/(e.Z<<n),0]);e.L(a,a,[s*e.Z,o*e.Z,0]),this._demMatrixCache[t.key]={matrix:a,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(t){const e=this.painter,i=e.width/devicePixelRatio,r=e.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===r||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new y(e.context,{width:i,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new y(e.context,{width:i,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(i,r,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,i,r))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let e=0,s=0;e<this._coordsTextureSize;e++)for(let t=0;t<this._coordsTextureSize;t++,s+=4)i[s+0]=255&t,i[s+1]=255&e,i[s+2]=t>>8<<4|e>>8,i[s+3]=0;const r=new e.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),n=new y(t,r,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);const i=new Uint8Array(4),r=this.painter.context,n=r.gl,s=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),o=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),a=Math.round(this.painter.height/devicePixelRatio);r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(s,a-o-1,1,1,n.RGBA,n.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null);const l=i[0]+(i[2]>>4<<8),c=i[1]+((15&i[2])<<8),h=this.coordsIndex[255-i[3]],u=h&&this.sourceCache.getTileByID(h);if(!u)return null;const d=this._coordsTextureSize,p=(1<<u.tileID.canonical.z)*d;return new e.$((u.tileID.canonical.x*d+l)/p+u.tileID.wrap,(u.tileID.canonical.y*d+c)/p,this.getElevation(u.tileID,l,c,d))}depthAtPoint(t){const e=new Uint8Array(4),i=this.painter.context,r=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),r.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,e),i.bindFramebuffer.set(null),(e[0]/16777216+e[1]/65536+e[2]/256+e[3])/256}getTerrainMesh(t){var i;const r=(null===(i=this.painter.style.projection)||void 0===i?void 0:i.transitionState)>0,n=r&&0===t.canonical.y,s=r&&t.canonical.y===(1<<t.canonical.z)-1,o=`m_${n?"n":""}_${s?"s":""}`;if(this._meshCache[o])return this._meshCache[o];const a=this.painter.context,l=new e.ci,c=new e.aH,h=this.meshSize,u=e.Z/h,d=h*h;for(let e=0;e<=h;e++)for(let t=0;t<=h;t++)l.emplaceBack(t*u,e*u,0);for(let e=0;e<d;e+=h+1)for(let t=0;t<h;t++)c.emplaceBack(t+e,h+t+e+1,h+t+e+2),c.emplaceBack(t+e,h+t+e+2,t+e+1);const p=l.length,f=p+(h+1),m=(h+1)*h,_=n?e.b9:0,g=n?0:1,y=s?e.ba:e.Z,x=s?0:1;for(let e=0;e<=h;e++)l.emplaceBack(e*u,_,g);for(let e=0;e<=h;e++)l.emplaceBack(e*u,y,x);for(let e=0;e<h;e++)c.emplaceBack(m+e,f+e,f+e+1),c.emplaceBack(m+e,f+e+1,m+e+1),c.emplaceBack(0+e,p+e+1,p+e),c.emplaceBack(0+e,0+e+1,p+e+1);const v=l.length,b=v+2*(h+1);for(const T of[0,1])for(let t=0;t<=h;t++)for(const i of[0,1])l.emplaceBack(T*e.Z,t*u,i);for(let e=0;e<2*h;e+=2)c.emplaceBack(v+e,v+e+1,v+e+3),c.emplaceBack(v+e,v+e+3,v+e+2),c.emplaceBack(b+e,b+e+3,b+e+1),c.emplaceBack(b+e,b+e+2,b+e+3);const w=new fe(a.createVertexBuffer(l,Ms.members),a.createIndexBuffer(c),e.aG.simpleSegment(0,0,l.length,c.length));return this._meshCache[o]=w,w}getMeshFrameDelta(t){return 2*Math.PI*e.br/Math.pow(2,Math.max(t,0))
2/5}getMinTileElevationForLngLatZoom(t,e){var i;const{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(t,e);return null!==(i=this.getMinMaxElevation(r).minElevation)&&void 0!==i?i:0}getMinMaxElevation(t){const e=this.getTerrainData(t).tile,i={minElevation:null,maxElevation:null};return e&&e.dem&&(i.minElevation=e.dem.min*this.exaggeration,i.maxElevation=e.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(t,i){const r=e.$.fromLngLat(t.wrap()),n=(1<<i)*e.Z,s=r.x*n,o=r.y*n,a=Math.floor(s/e.Z),l=Math.floor(o/e.Z);return{tileID:new e.Y(i,0,i,a,l),mercatorX:s,mercatorY:o}}}class Cs{constructor(t,e,i){this._context=t,this._size=e,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const e=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new y(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.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),e.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),e.colorAttachment.set(i.texture),{id:t,fbo:e,texture:i,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((e=>t.id!==e)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some((t=>!t.inUse))}}const As={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Es{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new Cs(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter((i=>!t._layers[i].isHidden(e))),this._coordsAscending={};for(const i in t.sourceCaches){this._coordsAscending[i]={};const e=t.sourceCaches[i].getVisibleCoordinates(),r=t.sourceCaches[i].getSource(),n=r instanceof K?r.terrainTileRanges:null;for(const t of e){const e=this.terrain.sourceCache.getTerrainCoords(t,n);for(const t in e)this._coordsAscending[i][t]||(this._coordsAscending[i][t]=[]),this._coordsAscending[i][t].push(e[t])}}this._coordsAscendingStr={};for(const i of t._order){const e=t._layers[i],r=e.source;if(As[e.type]&&!this._coordsAscendingStr[r]){this._coordsAscendingStr[r]={};for(const t in this._coordsAscending[r])this._coordsAscendingStr[r][t]=this._coordsAscending[r][t].map((t=>t.key)).sort().join()}}for(const i of this._renderableTiles)for(const t in this._coordsAscendingStr){const e=this._coordsAscendingStr[t][i.tileID.key];e&&e!==i.rttCoords[t]&&(i.rtt=[])}}renderLayer(t,i){if(t.isHidden(this.painter.transform.zoom))return!1;const r=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),n=t.type,s=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(As[n]&&(this._prevType&&As[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!o))return!0;if(As[this._prevType]||As[n]&&o){this._prevType=n;const t=this._stacks.length-1,i=this._stacks[t]||[];for(const n of this._renderableTiles){if(this.pool.isFull()&&(yn(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[t]){const e=this.pool.getObjectForId(n.rtt[t].id);if(e.stamp===n.rtt[t].stamp){this.pool.useObject(e);continue}}const 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:e.b7.transparent,stencil:0}),s.currentStencilSource=void 0;for(let t=0;t<i.length;t++){const e=s.style._layers[i[t]],a=e.source?this._coordsAscending[e.source][n.tileID.key]:[n.tileID];s.context.viewport.set([0,0,o.fbo.width,o.fbo.height]),s._renderTileClippingMasks(e,a,!0),s.renderLayer(s,s.style.sourceCaches[e.source],e,a,r),e.source&&(n.rttCoords[e.source]=this._coordsAscendingStr[e.source][n.tileID.key])}}return yn(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects(),As[n]}return!1}}const zs={"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"},ks=i,Ds={hash:!1,interactive:!0,bearingSnap:7,attributionControl:bs,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileC
2acheSize:null,maxTileCacheZoomLevels:e.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},Rs={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Ls{constructor(t,i,r=!1){this.mousedown=t=>{this.startMove(t,a.mousePos(this.element,t)),a.addEventListener(window,"mousemove",this.mousemove),a.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=t=>{this.move(t,a.mousePos(this.element,t))},this.mouseup=t=>{this._rotatePitchHanlder.dragEnd(t),this.offTemp()},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=a.touchPos(this.element,t.targetTouches)[0],this.startMove(t,this._startPos),a.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),a.addEventListener(window,"touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=a.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._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const n=new Wn;this._rotatePitchHanlder=new Un({clickTolerance:3,move:(t,n)=>{const s=i.getBoundingClientRect(),o=new e.P((s.bottom-s.top)/2,(s.right-s.left)/2);return{bearingDelta:e.ca(new e.P(t.x,n.y),n,o),pitchDelta:r?-.5*(n.y-t.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=t,a.addEventListener(i,"mousedown",this.mousedown),a.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),a.addEventListener(i,"touchcancel",this.reset)}startMove(t,e){this._rotatePitchHanlder.dragStart(t,e),a.disableDrag()}move(t,e){const i=this.map,{bearingDelta:r,pitchDelta:n}=this._rotatePitchHanlder.dragMove(t,e)||{};r&&i.setBearing(i.getBearing()+r),n&&i.setPitch(i.getPitch()+n)}off(){const t=this.element;a.removeEventListener(t,"mousedown",this.mousedown),a.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),a.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),a.removeEventListener(window,"touchend",this.touchend),a.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){a.enableDrag(),a.removeEventListener(window,"mousemove",this.mousemove),a.removeEventListener(window,"mouseup",this.mouseup),a.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),a.removeEventListener(window,"touchend",this.touchend)}}let Fs;function Bs(t,i,r){const n=new e.Q(t.lng,t.lat);if(t=new e.Q(t.lng,t.lat),i){const n=new e.Q(t.lng-360,t.lat),s=new e.Q(t.lng+360,t.lat),o=r.locationToScreenPoint(t).distSqr(i);r.locationToScreenPoint(n).distSqr(i)<o?t=n:r.locationToScreenPoint(s).distSqr(i)<o&&(t=s)}for(;Math.abs(t.lng-r.center.lng)>180;){const e=r.locationToScreenPoint(t);if(e.x>=0&&e.y>=0&&e.x<=r.width&&e.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t.lng!==n.lng&&r.isPointOnMapSurface(r.locationToScreenPoint(t))?t:n}const Os={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 js(t,e,i){const r=t.classList;for(const n in Os)r.remove(`maplibregl-${i}-anchor-${n}`);r.add(`maplibregl-${i}-anchor-${e}`)}class Vs extends e.E{constructor(t){if(super(),this._onKeyPress=t=>{const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()},this._onMapClick=t=>{const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()},this._update=t=>{var e;if(!this._map)return;const 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=this._map.transform.renderWorldCopies?Bs(this._lngLat,this._flatPos,this._map.transform):null===(e=this._lngLat)||void 0===e?void 0:e.wrap(),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 n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t&&"moveend"!==t.type||(this._pos=this._pos.round()),a.setTransform(this._element,`${Os[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${r}`),o.frameAsync(new AbortController).then((()=>{this._updateOpacity(t&&"moveend"===t.type)})).catch((()=>{}))},this._onMove=t=>{if(!this._isDragging){const e=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=e}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 e.l("dragstart"))),this.fire(new e.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 e.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=e.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=a.create("div");const i=a.createNS("http://www.w3.org/2000/svg","svg"),r=41,n=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${r}px`),i.setAttributeNS(null,"width",`${n}px`),i.setAttributeNS(null,"viewBox",`0 0 ${n} ${r}`);const s=a.createNS("http://www.w3.org/2000/svg","g");
2s.setAttributeNS(null,"stroke","none"),s.setAttributeNS(null,"stroke-width","1"),s.setAttributeNS(null,"fill","none"),s.setAttributeNS(null,"fill-rule","evenodd");const o=a.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"fill-rule","nonzero");const l=a.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const c=[{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"}];for(const t of c){const e=a.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const h=a.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"fill",this._color);const u=a.createNS("http://www.w3.org/2000/svg","path");u.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"),h.appendChild(u);const d=a.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"fill","#000000");const p=a.createNS("http://www.w3.org/2000/svg","path");p.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"),d.appendChild(p);const f=a.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=a.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const _=a.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#000000"),_.setAttributeNS(null,"opacity","0.25"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962");const g=a.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#FFFFFF"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962"),m.appendChild(_),m.appendChild(g),o.appendChild(l),o.appendChild(h),o.appendChild(d),o.appendChild(f),o.appendChild(m),i.appendChild(o),i.setAttributeNS(null,"height",r*this._scale+"px"),i.setAttributeNS(null,"width",n*this._scale+"px"),this._element.appendChild(i),this._offset=e.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()})),js(this._element,this._anchor,"marker"),t&&t.className)for(const e of t.className.split(" "))this._element.classList.add(e);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")),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),a.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.Q.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,r=Math.abs(i)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
20,-38.1],"bottom-left":[r,-1*(e-i+r)],"bottom-right":[-r,-1*(e-i+r)],left:[i,-1*(e-i)],right:[-13.5,-1*(e-i)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var i,r;if(!(null===(i=this._map)||void 0===i?void 0:i.terrain)){const t=this._map.transform.isLocationOccluded(this._lngLat)?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)}const n=this._map,s=n.terrain.depthAtPoint(this._pos),o=n.terrain.getElevationForLngLatZoom(this._lngLat,n.transform.tileZoom);if(n.transform.lngLatToCameraDepth(this._lngLat,o)-s<.006)return void(this._element.style.opacity=this._opacity);const a=-this._offset.y/n.transform.pixelsPerMeter,l=Math.sin(n.getPitch()*Math.PI/180)*a,c=n.terrain.depthAtPoint(new e.P(this._pos.x,this._pos.y-this._offset.y)),h=n.transform.lngLatToCameraDepth(this._lngLat,o+l)-c>.006;(null===(r=this._popup)||void 0===r?void 0:r.isOpen())&&h&&this._popup.remove(),this._element.style.opacity=h?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=e.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,e){return(void 0===this._opacity||void 0===t&&void 0===e)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=t),void 0!==e&&(this._opacityWhenCovered=e),this._map&&this._updateOpacity(!0),this}}const Ns={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Zs=0,Us=!1;const Gs={maxWidth:100,unit:"metric"};function $s(t,e,i){const r=i&&i.maxWidth||100,n=t._container.clientHeight/2,s=t._container.clientWidth/2,o=t.unproject([s-r/2,n]),a=t.unproject([s+r/2,n]),l=Math.round(t.project(a).x-t.project(o).x),c=Math.min(r,l,t._container.clientWidth),h=o.distanceTo(a);if(i&&"imperial"===i.unit){const i=3.2808*h;i>5280?qs(e,c,i/5280,t._getUIString("ScaleControl.Miles")):qs(e,c,i,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?qs(e,c,h/1852,t._getUIString("ScaleControl.NauticalMiles")):h>=1e3?qs(e,c,h/1e3,t._getUIString("ScaleControl.Kilometers")):qs(e,c,h,t._getUIString("ScaleControl.Meters"))}function qs(t,e,i,r){const n=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(n/i)+"px",t.innerHTML=`${n} ${r}`}const Ws={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0}
2,Hs=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Xs(t){if(t){if("number"==typeof t){const i=Math.round(Math.abs(t)/Math.SQRT2);return{center:new e.P(0,0),top:new e.P(0,t),"top-left":new e.P(i,i),"top-right":new e.P(-i,i),bottom:new e.P(0,-t),"bottom-left":new e.P(i,-i),"bottom-right":new e.P(-i,-i),left:new e.P(t,0),right:new e.P(-t,0)}}if(t instanceof e.P||Array.isArray(t)){const i=e.P.convert(t);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:e.P.convert(t.center||[0,0]),top:e.P.convert(t.top||[0,0]),"top-left":e.P.convert(t["top-left"]||[0,0]),"top-right":e.P.convert(t["top-right"]||[0,0]),bottom:e.P.convert(t.bottom||[0,0]),"bottom-left":e.P.convert(t["bottom-left"]||[0,0]),"bottom-right":e.P.convert(t["bottom-right"]||[0,0]),left:e.P.convert(t.left||[0,0]),right:e.P.convert(t.right||[0,0])}}return Xs(new e.P(0,0))}const Ks=i;t.AJAXError=e.cm,t.Event=e.l,t.Evented=e.E,t.LngLat=e.Q,t.MercatorCoordinate=e.$,t.Point=e.P,t.addProtocol=e.cn,t.config=e.a,t.removeProtocol=e.co,t.AttributionControl=ws,t.BoxZoomHandler=On,t.CanvasSource=J,t.CooperativeGesturesHandler=ms,t.DoubleClickZoomHandler=cs,t.DragPanHandler=ds,t.DragRotateHandler=ps,t.EdgeInsets=Pe,t.FullscreenControl=class extends e.E{constructor(t={}){super(),this._onFullscreenChange=()=>{var t;let e=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null===(t=null==e?void 0:e.shadowRoot)||void 0===t?void 0:t.fullscreenElement;)e=e.shadowRoot.fullscreenElement;e===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:e.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=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){a.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=a.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);a.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(){const 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 e.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new e.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=X,t.GeolocateControl=class extends e.E{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.l("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
2RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"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 e.l("geolocate",t)),this._finish()}},this._updateCamera=t=>{const i=new e.Q(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy,n=this._map.getBearing(),s=e.e({bearing:n},this.options.fitBoundsOptions),o=G.fromLngLat(i,r);this._map.fitBounds(o,s,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const i=new e.Q(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)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;const 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&&Us)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new e.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=a.create("button","maplibregl-ctrl-geolocate",this._container),a.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){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const 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","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=a.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Vs({element:this._dotElement}),this._circleElement=a.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Vs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new e.l("trackuserlocationend")),this.fire(new e.l("userlocationlostfocus")))}))}},this.options=e.e({},Ns,t)}onAdd(t){return this._map=t,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return e._(this,arguments,void 0,(function*(t=!1){if(void 0!==Fs&&!t)return Fs;if(void 0===window.navigator.permissions)return Fs=!!window.navigator.geolocation,Fs;try{const t=yield window.navigator.permissions.query({name:"geolocation"});Fs="denied"!==t.state}catch(t){Fs=!!window.navigator.geolocation}return Fs}))}().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(),a.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Zs=0,Us=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
2RROR",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":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const t=this._map.getBounds(),e=t.getSouthEast(),i=t.getNorthEast(),r=e.distanceTo(i),n=Math.ceil(this._accuracy/(r/this._map._container.clientHeight)*2);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}trigger(){if(!this._setup)return e.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 e.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Zs--,Us=!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 e.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 e.l("trackuserlocationstart")),this.fire(new e.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("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"),Zs++,Zs>1?(t={maximumAge:6e5,timeout:0},Us=!0):(t=this.options.positionOptions,Us=!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","false"),this.options.showUserLocation&&this._updateMarker(null)}},t.GlobeControl=class{constructor(){this._toggleProjection=()=>{var t;const e=null===(t=this._map.getProjection())||void 0===t?void 0:t.type;this._map.setProjection("mercator"!==e&&e?{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?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=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=a.create("button","maplibregl-ctrl-globe",this._container),a.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(){a.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},t.Hash=wn,t.ImageSource=K,t.KeyboardHandler=ss,t.LngLatBounds=G,t.LogoControl
2=Ts,t.Map=class extends vs{constructor(t){var i,r;e.cj.mark(e.ck.create);const n=Object.assign(Object.assign(Object.assign({},Ds),t),{canvasContextAttributes:Object.assign(Object.assign({},Ds.canvasContextAttributes),t.canvasContextAttributes)});if(null!=n.minZoom&&null!=n.maxZoom&&n.minZoom>n.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=n.minPitch&&null!=n.maxPitch&&n.minPitch>n.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=n.minPitch&&n.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=n.maxPitch&&n.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const s=new ze,o=new Le;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),super(s,o,{bearingSnap:n.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Ps,this._controls=[],this._mapId=e.a4(),this._contextLost=t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new e.l("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new e.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.maxTileCacheSize,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({},zs),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this.transformCameraUpdate=n.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=!0===n.cancelPendingTileRequestsWhileZooming,this._imageQueueHandle=f.addThrottleControl((()=>this.isMoving())),this._requestManager=new m(n.transformRequest),"string"==typeof n.container){if(this._container=document.getElementById(n.container),!this._container)throw new Error(`Container '${n.container}' not found.`)}else{if(!(n.container instanceof HTMLElement))throw new 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})),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let t=!1;const e=bn((t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())}),50);this._resizeObserver=new ResizeObserver((i=>{t?e(i):t=!0})),this._resizeObserver.observe(this._container)}this.handlers=new xs(this,n),this._hash=n.hash&&new wn("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,e.e({},n.fitBoundsOptions,{duration:0}))));const a="string"==typeof n.style||!("globe"===(null===(r=null===(i=n.style)||void 0===i?void 0:i.projection)||void 0===r?void 0:r.type));this.resize(null,a),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new ws("boolean"==typeof n.attributionControl?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new Ts,n.logoPosition),this.on("style.load",(()=>{if(a||this._resizeTransform(),this.transform.unmodified){const t=e.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t)}}
vendor: 1,042 bytes, line 2
2)),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new e.l(`${t.dataType}data`,t))})),this.on("dataloading",(t=>{this.fire(new e.l(`${t.dataType}dataloading`,t))})),this.on("dataabort",(t=>{this.fire(new e.l("sourcedataabort",t))}))}_getMapId(){return this._mapId}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=t.onAdd(this);this._controls.push(t);const n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,
2i,r){return null==r&&this.terrain&&(r=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,e,i,r)}resize(t,i=!0){const[r,n]=this._containerDimensions(),s=this._getClampedPixelRatio(r,n);if(this._resizeCanvas(r,n,s),this.painter.resize(r,n,s),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const e=this._getClampedPixelRatio(r,n);this._resizeCanvas(r,n,e),this.painter.resize(r,n,e)}this._resizeTransform(i);const o=!this._moving;return o&&(this.stop(),this.fire(new e.l("movestart",t)).fire(new e.l("move",t))),this.fire(new e.l("resize",t)),o&&this.fire(new e.l("moveend",t)),this}_resizeTransform(t=!0){var e;const[i,r]=this._containerDimensions();this.transform.resize(i,r,t),null===(e=this._requestedCameraState)||void 0===e||e.resize(i,r,t)}_getClampedPixelRatio(t,e){const{0:i,1:r}=this._maxCanvasSize,n=this.getPixelRatio(),s=t*n,o=e*n;return Math.min(s>i?i/s:1,o>r?r/o:1)*n}getPixelRatio(){var t;return null!==(t=this._overridePixelRatio)&&void 0!==t?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(G.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.setMinZoom(t),this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new 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)return this.transform.setMaxZoom(t),this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new 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 new 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 new 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 new 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()}project(t){return this.transform.locationToScreenPoint(e.Q.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.screenPointToLocation(e.P.convert(t),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let r=!1;const n=n=>{const s=e.filter((t=>this.getLayer(t))),o=0!==s.length?this.queryRenderedFeatures(n.point,{layers:s}):[];o.length?r||(r=!0,i.call(this,new kn(t,this,n.originalEvent,{features:o}))):r=!1};return{layers:e,listener:i,delegates:{mousemove:n,mouseout:()=>{r=!1}}}}if("mouseleave"===t||"mouseout"===t){let r=!1;const n=n=>{const s=e.filter((t=>this.getLayer(t)));(0!==s.length?this.queryRenderedFeatures(n.point,{layers:s}):[]).length?r=!0:r&&(r=!1,i.call(this,new kn(t,this,n.originalEvent)))},s=e=>{r&&(r=!1,i.call(this,new kn(t,this,e.originalEvent)))};return{layers:e,listener:i,delegates:{mousemove:n,mouseout:s}}}{const r=t=>{const r=e.filter((t=>this.getLayer(t))),n=0!==r.length?this.queryRenderedFeatures(t.point,{layers:r}):[];n.length&&(t.features=n,i.call(this,t),delete t.features)};return{layers:e,listener:i,delegates:{[t]:r}}}}_saveDelegatedListener(t,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(e)}_removeDelegatedListener(t,e,i){if(!this._delegatedListeners||!this._delegatedListeners[t])return;const r=this._delegatedListeners[t];for(let n=0;n<r.length;n++){const t=r[n];if(t.listener===i&&t.layers.length===e.length&&t.layers.every((t=>e.includes(t)))){for(const e in t.delegates)this.off(e,t.delegates[e]);return void r.splice(n,1)}}}
2on(t,e,i){if(void 0===i)return super.on(t,e);const r="string"==typeof e?[e]:e,n=this._createDelegatedListener(t,r,i);this._saveDelegatedListener(t,n);for(const s in n.delegates)this.on(s,n.delegates[s]);return{unsubscribe:()=>{this._removeDelegatedListener(t,r,i)}}}once(t,e,i){if(void 0===i)return super.once(t,e);const r="string"==typeof e?[e]:e,n=this._createDelegatedListener(t,r,i);for(const s in n.delegates){const e=n.delegates[s];n.delegates[s]=(...n)=>{this._removeDelegatedListener(t,r,i),e(...n)}}this._saveDelegatedListener(t,n);for(const s in n.delegates)this.once(s,n.delegates[s]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._removeDelegatedListener(t,"string"==typeof e?[e]:e,i),this)}queryRenderedFeatures(t,i){if(!this.style)return[];let r;const n=t instanceof e.P||Array.isArray(t),s=n?t:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(n?{}:t)||{},s instanceof e.P||"number"==typeof s[0])r=[e.P.convert(s)];else{const t=e.P.convert(s[0]),i=e.P.convert(s[1]);r=[t,new e.P(i.x,t.y),i,new e.P(t.x,i.y),t]}return this.style.queryRenderedFeatures(r,i,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(t,i){return!1!==(i=e.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
2idateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(t,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){var i,r;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(t,e)));const n=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new gi(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,n):this.style.loadJSON(t,e,n),this):(null===(r=null===(i=this.style)||void 0===i?void 0:i.projection)||void 0===r||r.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new gi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,i){if("string"==typeof t){const r=this._requestManager.transformRequest(t,"Style");e.j(r,new AbortController).then((t=>{this._updateDiff(t.data,i)})).catch((t=>{t&&this.fire(new e.k(t))}))}else"object"==typeof t&&this._updateDiff(t,i)}_updateDiff(t,i){try{this.style.setState(t,i)&&this._update(!0)}catch(r){e.w(`Unable to perform style diff: ${r.message||r.error||r}. Rebuilding the style from scratch.`),this._updateStyle(t,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():e.w("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(t){const i=this.style&&this.style.sourceCaches[t];if(void 0!==i)return i.loaded();this.fire(new e.k(new Error(`There is no source with ID '${t}'`)))}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){const i=this.style.sourceCaches[t.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);null===this.terrain&&i.reload();for(const r in this.style._layers){const i=this.style._layers[r];"hillshade"===i.type&&i.source===t.source&&e.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.")}this.terrain=new Is(this.painter,i,t),this.painter.renderToTexture=new Es(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=e=>{var i;"style"===e.dataType?this.terrain.sourceCache.freeRtt():"source"===e.dataType&&e.tile&&(e.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===(i=e.source)||void 0===i?void 0:i.type)?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(e.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.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 e.l("terrain",{terrain:t})),this}getTerrain(){var t,e;return null!==(e=null===(t=this.terrain)||void 0===t?void 0:t.options)&&void 0!==e?e:null}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(t,i,r={}){const{pixelRatio:n=1,sdf:s=!1,stretchX:a,stretchY:l,content:c,textFitWidth:h,textFitHeight:u}=r;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||e.b(i))){if(void 0===i.width||void 0===i.height)return this.fire(new e.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:r,height:o,data:d}=i,p=i;return this.style.addImage(t,{data:new e.R({width:r,height:o},new Uint8Array(d)),pixelRatio:n,stretchX:a,stretchY:l,content:c,textFitWidth:h,textFitHeight:u,sdf:s,version:0,userImage:p}),p.onAdd&&p.onAdd(this,t),this}}{const{width:r,height:d,data:p}=o.getImageData(i);this.style.addImage(t,{data:new e.R({width:r,height:d},p),pixelRatio:n,stretchX:a,stretchY:l,content:c,textFitWidth:h,textFitHeight:u,sdf:s,version:0})}}updateImage(t,i){const r=this.style.getImage(t);if(!r)return this.fire(new e.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=i instanceof HTMLImageElement||e.b(i)?o.getImageData(i):i,{width:s,height:a,data:l}=n;if(void 0===s||void 0===a)return this.fire(new e.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(s!==r.data.width||a!==r.data.height)return this.fire(new e.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const c=!(i instanceof HTMLImageElement||e.b(i));return r.data.replace(l,c),this.style.updateImage(t,r),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.k(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return f.getImage(this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),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,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,r={}){return this.style.setPaintProperty(t,e,i,r),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,r={}){return this.style.setLayoutProperty(t,e,i,r),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,(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,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0)})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),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,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=a.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=a.create("canvas","maplibregl-canvas",e),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
2on");const i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);const n=this._controlContainer=a.create("div","maplibregl-control-container",t),s=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{s[t]=a.create("div",`maplibregl-ctrl-${t} `,n)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,e,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const t=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",(i=>{e={requestedAttributes:t},i&&(e.statusMessage=i.statusMessage,e.type=i.type)}),{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,t):this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t),!i){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new vn(i,this.transform),l.testSupport(i)}migrateProjection(t,i){super.migrateProjection(t,i),this.painter.transform=t,this.fire(new e.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):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){var i,r,n,s,a;const l=this._idleTriggered?this._fadeDuration:0,c=(null===(i=this.style.projection)||void 0===i?void 0:i.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,i=o.now();this.style.zoomHistory.update(t,i);const r=new e.C(t,{now:i,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=r.crossFadingFactor();1===n&&n===this._crossFadingFactor||(h=!0,this._crossFadingFactor=n),this.style.update(r)}const u=(null===(r=this.style.projection)||void 0===r?void 0:r.transitionState)>0!==c;null===(n=this.style.projection)||void 0===n||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(s=this.style.projection)||void 0===s?void 0:s.transitionState,null===(a=this.style.projection)||void 0===a?void 0:a.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||u)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.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,u),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 e.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,e.cj.mark(e.ck.load),this.fire(new e.l("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new e.l("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,e.cj.mark(e.ck.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t;this._hash&&this._hash.remove();for(const e of this._controls)e.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),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),f.removeThrottleControl(this._imageQueueHandle),null===(t=this._resizeObserver)||void 0===t||t.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==i?void 0:i.loseContext)&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),a.remove(this._canvasContainer),a.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),e.cj.clearMetrics(),this._removed=!0,this.fire(new e.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,o.frame(this._frameRequest,(t=>{e.cj.frame(t),this._frameRequest=null;try{this._render(t)}catch(t){if(!e.cl(t)&&!function(t){return t.message===jr}(t))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 ks}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}},t.MapMouseEvent=kn,t.MapTouchEvent=Dn,t.MapWheelEvent=Rn,t.Marker=Vs,t.NavigationControl
2=class{constructor(t){this._updateZoomButtons=()=>{const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.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,e)=>{const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute("aria-label",i)},this.options=e.e({},Rs,t),this._container=a.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}))),a.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}))),a.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=a.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 Ls(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){a.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,e){const i=a.create("button",t,this._container);return i.type="button",i.addEventListener("click",e),i}},t.Popup=class extends e.E{constructor(t){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&a.remove(this._content),this._container&&(a.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 e.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=>{var e;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=a.create("div","maplibregl-popup",this._map.getContainer()),this._tip=a.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const 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=this._map.transform.renderWorldCopies&&!this._trackPointer?Bs(this._lngLat,this._flatPos,this._map.transform):null===(e=this._lngLat)||void 0===e?void 0:e.wrap(),this._trackPointer&&!t)return;const i=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));let r=this.options.anchor;const n=Xs(this.options.offset);if(!r){const t=this._container.offsetWidth,e=this._container.offsetHeight;let s;s=i.y+n.bottom.y<e?["top"]:i.y>this._map.transform.height-e?["bottom"]:[],i.x<t/2?s.push("left"):i.x>this._map.transform.width-t/2&&s.push("right"),r=0===s.length?"bottom":s.join("-")}let s=i.add(n[r]);this.options.subpixelPositioning||(s=s.round()),a.setTransform(this._container,`${Os[r]} translate(${s.x}px,${s.y}px)`),js(this._container,r,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=e.e(Object.create(Ws),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 e.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.Q.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){const e=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=t;r=i.firstChild,r;)e.appendChild(r);return this.setDOMContent(e)}getMaxWidth(){var t;return null===(t=this._container)||void 0===t?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=a.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}_createCloseButton(){this.options.closeButton&&(this._closeButton=a.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(Hs);t&&t.focus()}},t.RasterDEMTileSource=H,t.RasterTileSource=W,t.ScaleControl=class{constructor(t){this._onMove=()=>{$s(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,$s(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Gs),t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){a.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}}
2,t.ScrollZoomHandler=ls,t.Style=gi,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=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=a.create("button","maplibregl-ctrl-terrain",this._container),a.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(){a.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},t.TwoFingersTouchPitchHandler=rs,t.TwoFingersTouchRotateHandler=es,t.TwoFingersTouchZoomHandler=Qn,t.TwoFingersTouchZoomRotateHandler=fs,t.VectorTileSource=q,t.VideoSource=Y,t.addSourceType=(t,i)=>e._(void 0,void 0,void 0,(function*(){if(tt(t))throw new Error(`A source type called "${t}" already exists.`);((t,e)=>{Q[t]=e})(t,i)})),t.clearPrewarmedResources=function(){const t=R;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(z),R=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=qe,t.getMaxParallelImageRequests=function(){return e.a.MAX_PARALLEL_IMAGE_REQUESTS},t.getRTLTextPluginStatus=function(){return nt().getRTLTextPluginStatus()},t.getVersion=function(){return Ks},t.getWorkerCount=function(){return k.workerCount},t.getWorkerUrl=function(){return e.a.WORKER_URL},t.importScriptInWorkers=function(t){return O().broadcast("IS",t)},t.prewarm=function(){F().acquire(z)},t.setMaxParallelImageRequests=function(t){e.a.MAX_PARALLEL_IMAGE_REQUESTS=t},t.setRTLTextPlugin=function(t,e){return nt().setRTLTextPlugin(t,e)},t.setWorkerCount=function(t){k.workerCount=t},t.setWorkerUrl=function(t){e.a.WORKER_URL=t}})),t}()}}]); 3//# sourceMappingURL=d94c0b71-3af770b0661d1a1702b6.js.map
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.