/*! mantle-gl v1.9.5 (2026-09-21 17:59:59) / Copyright(c) 2026, NAVER Corp. */ (function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=((n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)))(o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.mapboxgl=r())})(e,(function(){"use strict";var e,t,n;function r(r,i){if(!e)e=i;else if(!t)t=i;else{var a=`var sharedChunk = {}; (`+e+`)(sharedChunk); (`+t+`)(sharedChunk);`,o={};e(o),n=i(o),typeof window<`u`&&(n.workerUrl=window.URL.createObjectURL(new Blob([a],{type:`text/javascript`})))}}return r([`exports`],function(e){function t(e,t,n,r){let i=3*e,a=3*(n-e)-i,o=1-i-a,s=3*t,c=3*(r-t)-s,l=1-s-c;return function(e,t=1e-6){if(e<=0)return 0;if(e>=1)return 1;let n=e;for(let r=0;r<8;r++){let r=((o*n+a)*n+i)*n-e;if(Math.abs(r)s?r=n:u=n,n=.5*(r+u)}return((l*n+c)*n+s)*n}}function n(e,n,r,i){return t(e,n,r,i)}let r=n(.25,.1,.25,1);function i(e,t,n){return Math.min(n,Math.max(t,e))}function a(e,t,n){let r=n-t,i=((e-t)%r+r)%r+t;return i===t?n:i}function o(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}let s=1;function c(e,t){e.forEach(e=>{t[e]&&(t[e]=t[e].bind(t))})}function l(e,t,n){let r={};for(let n in e)r[n]=t.call(this,e[n],n,e);return r}function u(e,t,n){let r={};for(let n in e)t.call(this,e[n],n,e)&&(r[n]=e[n]);return r}function d(e){return Array.isArray(e)?e.map(d):typeof e==`object`&&e?l(e,d):e}let f={};function p(e){f[e]||(f[e]=!0)}function m(e){return e instanceof Error?e:Error(typeof e==`string`?e:String(e))}function h(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}function g(e){let t=0;for(let n,r,i=0,a=e.length,o=a-1;inew Promise((t,n)=>{let r=requestAnimationFrame(t);e.signal.addEventListener(`abort`,()=>{cancelAnimationFrame(r),n(Error(T))})}),frame(e){let t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){b||(b=document.createElement(`canvas`));let n=b.getContext(`2d`,{willReadFrequently:!0});if(!n)throw Error(`failed to create canvas 2d context`);let{width:r,height:i}=e,a=-t,o=-t,s=r+2*t,c=i+2*t;return(r>b.width||i>b.height)&&(b.width=r,b.height=i),n.clearRect(a,o,s,c),n.drawImage(e,0,0,r,i),n.getImageData(a,o,s,c)},resolveURL:e=>(v||(v=document.createElement(`a`)),v.href=e,v.href),hardwareConcurrency:typeof navigator<`u`&&navigator.hardwareConcurrency||4,get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(y==null&&(y=window.matchMedia(`(prefers-reduced-motion: reduce)`)),y.matches)}},T=`AbortError`;function E(e,t){this.x=e,this.y=t}E.prototype={clone(){return new E(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),n=Math.sin(e),r=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=r,this},_rotateAround(e,t){let n=Math.cos(e),r=Math.sin(e),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-r*(this.y-t.y),this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:E},E.convert=function(e){if(e instanceof E)return e;if(Array.isArray(e))return new E(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new E(+e.x,+e.y);throw Error(`Expected [x, y] or {x, y} point format`)};let D=`mapbox-tiles`,O,k=500,A=50,j=1/0,ee={Unknown:`Unknown`,Style:`Style`,Source:`Source`,Tile:`Tile`,Glyphs:`Glyphs`,SpriteImage:`SpriteImage`,SpriteJSON:`SpriteJSON`,Image:`Image`,Model:`Model`};typeof Object.freeze==`function`&&Object.freeze(ee);class te extends Error{constructor(e,t,n){super(e),this.status=t,this.url=n,this.name=this.constructor.name,this.message=e}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}let ne=_()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol===`blob:`?window.parent:window).location.href;function re(e,t){let n=new AbortController,r=new Request(e.url,{method:e.method||`GET`,body:e.body,credentials:e.credentials,headers:e.headers,referrer:ne(),signal:n.signal}),i=!1,a=!1;return e.type===`json`&&r.headers.set(`Accept`,`application/json`),a||fetch(r).then(n=>n.ok?(n=>{(e.type===`arrayBuffer`?n.arrayBuffer():e.type===`json`?n.json():n.text()).then(e=>{a||(i=!0,t(null,e,n.headers.get(`Cache-Control`),n.headers.get(`Expires`)))}).catch(e=>{a||t(Error(e.message))})})(n):t(new te(n.statusText,n.status,e.url))).catch(e=>{e.code!==20&&t(Error(e.message))}),{cancel:()=>{a=!0,i||n.abort()}}}let ie=function(e,t){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){if(_()&&self.worker&&self.worker.actor)return self.worker.actor.send(`getResource`,e,t);if(!_())return re(e,t)}if(!(/^file:/.test(n=e.url)||/^file:/.test(ne())&&!/^\w+:/.test(n))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,`signal`))return re(e,t);if(_()&&self.worker&&self.worker.actor)return self.worker.actor.send(`getResource`,e,t,void 0,!0)}var n;return function(e,t){let n=new XMLHttpRequest;n.open(e.method||`GET`,e.url,!0),e.type===`arrayBuffer`&&(n.responseType=`arraybuffer`);for(let t in e.headers)n.setRequestHeader(t,String(e.headers[t]));return e.type===`json`&&(n.responseType=`text`,n.setRequestHeader(`Accept`,`application/json`)),n.withCredentials=e.credentials===`include`,n.onerror=()=>{t(Error(n.statusText))},n.onload=()=>{if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let r=n.response;if(e.type===`json`)try{r=JSON.parse(n.response)}catch(e){return t(e)}t(null,r,n.getResponseHeader(`Cache-Control`),n.getResponseHeader(`Expires`))}else t(new te(n.statusText,n.status,e.url))},n.send(e.body),{cancel:()=>n.abort()}}(e,t)},ae=function(e,t){return ie(o(e,{type:`arrayBuffer`}),t)};function oe(e){let t=document.createElement(`a`);return t.href=e,t.protocol===window.document.location.protocol&&t.host===window.document.location.host}let se=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=`;function ce(e,t,n){n[e]&&n[e].indexOf(t)!==-1||(n[e]=n[e]||[],n[e].push(t))}function le(e,t,n){if(n&&n[e]){let r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}class ue{constructor(e,t={}){o(this,t),this.type=e}}class de extends ue{constructor(e,t={}){super(`error`,o({error:e},t))}}class fe{on(e,t){return this._listeners=this._listeners||{},ce(e,t,this._listeners),this}off(e,t){return le(e,t,this._listeners),le(e,t,this._oneTimeListeners),this}once(e,t){return this._oneTimeListeners=this._oneTimeListeners||{},ce(e,t,this._oneTimeListeners),this}fire(e,t){typeof e==`string`&&(e=new ue(e,t||{}));let n=e.type;if(this.listens(n)){e.target=this;let t=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let n of t)n.call(this,e);let r=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let t of r)le(n,t,this._oneTimeListeners),t.call(this,e);let i=this._eventedParent;i&&(o(e,typeof this._eventedParentData==`function`?this._eventedParentData():this._eventedParentData),i.fire(e))}else e instanceof de;return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var M={$version:8,$root:{version:{required:!0,type:`enum`,values:[8]},name:{type:`string`},metadata:{type:`*`},center:{type:`array`,value:`number`},zoom:{type:`number`},bearing:{type:`number`,default:0,period:360,units:`degrees`},pitch:{type:`number`,default:0,units:`degrees`},light:{type:`light`},terrain:{type:`terrain`},sources:{required:!0,type:`sources`},sprite:{type:`string`},"sprite-compact":{type:`string`},glyphs:{type:`string`},models:{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_mesh_batch`],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:{}},default:`mapbox`},volatile:{type:`boolean`,default:!1},"*":{type:`*`}},source_geojson:{type:{required:!0,type:`enum`,values:{geojson:{}}},data:{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},clusterType:{type:`*`},clusterDistance:{type:`number`,default:10,minimum:0},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`}}},source_mesh_batch:{type:{required:!0,type:`enum`,values:{"mesh-batch":{}}},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},attribution:{type:`string`},scheme:{type:`enum`,values:{xyz:{},tms:{}},default:`xyz`},format:{type:`enum`,values:{glb:{},gltf:{}},default:`glb`},"*":{type:`*`}},layer:{id:{type:`string`,required:!0},type:{type:`enum`,values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},"line-extrusion":{},raster:{},hillshade:{},"mesh-object":{},"mesh-batch":{},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_line-extrusion`,`layout_symbol`,`layout_raster`,`layout_hillshade`,`layout_background`,`layout_mesh-object`,`layout_mesh-batch`],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-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:{},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`},"symbol-placement-priority":{type:`number`,default:0,expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"icon-always-allow-overlap":{type:`boolean`,default:!1,requires:[`icon-image`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"icon-image-url":{type:`string`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"subtext-field":{type:`formatted`,default:``,tokens:!0,requires:[`text-field`,`subtext-field`],expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"subtext-font":{type:`array`,value:`string`,default:[`Open Sans Regular`,`Arial Unicode MS Regular`],requires:[`text-field`,`subtext-field`],"property-type":`data-driven`},"subtext-size":{type:`number`,default:13,minimum:0,units:`pixels`,requires:[`text-field`,`subtext-field`],"property-type":`data-driven`},"subtext-max-width":{type:`number`,default:10,minimum:0,units:`ems`,requires:[`text-field`,`subtext-field`],"property-type":`data-driven`},"icon-allow-overlap":{type:`boolean`,default:!1,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:`number`,default:2,minimum:0,units:`pixels`,requires:[`icon-image`],expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"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:{},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-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`],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`}},"layout_mesh-object":{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,"property-type":`constant`},"mesh-object-type":{type:`string`,tokens:!0,expression:{interpolated:!1,parameters:[`feature`]},"property-type":`data-driven`},"mesh-object-name":{type:`string`,tokens:!0,expression:{interpolated:!1,parameters:[`feature`]},"property-type":`data-driven`},"mesh-object-rotate":{type:`number`,default:0,period:360,units:`degrees`,expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"mesh-object-scale":{type:`number`,default:1,minimum:0,transition:!1,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"mesh-object-center-lat":{type:`number`,default:0,period:360,units:`degrees`,expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"mesh-object-center-lng":{type:`number`,default:0,period:360,units:`degrees`,expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"mesh-object-half-width":{type:`number`,default:1,minimum:0,transition:!1,units:`meters`,expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"mesh-object-half-height":{type:`number`,default:1,minimum:0,transition:!1,units:`meters`,expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`}},"layout_mesh-batch":{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":{},within:{}}},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}},terrain:{source:{type:`string`,required:!0},exaggeration:{type:`number`,default:1,minimum:0,maximum:1e3}},paint:[`paint_fill`,`paint_line`,`paint_circle`,`paint_heatmap`,`paint_fill-extrusion`,`paint_line-extrusion`,`paint_symbol`,`paint_raster`,`paint_hillshade`,`paint_background`,`paint_mesh-object`,`paint_mesh-batch`],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-gradation-top-color":{type:`color`,default:`#000000`,transition:!0,requires:[`fill-extrusion-gradation-bottom-color`],"property-type":`data-driven`},"fill-extrusion-gradation-bottom-color":{type:`color`,default:`#000000`,transition:!0,requires:[`fill-extrusion-gradation-top-color`],"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-extrusion":{"line-extrusion-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"line-extrusion-color":{type:`color`,default:`#000000`,transition:!0,requires:[{"!":`line-extrusion-pattern`}],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-extrusion-width":{type:`number`,default:1,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-extrusion-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"line-extrusion-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`line-extrusion-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"line-extrusion-pattern":{type:`resolvedImage`,transition:!0,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`cross-faded-data-driven`},"line-extrusion-height":{type:`number`,default:0,minimum:0,units:`meters`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-extrusion-base":{type:`number`,default:0,minimum:0,units:`meters`,transition:!0,requires:[`line-extrusion-height`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`}},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,overridable:!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,overridable:!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`},"subtext-color":{type:`color`,default:`#000000`,transition:!0,requires:[`text-field`,`subtext-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"subtext-halo-color":{type:`color`,default:`rgba(0, 0, 0, 0)`,transition:!0,requires:[`text-field`,`subtext-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"subtext-halo-width":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,requires:[`text-field`,`subtext-field`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`}},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`}},"paint_mesh-object":{"mesh-object-color":{type:`color`,default:`#ffffff`,"zoom-function":!0,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"mesh-object-translate":{type:`array`,value:`number`,length:2,default:[0,0],"zoom-function":!0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"mesh-object-translate-anchor":{type:`enum`,"zoom-function":!0,values:{map:{},viewport:{}},default:`map`,requires:[`mesh-object-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"mesh-object-opacity":{type:`number`,default:1,minimum:0,maximum:1,"zoom-function":!0,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"mesh-object-height-ratio":{type:`number`,default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"mesh-object-cast-shadows":{type:`boolean`,default:!1,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`}},"paint_mesh-batch":{"mesh-batch-color":{type:`color`,default:`#ffffff`,"zoom-function":!0,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"mesh-batch-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"mesh-batch-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`mesh-batch-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"mesh-batch-opacity":{type:`number`,default:1,minimum:0,maximum:1,"zoom-function":!0,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"mesh-batch-height-ratio":{type:`number`,default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"mesh-batch-cast-shadows":{type:`boolean`,default:!1,expression:{interpolated:!1,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`}}};class N{constructor(e,t,n,r){this.message=(e?`${e}: `:``)+n,r&&(this.identifier=r),t!=null&&t.__line__&&(this.line=t.__line__)}}function P(e){let t=e.value;return t?[new N(e.key,t,`constants have been deprecated as of v8`)]:[]}function F(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}function I(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function pe(e){if(Array.isArray(e))return e.map(pe);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let n in e)t[n]=pe(e[n]);return t}return I(e)}class L extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class me{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[e,n]of t)this.bindings[e]=n}concat(e){return new me(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}let he={kind:`null`},R={kind:`number`},z={kind:`string`},B={kind:`boolean`},ge={kind:`color`},_e={kind:`object`},V={kind:`value`},ve={kind:`collator`},H={kind:`formatted`},ye={kind:`resolvedImage`};function be(e,t){return{kind:`array`,itemType:e,N:t}}function xe(e){if(e.kind===`array`){let t=xe(e.itemType);return typeof e.N==`number`?`array<${t}, ${e.N}>`:e.itemType.kind===`value`?`array`:`array<${t}>`}return e.kind}let Se=[he,R,z,B,ge,H,_e,be(V),ye];function Ce(e,t){if(t.kind===`error`)return null;if(e.kind===`array`){if(t.kind===`array`&&(t.N===0&&t.itemType.kind===`value`||!Ce(e.itemType,t.itemType))&&(typeof e.N!=`number`||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind===`value`){for(let e of Se)if(!Ce(e,t))return null}}return`Expected ${xe(e)} but found ${xe(t)} instead.`}function U(e,t){return t.some(t=>t.kind===e.kind)}function we(e,t){return t.some(t=>t===`null`?e===null:t===`array`?Array.isArray(e):t===`object`?e&&!Array.isArray(e)&&typeof e==`object`:t===typeof e)}function Te(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var Ee,De={},Oe=function(){if(Ee)return De;Ee=1;var e={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function t(e){return(e=Math.round(e))<0?0:e>255?255:e}function n(e){return t(e[e.length-1]===`%`?parseFloat(e)/100*255:parseInt(e))}function r(e){return(t=e[e.length-1]===`%`?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function i(e,t,n){return n<0?n+=1:n>1&&--n,6*n<1?e+(t-e)*n*6:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}try{De.parseCSSColor=function(a){var o,s=a.replace(/ /g,``).toLowerCase();if(s in e)return e[s].slice();if(s[0]===`#`)return s.length===4?(o=parseInt(s.substr(1),16))>=0&&o<=4095?[(3840&o)>>4|(3840&o)>>8,240&o|(240&o)>>4,15&o|(15&o)<<4,1]:null:s.length===7&&(o=parseInt(s.substr(1),16))>=0&&o<=16777215?[(16711680&o)>>16,(65280&o)>>8,255&o,1]:null;var c=s.indexOf(`(`),l=s.indexOf(`)`);if(c!==-1&&l+1===s.length){var u=s.substr(0,c),d=s.substr(c+1,l-(c+1)).split(`,`),f=1;switch(u){case`rgba`:if(d.length!==4)return null;f=r(d.pop());case`rgb`:return d.length===3?[n(d[0]),n(d[1]),n(d[2]),f]:null;case`hsla`:if(d.length!==4)return null;f=r(d.pop());case`hsl`:if(d.length!==3)return null;var p=(parseFloat(d[0])%360+360)%360/360,m=r(d[1]),h=r(d[2]),g=h<=.5?h*(m+1):h+m-h*m,_=2*h-g;return[t(255*i(_,g,p+1/3)),t(255*i(_,g,p)),t(255*i(_,g,p-1/3)),f];default:return null}}return null}}catch(e){}return De}();class ke{constructor(e,t,n,r=1){this.r=e,this.g=t,this.b=n,this.a=r}static parse(e){if(!e)return;if(e instanceof ke)return e;if(typeof e!=`string`)return;let t=Oe.parseCSSColor(e);return t?new ke(t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3]):void 0}toString(){let[e,t,n,r]=this.toArray();return`rgba(${Math.round(e)},${Math.round(t)},${Math.round(n)},${r})`}toArray(){let{r:e,g:t,b:n,a:r}=this;return r===0?[0,0,0,0]:[255*e/r,255*t/r,255*n/r,r]}}ke.black=new ke(0,0,0,1),ke.white=new ke(1,1,1,1),ke.transparent=new ke(0,0,0,0),ke.red=new ke(1,0,0,1);class Ae{constructor(e,t,n){this.sensitivity=e?t?`variant`:`case`:t?`accent`:`base`,this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:`search`})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class je{constructor(e,t,n,r,i,a=!1){this.text=e,this.image=t,this.scale=n,this.fontStack=r,this.textColor=i,this.isSubText=a}}class Me{constructor(e){this.sections=e}static fromString(e){return new Me([new je(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Me?e:Me.fromString(e)}toString(){return this.sections.length===0?``:this.sections.map(e=>e.text).join(``)}serialize(){let e=[`format`];for(let t of this.sections){if(t.image){e.push([`image`,t.image.name]);continue}e.push(t.text);let n={};t.fontStack&&(n[`text-font`]=[`literal`,t.fontStack.split(`,`)]),t.scale&&(n[`font-scale`]=t.scale),t.textColor&&(n[`text-color`]=[`rgba`].concat(t.textColor.toArray())),e.push(n)}return e}}class Ne{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Ne({name:e,available:!1}):null}serialize(){return[`image`,this.name]}}function Pe(e,t,n,r){return typeof e==`number`&&e>=0&&e<=255&&typeof t==`number`&&t>=0&&t<=255&&typeof n==`number`&&n>=0&&n<=255?r===void 0||typeof r==`number`&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,n,r].join(`, `)}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r==`number`?[e,t,n,r]:[e,t,n]).join(`, `)}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Fe(e){if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`||e instanceof ke||e instanceof Ae||e instanceof Me||e instanceof Ne)return!0;if(Array.isArray(e)){for(let t of e)if(!Fe(t))return!1;return!0}if(typeof e==`object`){for(let t in e)if(!Fe(e[t]))return!1;return!0}return!1}function Ie(e){if(e===null)return he;if(typeof e==`string`)return z;if(typeof e==`boolean`)return B;if(typeof e==`number`)return R;if(e instanceof ke)return ge;if(e instanceof Ae)return ve;if(e instanceof Me)return H;if(e instanceof Ne)return ye;if(Array.isArray(e)){let t=e.length,n;for(let t of e){let e=Ie(t);if(n){if(n===e)continue;n=V;break}n=e}return be(n||V,t)}return _e}function Le(e){let t=typeof e;return e===null?``:t===`string`||t===`number`||t===`boolean`?String(e):e instanceof ke||e instanceof Me||e instanceof Ne?e.toString():JSON.stringify(e)}class Re{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Fe(e[1]))return t.error(`invalid value`);let n=e[1],r=Ie(n),i=t.expectedType;return r.kind!==`array`||r.N!==0||!i||i.kind!==`array`||typeof i.N==`number`&&i.N!==0||(r=i),new Re(r,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind===`array`||this.type.kind===`object`?[`literal`,this.value]:this.value instanceof ke?[`rgba`].concat(this.value.toArray()):this.value instanceof Me?this.value.serialize():this.value}}class ze{constructor(e){this.name=`ExpressionEvaluationError`,this.message=e}toJSON(){return this.message}}let Be={string:z,number:R,boolean:B,object:_e};class Ve{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n,r=1,i=e[0];if(i===`array`){let i,a;if(e.length>2){let n=e[1];if(typeof n!=`string`||!(n in Be)||n===`object`)return t.error(`The item type argument of "array" must be one of string, number, boolean`,1);i=Be[n],r++}else i=V;if(e.length>3){if(e[2]!==null&&(typeof e[2]!=`number`||e[2]<0||e[2]!==Math.floor(e[2])))return t.error(`The length argument to "array" must be a positive integer literal`,2);a=e[2],r++}n=be(i,a)}else n=Be[i];let a=[];for(;re.outputDefined())}serialize(){let e=this.type,t=[e.kind];if(e.kind===`array`){let n=e.itemType;if(n.kind===`string`||n.kind===`number`||n.kind===`boolean`){t.push(n.kind);let r=e.N;(typeof r==`number`||this.args.length>1)&&t.push(r)}}return t.concat(this.args.map(e=>e.serialize()))}}class W{constructor(e){this.type=H,this.sections=e}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=e[1];if(!Array.isArray(n)&&typeof n==`object`)return t.error(`First argument must be an image or text section.`);let r=[],i=!1;for(let n=1;n<=e.length-1;++n){let a=e[n];if(i&&typeof a==`object`&&!Array.isArray(a)){i=!1;let e=null;if(a[`font-scale`]&&(e=t.parse(a[`font-scale`],1,R),!e))return null;let n=null;if(a[`text-font`]&&(n=t.parse(a[`text-font`],1,be(z)),!n))return null;let o=null;if(a[`text-color`]&&(o=t.parse(a[`text-color`],1,ge),!o))return null;let s=r[r.length-1];s.scale=e,s.font=n,s.textColor=o}else{let a=t.parse(e[n],1,V);if(!a)return null;let o=a.type.kind;if(o!==`string`&&o!==`value`&&o!==`null`&&o!==`resolvedImage`)return t.error(`Formatted text type must be 'string', 'value', 'image' or 'null'.`);i=!0,r.push({content:a,scale:null,font:null,textColor:null})}}return new W(r)}evaluate(e){return new Me(this.sections.map(t=>{let n=t.content.evaluate(e);return Ie(n)===ye?new je(``,n,null,null,null):new je(Le(n),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(`,`):null,t.textColor?t.textColor.evaluate(e):null)}))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){let e=[`format`];for(let t of this.sections){e.push(t.content.serialize());let n={};t.scale&&(n[`font-scale`]=t.scale.serialize()),t.font&&(n[`text-font`]=t.font.serialize()),t.textColor&&(n[`text-color`]=t.textColor.serialize()),e.push(n)}return e}}class He{constructor(e){this.type=ye,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected two arguments.`);let n=t.parse(e[1],1,z);return n?new He(n):t.error(`No image name provided.`)}evaluate(e){let t=this.input.evaluate(e),n=Ne.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){return[`image`,this.input.serialize()]}}let Ue={"to-boolean":B,"to-color":ge,"to-number":R,"to-string":z};class We{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=e[0];if((n===`to-boolean`||n===`to-string`)&&e.length!==2)return t.error(`Expected one argument.`);let r=Ue[n],i=[];for(let n=1;n4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Pe(t[0],t[1],t[2],t[3]),!n))return new ke(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new ze(n||`Could not parse color from value '${typeof t==`string`?t:String(JSON.stringify(t))}'`)}if(this.type.kind===`number`){let t=null;for(let n of this.args){if(t=n.evaluate(e),t===null)return 0;let r=Number(t);if(!isNaN(r))return r}throw new ze(`Could not convert ${JSON.stringify(t)} to number.`)}return this.type.kind===`formatted`?Me.fromString(Le(this.args[0].evaluate(e))):this.type.kind===`resolvedImage`?Ne.fromString(Le(this.args[0].evaluate(e))):Le(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind===`formatted`)return new W([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind===`resolvedImage`)return new He(this.args[0]).serialize();let e=[`to-${this.type.kind}`];return this.eachChild(t=>{e.push(t.serialize())}),e}}let Ge=[`Unknown`,`Point`,`LineString`,`Polygon`];class Ke{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?typeof this.feature.type==`number`?Ge[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&`geometry`in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=ke.parse(e)),t}}class qe{constructor(e,t,n=[],r,i=new me,a=[]){this.registry=e,this.path=n,this.key=n.map(e=>`[${e}]`).join(``),this.scope=i,this.errors=a,this.expectedType=r,this._isConstant=t}parse(e,t,n,r,i={}){return t?this.concat(t,n,r)._parse(e,i):this._parse(e,i)}_parse(e,t){function n(e,t,n){return n===`assert`?new Ve(t,[e]):n===`coerce`?new We(t,[e]):e}if(e!==null&&typeof e!=`string`&&typeof e!=`boolean`&&typeof e!=`number`||(e=[`literal`,e]),Array.isArray(e)){if(e.length===0)return this.error(`Expected an array with at least one element. If you wanted a literal array, use ["literal", []].`);let r=e[0];if(typeof r!=`string`)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let i=this.registry[r];if(i){let r=i.parse(e,this);if(!r)return null;if(this.expectedType){let e=this.expectedType,i=r.type;if(e.kind!==`string`&&e.kind!==`number`&&e.kind!==`boolean`&&e.kind!==`object`&&e.kind!==`array`||i.kind!==`value`){if(e.kind!==`color`&&e.kind!==`formatted`&&e.kind!==`resolvedImage`||i.kind!==`value`&&i.kind!==`string`){if(this.checkSubtype(e,i))return null}else r=n(r,e,t.typeAnnotation||`coerce`)}else r=n(r,e,t.typeAnnotation||`assert`)}if(!(r instanceof Re)&&r.type.kind!==`resolvedImage`&&this._isConstant(r)){let e=new Ke;try{r=new Re(r.type,r.evaluate(e))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?`'undefined' value invalid. Use null instead.`:typeof e==`object`?`Bare objects invalid. Use ["literal", {...}] instead.`:`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){let r=typeof e==`number`?this.path.concat(e):this.path,i=n?this.scope.concat(n):this.scope;return new qe(this.registry,this._isConstant,r,t||null,i,this.errors)}error(e,...t){let n=`${this.key}${t.map(e=>`[${e}]`).join(``)}`;this.errors.push(new L(n,e))}checkSubtype(e,t){let n=Ce(e,t);return n&&this.error(n),n}}class Je{constructor(e,t,n){this.type=ve,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error(`Expected one argument.`);let n=e[1];if(typeof n!=`object`||Array.isArray(n))return t.error(`Collator options argument must be an object.`);let r=t.parse(n[`case-sensitive`]!==void 0&&n[`case-sensitive`],1,B);if(!r)return null;let i=t.parse(n[`diacritic-sensitive`]!==void 0&&n[`diacritic-sensitive`],1,B);if(!i)return null;let a=null;return n.locale&&(a=t.parse(n.locale,1,z),!a)?null:new Je(r,i,a)}evaluate(e){return new Ae(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){let e={};return e[`case-sensitive`]=this.caseSensitive.serialize(),e[`diacritic-sensitive`]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),[`collator`,e]}}let Ye=8192;function Xe(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Ze(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Qe(e,t){let n=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,i=2**t.z;return[Math.round(n*i*Ye),Math.round(r*i*Ye)]}function $e(e,t,n){let r=e[0]-t[0],i=e[1]-t[1],a=e[0]-n[0],o=e[1]-n[1];return r*o-a*i===0&&r*a<=0&&i*o<=0}function et(e,t,n){return t[1]>e[1]!=n[1]>e[1]&&e[0]<(n[0]-t[0])*(e[1]-t[1])/(n[1]-t[1])+t[0]}function tt(e,t){let n=!1;for(let r=0,i=t.length;r0&&s<0||o<0&&s>0}function it(e,t,n,r){return(i=[r[0]-n[0],r[1]-n[1]])[0]*(a=[t[0]-e[0],t[1]-e[1]])[1]-i[1]*a[0]!==0&&!(!rt(e,t,n,r)||!rt(n,r,e,t));var i,a}function at(e,t,n){for(let r of n)for(let n=0;nn[2]){let t=.5*r,i=e[0]-n[0]>t?-r:n[0]-e[0]>t?r:0;i===0&&(i=e[0]-n[2]>t?-r:n[2]-e[0]>t?r:0),e[0]+=i}Xe(t,e)}function dt(e,t,n,r){let i=2**r.z*Ye,a=[r.x*Ye,r.y*Ye],o=[];for(let r of e)for(let e of r){let r=[e.x+a[0],e.y+a[1]];ut(r,t,n,i),o.push(r)}return o}function ft(e,t,n,r){let i=2**r.z*Ye,a=[r.x*Ye,r.y*Ye],o=[];for(let n of e){let e=[];for(let r of n){let n=[r.x+a[0],r.y+a[1]];Xe(t,n),e.push(n)}o.push(e)}if(t[2]-t[0]<=i/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(let e of o)for(let r of e)ut(r,t,n,i)}var s;return o}class pt{constructor(e,t){this.type=B,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Fe(e[1])){let t=e[1];if(t.type===`FeatureCollection`)for(let e=0;ee.serialize()))}static parse(e,t){let n=e[0],r=ht.definitions[n];if(!r)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let i=Array.isArray(r)?r[0]:r.type,a=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=a.filter(([t])=>!Array.isArray(t)||t.length===e.length-1),s=null;for(let[r,a]of o){s=new qe(t.registry,gt,t.path,null,t.scope);let o=[],c=!1;for(let t=1;t{return t=e,Array.isArray(t)?`(${t.map(xe).join(`, `)})`:`(${xe(t.type)}...)`;var t}).join(` | `),r=[];for(let n=1;n{n=t?n&>(e):n&&e instanceof Re}),!!n&&_t(e)&&vt(e,[`zoom`,`heatmap-density`,`line-progress`,`accumulated`,`is-supported-script`])}function _t(e){if(e instanceof ht&&(e.name===`get`&&e.args.length===1||e.name===`feature-state`||e.name===`has`&&e.args.length===1||e.name===`properties`||e.name===`geometry-type`||e.name===`id`||/^filter-/.test(e.name))||e instanceof pt)return!1;let t=!0;return e.eachChild(e=>{t&&!_t(e)&&(t=!1)}),t}function vt(e,t){if(e instanceof ht&&t.indexOf(e.name)>=0)return!1;let n=!0;return e.eachChild(e=>{n&&!vt(e,t)&&(n=!1)}),n}function yt(e,t){let n=e.length-1,r,i,a=0,o=n,s=0;for(;a<=o;)if(s=Math.floor((a+o)/2),r=e[s],i=e[s+1],r<=t){if(s===n||tt))throw new ze(`Input is not a number.`);o=s-1}return 0}class bt{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[e,t]of n)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error(`Expected an even number of arguments.`);let n=t.parse(e[1],1,R);if(!n)return null;let r=[],i=null;t.expectedType&&t.expectedType.kind!==`value`&&(i=t.expectedType);for(let n=1;n=a)return t.error(`Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.`,s);let l=t.parse(o,c,i);if(!l)return null;i=i||l.type,r.push([a,l])}return new bt(i,n,r)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);let i=t.length;return r>=t[i-1]?n[i-1].evaluate(e):n[yt(t,r)].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e=[`step`,this.input.serialize()];for(let t=0;t0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}function G(e,t,n){return e*(1-n)+t*n}var xt=Object.freeze({__proto__:null,array:function(e,t,n){return e.map((e,r)=>G(e,t[r],n))},color:function(e,t,n){return new ke(G(e.r,t.r,n),G(e.g,t.g,n),G(e.b,t.b,n),G(e.a,t.a,n))},number:G});let St=.95047,Ct=1.08883,wt=4/29,Tt=6/29,Et=3*Tt*Tt,Dt=Math.PI/180,Ot=180/Math.PI;function kt(e){return e>.008856451679035631?e**(1/3):e/Et+wt}function At(e){return e>Tt?e*e*e:Et*(e-wt)}function jt(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function Mt(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Nt(e){let t=Mt(e.r),n=Mt(e.g),r=Mt(e.b),i=kt((.4124564*t+.3575761*n+.1804375*r)/St),a=kt((.2126729*t+.7151522*n+.072175*r)/1);return{l:116*a-16,a:500*(i-a),b:200*(a-kt((.0193339*t+.119192*n+.9503041*r)/Ct)),alpha:e.a}}function Pt(e){let t=(e.l+16)/116,n=isNaN(e.a)?t:t+e.a/500,r=isNaN(e.b)?t:t-e.b/200;return t=1*At(t),n=St*At(n),r=Ct*At(r),new ke(jt(3.2404542*n-1.5371385*t-.4985314*r),jt(-.969266*n+1.8760108*t+.041556*r),jt(.0556434*n-.2040259*t+1.0572252*r),e.alpha)}function Ft(e,t,n){let r=t-e;return e+n*(r>180||r<-180?r-360*Math.round(r/360):r)}let It={forward:Nt,reverse:Pt,interpolate:function(e,t,n){return{l:G(e.l,t.l,n),a:G(e.a,t.a,n),b:G(e.b,t.b,n),alpha:G(e.alpha,t.alpha,n)}}},Lt={forward:function(e){let{l:t,a:n,b:r}=Nt(e),i=Math.atan2(r,n)*Ot;return{h:i<0?i+360:i,c:Math.sqrt(n*n+r*r),l:t,alpha:e.a}},reverse:function(e){let t=e.h*Dt,n=e.c;return Pt({l:e.l,a:Math.cos(t)*n,b:Math.sin(t)*n,alpha:e.alpha})},interpolate:function(e,t,n){return{h:Ft(e.h,t.h,n),c:G(e.c,t.c,n),l:G(e.l,t.l,n),alpha:G(e.alpha,t.alpha,n)}}};var Rt=Object.freeze({__proto__:null,hcl:Lt,lab:It});class zt{constructor(e,t,n,r,i){this.type=e,this.operator=t,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(let[e,t]of i)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,n,r,i){let a=0;if(e.name===`exponential`)a=Bt(n,e.base,r,i);else if(e.name===`linear`)a=Bt(n,1,r,i);else if(e.name===`cubic-bezier`){let o=e.controlPoints;a=t(o[0],o[1],o[2],o[3])(Bt(n,1,r,i))}return a}static parse(e,t){let[n,r,i,...a]=e;if(!Array.isArray(r)||r.length===0)return t.error(`Expected an interpolation type expression.`,1);if(r[0]===`linear`)r={name:`linear`};else if(r[0]===`exponential`){let e=r[1];if(typeof e!=`number`)return t.error(`Exponential interpolation requires a numeric base.`,1,1);r={name:`exponential`,base:e}}else{if(r[0]!==`cubic-bezier`)return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{let e=r.slice(1);if(e.length!==4||e.some(e=>typeof e!=`number`||e<0||e>1))return t.error(`Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.`,1);r={name:`cubic-bezier`,controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error(`Expected an even number of arguments.`);if(i=t.parse(i,2,R),!i)return null;let o=[],s=null;n===`interpolate-hcl`||n===`interpolate-lab`?s=ge:t.expectedType&&t.expectedType.kind!==`value`&&(s=t.expectedType);for(let e=0;e=n)return t.error(`Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.`,i);let l=t.parse(r,c,s);if(!l)return null;s=s||l.type,o.push([n,l])}return s.kind===`number`||s.kind===`color`||s.kind===`array`&&s.itemType.kind===`number`&&typeof s.N==`number`?new zt(s,n,r,i,o):t.error(`Type ${xe(s)} is not interpolatable.`)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);let i=t.length;if(r>=t[i-1])return n[i-1].evaluate(e);let a=yt(t,r),o=zt.interpolationFactor(this.interpolation,r,t[a],t[a+1]),s=n[a].evaluate(e),c=n[a+1].evaluate(e);return this.operator===`interpolate`?xt[this.type.kind.toLowerCase()](s,c,o):this.operator===`interpolate-hcl`?Lt.reverse(Lt.interpolate(Lt.forward(s),Lt.forward(c),o)):It.reverse(It.interpolate(It.forward(s),It.forward(c),o))}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name===`linear`?[`linear`]:this.interpolation.name===`exponential`?this.interpolation.base===1?[`linear`]:[`exponential`,this.interpolation.base]:[`cubic-bezier`].concat(this.interpolation.controlPoints);let t=[this.operator,e,this.input.serialize()];for(let e=0;eCe(r,e.type));return new Vt(a?V:n,i)}evaluate(e){let t,n=null,r=0;for(let i of this.args)if(r++,n=i.evaluate(e),n&&n instanceof Ne&&!n.available&&(t||(t=n.name),n=null,r===this.args.length&&(n=t)),n!==null)break;return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){let e=[`coalesce`];return this.eachChild(t=>{e.push(t.serialize())}),e}}class Ht{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let r=1;r=n.length)throw new ze(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new ze(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return[`at`,this.index.serialize(),this.input.serialize()]}}class Wt{constructor(e,t){this.type=B,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,V),r=t.parse(e[2],2,V);return n&&r?U(n.type,[B,z,R,he,V])?new Wt(n,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${xe(n.type)} instead`):null}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!we(t,[`boolean`,`string`,`number`,`null`]))throw new ze(`Expected first argument to be of type boolean, string, number or null, but found ${xe(Ie(t))} instead.`);if(!we(n,[`string`,`array`]))throw new ze(`Expected second argument to be of type array or string, but found ${xe(Ie(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return[`in`,this.needle.serialize(),this.haystack.serialize()]}}class Gt{constructor(e,t,n){this.type=R,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,V),r=t.parse(e[2],2,V);if(!n||!r)return null;if(!U(n.type,[B,z,R,he,V]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${xe(n.type)} instead`);if(e.length===4){let i=t.parse(e[3],3,R);return i?new Gt(n,r,i):null}return new Gt(n,r)}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!we(t,[`boolean`,`string`,`number`,`null`]))throw new ze(`Expected first argument to be of type boolean, string, number or null, but found ${xe(Ie(t))} instead.`);if(!we(n,[`string`,`array`]))throw new ze(`Expected second argument to be of type array or string, but found ${xe(Ie(n))} instead.`);if(this.fromIndex){let r=this.fromIndex.evaluate(e);return n.indexOf(t,r)}return n.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){let e=this.fromIndex.serialize();return[`index-of`,this.needle.serialize(),this.haystack.serialize(),e]}return[`index-of`,this.needle.serialize(),this.haystack.serialize()]}}class Kt{constructor(e,t,n,r,i,a){this.inputType=e,this.type=t,this.input=n,this.cases=r,this.outputs=i,this.otherwise=a}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error(`Expected an even number of arguments.`);let n,r;t.expectedType&&t.expectedType.kind!==`value`&&(r=t.expectedType);let i={},a=[];for(let o=2;o2**53-1)return l.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof e==`number`&&Math.floor(e)!==e)return l.error(`Numeric branch labels must be integer values.`);if(n){if(l.checkSubtype(n,Ie(e)))return null}else n=Ie(e);if(i[String(e)]!==void 0)return l.error(`Branch labels must be unique.`);i[String(e)]=a.length}let u=t.parse(c,o,r);if(!u)return null;r=r||u.type,a.push(u)}let o=t.parse(e[1],1,V);if(!o)return null;let s=t.parse(e[e.length-1],e.length-1,r);return s?o.type.kind!==`value`&&t.concat(1).checkSubtype(n,o.type)?null:new Kt(n,r,o,i,a,s):null}evaluate(e){let t=this.input.evaluate(e);return(Ie(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){let e=[`match`,this.input.serialize()],t=Object.keys(this.cases).sort(),n=[],r={};for(let e of t){let t=r[this.cases[e]];t===void 0?(r[this.cases[e]]=n.length,n.push([this.cases[e],[e]])):n[t][1].push(e)}let i=e=>this.inputType.kind===`number`?Number(e):e;for(let[t,r]of n)e.push(r.length===1?i(r[0]):r.map(i)),e.push(this.outputs[t].serialize());return e.push(this.otherwise.serialize()),e}}class qt{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error(`Expected an odd number of arguments.`);let n;t.expectedType&&t.expectedType.kind!==`value`&&(n=t.expectedType);let r=[];for(let i=1;it.outputDefined())&&this.otherwise.outputDefined()}serialize(){let e=[`case`];return this.eachChild(t=>{e.push(t.serialize())}),e}}class Jt{constructor(e,t,n,r){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,V),r=t.parse(e[2],2,R);if(!n||!r)return null;if(!U(n.type,[be(V),z,V]))return t.error(`Expected first argument to be of type array or string, but found ${xe(n.type)} instead`);if(e.length===4){let i=t.parse(e[3],3,R);return i?new Jt(n.type,n,r,i):null}return new Jt(n.type,n,r)}evaluate(e){let t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!we(t,[`string`,`array`]))throw new ze(`Expected first argument to be of type array or string, but found ${xe(Ie(t))} instead.`);if(this.endIndex){let r=this.endIndex.evaluate(e);return t.slice(n,r)}return t.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){let e=this.endIndex.serialize();return[`slice`,this.input.serialize(),this.beginIndex.serialize(),e]}return[`slice`,this.input.serialize(),this.beginIndex.serialize()]}}function Yt(e,t){return e===`==`||e===`!=`?t.kind===`boolean`||t.kind===`string`||t.kind===`number`||t.kind===`null`||t.kind===`value`:t.kind===`string`||t.kind===`number`||t.kind===`value`}function Xt(e,t,n,r){return r.compare(t,n)===0}function Zt(e,t,n){let r=e!==`==`&&e!==`!=`;return class i{constructor(e,t,n){this.type=B,this.lhs=e,this.rhs=t,this.collator=n,this.hasUntypedArgument=e.type.kind===`value`||t.type.kind===`value`}static parse(e,t){if(e.length!==3&&e.length!==4)return t.error(`Expected two or three arguments.`);let n=e[0],a=t.parse(e[1],1,V);if(!a)return null;if(!Yt(n,a.type))return t.concat(1).error(`"${n}" comparisons are not supported for type '${xe(a.type)}'.`);let o=t.parse(e[2],2,V);if(!o)return null;if(!Yt(n,o.type))return t.concat(2).error(`"${n}" comparisons are not supported for type '${xe(o.type)}'.`);if(a.type.kind!==o.type.kind&&a.type.kind!==`value`&&o.type.kind!==`value`)return t.error(`Cannot compare types '${xe(a.type)}' and '${xe(o.type)}'.`);r&&(a.type.kind===`value`&&o.type.kind!==`value`?a=new Ve(o.type,[a]):a.type.kind!==`value`&&o.type.kind===`value`&&(o=new Ve(a.type,[o])));let s=null;if(e.length===4){if(a.type.kind!==`string`&&o.type.kind!==`string`&&a.type.kind!==`value`&&o.type.kind!==`value`)return t.error(`Cannot use collator to compare non-string types.`);if(s=t.parse(e[3],3,ve),!s)return null}return new i(a,o,s)}evaluate(i){let a=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){let t=Ie(a),n=Ie(o);if(t.kind!==n.kind||t.kind!==`string`&&t.kind!==`number`)throw new ze(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${n.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){let e=Ie(a),n=Ie(o);if(e.kind!==`string`||n.kind!==`string`)return t(i,a,o)}return this.collator?n(i,a,o,this.collator.evaluate(i)):t(i,a,o)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){let t=[e];return this.eachChild(e=>{t.push(e.serialize())}),t}}}let Qt=Zt(`==`,function(e,t,n){return t===n},Xt),$t=Zt(`!=`,function(e,t,n){return t!==n},function(e,t,n,r){return!Xt(0,t,n,r)}),en=Zt(`<`,function(e,t,n){return t`,function(e,t,n){return t>n},function(e,t,n,r){return r.compare(t,n)>0}),nn=Zt(`<=`,function(e,t,n){return t<=n},function(e,t,n,r){return r.compare(t,n)<=0}),rn=Zt(`>=`,function(e,t,n){return t>=n},function(e,t,n,r){return r.compare(t,n)>=0});class an{constructor(e,t,n,r,i){this.type=z,this.number=e,this.locale=t,this.currency=n,this.minFractionDigits=r,this.maxFractionDigits=i}static parse(e,t){if(e.length!==3)return t.error(`Expected two arguments.`);let n=t.parse(e[1],1,R);if(!n)return null;let r=e[2];if(typeof r!=`object`||Array.isArray(r))return t.error(`NumberFormat options argument must be an object.`);let i=null;if(r.locale&&(i=t.parse(r.locale,1,z),!i))return null;let a=null;if(r.currency&&(a=t.parse(r.currency,1,z),!a))return null;let o=null;if(r[`min-fraction-digits`]&&(o=t.parse(r[`min-fraction-digits`],1,R),!o))return null;let s=null;return r[`max-fraction-digits`]&&(s=t.parse(r[`max-fraction-digits`],1,R),!s)?null:new an(n,i,a,o,s)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?`currency`:`decimal`,currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.minFractionDigits&&(e[`min-fraction-digits`]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e[`max-fraction-digits`]=this.maxFractionDigits.serialize()),[`number-format`,this.number.serialize(),e]}}class on{constructor(e){this.type=R,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=t.parse(e[1],1);return n?n.type.kind!==`array`&&n.type.kind!==`string`&&n.type.kind!==`value`?t.error(`Expected argument of type string or array, but found ${xe(n.type)} instead.`):new on(n):null}evaluate(e){let t=this.input.evaluate(e);if(typeof t==`string`||Array.isArray(t))return t.length;throw new ze(`Expected value to be of type string or array, but found ${xe(Ie(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){let e=[`length`];return this.eachChild(t=>{e.push(t.serialize())}),e}}let sn={"==":Qt,"!=":$t,">":tn,"<":en,">=":rn,"<=":nn,array:Ve,at:Ut,boolean:Ve,case:qt,coalesce:Vt,collator:Je,format:W,image:He,in:Wt,"index-of":Gt,interpolate:zt,"interpolate-hcl":zt,"interpolate-lab":zt,length:on,let:Ht,literal:Re,match:Kt,number:Ve,"number-format":an,object:Ve,slice:Jt,step:bt,string:Ve,"to-boolean":We,"to-color":We,"to-number":We,"to-string":We,var:mt,within:pt};function cn(e,[t,n,r,i]){let a=t.evaluate(e),o=n.evaluate(e),s=r.evaluate(e),c=i?i.evaluate(e):1,l=Pe(a,o,s,c);if(l)throw new ze(l);return new ke(a/255*c,o/255*c,s/255*c,c)}function ln(e,t){return e in t}function un(e,t){let n=t[e];return n===void 0?null:n}function dn(e){return{type:e}}function fn(e){if(e instanceof ht&&(e.name===`get`&&e.args.length===1||e.name===`feature-state`||e.name===`has`&&e.args.length===1||e.name===`properties`||e.name===`geometry-type`||e.name===`id`||/^filter-/.test(e.name))||e instanceof pt)return!1;let t=!0;return e.eachChild(e=>{t&&!fn(e)&&(t=!1)}),t}function pn(e){if(e instanceof ht&&e.name===`feature-state`)return!1;let t=!0;return e.eachChild(e=>{t&&!pn(e)&&(t=!1)}),t}function mn(e,t){if(e instanceof ht&&t.indexOf(e.name)>=0)return!1;let n=!0;return e.eachChild(e=>{n&&!mn(e,t)&&(n=!1)}),n}function hn(e){return{result:`success`,value:e}}function gn(e){return{result:`error`,value:e}}function _n(e){return e[`property-type`]===`data-driven`||e[`property-type`]===`cross-faded-data-driven`}function vn(e){return!!e.expression&&e.expression.parameters.indexOf(`zoom`)>-1}function yn(e){return!!e.expression&&e.expression.interpolated}function bn(e){return e instanceof Number?`number`:e instanceof String?`string`:e instanceof Boolean?`boolean`:Array.isArray(e)?`array`:e===null?`null`:typeof e}function xn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Sn(e){return e}function Cn(e,t){let n=t.type===`color`,r=e.stops&&typeof e.stops[0][0]==`object`,i=r||!(r||e.property!==void 0),a=e.type||(yn(t)?`exponential`:`interval`);if(n&&((e=F({},e)).stops&&(e.stops=e.stops.map(e=>[e[0],ke.parse(e[1])])),e.default=ke.parse(e.default?e.default:t.default)),e.colorSpace&&e.colorSpace!==`rgb`&&!Rt[e.colorSpace])throw Error(`Unknown color space: ${e.colorSpace}`);let o,s,c;if(a===`exponential`)o=En;else if(a===`interval`)o=Tn;else if(a===`categorical`){o=wn,s=Object.create(null);for(let t of e.stops)s[t[0]]=t[1];c=typeof e.stops[0][0]}else{if(a!==`identity`)throw Error(`Unknown function type "${a}"`);o=Dn}if(r){let n={},r=[];for(let t=0;te[0]),evaluate:({zoom:n},r)=>En({stops:i,base:e.base},t,n).evaluate(n,r)}}if(i){let n=a===`exponential`?{name:`exponential`,base:e.base===void 0?1:e.base}:null;return{kind:`camera`,interpolationType:n,interpolationFactor:zt.interpolationFactor.bind(void 0,n),zoomStops:e.stops.map(e=>e[0]),evaluate:({zoom:n})=>o(e,t,n,s,c)}}return{kind:`source`,evaluate(n,r){let i=r&&r.properties?r.properties[e.property]:void 0;return i===void 0?K(e.default,t.default):o(e,t,i,s,c)}}}function K(e,t,n){return e===void 0?t===void 0?n===void 0?void 0:n:t:e}function wn(e,t,n,r,i){return K(typeof n===i?r[n]:void 0,e.default,t.default)}function Tn(e,t,n){if(bn(n)!==`number`)return K(e.default,t.default);let r=e.stops.length;if(r===1||n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[r-1][0])return e.stops[r-1][1];let i=yt(e.stops.map(e=>e[0]),n);return e.stops[i][1]}function En(e,t,n){let r=e.base===void 0?1:e.base;if(bn(n)!==`number`)return K(e.default,t.default);let i=e.stops.length;if(i===1||n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[i-1][0])return e.stops[i-1][1];let a=yt(e.stops.map(e=>e[0]),n),o=function(e,t,n,r){let i=r-n,a=e-n;return i===0?0:t===1?a/i:(t**+a-1)/(t**+i-1)}(n,r,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],c=e.stops[a+1][1],l=xt[t.type]||Sn;if(e.colorSpace&&e.colorSpace!==`rgb`){let t=Rt[e.colorSpace];l=(e,n)=>t.reverse(t.interpolate(t.forward(e),t.forward(n),o))}return typeof s.evaluate==`function`?{evaluate(...e){let t=s.evaluate.apply(void 0,e),n=c.evaluate.apply(void 0,e);if(t!==void 0&&n!==void 0)return l(t,n,o)}}:l(s,c,o)}function Dn(e,t,n){return t.type===`color`?n=ke.parse(n):t.type===`formatted`?n=Me.fromString(n.toString()):t.type===`resolvedImage`?n=Ne.fromString(n.toString()):bn(n)===t.type||t.type===`enum`&&t.values[n]||(n=void 0),K(n,e.default,t.default)}ht.register(sn,{error:[{kind:`error`},[z],(e,[t])=>{throw new ze(t.evaluate(e))}],typeof:[z,[V],(e,[t])=>xe(Ie(t.evaluate(e)))],"to-rgba":[be(R,4),[ge],(e,[t])=>t.evaluate(e).toArray()],rgb:[ge,[R,R,R],cn],rgba:[ge,[R,R,R,R],cn],has:{type:B,overloads:[[[z],(e,[t])=>ln(t.evaluate(e),e.properties())],[[z,_e],(e,[t,n])=>ln(t.evaluate(e),n.evaluate(e))]]},get:{type:V,overloads:[[[z],(e,[t])=>un(t.evaluate(e),e.properties())],[[z,_e],(e,[t,n])=>un(t.evaluate(e),n.evaluate(e))]]},"feature-state":[V,[z],(e,[t])=>un(t.evaluate(e),e.featureState||{})],properties:[_e,[],e=>e.properties()],"geometry-type":[z,[],e=>e.geometryType()],id:[V,[],e=>e.id()],zoom:[R,[],e=>e.globals.zoom],"heatmap-density":[R,[],e=>e.globals.heatmapDensity||0],"line-progress":[R,[],e=>e.globals.lineProgress||0],accumulated:[V,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[R,dn(R),(e,t)=>{let n=0;for(let r of t)n+=r.evaluate(e);return n}],"*":[R,dn(R),(e,t)=>{let n=1;for(let r of t)n*=r.evaluate(e);return n}],"-":{type:R,overloads:[[[R,R],(e,[t,n])=>t.evaluate(e)-n.evaluate(e)],[[R],(e,[t])=>-t.evaluate(e)]]},"/":[R,[R,R],(e,[t,n])=>t.evaluate(e)/n.evaluate(e)],"%":[R,[R,R],(e,[t,n])=>t.evaluate(e)%n.evaluate(e)],ln2:[R,[],()=>Math.LN2],pi:[R,[],()=>Math.PI],e:[R,[],()=>Math.E],"^":[R,[R,R],(e,[t,n])=>t.evaluate(e)**+n.evaluate(e)],sqrt:[R,[R],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[R,[R],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[R,[R],(e,[t])=>Math.log(t.evaluate(e))],log2:[R,[R],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[R,[R],(e,[t])=>Math.sin(t.evaluate(e))],cos:[R,[R],(e,[t])=>Math.cos(t.evaluate(e))],tan:[R,[R],(e,[t])=>Math.tan(t.evaluate(e))],asin:[R,[R],(e,[t])=>Math.asin(t.evaluate(e))],acos:[R,[R],(e,[t])=>Math.acos(t.evaluate(e))],atan:[R,[R],(e,[t])=>Math.atan(t.evaluate(e))],min:[R,dn(R),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[R,dn(R),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[R,[R],(e,[t])=>Math.abs(t.evaluate(e))],round:[R,[R],(e,[t])=>{let n=t.evaluate(e);return n<0?-Math.round(-n):Math.round(n)}],floor:[R,[R],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[R,[R],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[B,[z,V],(e,[t,n])=>e.properties()[t.value]===n.value],"filter-id-==":[B,[V],(e,[t])=>e.id()===t.value],"filter-type-==":[B,[z],(e,[t])=>e.geometryType()===t.value],"filter-<":[B,[z,V],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r{let n=e.id(),r=t.value;return typeof n==typeof r&&n":[B,[z,V],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>i}],"filter-id->":[B,[V],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n>r}],"filter-<=":[B,[z,V],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[B,[V],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n<=r}],"filter->=":[B,[z,V],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[B,[V],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n>=r}],"filter-has":[B,[V],(e,[t])=>t.value in e.properties()],"filter-has-id":[B,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[B,[be(z)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[B,[be(V)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[B,[z,be(V)],(e,[t,n])=>n.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[B,[z,be(V)],(e,[t,n])=>function(e,t,n,r){for(;n<=r;){let i=n+r>>1;if(t[i]===e)return!0;t[i]>e?r=i-1:n=i+1}return!1}(e.properties()[t.value],n.value,0,n.value.length-1)],all:{type:B,overloads:[[[B,B],(e,[t,n])=>t.evaluate(e)&&n.evaluate(e)],[dn(B),(e,t)=>{for(let n of t)if(!n.evaluate(e))return!1;return!0}]]},any:{type:B,overloads:[[[B,B],(e,[t,n])=>t.evaluate(e)||n.evaluate(e)],[dn(B),(e,t)=>{for(let n of t)if(n.evaluate(e))return!0;return!1}]]},"!":[B,[B],(e,[t])=>!t.evaluate(e)],"is-supported-script":[B,[z],(e,[t])=>{let n=e.globals&&e.globals.isSupportedScript;return!n||n(t.evaluate(e))}],upcase:[z,[z],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[z,[z],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[z,dn(V),(e,t)=>t.map(t=>Le(t.evaluate(e))).join(``)],"resolved-locale":[z,[ve],(e,[t])=>t.evaluate(e).resolvedLocale()]});class On{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Ke,this._defaultValue=t?function(e){return e.type===`color`&&xn(e.default)?new ke(0,0,0,0):e.type===`color`?ke.parse(e.default)||null:e.default===void 0?null:e.default}(t):null,this._enumValues=t&&t.type===`enum`?t.values:null}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,r,i,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{let e=this.expression.evaluate(this._evaluator);if(e==null||typeof e==`number`&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new ze(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(`, `)}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){let t=e;return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0),this._defaultValue}}}function kn(e){return Array.isArray(e)&&e.length>0&&typeof e[0]==`string`&&e[0]in sn}function An(e,t){let n=new qe(sn,gt,[],t?function(e){let t={color:ge,string:z,number:R,enum:z,boolean:B,formatted:H,resolvedImage:ye};return e.type===`array`?be(t[e.value]||V,e.length):t[e.type]}(t):void 0),r=n.parse(e,void 0,void 0,void 0,t&&t.type===`string`?{typeAnnotation:`coerce`}:void 0);return r?hn(new On(r,t)):gn(n.errors)}class jn{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent=e!==`constant`&&!pn(t.expression)}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,a)}evaluate(e,t,n,r,i,a){return this._styleExpression.evaluate(e,t,n,r,i,a)}}class Mn{constructor(e,t,n,r){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent=e!==`camera`&&!pn(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,a)}evaluate(e,t,n,r,i,a){return this._styleExpression.evaluate(e,t,n,r,i,a)}interpolationFactor(e,t,n){return this.interpolationType?zt.interpolationFactor(this.interpolationType,e,t,n):0}}function Nn(e,t){let n=An(e,t);if(n.result===`error`)return n;let r=n.value.expression,i=fn(r);if(!i&&!_n(t))return gn([new L(``,`data expressions not supported`)]);let a=mn(r,[`zoom`]);if(!a&&!vn(t))return gn([new L(``,`zoom expressions not supported`)]);let o=Fn(r);return o||a?o instanceof L?gn([o]):o instanceof zt&&!yn(t)?gn([new L(``,`"interpolate" expressions cannot be used with this property`)]):hn(o?new Mn(i?`camera`:`composite`,n.value,o.labels,o instanceof zt?o.interpolation:void 0):new jn(i?`constant`:`source`,n.value)):gn([new L(``,`"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.`)])}class Pn{constructor(e,t){this._parameters=e,this._specification=t,F(this,Cn(this._parameters,this._specification))}static deserialize(e){return new Pn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Fn(e){let t=null;if(e instanceof Ht)t=Fn(e.result);else if(e instanceof Vt){for(let n of e.args)if(t=Fn(n),t)break}else(e instanceof bt||e instanceof zt)&&e.input instanceof ht&&e.input.name===`zoom`&&(t=e);return t instanceof L||e.eachChild(e=>{let n=Fn(e);n instanceof L?t=n:!t&&n?t=new L(``,`"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.`):t&&n&&t!==n&&(t=new L(``,`Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.`))}),t}function In(e){let t=e.key,n=e.value,r=e.valueSpec||{},i=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=e.validateSpec,c=[],l=bn(n);if(l!==`object`)return[new N(t,n,`object expected, ${l} found`)];for(let e in n){let l=e.split(`.`)[0],u=r[l]||r[`*`],d;if(i[l])d=i[l];else if(r[l])d=s;else if(i[`*`])d=i[`*`];else{if(!r[`*`]){c.push(new N(t,n[e],`unknown property "${e}"`));continue}d=s}c=c.concat(d({key:(t&&`${t}.`)+e,value:n[e],valueSpec:u,style:a,styleSpec:o,object:n,objectKey:e,validateSpec:s},n))}for(let e in r)i[e]||r[e].required&&r[e].default===void 0&&n[e]===void 0&&c.push(new N(t,n,`missing required property "${e}"`));return c}function Ln(e){let t=e.value,n=e.valueSpec,r=e.style,i=e.styleSpec,a=e.key,o=e.arrayElementValidator||e.validateSpec;if(bn(t)!==`array`)return[new N(a,t,`array expected, ${bn(t)} found`)];if(n.length&&t.length!==n.length)return[new N(a,t,`array length ${n.length} expected, length ${t.length} found`)];if(n[`min-length`]&&t.lengthr.maximum?[new N(t,n,`${n} is greater than the maximum value ${r.maximum}`)]:[]:[new N(t,n,`number expected, ${i} found`)]}function zn(e){let t=e.valueSpec,n=I(e.value.type),r,i,a,o={},s=n!==`categorical`&&e.value.property===void 0,c=!s,l=bn(e.value.stops)===`array`&&bn(e.value.stops[0])===`array`&&bn(e.value.stops[0][0])===`object`,u=In({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if(n===`identity`)return[new N(e.key,e.value,`identity function may not have a "stops" property`)];let t=[],r=e.value;return t=t.concat(Ln({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:d})),bn(r)===`array`&&r.length===0&&t.push(new N(e.key,r,`array must have at least one stop`)),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return n===`identity`&&s&&u.push(new N(e.key,e.value,`missing required property "property"`)),n===`identity`||e.value.stops||u.push(new N(e.key,e.value,`missing required property "stops"`)),n===`exponential`&&e.valueSpec.expression&&!yn(e.valueSpec)&&u.push(new N(e.key,e.value,`exponential functions not supported`)),e.styleSpec.$version>=8&&(c&&!_n(e.valueSpec)?u.push(new N(e.key,e.value,`property functions not supported`)):s&&!vn(e.valueSpec)&&u.push(new N(e.key,e.value,`zoom functions not supported`))),n!==`categorical`&&!l||e.value.property!==void 0||u.push(new N(e.key,e.value,`"property" property is required`)),u;function d(e){let n=[],r=e.value,s=e.key;if(bn(r)!==`array`)return[new N(s,r,`array expected, ${bn(r)} found`)];if(r.length!==2)return[new N(s,r,`array length 2 expected, length ${r.length} found`)];if(l){if(bn(r[0])!==`object`)return[new N(s,r,`object expected, ${bn(r[0])} found`)];if(r[0].zoom===void 0)return[new N(s,r,`object stop key must have zoom`)];if(r[0].value===void 0)return[new N(s,r,`object stop key must have value`)];if(a&&a>I(r[0].zoom))return[new N(s,r[0].zoom,`stop zoom values must appear in ascending order`)];I(r[0].zoom)!==a&&(a=I(r[0].zoom),i=void 0,o={}),n=n.concat(In({key:`${s}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Rn,value:f}}))}else n=n.concat(f({key:`${s}[0]`,value:r[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return kn(pe(r[1]))?n.concat([new N(`${s}[1]`,r[1],`expressions are not allowed in function stops.`)]):n.concat(e.validateSpec({key:`${s}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function f(e,a){let s=bn(e.value),c=I(e.value),l=e.value===null?a:e.value;if(r){if(s!==r)return[new N(e.key,l,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if(s!==`number`&&s!==`string`&&s!==`boolean`)return[new N(e.key,l,`stop domain value must be a number, string, or boolean`)];if(s!==`number`&&n!==`categorical`){let r=`number expected, ${s} found`;return _n(t)&&n===void 0&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new N(e.key,l,r)]}return n!==`categorical`||s!==`number`||isFinite(c)&&Math.floor(c)===c?n!==`categorical`&&s===`number`&&i!==void 0&&cnew N(`${e.key}${t.key}`,e.value,t.message));let n=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext===`property`&&e.propertyKey===`text-font`&&!n.outputDefined())return[new N(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext===`property`&&e.propertyType===`layout`&&!pn(n))return[new N(e.key,e.value,`"feature-state" data expressions are not supported with layout properties.`)];if(e.expressionContext===`filter`&&!pn(n))return[new N(e.key,e.value,`"feature-state" data expressions are not supported with filters.`)];if(e.expressionContext&&e.expressionContext.indexOf(`cluster`)===0){if(!mn(n,[`zoom`,`feature-state`]))return[new N(e.key,e.value,`"zoom" and "feature-state" expressions are not supported with cluster properties.`)];if(e.expressionContext===`cluster-initial`&&!fn(n))return[new N(e.key,e.value,`Feature data expressions are not supported with initial expression part of cluster properties.`)]}return[]}function Vn(e){let t=e.key,n=e.value,r=e.valueSpec,i=[];return Array.isArray(r.values)?r.values.indexOf(I(n))===-1&&i.push(new N(t,n,`expected one of [${r.values.join(`, `)}], ${JSON.stringify(n)} found`)):Object.keys(r.values).indexOf(I(n))===-1&&i.push(new N(t,n,`expected one of [${Object.keys(r.values).join(`, `)}], ${JSON.stringify(n)} found`)),i}function Hn(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case`has`:return e.length>=2&&e[1]!==`$id`&&e[1]!==`$type`;case`in`:return e.length>=3&&(typeof e[1]!=`string`||Array.isArray(e[2]));case`!in`:case`!has`:case`none`:return!1;case`==`:case`!=`:case`>`:case`>=`:case`<`:case`<=`:return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case`any`:case`all`:for(let t of e.slice(1))if(!Hn(t)&&typeof t!=`boolean`)return!1;return!0;default:return!0}}let Un={type:`boolean`,default:!1,transition:!1,"property-type":`data-driven`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]}};function Wn(e){if(e==null)return{filter:()=>!0,needGeometry:!1};Hn(e)||(e=qn(e));let t=An(e,Un);if(t.result===`error`)throw Error(t.value.map(e=>`${e.key}: ${e.message}`).join(`, `));return{filter:(e,n,r)=>t.value.evaluate(e,n,{},r),needGeometry:Kn(e)}}function Gn(e,t){return et)}function Kn(e){if(!Array.isArray(e))return!1;if(e[0]===`within`)return!0;for(let t=1;t`||t===`<=`||t===`>=`?Jn(e[1],e[2],t):t===`any`?(n=e.slice(1),[`any`].concat(n.map(qn))):t===`all`?[`all`].concat(e.slice(1).map(qn)):t===`none`?[`all`].concat(e.slice(1).map(qn).map(Zn)):t===`in`?Yn(e[1],e.slice(2)):t===`!in`?Zn(Yn(e[1],e.slice(2))):t===`has`?Xn(e[1]):t===`!has`?Zn(Xn(e[1])):t!==`within`||e;var n}function Jn(e,t,n){switch(e){case`$type`:return[`filter-type-${n}`,t];case`$id`:return[`filter-id-${n}`,t];default:return[`filter-${n}`,e,t]}}function Yn(e,t){if(t.length===0)return!1;switch(e){case`$type`:return[`filter-type-in`,[`literal`,t]];case`$id`:return[`filter-id-in`,[`literal`,t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?[`filter-in-large`,e,[`literal`,t.sort(Gn)]]:[`filter-in-small`,e,[`literal`,t]]}}function Xn(e){switch(e){case`$type`:return!0;case`$id`:return[`filter-has-id`];default:return[`filter-has`,e]}}function Zn(e){return[`!`,e]}function Qn(e){return Hn(pe(e.value))?Bn(F({},e,{expressionContext:`filter`,valueSpec:{value:`boolean`}})):$n(e)}function $n(e){let t=e.value,n=e.key;if(bn(t)!==`array`)return[new N(n,t,`array expected, ${bn(t)} found`)];let r=e.styleSpec,i,a=[];if(t.length<1)return[new N(n,t,`filter array must have at least 1 element`)];switch(a=a.concat(Vn({key:`${n}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),I(t[0])){case`<`:case`<=`:case`>`:case`>=`:t.length>=2&&I(t[1])===`$type`&&a.push(new N(n,t,`"$type" cannot be use with operator "${t[0]}"`));case`==`:case`!=`:t.length!==3&&a.push(new N(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case`in`:case`!in`:t.length>=2&&(i=bn(t[1]),i!==`string`&&a.push(new N(`${n}[1]`,t[1],`string expected, ${i} found`)));for(let o=2;o{e in n&&t.push(new N(r,n[e],`"${e}" is prohibited for ref layers`))}),i.layers.forEach(t=>{I(t.id)===s&&(e=t)}),e?e.ref?t.push(new N(r,n.ref,`ref cannot reference another ref layer`)):o=I(e.type):t.push(new N(r,n.ref,`ref layer "${s}" not found`))}else if(o!==`background`){if(n.source){let e=i.sources&&i.sources[n.source],a=e&&I(e.type);e?a===`vector`&&o===`raster`?t.push(new N(r,n.source,`layer "${n.id}" requires a raster source`)):a!==`raster-dem`&&o===`hillshade`?t.push(new N(r,n.source,`layer "${n.id}" requires a raster-dem source`)):a===`raster`&&o!==`raster`?t.push(new N(r,n.source,`layer "${n.id}" requires a vector source`)):a!==`vector`||n[`source-layer`]?a===`raster-dem`&&o!==`hillshade`?t.push(new N(r,n.source,`raster-dem source can only be used with layer type 'hillshade'.`)):o!==`line`||!n.paint||!n.paint[`line-gradient`]||a===`geojson`&&e.lineMetrics||t.push(new N(r,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new N(r,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new N(r,n.source,`source "${n.source}" not found`))}else t.push(new N(r,n,`missing required property "source"`))}return t=t.concat(In({key:r,value:n,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${r}.type`,value:n.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:n,objectKey:`type`}),filter:Qn,layout:e=>In({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>nr(F({layerType:o},e))}}),paint:e=>In({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>tr(F({layerType:o},e))}})}})),t}function ir(e){let t=e.value,n=e.key,r=bn(t);return r===`string`?[]:[new N(n,t,`string expected, ${r} found`)]}let ar={promoteId:function({key:e,value:t}){if(bn(t)===`string`)return ir({key:e,value:t});{let n=[];for(let r in t)n.push(...ir({key:`${e}.${r}`,value:t[r]}));return n}}};function or(e){let t=e.value,n=e.key,r=e.styleSpec,i=e.style,a=e.validateSpec;if(!t.type)return[new N(n,t,`"type" is required`)];let o=I(t.type),s;switch(o){case`vector`:case`raster`:case`raster-dem`:case`mesh-batch`:return s=In({key:n,value:t,valueSpec:r[`source_${o.replace(`-`,`_`)}`],style:e.style,styleSpec:r,objectElementValidators:ar,validateSpec:a}),s;case`geojson`:if(s=In({key:n,value:t,valueSpec:r.source_geojson,style:i,styleSpec:r,objectElementValidators:ar,validateSpec:a}),t.cluster)for(let e in t.clusterProperties){let[r,i]=t.clusterProperties[e],a=typeof r==`string`?[r,[`accumulated`],[`get`,e]]:r;s.push(...Bn({key:`${n}.${e}.map`,value:i,expressionContext:`cluster-map`})),s.push(...Bn({key:`${n}.${e}.reduce`,value:a,expressionContext:`cluster-reduce`}))}return s;case`video`:return In({key:n,value:t,valueSpec:r.source_video,style:i,validateSpec:a,styleSpec:r});case`image`:return In({key:n,value:t,valueSpec:r.source_image,style:i,validateSpec:a,styleSpec:r});case`canvas`:return[new N(n,null,`Please use runtime APIs to add canvas sources, rather than including them in stylesheets.`,`source.canvas`)];default:return Vn({key:`${n}.type`,value:t.type,valueSpec:{values:[`vector`,`raster`,`raster-dem`,`geojson`,`video`,`image`]}})}}function sr(e){let t=e.value,n=e.styleSpec,r=n.light,i=e.style,a=[],o=bn(t);if(t===void 0)return a;if(o!==`object`)return a=a.concat([new N(`light`,t,`object expected, ${o} found`)]),a;for(let o in t){let s=o.match(/^(.*)-transition$/);a=a.concat(s&&r[s[1]]&&r[s[1]].transition?e.validateSpec({key:o,value:t[o],valueSpec:n.transition,validateSpec:e.validateSpec,style:i,styleSpec:n}):r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:i,styleSpec:n}):[new N(o,t[o],`unknown property "${o}"`)])}return a}let cr={"*":()=>[],array:Ln,boolean:function(e){let t=e.value,n=e.key,r=bn(t);return r===`boolean`?[]:[new N(n,t,`boolean expected, ${r} found`)]},number:Rn,color:function(e){let t=e.key,n=e.value,r=bn(n);return r===`string`?Oe.parseCSSColor(n)===null?[new N(t,n,`color expected, "${n}" found`)]:[]:[new N(t,n,`color expected, ${r} found`)]},constants:P,enum:Vn,filter:Qn,function:zn,layer:rr,object:In,source:or,light:sr,string:ir,formatted:function(e){return ir(e).length===0?[]:Bn(e)},resolvedImage:function(e){return ir(e).length===0?[]:Bn(e)}};function lr(e){let t=e.value,n=e.valueSpec,r=e.styleSpec;return e.validateSpec=lr,n.expression&&xn(I(t))?zn(e):n.expression&&kn(pe(t))?Bn(e):n.type&&cr[n.type]?cr[n.type](e):In(F({},e,{valueSpec:n.type?r[n.type]:n}))}function ur(e){let t=e.value,n=e.key,r=ir(e);return r.length||(t.indexOf(`{fontstack}`)===-1&&r.push(new N(n,t,`"glyphs" url must include a "{fontstack}" token`)),t.indexOf(`{range}`)===-1&&r.push(new N(n,t,`"glyphs" url must include a "{range}" token`))),r}function dr(e,t=M){let n=[];return n=n.concat(lr({key:``,value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:lr,objectElementValidators:{glyphs:ur,"*":()=>[]}})),e.constants&&(n=n.concat(P({key:`constants`,value:e.constants}))),pr(n)}function fr(e){return function(t){return e(Object.assign(Object.assign({},t),{validateSpec:lr}))}}function pr(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function mr(e){return function(...t){return pr(e.apply(this,t))}}dr.source=mr(fr(or)),dr.light=mr(fr(sr)),dr.terrain=mr(fr(function(e){let t=e.value,n=e.styleSpec,r=n.terrain,i=e.style,a=[],o=bn(t);if(t===void 0)return a;if(o!==`object`)return a=a.concat([new N(`terrain`,t,`object expected, ${o} found`)]),a;for(let o in t)a=a.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:i,styleSpec:n}):[new N(o,t[o],`unknown property "${o}"`)]);return a})),dr.layer=mr(fr(rr)),dr.filter=mr(fr(Qn)),dr.paintProperty=mr(fr(tr)),dr.layoutProperty=mr(fr(nr));let hr=dr,gr=hr.light,_r=hr.paintProperty,vr=hr.layoutProperty;function yr(e,t){let n=!1;if(t&&t.length)for(let r of t)e.fire(new de(Error(r.message))),n=!0;return n}class br{constructor(e,t,n){let r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let i=new Int32Array(this.arrayBuffer);e=i[0],this.d=(t=i[1])+2*(n=i[2]);for(let e=0;e=l[c+0]&&r>=l[c+1])?(o[d]=!0,a.push(i[d])):o[d]=!1}}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToCellCoord(e),l=this._convertToCellCoord(t),u=this._convertToCellCoord(n),d=this._convertToCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++){let l=this.d*c+f;if((!s||s(this._convertFromCellCoord(f),this._convertFromCellCoord(c),this._convertFromCellCoord(f+1),this._convertFromCellCoord(c+1)))&&i.call(this,e,t,n,r,l,a,o,s))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,t=3+this.cells.length+1+1,n=0;for(let e=0;e=0)continue;let a=e[n];i[n]=xr[r].shallow.indexOf(n)>=0?a:Cr(a,t)}e instanceof Error&&(i.message=e.message)}if(i.$name)throw Error(`$name property is reserved for worker serialization logic.`);return r!==`Object`&&(i.$name=r),i}throw Error(`can't serialize object of type `+typeof e)}function wr(e){if(e==null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||Sr(e)||C(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(wr);if(typeof e==`object`){let t=e.$name||`Object`;if(!xr[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:n}=xr[t];if(!n)throw Error(`can't deserialize unregistered class ${t}`);if(n.deserialize)return n.deserialize(e);let r=Object.create(n.prototype);for(let n of Object.keys(e)){if(n===`$name`)continue;let i=e[n];r[n]=xr[t].shallow.indexOf(n)>=0?i:wr(i)}return r}throw Error(`can't deserialize object of type `+typeof e)}class J{constructor(){this.first=!0}update(e,t){let n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=t):this.lastFloorZoome>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function Tr(e){for(let t of e)if(kr(t.charCodeAt(0)))return!0;return!1}function Er(e){for(let t of e)if(!Dr(t.charCodeAt(0)))return!1;return!0}function Dr(e){return!(Y.Arabic(e)||Y[`Arabic Supplement`](e)||Y[`Arabic Extended-A`](e)||Y[`Arabic Presentation Forms-A`](e)||Y[`Arabic Presentation Forms-B`](e))}function Or(e){return!(e<11904||!(Y[`Bopomofo Extended`](e)||Y.Bopomofo(e)||Y[`CJK Compatibility Forms`](e)||Y[`CJK Compatibility Ideographs`](e)||Y[`CJK Compatibility`](e)||Y[`CJK Radicals Supplement`](e)||Y[`CJK Strokes`](e)||Y[`CJK Symbols and Punctuation`](e)||Y[`CJK Unified Ideographs Extension A`](e)||Y[`CJK Unified Ideographs`](e)||Y[`Enclosed CJK Letters and Months`](e)||Y[`Halfwidth and Fullwidth Forms`](e)||Y.Hiragana(e)||Y[`Ideographic Description Characters`](e)||Y[`Kangxi Radicals`](e)||Y[`Katakana Phonetic Extensions`](e)||Y.Katakana(e)||Y[`Vertical Forms`](e)||Y[`Yi Radicals`](e)||Y[`Yi Syllables`](e)))}function kr(e){return!(e!==746&&e!==747&&(e<4352||!(Y[`Bopomofo Extended`](e)||Y.Bopomofo(e)||Y[`CJK Compatibility Forms`](e)&&!(e>=65097&&e<=65103)||Y[`CJK Compatibility Ideographs`](e)||Y[`CJK Compatibility`](e)||Y[`CJK Radicals Supplement`](e)||Y[`CJK Strokes`](e)||!(!Y[`CJK Symbols and Punctuation`](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||e===12336)||Y[`CJK Unified Ideographs Extension A`](e)||Y[`CJK Unified Ideographs`](e)||Y[`Enclosed CJK Letters and Months`](e)||Y[`Hangul Compatibility Jamo`](e)||Y[`Hangul Jamo Extended-A`](e)||Y[`Hangul Jamo Extended-B`](e)||Y[`Hangul Jamo`](e)||Y[`Hangul Syllables`](e)||Y.Hiragana(e)||Y[`Ideographic Description Characters`](e)||Y.Kanbun(e)||Y[`Kangxi Radicals`](e)||Y[`Katakana Phonetic Extensions`](e)||Y.Katakana(e)&&e!==12540||!(!Y[`Halfwidth and Fullwidth Forms`](e)||e===65288||e===65289||e===65293||e>=65306&&e<=65310||e===65339||e===65341||e===65343||e>=65371&&e<=65503||e===65507||e>=65512&&e<=65519)||!(!Y[`Small Form Variants`](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||Y[`Unified Canadian Aboriginal Syllabics`](e)||Y[`Unified Canadian Aboriginal Syllabics Extended`](e)||Y[`Vertical Forms`](e)||Y[`Yijing Hexagram Symbols`](e)||Y[`Yi Syllables`](e)||Y[`Yi Radicals`](e))))}function Ar(e){return!(kr(e)||function(e){return!!(Y[`Latin-1 Supplement`](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Y[`General Punctuation`](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Y[`Letterlike Symbols`](e)||Y[`Number Forms`](e)||Y[`Miscellaneous Technical`](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Y[`Control Pictures`](e)&&e!==9251||Y[`Optical Character Recognition`](e)||Y[`Enclosed Alphanumerics`](e)||Y[`Geometric Shapes`](e)||Y[`Miscellaneous Symbols`](e)&&!(e>=9754&&e<=9759)||Y[`Miscellaneous Symbols and Arrows`](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Y[`CJK Symbols and Punctuation`](e)||Y.Katakana(e)||Y[`Private Use Area`](e)||Y[`CJK Compatibility Forms`](e)||Y[`Small Form Variants`](e)||Y[`Halfwidth and Fullwidth Forms`](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(e))}function jr(e){return Y.Arabic(e)||Y[`Arabic Supplement`](e)||Y[`Arabic Extended-A`](e)||Y[`Arabic Presentation Forms-A`](e)||Y[`Arabic Presentation Forms-B`](e)}function Mr(e){return e>=1424&&e<=2303||Y[`Arabic Presentation Forms-A`](e)||Y[`Arabic Presentation Forms-B`](e)}function Nr(e,t){return!(!t&&Mr(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||Y.Khmer(e))}function Pr(e){for(let t of e)if(Mr(t.charCodeAt(0)))return!0;return!1}let Fr=`unavailable`,Ir=`deferred`,Lr=`loading`,Rr=`loaded`,zr=`error`,Br=null,Vr=Fr,Hr=null,Ur=function(e){e&&(Vr=zr),Br&&Br(e)};function Wr(){Gr.fire(new ue(`pluginStateChange`,{pluginStatus:Vr,pluginURL:Hr}))}let Gr=new fe,Kr=function(){return Vr},qr=function(){if(Vr!==Ir||!Hr)throw Error(`rtl-text-plugin cannot be downloaded unless a pluginURL is specified`);Vr=Lr,Wr(),Hr&&ae({url:Hr},e=>{e?Ur(e):(Vr=Rr,Wr())})},Jr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Vr===Rr||Jr.applyArabicShaping!=null,isLoading:()=>Vr===Lr,setState(e){Vr=e.pluginStatus,Hr=e.pluginURL},isParsed:()=>Jr.applyArabicShaping!=null&&Jr.processBidirectionalText!=null&&Jr.processStyledBidirectionalText!=null,isParsing:()=>Vr===`parsing`,getPluginURL:()=>Hr};class Yr{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.zoomHistory=t.zoomHistory,this.transition=t.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new J,this.transition={})}isSupportedScript(e){return function(e,t){for(let n of e)if(!Nr(n.charCodeAt(0),t))return!1;return!0}(e,Jr.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*t}}}class Xr{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(xn(e))return new Pn(e,t);if(kn(e)){let n=Nn(e,t);if(n.result===`error`)throw Error(n.value.map(e=>`${e.key}: ${e.message}`).join(`, `));return n.value}{let n=e;return typeof e==`string`&&t.type===`color`&&(n=ke.parse(e)),{kind:`constant`,evaluate:()=>n}}}(t===void 0?e.specification.default:t,e.specification)}isDataDriven(){return this.expression.kind===`source`||this.expression.kind===`composite`}possiblyEvaluate(e,t,n){return this.property.possiblyEvaluate(this,e,t,n)}}class Zr{constructor(e){this.property=e,this.value=new Xr(e,void 0)}transitioned(e,t){return new $r(this.property,this.value,t,o({},e.transition,this.transition),e.now)}untransitioned(){return new $r(this.property,this.value,null,{},0)}}class Qr{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return d(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Zr(this._values[e].property)),this._values[e].value=new Xr(this._values[e].property,t===null?void 0:d(t))}getTransition(e){return d(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Zr(this._values[e].property)),this._values[e].transition=d(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n);let r=this.getTransition(t);r!==void 0&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){let n=new ei(this._properties);for(let r of Object.keys(this._values))n._values[r]=this._values[r].transitioned(e,t._values[r]);return n}untransitioned(){let e=new ei(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class $r{constructor(e,t,n,r,i){this.property=e,this.value=t,this.begin=i+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){let r=e.now||0,i=this.value.possiblyEvaluate(e,t,n),a=this.prior;if(a){if(r>this.end||this.value.isDataDriven())return this.prior=null,i;if(r=1)return 1;let t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}(o))}}return i}}class ei{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){let r=new ri(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(e,t,n);return r}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class ti{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return d(this._values[e].value)}setValue(e,t){this._values[e]=new Xr(this._values[e].property,t===null?void 0:d(t))}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n)}return e}possiblyEvaluate(e,t,n){let r=new ri(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(e,t,n);return r}}class ni{constructor(e,t,n){this.property=e,this.value=t,this.parameters=n}isConstant(){return this.value.kind===`constant`}constantOr(e){return this.value.kind===`constant`?this.value.value:e}evaluate(e,t,n,r){return this.property.evaluate(this.value,this.parameters,e,t,n,r)}}class ri{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class X{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw Error(`Value should not be data driven`);return e.expression.evaluate(t)}interpolate(e,t,n){let r=xt[this.specification.type];return r?r(e,t,n):e}}class Z{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,r){return new ni(this,e.expression.kind===`constant`||e.expression.kind===`camera`?{kind:`constant`,value:e.expression.evaluate(t,null,{},n,r)}:e.expression,t)}interpolate(e,t,n){if(e.value.kind!==`constant`||t.value.kind!==`constant`)return e;if(e.value.value===void 0||t.value.value===void 0)return new ni(this,{kind:`constant`,value:void 0},e.parameters);let r=xt[this.specification.type];return r?new ni(this,{kind:`constant`,value:r(e.value.value,t.value.value,n)},e.parameters):e}evaluate(e,t,n,r,i,a){return e.kind===`constant`?e.value:e.evaluate(t,n,r,i,a)}}class ii extends Z{possiblyEvaluate(e,t,n,r){if(e.value===void 0)return new ni(this,{kind:`constant`,value:void 0},t);if(e.expression.kind===`constant`){let i=e.expression.evaluate(t,null,{},n,r),a=e.property.specification.type===`resolvedImage`&&typeof i!=`string`?i.name:i,o=this._calculate(a,a,a,t);return new ni(this,{kind:`constant`,value:o},t)}if(e.expression.kind===`camera`){let n=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new ni(this,{kind:`constant`,value:n},t)}return new ni(this,e.expression,t)}evaluate(e,t,n,r,i,a){if(e.kind===`source`){let o=e.evaluate(t,n,r,i,a);return this._calculate(o,o,o,t)}return e.kind===`composite`?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},n,r),e.evaluate({zoom:Math.floor(t.zoom)},n,r),e.evaluate({zoom:Math.floor(t.zoom)+1},n,r),t):e.value}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class ai{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){if(e.value!==void 0){if(e.expression.kind===`constant`){let i=e.expression.evaluate(t,null,{},n,r);return this._calculate(i,i,i,t)}return this._calculate(e.expression.evaluate(new Yr(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Yr(Math.floor(t.zoom),t)),e.expression.evaluate(new Yr(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class oi{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){return!!e.expression.evaluate(t,null,{},n,r)}interpolate(){return!1}}class si{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let n=e[t];n.specification.overridable&&this.overridableProperties.push(t);let r=this.defaultPropertyValues[t]=new Xr(n,void 0),i=this.defaultTransitionablePropertyValues[t]=new Zr(n);this.defaultTransitioningPropertyValues[t]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}q(`DataDrivenProperty`,Z),q(`DataConstantProperty`,X),q(`CrossFadedDataDrivenProperty`,ii),q(`CrossFadedProperty`,ai),q(`ColorRampProperty`,oi);let Q=`-transition`;class ci extends fe{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!==`custom`&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!==`background`&&(this.source=e.source,this.sourceLayer=e[`source-layer`],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new ti(t.layout)),t.paint)){this._transitionablePaint=new Qr(t.paint);for(let t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(let t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ri(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e===`visibility`?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,n={}){t!=null&&this._validate(vr,`layers.${this.id}.layout.${e}`,e,t,n)||(e===`visibility`?this.visibility=t:this._unevaluatedLayout.setValue(e,t))}getPaintProperty(e){return e.endsWith(Q)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,n={}){if(t!=null&&this._validate(_r,`layers.${this.id}.paint.${e}`,e,t,n))return!1;if(e.endsWith(Q))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{let n=this._transitionablePaint._values[e],r=n.property.specification[`property-type`]===`cross-faded-data-driven`,i=n.value.isDataDriven(),a=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let o=this._transitionablePaint._values[e].value;return o.isDataDriven()||i||r||this._handleOverridablePaintPropertyUpdate(e,a,o)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,n){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility===`none`}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),u(e,(e,t)=>!(e===void 0||t===`layout`&&!Object.keys(e).length||t===`paint`&&!Object.keys(e).length))}_validate(e,t,n,r,i={}){return(!i||!1!==i.validate)&&yr(this,e.call(hr,{key:t,layerType:this.type,objectKey:n,value:r,styleSpec:M,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(t instanceof ni&&_n(t.property.specification)&&(t.value.kind===`source`||t.value.kind===`composite`)&&t.value.isStateDependent)return!0}return!1}isNaverLayer(){return!(!this.metadata||!this.metadata.group)}}let li={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ${constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ui{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw Error(`_refreshViews() must be implemented by each concrete StructArray layout`)}destroy(){this.arrayBuffer=null}}function di(e,t=1){let n=0,r=0;return{members:e.map(e=>{let i=li[e.type].BYTES_PER_ELEMENT,a=n=fi(n,Math.max(t,i)),o=e.components||1;return r=Math.max(r,i),n+=i*o,{name:e.name,type:e.type,components:o,offset:a}}),size:fi(n,Math.max(r,t)),alignment:t}}function fi(e,t){return Math.ceil(e/t)*t}class pi extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.int16[r+0]=t,this.int16[r+1]=n,e}}pi.prototype.bytesPerElement=4,q(`StructArrayLayout2i4`,pi);class mi extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.int16[i+0]=t,this.int16[i+1]=n,this.int16[i+2]=r,e}}mi.prototype.bytesPerElement=6,q(`StructArrayLayout3i6`,mi);class hi extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){let a=4*e;return this.int16[a+0]=t,this.int16[a+1]=n,this.int16[a+2]=r,this.int16[a+3]=i,e}}hi.prototype.bytesPerElement=8,q(`StructArrayLayout4i8`,hi);class gi extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,e}}gi.prototype.bytesPerElement=12,q(`StructArrayLayout2i4i12`,gi);class _i extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=4*e,c=8*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.uint8[c+4]=r,this.uint8[c+5]=i,this.uint8[c+6]=a,this.uint8[c+7]=o,e}}_i.prototype.bytesPerElement=8,q(`StructArrayLayout2i4ub8`,_i);class vi extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r,i)}emplace(e,t,n,r,i,a){let o=4*e,s=8*e;return this.int16[o+0]=t,this.int16[o+1]=n,this.uint8[s+4]=r,this.uint8[s+5]=i,this.uint8[s+6]=a,e}}vi.prototype.bytesPerElement=8,q(`StructArrayLayout2i3ub8`,vi);class yi extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.float32[r+0]=t,this.float32[r+1]=n,e}}yi.prototype.bytesPerElement=8,q(`StructArrayLayout2f8`,yi);class bi extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,n,r,i,a,o,s,c,l)}emplace(e,t,n,r,i,a,o,s,c,l,u){let d=10*e;return this.uint16[d+0]=t,this.uint16[d+1]=n,this.uint16[d+2]=r,this.uint16[d+3]=i,this.uint16[d+4]=a,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=c,this.uint16[d+8]=l,this.uint16[d+9]=u,e}}bi.prototype.bytesPerElement=20,q(`StructArrayLayout10ui20`,bi);class xi extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=5*e,c=10*e;return this.float32[s+0]=t,this.float32[s+1]=n,this.float32[s+2]=r,this.int16[c+6]=i,this.int16[c+7]=a,this.int16[c+8]=o,e}}xi.prototype.bytesPerElement=20,q(`StructArrayLayout3f3i20`,xi);class Si extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,n,r,i,a,o,s,c,l)}emplace(e,t,n,r,i,a,o,s,c,l,u){let d=9*e,f=18*e;return this.float32[d+0]=t,this.float32[d+1]=n,this.float32[d+2]=r,this.int16[f+6]=i,this.int16[f+7]=a,this.int16[f+8]=o,this.float32[d+5]=s,this.float32[d+6]=c,this.float32[d+7]=l,this.float32[d+8]=u,e}}Si.prototype.bytesPerElement=36,q(`StructArrayLayout3f3i4f36`,Si);class Ci extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,e,t,n,r,i,a,o,s,c,l,u,d)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f){let p=12*e;return this.int16[p+0]=t,this.int16[p+1]=n,this.int16[p+2]=r,this.int16[p+3]=i,this.uint16[p+4]=a,this.uint16[p+5]=o,this.uint16[p+6]=s,this.uint16[p+7]=c,this.int16[p+8]=l,this.int16[p+9]=u,this.int16[p+10]=d,this.int16[p+11]=f,e}}Ci.prototype.bytesPerElement=24,q(`StructArrayLayout4i4ui4i24`,Ci);class wi extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.float32[i+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,e}}wi.prototype.bytesPerElement=12,q(`StructArrayLayout3f12`,wi);class Ti extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Ti.prototype.bytesPerElement=4,q(`StructArrayLayout1ul4`,Ti);class Ei extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,r,i,a,o,s,c)}emplace(e,t,n,r,i,a,o,s,c,l){let u=10*e,d=5*e;return this.int16[u+0]=t,this.int16[u+1]=n,this.int16[u+2]=r,this.int16[u+3]=i,this.int16[u+4]=a,this.int16[u+5]=o,this.uint32[d+3]=s,this.uint16[u+8]=c,this.uint16[u+9]=l,e}}Ei.prototype.bytesPerElement=20,q(`StructArrayLayout6i1ul2ui20`,Ei);class Di extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,e}}Di.prototype.bytesPerElement=12,q(`StructArrayLayout2i2i2i12`,Di);class Oi extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r,i)}emplace(e,t,n,r,i,a){let o=4*e,s=8*e;return this.float32[o+0]=t,this.float32[o+1]=n,this.float32[o+2]=r,this.int16[s+6]=i,this.int16[s+7]=a,e}}Oi.prototype.bytesPerElement=16,q(`StructArrayLayout2f1f2i16`,Oi);class ki extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){let a=12*e,o=3*e;return this.uint8[a+0]=t,this.uint8[a+1]=n,this.float32[o+1]=r,this.float32[o+2]=i,e}}ki.prototype.bytesPerElement=12,q(`StructArrayLayout2ub2f12`,ki);class Ai extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.uint16[i+0]=t,this.uint16[i+1]=n,this.uint16[i+2]=r,e}}Ai.prototype.bytesPerElement=6,q(`StructArrayLayout3ui6`,Ai);class ji extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){let _=this.length;return this.resize(_+1),this.emplace(_,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=24*e,y=12*e,b=48*e;return this.int16[v+0]=t,this.int16[v+1]=n,this.uint16[v+2]=r,this.uint16[v+3]=i,this.uint32[y+2]=a,this.uint32[y+3]=o,this.uint32[y+4]=s,this.uint16[v+10]=c,this.uint16[v+11]=l,this.uint16[v+12]=u,this.float32[y+7]=d,this.float32[y+8]=f,this.uint8[b+36]=p,this.uint8[b+37]=m,this.uint8[b+38]=h,this.uint32[y+10]=g,this.int16[v+22]=_,e}}ji.prototype.bytesPerElement=48,q(`StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48`,ji);class Mi extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O){let k=this.length;return this.resize(k+1),this.emplace(k,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k){let A=36*e,j=18*e,ee=72*e;return this.int16[A+0]=t,this.int16[A+1]=n,this.int16[A+2]=r,this.int16[A+3]=i,this.int16[A+4]=a,this.int16[A+5]=o,this.int16[A+6]=s,this.int16[A+7]=c,this.uint16[A+8]=l,this.uint16[A+9]=u,this.uint16[A+10]=d,this.uint16[A+11]=f,this.uint16[A+12]=p,this.uint16[A+13]=m,this.uint16[A+14]=h,this.uint16[A+15]=g,this.uint16[A+16]=_,this.uint16[A+17]=v,this.uint16[A+18]=y,this.uint16[A+19]=b,this.uint16[A+20]=x,this.uint16[A+21]=S,this.uint16[A+22]=C,this.uint32[j+12]=w,this.float32[j+13]=T,this.float32[j+14]=E,this.float32[j+15]=D,this.float32[j+16]=O,this.uint8[ee+68]=k,e}}Mi.prototype.bytesPerElement=72,q(`StructArrayLayout8i15ui1ul4f1ub72`,Mi);class Ni extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Ni.prototype.bytesPerElement=4,q(`StructArrayLayout1f4`,Ni);class Pi extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=4*e;return this.uint32[2*e+0]=t,this.uint16[i+2]=n,this.uint16[i+3]=r,e}}Pi.prototype.bytesPerElement=8,q(`StructArrayLayout1ul2ui8`,Pi);class Fi extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=n,e}}Fi.prototype.bytesPerElement=4,q(`StructArrayLayout2ui4`,Fi);class Ii extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}Ii.prototype.bytesPerElement=2,q(`StructArrayLayout1ui2`,Ii);class Li extends ui{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){let a=4*e;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=r,this.float32[a+3]=i,e}}Li.prototype.bytesPerElement=16,q(`StructArrayLayout4f16`,Li);class Ri extends ${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 E(this.anchorPointX,this.anchorPointY)}}Ri.prototype.size=20;class zi extends Ei{get(e){return new Ri(this,e)}}q(`CollisionBoxArray`,zi);class Bi extends ${get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Bi.prototype.size=48;class Vi extends ji{get(e){return new Bi(this,e)}}q(`PlacedSymbolArray`,Vi);class Hi extends ${get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}get forceCollision(){return this._structArray.uint8[this._pos1+68]}set forceCollision(e){this._structArray.uint8[this._pos1+68]=e}}Hi.prototype.size=72;class Ui extends Mi{get(e){return new Hi(this,e)}}q(`SymbolInstanceArray`,Ui);class Wi extends Ni{getoffsetX(e){return this.float32[1*e+0]}}q(`GlyphOffsetArray`,Wi);class Gi extends mi{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}q(`SymbolLineVertexArray`,Gi);class Ki extends ${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]}}Ki.prototype.size=8;class qi extends Pi{get(e){return new Ki(this,e)}}q(`FeatureIndexArray`,qi);class Ji extends pi{}class Yi extends pi{}class Xi extends pi{}class Zi extends gi{}class Qi extends _i{}class $i extends vi{}class ea extends yi{}class ta extends bi{}class na extends xi{}class ra extends Ci{}class ia extends wi{}class aa extends Ti{}class oa extends Di{}class sa extends ki{}class ca extends Ai{}class la extends Fi{}let{members:ua}=di([{name:`a_pos`,components:2,type:`Int16`}],4);class da{constructor(e=[]){this.segments=e}prepareSegment(e,t,n,r){let i=this.segments[this.segments.length-1];return e>da.MAX_VERTEX_ARRAY_LENGTH&&p(`Max vertices per segment is ${da.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!i||i.vertexLength+e>da.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==r)&&(i={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},r!==void 0&&(i.sortKey=r),this.segments.push(i)),i}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,n,r){return new da([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:r,vaos:{},sortKey:0}])}}function fa(e,t){return 256*(e=i(Math.floor(e),0,255))+i(Math.floor(t),0,255)}da.MAX_VERTEX_ARRAY_LENGTH=2**16-1,q(`SegmentVector`,da);let pa=di([{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 ma,ha,ga,_a={exports:{}},va={exports:{}},ya={exports:{}},ba=Te(function(){if(ga)return _a.exports;ga=1;var e=(ma||(ma=1,va.exports=function(e,t){var n,r,i,a,o,s,c,l;for(r=e.length-(n=3&e.length),i=t,o=3432918353,s=461845907,l=0;l>>16)*o&65535)<<16)&4294967295)<<15|c>>>17))*s+(((c>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+(((a>>>16)+58964&65535)<<16);switch(c=0,n){case 3:c^=(255&e.charCodeAt(l+2))<<16;case 2:c^=(255&e.charCodeAt(l+1))<<8;case 1:i^=c=(65535&(c=(c=(65535&(c^=255&e.charCodeAt(l)))*o+(((c>>>16)*o&65535)<<16)&4294967295)<<15|c>>>17))*s+(((c>>>16)*s&65535)<<16)&4294967295}return i^=e.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}),va.exports),t=(ha||(ha=1,ya.exports=function(e,t){for(var n,r=e.length,i=t^r,a=0;r>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24))+((1540483477*(n>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),r-=4,++a;switch(r){case 3:i^=(255&e.charCodeAt(a+2))<<16;case 2:i^=(255&e.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&e.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}),ya.exports);return _a.exports=e,_a.exports.murmur3=e,_a.exports.murmur2=t,_a.exports}());class xa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,n,r){this.ids.push(Sa(e)),this.positions.push(t,n,r)}getPositions(e){if(!this.indexed)throw Error(`Trying to get index, but feature positions are not indexed`);let t=Sa(e),n=0,r=this.ids.length-1;for(;n>1;this.ids[e]>=t?r=e:n=e+1}let i=[];for(;this.ids[n]===t;)i.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return i}static serialize(e,t){let n=new Float64Array(e.ids),r=new Uint32Array(e.positions);return Ca(n,r,0,n.length-1),t&&t.push(n.buffer,r.buffer),{ids:n,positions:r}}static deserialize(e){let t=new xa;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function Sa(e){let t=+e;return!isNaN(t)&&t<=2**53-1?t:ba(String(e))}function Ca(e,t,n,r){for(;n>1],a=n-1,o=r+1;for(;;){do a++;while(e[a]i);if(a>=o)break;wa(e,a,o),wa(t,3*a,3*o),wa(t,3*a+1,3*o+1),wa(t,3*a+2,3*o+2)}o-n`u_${e}`),this.type=n}setUniform(e,t,n){e.set(n.constantOr(this.value))}getBinding(e,t,n){return this.type===`color`?new Oa(e,t):new Ea(e,t)}}class Ma{constructor(e,t){this.uniformNames=t.map(e=>`u_${e}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,n,r){let i=r===`u_pattern_to`?this.patternTo:r===`u_pattern_from`?this.patternFrom:r===`u_pixel_ratio_to`?this.pixelRatioTo:r===`u_pixel_ratio_from`?this.pixelRatioFrom:null;i&&e.set(i)}getBinding(e,t,n){return n.substr(0,9)===`u_pattern`?new Da(e,t):new Ea(e,t)}}class Na{constructor(e,t,n,r){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:`Float32`,components:n===`color`?2:1,offset:0})),this.paintVertexArray=new r}populatePaintArray(e,t,n,r,i){let a=this.paintVertexArray.length,o=this.expression.evaluate(new Yr(0),t,{},r,[],i);this.paintVertexArray.resize(e),this._setPaintValue(a,e,o)}updatePaintArray(e,t,n,r){let i=this.expression.evaluate({zoom:0},n,r);this._setPaintValue(e,t,i)}_setPaintValue(e,t,n){if(this.type===`color`){let r=Aa(n);for(let n=e;n`u_${e}_t`),this.type=n,this.useIntegerZoom=r,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:`Float32`,components:n===`color`?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,n,r,i){let a=this.expression.evaluate(new Yr(this.zoom),t,{},r,[],i),o=this.expression.evaluate(new Yr(this.zoom+1),t,{},r,[],i),s=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(s,e,a,o)}updatePaintArray(e,t,n,r){let i=this.expression.evaluate({zoom:this.zoom},n,r),a=this.expression.evaluate({zoom:this.zoom+1},n,r);this._setPaintValue(e,t,i,a)}_setPaintValue(e,t,n,r){if(this.type===`color`){let i=Aa(n),a=Aa(r);for(let n=e;n({name:`a_${e}`,type:`Float32`,components:r===`color`?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,t,n,r,i){let a=i&&i.isSubText,o=this.paintVertexArray.length,s=a?this._subTextExpression.kind===`constant`?this._subTextExpression.value:this._subTextExpression.evaluate(new Yr(0),t,{},r,[],i):this._textExpression.kind===`constant`?this._textExpression.value:this._textExpression.evaluate(new Yr(0),t,{},r,[],i);this.expression=a?this._subTextExpression:this._textExpression,this.paintVertexArray.resize(e),this._setPaintValue(o,e,s)}updatePaintArray(e,t,n,r){let i=this.expression.evaluate({zoom:0},n,r);this._setPaintValue(e,t,i)}_setPaintValue(e,t,n){if(this.type===`color`){let r=Aa(n);for(let n=e;n/^subtext/.test(e))||[]).length>0,a=e.paint;for(let o in e.paint._values){if(!n(o))continue;let s=a.get(o);if(!(s instanceof ni&&_n(s.property.specification)))continue;let c=za(o,e.type),l=s.value,u=s.property.specification.type,d=s.property.useIntegerZoom,f=s.property.specification[`property-type`],p=f===`cross-faded`||f===`cross-faded-data-driven`;if(i&&s.property.overrides){let e=o.replace(/^text/,`subtext`),t=a.get(e).value,n=Ba(o,u,l.kind===`source`?`source`:`composite`);this.binders[o]=new Ia(l,t,c,u,n),r.push(`/s_${o}`)}else if(l.kind===`constant`)this.binders[o]=p?new Ma(l.value,c):new ja(l.value,c,u),r.push(`/u_${o}`);else if(l.kind===`source`||p){let n=Ba(o,u,`source`);this.binders[o]=p?new Fa(l,u,d,t,n,e.id):new Na(l,c,u,n),r.push(`/a_${o}`)}else{let e=Ba(o,u,`composite`);this.binders[o]=new Pa(l,c,u,d,t,e),r.push(`/z_${o}`)}}this.cacheKey=r.sort().join(``)}getMaxValue(e){let t=this.binders[e];return t instanceof Na||t instanceof Pa||t instanceof Ia?t.maxValue:0}populatePaintArrays(e,t,n,r,i){for(let a in this.binders){let o=this.binders[a];(o instanceof Na||o instanceof Pa||o instanceof Fa||o instanceof Ia)&&o.populatePaintArray(e,t,n,r,i)}}setConstantPatternPositions(e,t){for(let n in this.binders){let r=this.binders[n];r instanceof Ma&&r.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,n,r,i){let a=!1;for(let o in e){let s=t.getPositions(o);for(let t of s){let s=n.feature(t.index);for(let n in this.binders){let c=this.binders[n];(c instanceof Na||c instanceof Pa||c instanceof Fa||c instanceof Ia)&&!0===c.expression.isStateDependent&&(c.expression=r.paint.get(n).value,c.updatePaintArray(t.start,t.end,s,e[o],i),a=!0)}}}return a}defines(){let e=[];for(let t in this.binders){let n=this.binders[t];(n instanceof ja||n instanceof Ma)&&e.push(...n.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof Na||n instanceof Pa||n instanceof Ia)for(let t=0;t!0){this.programConfigurations={};for(let r of e)this.programConfigurations[r.id]=new La(r,t,n);this.needsUpload=!1,this._featureMap=new xa,this._bufferOffset=0}populatePaintArrays(e,t,n,r,i,a){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,r,i,a);t.id!==void 0&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,r){for(let i of n)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(e,this._featureMap,t,i,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}function za(e,t){return{"text-opacity":[`opacity`],"icon-opacity":[`opacity`],"text-color":[`fill_color`],"icon-color":[`fill_color`],"text-halo-color":[`halo_color`],"icon-halo-color":[`halo_color`],"text-halo-blur":[`halo_blur`],"icon-halo-blur":[`halo_blur`],"text-halo-width":[`halo_width`],"icon-halo-width":[`halo_width`],"line-gap-width":[`gapwidth`],"line-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`],"line-extrusion-pattern":[`pattern_to`,`pattern_from`,`pixel_ratio_to`,`pixel_ratio_from`]}[e]||[e.replace(`${t}-`,``).replace(/-/g,`_`)]}function Ba(e,t,n){let r={color:{source:yi,composite:Li},number:{source:Ni,composite:yi}},i=function(e){return{"line-pattern":{source:ta,composite:ta},"fill-pattern":{source:ta,composite:ta},"fill-extrusion-pattern":{source:ta,composite:ta}}[e]}(e);return i&&i[n]||r[t][n]}q(`ConstantBinder`,ja),q(`CrossFadedConstantBinder`,Ma),q(`SourceExpressionBinder`,Na),q(`CrossFadedCompositeBinder`,Fa),q(`CompositeExpressionBinder`,Pa),q(`SubTextBinder`,Ia),q(`ProgramConfiguration`,La,{omit:[`_buffers`]}),q(`ProgramConfigurationSet`,Ra);var Va=8192;let Ha=2**14-1,Ua=-Ha-1;function Wa(e){let t=Va/e.extent,n=e.loadGeometry();for(let e=0;en.x+1||on.y+1)&&p(`Geometry exceeds allowed extent, reduce your vector tile buffer size`)}}return n}function Ga(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Wa(e):[]}}function Ka(e,t,n,r,i){e.emplaceBack(2*t+(r+1)/2,2*n+(i+1)/2)}class qa{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Yi,this.indexArray=new ca,this.segments=new da,this.programConfigurations=new Ra(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){let r=this.layers[0],i=[],a=null,o=!1;r.type===`circle`&&(a=r.layout.get(`circle-sort-key`),o=!a.isConstant());for(let{feature:t,id:r,index:s,sourceLayerIndex:c}of e){let e=this.layers[0]._featureFilter.needGeometry,l=Ga(t,e);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),l,n))continue;let u=o?a.evaluate(l,{},n):void 0,d={id:r,properties:t.properties,type:t.type,sourceLayerIndex:c,index:s,geometry:e?l.geometry:Wa(t),patterns:{},sortKey:u};i.push(d)}o&&i.sort((e,t)=>e.sortKey-t.sortKey);for(let r of i){let{geometry:i,index:a,sourceLayerIndex:o}=r,s=e[a].feature;this.addFeature(r,i,a,n),t.featureIndex.insert(s,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ua),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,n,r){for(let n of t)for(let t of n){let n=t.x,r=t.y;if(n<0||n>=Va||r<0||r>=Va)continue;let i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),a=i.vertexLength;Ka(this.layoutVertexArray,n,r,-1,-1),Ka(this.layoutVertexArray,n,r,1,-1),Ka(this.layoutVertexArray,n,r,1,1),Ka(this.layoutVertexArray,n,r,-1,1),this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+3,a+2),i.vertexLength+=4,i.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},r)}}function Ja(e,t){for(let n=0;n1){if(Qa(e,t))return!0;for(let r=0;r1?n:n.sub(t)._mult(i)._add(t))}function no(e,t){let n,r,i,a=!1;for(let o=0;ot.y!=i.y>t.y&&t.x<(i.x-r.x)*(t.y-r.y)/(i.y-r.y)+r.x&&(a=!a)}return a}function ro(e,t){let n=!1;for(let r=0,i=e.length-1;rt.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(n=!n)}return n}function io(e,t,n){let r=n[0],i=n[2];if(e.xi.x&&t.x>i.x||e.yi.y&&t.y>i.y)return!1;let a=h(e,t,n[0]);return a!==h(e,t,n[1])||a!==h(e,t,n[2])||a!==h(e,t,n[3])}function ao(e,t,n){let r=t.paint.get(e).value;return r.kind===`constant`?r.value:n.programConfigurations.get(t.id).getMaxValue(e)}function oo(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function so(e,t,n,r,i){if(!t[0]&&!t[1])return e;let a=E.convert(t)._mult(i);n===`viewport`&&a._rotate(-r);let o=[];for(let t=0;te.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw RangeError(`out of range source coordinates for image copy`);if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw RangeError(`out of range destination coordinates for image copy`);let o=e.data,s=t.data;if(o===s)throw Error(`srcData equals dstData, so image is already copied`);for(let c=0;c{t[e.evaluationKey]=a;let o=e.expression.evaluate(t);i.data[n+r+0]=Math.floor(255*o.r/o.a),i.data[n+r+1]=Math.floor(255*o.g/o.a),i.data[n+r+2]=Math.floor(255*o.b/o.a),i.data[n+r+3]=Math.floor(255*o.a)};if(e.clips)for(let t=0,i=0;t80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;at&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return Io(a,o,s,c,l),o}function Po(e,t,n,r,i){let a=null;if(i===function(e,t,n,r){let i=0;for(let a=t,o=n-r;a0)for(let i=t;i=t;i-=r)a=hs(i/r|0,e[i],e[i+1],a);return a&&us(a,a.next)&&(gs(a),a=a.next),a}function Fo(e,t=e){let n=t===e,r,i=e;do r=!1,i===i.next||jo.size!==0&&jo.has(i)||!us(i,i.next)&&ls(i.prev,i,i.next)!==0?(n||i!==t)&&(i=i.next,r=!n):((n||i===t)&&(t=i.prev),Mo=!0,gs(i),i=i.prev,r=!0);while(r||i!==t);return t}function Io(e,t,n,r,i){i&&function(e,t,n,r){let i=e,a=0;do i.z=as(i.x,i.y,t,n,r),$o[a++]=i,i=i.next;while(i!==e);(function(e){if(e<=32)for(let t=1;t=0&&$o[r].z>n;)$o[r+1]=$o[r],r--;$o[r+1]=e}else{ts.length=l&&p.x<=d&&p.y>=u&&p.y<=f&&(r!==p.x||o!==p.y)&&ss(r,o,i,s,a,c,p.x,p.y)&&ls(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Ro(e,t,n,r){let i=e.prev,a=e.next,o=i.x,s=e.x,c=a.x,l=i.y,u=e.y,d=a.y,f=Math.min(o,s,c),p=Math.min(l,u,d),m=Math.max(o,s,c),h=Math.max(l,u,d),g=as(f,p,t,n,r),_=as(m,h,t,n,r),v=e.prevZ;for(;v&&v.z>=g;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=h&&v!==a&&(o!==v.x||l!==v.y)&&ss(o,l,s,u,c,d,v.x,v.y)&&ls(v.prev,v,v.next)>=0)return!1;v=v.prevZ}let y=e.nextZ;for(;y&&y.z<=_;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=h&&y!==a&&(o!==y.x||l!==y.y)&&ss(o,l,s,u,c,d,y.x,y.y)&&ls(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function zo(e,t){let n=e,r=!1;do{let i=n.prev,a=n.next.next;ds(i,n,n.next,a,!1)&&ps(i,a)&&ps(a,i)&&(t.push(i.i,n.i,a.i),gs(n),gs(n.next),n=e=a,r=!0),n=n.next}while(n!==e);return r?Fo(n):n}function Bo(e,t,n,r,i){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&cs(a,e)){let o=ms(a,e);a=Fo(a,a.next),o=Fo(o,o.next),Io(a,t,n,r,i),Io(o,t,n,r,i);return}e=e.next}a=a.next}while(a!==e)}let Vo=!1;function Ho(e,t){return e.x-t.x||e.y-t.y||(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}function Uo(e,t){let n=function(e,t){let n=t,r=e.x,i=e.y,a,o=-1/0;if(us(e,n))return n;for(let t=0,s=0;tGo[s+3]||Go[s]>r||Go[s+2]<=o)continue;let c=Xo(t);n=Zo(t);do{if(n.prev.next===n){if(us(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>o&&(o=e,a=n.xr||Go[f+3]u)continue;let p=Xo(t);n=Zo(t);do{if(n.prev.next===n&&r>=n.x&&n.x>=s&&r!==n.x&&ss(ir)&&(ta.x||n.x===a.x&&Qo(a,n)))&&(a=n,d=t)}n=n.next}while(n!==p)}return a}(e,t);if(!n)return t;let r=ms(n,e);return Yo(n,r.next.next),Fo(r,r.next),Fo(n,n.next)}let Wo=16,Go=new Float64Array,Ko=0,qo=[],Jo=[];function Yo(e,t){let n=e;do{let e=Ko++;qo[e]=n;let r=1/0,i=1/0,a=-1/0,o=-1/0,s=0;do{let t=n.next;n.z=e,n.xa&&(a=n.x),n.yo&&(o=n.y),t.xa&&(a=t.x),t.yo&&(o=t.y),n=t}while(++s<16&&n!==t);Jo[e]=n;let c=4*e;Go[c]=r,Go[c+1]=i,Go[c+2]=a,Go[c+3]=o}while(n!==t)}function Xo(e){let t=Jo[e];for(;t.prev.next!==t;)t=t.next;return Jo[e]=t,t}function Zo(e){let t=qo[e];for(;t.prev.next!==t;)t=t.next;return qo[e]=t,t}function Qo(e,t){return ls(e.prev,e,t.prev)<0&&ls(t.next,e,e.next)<0}let $o=[],es=[],ts=new Uint32Array,ns=new Uint32Array,rs=new Uint32Array(256);function is(e,t,n,r,i,a){rs.fill(0);for(let t=0;t>>a&255]++;let o=0;for(let e=0;e<256;e++){let t=rs[e];rs[e]=o,o+=t}for(let o=0;o>>a&255]++;r[s]=t[o],i[s]=e}}function as(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function os(e){let t=e,n=e;do(t.x=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function cs(e,t){let n=us(e,t)&&ls(e.prev,e,e.next)>0&&ls(t.prev,t,t.next)>0;return e.next.i!==t.i&&(n||ps(e,t)&&ps(t,e)&&(ls(e.prev,e,t.prev)!==0||ls(e,t.prev,t)!==0))&&!function(e,t){let n=Math.min(e.x,t.x),r=Math.max(e.x,t.x),i=Math.min(e.y,t.y),a=Math.max(e.y,t.y),o=e;do{let s=o.next;if(o.x>r&&s.x>r||o.xa&&s.y>a||o.ya!=e.y>a&&i<(e.x-n.x)*(a-n.y)/(e.y-n.y)+n.x&&(r=!r),n=e}while(n!==e);return r}(e,t))}function ls(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function us(e,t){return e.x===t.x&&e.y===t.y}function ds(e,t,n,r,i=!0){let a=ls(e,t,n),o=ls(e,t,r),s=ls(n,r,e),c=ls(n,r,t);return(a>0&&o<0||a<0&&o>0)&&(s>0&&c<0||s<0&&c>0)||!!i&&(!(a!==0||!fs(e,n,t))||!(o!==0||!fs(e,r,t))||!(s!==0||!fs(n,e,r))||!(c!==0||!fs(n,t,r)))}function fs(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ps(e,t){return ls(e.prev,e,e.next)<0?ls(e,t,e.next)>=0&&ls(e,e.prev,t)>=0:ls(e,t,e.prev)<0||ls(e,e.next,t)<0}function ms(e,t){let n=_s(e.i,e.x,e.y),r=_s(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function hs(e,t,n,r){let i=_s(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function gs(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ),Vo&&function(e,t){let n=4*e.z;t.xGo[n+2]&&(Go[n+2]=t.x),t.y>Go[n+3]&&(Go[n+3]=t.y)}(e.prev,e.next)}function _s(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function vs(e,t,n=0,r=e.length-1,i=bs){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);vs(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(ys(e,n,t),i(e[r],a)>0&&ys(e,n,r);o0;)s--}i(e[n],a)===0?ys(e,n,s):(s++,ys(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function ys(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function bs(e,t){return et)}function xs(e,t){let n=e.length;if(n<=1)return[e];let r=[],i,a;for(let t=0;t1)for(let e=0;ee.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Xi,this.indexArray=new ca,this.indexArray2=new la,this.programConfigurations=new Ra(e.layers,e.zoom),this.segments=new da,this.segments2=new da,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){this.hasPattern=Cs(`fill`,this.layers,t);let r=this.layers[0].layout.get(`fill-sort-key`),i=!r.isConstant(),a=[];for(let{feature:o,id:s,index:c,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,u=Ga(o,e);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),u,n))continue;let d=i?r.evaluate(u,{},n,t.availableImages):void 0,f={id:s,properties:o.properties,type:o.type,sourceLayerIndex:l,index:c,geometry:e?u.geometry:Wa(o),patterns:{},sortKey:d};a.push(f)}i&&a.sort((e,t)=>e.sortKey-t.sortKey);for(let r of a){let{geometry:i,index:a,sourceLayerIndex:o}=r;if(this.hasPattern){let e=ws(`fill`,this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,i,a,n,{});t.featureIndex.insert(e[a].feature,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ao),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,n,r,i){for(let e of xs(t,500)){let t=0;for(let n of e)t+=n.length;let n=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),r=n.vertexLength,i=[],a=[];for(let t of e){if(t.length===0)continue;t!==e[0]&&a.push(i.length/2);let n=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),r=n.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(r+t.length-1,r),i.push(t[0].x),i.push(t[0].y);for(let e=1;e>3,a===0)continue}if(a--,i===1)o+=e.readSVarint(),s+=e.readSVarint(),r&&n.push(r),r=[new E(o,s)];else if(i===2)o+=e.readSVarint(),s+=e.readSVarint(),r&&r.push(new E(o,s));else{if(i!==7)throw Error(`unknown command ${i}`);r&&r.push(r[0].clone())}}return r&&n.push(r),n}bbox(){if(this._geometry<0)throw Error(`feature has no geometry`);let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,n=1,r=0,i=0,a=0,o=1/0,s=-1/0,c=1/0,l=-1/0;for(;e.pos>3,r===0)continue}if(r--,n===1||n===2)i+=e.readSVarint(),a+=e.readSVarint(),is&&(s=i),al&&(l=a);else if(n!==7)throw Error(`unknown command ${n}`)}return[o,c,s,l]}toGeoJSON(e,t,n){let r=this.extent*2**n,i=this.extent*e,a=this.extent*t,o=this.loadGeometry();function s(e){return[360*(e.x+i)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+a)/r)*Math.PI))-90]}function c(e){return e.map(s)}let l;if(this.type===1){let e=[];for(let t of o)e.push(t[0]);let t=c(e);l=e.length===1?{type:`Point`,coordinates:t[0]}:{type:`MultiPoint`,coordinates:t}}else if(this.type===2){let e=o.map(c);l=e.length===1?{type:`LineString`,coordinates:e[0]}:{type:`MultiLineString`,coordinates:e}}else{if(this.type!==3)throw Error(`unknown feature type`);{let e=function(e){let t=e.length;if(t<=1)return[e];let n=[],r,i;for(let a=0;a=this._features.length)throw Error(`feature index out of bounds`);this._pbf.pos=this._features[e];let t=this._pbf.readVarint()+this._pbf.pos;return new As(this._pbf,t,this.extent,this._keys,this._values)}}function Ns(e){let t=null,n=e.readVarint()+e.pos;for(;e.posVa)||e.y===t.y&&(e.y<0||e.y>Va)}function Is(e){return e.x>=0&&e.x<=Va&&e.y>=0&&e.y<=Va}function Ls(e){return e.every(e=>e.x<0)||e.every(e=>e.x>Va)||e.every(e=>e.y<0)||e.every(e=>e.y>Va)}let Rs=8192;function zs(e,t,n,r,i,a,o,s){e.emplaceBack(t,n,2*Math.floor(r*Rs)+o,i*Rs*2,a*Rs*2,Math.round(s))}class Bs{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Zi,this.centroidVertexArray=new Ji,this.indexArray=new ca,this.programConfigurations=new Ra(e.layers,e.zoom),this.segments=new da,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){this.features=[],this.hasPattern=Cs(`fill-extrusion`,this.layers,t);for(let{feature:r,id:i,index:a,sourceLayerIndex:o}of e){let e=this.layers[0]._featureFilter.needGeometry,s=Ga(r,e);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),s,n))continue;let c={id:i,sourceLayerIndex:o,index:a,geometry:e?s.geometry:Wa(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(ws(`fill-extrusion`,this.layers,c,this.zoom,t)):this.addFeature(c,c.geometry,a,n,{}),t.featureIndex.insert(r,c.geometry,a,o,this.index,!0)}}addFeatures(e,t,n){for(let e of this.features){let{geometry:r}=e;this.addFeature(e,r,e.index,t,n)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Os.members),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ks.members),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,n,r,i){for(let n of xs(t,500)){let t={x:0,y:0,vertexCount:0},r=0;for(let e of n)r+=e.length;let i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let e of n){if(e.length===0||Ls(e))continue;let n=0;for(let r=0;r=1){let o=e[r-1];if(!Fs(a,o)){i.vertexLength+4>da.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let e=a.sub(o)._perp()._unit(),r=o.dist(a);n+r>32768&&(n=0),zs(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,0,n),zs(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,1,n),t.x+=2*a.x,t.y+=2*a.y,t.vertexCount+=2,n+=r,zs(this.layoutVertexArray,o.x,o.y,e.x,e.y,0,0,n),zs(this.layoutVertexArray,o.x,o.y,e.x,e.y,0,1,n),t.x+=2*o.x,t.y+=2*o.y,t.vertexCount+=2;let s=i.vertexLength;this.indexArray.emplaceBack(s,s+2,s+1),this.indexArray.emplaceBack(s+1,s+2,s+3),i.vertexLength+=4,i.primitiveLength+=2}}}}if(i.vertexLength+r>da.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(r,this.layoutVertexArray,this.indexArray)),As.types[e.type]!==`Polygon`)continue;let a=[],o=[],s=i.vertexLength;for(let e of n)if(e.length!==0){e!==n[0]&&o.push(a.length/2);for(let n=0;ne.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new Qi,this.layoutVertexArray2=new ea,this.indexArray=new ca,this.programConfigurations=new Ra(e.layers,e.zoom),this.segments=new da,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){this.hasPattern=Cs(`line`,this.layers,t);let r=this.layers[0].layout.get(`line-sort-key`),i=!r.isConstant(),a=[];for(let{feature:t,id:o,index:s,sourceLayerIndex:c}of e){let e=this.layers[0]._featureFilter.needGeometry,l=Ga(t,e);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),l,n))continue;let u=i?r.evaluate(l,{},n):void 0,d={id:o,properties:t.properties,type:t.type,sourceLayerIndex:c,index:s,geometry:e?l.geometry:Wa(t),patterns:{},sortKey:u};a.push(d)}i&&a.sort((e,t)=>e.sortKey-t.sortKey);for(let r of a){let{geometry:i,index:a,sourceLayerIndex:o}=r;if(this.hasPattern){let e=ws(`line`,this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,i,a,n,{});t.featureIndex.insert(e[a].feature,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Gs)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ws),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,`mapbox_clip_start`)&&Object.prototype.hasOwnProperty.call(e.properties,`mapbox_clip_end`))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,n,r,i){let a=this.layers[0].layout,o=a.get(`line-join`).evaluate(e,{}),s=a.get(`line-cap`),c=a.get(`line-miter-limit`),l=a.get(`line-round-limit`);this.lineClips=this.lineFeatureClips(e);for(let n of t)this.addLine(n,e,o,s,c,l);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,i,r)}addLine(e,t,n,r,i,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t=2&&e[s-1].equals(e[s-2]);)s--;let c=0;for(;c0;if(x&&t>c){let e=d.dist(f);if(e>2*l){let t=d.sub(d.sub(f)._mult(l/e)._round());this.updateDistance(f,t),this.addCurrentVertex(t,m,0,0,u),f=t}}let C=f&&p,w=C?n:o?`butt`:r;if(C&&w===`round`&&(yi&&(w=`bevel`),w===`bevel`&&(y>2&&(w=`flipbevel`),y100)g=h.mult(-1);else{let e=y*m.add(h).mag()/m.sub(h).mag();g._perp()._mult(e*(S?-1:1))}this.addCurrentVertex(d,g,0,0,u),this.addCurrentVertex(d,g.mult(-1),0,0,u)}else if(w===`bevel`||w===`fakeround`){let e=-Math.sqrt(y*y-1),t=S?e:0,n=S?0:e;if(f&&this.addCurrentVertex(d,m,t,n,u),w===`fakeround`){let e=Math.round(180*b/Math.PI/20);for(let t=1;t2*l){let t=d.add(p.sub(d)._mult(l/e)._round());this.updateDistance(d,t),this.addCurrentVertex(t,h,0,0,u),d=t}}}}addCurrentVertex(e,t,n,r,i,a=!1){let o=t.y*r-t.x,s=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*n,t.y-t.x*n,a,!1,n,i),this.addHalfVertex(e,o,s,a,!0,-r,i),this.distance>qs/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,t,n,r,i,a))}addHalfVertex({x:e,y:t},n,r,i,a,o,s){let c=.5*(this.lineClips?this.scaledDistance*(qs-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+ +!!i,(t<<1)+ +!!a,Math.round(63*n)+128,Math.round(63*r)+128,1+(o===0?0:o<0?-1:1)|(63&c)<<2,c>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let l=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),s.primitiveLength++),a?this.e2=l:this.e1=l}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}q(`LineBucket`,Js,{omit:[`layers`,`patternFeatures`]});let Ys=new si({"line-cap":new X(M.layout_line[`line-cap`]),"line-join":new Z(M.layout_line[`line-join`]),"line-miter-limit":new X(M.layout_line[`line-miter-limit`]),"line-round-limit":new X(M.layout_line[`line-round-limit`]),"line-sort-key":new Z(M.layout_line[`line-sort-key`])});var Xs={paint:new si({"line-opacity":new Z(M.paint_line[`line-opacity`]),"line-color":new Z(M.paint_line[`line-color`]),"line-translate":new X(M.paint_line[`line-translate`]),"line-translate-anchor":new X(M.paint_line[`line-translate-anchor`]),"line-width":new Z(M.paint_line[`line-width`]),"line-gap-width":new Z(M.paint_line[`line-gap-width`]),"line-offset":new Z(M.paint_line[`line-offset`]),"line-blur":new Z(M.paint_line[`line-blur`]),"line-dasharray":new ai(M.paint_line[`line-dasharray`]),"line-pattern":new ii(M.paint_line[`line-pattern`]),"line-gradient":new oi(M.paint_line[`line-gradient`])}),layout:Ys};let Zs=new class extends Z{possiblyEvaluate(e,t){return t=new Yr(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,r){return t=o({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,r)}}(Xs.paint.properties[`line-width`].specification);function Qs(e,t){return t>0?t+2*e:e}Zs.useIntegerZoom=!0;var $s={paint:new si({"line-extrusion-opacity":new X(M[`paint_line-extrusion`][`line-extrusion-opacity`]),"line-extrusion-color":new Z(M[`paint_line-extrusion`][`line-extrusion-color`]),"line-extrusion-width":new Z(M[`paint_line-extrusion`][`line-extrusion-width`]),"line-extrusion-translate":new X(M[`paint_line-extrusion`][`line-extrusion-translate`]),"line-extrusion-translate-anchor":new X(M[`paint_line-extrusion`][`line-extrusion-translate-anchor`]),"line-extrusion-pattern":new ii(M[`paint_line-extrusion`][`line-extrusion-pattern`]),"line-extrusion-height":new Z(M[`paint_line-extrusion`][`line-extrusion-height`]),"line-extrusion-base":new Z(M[`paint_line-extrusion`][`line-extrusion-base`])})};let ec=di([{name:`a_pos`,components:2,type:`Int16`},{name:`a_data`,components:3,type:`Uint8`}],4);class tc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new $i,this.indexArray=new ca,this.programConfigurations=new Ra(e.layers,e.zoom),this.segments=new da,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){this.features=[];for(let{feature:r,id:i,index:a,sourceLayerIndex:o}of e){let e=this.layers[0]._featureFilter.needGeometry,s=Ga(r,e);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),s,n))continue;let c={id:i,sourceLayerIndex:o,index:a,geometry:e?s.geometry:Wa(r),properties:r.properties,type:r.type,patterns:{}};this.addFeature(c,c.geometry,a,n,{}),t.featureIndex.insert(r,c.geometry,a,o,this.index,!0)}}addFeatures(e,t,n){for(let e of this.features){let{geometry:r}=e;this.addFeature(e,r,e.index,t,n)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ec.members),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,n,r,i){for(let e of xs(t,500)){let t=[];for(let n of e){if(n.length===0)continue;let e,r=!1,i=n[0];for(let a=1;a=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,this.e3),r.primitiveLength++),this.e1=this.e2,this.e2=this.e3,this.layoutVertexArray.emplaceBack(e.x,e.y,Math.round(63*-t.x)+128,Math.round(63*-t.y)+128,n),this.e3=r.vertexLength++,this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,this.e3),r.primitiveLength++),this.e1=this.e2,this.e2=this.e3}}function nc(e,t){return e.vertex.equals(t.vertex)&&e.normal.equals(t.normal)&&e.t===t.t}q(`LineExtrusionBucket`,tc,{omit:[`layers`,`features`]});let rc=new si({"symbol-placement":new X(M.layout_symbol[`symbol-placement`]),"symbol-spacing":new X(M.layout_symbol[`symbol-spacing`]),"symbol-avoid-edges":new X(M.layout_symbol[`symbol-avoid-edges`]),"symbol-sort-key":new Z(M.layout_symbol[`symbol-sort-key`]),"symbol-z-order":new X(M.layout_symbol[`symbol-z-order`]),"symbol-placement-priority":new Z(M.layout_symbol[`symbol-placement-priority`]),"icon-always-allow-overlap":new X(M.layout_symbol[`icon-always-allow-overlap`]),"icon-image-url":new Z(M.layout_symbol[`icon-image-url`]),"subtext-field":new Z(M.layout_symbol[`subtext-field`]),"subtext-font":new Z(M.layout_symbol[`subtext-font`]),"subtext-size":new Z(M.layout_symbol[`subtext-size`]),"subtext-max-width":new Z(M.layout_symbol[`subtext-max-width`]),"icon-allow-overlap":new X(M.layout_symbol[`icon-allow-overlap`]),"icon-ignore-placement":new X(M.layout_symbol[`icon-ignore-placement`]),"icon-optional":new X(M.layout_symbol[`icon-optional`]),"icon-rotation-alignment":new X(M.layout_symbol[`icon-rotation-alignment`]),"icon-size":new Z(M.layout_symbol[`icon-size`]),"icon-text-fit":new X(M.layout_symbol[`icon-text-fit`]),"icon-text-fit-padding":new X(M.layout_symbol[`icon-text-fit-padding`]),"icon-image":new Z(M.layout_symbol[`icon-image`]),"icon-rotate":new Z(M.layout_symbol[`icon-rotate`]),"icon-padding":new X(M.layout_symbol[`icon-padding`]),"icon-keep-upright":new X(M.layout_symbol[`icon-keep-upright`]),"icon-offset":new Z(M.layout_symbol[`icon-offset`]),"icon-anchor":new Z(M.layout_symbol[`icon-anchor`]),"icon-pitch-alignment":new X(M.layout_symbol[`icon-pitch-alignment`]),"text-pitch-alignment":new X(M.layout_symbol[`text-pitch-alignment`]),"text-rotation-alignment":new X(M.layout_symbol[`text-rotation-alignment`]),"text-field":new Z(M.layout_symbol[`text-field`]),"text-font":new Z(M.layout_symbol[`text-font`]),"text-size":new Z(M.layout_symbol[`text-size`]),"text-max-width":new Z(M.layout_symbol[`text-max-width`]),"text-line-height":new X(M.layout_symbol[`text-line-height`]),"text-letter-spacing":new Z(M.layout_symbol[`text-letter-spacing`]),"text-justify":new Z(M.layout_symbol[`text-justify`]),"text-radial-offset":new Z(M.layout_symbol[`text-radial-offset`]),"text-variable-anchor":new X(M.layout_symbol[`text-variable-anchor`]),"text-anchor":new Z(M.layout_symbol[`text-anchor`]),"text-max-angle":new X(M.layout_symbol[`text-max-angle`]),"text-writing-mode":new X(M.layout_symbol[`text-writing-mode`]),"text-rotate":new Z(M.layout_symbol[`text-rotate`]),"text-padding":new X(M.layout_symbol[`text-padding`]),"text-keep-upright":new X(M.layout_symbol[`text-keep-upright`]),"text-transform":new Z(M.layout_symbol[`text-transform`]),"text-offset":new Z(M.layout_symbol[`text-offset`]),"text-allow-overlap":new X(M.layout_symbol[`text-allow-overlap`]),"text-ignore-placement":new X(M.layout_symbol[`text-ignore-placement`]),"text-optional":new X(M.layout_symbol[`text-optional`])});var ic={paint:new si({"icon-opacity":new Z(M.paint_symbol[`icon-opacity`]),"icon-color":new Z(M.paint_symbol[`icon-color`]),"icon-halo-color":new Z(M.paint_symbol[`icon-halo-color`]),"icon-halo-width":new Z(M.paint_symbol[`icon-halo-width`]),"icon-halo-blur":new Z(M.paint_symbol[`icon-halo-blur`]),"icon-translate":new X(M.paint_symbol[`icon-translate`]),"icon-translate-anchor":new X(M.paint_symbol[`icon-translate-anchor`]),"text-opacity":new Z(M.paint_symbol[`text-opacity`]),"text-color":new Z(M.paint_symbol[`text-color`],{runtimeType:ge,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Z(M.paint_symbol[`text-halo-color`],{runtimeType:ge,getOverride:e=>e.textHaloColor,hasOverride:e=>!!e.textHaloColor}),"text-halo-width":new Z(M.paint_symbol[`text-halo-width`],{runtimeType:R,getOverride:e=>e.textHaloWidth,hasOverride:e=>!!e.textHaloWidth}),"text-halo-blur":new Z(M.paint_symbol[`text-halo-blur`]),"text-translate":new X(M.paint_symbol[`text-translate`]),"text-translate-anchor":new X(M.paint_symbol[`text-translate-anchor`]),"subtext-color":new Z(M.paint_symbol[`subtext-color`]),"subtext-halo-color":new Z(M.paint_symbol[`subtext-halo-color`]),"subtext-halo-width":new Z(M.paint_symbol[`subtext-halo-width`])}),layout:rc};let ac=di([{name:`a_pos_offset`,components:4,type:`Int16`},{name:`a_data`,components:4,type:`Uint16`},{name:`a_pixeloffset`,components:4,type:`Int16`}],4),oc=di([{name:`a_projected_pos`,components:3,type:`Float32`}],4);di([{name:`a_fade_opacity`,components:1,type:`Uint32`}],4);let sc=di([{name:`a_placed`,components:2,type:`Uint8`},{name:`a_shift`,components:2,type:`Float32`}]);di([{type:`Int16`,name:`anchorPointX`},{type:`Int16`,name:`anchorPointY`},{type:`Int16`,name:`x1`},{type:`Int16`,name:`y1`},{type:`Int16`,name:`x2`},{type:`Int16`,name:`y2`},{type:`Uint32`,name:`featureIndex`},{type:`Uint16`,name:`sourceLayerIndex`},{type:`Uint16`,name:`bucketIndex`}]);let cc=di([{name:`a_pos`,components:2,type:`Int16`},{name:`a_anchor_pos`,components:2,type:`Int16`},{name:`a_extrude`,components:2,type:`Int16`}],4),lc=di([{name:`a_pos`,components:2,type:`Float32`},{name:`a_radius`,components:1,type:`Float32`},{name:`a_flags`,components:2,type:`Int16`}],4);function uc(e,t,n){return e.sections.forEach(e=>{e.text=function(e,t,n){let r=t.layout.get(`text-transform`).evaluate(n,{});return r===`uppercase`?e=e.toLocaleUpperCase():r===`lowercase`&&(e=e.toLocaleLowerCase()),Jr.applyArabicShaping&&(e=Jr.applyArabicShaping(e)),e}(e.text,t,n)}),e}di([{name:`triangle`,components:3,type:`Uint16`}]),di([{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`}]),di([{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`,components:2,name:`textOffset`},{type:`Float32`,name:`collisionCircleDiameter`},{type:`Uint8`,name:`forceCollision`}]),di([{type:`Float32`,name:`offsetX`}]),di([{type:`Int16`,name:`x`},{type:`Int16`,name:`y`},{type:`Int16`,name:`tileUnitDistanceFromAnchor`}]);let dc={"!":`︕`,"#":`#`,$:`$`,"%":`%`,"&":`&`,"(":`︵`,")":`︶`,"*":`*`,"+":`+`,",":`︐`,"-":`︲`,".":`・`,"/":`/`,":":`︓`,";":`︔`,"<":`︿`,"=":`=`,">":`﹀`,"?":`︖`,"@":`@`,"[":`﹇`,"\\":`\`,"]":`﹈`,"^":`^`,_:`︳`,"`":```,"{":`︷`,"|":`―`,"}":`︸`,"~":`~`,"¢":`¢`,"£":`£`,"¥":`¥`,"¦":`¦`,"¬":`¬`,"¯":` ̄`,"–":`︲`,"—":`︱`,"‘":`﹃`,"’":`﹄`,"“":`﹁`,"”":`﹂`,"…":`︙`,"‧":`・`,"₩":`₩`,"、":`︑`,"。":`︒`,"〈":`︿`,"〉":`﹀`,"《":`︽`,"》":`︾`,"「":`﹁`,"」":`﹂`,"『":`﹃`,"』":`﹄`,"【":`︻`,"】":`︼`,"〔":`︹`,"〕":`︺`,"〖":`︗`,"〗":`︘`,"!":`︕`,"(":`︵`,")":`︶`,",":`︐`,"-":`︲`,".":`・`,":":`︓`,";":`︔`,"<":`︿`,">":`﹀`,"?":`︖`,"[":`﹇`,"]":`﹈`,"_":`︳`,"{":`︷`,"|":`―`,"}":`︸`,"⦅":`︵`,"⦆":`︶`,"。":`︒`,"「":`﹁`,"」":`﹂`,"←":`↑`,"→":`↓`};var fc=24;let pc=4294967296,mc=1/pc,hc=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`);class gc{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t,n=this.length){let r;for(;r=this.nextField(n);)e(r,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*pc;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*pc;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let t=this.buf,n=t[this.pos++];if(n<128)return n;let r,i=127&n;return r=t[this.pos++],i|=(127&r)<<7,r<128?i:(r=t[this.pos++],i|=(127&r)<<14,r<128?i:(r=t[this.pos++],i|=(127&r)<<21,r<128?i:(r=t[this.pos],i|=(15&r)<<28,function(e,t,n){let r=n.buf,i,a;if(a=r[n.pos++],i=(112&a)>>4,a<128||(a=r[n.pos++],i|=(127&a)<<3,a<128)||(a=r[n.pos++],i|=(127&a)<<10,a<128)||(a=r[n.pos++],i|=(127&a)<<17,a<128)||(a=r[n.pos++],i|=(127&a)<<24,a<128)||(a=r[n.pos++],i|=(1&a)<<31,a<128))return _c(e,i,t);throw Error(`Expected varint not more than 10 bytes`)}(i,e,this))))}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&hc?hc.decode(this.buf.subarray(t,e)):function(e,t,n){let r=``,i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+l>n)break;l===1?t<128&&(c=t):l===2?(a=e[i+1],(192&a)==128&&(c=(31&t)<<6|63&a,c<=127&&(c=null))):l===3?(a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(c=(15&t)<<12|(63&a)<<6|63&o,(c<=2047||c>=55296&&c<=57343)&&(c=null))):l===4&&(a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(c=(15&t)<<18|(63&a)<<12|(63&o)<<6|63&s,(c<=65535||c>=1114112)&&(c=null))),c===null?(c=65533,l=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),i+=l}return r}(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let n=this.readPackedEnd();for(;this.pos=e)return 0;let t=this.readVarint();return this.type=7&t,this._valueStart=this.pos,t>>>3}skip(e){let t=7&e;if(t===0)for(;this.buf[this.pos++]>127;);else if(t===2)this.pos=this.readVarint()+this.pos;else if(t===5)this.pos+=4;else{if(t!==1)throw Error(`Unimplemented type: ${t}`);this.pos+=8}}}function _c(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function vc(e,t,n){let r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));n.realloc(r),n.buf.copyWithin(e+r,e,n.pos)}function yc(e,t){let n=e.length,r=t.buf,i=t.pos,a=t.length;for(let o=0;oa)t.pos=i,t.writeVarint(n),r=t.buf,i=t.pos,a=t.length;else{for(;n>127;)r[i++]=n%128|128,n=Math.floor(n/128);r[i++]=n}}t.pos=i}function bc(e,t){for(let n=0;nt.h-e.h);let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}],i=0,a=0;for(let t of e)for(let e=r.length-1;e>=0;e--){let n=r[e];if(!(t.w>n.w||t.h>n.h)){if(t.x=n.x,t.y=n.y,a=Math.max(a,t.y+t.h),i=Math.max(i,t.x+t.w),t.w===n.w&&t.h===n.h){let t=r.pop();t&&e=0&&n>=e&&Rc[this.text.charCodeAt(n)];n--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){let n=new Ic;return n.text=this.text.substring(e,t),n.sectionIndex=this.sectionIndex.slice(e,t),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.max(e,this.sections[t].scale),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(Fc.forText(e.scale,e.fontStack||t,e.isSubText));let n=this.sections.length-1;for(let t=0;t=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Lc(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=Ic.fromFeature(t,a),y;p===e.au.vertical&&v.verticalizePunctuation();let{processBidirectionalText:b,processStyledBidirectionalText:x}=Jr;if(b&&v.sections.length===1){y=[];let e=b(v.toString(),Kc(v,d,o,s,n,i,h,g));for(let t of e){let e=new Ic;e.text=t,e.sections=v.sections;for(let n=0;n0&&r>x&&(x=r)}else{let e=r[h.fontStack],t=e&&e[_];if(t&&t.rect)C=t.rect,y=t.metrics;else{let e=n[h.fontStack],t=e&&e[_];if(!t)continue;y=t.metrics}v=(a-h.scale)*fc}E?(t.verticalizable=!0,b.push({glyph:_,imageName:w,x:p,y:m+v,vertical:E,scale:h.scale,fontStack:h.fontStack,sectionIndex:g,metrics:y,rect:C}),p+=T*h.scale+u):(b.push({glyph:_,imageName:w,x:p,y:m+v,vertical:E,scale:h.scale,fontStack:h.fontStack,sectionIndex:g,metrics:y,rect:C}),p+=y.advance*h.scale+u)}b.length!==0&&(h=Math.max(p-u,h),$c(b,0,b.length-1,_,x)),p=0;let C=o*a+x;y.lineOffset=Math.max(x,c),m+=C,g=Math.max(C,g),++v}let y=m- -17,{horizontalAlign:b,verticalAlign:x}=qc(s);(function(e,t,n,r,i,a,o,s,c){let l=(t-n)*i,u=0;u=a===o?(-r*c+.5)*o:-s*r- -17;for(let t of e)for(let e of t.positionedGlyphs)e.x+=l,e.y+=u})(t.positionedLines,_,b,x,h,g,o,y,a.length),t.top+=-x*y,t.bottom=t.top+y,t.left+=-b*h,t.right=t.left+h}(C,n,r,i,y,c,l,u,p,d,m,_),!function(e){for(let t of e)if(t.positionedGlyphs.length!==0)return!1;return!0}(S)&&C}let Rc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},zc={40:!0},Bc={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};function Vc(e,t,n,r,i,a){if(t.imageName){let e=r[t.imageName];return e?e.displaySize[0]*t.scale*fc/a+i:0}{let r=n[t.fontStack],a=r&&r[e];return a?a.metrics.advance*t.scale+i:0}}function Hc(e,t,n,r){let i=(e-t)**2;return r?e=0,d=0;for(let n=0;nJc(e)||function(e){return RegExp(`[\\p{P}\\p{S}]`,`u`).test(String.fromCharCode(e))}(e)),n=e.length<=3&&e.every(e=>Yc(e)||Jc(e));return t||n}function Zc(e){return(Jc(e)||Yc(e))&&!jr(e)}function Qc(e){let t=e.text.split(``),n=t.map(e=>e.charCodeAt(0)),r=n.map(e=>kr(e)),i=t=>!r[t]&&!Rc[n[t]]&&!e.getSection(t).imageName;for(let e=0;ee.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyVisible=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=po([]),this.placementViewportMatrix=po([]);let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=rl(this.zoom,n[`text-size`]),this.iconSizeData=rl(this.zoom,n[`icon-size`]);let r=this.layers[0].layout,i=r.get(`symbol-sort-key`),a=r.get(`symbol-z-order`);this.canOverlap=r.get(`text-allow-overlap`)||r.get(`icon-allow-overlap`)||r.get(`text-ignore-placement`)||r.get(`icon-ignore-placement`),this.sortFeaturesByKey=a!==`viewport-y`&&i.constantOr(1)!==void 0,this.sortFeaturesByY=(a===`viewport-y`||a===`auto`&&!this.sortFeaturesByKey)&&this.canOverlap,r.get(`symbol-placement`)===`point`&&(this.writingModes=r.get(`text-writing-mode`).map(t=>e.au[t])),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=t.sourceID}createArrays(){this.text=new ll(new Ra(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new ll(new Ra(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Wi,this.lineVertexArray=new Gi,this.symbolInstances=new Ui}calculateGlyphDependencies(e,t,n,r,i){for(let a=0;a0)&&(o.value.kind!==`constant`||o.value.value.length>0),p=(l.value.kind!==`constant`||l.value.value.toString().length>0)&&(c.value.kind!==`constant`||c.value.value.length>0),m=u.value.kind!==`constant`||!!u.value.value||Object.keys(u.parameters).length>0,h=d.value.kind!==`constant`||!!d.value.value||Object.keys(d.parameters).length>0,g=a.get(`symbol-sort-key`);if(this.features=[],!f&&!m&&!h)return;let _=n.iconDependencies,v=n.glyphDependencies,y=n.availableImages,b=n.language,x=n.pixelRatio,S=new Yr(this.zoom),C=b&&b!==`ko`&&a.get(`symbol-placement`)!==`line`?il.fromMetadata(i.metadata):null;for(let{feature:n,id:s,index:l,sourceLayerIndex:u}of t){let t=i._featureFilter.needGeometry,d=Ga(n,t);if(!i._featureFilter.filter(S,d,r))continue;let w;t||(d.geometry=Wa(n));let T,E=p;if(f){let e=i.getValueAndResolveTokens(`text-field`,d,r,y,b),t=Me.factory(e);if(C&&t.sections.length===1){let e=C.scaleForTag(b),n=C.baseScale;if(e!==1||n!==1){let r=t.sections[0].text,i=r.indexOf(` `);if(i>0&&i=0;for(let e of w.sections)if(e.image)_[e.image.name]=!0;else{let r=Tr(w.toString()),i=e.fontStack||t,a=v[i]=v[i]||{};this.calculateGlyphDependencies(e.text,a,n,this.allowVerticalPlacement,r)}}}a.get(`symbol-placement`)===`line`&&(this.features=function(e){let t={},n={},r=[],i=0;function a(t){r.push(e[t]),i++}function o(e,t,i){let a=n[e];return delete n[e],n[t]=a,r[a].geometry[0].pop(),r[a].geometry[0]=r[a].geometry[0].concat(i[0]),a}function s(e,n,i){let a=t[n];return delete t[n],t[e]=a,r[a].geometry[0].shift(),r[a].geometry[0]=i[0].concat(r[a].geometry[0]),a}function c(e,t,n){let r=n?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let l=0;le.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,t)=>e.sortKey-t.sortKey)}update(e,t,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){let n=this.lineVertexArray.length;if(e.segment!==void 0){let n=e.dist(t[e.segment+1]),r=e.dist(t[e.segment]),i={};for(let r=e.segment+1;r=0;n--)i[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:r},n>0&&(r+=t[n-1].dist(t[n]));for(let e=0;e0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){let n=e.placedSymbolArray.get(t),r=n.vertexStartIndex+4*n.numGlyphs;for(let t=n.vertexStartIndex;tr[e]-r[t]||i[t]-i[e]),a}addToSortKeyRanges(e,t){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===t?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach((e,t,n)=>{e>=0&&n.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)}),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}function fl(e,t,n,r){if(!n||n===`ko`)return r&&(t=function(e,t){return e.replace(/{ratio}/g,t>1?`@2x`:``)}(t,r)),pl(e,t);let i=pl(e,t.replace(/{([^{}]+)}/g,(e,t)=>`{${t}:${n}}`)),a=pl(e,t);return a===i?i:a&&i?`${i}\n${a}`:`${i}${a}`}function pl(e,t){return t.replace(/{([^{}]+)}/g,(t,n)=>e&&n in e?String(e[n]):``)}q(`SymbolBucket`,dl,{omit:[`layers`,`collisionBoxArray`,`features`,`compareText`]}),dl.MAX_GLYPHS=65535,dl.addDynamicAttributes=sl;class ml{constructor(e){if(e.property.overrides===void 0)throw Error(`overrides must be provided to instantiate FormatSectionOverride class`);this.type=e.property.overrides?e.property.overrides.runtimeType:he,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}q(`FormatSectionOverride`,ml,{omit:[`defaultValue`]});class hl extends ci{constructor(e){super(e,ic)}recalculate(e,t){if(super.recalculate(e,t),this.layout.get(`icon-rotation-alignment`)===`auto`&&(this.layout._values[`icon-rotation-alignment`]=this.layout.get(`symbol-placement`)===`point`?`viewport`:`map`),this.layout.get(`text-rotation-alignment`)===`auto`&&(this.layout._values[`text-rotation-alignment`]=this.layout.get(`symbol-placement`)===`point`?`viewport`:`map`),this.layout.get(`text-pitch-alignment`)===`auto`&&(this.layout._values[`text-pitch-alignment`]=this.layout.get(`text-rotation-alignment`)),this.layout.get(`icon-pitch-alignment`)===`auto`&&(this.layout._values[`icon-pitch-alignment`]=this.layout.get(`icon-rotation-alignment`)),this.layout.get(`symbol-placement`)===`point`){let e=this.layout.get(`text-writing-mode`);if(e){let t=[];for(let n of e)t.indexOf(n)<0&&t.push(n);this.layout._values[`text-writing-mode`]=t}else this.layout._values[`text-writing-mode`]=[`horizontal`]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,n,r,i){let a,o=!!i&&i!==`ko`;if(o){a=d(t);let e=a.properties||{},n=`:${i}`;for(let t of Object.keys(e)){if(!t.endsWith(n))continue;let r=e[t];if(!r)continue;let i=t.slice(0,-n.length),a=e[i];a!==r&&(e[i]=a?`${r}\n${a}`:r)}}let s=this.layout.get(e).evaluate(o?a:t,{},n,r),c=this._unevaluatedLayout._values[e];return c.isDataDriven()||kn(c.value)||!s?s:fl(t.properties,s,i)}getResolvedIconImageUrl(e,t,n){let r=this.layout.get(`icon-image-url`).evaluate(e,{},t);return fl(e.properties,r,null,n)}createBucket(e){return new dl(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error(`Should take a different path in FeatureIndex`)}_setPaintOverrides(){for(let e of ic.paint.overridableProperties){if(!hl.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),n=new ml(t),r=new On(n,t.property.specification),i=null;i=t.value.kind===`constant`||t.value.kind===`source`?new jn(`source`,r):new Mn(`composite`,r,t.value.zoomStops,t.value._interpolationType),this.paint._values[e]=new ni(t.property,i,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!(!this.layout||t.isDataDriven()||n.isDataDriven())&&hl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let n=e.get(`text-field`),r=ic.paint.properties[t],i=!1,a=e=>{for(let t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(i=!0)};if(n.value.kind===`constant`&&n.value.value instanceof Me)a(n.value.value.sections);else if(n.value.kind===`source`){let e=t=>{i||(t instanceof Re&&Ie(t.value)===H?a(t.value.sections):t instanceof W?a(t.sections):t.eachChild(e))},t=n.value;t._styleExpression&&e(t._styleExpression.expression)}return i}}var gl={paint:new si({"background-color":new X(M.paint_background[`background-color`]),"background-pattern":new ai(M.paint_background[`background-pattern`]),"background-opacity":new X(M.paint_background[`background-opacity`])})},_l={paint:new si({"raster-opacity":new X(M.paint_raster[`raster-opacity`]),"raster-hue-rotate":new X(M.paint_raster[`raster-hue-rotate`]),"raster-brightness-min":new X(M.paint_raster[`raster-brightness-min`]),"raster-brightness-max":new X(M.paint_raster[`raster-brightness-max`]),"raster-saturation":new X(M.paint_raster[`raster-saturation`]),"raster-contrast":new X(M.paint_raster[`raster-contrast`]),"raster-resampling":new X(M.paint_raster[`raster-resampling`]),"raster-fade-duration":new X(M.paint_raster[`raster-fade-duration`])})};class vl extends ci{constructor(e){super(e,{}),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode===`3d`}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error(`Custom layers cannot be serialized`)}}var yl={paint:new si({"mesh-batch-color":new X(M[`paint_mesh-batch`][`mesh-batch-color`]),"mesh-batch-translate":new X(M[`paint_mesh-batch`][`mesh-batch-translate`]),"mesh-batch-translate-anchor":new X(M[`paint_mesh-batch`][`mesh-batch-translate-anchor`]),"mesh-batch-opacity":new X(M[`paint_mesh-batch`][`mesh-batch-opacity`]),"mesh-batch-height-ratio":new Z(M[`paint_mesh-batch`][`mesh-batch-height-ratio`]),"mesh-batch-cast-shadows":new X(M[`paint_mesh-batch`][`mesh-batch-cast-shadows`])})};let bl=di([{name:`a_pos`,type:`Float32`,components:3},{name:`a_normal`,type:`Int16`,components:3}],1),xl=di([{name:`a_pos`,type:`Float32`,components:3},{name:`a_normal`,type:`Int16`,components:3},{name:`a_texture_pos0`,type:`Float32`,components:2},{name:`a_texture_pos1`,type:`Float32`,components:2}],1);function Sl(e,t,n,r){return new(n||(n=Promise))(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})}let Cl=5120,wl=5121,Tl=5122,El=5123,Dl=5124,Ol=5125,kl=5126,Al={[Cl]:Int8Array,[wl]:Uint8Array,[Tl]:Int16Array,[El]:Uint16Array,[Dl]:Int32Array,[Ol]:Uint32Array,[kl]:Float32Array},jl={[Cl]:`DT_INT8`,[wl]:`DT_UINT8`,[Tl]:`DT_INT16`,[El]:`DT_UINT16`,[Dl]:`DT_INT32`,[Ol]:`DT_UINT32`,[kl]:`DT_FLOAT32`},Ml={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Nl=`KHR_draco_mesh_compression`,Pl=`https://ssl.pstatic.net/static/maps/mantle/draco/1.5.7`,Fl={DECODER:`${Pl}/draco_wasm_wrapper.js`,DECODER_WASM:`${Pl}/draco_decoder.wasm`},Il,Ll,Rl=new TextDecoder(`utf8`);function zl(e,t){return new URL(e,t).href}function Bl(e,t=0){return new Uint32Array(e,t,1)[0]===1179937895}function Vl(e,t){var n;let r=(n=t.extensions)==null?void 0:n[Nl];if(!r)return;let{bufferView:i,attributes:a}=r,o=new Il.Decoder,s=new Il.DecoderBuffer,c=Hl(e,i);s.Init(c,c.length);let l=o.GetEncodedGeometryType(s);if(l!==Il.TRIANGULAR_MESH)throw Error(`Unsupported Draco geometry type: ${l}`);let u=new Il.Mesh,d=o.DecodeBufferToMesh(s,u);if(!d.ok())throw Error(`Draco decoding failed: ${d.error_msg()}`);for(let n in a){let r=o.GetAttributeByUniqueId(u,a[n]),i=e.json.accessors[t.attributes[n]],s=Al[i.componentType],c=jl[i.componentType],l=r.num_components(),d=u.num_points(),f=d*l*s.BYTES_PER_ELEMENT,p=Il._malloc(f);o.GetAttributeDataArrayForAllPoints(u,r,Il[c],f,p);let m=l*d,h,g;if(s===Float32Array)h=new Float32Array(Il.HEAPF32.buffer,p,m),g=new Float32Array(h);else if(s===Uint8Array)h=new Uint8Array(Il.HEAPU8.buffer,p,m),g=new Uint8Array(h);else if(s===Int8Array)h=new Int8Array(Il.HEAP8.buffer,p,m),g=new Int8Array(h);else if(s===Uint16Array)h=new Uint16Array(Il.HEAPU16.buffer,p,m),g=new Uint16Array(h);else if(s===Int16Array)h=new Int16Array(Il.HEAP16.buffer,p,m),g=new Int16Array(h);else if(s===Uint32Array)h=new Uint32Array(Il.HEAPU32.buffer,p,m),g=new Uint32Array(h);else{if(s!==Int32Array)throw Error(`Unsupported array type for accessor component type: ${i.componentType}`);h=new Int32Array(Il.HEAP32.buffer,p,m),g=new Int32Array(h)}Il._free(p),Ul(e,i,g.buffer)}let f=e.json.accessors[t.indices],p=Al[f.componentType],m=3*u.num_faces(),h=m*p.BYTES_PER_ELEMENT,g=Il._malloc(h),_,v;p===Uint16Array?(o.GetTrianglesUInt16Array(u,h,g),_=new Uint16Array(Il.HEAPU16.buffer,g,m),v=new Uint16Array(_)):(o.GetTrianglesUInt32Array(u,h,g),_=new Uint32Array(Il.HEAPU32.buffer,g,m),v=new Uint32Array(_)),Il._free(g),Ul(e,f,v.buffer),Il.destroy(u),Il.destroy(s),Il.destroy(o),delete t.extensions[Nl]}function Hl(e,t){let{json:n,buffers:r}=e,i=n.bufferViews[t];return new Uint8Array(r[i.buffer],i.byteOffset||0,i.byteLength)}function Ul(e,t,n){let r=e.json.bufferViews.length,i=e.buffers.length;t.bufferView=r,e.json.bufferViews[r]={buffer:i,byteLength:n.byteLength},e.buffers[i]=n}function Wl(e,t){let n=e.json.accessors[t];if(!n||n.bufferView===void 0)return null;let r=e.json.bufferViews[n.bufferView],i=e.buffers[r.buffer],a=Al[n.componentType],o=(r.byteOffset||0)+(n.byteOffset||0),s=n.count*Ml[n.type];return a===Float32Array?new Float32Array(i,o,s):a===Uint8Array?new Uint8Array(i,o,s):a===Int8Array?new Int8Array(i,o,s):a===Uint16Array?new Uint16Array(i,o,s):a===Int16Array?new Int16Array(i,o,s):a===Uint32Array?new Uint32Array(i,o,s):a===Int32Array?new Int32Array(i,o,s):null}function Gl(e){return Sl(this,arguments,void 0,function*(e,t=0,n){let r={json:null,images:[],buffers:[]};if(Bl(e,t)){let n=new DataView(e),i=n.getUint32(t+4,!0),a=n.getUint32(t+8,!0);if(i!==2)throw Error(`GLB version ${i} is not supported. Only supports version 2.`);if(a<20)throw Error(`Invalid GLB file: File size (${a} bytes) is too small.`);let o=n.getUint32((t+=12)+0,!0);if(n.getUint32(t+4,!0)!==1313821514)throw Error(`Invalid GLB file: First chunk must be of type JSON.`);if(t+=8,r.json=JSON.parse(Rl.decode(new Uint8Array(n.buffer,t,o))),(t+=o)Sl(this,void 0,void 0,function*(){try{_()?self.importScripts(Fl.DECODER):(n=Fl.DECODER,yield new Promise((e,t)=>{let r=document.createElement(`script`);r.src=n,r.onload=()=>e(),r.onerror=()=>t(Error(`Failed to load script: ${n}`)),document.body.appendChild(r)}));let r=self.DracoDecoderModule||window.DracoDecoderModule;if(!r)throw Error(`DracoDecoderModule not found after loading script`);r({locateFile:e=>e.endsWith(`.wasm`)?Fl.DECODER_WASM:e}).then(t=>{Il=t,Ll=void 0,e()}).catch(e=>{Ll=void 0,t(Error(`Failed to initialize Draco decoder: ${e.message}`))})}catch(e){Ll=void 0,t(Error(`Failed to load Draco decoder script: ${e.message}`))}var n})),Ll)})}()),a&&(yield function(e,t){return Sl(this,void 0,void 0,function*(){let n=(e.json.images||[]).map((n,r)=>Sl(this,void 0,void 0,function*(){let i=yield function(e,t,n){return Sl(this,void 0,void 0,function*(){var r;if(t.bufferView!==void 0){let n=Hl(e,t.bufferView);return new Blob([n],{type:t.mimeType||`image/png`})}if(t.uri){if(t.uri.startsWith(`data:`)){let[e,n]=t.uri.split(`,`),i=((r=e.match(/data:(.*?);/))==null?void 0:r[1])||`image/png`,a=atob(n),o=new Uint8Array(a.length);for(let e=0;eda.MAX_VERTEX_ARRAY_LENGTH&&(l=n.prepareSegment(0,e,t,o()),u++,c.fill(-1));for(let e=0;e<3;e++){let t=i[r+e];c[t]===-1&&(c[t]=l.vertexLength++,a(t))}t.emplaceBack(c[i[r]],c[i[r+1]],c[i[r+2]]),l.primitiveLength++}return u}function Yl(e,t,n,r,i){let a=e.json.meshes||[],o=[],s=0;for(let e of a)for(let a of e.primitives){if(!a)continue;let{indices:e,numVertices:c,imageIndex:l,addVertex:u}=i(a),d=Jl(t,n,r,c,e,u,()=>s++);if(l!==void 0)for(let e=0;e{let{attributes:r}=n,i=Wl(e,r.POSITION),a=Wl(e,r.NORMAL);return{indices:Wl(e,n.indices),numVertices:i.length/3,addVertex:e=>{let n=0,r=0,o=1;a&&(n=a[3*e],r=a[3*e+2],o=a[3*e+1]),t.emplaceBack(i[3*e],i[3*e+2],i[3*e+1],n*Kl*2,r*Kl*2,o*Kl*2)}}})}class Zl{constructor(e){this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.hasPattern=!1,this.layoutVertexArray=new na,this.indexArray=new ca,this.programConfigurations=new Ra(e.layers,e.zoom),this.segments=new da,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,n){}evaluate(e){Xl(e,this.layoutVertexArray,this.indexArray,this.segments)}update(e,t,n){}isEmpty(){return this.layoutVertexArray.length===0}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,bl.members),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}}q(`MeshBatchBucket`,Zl,{omit:[`layers`]});let Ql=new si({"mesh-object-type":new Z(M[`layout_mesh-object`][`mesh-object-type`]),"mesh-object-name":new Z(M[`layout_mesh-object`][`mesh-object-name`]),"mesh-object-rotate":new Z(M[`layout_mesh-object`][`mesh-object-rotate`]),"mesh-object-scale":new Z(M[`layout_mesh-object`][`mesh-object-scale`]),"mesh-object-center-lat":new Z(M[`layout_mesh-object`][`mesh-object-center-lat`]),"mesh-object-center-lng":new Z(M[`layout_mesh-object`][`mesh-object-center-lng`]),"mesh-object-half-width":new Z(M[`layout_mesh-object`][`mesh-object-half-width`]),"mesh-object-half-height":new Z(M[`layout_mesh-object`][`mesh-object-half-height`])});var $l={paint:new si({"mesh-object-color":new X(M[`paint_mesh-object`][`mesh-object-color`]),"mesh-object-translate":new X(M[`paint_mesh-object`][`mesh-object-translate`]),"mesh-object-translate-anchor":new X(M[`paint_mesh-object`][`mesh-object-translate-anchor`]),"mesh-object-opacity":new X(M[`paint_mesh-object`][`mesh-object-opacity`]),"mesh-object-height-ratio":new Z(M[`paint_mesh-object`][`mesh-object-height-ratio`]),"mesh-object-cast-shadows":new X(M[`paint_mesh-object`][`mesh-object-cast-shadows`])}),layout:Ql};class eu{constructor(e){this.name=e,this.position=[0,0],this.rotation=0,this.scale=1}}class tu{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.modelUris=[]}populate(e,t,n){this.features=[];for(let{feature:t,id:r,index:i,sourceLayerIndex:a}of e){let e=this.layers[0]._featureFilter.needGeometry,o=Ga(t,e);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),o,n))continue;let s={id:r,sourceLayerIndex:a,index:i,geometry:e?o.geometry:Wa(t),properties:t.properties,type:t.type,patterns:{}};this.addFeature(s,s.geometry,o,i,n)}}isEmpty(){return!this.features||this.features.length===0}upload(){}destroy(){}update(e,t,n){}uploadPending(){return!1}addFeature(e,t,n,r,i){let a=this.layers[0].layout;for(let n of t)for(let t of n){let n=t.x,r=t.y;if(n<0||n>=Va||r<0||r>=Va)continue;let o=a.get(`mesh-object-name`).evaluate(e,{},i),s=a.get(`mesh-object-center-lng`).evaluate(e,{},i),c=a.get(`mesh-object-center-lat`).evaluate(e,{},i),l=a.get(`mesh-object-half-width`).evaluate(e,{},i),u=a.get(`mesh-object-half-height`).evaluate(e,{},i),d=a.get(`mesh-object-rotate`).evaluate(e,{},i),f=a.get(`mesh-object-scale`).evaluate(e,{},i),p=new eu(o);p.position=[n,r],p.rotation=d,p.scale=f,p.bounds=[s-l,c-u,s+l,c+u],this.features.push(p),this.modelUris.indexOf(o)===-1&&this.modelUris.push(o)}}}q(`MeshObjectBucket`,tu,{omit:[`layers`]}),q(`MeshObjectFeature`,eu);let nu={circle:class extends ci{constructor(e){super(e,lo)}createBucket(e){return new qa(e)}queryRadius(e){let t=e;return ao(`circle-radius`,this,t)+ao(`circle-stroke-width`,this,t)+oo(this.paint.get(`circle-translate`))}queryIntersectsFeature(e,t,n,r,i,a,o,s){let c=so(e,this.paint.get(`circle-translate`),this.paint.get(`circle-translate-anchor`),a.angle,o),l=this.paint.get(`circle-radius`).evaluate(t,n)+this.paint.get(`circle-stroke-width`).evaluate(t,n),u=this.paint.get(`circle-pitch-alignment`)===`map`,d=u?c:function(e,t){return e.map(e=>yo(e,t))}(c,s),f=u?l*o:l;for(let e of r)for(let t of e){let e=u?t:yo(t,s),n=f,r=vo(go(),_o(t.x,t.y,0,1),s);if(this.paint.get(`circle-pitch-scale`)===`viewport`&&this.paint.get(`circle-pitch-alignment`)===`map`?n*=r[3]/a.cameraToCenterDistance:this.paint.get(`circle-pitch-scale`)===`map`&&this.paint.get(`circle-pitch-alignment`)===`viewport`&&(n*=a.cameraToCenterDistance/r[3]),Ya(d,e,n))return!0}return!1}},heatmap:class extends ci{createBucket(e){return new bo(e)}constructor(e){super(e,xo),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e===`heatmap-color`&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Do({expression:this._transitionablePaint._values[`heatmap-color`].value.expression,evaluationKey:`heatmapDensity`,image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Oo)&&this.heatmapFbos.delete(Oo)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get(`heatmap-opacity`)!==0&&this.visibility!==`none`}},hillshade:class extends ci{constructor(e){super(e,ko)}hasOffscreenPass(){return this.paint.get(`hillshade-exaggeration`)!==0&&this.visibility!==`none`}},fill:class extends ci{constructor(e){super(e,Ds)}recalculate(e,t){super.recalculate(e,t);let n=this.paint._values[`fill-outline-color`];n.value.kind===`constant`&&n.value.value===void 0&&(this.paint._values[`fill-outline-color`]=this.paint._values[`fill-color`])}createBucket(e){return new Ts(e)}queryRadius(){return oo(this.paint.get(`fill-translate`))}queryIntersectsFeature(e,t,n,r,i,a,o){return Xa(so(e,this.paint.get(`fill-translate`),this.paint.get(`fill-translate-anchor`),a.angle,o),r)}isTileClipped(){return!0}},"fill-extrusion":class extends ci{constructor(e){super(e,Vs)}createBucket(e){return new Bs(e)}queryRadius(){return oo(this.paint.get(`fill-extrusion-translate`))}is3D(){return!0}queryIntersectsFeature(e,t,n,r,i,a,o,s){let c=so(e,this.paint.get(`fill-extrusion-translate`),this.paint.get(`fill-extrusion-translate-anchor`),a.angle,o),l=this.paint.get(`fill-extrusion-height`).evaluate(t,n),u=this.paint.get(`fill-extrusion-base`).evaluate(t,n),d=function(e,t){let n=[];for(let r of e){let e=_o(r.x,r.y,0,1);vo(e,e,t),n.push(new E(e[0]/e[3],e[1]/e[3]))}return n}(c,s),f=function(e,t,n,r){let i=[],a=[],o=r[8]*t,s=r[9]*t,c=r[10]*t,l=r[11]*t,u=r[8]*n,d=r[9]*n,f=r[10]*n,p=r[11]*n;for(let t of e){let e=[],n=[];for(let i of t){let t=i.x,a=i.y,m=r[0]*t+r[4]*a+r[12],h=r[1]*t+r[5]*a+r[13],g=r[2]*t+r[6]*a+r[14],_=r[3]*t+r[7]*a+r[15],v=g+c,y=_+l,b=m+u,x=h+d,S=g+f,C=_+p,w=new E((m+o)/y,(h+s)/y);w.z=v/y,e.push(w);let T=new E(b/C,x/C);T.z=S/C,n.push(T)}i.push(e),a.push(n)}return[i,a]}(r,u,l,s);return function(e,t,n){let r=1/0;Xa(n,t)&&(r=Us(n,t[0]));for(let i=0;i=3){for(let t=0;t{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel&&this._channel.port2&&(this._channel.port2.onmessage=void 0),this._channel=void 0,this._callback=()=>{}}}let iu=6371008.8;class au{constructor(e,t){if(isNaN(e)||isNaN(t))throw Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw Error(`Invalid LngLat latitude value: must be between -90 and 90`)}wrap(){return new au(a(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let t=Math.PI/180,n=this.lat*t,r=e.lat*t,i=Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return iu*Math.acos(Math.min(i,1))}static convert(e){if(e instanceof au)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new au(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e==`object`&&e)return new au(Number(`lng`in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}let ou=2*Math.PI*iu;function su(e){return ou*Math.cos(e*Math.PI/180)}function cu(e){return(180+e)/360}function lu(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function uu(e,t){return e/su(t)}function du(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function fu(e,t){return e*su(du(t))}class pu{constructor(e,t,n=0){this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e,t=0){let n=au.convert(e);return new pu(cu(n.lng),lu(n.lat),uu(t,n.lat))}toLngLat(){return new au(360*this.x-180,du(this.y))}toAltitude(){return fu(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ou*(e=du(this.y),1/Math.cos(e*Math.PI/180));var e}}function mu(e,t,n){var r=2*Math.PI*6378137/256/2**n;return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class hu{constructor(e,t,n){if(e<0||e>25||n<0||n>=2**e||t<0||t>=2**e)throw Error(`x=${t}, y=${n}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t,this.y=n,this.key=vu(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,n){let r=(a=this.y,o=this.z,s=mu(256*(i=this.x),256*(a=2**o-a-1),o),c=mu(256*(i+1),256*(a+1),o),s[0]+`,`+s[1]+`,`+c[0]+`,`+c[1]);var i,a,o,s,c;let l=function(e,t,n){let r,i=``;for(let a=e;a>0;a--)r=1<1?`@2x`:``).replace(`{quadkey}`,l).replace(`{bbox-epsg-3857}`,r)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=2**this.z;return new E((e.x*t-this.x)*Va,(e.y*t-this.y)*Va)}toString(){return`${this.z}/${this.x}/${this.y}`}}class gu{constructor(e,t){this.wrap=e,this.canonical=t,this.key=vu(e,t.z,t.z,t.x,t.y)}}class _u{constructor(e,t,n,r,i){if(e= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=t,this.canonical=new hu(n,+r,+i),this.key=vu(t,e,n,r,i)}clone(){return new _u(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let t=this.canonical.z-e;return e>this.canonical.z?new _u(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new _u(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?vu(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):vu(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let t=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new _u(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,n=2*this.canonical.x,r=2*this.canonical.y;return[new _u(t,this.wrap,t,n,r),new _u(t,this.wrap,t,n+1,r),new _u(t,this.wrap,t,n,r+1),new _u(t,this.wrap,t,n+1,r+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=n),n=this.dim+1||t<-1||t>=this.dim+1)throw RangeError(`out of range source coordinates for DEM data`);return(t+1)*this.stride+(e+1)}_unpackMapbox(e,t,n){return(256*e*256+256*t+n)/10-1e4}_unpackTerrarium(e,t,n){return 256*e+t+n/256-32768}getPixels(){return new Eo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,n){if(this.dim!==e.dim)throw Error(`dem dimension mismatch`);let r=t*this.dim,i=t*this.dim+this.dim,a=n*this.dim,o=n*this.dim+this.dim;switch(t){case-1:r=i-1;break;case 1:i=r+1}switch(n){case-1:a=o-1;break;case 1:o=a+1}let s=-t*this.dim,c=-n*this.dim;for(let t=a;t=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class xu{constructor(e,t,n,r,i){this.type=`Feature`,this._vectorTileFeature=e,e._z=t,e._x=n,e._y=r,this.properties=Object.assign({},e.properties),this.id=i}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i=0&&r[3]>=0&&s.insert(o,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ps(new gc(this.rawTileData)).layers,this.sourceLayerCoder=new bu(this.vtLayers?Object.keys(this.vtLayers).sort():[`_geojsonTileLayer`])),this.vtLayers}query(e,t,n,r){this.loadVTLayers();let i=e.params||{},a=Va/e.tileSize/e.scale,o=Wn(i.filter),s=e.queryGeometry,c=e.queryPadding*a,l=wu(s),u=this.grid.query(l.minX-c,l.minY-c,l.maxX+c,l.maxY+c),d=wu(e.cameraQueryGeometry),f=this.grid3D.query(d.minX-c,d.minY-c,d.maxX+c,d.maxY+c,(t,n,r,i)=>function(e,t,n,r,i){for(let a of e)if(t<=a.x&&n<=a.y&&r>=a.x&&i>=a.y)return!0;let a=[new E(t,n),new E(t,i),new E(r,i),new E(r,n)];if(e.length>2){for(let t of a)if(ro(e,t))return!0}for(let t=0;t(f||(f=Wa(t)),n.queryIntersectsFeature(s,t,r,f,this.z,e.transform,a,e.pixelPosMatrix)))}return p}loadMatchingFeature(e,t,n,r,i,a,s,c,l,u,d){let f=this.bucketLayerIDs[t];if(a&&!function(e,t){for(let n=0;n=0)return!0;return!1}(a,f))return;let p=this.sourceLayerCoder.decode(n),m=this.vtLayers[p].feature(r),h=this.dynamicPropertiesTileData;if(h&&h.properties&&h.properties.length>0){let e=h[`mapping-key`];for(let t of h.properties)t[e]===m.properties[e]&&o(m.properties,t)}if(i.needGeometry){let e=Ga(m,!0);if(!i.filter(new Yr(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!i.filter(new Yr(this.tileID.overscaledZ),m))return;let g=this.getId(m,p);for(let t=0;t{let o=t instanceof ri?t.get(a):null;return o&&o.evaluate?o.evaluate(n,r,i):o})}function wu(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return{minX:t,minY:n,maxX:r,maxY:i}}function Tu(e,t){return t-e}function Eu(e,t,n,r,i){let a=[];for(let o=0;o=r&&l.x>=r||(o.x>=r?o=new E(r,o.y+(r-o.x)/(l.x-o.x)*(l.y-o.y))._round():l.x>=r&&(l=new E(r,o.y+(r-o.x)/(l.x-o.x)*(l.y-o.y))._round()),o.y>=i&&l.y>=i||(o.y>=i?o=new E(o.x+(i-o.y)/(l.y-o.y)*(l.x-o.x),i)._round():l.y>=i&&(l=new E(o.x+(i-o.y)/(l.y-o.y)*(l.x-o.x),i)._round()),c&&o.equals(c[c.length-1])||(c=[o],a.push(c)),c.push(l)))))}}return a}q(`FeatureIndex`,Su,{omit:[`rawTileData`,`sourceLayerCoder`]});class Du extends E{constructor(e,t,n,r){super(e,t),this.angle=n,r!==void 0&&(this.segment=r)}clone(){return new Du(this.x,this.y,this.angle,this.segment)}}function Ou(e,t,n,r,i){if(t.segment===void 0||n===0)return!0;let a=t,o=t.segment+1,s=0;for(;s>-n/2;){if(o--,o<0)return!1;s-=e[o].dist(a),a=e[o]}s+=e[o].dist(e[o+1]),o++;let c=[],l=0;for(;sr;)l-=c.shift().angleDelta;if(l>i)return!1;o++,s+=t.dist(n)}return!0}function ku(e){let t=0;for(let n=0;nl){let u=(l-c)/a,d=G(r.x,i.x,u),f=G(r.y,i.y,u),p=new Du(d,f,i.angleTo(r),n);return p._round(),!o||Ou(e,p,s,o,t)?p:void 0}c+=a}}function Nu(e,t,n,r,i,a,o,s,c){let l=Au(r,a,o),u=ju(r,i),d=u*o,f=e[0].x===0||e[0].x===c||e[0].y===0||e[0].y===c;return t-d=0&&_=0&&v=0&&f+l<=u){let n=new Du(_,v,h,t);n._round(),r&&!Ou(e,n,a,r,i)||p.push(n)}}d+=m}return s||p.length||o||(p=Pu(e,d/2,n,r,i,a,o,!0,c)),p}function Fu(e,t,n,r){let i=[],a=e.image,o=a.pixelRatio,s=a.paddedRect.w-2,c=a.paddedRect.h-2,l=e.right-e.left,u=e.bottom-e.top,d=a.stretchX||[[0,s]],f=a.stretchY||[[0,c]],p=(e,t)=>e+t[1]-t[0],m=d.reduce(p,0),h=f.reduce(p,0),g=s-m,_=c-h,v=0,y=m,b=0,x=h,S=0,C=g,w=0,T=_;if(a.content&&r){let e=a.content;v=Iu(d,0,e[0]),b=Iu(f,0,e[1]),y=Iu(d,e[0],e[2]),x=Iu(f,e[1],e[3]),S=e[0]-v,w=e[1]-b,C=e[2]-e[0]-y,T=e[3]-e[1]-x}let D=(r,i,s,c)=>{let d=Ru(r.stretch-v,y,l,e.left),f=zu(r.fixed-S,C,r.stretch,m),p=Ru(i.stretch-b,x,u,e.top),g=zu(i.fixed-w,T,i.stretch,h),_=Ru(s.stretch-v,y,l,e.left),D=zu(s.fixed-S,C,s.stretch,m),O=Ru(c.stretch-b,x,u,e.top),k=zu(c.fixed-w,T,c.stretch,h),A=new E(d,p),j=new E(_,p),ee=new E(_,O),te=new E(d,O),ne=new E(f/o,g/o),re=new E(D/o,k/o),ie=t*Math.PI/180;if(ie){let e=Math.sin(ie),t=Math.cos(ie),n=[t,-e,e,t];A._matMult(n),j._matMult(n),te._matMult(n),ee._matMult(n)}let ae=r.stretch+r.fixed,oe=i.stretch+i.fixed;return{tl:A,tr:j,bl:te,br:ee,tex:{x:a.paddedRect.x+1+ae,y:a.paddedRect.y+1+oe,w:s.stretch+s.fixed-ae,h:c.stretch+c.fixed-oe},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ne,pixelOffsetBR:re,minFontScaleX:C/o/l,minFontScaleY:T/o/u,isSDF:n}};if(r&&(a.stretchX||a.stretchY)){let e=Lu(d,g,m),t=Lu(f,_,h);for(let n=0;n0&&(r=Math.max(10,r),this.circleDiameter=r)}else{let c=a.top*o-s,u=a.bottom*o+s,d=a.left*o-s,f=a.right*o+s,p=a.collisionPadding;if(p&&(d-=p[0]*o,c-=p[1]*o,f+=p[2]*o,u+=p[3]*o),l){let e=new E(d,c),t=new E(f,c),n=new E(d,u),r=new E(f,u),i=l*Math.PI/180;e._rotate(i),t._rotate(i),n._rotate(i),r._rotate(i),d=Math.min(e.x,t.x,n.x,r.x),f=Math.max(e.x,t.x,n.x,r.x),c=Math.min(e.y,t.y,n.y,r.y),u=Math.max(e.y,t.y,n.y,r.y)}e.emplaceBack(t.x,t.y,d,c,f,u,n,r,i)}this.boxEndIndex=e.length}}class Vu{constructor(e=[],t=(e,t)=>et)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,r=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){let{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e=0)break;t[e]=t[r],e=r}t[e]=i}}function Hu(e,t=1,n=!1){let r=1/0,i=1/0,a=-1/0,o=-1/0,s=e[0];for(let e=0;ea)&&(a=t.x),(!e||t.y>o)&&(o=t.y)}let c=Math.min(a-r,o-i),l=c/2,u=new Vu([],Uu);if(c===0)return new E(r,i);for(let t=r;td.d||!d.d)&&(d=n),n.max-d.d<=t||(l=n.h/2,u.push(new Wu(n.p.x-l,n.p.y-l,l,e)),u.push(new Wu(n.p.x+l,n.p.y-l,l,e)),u.push(new Wu(n.p.x-l,n.p.y+l,l,e)),u.push(new Wu(n.p.x+l,n.p.y+l,l,e)),f+=4)}return d.p}function Uu(e,t){return t.max-e.max}class Wu{constructor(e,t,n,r){this.p=new E(e,t),this.h=n,this.d=function(e,t){let n=!1,r=1/0;for(let i=0;ie.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n),r=Math.min(r,to(e,i,s))}}return(n?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}}let Gu=1/0;function Ku(e,t){return t[1]===Gu?function(e,t){let n=0,r=0;t<0&&(t=0);let i=t/Math.sqrt(2);switch(e){case`top-right`:case`top-left`:r=i-7;break;case`bottom-right`:case`bottom-left`:r=7-i;break;case`bottom`:r=7-t;break;case`top`:r=t-7}switch(e){case`top-right`:case`bottom-right`:n=-i;break;case`top-left`:case`bottom-left`:n=i;break;case`left`:n=t;break;case`right`:n=-t}return[n,r]}(e,t[0]):function(e,t,n){let r=0,i=0;switch(t=Math.abs(t),n=Math.abs(n),e){case`top-right`:case`top-left`:case`top`:i=n-7;break;case`bottom-right`:case`bottom-left`:case`bottom`:i=7-n}switch(e){case`top-right`:case`bottom-right`:case`right`:r=-t;break;case`top-left`:case`bottom-left`:case`left`:r=t}return[r,i]}(e,t[0],t[1])}function qu(e){switch(e){case`right`:case`top-right`:case`bottom-right`:return`right`;case`left`:case`top-left`:case`bottom-left`:return`left`}return`center`}function Ju(t,n,r,i,a,o,s,c,l,u,d){let f=o.textMaxSize.evaluate(n,{});f===void 0&&(f=s);let m=t.layers[0].layout,h=m.get(`icon-offset`).evaluate(n,{},d),g=Xu(r.horizontal),_=s/24,v=t.tilePixelRatio*_,y=t.tilePixelRatio*f/24,b=t.tilePixelRatio*c,x=t.tilePixelRatio*m.get(`symbol-spacing`),S=m.get(`text-padding`)*t.tilePixelRatio,C=m.get(`icon-padding`)*t.tilePixelRatio,w=m.get(`text-max-angle`)/180*Math.PI,T=m.get(`text-rotation-alignment`)===`map`&&m.get(`symbol-placement`)!==`point`,E=m.get(`icon-rotation-alignment`)===`map`&&m.get(`symbol-placement`)!==`point`,D=m.get(`symbol-placement`),O=x/2,k=m.get(`icon-text-fit`),A;i&&k!==`none`&&(t.allowVerticalPlacement&&r.vertical&&(A=tl(i,r.vertical,k,m.get(`icon-text-fit-padding`),h,_)),g&&(i=tl(i,g,k,m.get(`icon-text-fit-padding`),h,_)));let j=(c,f)=>{f.x<0||f.x>=Va||f.y<0||f.y>=Va||function(t,n,r,i,a,o,s,c,l,u,d,f,m,h,g,_,v,y,b,x,S,C,w,T,E){let D=t.addToLineVertexArray(n,r),O,k,A,j,ee=0,te=0,ne=0,re=0,ie=-1,ae=-1,oe={},se=ba(``),ce=0,le=0;if(c._unevaluatedLayout.getValue(`text-radial-offset`)===void 0?[ce,le]=c.layout.get(`text-offset`).evaluate(S,{},T).map(e=>e*fc):(ce=c.layout.get(`text-radial-offset`).evaluate(S,{},T)*fc,le=Gu),t.allowVerticalPlacement&&i.vertical){let e=c.layout.get(`text-rotate`).evaluate(S,{},T)+90;A=new Bu(l,n,u,d,f,i.vertical,m,h,g,e),s&&(j=new Bu(l,n,u,d,f,s,v,y,g,e))}if(a){let r=c.layout.get(`icon-rotate`).evaluate(S,{}),i=c.layout.get(`icon-text-fit`)!==`none`,o=Fu(a,r,w,i),m=s?Fu(s,r,w,i):void 0;k=new Bu(l,n,u,d,f,a,v,y,!1,r),ee=4*o.length;let h=t.iconSizeData,g=null;h.kind===`source`?(g=[128*c.layout.get(`icon-size`).evaluate(S,{})],g[0]>nl&&p(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):h.kind===`composite`&&(g=[128*C.compositeIconSizes[0].evaluate(S,{},T),128*C.compositeIconSizes[1].evaluate(S,{},T)],(g[0]>nl||g[1]>nl)&&p(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,o,g,x,b,S,!1,n,D.lineStartIndex,D.lineLength,-1,T),ie=t.icon.placedSymbolArray.length-1,m&&(te=4*m.length,t.addSymbols(t.icon,m,g,x,b,S,e.au.vertical,n,D.lineStartIndex,D.lineLength,-1,T),ae=t.icon.placedSymbolArray.length-1)}for(let r in i.horizontal){let a=i.horizontal[r];if(!O){se=ba(a.text);let e=c.layout.get(`text-rotate`).evaluate(S,{},T);O=new Bu(l,n,u,d,f,a,m,h,g,e)}let s=a.positionedLines.length===1;if(ne+=Yu(t,n,a,o,c,g,S,_,D,i.vertical?e.au.horizontal:e.au.horizontalOnly,s?Object.keys(i.horizontal):[r],oe,ie,C,T),s)break}i.vertical&&(re+=Yu(t,n,i.vertical,o,c,g,S,_,D,e.au.vertical,[`vertical`],oe,ae,C,T));let ue=O?O.boxStartIndex:t.collisionBoxArray.length,de=O?O.boxEndIndex:t.collisionBoxArray.length,fe=A?A.boxStartIndex:t.collisionBoxArray.length,M=A?A.boxEndIndex:t.collisionBoxArray.length,N=k?k.boxStartIndex:t.collisionBoxArray.length,P=k?k.boxEndIndex:t.collisionBoxArray.length,F=j?j.boxStartIndex:t.collisionBoxArray.length,I=j?j.boxEndIndex:t.collisionBoxArray.length,pe=-1,L=(e,t)=>e&&e.circleDiameter?Math.max(e.circleDiameter,t):t;pe=L(O,pe),pe=L(A,pe),pe=L(k,pe),pe=L(j,pe);let me=+(pe>-1);me&&(pe*=E/fc),t.glyphOffsetArray.length>=dl.MAX_GLYPHS&&p(`Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907`),S.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,S.sortKey),t.symbolInstances.emplaceBack(n.x,n.y,oe.right>=0?oe.right:-1,oe.center>=0?oe.center:-1,oe.left>=0?oe.left:-1,oe.vertical>=0?oe.vertical:-1,ie,ae,se,ue,de,fe,M,N,P,F,I,u,ne,re,ee,te,me,0,m,ce,le,pe,0)}(t,f,c,r,i,a,A,t.layers[0],t.collisionBoxArray,n.index,n.sourceLayerIndex,t.index,v,S,T,l,b,C,E,h,n,o,u,d,s)};if(D===`line`)for(let e of Eu(n.geometry,0,0,Va,Va)){let n=Nu(e,x,w,r.vertical||g,i,24,y,t.overscaling,Va);for(let r of n)g&&Zu(t,g.text,O,r)||j(e,r)}else if(D===`line-center`){for(let e of n.geometry)if(e.length>1){let t=Mu(e,w,r.vertical||g,i,24,y);t&&j(e,t)}}else if(n.type===`Polygon`)for(let e of xs(n.geometry,0)){let t=Hu(e,16);j(e[0],new Du(t.x,t.y,0))}else if(n.type===`LineString`)for(let e of n.geometry)j(e,new Du(e[0].x,e[0].y,0));else if(n.type===`Point`)for(let e of n.geometry)for(let t of e)j([t],new Du(t.x,t.y,0))}function Yu(e,t,n,r,i,a,o,s,c,l,u,d,f,m,h){let g=function(e,t,n,r,i,a,o,s){let c=r.layout.get(`text-rotate`).evaluate(a,{})*Math.PI/180,l=[];for(let e of t.positionedLines)for(let r of e.positionedGlyphs){if(!r.rect)continue;let a=r.rect||{},u=4,d=!0,f=1,p=0,m=(i||s)&&r.vertical,h=r.metrics.advance*r.scale/2;if(s&&t.verticalizable&&(p=e.lineOffset/2-(r.imageName?-(fc-r.metrics.width*r.scale)/2:(r.scale-1)*fc)),r.imageName){let e=o[r.imageName];d=e.sdf,f=e.pixelRatio,u=1/f}let g=i?[r.x+h,r.y]:[0,0],_=i?[0,0]:[r.x+h+n[0],r.y+n[1]-p],v=[0,0];m&&(v=_,_=[0,0]);let y=r.metrics.isDoubleResolution?2:1,b=(r.metrics.left-u)*r.scale-h+_[0],x=(-r.metrics.top-u)*r.scale+_[1],S=b+a.w/y*r.scale/f,C=x+a.h/y*r.scale/f,w=new E(b,x),T=new E(S,x),D=new E(b,C),O=new E(S,C);if(m){let e=new E(-h,h- -17),t=-Math.PI/2,n=12-h,i=new E(22-n,-(r.imageName?n:0)),a=new E(...v);w._rotateAround(t,e)._add(i)._add(a),T._rotateAround(t,e)._add(i)._add(a),D._rotateAround(t,e)._add(i)._add(a),O._rotateAround(t,e)._add(i)._add(a)}if(c){let e=Math.sin(c),t=Math.cos(c),n=[t,-e,e,t];w._matMult(n),T._matMult(n),D._matMult(n),O._matMult(n)}let k=new E(0,0),A=new E(0,0);l.push({tl:w,tr:T,bl:D,br:O,tex:a,writingMode:t.writingMode,glyphOffset:g,sectionIndex:r.sectionIndex,isSDF:d,pixelOffsetTL:k,pixelOffsetBR:A,minFontScaleX:0,minFontScaleY:0})}return l}(0,n,s,i,a,o,r,e.allowVerticalPlacement),_=e.textSizeData,v=null;_.kind===`source`?(v=[128*i.layout.get(`text-size`).evaluate(o,{})],v[0]>nl&&p(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):_.kind===`composite`&&(v=[128*m.compositeTextSizes[0].evaluate(o,{},h),128*m.compositeTextSizes[1].evaluate(o,{},h)],(v[0]>nl||v[1]>nl)&&p(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,v,s,a,o,l,t,c.lineStartIndex,c.lineLength,f,h);for(let t of u)d[t]=e.text.placedSymbolArray.length-1;return 4*g.length}function Xu(e){for(let t in e)return e[t];return null}function Zu(e,t,n,r){let i=e.compareText;if(t in i){let e=i[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])>4;if(r!==1)throw Error(`Got v${r} data when expected v1.`);let i=Qu[15&n];if(!i)throw Error(`Unrecognized array type.`);let[a]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new ed(o,a,i,void 0,e)}constructor(e,t=64,n=Float64Array,r=ArrayBuffer,i){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let a=Qu.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,c=(8-s%8)%8;if(a<0)throw Error(`Unexpected typed array class: ${n}.`);if(i)this.data=i,this.ids=new this.IndexArrayType(i,8,e),this.coords=new n(i,8+s+c,2*e),this._pos=2*e,this._finished=!0;else{let i=this.data=new r(8+o+s+c);this.ids=new this.IndexArrayType(i,8,e),this.coords=new n(i,8+s+c,2*e),this._pos=0,this._finished=!1,new Uint8Array(i,0,2).set([219,16+a]),new Uint16Array(i,2,1)[0]=t,new Uint32Array(i,4,1)[0]=e}}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return td(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this;$u[0]=0,$u[1]=i.length-1,$u[2]=0;let s=3,c=[];for(;s>0;){let l=$u[--s],u=$u[--s],d=$u[--s];if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&($u[s++]=d,$u[s++]=f-1,$u[s++]=1-l),(l===0?n>=p:r>=m)&&($u[s++]=f+1,$u[s++]=u,$u[s++]=1-l)}return c}within(e,t,n){let r=[];return this.withinInto(e,t,n,r),r}withinInto(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this;$u[0]=0,$u[1]=i.length-1,$u[2]=0;let s=3,c=0,l=n*n;for(;s>0;){let u=$u[--s],d=$u[--s],f=$u[--s];if(d-f<=o){for(let n=f;n<=d;n++)ad(a[2*n],a[2*n+1],e,t)<=l&&(r[c++]=i[n]);continue}let p=f+d>>1,m=a[2*p],h=a[2*p+1];ad(m,h,e,t)<=l&&(r[c++]=i[p]),(u===0?e-n<=m:t-n<=h)&&($u[s++]=f,$u[s++]=p-1,$u[s++]=1-u),(u===0?e+n>=m:t+n>=h)&&($u[s++]=p+1,$u[s++]=d,$u[s++]=1-u)}return c}}function td(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;nd(e,t,o,r,i,a),td(e,t,n,r,o-1,1-a),td(e,t,n,o+1,i,1-a)}function nd(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);nd(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(rd(e,t,r,n),t[2*i+a]>o&&rd(e,t,r,i);so;)c--}t[2*r+a]===o?rd(e,t,r,c):(c++,rd(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function rd(e,t,n,r){id(e,n,r),id(t,2*n,2*r),id(t,2*n+1,2*r+1)}function id(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function ad(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}var od;e.br=void 0,(od=e.br||(e.br={})).create=`create`,od.load=`load`,od.fullLoad=`fullLoad`;let sd=null,cd=[],ld=1e3/30;e.$=c,e.A=fo,e.B=na,e.C=Xl,e.D=xl,e.E=fe,e.F=bl,e.G=si,e.H=X,e.I=Mc,e.J=M,e.K=function([e,t,n]){return t+=90,t*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(n),y:e*Math.sin(t)*Math.sin(n),z:e*Math.cos(n)}},e.L=G,e.M=class extends Si{},e.N=Qr,e.O=gr,e.P=E,e.Q=yr,e.R=ee,e.S=da,e.T=ca,e.U=hr,e.V=function(){return s++},e.W=class{constructor(e,t,n){this.target=e,this.parent=t,this.mapId=n,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},c([`receive`,`process`],this),this.invoker=new ru(this.process),this.target.addEventListener(`message`,this.receive,!1),this.globalScope=_()?e:window}send(e,t,n,r,i=!1){let a=Math.round(0xde0b6b3a7640000*Math.random()).toString(36).substring(0,10);n&&(this.callbacks[a]=n);let o=S(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:e,hasCallback:!!n,targetMapId:r,mustQueue:i,sourceMapId:this.mapId,data:Cr(t,o)},o),{cancel:()=>{n&&delete this.callbacks[a],this.target.postMessage({id:a,type:``,targetMapId:r,sourceMapId:this.mapId})}}}receive(e){let t=e.data,n=t.id;if(n&&(!t.targetMapId||this.mapId===t.targetMapId)){if(t.type===``){delete this.tasks[n];let e=this.cancelCallbacks[n];delete this.cancelCallbacks[n],e&&e()}else _()||t.mustQueue?(this.tasks[n]=t,this.taskQueue.push(n),this.invoker.trigger()):this.processTask(n,t)}}process(){if(!this.taskQueue.length)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,t){if(t.type===``){let n=this.callbacks[e];delete this.callbacks[e],n&&(t.error?n(wr(t.error)):n(null,wr(t.data)))}else{let n=!1,r=S(this.globalScope)?void 0:[],i=t.hasCallback?(t,i)=>{n=!0,delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:``,sourceMapId:this.mapId,error:t?Cr(t):null,data:Cr(i,r)},r)}:e=>{n=!0},a=null,o=wr(t.data);try{if(this.parent[t.type])a=this.parent[t.type](t.sourceMapId,o,i);else if(this.parent.getWorkerSource){let e=t.type.split(`.`);a=this.parent.getWorkerSource(t.sourceMapId,e[0],o.source)[e[1]](o,i)}else i(Error(`Could not find function ${t.type}`))}catch(e){if(n||!t.hasCallback)throw e;i(m(e))}!n&&a&&a.cancel&&(this.cancelCallbacks[e]=a.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener(`message`,this.receive,!1)}},e.X=function(e,t){let n={};for(let r=0;rA&&(e.getActor().send(`enforceCacheSizeLimit`,k),j=0)},e.a1=_u,e.a2=Va,e.a3=di,e.a4=pu,e.a5=class extends hi{},e.a6=hu,e.a7=function(e,t){let n=document.createElement(`video`);n.muted=!0,n.onloadstart=function(){t(null,n)};for(let t=0;t{}}},e.a8=N,e.a9=po,e.aA=fc,e.aB=function(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=n*s-r*o,y=n*c-i*o,b=n*l-a*o,x=r*c-i*s,S=r*l-a*s,C=i*l-a*c,w=u*h-d*m,T=u*g-f*m,E=u*_-p*m,D=d*g-f*h,O=d*_-p*h,k=f*_-p*g,A=v*k-y*O+b*D+x*E-S*T+C*w;return A?(e[0]=(s*k-c*O+l*D)*(A=1/A),e[1]=(i*O-r*k-a*D)*A,e[2]=(h*C-g*S+_*x)*A,e[3]=(f*S-d*C-p*x)*A,e[4]=(c*E-o*k-l*T)*A,e[5]=(n*k-i*E+a*T)*A,e[6]=(g*b-m*C-_*y)*A,e[7]=(u*C-f*b+p*y)*A,e[8]=(o*O-s*E+l*w)*A,e[9]=(r*E-n*O-a*w)*A,e[10]=(m*S-h*b+_*v)*A,e[11]=(d*b-u*S-p*v)*A,e[12]=(s*T-o*D-c*w)*A,e[13]=(n*D-r*T+i*w)*A,e[14]=(h*y-m*x-g*v)*A,e[15]=(u*x-d*y+f*v)*A,e):null},e.aC=qu,e.aD=Ku,e.aE=qc,e.aF=ed,e.aG=J,e.aH=ne,e.aI=Ur,e.aJ=function(e){return e.type===`custom`?new vl(e):new nu[e.type](e)},e.aK=d,e.aL=function(e){let t=[],n=e.id;return n===void 0&&t.push({message:`layers.${n}: missing required property "id"`}),e.render===void 0&&t.push({message:`layers.${n}: missing required method "render"`}),e.renderingMode&&e.renderingMode!==`2d`&&e.renderingMode!==`3d`&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},e.aM=u,e.aN=l,e.aO=Gr,e.aP=ie,e.aQ=function(e){return e({pluginStatus:Vr,pluginURL:Hr}),Gr.on(`pluginStateChange`,e),e},e.aR=Ea,e.aS=class extends Ta{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.aT=class extends Ta{constructor(e,t){super(e,t),this.current=ka}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.aU=Da,e.aV=class extends Ta{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]||(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},e.aW=class extends Ta{constructor(e,t){super(e,t),this.current=[0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]||(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},e.aX=Oa,e.aY=function(e,t,n,r,i,a,o){var s=1/(t-n),c=1/(r-i),l=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*s,e[13]=(i+r)*c,e[14]=(o+a)*l,e[15]=1,e},e.aZ=ke,e.a_=ho,e.aa=function(e,t,n){var r,i,a,o,s,c,l,u,d,f,p,m,h=n[0],g=n[1],_=n[2];return t===e?(e[12]=t[0]*h+t[4]*g+t[8]*_+t[12],e[13]=t[1]*h+t[5]*g+t[9]*_+t[13],e[14]=t[2]*h+t[6]*g+t[10]*_+t[14],e[15]=t[3]*h+t[7]*g+t[11]*_+t[15]):(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],e[0]=r=t[0],e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e[6]=l,e[7]=u,e[8]=d,e[9]=f,e[10]=p,e[11]=m,e[12]=r*h+s*g+d*_+t[12],e[13]=i*h+c*g+f*_+t[13],e[14]=a*h+l*g+p*_+t[14],e[15]=o*h+u*g+m*_+t[15]),e},e.ab=function(e,t,n){var r=n[0],i=n[1],a=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.ac=mo,e.ad=zi,e.ae=dl,e.af=function(){Jr.isLoading()||Jr.isLoaded()||Kr()!==`deferred`||qr()},e.ag=Wn,e.ah=Ga,e.ai=Yr,e.aj=xu,e.ak=function(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,n,r,i)=>{let a=r||i;return t[n]=!a||a.toLowerCase(),``}),t[`max-age`]){let e=parseInt(t[`max-age`],10);isNaN(e)?delete t[`max-age`]:t[`max-age`]=e}return t},e.al=function(e,t){let n=[];for(let r in e)r in t||n.push(r);return n},e.am=S,e.an=[`type`,`source`,`source-layer`,`minzoom`,`maxzoom`,`filter`,`layout`],e.ao=i,e.ap=function(){var e=new fo(16);return fo!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.aq=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[0],o=t[1],s=t[2],c=t[3],l=t[4],u=t[5],d=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*i+l*r,e[1]=o*i+u*r,e[2]=s*i+d*r,e[3]=c*i+f*r,e[4]=l*i-a*r,e[5]=u*i-o*r,e[6]=d*i-s*r,e[7]=f*i-c*r,e},e.ar=function(e){var t=new fo(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.as=vo,e.at=function(e,t){let n=0,r=0;if(e.kind===`constant`)r=e.layoutSize;else if(e.kind!==`source`){let{interpolationType:a,minZoom:o,maxZoom:s}=e,c=a?i(zt.interpolationFactor(a,t,o,s),0,1):0;e.kind===`camera`?r=G(e.minSize,e.maxSize,c):n=c}return{uSizeT:n,uSize:r}},e.av=_o,e.aw=function(e,{uSize:t,uSizeT:n},{lowerSize:r,upperSize:i}){return e.kind===`source`?r/128:e.kind===`composite`?G(r/128,i/128,n):t},e.ax=sl,e.ay=Eu,e.az=Ja,e.b=function(e,t){if(e.byteLength===0)return void createImageBitmap(new ImageData(1,1)).then(e=>{t(null,e)});let n=new Blob([new Uint8Array(e)],{type:`image/png`});createImageBitmap(n).then(e=>{t(null,e)}).catch(e=>{t(Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},e.b0=lc,e.b1=class extends Ai{},e.b2=Oo,e.b3=function(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)},e.b4=Do,e.b5=Ji,e.b6=class extends Ii{},e.b7=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},e.b8=function(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8],d=e[9],f=e[10],p=e[11],m=e[12],h=e[13],g=e[14],_=e[15],v=t[0],y=t[1],b=t[2],x=t[3],S=t[4],C=t[5],w=t[6],T=t[7],E=t[8],D=t[9],O=t[10],k=t[11],A=t[12],j=t[13],ee=t[14],te=t[15];return Math.abs(n-v)<=uo*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(r-y)<=uo*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(i-b)<=uo*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(a-x)<=uo*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(o-S)<=uo*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(s-C)<=uo*Math.max(1,Math.abs(s),Math.abs(C))&&Math.abs(c-w)<=uo*Math.max(1,Math.abs(c),Math.abs(w))&&Math.abs(l-T)<=uo*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-E)<=uo*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(d-D)<=uo*Math.max(1,Math.abs(d),Math.abs(D))&&Math.abs(f-O)<=uo*Math.max(1,Math.abs(f),Math.abs(O))&&Math.abs(p-k)<=uo*Math.max(1,Math.abs(p),Math.abs(k))&&Math.abs(m-A)<=uo*Math.max(1,Math.abs(m),Math.abs(A))&&Math.abs(h-j)<=uo*Math.max(1,Math.abs(h),Math.abs(j))&&Math.abs(g-ee)<=uo*Math.max(1,Math.abs(g),Math.abs(ee))&&Math.abs(_-te)<=uo*Math.max(1,Math.abs(_),Math.abs(te))},e.b9=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.bA=Su,e.bB=m,e.bC=Nc,e.bD=function(t,n,r,i,a,o,s,c,l){t.createArrays(),t.tilePixelRatio=Va/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;let u=t.layers[0].layout,d=t.layers[0]._unevaluatedLayout._values,f={};if(t.textSizeData.kind===`composite`){let{minZoom:e,maxZoom:n}=t.textSizeData;f.compositeTextSizes=[d[`text-size`].possiblyEvaluate(new Yr(e),s),d[`text-size`].possiblyEvaluate(new Yr(n),s)]}if(t.iconSizeData.kind===`composite`){let{minZoom:e,maxZoom:n}=t.iconSizeData;f.compositeIconSizes=[d[`icon-size`].possiblyEvaluate(new Yr(e),s),d[`icon-size`].possiblyEvaluate(new Yr(n),s)]}f.layoutTextSize=d[`text-size`].possiblyEvaluate(new Yr(t.zoom+1),s),f.layoutIconSize=d[`icon-size`].possiblyEvaluate(new Yr(t.zoom+1),s),f.textMaxSize=d[`text-size`].possiblyEvaluate(new Yr(18));let m=u.get(`text-line-height`)*fc,h=u.get(`text-rotation-alignment`)===`map`&&u.get(`symbol-placement`)!==`point`,g=u.get(`text-keep-upright`),_=u.get(`text-size`);for(let o of t.features){let d=u.get(`text-font`).evaluate(o,{},s).join(`,`),v=_.evaluate(o,{},s),y=f.layoutTextSize.evaluate(o,{},s),b=f.layoutIconSize.evaluate(o,{},s),x={horizontal:{},vertical:void 0},S=o.text,C,w=[0,0];if(S){let i=S.toString(),f=u.get(`text-letter-spacing`).evaluate(o,{},s)*fc,p=Er(i)?f:0,_=u.get(`text-anchor`).evaluate(o,{},s),b=u.get(`text-variable-anchor`);if(!b){let e=u.get(`text-radial-offset`).evaluate(o,{},s);w=e?Ku(_,[e*fc,Gu]):u.get(`text-offset`).evaluate(o,{},s).map(e=>e*fc)}let C=h?`center`:u.get(`text-justify`).evaluate(o,{},s),T=u.get(`symbol-placement`),E=T===`point`?u.get(`text-max-width`).evaluate(o,{},s)*fc:0,D=o.hasSubText?u.get(`subtext-max-width`).evaluate(o,{},s)*fc:0;!1!==l&&c===`en`&&(E*=2,D*=2);let O=()=>{t.allowVerticalPlacement&&Tr(i)&&(x.vertical=Lc(S,n,r,a,d,E,D,m,_,`left`,p,w,e.au.vertical,!0,T,y,v))};if(!h&&b){let t=C===`auto`?b.map(e=>qu(e)):[C],i=!1;for(let o=0;o=0&&e<128)return this.pos>=this.length&&this.realloc(1),void(this.buf[this.pos++]=e);e>268435455||e<0?function(e,t){let n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),4294967295^n?n=n+1|0:(n=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw Error(`Given varint doesn't fit into 10 bytes`);t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,n.buf[n.pos]=127&(e>>>=7)}(n,0,t),function(e,t){let n=(7&e)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;let t=this.pos;this.pos=function(e,t,n){for(let r,i,a=0;a55295&&r<57344){if(!i){r>56319||a+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=r;continue}if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=63&r|128)}return n}(this.buf,e,this.pos);let n=this.pos-t;n>=128&&vc(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){let t=e.length;this.writeVarint(t),this.realloc(t),this.buf.set(e,this.pos),this.pos+=t}writeRawMessage(e,t){this.pos++;let n=this.pos;e(t,this);let r=this.pos-n;r>=128&&vc(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r}writeMessage(e,t,n){this.writeTag(e,2),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,yc,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,bc,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Cc,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,xc,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,Sc,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,wc,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Tc,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Ec,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Dc,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}},e.bM=An,e.bN=function(e){if(!Bl(e,0))throw Error(`Unsupported format: MeshBatch tiles must be in GLB format`);return Gl(e,0)},e.bO=Jr,e.bP=function(e){typeof caches>`u`||O||(O=caches.open(D)),O&&O.then(t=>{t.keys().then(n=>{for(let r=0;re+t,0)/r/1e3),a=cd.filter(e=>e>ld).reduce((e,t)=>e+(t-ld)/ld,0);return{loadTime:t,fullLoadTime:n,fps:i,percentDroppedFrames:a/(r+a)*100}}},e.bs=function(e,t){k=e,A=t},e.bt=Kr,e.bu=function(e,t,n=!1){if(Vr===Ir||Vr===Lr||Vr===Rr)throw Error(`setRTLTextPlugin cannot be called multiple times.`);Vr===zr&&(Vr=Fr),Hr=w.resolveURL(e),Vr=Ir,Br=t,Wr(),n||qr()},e.bv=function(e){let t=caches.delete(D);e&&t.catch(e).then(()=>e())},e.bw=Ps,e.bx=Ms,e.by=q,e.bz=bu,e.c=function(e,t,n,r){let i=new Image;i.onload=()=>{t(null,i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>{i.src=se})},i.onerror=()=>t(Error(`Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`));let a=new Blob([new Uint8Array(e)],{type:`image/png`});i.cacheControl=n,i.expires=r,i.src=e.byteLength?URL.createObjectURL(a):se},e.d=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(Number(`0x`+t))))},e.e=o,e.f=function(e){try{let t=window[e];return t.setItem(`_mapbox_test_`,`1`),t.removeItem(`_mapbox_test_`),!0}catch(e){return!1}},e.g=ae,e.h=function(e){return decodeURIComponent(atob(e).split(``).map(e=>`%`+(`00`+e.charCodeAt(0).toString(16)).slice(-2)).join(``))},e.i=_,e.j=function(e,t){return ie(o(e,{type:`json`}),t)},e.k=w,e.l=Eo,e.m=de,e.n=function(e,t,n){if(!e.length)return n(null,[]);let r=e.length,i=Array(e.length),a=null;e.forEach((e,o)=>{t(e,(e,t)=>{e&&(a=e),i[o]=t,--r===0&&n(a,i)})})},e.o=ue,e.p=function(e,t){return ie(o(e,{method:`POST`}),t)},e.q=jc,e.r=function(e){return new gc(e).readFields(Oc,[])},e.s=oe,e.t=Y,e.u=function(){return function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()},e.v=function(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},e.w=p,e.x=To,e.y=function(e){return fetch(e).then(e=>e.arrayBuffer()).then(t=>Gl(t,0,e))},e.z=function(e,t,n,r){return Yl(e,t,n,r,n=>{let{attributes:r}=n,i=Wl(e,r.POSITION),a=Wl(e,r.NORMAL),o=r.TEXCOORD_0===void 0?null:Wl(e,r.TEXCOORD_0),s=r.TEXCOORD_1===void 0?null:Wl(e,r.TEXCOORD_1);return{indices:Wl(e,n.indices),numVertices:i.length/3,addVertex:e=>{let n=0,r=0,c=1;a&&(n=a[3*e],r=a[3*e+2],c=a[3*e+1]);let l=0,u=0;o&&(l=o[2*e],u=o[2*e+1]);let d=l,f=u;s&&(d=s[2*e],f=s[2*e+1]),t.emplaceBack(i[3*e],i[3*e+2],i[3*e+1],n*Kl*2,r*Kl*2,c*Kl*2,l,u,d,f)},imageIndex:ql(e,n.material)}})}}),r([`./shared`],function(e){function t(e){let n=typeof e;if(n===`number`||n===`boolean`||n===`string`||e==null)return JSON.stringify(e);if(Array.isArray(e)){let n=`[`;for(let r of e)n+=`${t(r)},`;return`${n}]`}let r=Object.keys(e).sort(),i=`{`;for(let n=0;nthis._layers[e.id]),n=t[0];if(n.visibility===`none`)continue;let r=n.source||``,i=this.familiesBySource[r];i||(i=this.familiesBySource[r]={});let a=n.sourceLayer||`_geojsonTileLayer`,o=i[a];o||(o=i[a]=[]),o.push(t)}}}let i=e.bw.prototype;if(!i.setDynamicProperty){i.setDynamicProperty=function(e){this.dynamicProperty=e;for(let e in this.layers)this.layers[e].dynamicProperty=this.dynamicProperty};let t=e.bx.prototype.feature;e.bx.prototype.feature=function(e){let n=t.apply(this,[e]),r=this.dynamicProperty;if(r){let e=r.properties,t=r[`mapping-key`];if(t){let r=n.properties,i=e.length;for(let n=0;n=n.maxzoom||n.visibility!==`none`&&(s(t,this.zoom,r),(u[n.id]=n.createBucket({index:l.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:a,sourceID:this.source})).populate(o,d,this.tileID.canonical),l.bucketLayerIDs.push(t.map(e=>e.id)))}}}catch(t){return this.status=`done`,o(e.bB(t))}let p,m,h,g,_=e.aN(d.glyphDependencies,e=>Object.keys(e).map(Number));Object.keys(_).length?i.send(`getGlyphs`,{uid:this.uid,stacks:_},(e,t)=>{p||(p=e,m=t,b.call(this))}):m={};let v=Object.keys(d.iconDependencies);v.length?i.send(`getImages`,{icons:v,source:this.source,tileID:this.tileID,type:`icons`},(e,t)=>{p||(p=e,h=t,b.call(this))}):h={};let y=Object.keys(d.patternDependencies);function b(){if(p)return o(p);if(m&&h&&g){let t=new a(m),n=new e.bC(h,g);try{for(let i in u){let a=u[i];a instanceof e.ae?(s(a.layers,this.zoom,r),e.bD(a,m,t.positions,h,n.iconPositions,this.showCollisionBoxes,this.tileID.canonical,d.language,d.englishWrapWidthMultiplier)):a.hasPattern&&(a instanceof e.bE||a instanceof e.bF||a instanceof e.bG)&&(s(a.layers,this.zoom,r),a.addFeatures(d,this.tileID.canonical,n.patternPositions))}}catch(t){return this.status=`done`,o(e.bB(t))}this.status=`done`,o(null,{buckets:Object.values(u).filter(e=>!e.isEmpty()),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,imageAtlas:n,glyphMap:this.returnDependencies?m:null,iconMap:this.returnDependencies?h:null,glyphPositions:this.returnDependencies?t.positions:null})}}y.length?i.send(`getImages`,{icons:y,source:this.source,tileID:this.tileID,type:`patterns`},(e,t)=>{p||(p=e,g=t,b.call(this))}):g={},b.call(this)}}function s(t,n,r){let i=new e.ai(n);for(let e of t)e.recalculate(i,r)}function c(t,n){let r=e.g(t.request,(r,i,a,o)=>{if(r)n(r);else if(i)try{let r=new e.bw(new e.bI(i));t.dynamicProperty&&r.setDynamicProperty(t.dynamicProperty),n(null,{vectorTile:r,rawData:i,cacheControl:a,expires:o})}catch(e){let r=new Uint8Array(i),a=`Unable to parse the tile at ${t.request.url}, `;a+=r[0]===31&&r[1]===139?`please make sure the data is not gzipped and that you have configured the relevant header in the server`:`got error: ${e.message}`,n(Error(a))}});return()=>{r.cancel(),n()}}class l{constructor(e,t,n,r){this.actor=e,this.layerIndex=t,this.availableImages=n,this.loadVectorData=r||c,this.loading={},this.loaded={}}loadTile(t,n){let r=t.uid;this.loading||(this.loading={});let i=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.bH(t.request),a=this.loading[r]=new o(t);a.abort=this.loadVectorData(t,(t,o)=>{if(delete this.loading[r],t||!o)return a.status=`done`,this.loaded[r]=a,n(t);let s=o.rawData,c={};o.expires&&(c.expires=o.expires),o.cacheControl&&(c.cacheControl=o.cacheControl);let l={};if(i){let e=i.finish();e&&(l.resourceTiming=JSON.parse(JSON.stringify(e)))}a.vectorTile=o.vectorTile,this.loaded=this.loaded||{},this.loaded[r]=a,a.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,(t,r)=>{if(t||!r)return n(t);n(null,e.e({rawTileData:s.slice(0)},r,c,l))})})}reloadTile(e,t){let n=this.loaded,r=e.uid,i=this;if(n&&n[r]){let a=n[r];a.showCollisionBoxes=e.showCollisionBoxes,a.language=e.language,a.englishWrapWidthMultiplier=e.englishWrapWidthMultiplier;let o=(e,n)=>{let r=a.reloadCallback;r&&(delete a.reloadCallback,a.parse(a.vectorTile,i.layerIndex,this.availableImages,i.actor,r)),t(e,n)};a.status===`parsing`?a.reloadCallback=o:a.status===`done`&&(a.vectorTile?(e.dynamicProperty&&a.vectorTile.setDynamicProperty(e.dynamicProperty),a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,o)):o())}}abortTile(e,t){let n=this.loading,r=e.uid;n&&n[r]&&n[r].abort&&(n[r].abort(),delete n[r]),t()}removeTile(e,t){let n=this.loaded,r=e.uid;n&&n[r]&&delete n[r],t()}}class u{constructor(){this.loaded={}}loadTile(t,n){let{uid:r,encoding:i,rawImageData:a}=t,o=e.a(a)?this.getImageData(a):a,s=new e.bJ(r,o,i);this.loaded=this.loaded||{},this.loaded[r]=s,n(null,s)}getImageData(t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(t.width,t.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext(`2d`,{willReadFrequently:!0})),this.offscreenCanvas.width=t.width,this.offscreenCanvas.height=t.height,this.offscreenCanvasContext.drawImage(t,0,0,t.width,t.height);let n=this.offscreenCanvasContext.getImageData(-1,-1,t.width+2,t.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new e.l({width:n.width,height:n.height},n.data)}removeTile(e){let t=this.loaded,n=e.uid;t&&t[n]&&delete t[n]}}var d,f,p=function(){if(f)return d;function e(e,n){if(e.length!==0){t(e[0],n);for(var r=1;r=Math.abs(s)?n-c+s:s-c+n,n=c}n+r>=0!=!!t&&e.reverse()}return f=1,d=function t(n,r){var i,a=n&&n.type;if(a===`FeatureCollection`)for(i=0;ie},g=Math.fround||(_=new Float32Array(1),e=>(_[0]=+e,_[0]));var _;class v{constructor(t){this.options=e.e(Object.create(h),t),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?9:8,this.clusterProps=[]}load(t){let{log:n,minZoom:r,maxZoom:i}=this.options;`${t.length}`,this.points=t;let a=[];for(let n=0;n=r;e--)+Date.now(),o=this.trees[e]=this._createTree(this._cluster(o,e));return this}getClusters(t,n){let r=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),a=t[2]===180?180:((t[2]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,a=180;else if(r>a){let e=this.getClusters([r,i,180,o],n),t=this.getClusters([-180,i,a,o],n);return e.concat(t)}let s=this.trees[this._limitZoom(n)],c=e.a4.fromLngLat({lng:r,lat:i}),l=e.a4.fromLngLat({lng:a,lat:o}),u=s.range(c.x,l.y,l.x,c.y),d=s.data,f=[];for(let e of u){let t=this.stride*e;f.push(d[t+5]>1?y(d,t,this.clusterProps):this.points[d[t+3]])}return f}getChildren(e){let t=this._getOriginId(e),n=this._getOriginZoom(e),r=n-1,i=this._getOriginType(r),a=this._getOriginDistance(),o=`No cluster with the specified id.`,s=this.trees[n];if(!s)throw Error(o);let c=s.data;if(t*this.stride>=c.length)throw Error(o);let l=c[t*this.stride],u=c[t*this.stride+1],d=this.options.radius/(this.options.extent*2**r),f=i===`radius`?d:this._getDistanceInMercatorCoordinate({x:l,y:u},a),p=s.within(l,u,f),m=[];for(let t of p){let n=t*this.stride;c[n+4]===e&&m.push(c[n+5]>1?y(c,n,this.clusterProps):this.points[c[n+3]])}if(m.length===0)throw Error(o);return m}getLeaves(e,t,n){let r=[];return this._appendLeaves(r,e,t=t||10,n=n||0,0),r}getTile(e,t,n){let r=this.trees[this._limitZoom(e)],i=2**e,{extent:a,radius:o}=this.options,s=o/a,c=(n-s)/i,l=(n+1+s)/i,u={features:[]};return this._addTileFeatures(r.range((t-s)/i,c,(t+1+s)/i,l),r.data,t,n,i,u),t===0&&this._addTileFeatures(r.range(1-s/i,c,1,l),r.data,i,n,i,u),t===i-1&&this._addTileFeatures(r.range(0,c,s/i,l),r.data,-1,n,i,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){let n=this.getChildren(e);if(t++,n.length!==1)break;e=n[0].properties.cluster_id}return t}_appendLeaves(e,t,n,r,i){let a=this.getChildren(t);for(let t of a){let a=t.properties;if(a&&a.cluster?i+a.point_count<=r?i+=a.point_count:i=this._appendLeaves(e,a.cluster_id,n,r,i):i1,l,u,d;if(c)l=b(n,t,this.clusterProps),u=n[t+6],d=n[t+6+1];else{let r=this.points[n[t+3]],i=e.a4.fromLngLat(r.geometry.coordinates);l=r.properties,u=i.x,d=i.y}let f={id:void 0,type:1,geometry:[[Math.round(this.options.extent*(u*a-r)),Math.round(this.options.extent*(d*a-i))]],tags:l},p;p=c||this.options.generateId?n[t+3]:this.points[n[t+3]].id,p!==void 0&&(f.id=p),o.features.push(f)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){let{radius:n,distance:r,extent:i,reduce:a,minPoints:o}=this.options,s=this._getOriginType(t),c=n/(i*2**t),l=e.data,u=[],d=this.stride;for(let n=0;nt&&(v+=l[n+5])}if(v>_&&v>=o){let e,r=i*_,o=f*_,s=-1,c=(n/d<<5)+(t+1)+this.points.length;for(let i of g){let u=i*d;if(l[u+2]<=t)continue;l[u+2]=t;let f=l[u+5];r+=l[u]*f,o+=l[u+1]*f,l[u+4]=c,a&&(e||(e=this._map(l,n,!0),s=this.clusterProps.length,this.clusterProps.push(e)),a(e,this._map(l,u)))}l[n+4]=c,u.push(r/v,o/v,1/0,c,-1,v,p,m),a&&u.push(s)}else{for(let e=0;e1)for(let e of g){let n=e*d;if(!(l[n+2]<=t)){l[n+2]=t;for(let e=0;e>5}_getOriginZoom(e){return(e-this.points.length)%32}_getOriginType(e){let{minZoom:t,type:n}=this.options;return Array.isArray(n)?n[e-t]||`radius`:n}_getOriginDistance(){return this.options.distance}_getDistanceInMercatorCoordinate(t,n){return n*new e.a4(t.x,t.y).meterInMercatorCoordinateUnits()}_map(t,n,r){if(t[n+5]>1){let i=this.clusterProps[t[n+8]];return r?e.e({},i):i}let i=this.points[t[n+3]].properties,a=this.options.map(i);return r&&a===i?e.e({},a):a}}function y(t,n,r){let i=new e.a4(t[n+6],t[n+6+1]);return{type:`Feature`,id:t[n+3],properties:b(t,n,r),geometry:{type:`Point`,coordinates:i.toLngLat().toArray()}}}function b(t,n,r){let i=t[n+5],a=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?Math.round(i/100)/10+`k`:i,o=t[n+8]===-1?{}:e.e({},r[t[n+8]]);return e.e(o,{cluster:!0,cluster_id:t[n+3],point_count:i,point_count_abbreviated:a})}var x=class{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,`id`in e&&(typeof e.id==`string`?this.id=parseInt(e.id,10):typeof e.id!=`number`||isNaN(e.id)||(this.id=e.id))}loadGeometry(){let t=[],n=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(let r of n){let n=[];for(let t of r)n.push(new e.P(t[0],t[1]));t.push(n)}return t}};let S=`_geojsonTileLayer`;var C=class{constructor(e,t){this.layers={[S]:this},this.name=S,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new x(this.features[e],this.extent)}};function w(e,t,n=``){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||``),t.writeVarintField(5,e.extent||4096);let r={jsonPrefix:n,keys:[],values:[],keycache:{},valuecache:{}};for(let n=0;n>31}function k(e,t){let n=e.loadGeometry(),r=e.type,i=0,a=0;for(let o of n){let n=1;r===1&&(n=o.length),t.writeVarint(D(1,n));let s=r===3?o.length-1:o.length;for(let e=0;e>1),o,s=n-t,c=e[t],l=e[t+1],u=e[n],d=e[n+1];for(let r=t+3;ri)o=r,i=t;else if(t===i){let e=Math.abs(r-a);er&&(o-t>3&&j(e,t,o,r),e[o+2]=i,n-o>3&&j(e,o,n,r))}function ee(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return o=e-n,s=t-r,o*o+s*s}function te(e,t,n,r){let i={id:e==null?null:e,type:t,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(t===`Point`||t===`MultiPoint`||t===`LineString`)ne(i,n);else if(t===`Polygon`)ne(i,n[0]);else if(t===`MultiLineString`)for(let e of n)ne(i,e);else if(t===`MultiPolygon`)for(let e of n)ne(i,e[0]);return i}function ne(e,t){for(let n=0;n0&&(o+=r?(i*c-s*a)/2:Math.sqrt((s-i)**2+(c-a)**2)),i=s,a=c}let s=t.length-3;t[2]=1,j(t,0,s,n),t[s+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function oe(e,t,n,r){for(let i=0;i1?1:n}function le(e,t,n,r,i,a,o,s){if(r/=t,a>=(n/=t)&&o=r)return null;let c=[];for(let t of e){let e=t.geometry,a=t.type,o=i===0?t.minX:t.minY,l=i===0?t.maxX:t.maxY;if(o>=n&&l=r)continue;let u=[];if(a===`Point`||a===`MultiPoint`)ue(e,u,n,r,i);else if(a===`LineString`)de(e,u,n,r,i,!1,s.lineMetrics);else if(a===`MultiLineString`)M(e,u,n,r,i,!1);else if(a===`Polygon`)M(e,u,n,r,i,!0);else if(a===`MultiPolygon`)for(let t of e){let e=[];M(t,e,n,r,i,!0),e.length&&u.push(e)}if(u.length){if(s.lineMetrics&&a===`LineString`){for(let e of u)c.push(te(t.id,a,e,t.tags));continue}a!==`LineString`&&a!==`MultiLineString`||(u.length===1?(a=`LineString`,u=u[0]):a=`MultiLineString`),a!==`Point`&&a!==`MultiPoint`||(a=u.length===3?`Point`:`MultiPoint`),c.push(te(t.id,a,u,t.tags))}}return c.length?c:null}function ue(e,t,n,r,i){for(let a=0;a=n&&o<=r&&N(t,e[a],e[a+1],e[a+2])}}function de(e,t,n,r,i,a,o){let s=fe(e),c=i===0?P:F,l,u,d=e.start;for(let f=0;f=n&&(u=c(s,p,m,g,_,n),o&&(s.start=d+l*u)):v>r?y<=r&&(u=c(s,p,m,g,_,r),o&&(s.start=d+l*u)):N(s,p,m,h),y=n&&(u=c(s,p,m,g,_,n),b=!0),y>r&&v<=r&&(u=c(s,p,m,g,_,r),b=!0),!a&&b&&(o&&(s.end=d+l*u),t.push(s),s=fe(e)),o&&(d+=l)}let f=e.length-3,p=e[f],m=e[f+1],h=i===0?p:m;h>=n&&h<=r&&N(s,p,m,e[f+2]),f=s.length-3,a&&f>=3&&(s[f]!==s[0]||s[f+1]!==s[1])&&N(s,s[0],s[1],s[2]),s.length&&t.push(s)}function fe(e){let t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function M(e,t,n,r,i,a){for(let o of e)de(o,t,n,r,i,a,!1)}function N(e,t,n,r){e.push(t,n,r)}function P(e,t,n,r,i,a){let o=(a-t)/(r-t);return N(e,a,n+(i-n)*o,1),o}function F(e,t,n,r,i,a){let o=(a-n)/(i-n);return N(e,t+(r-t)*o,a,1),o}function I(e,t){let n=[];for(let r=0;r0&&t.size<(i?o:r))return void(n.numPoints+=t.length/3);let s=[];for(let e=0;eo)&&(n.numSimplified++,s.push(t[e],t[e+1])),n.numPoints++;i&&function(e,t){let n=0;for(let t=0,r=e.length,i=r-2;t0===t)for(let t=0,n=e.length;t24)throw Error(`maxZoom should be in the 0-24 range`);if(t.promoteId&&t.generateId)throw Error(`promoteId and generateId cannot be used together.`);let r=function(e,t){let n=[];if(e.type===`FeatureCollection`)for(let r=0;r>e||r!==o>>e)continue}}if(f.source=null,e.length===0)continue;let p=.5*c.buffer/c.extent,m=.5-p,h=.5+p,g=1+p,_=null,v=null,y=null,b=null,x=le(e,u,n-p,n+h,0,f.minX,f.maxX,c),S=le(e,u,n+m,n+g,0,f.minX,f.maxX,c);x&&(_=le(x,u,r-p,r+h,1,f.minY,f.maxY,c),v=le(x,u,r+m,r+g,1,f.minY,f.maxY,c)),S&&(y=le(S,u,r-p,r+h,1,f.minY,f.maxY,c),b=le(S,u,r+m,r+g,1,f.minY,f.maxY,c)),s.push(_||[],t+1,2*n,2*r),s.push(v||[],t+1,2*n,2*r+1),s.push(y||[],t+1,2*n+1,2*r),s.push(b||[],t+1,2*n+1,2*r+1)}}getTile(e,t,n){e=+e,t=+t,n=+n;let{extent:r,debug:i}=this.options;if(e<0||e>24)return null;let a=1<0;)c--,l>>=1,u>>=1,s=this.tiles[_e(c,l,u)];return s&&s.source?(this.splitTile(s.source,c,l,u,e,t,n),this.tiles[o]?L(this.tiles[o],r):null):null}}function _e(e,t,n){return 32*((1<w(e,t,n),e.layers[r])}(t,r,n),r.finish()}(a);o.byteOffset===0&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),n(null,{vectorTile:a,rawData:o.buffer})}class ve extends l{constructor(e,t,n,r){super(e,t,n,V),r&&(this.loadGeoJSON=r)}loadData(e,t){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=t,this._pendingLoadDataParams=e,this._state&&this._state!==`Idle`?this._state=`NeedsLoadData`:(this._state=`Coalescing`,this._loadData())}_loadData(){if(!this._pendingCallback||!this._pendingLoadDataParams)return;let t=this._pendingCallback,n=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;let r=!!(n&&n.request&&n.request.collectResourceTiming)&&new e.bH(n.request);this.loadGeoJSON(n,(i,a)=>{if(i||!a)return t(i);if(typeof a!=`object`)return t(Error(`Input data given to '${n.source}' is not a valid GeoJSON object.`));{m(a,!0);try{if(n.filter){let t=e.bM(n.filter,{type:`boolean`,"property-type":`data-driven`,overridable:!1,transition:!1});if(t.result===`error`)throw Error(t.value.map(e=>`${e.key}: ${e.message}`).join(`, `));a={type:`FeatureCollection`,features:a.features.filter(e=>t.value.evaluate({zoom:0},e))}}let t=a.features;this._geoJSONIndex=n.cluster?new v(function({superclusterOptions:t,clusterProperties:n}){if(!n||!t)return t;let r={},i={},a={accumulated:null,zoom:0},o={properties:null},s=Object.keys(n);for(let t of s){let[a,o]=n[t],s=e.bM(o),c=e.bM(typeof a==`string`?[a,[`accumulated`],[`get`,t]]:a);r[t]=s.value,i[t]=c.value}return t.map=e=>{o.properties=e;let t={};for(let e of s)t[e]=r[e].evaluate(a,o);return t},t.reduce=(e,t)=>{o.properties=t;for(let t of s)a.accumulated=e[t],e[t]=i[t].evaluate(a,o)},t}(n)).load(t):function(e,t){return new ge(e,t)}(a,n.geojsonVtOptions)}catch(e){return t(e)}this.loaded={};let i={};if(r){let e=r.finish();e&&(i.resourceTiming={},i.resourceTiming[n.source]=JSON.parse(JSON.stringify(e)))}t(null,i)}})}coalesce(){this._state===`Coalescing`?this._state=`Idle`:this._state===`NeedsLoadData`&&(this._state=`Coalescing`,this._loadData())}reloadTile(e,t){let n=this.loaded;return n&&n[e.uid]?super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,n){if(t.request)e.j(t.request,n);else{if(typeof t.data!=`string`)return n(Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return n(null,JSON.parse(t.data))}catch(e){return n(Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}removeSource(e,t){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),t()}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}class H{constructor(t){this.tileID=new e.a1(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.source=t.source}parse(t,n,r){this.status=`parsing`,this.data=t;let i={},a=n.familiesBySource[this.source],o=new e.bA(this.tileID);o.bucketLayerIDs=[],e.bN(t).then(t=>{if(!t)return r(Error(`Could not parse tile`));let n=new e.ai(this.zoom);for(let e in a)for(let r of a[e]){let e=r[0];e.minzoom&&this.zoom=e.maxzoom||e.visibility!==`none`&&(e.recalculate(n,[]),(i[e.id]=e.createBucket({index:o.bucketLayerIDs.length,zoom:this.zoom,sourceID:this.source,layers:r,pixelRatio:null,overscaling:null,collisionBoxArray:null,sourceLayerIndex:null})).evaluate(t),o.bucketLayerIDs.push(r.map(e=>e.id)))}this.status=`done`,r(null,{buckets:Object.values(i).filter(e=>!e.isEmpty()),featureIndex:o})}).catch(e=>{r(e)})}}class ye{constructor(e,t,n){this.actor=e,this.layerIndex=t,this.availableImages=n||[],this.loading={},this.loaded={}}loadTile(t,n){let r=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.bH(t.request),i=t.uid,a=this.loading[i]=new H(t);a.abort=function(t,n){let r=e.g(t.request,(e,t,r,i)=>{e?n(e):t&&t.byteLength!==0?n(null,{rawData:t,cacheControl:r,expires:i}):n()});return()=>{r.cancel(),n()}}(t,(t,o)=>{if(delete this.loading[i],t)return a.status=`done`,this.loaded[i]=a,n(t);if(!o)return a.status=`done`,this.loaded[i]=a,n();let s=o.rawData,c={};if(r){let e=r.finish();e&&(c.resourceTiming=JSON.parse(JSON.stringify(e)))}a.parse(s,this.layerIndex,(t,r)=>{if(t||!r)return n(t);n(null,e.e({},r,{imageAtlas:null,glyphAtlasImage:null,collisionBoxArray:null},c))}),this.loaded=this.loaded||{},this.loaded[i]=a})}reloadTile(e,t){let n=this.loaded,r=e.uid;if(n&&n[r]){let e=n[r],i=(n,r)=>{let i=e.reloadCallback;i&&(delete e.reloadCallback,e.parse(e.data,this.layerIndex,i)),t(n,r)};e.status===`parsing`?e.reloadCallback=i:e.status===`done`&&(e.data?e.parse(e.data,this.layerIndex,i):i())}}abortTile(e,t){let n=this.loading,r=e.uid;n&&n[r]&&n[r].abort&&(n[r].abort(),delete n[r]),t()}removeTile(e,t){let n=this.loaded,r=e.uid;n&&n[r]&&delete n[r],t()}}class be{constructor(t){this.self=t,this.actor=new e.W(t,this),this.layerIndexes={},this.availableImages={},this.rtlPluginDeferredListeners=[],this.workerSourceTypes={vector:l,geojson:ve,"mesh-batch":ye},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=t=>{if(e.bO.isParsed())throw Error(`RTL text plugin already registered.`);e.bO.setState({pluginStatus:`parsed`,pluginURL:e.bO.getPluginURL()}),e.bO.applyArabicShaping=t.applyArabicShaping,e.bO.processBidirectionalText=t.processBidirectionalText,e.bO.processStyledBidirectionalText=t.processStyledBidirectionalText;for(let e of this.rtlPluginDeferredListeners)e(null,!0);this.rtlPluginDeferredListeners=[]}}setReferrer(e,t){this.referrer=t}setImages(e,t,n){this.availableImages[e]=t;for(let n in this.workerSources[e]){let r=this.workerSources[e][n];for(let e in r)r[e].availableImages=t}n()}setLayers(e,t,n){this.getLayerIndex(e).replace(t),n()}updateLayers(e,t,n){this.getLayerIndex(e).update(t.layers,t.removedIds),n()}loadTile(e,t,n){this.getWorkerSource(e,t.type,t.source).loadTile(t,n)}loadDEMTile(e,t,n){this.getDEMWorkerSource(e,t.source).loadTile(t,n)}reloadTile(e,t,n){this.getWorkerSource(e,t.type,t.source).reloadTile(t,n)}abortTile(e,t,n){this.getWorkerSource(e,t.type,t.source).abortTile(t,n)}removeTile(e,t,n){this.getWorkerSource(e,t.type,t.source).removeTile(t,n)}removeDEMTile(e,t){this.getDEMWorkerSource(e,t.source).removeTile(t)}removeSource(e,t,n){if(!this.workerSources[e]||!this.workerSources[e][t.type]||!this.workerSources[e][t.type][t.source])return;let r=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],r.removeSource===void 0?n():r.removeSource(t,n)}loadWorkerSource(e,t,n){try{this.self.importScripts(t.url),n()}catch(e){n(e.toString())}}syncRTLPluginState(t,n,r){if(e.bO.isParsed())r(null,!0);else if(e.bO.isParsing())this.rtlPluginDeferredListeners.push(r);else try{e.bO.setState(n);let t=e.bO.getPluginURL();e.bO.isLoaded()&&!e.bO.isParsed()&&t!=null?(e.bO.setState({pluginStatus:`parsing`,pluginURL:t}),this.self.importScripts(t),e.bO.isParsed()?r(null,!0):this.rtlPluginDeferredListeners.push(r)):r(null,!0)}catch(e){let t=e.toString();r(t);for(let e of this.rtlPluginDeferredListeners)e(t);this.rtlPluginDeferredListeners=[]}}getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}getLayerIndex(e){let t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new r),t}getWorkerSource(e,t,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][n]){let r={send:(t,n,r)=>{this.actor.send(t,n,r,e)}};this.workerSources[e][t][n]=new this.workerSourceTypes[t](r,this.getLayerIndex(e),this.getAvailableImages(e))}return this.workerSources[e][t][n]}getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new u),this.demWorkerSources[e][t]}enforceCacheSizeLimit(t,n){e.bP(n)}clearCaches(e,t,n){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],n()}}return e.i()&&(self.worker=new be(self)),be}),r([`./shared`],function(e){let t={antialias:!1,alpha:!0,stencil:!0,depth:!0},n,r;function i(e){let n=document.createElement(`canvas`),r=Object.create(t);r.failIfMajorPerformanceCaveat=e;let i=n.getContext(`webgl2`,r);if(!i)return!1;let a;try{a=i.createShader(i.VERTEX_SHADER)}catch(e){return!1}return!(!a||i.isContextLost())&&(i.shaderSource(a,`void main() {}`),i.compileShader(a),!0===i.getShaderParameter(a,i.COMPILE_STATUS))}var a=`1.21.0`;function o(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n{window.removeEventListener(`click`,s.suppressClickInternal,!0)},0)}static mousePos(t,n){let r=t.getBoundingClientRect();return new e.P(n.clientX-r.left-t.clientLeft,n.clientY-r.top-t.clientTop)}static touchPos(t,n){let r=t.getBoundingClientRect(),i=[];for(let a=0;a{l.supported&&(e.headers||(e.headers={}),e.headers.accept=`image/webp,*/*`);let r={requestParameters:e,supportImageRefresh:n,callback:t,cancelled:!1,completed:!1,cancel:()=>{r.completed||r.cancelled||(r.cancelled=!0,r.innerRequest&&(r.innerRequest.cancel(),p--),C())}};return f.push(r),C(),r},b=t=>{let{requestParameters:n,supportImageRefresh:r,callback:i}=t;return e.e(n,{type:`image`}),(!1!==r||e.i()||n.headers&&!Object.keys(n.headers).reduce((e,t)=>e&&t===`accept`,!0)?e.g:x)(n,(e,n,r,a)=>{S(t,i,e,n,r,a)})},x=(t,n)=>{let r=new Image,i=t.url,a=!1,o=t.credentials;return o&&o===`include`?r.crossOrigin=`use-credentials`:(o&&o===`same-origin`||!e.s(i))&&(r.crossOrigin=`anonymous`),r.fetchPriority=`high`,r.onload=()=>{n(null,r),r.onerror=r.onload=null},r.onerror=()=>{a||n(Error(`Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)),r.onerror=r.onload=null},r.src=i,{cancel:()=>{a=!0,r.src=``}}},S=(t,n,r,i,a,o)=>{r?n(r):i instanceof HTMLImageElement||e.a(i)?n(null,i):i&&function(t,n){typeof createImageBitmap==`function`?e.b(t,n):e.c(t,n)}(i,(e,t)=>{e==null?t!=null&&n(null,t,a,o):n(e)}),t.cancelled||(t.completed=!0,p--,C())},C=()=>{let e=(()=>{let e=Object.keys(h),t=!1;if(e.length>0){for(let n of e)if(t=h[+n](),t)break}return t})()?c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=p;t0;t++){let e=f.shift();if(e.cancelled){t--;continue}let n=b(e);p++,e.innerRequest=n}};f=[],p=0,m=0,h={};let w=a;class T{constructor(e,t){this._transformRequestFn=e,this._customAccessToken=t,this._createSkuToken()}_createSkuToken(){let e=function(){let e=``;for(let t=0;t<10;t++)e+=`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`[Math.floor(62*Math.random())];return{token:[`1`,`01`,e].join(``),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=e.token,this._skuTokenExpiresAt=e.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeStyleURL(e,t){if(!E(e))return e;let n=A(e);return n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||t)}normalizeGlyphsURL(e,t){if(!E(e))return e;let n=A(e);return n.path=`/fonts/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||t)}normalizeSourceURL(e,t){if(!E(e))return e;let n=A(e);return n.path=`/v4/${n.authority}.json`,n.params.push(`secure`),this._makeAPIURL(n,this._customAccessToken||t)}normalizeSpriteURL(e,t,n,r){let i=A(e);return E(e)?(i.path=`/styles/v1${i.path}/sprite${t}${n}`,this._makeAPIURL(i,this._customAccessToken||r)):(i.path+=`${t}${n}`,j(i))}normalizeTileURL(e,t,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!E(e))return e;let r=A(e);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${t>=2||n===512?`@2x`:``}${l.supported?`.webp`:`$1`}`),r.path=r.path.replace(/^.+\/v4\//,`/`),r.path=`/v4${r.path}`;let i=this._customAccessToken||function(e){for(let t of e){let e=t.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(r.params)||c.ACCESS_TOKEN;return c.REQUIRE_ACCESS_TOKEN&&i&&this._skuToken&&r.params.push(`sku=${this._skuToken}`),this._makeAPIURL(r,i)}canonicalizeTileURL(e,t){let n=A(e);if(!n.path.match(/(^\/v4\/)/)||!n.path.match(/\.[\w]+$/))return e;let r=`mapbox://tiles/`;r+=n.path.replace(`/v4/`,``);let i=n.params;return t&&(i=i.filter(e=>!e.match(/^access_token=/))),i.length&&(r+=`?${i.join(`&`)}`),r}canonicalizeTileset(e,t){let n=!!t&&E(t),r=[];for(let t of e.tiles||[])O(t)?r.push(this.canonicalizeTileURL(t,n)):r.push(t);return r}_makeAPIURL(e,t){let n=`See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes`,r=A(c.API_URL);if(e.protocol=r.protocol,e.authority=r.authority,e.protocol===`http`){let t=e.params.indexOf(`secure`);t>=0&&e.params.splice(t,1)}if(r.path!==`/`&&(e.path=`${r.path}${e.path}`),!c.REQUIRE_ACCESS_TOKEN)return j(e);if(!(t=t||c.ACCESS_TOKEN))throw Error(`An API access token is required to use Mapbox GL. ${n}`);if(t[0]===`s`)throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${n}`);return e.params=e.params.filter(e=>e.indexOf(`access_token`)===-1),e.params.push(`access_token=${t}`),j(e)}}function E(e){return e.indexOf(`mapbox:`)===0}let D=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function O(e){return D.test(e)}let k=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function A(e){let t=e.match(k);if(!t)throw Error(`Unable to parse URL object`);return{protocol:t[1],authority:t[2],path:t[3]||`/`,params:t[4]?t[4].split(`&`):[]}}function j(e){let t=e.params.length?`?${e.params.join(`&`)}`:``;return`${e.protocol}://${e.authority}${e.path}${t}`}let ee=`mapbox.eventData`;function te(t){if(!t)return null;let n=t.split(`.`);if(!n||n.length!==3)return null;try{return JSON.parse(e.h(n[1]))}catch(e){return null}}class ne{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){let n=te(c.ACCESS_TOKEN),r=``;return r=n&&n.u?e.d(n.u):c.ACCESS_TOKEN||``,t?`${ee}.${t}:${r}`:`${ee}:${r}`}fetchEventData(){let t=e.f(`localStorage`),n=this.getStorageKey(),r=this.getStorageKey(`uuid`);if(t)try{let e=window.localStorage.getItem(n);e&&(this.eventData=JSON.parse(e));let t=window.localStorage.getItem(r);t&&(this.anonId=t)}catch(t){e.w(`Unable to read from LocalStorage`)}}saveEventData(){let t=e.f(`localStorage`),n=this.getStorageKey(),r=this.getStorageKey(`uuid`);if(t)try{window.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&window.localStorage.setItem(n,JSON.stringify(this.eventData))}catch(t){e.w(`Unable to write to LocalStorage`)}}processRequests(e){}postEvent(t,n,r,i){if(!c.EVENTS_URL)return;let a=A(c.EVENTS_URL);a.params.push(`access_token=${i||c.ACCESS_TOKEN||``}`);let o={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:`mapbox-gl-js`,sdkVersion:w,skuId:`01`,userId:this.anonId},s=n?e.e(o,n):o,l={url:j(a),headers:{"Content-Type":`text/plain`},body:JSON.stringify([s])};this.pendingRequest=e.p(l,e=>{this.pendingRequest=null,r(e),this.saveEventData(),this.processRequests(i)})}queueRequest(e,t){this.queue.push(e),this.processRequests(t)}}let re=new class extends ne{constructor(e){super(`appUserTurnstile`),this._customAccessToken=e}postTurnstileEvent(e,t){c.EVENTS_URL&&c.ACCESS_TOKEN&&Array.isArray(e)&&e.some(e=>E(e)||O(e))&&this.queueRequest(Date.now(),t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();let n=te(c.ACCESS_TOKEN),r=n?n.u:c.ACCESS_TOKEN,i=r!==this.eventData.tokenU;e.v(this.anonId)||(this.anonId=e.u(),i=!0);let a=this.queue.shift();if(this.eventData.lastSuccess){let e=new Date(this.eventData.lastSuccess),t=new Date(a),n=(a-this.eventData.lastSuccess)/864e5;i=i||n>=1||n<-1||e.getDate()!==t.getDate()}else i=!0;if(!i)return this.processRequests();this.postEvent(a,{"enabled.telemetry":!1},e=>{e||(this.eventData.lastSuccess=a,this.eventData.tokenU=r)},t)}},ie=re.postTurnstileEvent.bind(re),ae=new class extends ne{constructor(){super(`map.load`),this.success={},this.skuToken=``}postMapLoadEvent(e,t,n,r){this.skuToken=n;let i=!(!r&&!c.ACCESS_TOKEN),a=Array.isArray(e)&&e.some(e=>E(e)||O(e));c.EVENTS_URL&&i&&a&&this.queueRequest({id:t,timestamp:Date.now()},r)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;let{id:n,timestamp:r}=this.queue.shift();n&&this.success[n]||(this.anonId||this.fetchEventData(),e.v(this.anonId)||(this.anonId=e.u()),this.postEvent(r,{skuToken:this.skuToken},e=>{e||n&&(this.success[n]=!0)},t))}},oe=ae.postMapLoadEvent.bind(ae);function se(t){var n=new e.A(3);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n}function ce(t,n,r){var i=new e.A(3);return i[0]=t,i[1]=n,i[2]=r,i}function le(e,t){var n=t[0],r=t[1],i=t[2],a=n*n+r*r+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}var ue,de=function(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e};ue=new e.A(3),e.A!=Float32Array&&(ue[0]=0,ue[1]=0,ue[2]=0);var fe=function(e){var t=e[0],n=e[1];return t*t+n*n};(function(){var t=new e.A(2);e.A!=Float32Array&&(t[0]=0,t[1]=0)})();class M{constructor(e,t,n,r){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(t,r)}update(t,n,r){let{width:i,height:a}=t,o=!(this.size&&this.size[0]===i&&this.size[1]===a||r),{context:s}=this,{gl:c}=s;if(this.useMipmap=!!(n&&n.useMipmap),c.bindTexture(c.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===c.RGBA&&(!n||!1!==n.premultiply)),o)this.size=[i,a],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.a(t)?c.texImage2D(c.TEXTURE_2D,0,this.format,this.format,c.UNSIGNED_BYTE,t):c.texImage2D(c.TEXTURE_2D,0,this.format,i,a,0,this.format,c.UNSIGNED_BYTE,t.data);else{let{x:n,y:o}=r||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.a(t)?c.texSubImage2D(c.TEXTURE_2D,0,n,o,c.RGBA,c.UNSIGNED_BYTE,t):c.texSubImage2D(c.TEXTURE_2D,0,n,o,i,a,c.RGBA,c.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&c.generateMipmap(c.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,t,n){let{context:r}=this,{gl:i}=r;i.bindTexture(i.TEXTURE_2D,this.texture),n!==i.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=i.LINEAR),e!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,n||e),this.filter=e),t!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function N(e){let{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class P extends e.E{constructor(t){super(),this.requestManager=t,this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.spriteLoaded=!1,this.spriteRequestors=[],this.patterns={},this.atlasImage=new e.l({width:1,height:1}),this.dirty=!0,this.imageUrlRequestors={}}isSpriteLoaded(){return this.spriteLoaded}setSpriteLoaded(e){if(this.spriteLoaded!==e&&(this.spriteLoaded=e,e)){for(let{ids:e,callback:t}of this.spriteRequestors)this._notify(e,t);this.spriteRequestors=[]}}getImage(e){return this.images[e]}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(t,n){let r=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new e.m(Error(`Image "${t}" has invalid "stretchX" value`))),r=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new e.m(Error(`Image "${t}" has invalid "stretchY" value`))),r=!1),this._validateContent(n.content,n)||(this.fire(new e.m(Error(`Image "${t}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let n=0;for(let r of e){if(r[0]0?this._loadImageUrls(n,()=>{this._handleImages(e,t)}):this._handleImages(e,t)}_loadImageUrls(t,n){e.n(t,(t,n)=>{if(this.images[t])return void n();let r=this.imageUrlRequestors[t];r||(r=this.imageUrlRequestors[t]=[],y(this.requestManager.transformRequest(t,e.R.Image),(e,n)=>{for(let t of r)t(e,n);delete this.imageUrlRequestors[t]})),r.push((r,i)=>{if(r)e.w(`Image "${t}" could not be called.`);else if(i&&!this.images[t]){let{width:n,height:r,data:a}=e.k.getImageData(i);this.addImage(t,{data:new e.l({width:n,height:r},a),pixelRatio:t.indexOf(`@2x`)>-1?2:1,sdf:!1,content:void 0,stretchX:void 0,stretchY:void 0,version:0})}n()})},()=>{n()})}_handleImages(e,t){let n=!0;if(!this.isSpriteLoaded())for(let t of e)this.images[t]||(n=!1);this.isSpriteLoaded()||n?this._notify(e,t):this.spriteRequestors.push({ids:e,callback:t})}_notify(t,n){let r={};for(let n of t){this.images[n]||this.fire(new e.o(`styleimagemissing`,{id:n}));let t=this.images[n];t?r[n]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,hasRenderCallback:!!(t.userImage&&t.userImage.render)}:e.w(`Image "${n}" 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.`)}n(null,r)}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(t){let n=this.patterns[t],r=this.getImage(t);if(!r)return null;if(n&&n.position.version===r.version)return n.position;if(n)n.position.version=r.version;else{let n={w:r.data.width+2,h:r.data.height+2,x:0,y:0},i=new e.I(n,r);this.patterns[t]={bin:n,position:i}}return this._updatePatternAtlas(),this.patterns[t].position}bind(e){let t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new M(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){let t=[];for(let e in this.patterns)t.push(this.patterns[e].bin);let{w:n,h:r}=e.q(t),i=this.atlasImage;i.resize({width:n||1,height:r||1});for(let t in this.patterns){let{bin:n}=this.patterns[t],r=n.x+1,a=n.y+1,o=this.images[t].data,s=o.width,c=o.height;e.l.copy(o,i,{x:0,y:0},{x:r,y:a},{width:s,height:c}),e.l.copy(o,i,{x:0,y:c-1},{x:r,y:a-1},{width:s,height:1}),e.l.copy(o,i,{x:0,y:0},{x:r,y:a+c},{width:s,height:1}),e.l.copy(o,i,{x:s-1,y:0},{x:r-1,y:a},{width:1,height:c}),e.l.copy(o,i,{x:0,y:0},{x:r+s,y:a},{width:1,height:c})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(let n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;let t=this.images[n];t||e.w(`Image with ID: "${n}" was not found`),N(t)&&this.updateImage(n,t)}}}function F(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}let I=0x56bc75e2d63100000,pe=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-(e/255)**(1/2.2);pe[e]=t*Math.abs(t)}function L(e,t,n,r,i,a,o,s,c){for(let l=t;l-1);c++,a[c]=s,o[c]=l,o[c+1]=I}for(let s=0,c=0;s{let r=this.entries[e];r||(r=this.entries[e]={glyphs:{},requests:{},ranges:{},fallbackRanges:{}});let i=r.glyphs[t];if(i!==void 0)return void n(null,{stack:e,id:t,glyph:i});if(i=this._tinySDF(r,e,t),i)return r.glyphs[t]=i,void n(null,{stack:e,id:t,glyph:i});let a=Math.floor(t/256);if(256*a>65535)return void n(Error(`glyphs > 65535 not supported`));let o=()=>{n(null,{stack:e,id:t,glyph:r.glyphs[t]})};if(r.ranges[a])return!i&&this.fallbackUrl?void this._loadFallbackGlyph(r,e,a,o):void n(null,{stack:e,id:t,glyph:i});let s=r.requests[a];s||(s=r.requests[a]=[],he.loadGlyphRange(e,a,this.url,this.requestManager,(e,t)=>{if(t){for(let e in t)this._doesCharSupportLocalGlyph(+e)||(r.glyphs[+e]=t[+e]);r.ranges[a]=!0}for(let n of s)n(e,t);delete r.requests[a]})),s.push((i,s)=>{if(i)n(i);else if(s){if(!s[t]&&this.fallbackUrl)return void this._loadFallbackGlyph(r,e,a,o);n(null,{stack:e,id:t,glyph:s[t]||null})}})},(e,t)=>{if(e)n(e);else if(t){let e={};for(let{stack:n,id:r,glyph:i}of t)(e[n]||(e[n]={}))[r]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics};n(null,e)}})}_loadFallbackGlyph(e,t,n,r){e.fallbackRanges[n]?r():he.loadGlyphRange(t,n,this.fallbackUrl,this.requestManager,(t,i)=>{for(let t in i)e.glyphs[+t]||this._doesCharSupportLocalGlyph(+t)||(e.glyphs[+t]=i[+t]),e.fallbackRanges[n]=!0;r()})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(e.t[`CJK Unified Ideographs`](t)||e.t[`Hangul Syllables`](t)||e.t.Hiragana(t)||e.t.Katakana(t))}_tinySDF(t,n,r){let i=this.localIdeographFontFamily;if(!i||!this._doesCharSupportLocalGlyph(r))return;let a=t.tinySDF;if(!a){let e=`400`;/bold/i.test(n)?e=`900`:/medium/i.test(n)?e=`500`:/light/i.test(n)&&(e=`200`),a=t.tinySDF=new he.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:i,fontWeight:e})}let o=String.fromCharCode(r),{data:s,width:c,height:l,glyphWidth:u,glyphHeight:d,glyphLeft:f,glyphTop:p,glyphAdvance:m}=a.draw(o);return{id:r,bitmap:new e.x({width:c||60,height:l||60},s),metrics:{width:u/2||24,height:d/2||24,left:f/2+.5||0,top:p/2-27.5||-8,advance:m/2||24,isDoubleResolution:!0}}}}he.loadGlyphRange=function(t,n,r,i,a){let o=256*n,s=o+255,c=i.transformRequest(i.normalizeGlyphsURL(r).replace(`{fontstack}`,t).replace(`{range}`,`${o}-${s}`),e.R.Glyphs);e.g(c,(t,n)=>{if(t)a(t);else if(n){let t={};for(let r of e.r(n))t[r.id]=r;a(null,t)}})},he.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:r=.25,fontFamily:i=`sans-serif`,fontWeight:a=`normal`,fontStyle:o=`normal`,lang:s=null}={}){this.buffer=t,this.radius=n,this.cutoff=r,this.lang=s;let c=this.size=e+4*t,l=this._createCanvas(c),u=this.ctx=l.getContext(`2d`,{willReadFrequently:!0});u.font=`${o} ${a} ${e}px ${i}`,u.textBaseline=`alphabetic`,u.textAlign=`left`,u.fillStyle=`black`,this.gridOuter=new Float64Array(c*c),this.gridInner=new Float64Array(c*c),this.f=new Float64Array(c),this.z=new Float64Array(c+1),this.v=new Uint16Array(c)}_createCanvas(e){if(typeof OffscreenCanvas<`u`)return new OffscreenCanvas(e,e);let t=document.createElement(`canvas`);return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:r,actualBoundingBoxLeft:i,actualBoundingBoxRight:a}=this.ctx.measureText(e),o=Math.ceil(n),s=Math.floor(-i),c=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a)-s)),l=Math.max(0,Math.min(this.size-this.buffer,o+Math.ceil(r))),u=c+2*this.buffer,d=l+2*this.buffer,f=Math.max(u*d,0),p=new Uint8ClampedArray(f),m={data:p,width:u,height:d,glyphWidth:c,glyphHeight:l,glyphTop:o,glyphLeft:s,glyphAdvance:t};if(c===0||l===0)return m;let{ctx:h,buffer:g,gridInner:_,gridOuter:v}=this;this.lang&&(h.lang=this.lang),h.clearRect(g,g,c,l),h.fillText(e,g-s,g+o);let y=h.getImageData(g,g,c,l);v.fill(I,0,f),_.fill(0,0,f);let b=3;for(let e=0;e0),i=new e.T,a=new e.S;if(r){let o=new e.M,s=e.z(n,o,i,a);this._modelArrays[t]={layoutVertexArray:null,textureVertexArray:o,indexArray:i,segments:a,segmentImageIndices:s,hasTexture:r}}else{let o=new e.B;e.C(n,o,i,a),this._modelArrays[t]={layoutVertexArray:o,textureVertexArray:null,indexArray:i,segments:a,segmentImageIndices:[],hasTexture:r}}this._pendingUpload.push(t)}getModelBuffers(e){return this._modelBuffers[e]}upload(t){let n=this._pendingUpload;for(let r of n){let n=this._modelArrays[r];if(!n)continue;let i=null,a=null;n.hasTexture&&n.textureVertexArray?a=t.createVertexBuffer(n.textureVertexArray,e.D.members):n.layoutVertexArray&&(i=t.createVertexBuffer(n.layoutVertexArray,e.F.members));let o=t.createIndexBuffer(n.indexArray),s=[],c=this.getModel(r);if(c!=null&&c.images)for(let e of c.images)e&&s.push(new M(t,e,t.gl.RGBA,{premultiply:!1}));this._modelBuffers[r]={vertexBuffer:i,textureVertexBuffer:a,indexBuffer:o,segments:n.segments,textures:s,segmentImageIndices:n.segmentImageIndices,hasTexture:n.hasTexture}}this._pendingUpload=[]}uploadPending(){return this._pendingUpload.length>0}isLoading(e){return!!this._requestors[e]}isLoaded(){return Object.keys(this._requestors).length===0}loadModel(e){if(this.getModel(e)||this._failedModels[e]>=3)return Promise.resolve();let t=this._requestors[e];if(t)return t;let n=new Promise((t,n)=>{R.loadModel(e,this.url,this.requestManager,(r,i)=>{if(delete this._requestors[e],r)return this._failedModels[e]=(this._failedModels[e]||0)+1,void n(r);this._models[e]=i,t()})});return this._requestors[e]=n,n}destroy(){let e=Object.values(this._modelBuffers);for(let t of e){t.vertexBuffer&&t.vertexBuffer.destroy(),t.textureVertexBuffer&&t.textureVertexBuffer.destroy(),t.indexBuffer.destroy(),t.segments.destroy();for(let e of t.textures)e.destroy()}this._models={},this._requestors={},this._failedModels={},this._modelArrays={},this._modelBuffers={},this._pendingUpload=[]}}R.loadModel=function(t,n,r,i){let a=r.transformRequest(n.replace(`{name}`,t),e.R.Model);e.y(a.url).then(e=>{i(null,e)}).catch(e=>{if(e&&e.status===404)return i(e);i(Error(`Failed to load model ${t}: ${e.message}`))})};let z=new e.G({anchor:new e.H(e.J.light.anchor),position:new class{constructor(){this.specification=e.J.light.position}possiblyEvaluate(t,n){return e.K(t.expression.evaluate(n))}interpolate(t,n,r){return{x:e.L(t.x,n.x,r),y:e.L(t.y,n.y,r),z:e.L(t.z,n.z,r)}}},color:new e.H(e.J.light.color),intensity:new e.H(e.J.light.intensity)});class B extends e.E{constructor(t){super(),this._transitionable=new e.N(z),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(e.O,t,n))for(let e in t){let n=t[e];e.endsWith(`-transition`)?this._transitionable.setTransition(e.slice(0,-11),n):this._transitionable.setValue(e,n)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,n,r){return(!r||!1!==r.validate)&&e.Q(this,t.call(e.U,e.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:e.J})))}}class ge{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let n=e.join(`,`)+String(t);return this.dashEntry[n]||(this.dashEntry[n]=this.addDash(e,t)),this.dashEntry[n]}getDashRanges(e,t,n){let r=[],i=e.length%2==1?-e[e.length-1]*n:0,a=e[0]*n,o=!0;r.push({left:i,right:a,isDash:o,zeroLength:e[0]===0});let s=e[0];for(let t=1;t1&&(o=e[++a]);let c=Math.abs(s-o.left),l=Math.abs(s-o.right),u=Math.min(c,l),d,f=t/n*(r+1);if(o.isDash){let e=r-Math.abs(f);d=Math.sqrt(u*u+e*e)}else d=r-Math.sqrt(u*u+f*f);this.data[i+s]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=e[t+1];n.zeroLength?e.splice(t,1):r&&r.isDash===n.isDash&&(r.left=n.left,e.splice(t,1))}let t=e[0],n=e[e.length-1];t.isDash===n.isDash&&(t.left=n.left-this.width,n.right=t.right+this.width);let r=this.width*this.nextRow,i=0,a=e[i];for(let t=0;t1&&(a=e[++i]);let n=Math.abs(t-a.left),o=Math.abs(t-a.right),s=Math.min(n,o);this.data[r+t]=Math.max(0,Math.min(255,(a.isDash?s:-s)+128))}}addDash(t,n){let r=n?7:0,i=2*r+1;if(this.nextRow+i>this.height)return e.w(`LineAtlas out of space`),null;let a=0;for(let e=0;e{e.send(t,n,r)},r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}function V(t,n,r){let i=function(i,a){if(i)return r(i);if(a){let i=e.X(e.e(a,t),[`tiles`,`minzoom`,`maxzoom`,`attribution`,`mapbox_logo`,`bounds`,`scheme`,`tileSize`,`encoding`,`dynamic-properties`,`format`]);a.vector_layers&&(i.vectorLayers=a.vector_layers,i.vectorLayerIds=i.vectorLayers.map(e=>e.id)),i.tiles=n.canonicalizeTileset(i,t.url),r(null,i)}};return t.url?e.j(n.transformRequest(n.normalizeSourceURL(t.url),e.R.Source),i):e.k.frame(()=>i(null,t))}_e.Actor=e.W;class ve{constructor(e,t){if(e){if(t)this.setSouthWest(e).setNorthEast(t);else if(e.length===4){let t=e;this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]])}else{let t=e;this.setSouthWest(t[0]).setNorthEast(t[1])}}}setNorthEast(t){return this._ne=t instanceof e.Y?new e.Y(t.lng,t.lat):e.Y.convert(t),this}setSouthWest(t){return this._sw=t instanceof e.Y?new e.Y(t.lng,t.lat):e.Y.convert(t),this}extend(t){let n=this._sw,r=this._ne,i,a;if(t instanceof e.Y)i=t,a=t;else{if(!(t instanceof ve))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ve.convert(t)):this.extend(e.Y.convert(t)):this;if(i=t._sw,a=t._ne,!i||!a)return this}return n||r?(n.lng=Math.min(i.lng,n.lng),n.lat=Math.min(i.lat,n.lat),r.lng=Math.max(a.lng,r.lng),r.lat=Math.max(a.lat,r.lat)):(this._sw=new e.Y(i.lng,i.lat),this._ne=new e.Y(a.lng,a.lat)),this}getCenter(){return new e.Y((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.Y(this.getWest(),this.getNorth())}getSouthEast(){return new e.Y(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:n,lat:r}=e.Y.convert(t),i=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&i}static convert(e){return e&&(e instanceof ve?e:new ve(e))}static fromLngLat(t,n=0){let r=360*n/40075017,i=r/Math.cos(Math.PI/180*t.lat);return new ve(new e.Y(t.lng-i,t.lat-r),new e.Y(t.lng+i,t.lat+r))}}class H{constructor(e,t,n){this.bounds=ve.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=n||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){let n=2**t.z,r=Math.floor(e._(this.bounds.getWest())*n),i=Math.floor(e.Z(this.bounds.getNorth())*n),a=Math.ceil(e._(this.bounds.getEast())*n),o=Math.ceil(e.Z(this.bounds.getSouth())*n);return t.x>=r&&t.x=i&&t.y{this.fire(new e.o(`data.update`))};this._properties=t,n?this._updateVersion(r):r()}setDynamicPropertiesUrl(e){this._properties&&(this._properties.tiles[0]=e)}getDynamicPropertiesUrl(){if(this._properties)return this._properties.tiles[0]}loadTile(t,n){let r=(e,r)=>t.aborted?n(null):e?n(e):(r?t.dynamicProperty={"mapping-key":this._properties[`mapping-key`],version:this._version,properties:r}:delete t.dynamicProperty,n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null))),i=()=>{if(!this._version)return delete t.dynamicProperty,n(null);let i=this._getDynamicPropertiesTileUrl(t);e.j({url:i},r)};this._loaded?i():this.once(`version.load`,i)}_getDynamicPropertiesTileUrl(e){let{x:t,y:n,z:r}=e.tileID.canonical,{tiles:i}=this._properties;return a={x:t,y:n,z:r,version:this._version},i[0].replace(/\{(-?)(\w+)\}/g,(e,t,n)=>n in a?String(a[n]):``);var a}pause(){this._paused||(this._paused=!0,this._clearUpdateTimer())}resume(){if(!this._paused||(this._paused=!1,!this._properties))return;let{update:t}=this._properties;if(!t||!t[`check-interval`])return;let n=e.k.now()-this._lastTime,r=1e3*t[`check-interval`]-n;this._startUpdateTimer(r<0?0:Math.floor(r/1e3))}_startUpdateTimer(e){this._clearUpdateTimer(),this._timer=setTimeout(this._updateVersion.bind(this),1e3*(isNaN(e)?60:e))}_clearUpdateTimer(){clearTimeout(this._timer),delete this._timer}_updateVersion(t){if(!this._properties||!this._properties.version)return;let n=!1,r=this.source,i=this.map.style._layers;for(let e in i){let t=i[e];if(t.source===r.id&&t.visibility===`visible`){n=!0;break}}if(this._loaded&&!n)return;let{version:a,update:o}=this._properties,s=this._version;e.j({url:a.url},(n,r)=>{n?this.fire(new e.m(n)):r&&(this._version=r.version,s&&this._version!==s&&this.source.setSourceDynamincProperty(()=>{}),o&&o[`check-interval`]&&this._startUpdateTimer(o[`check-interval`])),t&&t(),this._loaded||(this.fire(new e.o(`version.load`)),this._loaded=!0),this._lastTime=e.k.now()})}_onVisibilityChange(){this._visibilityState!==document.visibilityState&&(document.visibilityState===`hidden`?this.pause():document.visibilityState===`visible`&&this.resume(),this._visibilityState=document.visibilityState)}}class be extends e.E{constructor(t,n,r,i){super(),this.id=t,this.dispatcher=r,this.setEventedParent(i),this.type=`raster`,this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=`xyz`,this.tileSize=512,this._loaded=!1,this._options=e.e({type:`raster`},n),e.e(this,e.X(n,[`url`,`scheme`,`tileSize`]))}load(){this._loaded=!1,this.fire(new e.o(`dataloading`,{dataType:`source`})),this._tileJSONRequest=V(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new e.m(t)):n&&(e.e(this,n),n.bounds&&(this.tileBounds=new H(n.bounds,this.minzoom,this.maxzoom)),ie(n.tiles),oe(n.tiles,this.map._getMapId(),this.map._requestManager._skuToken),this.fire(new e.o(`data`,{dataType:`source`,sourceDataType:`metadata`})),this.fire(new e.o(`data`,{dataType:`source`,sourceDataType:`content`})))})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return e.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,n){let r=this.map.getPixelRatio(),i=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,r,this.scheme),r,this.tileSize);t.request=y(this.map._requestManager.transformRequest(i,e.R.Tile),(r,i)=>{if(delete t.request,t.aborted)t.state=`unloaded`,n(null);else if(r)t.state=`errored`,n(r);else if(i){this.map._refreshExpiredTiles&&t.setExpiryData(i),delete i.cacheControl,delete i.expires;let r=this.map.painter.context,a=r.gl;t.texture=this.map.painter.getTileTexture(i.width),t.texture?t.texture.update(i,{useMipmap:!0}):(t.texture=new M(r,i,a.RGBA,{useMipmap:!0}),t.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST),r.extTextureFilterAnisotropic&&a.texParameterf(a.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax)),t.state=`loaded`,e.a0(this.dispatcher),n(null)}},this.map._refreshExpiredTiles)}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t()}unloadTile(e,t){e.texture&&this.map.painter.saveTileTexture(e.texture),t()}hasTransition(){return!1}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.cancel(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}}let xe;var Se=e.a3([{name:`a_pos`,type:`Int16`,components:2},{name:`a_texture_pos`,type:`Int16`,components:2}]);class Ce extends e.E{constructor(e,t,n,r){super(),this.id=e,this.dispatcher=n,this.coordinates=t.coordinates,this.type=`image`,this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}load(t,n){this._loaded=!1,this.fire(new e.o(`dataloading`,{dataType:`source`})),this.url=this.options.url,y(this.map._requestManager.transformRequest(this.url,e.R.Image),(r,i)=>{this._loaded=!0,r?this.fire(new e.m(r)):i&&(this.image=i,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return this.image&&e.url?(this.options.url=e.url,this.load(e.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.o(`data`,{dataType:`source`,sourceDataType:`metadata`})))}onAdd(e){this.map=e,this.load()}setCoordinates(t){this.coordinates=t;let n=t.map(e.a4.fromLngLat);this.tileID=function(t){let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let e of t)n=Math.min(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x),a=Math.max(a,e.y);let o=Math.max(i-n,a-r),s=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),c=2**s;return new e.a6(s,Math.floor((n+i)/2*c),Math.floor((r+a)/2*c))}(n),this.minzoom=this.maxzoom=this.tileID.z;let r=n.map(e=>this.tileID.getTilePoint(e)._round());return this._boundsArray=new e.a5,this._boundsArray.emplaceBack(r[0].x,r[0].y,0,0),this._boundsArray.emplaceBack(r[1].x,r[1].y,e.a2,0),this._boundsArray.emplaceBack(r[3].x,r[3].y,0,e.a2),this._boundsArray.emplaceBack(r[2].x,r[2].y,e.a2,e.a2),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new e.o(`data`,{dataType:`source`,sourceDataType:`content`})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Se.members)),this.boundsSegments||(this.boundsSegments=e.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new M(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture)}}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state=`errored`,t(null))}serialize(){return{type:`image`,url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}let U={vector:class extends e.E{constructor(t,n,r,i){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.X(n,[`url`,`scheme`,`tileSize`,`promoteId`])),this._options=e.e({type:`vector`},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw Error(`vector tile sources must have a tileSize of 512`);this.setEventedParent(i)}setDynamicPropertiesUrl(e){this.setSourceDynamincProperty(()=>{this._dynamicPropertiesUrl=e,this._dynamicPropertySource&&this._dynamicPropertySource.setDynamicPropertiesUrl(e)})}getDynamicPropertiesUrl(){if(this._dynamicPropertySource)return this._dynamicPropertySource.getDynamicPropertiesUrl()}load(){this._dynamicPropertySource&&this._dynamicPropertySource.hasProperties()&&this._dynamicPropertySource.reset(),this._loaded=!1,this.fire(new e.o(`dataloading`,{dataType:`source`})),this._tileJSONRequest=V(this._options,this.map._requestManager,(t,n)=>{if(this._tileJSONRequest=null,this.fire(new e.o(`data.load`)),t)this._loaded=!0,this.fire(new e.m(t));else if(n){e.e(this,n),n.bounds&&(this.tileBounds=new H(n.bounds,this.minzoom,this.maxzoom)),ie(n.tiles,this.map._requestManager._customAccessToken),oe(n.tiles,this.map._getMapId(),this.map._requestManager._skuToken,this.map._requestManager._customAccessToken);let t=()=>{this._loaded=!0,this.fire(new e.o(`data`,{dataType:`source`,sourceDataType:`metadata`})),this.fire(new e.o(`data`,{dataType:`source`,sourceDataType:`content`}))};if(!n[`dynamic-properties`])return t();this._dynamicPropertiesUrl&&(n[`dynamic-properties`].tiles[0]=this._dynamicPropertiesUrl),this._dynamicPropertySource.once(`data.update`,t),this._dynamicPropertySource.setDynamicProperties(n[`dynamic-properties`])}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this._dynamicPropertySource=new ye(e,this),this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.cancel(),e(),this._clearSourceCacheTiles(),this.load()}setSourceDynamincProperty(e){this._tileJSONRequest&&this._tileJSONRequest.cancel(),e();let t=this.map.style.sourceCaches[this.id];t.reload(),t.transform&&t.update(t.transform)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.once(`data.load`,()=>{this._clearSourceCacheTiles()}),this.setSourceProperty(()=>{this.url=e,this._options.url=e,this._dynamicPropertiesUrl=null}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null),this._dynamicPropertySource&&(this._dynamicPropertySource.destroy(),this._dynamicPropertySource=void 0)}serialize(){return e.e({},this._options)}loadTile(t,n){let r=this.map.getPixelRatio(),i=()=>{let i=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,r,this.scheme),r),a={request:this.map._requestManager.transformRequest(i,e.R.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:r,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,dynamicProperty:null,language:this.map.language,englishWrapWidthMultiplier:this.map.englishWrapWidthMultiplier};function o(r,i){return delete t.request,t.aborted?n(null):r&&r.status!==404?n(r):(i&&i.resourceTiming&&(t.resourceTiming=i.resourceTiming),this.map._refreshExpiredTiles&&i&&t.setExpiryData(i),t.loadVectorData(i,this.map.painter),e.a0(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}a.request.collectResourceTiming=this._collectResourceTiming,t.dynamicProperty&&(a.dynamicProperty=t.dynamicProperty),t.actor&&t.state!==`expired`?t.state===`loading`?t.reloadCallback=n:t.request=t.actor.send(`reloadTile`,a,o.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send(`loadTile`,a,o.bind(this)))};this._dynamicPropertySource.hasProperties()?this._dynamicPropertySource.loadTile(t,i):i()}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send(`abortTile`,{uid:e.uid,type:this.type,source:this.id},void 0)}unloadTile(e){e.unloadVectorData(),e.actor&&e.actor.send(`removeTile`,{uid:e.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}_clearSourceCacheTiles(){this.map.style.sourceCaches[this.id].clearTiles()}},raster:be,"raster-dem":class extends be{constructor(t,n,r,i){super(t,n,r,i),this.type=`raster-dem`,this.maxzoom=22,this._options=e.e({type:`raster-dem`},n),this.encoding=n.encoding||`mapbox`}loadTile(t,n){let r=this.map.getPixelRatio(),i=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,r,this.scheme),r,this.tileSize);function a(e,r){e&&(t.state=`errored`,n(e)),r&&(t.dem=r,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state=`loaded`,n(null)),t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)}t.request=y(this.map._requestManager.transformRequest(i,e.R.Tile),function(r,i){if(delete t.request,t.aborted)t.state=`unloaded`,n(null);else if(r)t.state=`errored`,n(r);else if(i){this.map._refreshExpiredTiles&&t.setExpiryData(i),delete i.cacheControl,delete i.expires;let r=e.a(i)&&(xe==null&&(xe=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)&&typeof createImageBitmap==`function`),xe)?i:e.k.getImageData(i,1),o={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:r,encoding:this.encoding};t.actor&&t.state!==`expired`?t.state===`loading`?t.reloadCallback=n:t.actor.send(`loadDEMTile`,o,a.bind(this)):(t.actor=this.dispatcher.getActor(),t.actor.send(`loadDEMTile`,o,a.bind(this)))}}.bind(this),this.map._refreshExpiredTiles),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){let n=t.canonical,r=2**n.z,i=(n.x-1+r)%r,a=n.x===0?t.wrap-1:t.wrap,o=(n.x+1+r)%r,s=n.x+1===r?t.wrap+1:t.wrap,c={};return c[new e.a1(t.overscaledZ,a,n.z,i,n.y).key]={backfilled:!1},c[new e.a1(t.overscaledZ,s,n.z,o,n.y).key]={backfilled:!1},n.y>0&&(c[new e.a1(t.overscaledZ,a,n.z,i,n.y-1).key]={backfilled:!1},c[new e.a1(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},c[new e.a1(t.overscaledZ,s,n.z,o,n.y-1).key]={backfilled:!1}),n.y+1{if(t)return void this.fire(new e.m(t));let n={dataType:`source`,sourceDataType:`metadata`};this._collectResourceTiming&&this._resourceTiming&&this._resourceTiming.length>0&&(n.resourceTiming=this._resourceTiming,this._resourceTiming=[]),this.fire(new e.o(`data`,n))})}onAdd(e){this.map=e,this.load()}setData(t){return this._data=t,this.fire(new e.o(`dataloading`,{dataType:`source`})),this._updateWorkerData(t=>{if(t)return void this.fire(new e.m(t));let n={dataType:`source`,sourceDataType:`content`};this._collectResourceTiming&&this._resourceTiming&&this._resourceTiming.length>0&&(n.resourceTiming=this._resourceTiming,this._resourceTiming=[]),this.fire(new e.o(`data`,n))}),this}getClusterExpansionZoom(e,t){return this.actor.send(`geojson.getClusterExpansionZoom`,{clusterId:e,source:this.id},t),this}getClusterChildren(e,t){return this.actor.send(`geojson.getClusterChildren`,{clusterId:e,source:this.id},t),this}getClusterLeaves(e,t,n,r){return this.actor.send(`geojson.getClusterLeaves`,{source:this.id,clusterId:e,limit:t,offset:n},r),this}_updateWorkerData(t){this._loaded=!1;let n=e.e({},this.workerOptions),r=this._data;typeof r==`string`?(n.request=this.map._requestManager.transformRequest(e.k.resolveURL(r),e.R.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(r),this.actor.send(`${this.type}.loadData`,n,(e,r)=>{this._removed||r&&r.abandoned||(this._loaded=!0,r&&r.resourceTiming&&r.resourceTiming[this.id]&&(this._resourceTiming=r.resourceTiming[this.id].slice(0)),this.actor.send(`${this.type}.coalesce`,{source:n.source},null),t(e))})}loaded(){return this._loaded}loadTile(e,t){let n=e.actor?`reloadTile`:`loadTile`;e.actor=this.actor;let r={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.request=this.actor.send(n,r,(r,i)=>(delete e.request,e.unloadVectorData(),e.aborted?t(null):r?t(r):(e.loadVectorData(i,this.map.painter,n===`reloadTile`),t(null))))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){e.unloadVectorData(),this.actor.send(`removeTile`,{uid:e.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send(`removeSource`,{type:this.type,source:this.id})}serialize(){return e.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}setClusterOptions(e){let t=this.workerOptions.superclusterOptions;for(let n in e)t[n]!==void 0&&(t[n]=e[n]);this.updateClusterOptions()}updateClusterOptions(){let{type:e,maxZoom:t}=this.workerOptions.superclusterOptions;if(typeof e==`function`){let n=[],r=e;for(let e=0;e<=t;e++)n.push(r(e));n.push(r(t)),this.workerOptions.superclusterOptions.type=n}}},video:class extends Ce{constructor(e,t,n,r){super(e,t,n,r),this.roundZoom=!0,this.type=`video`,this.options=t}load(){this._loaded=!1;let t=this.options;this.urls=[];for(let n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,e.R.Source).url);e.a7(this.urls,(t,n)=>{this._loaded=!0,t?this.fire(new e.m(t)):n&&(this.video=n,this.video.loop=!0,this.video.setAttribute(`playsinline`,``),this.video.addEventListener(`playing`,()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){let n=this.video.seekable;tn.end(0)?this.fire(new e.m(new e.a8(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Se.members)),this.boundsSegments||(this.boundsSegments=e.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new M(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture)}}serialize(){return{type:`video`,urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:Ce,canvas:class extends Ce{constructor(t,n,r,i){super(t,n,r,i),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(e=>!Array.isArray(e)||e.length!==2||e.some(e=>typeof e!=`number`))||this.fire(new e.m(new e.a8(`sources.${t}`,null,`"coordinates" property must be an array of 4 longitude/latitude array pairs`))):this.fire(new e.m(new e.a8(`sources.${t}`,null,`missing required property "coordinates"`))),n.animate&&typeof n.animate!=`boolean`&&this.fire(new e.m(new e.a8(`sources.${t}`,null,`optional "animate" property must be a boolean value`))),n.canvas?typeof n.canvas==`string`||n.canvas instanceof HTMLCanvasElement||this.fire(new e.m(new e.a8(`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.m(new e.a8(`sources.${t}`,null,`missing required property "canvas"`))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){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.m(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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let n=this.map.painter.context,r=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,Se.members)),this.boundsSegments||(this.boundsSegments=e.S.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new M(n,this.canvas,r.RGBA,{premultiply:!0});for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture)}}serialize(){return{type:`canvas`,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},"mesh-batch":class extends e.E{constructor(t,n,r,i){super(),this.id=t,this.dispatcher=r,this.setEventedParent(i),this.type=`mesh-batch`,this.minzoom=0,this.maxzoom=22,this.scheme=`xyz`,this.tileSize=512,this._loaded=!1,e.e(this,e.X(n,[`url`,`scheme`,`tileSize`])),this._options=e.e({type:`mesh-batch`},n)}load(){this._loaded=!1,this.fire(new e.o(`dataloading`,{dataType:`source`})),this._tileJSONRequest=V(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new e.m(t)):n&&(e.e(this,n),n.bounds&&(this.tileBounds=new H(n.bounds,this.minzoom,this.maxzoom)),ie(n.tiles),oe(n.tiles,this.map._getMapId(),this.map._requestManager._skuToken),this.fire(new e.o(`data`,{dataType:`source`,sourceDataType:`metadata`})),this.fire(new e.o(`data`,{dataType:`source`,sourceDataType:`content`})))})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return e.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,n){let r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),this.map.getPixelRatio()),i={request:this.map._requestManager.transformRequest(r,e.R.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,type:this.type,source:this.id};function a(e,r){return delete t.request,t.aborted?n(null):e&&e.status!==404?n(e):(r&&r.resourceTiming&&(t.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadMeshBatchData(r,this.map.painter),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}t.actor&&t.state!==`expired`?t.state===`loading`?t.reloadCallback=n:t.request=t.actor.send(`reloadTile`,i,a.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send(`loadTile`,i,a.bind(this)))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send(`abortTile`,{uid:e.uid,type:this.type,source:this.id},void 0)}unloadTile(e){e.unloadMeshBatchData(),e.actor&&e.actor.send(`removeTile`,{uid:e.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}};function we(t,n){let r=e.a9([]);return e.aa(r,r,[1,1,0]),e.ab(r,r,[.5*t.width,.5*t.height,1]),e.ac(r,r,t.calculatePosMatrix(n.toUnwrapped()))}function Te(e,t,n,r,i,a){let o=function(e,t,n){if(e)for(let r of e){let e=t[r];if(e&&e.source===n&&e.type===`fill-extrusion`)return!0}else for(let e in t){let r=t[e];if(r.source===n&&r.type===`fill-extrusion`)return!0}return!1}(i&&i.layers,t,e.id),s=a.maxPitchScaleFactor(),c=e.tilesIn(r,s,o);c.sort(Ee);let l=[];for(let r of c)l.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,n,e._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,i,a,s,we(e.transform,r.tileID))});let u=function(e){let t={},n={};for(let r of e){let e=r.queryResults,i=r.wrappedTileID,a=n[i]=n[i]||{};for(let n in e){let r=e[n],i=a[n]=a[n]||{},o=t[n]=t[n]||[];for(let e of r)i[e.featureIndex]||(i[e.featureIndex]=!0,o.push(e))}}return t}(l);for(let t in u)u[t].forEach(t=>{let n=t.feature,r=e.getFeatureState(n.layer[`source-layer`],n.id);n.source=n.layer.source,n.layer[`source-layer`]&&(n.sourceLayer=n.layer[`source-layer`]),n.state=r});return u}function Ee(e,t){let n=e.tileID,r=t.tileID;return n.overscaledZ-r.overscaledZ||n.canonical.y-r.canonical.y||n.wrap-r.wrap||n.canonical.x-r.canonical.x}function De(e,t){let n={};if(!t)return n;for(let r of e){let e=r.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(e.length!==0){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(let t of e)n[t.id]=r}}return n}class Oe{constructor(t,n){this.tileID=t,this.uid=e.V(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state=`loading`}registerFadeDuration(t){let n=t+this.timeAdded;n{let t=null;return t=o&&o.feature?o.feature(e.featureIndex):i.vtLayers&&i.vtLayers._geojsonTileLayer?i.vtLayers._geojsonTileLayer.feature(e.featureIndex):null,t?s.evaluate(t,void 0):0};for(let t=0;te)t=!1;else if(n){if(this.expirationTime{this.remove(e,i)},n)),this.data[r].push(i),this.order.push(r),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let n=e.wrapped().key,r=t===void 0?0:this.data[n].indexOf(t),i=this.data[n][r];return this.data[n].splice(r,1),i.timeout&&clearTimeout(i.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(i.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let t=[];for(let n in this.data)for(let r of this.data[n])e(r.value)||t.push(r);for(let e of t)this.remove(e.value.tileID,e)}}class Ae{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,r){let i=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][i]=this.stateChanges[t][i]||{},e.e(this.stateChanges[t][i],r),this.deletedStates[t]===null){this.deletedStates[t]={};for(let e in this.state[t])e!==i&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][i]===null){this.deletedStates[t][i]={};for(let e in this.state[t][i])r[e]||(this.deletedStates[t][i][e]=null)}else for(let e in r)this.deletedStates[t]&&this.deletedStates[t][i]&&this.deletedStates[t][i][e]===null&&delete this.deletedStates[t][i][e]}removeFeatureState(e,t,n){if(this.deletedStates[e]===null)return;let r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&t!==void 0)this.deletedStates[e][r]!==null&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][n]=null);else if(t!==void 0){if(this.stateChanges[e]&&this.stateChanges[e][r])for(n in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][n]=null;else this.deletedStates[e][r]=null}else this.deletedStates[e]=null}getState(t,n){let r=String(n),i=e.e({},(this.state[t]||{})[r],(this.stateChanges[t]||{})[r]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){let e=this.deletedStates[t][n];if(e===null)return{};for(let t in e)delete i[t]}return i}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(t,n){let r={};for(let t in this.stateChanges){this.state[t]=this.state[t]||{};let n={};for(let r in this.stateChanges[t])this.state[t][r]||(this.state[t][r]={}),e.e(this.state[t][r],this.stateChanges[t][r]),n[r]=this.state[t][r];r[t]=n}for(let t in this.deletedStates){this.state[t]=this.state[t]||{};let n={};if(this.deletedStates[t]===null)for(let e in this.state[t])n[e]={},this.state[t][e]={};else for(let e in this.deletedStates[t]){if(this.deletedStates[t][e]===null)this.state[t][e]={};else for(let n of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][n];n[e]=this.state[t][e]}r[t]=r[t]||{},e.e(r[t],n)}if(this.stateChanges={},this.deletedStates={},Object.keys(r).length!==0)for(let e in t)t[e].setFeatureState(r,n)}}class je extends e.E{constructor(t,n,r){super(),this.id=t,this.dispatcher=r,this.on(`data`,e=>{e.dataType===`source`&&e.sourceDataType===`metadata`&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType===`source`&&e.sourceDataType===`content`&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on(`error`,()=>{this._sourceErrored=!0}),this._source=function(t,n,r,i){let a=new U[n.type](t,n,r,i);if(a.id!==t)throw Error(`Expected Source id to be ${t} instead of ${a.id}`);return e.$([`load`,`abort`,`unload`,`serialize`,`prepare`],a),a}(t,n,r,this),this._tiles={},this._cache=new ke(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ae}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;for(let e in this._tiles){let t=this._tiles[e];if(t.state!==`loaded`&&t.state!==`errored`)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,t){return this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,()=>{})}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e,()=>{})}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let t in this._tiles){let n=this._tiles[t];n.upload(e),n.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(Me).map(e=>e.key)}getRenderableIds(t){let n=[];for(let e in this._tiles)this._isIdRenderable(e,t)&&n.push(this._tiles[e]);return t?n.sort((t,n)=>{let r=t.tileID,i=n.tileID,a=new e.P(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),o=new e.P(i.canonical.x,i.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-i.overscaledZ||o.y-a.y||o.x-a.x}).map(e=>e.tileID.key):n.map(e=>e.tileID).sort(Me).map(e=>e.key)}hasRenderableParent(e){let t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let e in this._tiles)this._tiles[e].state!==`errored`&&this._reloadTile(e,`reloading`)}}_reloadTile(e,t){let n=this._tiles[e];n&&(n.state!==`loading`&&(n.state=t),this._loadTile(n,this._tileLoaded.bind(this,n,e,t)))}_tileLoaded(t,n,r,i){if(i)return t.state=`errored`,void(i.status===404?this.update(this.transform,this.terrain):this._source.fire(new e.m(i,{tile:t})));t.timeAdded=e.k.now(),r===`expired`&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type===`raster-dem`&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new e.o(`data`,{dataType:`source`,tile:t,coord:t.tileID}))}_backfillDEM(e){let t=this.getRenderableIds();for(let r=0;r1||(Math.abs(n)>1&&(Math.abs(n+i)===1?n+=i:Math.abs(n-i)===1&&(n-=i)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,n,r),e.neighboringTiles&&e.neighboringTiles[a]&&(e.neighboringTiles[a].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,n,r){for(let i in this._tiles){let a=this._tiles[i];if(r[i]||!a.hasData()||a.tileID.overscaledZ<=t||a.tileID.overscaledZ>n)continue;let o=a.tileID;for(;a&&a.tileID.overscaledZ>t+1;){let e=a.tileID.scaledTo(a.tileID.overscaledZ-1);a=this._tiles[e.key],a&&a.hasData()&&(o=e)}let s=o;for(;s.overscaledZ>t;)if(s=s.scaledTo(s.overscaledZ-1),e[s.key]){r[o.key]=o;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){let n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=t?n:null}for(let n=e.overscaledZ-1;n>=t;n--){let t=e.scaledTo(n),r=this._getLoadedTile(t);if(r)return r}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){let t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let t=Math.ceil(e.width/this._source.tileSize)+1,n=Math.ceil(e.height/this._source.tileSize)+1,r=Math.floor(t*n*5),i=typeof this._maxTileCacheSize==`number`?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(i)}handleWrapJump(e){let t=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,t){let e={};for(let n in this._tiles){let r=this._tiles[n];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e;for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e in this._tiles)this._setTileReloadTimer(e,this._tiles[e])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let r;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.a1(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(r=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,upscalingZoom:this._source.upscalingZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(r=r.filter(e=>this._source.hasTile(e)))):r=[];let i=t.coveringZoomLevel(this._source),a=Math.max(i-je.maxOverzooming,this._source.minzoom),o=Math.max(i+je.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let e={};for(let t of r)if(t.canonical.z>this._source.minzoom){let n=t.scaledTo(t.canonical.z-1);e[n.key]=n;let r=t.scaledTo(Math.max(this._source.minzoom,Math.min(t.canonical.z,5)));e[r.key]=r}r=r.concat(Object.values(e))}let s=this._updateRetainedTiles(r,i);if(Ne(this._source.type)){let t={},c={},l=Object.keys(s);for(let n of l){let r=s[n],i=this._tiles[n];if(!i||i.fadeEndTime&&i.fadeEndTime<=e.k.now())continue;let o=this.findLoadedParent(r,a),l=this.findLoadedSibling(r),u=o||l;u&&(this._addTile(u.tileID),t[u.tileID.key]=u.tileID),c[n]=r}this._retainLoadedChildren(c,i,o,s);for(let e in t)s[e]||(this._coveredTiles[e]=!0,s[e]=t[e]);if(n){let e={},t={};for(let n of r)this._tiles[n.key].hasData()?e[n.key]=n:t[n.key]=n;for(let n in t){let r=t[n].children(this._source.maxzoom);this._tiles[r[0].key]&&this._tiles[r[1].key]&&this._tiles[r[2].key]&&this._tiles[r[3].key]&&(e[r[0].key]=s[r[0].key]=r[0],e[r[1].key]=s[r[1].key]=r[1],e[r[2].key]=s[r[2].key]=r[2],e[r[3].key]=s[r[3].key]=r[3],delete t[n])}for(let n in t){let r=t[n],i=this.findLoadedParent(r,this._source.minzoom),a=this.findLoadedSibling(r),o=i||a;if(o){e[o.tileID.key]=s[o.tileID.key]=o.tileID;for(let t in e)e[t].isChildOf(o.tileID)&&delete e[t]}}for(let t in this._tiles)e[t]||(this._coveredTiles[t]=!0)}}for(let e in s)this._tiles[e].clearFadeHold();let c=e.al(this._tiles,s);for(let e of c){let t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(e)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){let n={},r={},i=Math.max(t-je.maxOverzooming,this._source.minzoom),a=Math.max(t+je.maxUnderzooming,this._source.minzoom),o={};for(let r of e){let e=this._addTile(r);n[r.key]=r,e.hasData()||tthis._source.maxzoom){let e=a.children(this._source.maxzoom)[0],t=this.getTile(e);if(t&&t.hasData()){n[e.key]=e;continue}}else{let e=a.children(this._source.maxzoom);if(n[e[0].key]&&n[e[1].key]&&n[e[2].key]&&n[e[3].key])continue}let o=e.wasRequested();for(let t=a.overscaledZ-1;t>=i;--t){let i=a.scaledTo(t);if(r[i.key]||(r[i.key]=!0,e=this.getTile(i),!e&&o&&(e=this._addTile(i)),e&&(n[i.key]=i,o=e.wasRequested(),e.hasData())))break}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let t=[],n,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){n=this._loadedParentTiles[r.key];break}t.push(r.key);let e=r.scaledTo(r.overscaledZ-1);if(n=this._getLoadedTile(e),n)break;r=e}for(let e of t)this._loadedParentTiles[e]=n}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));let r=!!n;return r||(n=new Oe(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,r||this._source.fire(new e.o(`dataloading`,{tile:n,coord:n.tileID,dataType:`source`})),n}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let n=t.getExpiryTimeout();n&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,`expired`),delete this._timers[e]},n))}_removeTile(e){let t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&t.state!==`reloading`?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(t,n,r){let i=[],a=this.transform;if(!a)return i;let o=r?a.getCameraQueryGeometry(t):t,s=t.map(e=>a.pointCoordinate(e,this.terrain)),c=o.map(e=>a.pointCoordinate(e,this.terrain)),l=this.getIds(),u=1/0,d=1/0,f=-1/0,p=-1/0;for(let e of c)u=Math.min(u,e.x),d=Math.min(d,e.y),f=Math.max(f,e.x),p=Math.max(p,e.y);for(let t=0;t=0&&g[1].y+h>=0){let e=s.map(e=>o.getTilePoint(e)),t=c.map(e=>o.getTilePoint(e));i.push({tile:r,tileID:o,queryGeometry:e,cameraQueryGeometry:t,scale:m})}}return i}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(e=>this._tiles[e].tileID);for(let e of t)e.posMatrix=this.transform.calculatePosMatrix(e.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(Ne(this._source.type))for(let t in this._tiles){let n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=e.k.now())return!0}return!1}setFeatureState(e,t,n){this._state.updateState(e=e||`_geojsonTileLayer`,t,n)}removeFeatureState(e,t,n){this._state.removeFeatureState(e=e||`_geojsonTileLayer`,t,n)}getFeatureState(e,t){return this._state.getState(e=e||`_geojsonTileLayer`,t)}setDependencies(e,t,n){let r=this._tiles[e];r&&r.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(let n in this._tiles)this._tiles[n].hasDependency(e,t)&&this._reloadTile(n,`reloading`);this._cache.filter(n=>!n.hasDependency(e,t))}}function Me(e,t){let n=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-n||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Ne(e){return e===`raster`||e===`image`||e===`video`}function Pe(){return new Worker(c.WORKER_URL)}je.maxOverzooming=10,je.maxUnderzooming=3;let Fe=`mapboxgl_preloaded_worker_pool`;class Ie{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Fe]}numActive(){return Object.keys(this.active).length}}let Le=Math.floor(e.k.hardwareConcurrency/2),Re;function ze(){return Re||(Re=new Ie),Re}function Be(t,n){let r={};for(let e in t)e!==`ref`&&(r[e]=t[e]);return e.an.forEach(e=>{e in n&&(r[e]=n[e])}),r}function Ve(e){let t=Object.create(null);for(let n=0;n0?(i-o)/s:0;return this.points[a].mult(1-c).add(this.points[n].mult(c))}}class Xe{constructor(e,t,n){let r=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let e=0;ethis.width||r<0||t>this.height)return!i&&[];let o=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=r){if(i)return!0;for(let e=0;e0:o}_queryCircle(e,t,n,r,i){let a=e-n,o=e+n,s=t-n,c=t+n;if(o<0||a>this.width||c<0||s>this.height)return!r&&[];let l=[];return this._forEachCell(a,s,o,c,this._queryCellCircle,l,{hitTest:r,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}},i),r?l.length>0:l}query(e,t,n,r,i){return this._query(e,t,n,r,!1,i)}hitTest(e,t,n,r,i){return this._query(e,t,n,r,!0,i)}hitTestCircle(e,t,n,r){return this._queryCircle(e,t,n,!0,r)}_queryCell(e,t,n,r,i,a,o,s){let c=o.seenUids,l=this.boxCells[i],u=.01;if(l!==null){let i=this.bboxes;for(let d of l)if(!c.box[d]){c.box[d]=!0;let l=4*d;if(e<=i[l+2]+u&&t<=i[l+3]+u&&n>=i[l+0]-u&&r>=i[l+1]-u&&(!s||s(this.boxKeys[d]))){if(o.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[d],x1:i[l],y1:i[l+1],x2:i[l+2],y2:i[l+3],priority:this.boxPriorities[d]})}}}let d=this.circleCells[i];if(d!==null){let i=this.circles;for(let l of d)if(!c.circle[l]){c.circle[l]=!0;let u=3*l;if(this._circleAndRectCollide(i[u],i[u+1],i[u+2],e,t,n,r)&&(!s||s(this.circleKeys[l]))){if(o.hitTest)return a.push(!0),!0;{let e=i[u],t=i[u+1],n=i[u+2];a.push({key:this.circleKeys[l],x1:e-n,y1:t-n,x2:e+n,y2:t+n})}}}}}_queryCellCircle(e,t,n,r,i,a,o,s){let c=o.circle,l=o.seenUids,u=this.boxCells[i];if(u!==null){let e=this.bboxes;for(let t of u)if(!l.box[t]){l.box[t]=!0;let n=4*t;if(this._circleAndRectCollide(c.x,c.y,c.radius,e[n+0],e[n+1],e[n+2],e[n+3])&&(!s||s(this.boxKeys[t])))return a.push(!0),!0}}let d=this.circleCells[i];if(d!==null){let e=this.circles;for(let t of d)if(!l.circle[t]){l.circle[t]=!0;let n=3*t;if(this._circlesCollide(e[n],e[n+1],e[n+2],c.x,c.y,c.radius)&&(!s||s(this.circleKeys[t])))return a.push(!0),!0}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToXCellCoord(e),l=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),d=this._convertToYCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++)if(i.call(this,e,t,n,r,this.xCellCount*c+f,a,o,s))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,r,i,a){let o=r-e,s=i-t,c=n+a;return c*c>o*o+s*s}_circleAndRectCollide(e,t,n,r,i,a,o){let s=(a-r)/2,c=Math.abs(e-(r+s));if(c>s+n)return!1;let l=(o-i)/2,u=Math.abs(t-(i+l));if(u>l+n)return!1;if(c<=s||u<=l)return!0;let d=c-s,f=u-l;return d*d+f*f<=n*n}}function Ze(t,n,r,i,a){let o=e.ap();return n?(e.ab(o,o,[1/a,1/a,1]),r||e.aq(o,o,i.angle)):e.ac(o,i.labelPlaneMatrix,t),o}function Qe(t,n,r,i,a){if(n){let n=e.ar(t);return e.ab(n,n,[a,a,1]),r||e.aq(n,n,-i.angle),n}return i.glCoordMatrix}function $e(t,n,r,i){let a;i?(a=[t,n,i(t,n),1],e.as(a,a,r)):(a=[t,n,0,1],ut(a,a,r));let o=a[3];return{point:new e.P(a[0]/o,a[1]/o),signedDistanceFromCamera:o}}function et(e,t){return .5+e/t*.5}function tt(e,t){let n=e[0]/e[3],r=e[1]/e[3];return n>=-t[0]&&n<=t[0]&&r>=-t[1]&&r<=t[1]}function nt(t,n,r,i,a,o,s,c,l){let u=i?t.textSizeData:t.iconSizeData,d=e.at(u,r.transform.zoom),f=[256/r.width*2+1,256/r.height*2+1],p=i?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;p.clear();let m=t.lineVertexArray,h=i?t.text.placedSymbolArray:t.icon.placedSymbolArray,g=r.transform.width/r.transform.height,_=!1;for(let i=0;iMath.abs(r.x-n.x)*i?{useVertical:!0}:(t===e.au.vertical?n.yr.x)?{needsFlipping:!0}:null}function at(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=n/24,_=t.lineOffsetX*g,v=t.lineOffsetY*g,y;if(t.numGlyphs>1){let e=t.glyphStartIndex+t.numGlyphs,n=t.lineStartIndex,a=t.lineStartIndex+t.lineLength,u=rt(g,c,_,v,r,d,f,t,l,o,p,h);if(!u)return{notEnoughRoom:!0};let b=$e(u.first.point.x,u.first.point.y,s,h).point,x=$e(u.last.point.x,u.last.point.y,s,h).point;if(i&&!r){let e=it(t.writingMode,b,x,m);if(e)return e}y=[u.first];for(let i=t.glyphStartIndex+1;i0?o.point:ot(f,i,n,1,a,h),c=it(t.writingMode,n,s,m);if(c)return c}let n=st(g*c.getoffsetX(t.glyphStartIndex),_,v,r,d,f,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,l,o,p,h);if(!n)return{notEnoughRoom:!0};y=[n]}for(let t of y)e.ax(u,t.point,t.angle);return{}}function ot(e,t,n,r,i,a){let o=e.add(e.sub(t)._unit()),s=$e(o.x,o.y,i,a).point,c=n.sub(s);return n.add(c._mult(r/c.mag()))}function st(t,n,r,i,a,o,s,c,l,u,d,f,p){let m=i?t-n:t+n,h=m>0?1:-1,g=0;i&&(h*=-1,g=Math.PI),h<0&&(g+=Math.PI);let _=h>0?c+s:c+s+1,v=a,y=a,b=0,x=0,S=Math.abs(m),C=[];for(;b+x<=S;){if(_+=h,_=l)return null;if(y=v,C.push(v),v=f[_],v===void 0){let t=new e.P(u.getx(_),u.gety(_)),n=$e(t.x,t.y,d,p);if(n.signedDistanceFromCamera>0)v=f[_]=n.point;else{let n=_-h;v=ot(b===0?o:new e.P(u.getx(n),u.gety(n)),t,y,S-b+1,d,p)}}b+=x,x=y.dist(v)}let w=(S-b)/x,T=v.sub(y),E=T.mult(w)._add(y);E._add(T._unit()._perp()._mult(r*h));let D=g+Math.atan2(v.y-y.y,v.x-y.x);return C.push(E),{point:E,angle:D,path:C}}let ct=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function lt(e,t){for(let n=0;ne&&e.priority>9999999990).length>0;return{box:e?[]:p,offscreen:!e&&m,forceCollision:e}}return{box:p,offscreen:m}}placeCollisionCircles(t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h=[],g=new e.P(n.anchorX,n.anchorY),_=$e(g.x,g.y,o,m),v=et(this.transform.cameraToCenterDistance,_.signedDistanceFromCamera),y=(u?a/v:a*v)/e.aA,b=$e(g.x,g.y,s,m).point,x=rt(y,i,n.lineOffsetX*y,n.lineOffsetY*y,!1,b,g,n,r,s,{},m),S=!1,C=!1,w=!0;if(x){let n=.5*f*v+p,r=new e.P(-100,-100),i=new e.P(this.screenRightBoundary,this.screenBottomBoundary),a=new Ye,o=x.first,s=x.last,u=[];for(let e=o.path.length-1;e>=1;e--)u.push(o.path[e]);for(let e=1;e$e(e.x,e.y,c,m));u=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let _=[];if(u.length>0){let t=u[0].clone(),n=u[0].clone();for(let e=1;e=r.x&&n.x<=i.x&&t.y>=r.y&&n.y<=i.y?[u]:n.xi.x||n.yi.y?[]:e.ay([u],r.x,r.y,i.x,i.y)}for(let e of _){a.reset(e,.25*n);let r=0;r=a.length<=.5*n?1:Math.ceil(a.paddedLength/g)+1;for(let e=0;e=this.screenRightBoundary||r<100||t>this.screenBottomBoundary}isInsideGrid(e,t,n,r){return n>=0&&e=0&&te.collisionGroupID===t}}return this.collisionGroups[e]}}function yt(t,n,r,i,a){let{horizontalAlign:o,verticalAlign:s}=e.aE(t),c=-(o-.5)*n,l=-(s-.5)*r,u=e.aD(t,i);return new e.P(c+u[0]*a,l+u[1]*a)}function bt(t,n,r,i,a,o){let{x1:s,x2:c,y1:l,y2:u,anchorPointX:d,anchorPointY:f}=t,p=new e.P(n,r);return i&&p._rotate(a?o:-o),{x1:s+p.x,y1:l+p.y,x2:c+p.x,y2:u+p.y,anchorPointX:d,anchorPointY:f}}class G{constructor(e,t,n,r,i){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new dt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new vt(r),this.collisionCircleArrays={},this.prevPlacement=i,i&&(i.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,r,i){let a=r.getBucket(n),o=r.latestFeatureIndex;if(!a||!o||n.id!==a.layerIds[0])return;let s=r.collisionBoxArray,c=a.layers[0].layout,l=2**(this.transform.zoom-r.tileID.overscaledZ),u=r.tileSize/e.a2,d=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),f=c.get(`text-pitch-alignment`)===`map`,p=c.get(`text-rotation-alignment`)===`map`,m=ft(r,1,this.transform.zoom),h=Ze(d,f,p,this.transform,m),g=null;if(f){let t=Qe(d,f,p,this.transform,m);g=e.ac([],this.transform.labelPlaneMatrix,t)}this.retainedQueryData[a.bucketInstanceId]=new _t(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,r.tileID);let _={bucket:a,layout:c,posMatrix:d,textLabelPlaneMatrix:h,labelToScreenMatrix:g,scale:l,textPixelRatio:u,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:e.at(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(i)for(let e of a.sortKeyRanges){let{sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i}=e;t.push({sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i,parameters:_})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:_});return`${a.bucketInstanceId}`}attemptAnchorPlacement(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){let _=[d.textOffset0,d.textOffset1],v=yt(e,n,r,_,i),y=this.collisionIndex.placeCollisionBox(bt(t,v.x,v.y,a,o,this.transform.angle),u,s,c,l.predicate,h,g);if((!m||this.collisionIndex.placeCollisionBox(bt(m,v.x,v.y,a,o,this.transform.angle),u,s,c,l.predicate,h,g).box.length!==0)&&y.box.length>0){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID].text&&(t=this.prevPlacement.variableOffsets[d.crossTileID].anchor),d.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);return this.variableOffsets[d.crossTileID]={textOffset:_,width:n,height:r,anchor:e,textBoxScale:i,prevAnchor:t},this.markUsedJustification(f,e,d,p),f.allowVerticalPlacement&&(this.markUsedOrientation(f,p,d),this.placedOrientations[d.crossTileID]=p),{shift:v,placedGlyphBoxes:y}}}placeLayerBucketPart(t,n,r){let{bucket:i,layout:a,posMatrix:o,collisionBoxArray:s}=t.parameters,c=a.get(`text-optional`),l=a.get(`icon-optional`),u=a.get(`text-allow-overlap`),d=a.get(`icon-allow-overlap`),f=a.get(`text-rotation-alignment`)===`map`,p=a.get(`text-pitch-alignment`)===`map`,m=a.get(`icon-text-fit`)!==`none`,h=a.get(`symbol-z-order`)===`viewport-y`,g={textOptional:c,iconOptional:l,hasIconTextFit:m,iconAllowOverlap:d,textAllowOverlap:u,rotateWithMap:f,pitchWithMap:p,alwaysShowText:u&&(d||!i.hasIconData()||l),alwaysShowIcon:d&&(u||!i.hasTextData()||c)};if(!i.collisionArrays&&s&&i.deserializeCollisionBoxes(s),h){if(t.symbolInstanceStart!==0)throw Error(`bucket.bucketInstanceId should be 0`);let e=i.getSortedSymbolIndexes(this.transform.angle);for(let a=e.length-1;a>=0;--a){let o=e[a];this.placeSymbol(t,i.symbolInstances.get(o),i.collisionArrays[o],n,r,g)}}else for(let e=t.symbolInstanceStart;ethis.terrain.getElevation(ce,e,t):null,ue=r.textBox;if(ue){let t=t=>{let r=e.au.horizontal;if(s.allowVerticalPlacement&&!t&&this.prevPlacement){let e=this.prevPlacement.placedOrientations[n.crossTileID];e&&(this.placedOrientations[n.crossTileID]=e,r=e,this.markUsedOrientation(s,r,n))}return r},i=(t,i)=>{if(s.allowVerticalPlacement&&n.numVerticalGlyphVertices>0&&r.verticalTextBox){for(let n of s.writingModes)if(n===e.au.vertical?(j=i(),ee=j):j=t(),j&&j.box&&j.box.length)break}else j=t()};if(c.get(`text-variable-anchor`)){let a=c.get(`text-variable-anchor`);if(this.prevPlacement&&this.prevPlacement.variableOffsets[n.crossTileID]){let e=this.prevPlacement.variableOffsets[n.crossTileID];a.indexOf(e.anchor)>0&&(a=a.filter(t=>t!==e.anchor),a.unshift(e.anchor))}let o=(e,t,r)=>{let i=e.x2-e.x1,o=e.y2-e.y1,c=n.textBoxScale,u=v&&!y?t:null,d={box:[],offscreen:!1},p=b?2*a.length:a.length;for(let t=0;t=a.length,n,s,r,u,T,le);if(p&&(d=p.placedGlyphBoxes,d&&d.box&&d.box.length)){D=!0,A=p.shift;break}}return d};i(()=>o(ue,r.iconBox,e.au.horizontal),()=>{let t=r.verticalTextBox;return s.allowVerticalPlacement&&!(j&&j.box&&j.box.length)&&n.numVerticalGlyphVertices>0&&t?o(t,r.verticalIconBox,e.au.vertical):{box:null,offscreen:null}}),j&&(D=!!j.box,k=j.offscreen);let u=t(!(!j||!j.box));if(!D&&this.prevPlacement){let e=this.prevPlacement.variableOffsets[n.crossTileID];e&&(this.variableOffsets[n.crossTileID]=e,this.markUsedJustification(s,e.anchor,n,u))}}else{let a=(e,t)=>{let r=this.collisionIndex.placeCollisionBox(e,b,f,l,h.predicate,T,le);return r&&r.box&&r.box.length&&(this.markUsedOrientation(s,t,n),this.placedOrientations[n.crossTileID]=t),r};i(()=>a(ue,e.au.horizontal),()=>{let t=r.verticalTextBox;return s.allowVerticalPlacement&&n.numVerticalGlyphVertices>0&&t?a(t,e.au.vertical):{box:null,offscreen:null}}),t(!!(j&&j.box&&j.box.length))}}if(te=j,D=te&&te.box&&te.box.length>0,k=te&&te.offscreen,n.useRuntimeCollisionCircles){let t=s.text.placedSymbolArray.get(n.centerJustifiedTextSymbolIndex),r=e.aw(s.textSizeData,m,t),i=c.get(`text-padding`);ne=this.collisionIndex.placeCollisionCircles(b,t,s.lineVertexArray,s.glyphOffsetArray,r,l,u,d,a,S,h.predicate,n.collisionCircleDiameter,i,le),ne.circles.length&&ne.collisionDetected&&!a&&e.w(`Collisions detected, but collision boxes are not shown`),D=b||ne.circles.length>0&&!ne.collisionDetected,k=k&&ne.offscreen}if(r.iconFeatureIndex&&(oe=r.iconFeatureIndex),r.iconBox){let e=e=>{let t=v&&A?bt(e,A.x,A.y,x,S,this.transform.angle):e;return this.collisionIndex.placeCollisionBox(t,y,f,l,h.predicate,T,le)};ee&&ee.box&&ee.box.length&&r.verticalIconBox?(re=e(r.verticalIconBox),O=re.box.length>0):(re=e(r.iconBox),O=re.box.length>0),k=k&&re.offscreen}let de=g||n.numHorizontalGlyphVertices===0&&n.numVerticalGlyphVertices===0,fe=_||n.numIconVertices===0;if(de||fe?fe?de||(O=O&&D):D=O&&D:O=D=O&&D,(re&&re.forceCollision||te&&te.forceCollision)&&(se=!0),D&&te&&te.box&&this.collisionIndex.insertCollisionBox(te.box,c.get(`text-ignore-placement`),s.bucketInstanceId,ee&&ee.box&&ae?ae:ie,h.ID,E),O&&re&&this.collisionIndex.insertCollisionBox(re.box,c.get(`icon-ignore-placement`),s.bucketInstanceId,oe,h.ID,E),ne&&(D&&this.collisionIndex.insertCollisionCircles(ne.circles,c.get(`text-ignore-placement`),s.bucketInstanceId,ie,h.ID),a)){let e=s.bucketInstanceId,t=this.collisionCircleArrays[e];t===void 0&&(t=this.collisionCircleArrays[e]=new gt);for(let e=0;e=0&&(t.text.placedSymbolArray.get(e).crossTileID=a>=0&&e!==a?0:r.crossTileID)}markUsedOrientation(t,n,r){let i=n===e.au.horizontal||n===e.au.horizontalOnly?n:0,a=n===e.au.vertical?n:0,o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let e of o)t.text.placedSymbolArray.get(e).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,n=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let r=t?t.symbolFadeChange(e):1,i=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],a=i[e];a?(this.opacities[e]=new mt(a,r,t.text,t.icon),n=n||t.text!==a.text.placed||t.icon!==a.icon.placed):(this.opacities[e]=new mt(null,r,t.text,t.icon,t.skipFade),n=n||t.text||t.icon)}for(let e in i){let t=i[e];if(!this.opacities[e]){let i=new mt(t,r,!1,!1);i.isHidden()||(this.opacities[e]=i,n=n||t.text.placed||t.icon.placed)}}for(let e in a)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=a[e]);for(let e in o)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=o[e]);if(t&&t.lastPlacementChangeTime===void 0)throw Error(`Last placement time for previous placement is not defined`);n?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!=`number`&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let n={};for(let r of t){let t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,n,r.collisionBoxArray)}}updateBucketOpacities(t,n,r){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();let i=t.layers[0].layout,a=new mt(null,0,!1,!1,!0),o=i.get(`text-variable-anchor`),s=i.get(`text-rotation-alignment`)===`map`,c=i.get(`text-pitch-alignment`)===`map`,l=i.get(`icon-text-fit`)!==`none`,u=i.get(`text-allow-overlap`),d=i.get(`icon-allow-overlap`),f=new mt(null,0,u&&(d||!t.hasIconData()||i.get(`icon-optional`)),d&&(u||!t.hasTextData()||i.get(`text-optional`)),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);let p=(e,t,n)=>{for(let r=0;r0||d>0,v=i.numIconVertices>0,y=this.placedOrientations[i.crossTileID],b=y===e.au.vertical,x=y===e.au.horizontal||y===e.au.horizontalOnly;if(t.fullyVisible=t.fullyVisible||(_||v)&&!g.isHidden(),_){let e=Et(g.text);p(t.text,u,b?Dt:e),p(t.text,d,x?Dt:e);let n=g.text.isHidden();[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach(e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=n||b?1:0)}),i.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).hidden=n||x?1:0);let r=this.variableOffsets[i.crossTileID];r&&this.markUsedJustification(t,r.anchor,i,y);let a=this.placedOrientations[i.crossTileID];a&&(this.markUsedJustification(t,`left`,i,a),this.markUsedOrientation(t,a,i))}if(v){let e=Et(g.icon),n=!(l&&i.verticalPlacedIconSymbolIndex&&b);i.placedIconSymbolIndex>=0&&(p(t.icon,i.numIconVertices,n?e:Dt),t.icon.placedSymbolArray.get(i.placedIconSymbolIndex).hidden=g.icon.isHidden()),i.verticalPlacedIconSymbolIndex>=0&&(p(t.icon,i.numVerticalIconVertices,n?Dt:e),t.icon.placedSymbolArray.get(i.verticalPlacedIconSymbolIndex).hidden=g.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let n=t.collisionArrays[r];if(n){let r=new e.P(0,0);if(n.textBox||n.verticalTextBox){let e=!0;if(o){let t=this.variableOffsets[m];t?(r=yt(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),s&&r._rotate(c?this.transform.angle:-this.transform.angle)):e=!1}n.textBox&&xt(t.textCollisionBox.collisionVertexArray,g.text.placed,!e||b,r.x,r.y),n.verticalTextBox&&xt(t.textCollisionBox.collisionVertexArray,g.text.placed,!e||x,r.x,r.y)}let i=!!(!x&&n.verticalIconBox);n.iconBox&&xt(t.iconCollisionBox.collisionVertexArray,g.icon.placed,i,l?r.x:0,l?r.y:0),n.verticalIconBox&&xt(t.iconCollisionBox.collisionVertexArray,g.icon.placed,!i,l?r.x:0,l?r.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){let e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function xt(e,t,n,r,i){e.emplaceBack(+!!t,+!!n,r||0,i||0),e.emplaceBack(+!!t,+!!n,r||0,i||0),e.emplaceBack(+!!t,+!!n,r||0,i||0),e.emplaceBack(+!!t,+!!n,r||0,i||0)}let St=2**25,Ct=2**24,wt=2**17,Tt=2**16;function Et(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=+!!e.placed,n=Math.floor(127*e.opacity);return n*St+t*Ct+n*wt+t*Tt+n*512+t*256+n*2+t}let Dt=0;class Ot{constructor(e){this._sortAcrossTiles=e.layout.get(`symbol-z-order`)!==`viewport-y`&&e.layout.get(`symbol-sort-key`).constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,n,r,i){let a=this._bucketParts;for(;this._currentTileIndexe.sortKey-t.sortKey));this._currentPartIndex!this._forceFullPlacement&&e.k.now()-i>2;if(this._useSymbolPlacementPriority){let i=this._bucketParts;for(;this._currentPlacementIndex>=0;){let e=n[t[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if(e.type===`symbol`&&(!e.minzoom||e.minzoom<=o)&&(!e.maxzoom||e.maxzoom>o)){let t=r[e.source],n=e.layout.get(`symbol-z-order`)!==`viewport-y`&&e.layout.get(`symbol-sort-key`).constantOr(1)!==void 0;for(this._currentTileIndex=0;this._currentTileIndexe.priority===t.priority?t.layerIndex-e.layerIndex:t.priority-e.priority),this._completeSymbolSorting=!0);this._symbolModels.length>0;){let{bucketId:e,instanceIndex:t,priority:n}=this._symbolModels.shift(),r=this._symbolBucketPartsMap[e],{bucket:i,layout:o,collisionBoxArray:s}=r.parameters,c=o.get(`text-optional`),l=o.get(`icon-optional`),u=o.get(`text-allow-overlap`),d=o.get(`icon-allow-overlap`),f=o.get(`text-rotation-alignment`)===`map`,p=o.get(`text-pitch-alignment`)===`map`,m=o.get(`icon-text-fit`)!==`none`,h=o.get(`icon-always-allow-overlap`),g={textOptional:c,iconOptional:l,hasIconTextFit:m,iconAllowOverlap:d,textAllowOverlap:u,rotateWithMap:f,pitchWithMap:p,alwaysShowText:u&&(d||!i.hasIconData()||l),alwaysShowIcon:d&&(u||!i.hasTextData()||c),iconAlwaysAllowOverlap:h,placementPriority:n};if(!i.collisionArrays&&s&&i.deserializeCollisionBoxes(s),this.placement.placeSymbol(r,i.symbolInstances.get(t),i.collisionArrays[t],this._seenCrossTileIDs,this._showCollisionBoxes,g),this._symbolBucketCountsMap[e]--,this._symbolBucketCountsMap[e]===0&&(this._symbolBucketPartsMap[e].parameters.bucket.justReloaded=!1),a())return}Object.keys(this._symbolBucketPartsMap).forEach(t=>{let{bucket:n,posMatrix:r}=this._symbolBucketPartsMap[t].parameters;if(this._showCollisionBoxes&&n.bucketInstanceId in this.placement.collisionCircleArrays){let t=this.placement.collisionCircleArrays[n.bucketInstanceId];e.aB(t.invProjMatrix,r),t.viewportMatrix=this.placement.collisionIndex.getViewportMatrix()}}),this._symbolBucketPartsMap={},this._symbolBucketCountsMap={}}else for(;this._currentPlacementIndex>=0;){let e=n[t[this._currentPlacementIndex]],i=this.placement.collisionIndex.transform.zoom;if(e.type===`symbol`&&(!e.minzoom||e.minzoom<=i)&&(!e.maxzoom||e.maxzoom>i)){if(this._inProgressLayer||(this._inProgressLayer=new Ot(e)),this._inProgressLayer.continuePlacement(r[e.source],this.placement,this._showCollisionBoxes,e,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}_hasSymbolPlacementPriority(e){let t=Object.keys(e);for(let n=0;ne.overscaledZ)for(let n in i){let a=i[n];a.tileID.isChildOf(e)&&a.findMatches(t.symbolInstances,e,r)}else{let a=i[e.scaledTo(Number(n)).key];a&&a.findMatches(t.symbolInstances,e,r)}}for(let e=0;e{t[e]=!0});for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}let Ft=(t,n)=>e.Q(t,n&&n.filter(e=>e.identifier!==`source.canvas`)),It=e.X(W,[`addLayer`,`removeLayer`,`setPaintProperty`,`setLayoutProperty`,`setFilter`,`addSource`,`removeSource`,`setLayerZoomRange`,`setLight`,`setTransition`,`setGeoJSONSourceData`]),Lt=e.X(W,[`setCenter`,`setZoom`,`setBearing`,`setPitch`]),Rt=function(){let t={},n=e.J.$version;for(let r in e.J.$root){let i=e.J.$root[r];if(i.required){let e=null;e=r===`version`?n:i.type===`array`?[]:{},e!=null&&(t[r]=e)}}return t}();class zt extends e.E{constructor(t,n={}){super(),this.map=t,this.dispatcher=new _e(ze(),this),this.imageManager=new P(t._requestManager),this.imageManager.setEventedParent(this),this.glyphManager=new he(t._requestManager,n.localIdeographFontFamily),this.modelManager=new R(t._requestManager),this.lineAtlas=new ge(256,512),this.crossTileSymbolIndex=new Pt,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new e.aG,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast(`setReferrer`,e.aH());let r=this;this._rtlTextPluginCallback=zt.registerForPluginStateChange(t=>{r.dispatcher.broadcast(`syncRTLPluginState`,{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},(t,n)=>{if(e.aI(t),n&&n.every(e=>e))for(let e in r.sourceCaches)r.sourceCaches[e].reload()})}),this.on(`data`,e=>{if(e.dataType!==`source`||e.sourceDataType!==`metadata`)return;let t=this.sourceCaches[e.sourceId];if(!t)return;let n=t.getSource();if(n&&n.vectorLayerIds)for(let e in this._layers){let t=this._layers[e];t.source===n.id&&this._validateLayer(t)}})}loadURL(t,n={}){this.fire(new e.o(`dataloading`,{dataType:`style`}));let r=typeof n.validate==`boolean`?n.validate:!E(t);t=this.map._requestManager.normalizeStyleURL(t,n.accessToken);let i=this.map._requestManager.transformRequest(t,e.R.Style);this._request=e.j(i,(t,n)=>{this._request=null,t?this.fire(new e.m(t)):n&&this._load(n,r)})}loadJSON(t,n={}){this.fire(new e.o(`dataloading`,{dataType:`style`})),this._request=e.k.frame(()=>{this._request=null,this._load(t,!1!==n.validate)})}loadEmpty(){this.fire(new e.o(`dataloading`,{dataType:`style`})),this._load(Rt,!1)}_load(t,n){if(n&&Ft(this,e.U(t)))return;this._loaded=!0,this.stylesheet=t;for(let e in t.sources)this.addSource(e,t.sources[e],{validate:!1});let r=t[`sprite-compact`]||t.sprite;r?this._loadSprite(r):this.imageManager.setSpriteLoaded(!0),this.glyphManager.setURL(t.glyphs),t.metadata&&t.metadata[`fallback-glyphs`]&&this.glyphManager.setFallbackUrl(t.metadata[`fallback-glyphs`]);let i=Ve(this.stylesheet.layers);this._extendLayer(this.stylesheet,i),this.dispatcher.broadcast(`setLayers`,i),this._order=i.map(e=>e.id),this._layers={},this._serializedLayers={};for(let t of i)t=e.aJ(t),t.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=t,this._serializedLayers[t.id]=t.serialize();this.light=new B(this.stylesheet.light),this.stylesheet.models&&this.modelManager.setURL(this.stylesheet.models),this.map.setTerrain(this.stylesheet.terrain||null),this.fire(new e.o(`data`,{dataType:`style`})),this.fire(new e.o(`style.load`))}_loadSprite(t){this._spriteRequest=function(t,n,r,i){let a,o,s,c=r>1?`@2x`:``,l=e.j(n.transformRequest(n.normalizeSpriteURL(t,c,`.json`),e.R.SpriteJSON),(e,t)=>{l=null,s||(s=e,a=t,d())}),u=y(n.transformRequest(n.normalizeSpriteURL(t,c,`.png`),e.R.SpriteImage),(e,t)=>{u=null,s||(s=e,o=t,d())});function d(){if(s)i(s);else if(a&&o){let t=e.k.getImageData(o),n={};for(let r in a){let{width:i,height:o,x:s,y:c,sdf:l,pixelRatio:u,stretchX:d,stretchY:f,content:p}=a[r],m=new e.l({width:i,height:o});e.l.copy(t,m,{x:s,y:c},{x:0,y:0},{width:i,height:o}),n[r]={data:m,pixelRatio:u,sdf:l,stretchX:d,stretchY:f,content:p}}i(null,n)}}return{cancel(){l&&(l.cancel(),l=null),u&&(u.cancel(),u=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(t,n)=>{if(this._spriteRequest=null,t)this.fire(new e.m(t));else if(n)for(let e in n)this.imageManager.addImage(e,n[e]);this.imageManager.setSpriteLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast(`setImages`,this._availableImages),this.fire(new e.o(`data`,{dataType:`style`}))})}_validateLayer(t){let n=this.sourceCaches[t.source];if(!n)return;let r=t.sourceLayer;if(!r)return;let i=n.getSource();(i.type===`geojson`||i.vectorLayerIds&&i.vectorLayerIds.indexOf(r)===-1)&&this.fire(new e.m(Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${t.id}"`)))}_extendLayer(t,n){let r=[`layout`,`paint`],i={layout:e.U.layoutProperty,paint:e.U.paintProperty};for(let a of n){if(!a.metadata)continue;let n=a;for(let a of r){let r=n.metadata;if(r[a])for(let o in r[a]){if(n[a][o])continue;let s=r[a][o];(i[a]({styleSpec:e.J,style:t,objectKey:o,value:s,layerType:n.type})||[]).length===0&&(n[a][o]=s)}}}}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isSpriteLoaded()}_serializeLayers(e){let t=[];for(let n of e){let e=this._layers[n];e.type!==`custom`&&t.push(e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error(`Style is not done loading`)}update(t){if(!this._loaded)return;let n=this._changed;if(this._changed){let e=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(e.length||n.length)&&this._updateWorkerLayers(e,n);for(let e in this._updatedSources){let t=this._updatedSources[e];t===`reload`?this._reloadSource(e):t===`clear`&&this._clearSource(e)}this._updateTilesForChangedImages();for(let e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}let r={};for(let e in this.sourceCaches){let t=this.sourceCaches[e];r[e]=t.used,t.used=!1}for(let e of this._order){let n=this._layers[e];n.recalculate(t,this._availableImages),!n.isHidden(t.zoom)&&n.source&&(this.sourceCaches[n.source].used=!0)}for(let t in r){let n=this.sourceCaches[t];r[t]!==n.used&&n.fire(new e.o(`data`,{sourceDataType:`visibility`,dataType:`source`,sourceId:t}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new e.o(`data`,{dataType:`style`}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies([`icons`,`patterns`],e);this._changedImages={}}}_updateWorkerLayers(e,t){this.dispatcher.broadcast(`updateLayers`,{layers:this._serializeLayers(e),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(t){if(this._checkLoaded(),Ft(this,e.U(t)))return!1;(t=e.aK(t)).layers=Ve(t.layers),this._extendLayer(t,t.layers);let n=function(e,t){if(!e)return[{command:W.setStyle,args:[t]}];let n=[];try{if(!o(e.version,t.version))return[{command:W.setStyle,args:[t]}];o(e.center,t.center)||n.push({command:W.setCenter,args:[t.center]}),o(e.zoom,t.zoom)||n.push({command:W.setZoom,args:[t.zoom]}),o(e.bearing,t.bearing)||n.push({command:W.setBearing,args:[t.bearing]}),o(e.pitch,t.pitch)||n.push({command:W.setPitch,args:[t.pitch]}),o(e.sprite,t.sprite)||n.push({command:W.setSprite,args:[t.sprite]}),o(e.glyphs,t.glyphs)||n.push({command:W.setGlyphs,args:[t.glyphs]}),o(e.transition,t.transition)||n.push({command:W.setTransition,args:[t.transition]}),o(e.light,t.light)||n.push({command:W.setLight,args:[t.light]});let r={},i=[];(function(e,t,n,r){let i;for(i in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)||Ue(i,n,r));for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?o(e[i],t[i])||(e[i].type===`geojson`&&t[i].type===`geojson`&&Ge(e,t,i)?n.push({command:W.setGeoJSONSourceData,args:[i,t[i].data]}):We(i,t,n,r)):He(i,t,n))})(e.sources,t.sources,i,r);let a=[];e.layers&&e.layers.forEach(e=>{r[e.source]?n.push({command:W.removeLayer,args:[e.id]}):a.push(e)}),n=n.concat(i),function(e,t,n){t=t||[];let r=(e=e||[]).map(qe),i=t.map(qe),a=e.reduce(Je,{}),s=t.reduce(Je,{}),c=r.slice(),l=Object.create(null),u,d,f,p,m,h,g;for(u=0,d=0;u!(e.command in Lt));if(n.length===0)return!1;let r=n.filter(e=>!(e.command in It));if(r.length>0)throw Error(`Unimplemented: ${r.map(e=>e.command).join(`, `)}.`);return n.forEach(e=>{e.command!==`setTransition`&&this[e.command].apply(this,e.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new e.m(Error(`An image with this name already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(t){if(!this.getImage(t))return this.fire(new e.m(Error(`No image with this name exists.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast(`setImages`,this._availableImages),this.fire(new e.o(`data`,{dataType:`style`}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,r={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw Error(`There is already a source with this ID`);if(!n.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(`, `)}.`);if([`vector`,`raster`,`geojson`,`video`,`image`].indexOf(n.type)>=0&&this._validate(e.U.source,`sources.${t}`,n,null,r))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let i=this.sourceCaches[t]=new je(t,n,this.dispatcher);i.style=this,i.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:i.serialize(),sourceId:t})),i.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw Error(`There is no source with this ID`);for(let n in this._layers)if(this._layers[n].source===t)return this.fire(new e.m(Error(`Source "${t}" cannot be removed while layer "${n}" is using it.`)));let n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new e.o(`data`,{sourceDataType:`metadata`,dataType:`source`,sourceId:t})),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw Error(`There is no source with this ID=${e}`);let n=this.sourceCaches[e].getSource();if(n.type!==`geojson`)throw Error(`geojsonSource.type is ${n.type}, which is !== 'geojson`);n.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(t,n,r={}){this._checkLoaded();let i=t.id;if(this.getLayer(i))return void this.fire(new e.m(Error(`Layer with id "${i}" already exists on this map`)));let a;if(t.type===`custom`){if(Ft(this,e.aL(t)))return;a=e.aJ(t)}else{if(typeof t.source==`object`&&(this.addSource(i,t.source),t=e.aK(t),t=e.e(t,{source:i})),this._validate(e.U.layer,`layers.${i}`,t,{arrayIndex:-1},r))return;a=e.aJ(t),this._validateLayer(a),a.setEventedParent(this,{layer:{id:i}}),this._serializedLayers[a.id]=a.serialize()}let o=n?this._order.indexOf(n):this._order.length;if(n&&o===-1)this.fire(new e.m(Error(`Layer with id "${n}" does not exist on this map.`)));else{if(this._order.splice(o,0,i),this._layerOrderChanged=!0,this._layers[i]=a,this._removedLayers[i]&&a.source&&a.type!==`custom`){let e=this._removedLayers[i];delete this._removedLayers[i],e.type===a.type?(this._updatedSources[a.source]=`reload`,this.sourceCaches[a.source].pause()):this._updatedSources[a.source]=`clear`}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.m(Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;let r=this._order.indexOf(t);this._order.splice(r,1);let i=n?this._order.indexOf(n):this._order.length;n&&i===-1?this.fire(new e.m(Error(`Layer with id "${n}" does not exist on this map.`))):(this._order.splice(i,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();let n=this._layers[t];if(!n)return void this.fire(new e.m(Error(`The layer '${t}' does not exist in the map's style and cannot be removed.`)));n.setEventedParent(null);let r=this._order.indexOf(t);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(t,n,r){this._checkLoaded();let i=this.getLayer(t);i?i.minzoom===n&&i.maxzoom===r||(n!=null&&(i.minzoom=n),r!=null&&(i.maxzoom=r),this._updateLayer(i)):this.fire(new e.m(Error(`The layer '${t}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(t,n,r={}){this._checkLoaded();let i=this.getLayer(t);if(i){if(!o(i.filter,n))return n==null?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(e.U.filter,`layers.${i.id}.filter`,n,null,r)||(i.filter=e.aK(n),this._updateLayer(i)))}else this.fire(new e.m(Error(`The layer '${t}' does not exist in the map's style and cannot be filtered.`)))}getFilter(t){return e.aK(this.getLayer(t).filter)}setLayoutProperty(t,n,r,i={}){this._checkLoaded();let a=this.getLayer(t);a?o(a.getLayoutProperty(n),r)||(a.setLayoutProperty(n,r,i),this._updateLayer(a)):this.fire(new e.m(Error(`The layer '${t}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(t,n){let r=this.getLayer(t);if(r)return r.getLayoutProperty(n);this.fire(new e.m(Error(`The layer '${t}' does not exist in the map's style.`)))}setPaintProperty(t,n,r,i={}){this._checkLoaded();let a=this.getLayer(t);a?o(a.getPaintProperty(n),r)||(a.setPaintProperty(n,r,i)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new e.m(Error(`The layer '${t}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(t,n){this._checkLoaded();let r=t.source,i=t.sourceLayer,a=this.sourceCaches[r];if(a===void 0)return void this.fire(new e.m(Error(`The source '${r}' does not exist in the map's style.`)));let o=a.getSource().type;o===`geojson`&&i?this.fire(new e.m(Error(`GeoJSON sources cannot have a sourceLayer parameter.`))):o!==`vector`||i?(t.id===void 0&&this.fire(new e.m(Error(`The feature id parameter must be provided.`))),a.setFeatureState(i,t.id,n)):this.fire(new e.m(Error(`The sourceLayer parameter must be provided for vector source types.`)))}removeFeatureState(t,n){this._checkLoaded();let r=t.source,i=this.sourceCaches[r];if(i===void 0)return void this.fire(new e.m(Error(`The source '${r}' does not exist in the map's style.`)));let a=i.getSource().type,o=a===`vector`?t.sourceLayer:void 0;a!==`vector`||o?n&&typeof t.id!=`string`&&typeof t.id!=`number`?this.fire(new e.m(Error(`A feature id is required to remove its specific state property.`))):i.removeFeatureState(o,t.id,n):this.fire(new e.m(Error(`The sourceLayer parameter must be provided for vector source types.`)))}getFeatureState(t){this._checkLoaded();let n=t.source,r=t.sourceLayer,i=this.sourceCaches[n];if(i!==void 0)return i.getSource().type!==`vector`||r?(t.id===void 0&&this.fire(new e.m(Error(`The feature id parameter must be provided.`))),i.getFeatureState(r,t.id)):void this.fire(new e.m(Error(`The sourceLayer parameter must be provided for vector source types.`)));this.fire(new e.m(Error(`The source '${n}' 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 e.aM({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:e.aN(this.sourceCaches,e=>e.serialize()),layers:this._serializeLayers(this._order),"sprite-compact":this.stylesheet[`sprite-compact`],terrain:this.map.getTerrain()||void 0},e=>e!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!==`raster`&&(this._updatedSources[e.source]=`reload`,this.sourceCaches[e.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=e=>this._layers[e].type===`fill-extrusion`,n={},r=[];for(let i=this._order.length-1;i>=0;i--){let a=this._order[i];if(t(a)){n[a]=i;for(let t of e){let e=t[a];if(e)for(let t of e)r.push(t)}}}r.sort((e,t)=>t.intersectionZ-e.intersectionZ);let i=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o))for(let e=r.length-1;e>=0;e--){let t=r[e].feature;if(n[t.layer.id]{let r=n.featureSortOrder;if(r){let n=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex});for(let e of i)t.push(e)}}for(let t in s)s[t].forEach(r=>{let i=r.feature,a=n[e[t].source].getFeatureState(i.layer[`source-layer`],i.id);i.source=i.layer.source,i.layer[`source-layer`]&&(i.sourceLayer=i.layer[`source-layer`]),i.state=a});return s}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(t,n){n&&n.filter&&this._validate(e.U.filter,`querySourceFeatures.filter`,n.filter,null,n);let r=this.sourceCaches[t];return r?function(e,t){let n=e.getRenderableIds().map(t=>e.getTileByID(t)),r=[],i={};for(let e=0;ee.getTileByID(t)).sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}let n=this.crossTileSymbolIndex.addLayer(t,c[t.source],l);o=o||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((a=a||this._layerOrderChanged||r===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.k.now(),t.zoom))&&(this.pauseablePlacement=new kt(this._layers,t,this.map.terrain,this._order,a,n,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,c),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.k.now()),s=!0),o&&this.pauseablePlacement.placement.setStale()),s||o)for(let e of this._order){let t=this._layers[e];t.type===`symbol`&&this.placement.updateLayerOpacities(t,c[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.k.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,t,n){this.imageManager.getImages(t.icons,n),this._updateTilesForChangedImages();let r=this.sourceCaches[t.source];r&&r.setDependencies(t.tileID.key,t.type,t.icons)}getGlyphs(e,t,n){this.glyphManager.getGlyphs(t.stacks,n)}getResource(t,n,r){return e.aP(n,r)}reloadAllSource(){for(let e in this.sourceCaches)this._reloadSource(e)}destroy(){this._clearWorkerCaches()}_clearWorkerCaches(){this.dispatcher.broadcast(`clearCaches`,null)}}zt.getSourceType=function(e){return U[e]},zt.setSourceType=function(e,t){U[e]=t},zt.registerForPluginStateChange=e.aQ;var Bt=e.a3([{name:`a_pos`,type:`Int16`,components:2}]),Vt=`in vec4 v_color;void main() {glFragColor=v_color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`;let Ht=K(`out vec4 glFragColor;float calculate_shadow(vec4 light_pos,highp sampler2DShadow shadow_map,vec2 shadow_map_size,float bias,float intensity) {vec3 proj_coords=light_pos.xyz/light_pos.w;proj_coords=proj_coords*0.5+0.5;if (proj_coords.x < 0.0 || proj_coords.x > 1.0 || proj_coords.y < 0.0 || proj_coords.y > 1.0 || proj_coords.z < 0.0 || proj_coords.z > 1.0) {return 0.0;}float ref=proj_coords.z-bias;vec2 texel_size=vec2(1.0)/shadow_map_size;float shadow=0.0;for (int x=-1; x <=1;++x) {for (int y=-1; y <=1;++y) {shadow+=texture(shadow_map,vec3(proj_coords.xy+vec2(x,y)*texel_size,ref));}}shadow/=9.0;return shadow*intensity;}float get_lightness_color(const float value,const float lightness) {float t=value;if (lightness >=0.0) {t=1.0-value;}return clamp(value+t*lightness,0.0,1.0);}vec4 lerp_color_lightness(const vec4 color,const float lightness) {if (lightness==0.0) return color;return vec4( get_lightness_color(color.r,lightness),get_lightness_color(color.g,lightness),get_lightness_color(color.b,lightness),color.a );}`,` vec2 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 );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;} #ifdef TERRAIN3D uniform 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; #endif float ele(vec2 pos) { #ifdef TERRAIN3D vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; #else return 0.0; #endif }float get_elevation(vec2 pos) { #ifdef TERRAIN3D vec2 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; #else return 0.0; #endif }const 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) { #ifdef TERRAIN3D highp 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)); #else return 1.0; #endif }float calculate_visibility(vec4 pos) { #ifdef TERRAIN3D vec3 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; #else return 1.0; #endif }`),Ut=K(`uniform vec4 u_color;uniform float u_opacity;void main() {glFragColor=u_color*u_opacity; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}`),Wt=K(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);glFragColor=mix(color1,color2,u_mix)*u_opacity; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`uniform mat4 u_matrix;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=u_matrix*vec4(a_pos,0,1);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);}`),Gt=K(`in vec3 v_data;in float v_visibility; #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump float radius #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define highp vec4 stroke_color #pragma mapbox: define mediump float stroke_width #pragma mapbox: define lowp float stroke_opacity void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump float radius #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp vec4 stroke_color #pragma mapbox: initialize mediump float stroke_width #pragma mapbox: initialize lowp float stroke_opacity vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);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) );glFragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;out vec3 v_data;out float v_visibility; #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump float radius #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define highp vec4 stroke_color #pragma mapbox: define mediump float stroke_width #pragma mapbox: define lowp float stroke_opacity void main(void) { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump float radius #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp vec4 stroke_color #pragma mapbox: initialize mediump float stroke_width #pragma mapbox: initialize lowp float stroke_opacity vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);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;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),Kt=K(`void main() {glFragColor=vec4(1.0);}`,`in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}`),qt=K(`uniform highp float u_intensity;in vec2 v_extrude; #pragma mapbox: define highp float weight #define GAUSS_COEF 0.3989422804014327 void main() { #pragma mapbox: initialize highp float weight float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;out vec2 v_extrude; #pragma mapbox: define highp float weight #pragma mapbox: define mediump float radius const highp float ZERO=1.0/255.0/16.0; #define GAUSS_COEF 0.3989422804014327 void main(void) { #pragma mapbox: initialize highp float weight #pragma mapbox: initialize mediump float radius vec2 unscaled_extrude=vec2(mod(a_pos,2.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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),Jt=K(`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));glFragColor=color*u_opacity; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(0.0); #endif }`,`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;}`),Yt=K(`in float v_placed;in float v_notUsed;void main() {float alpha=0.5;glFragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {glFragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {glFragColor*=.1;}}`,`in vec2 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),Xt=K(`in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);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);glFragColor=color*alpha*opacity_t;}`,`in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;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;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp( 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),Zt=K(`uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}`,`in vec2 a_pos;out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}`),Qt=K(`#pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float opacity glFragColor=color*opacity; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`in vec2 a_pos;uniform mat4 u_matrix; #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float opacity gl_Position=u_matrix*vec4(a_pos,0,1);}`),$t=K(`in vec2 v_pos; #pragma mapbox: define highp vec4 outline_color #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 outline_color #pragma mapbox: initialize lowp float opacity float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);glFragColor=outline_color*(alpha*opacity); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`in vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;out vec2 v_pos; #pragma mapbox: define highp vec4 outline_color #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 outline_color #pragma mapbox: initialize lowp float opacity gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),en=K(`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; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;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);glFragColor=mix(color1,color2,u_fade)*alpha*opacity; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to #pragma mapbox: define lowp float pixel_ratio_from #pragma mapbox: define lowp float pixel_ratio_to void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);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;}`),tn=K(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;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);glFragColor=mix(color1,color2,u_fade)*opacity; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to #pragma mapbox: define lowp float pixel_ratio_from #pragma mapbox: define lowp float pixel_ratio_to void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);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);}`),nn=K(Vt,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;in vec2 a_pos;in vec4 a_normal_ed; #ifdef TERRAIN3D in vec2 a_centroid; #endif out vec4 v_color; #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp vec4 color void main() { #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp vec4 color vec3 normal=a_normal_ed.xyz; #ifdef TERRAIN3D float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); #else float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; #endif base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float 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;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=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;}`),rn=K(Vt,`uniform mat4 u_matrix;uniform lowp float u_opacity;in vec2 a_pos;in vec4 a_normal_ed; #ifdef TERRAIN3D in vec2 a_centroid; #endif out vec4 v_color; #pragma mapbox: define lowp float base #pragma mapbox: define lowp float height #pragma mapbox: define highp vec4 color #pragma mapbox: define highp vec4 gradation_top_color #pragma mapbox: define highp vec4 gradation_bottom_color #define LIGHT_DIRECTION_01 vec3(0,1,0) #define LIGHT_DIRECTION_02 vec3(0,-1,0) #define LIGHT_DIRECTION_03 vec3(0,0,1) void main() { #pragma mapbox: initialize lowp float base #pragma mapbox: initialize lowp float height #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize highp vec4 gradation_top_color #pragma mapbox: initialize highp vec4 gradation_bottom_color #ifdef TERRAIN3D float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); #else float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; #endif base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;vec3 normal=a_normal_ed.xyz;float t=mod(normal.x,2.0);float z=base;lowp vec4 gradationColor=gradation_bottom_color;if (t > 0.0) {gradationColor=gradation_top_color;z=height;}gl_Position=u_matrix*vec4(a_pos,z,1);vec3 n=vec3(normal/16384.0);float df01=dot(LIGHT_DIRECTION_01,n);float df02=dot(LIGHT_DIRECTION_02,n);float df03=dot(LIGHT_DIRECTION_03,n);df01=(df01+1.0)*0.5;df02=(df02+1.0)*0.5;float directional=smoothstep(0.0,1.0,df01*0.28+df02*0.4+df03*1.0+0.5);if (df03 >=1.0) {gradationColor=vec4(1.0);}v_color=vec4(color.xyz*directional,color.a);v_color*=gradationColor*u_opacity;}`),an=K(`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; #pragma mapbox: define lowp float base #pragma mapbox: define lowp float height #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to #pragma mapbox: define lowp float pixel_ratio_from #pragma mapbox: define lowp float pixel_ratio_to void main() { #pragma mapbox: initialize lowp float base #pragma mapbox: initialize lowp float height #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;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);glFragColor=mixedColor*v_lighting; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`uniform mat4 u_matrix;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 vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed; #ifdef TERRAIN3D in vec2 a_centroid; #endif out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting; #pragma mapbox: define lowp float base #pragma mapbox: define lowp float height #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to #pragma mapbox: define lowp float pixel_ratio_from #pragma mapbox: define lowp float pixel_ratio_to void main() { #pragma mapbox: initialize lowp float base #pragma mapbox: initialize lowp float height #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;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; #ifdef TERRAIN3D float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); #else float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; #endif base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 ? a_pos : vec2(edgedistance,z*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;}`),on=K(`#ifdef GL_ES precision highp float; #endif uniform 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));glFragColor=clamp(vec4( deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`precision highp float;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;}`),sn=K(`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; #define PI 3.141592653589793 void 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);glFragColor=accent_color*(1.0-shade_color.a)+shade_color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}`),cn=K(`in vec4 v_color;void main() {glFragColor=v_color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,` #define scale 0.015873016 in vec2 a_pos;in vec3 a_data;uniform mat4 u_matrix;uniform lowp float u_opacity;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec4 v_color; #pragma mapbox: define highp vec4 color #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define mediump float width void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize mediump float width float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;float halfwidth=width/2.0;float outset=(halfwidth+(halfwidth==0.0 ? 0.0 : ANTIALIASING))*0.5;vec2 a_extrude=a_data.xy-128.0;mediump vec2 dist=outset*a_extrude*scale;base=max(0.0,base);height=max(0.0,height);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,a_data.z > 0.0 ? height : base,0.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0)+projected_extrude;v_color=color*u_opacity;}`),ln=K(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale; #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity 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);glFragColor=color*(alpha*opacity); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,` #define scale 0.015873016 in vec2 a_pos_normal;in vec4 a_data;uniform mat4 u_matrix;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; #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float gapwidth #pragma mapbox: define lowp float offset #pragma mapbox: define mediump float width void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize lowp float offset #pragma mapbox: initialize mediump float width float 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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; #ifdef TERRAIN3D v_gamma_scale=1.0; #else float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; #endif v_width2=vec2(outset,inset);}`),un=K(`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; #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);glFragColor=color*(alpha*opacity); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,` #define scale 0.015873016 in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform mat4 u_matrix;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; #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float gapwidth #pragma mapbox: define lowp float offset #pragma mapbox: define mediump float width void main() { #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize lowp float offset #pragma mapbox: initialize mediump float width float 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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; #ifdef TERRAIN3D v_gamma_scale=1.0; #else float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; #endif v_width2=vec2(outset,inset);}`),dn=K(`uniform 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; #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to #pragma mapbox: define lowp float pixel_ratio_from #pragma mapbox: define lowp float pixel_ratio_to #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);glFragColor=color*alpha*opacity; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,` #define scale 0.015873016 #define LINE_DISTANCE_SCALE 2.0 in vec2 a_pos_normal;in vec4 a_data;uniform mat4 u_matrix;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; #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float offset #pragma mapbox: define mediump float gapwidth #pragma mapbox: define mediump float width #pragma mapbox: define lowp float floorwidth #pragma mapbox: define lowp vec4 pattern_from #pragma mapbox: define lowp vec4 pattern_to #pragma mapbox: define lowp float pixel_ratio_from #pragma mapbox: define lowp float pixel_ratio_to void main() { #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float offset #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize mediump float width #pragma mapbox: initialize lowp float floorwidth #pragma mapbox: initialize mediump vec4 pattern_from #pragma mapbox: initialize mediump vec4 pattern_to #pragma mapbox: initialize lowp float pixel_ratio_from #pragma mapbox: initialize lowp float pixel_ratio_to float 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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; #ifdef TERRAIN3D v_gamma_scale=1.0; #else float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; #endif v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),fn=K(`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; #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float width #pragma mapbox: define lowp float floorwidth void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float width #pragma mapbox: initialize lowp float floorwidth float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);glFragColor=color*(alpha*opacity); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,` #define scale 0.015873016 #define LINE_DISTANCE_SCALE 2.0 in vec2 a_pos_normal;in vec4 a_data;uniform mat4 u_matrix;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; #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float gapwidth #pragma mapbox: define lowp float offset #pragma mapbox: define mediump float width #pragma mapbox: define lowp float floorwidth void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize lowp float offset #pragma mapbox: initialize mediump float width #pragma mapbox: initialize lowp float floorwidth float 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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; #ifdef TERRAIN3D v_gamma_scale=1.0; #else float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; #endif v_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);}`),pn=K(`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);glFragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),mn=K(`uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;uniform float u_brightness_low;uniform float u_brightness_high;void main() {vec4 rgba=texture(u_texture,v_tex);vec4 color=rgba*v_total_opacity;if (u_brightness_low==0.0 && u_brightness_high==1.0) {glFragColor=color;} else {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);color.rgb=mix(u_high_vec,u_low_vec,color.rgb);glFragColor=color*color.a*v_total_opacity;} #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`const float PI=3.141592653589793;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_matrix;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;out vec2 v_tex;out float v_total_opacity; #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize lowp float opacity vec2 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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1) {gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : u_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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;}`),hn=K(`#define SDF_PX 8.0 uniform 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;uniform lowp float u_lightness; in vec2 v_data0;in vec3 v_data1; #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=lerp_color_lightness(fill_color,u_lightness);highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=lerp_color_lightness(halo_color,u_lightness);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);glFragColor=color*(alpha*total_opacity); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`const float PI=3.141592653589793;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_matrix;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;out vec2 v_data0;out vec3 v_data1; #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur vec2 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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1) {gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : u_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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),gn=K(`#define SDF_PX 8.0 #define SDF 1.0 #define ICON 0.0 uniform 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; #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur float total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;glFragColor=texture(u_texture_icon,tex_icon)*total_opacity; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif return;}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);glFragColor=color*(alpha*total_opacity); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`const float PI=3.141592653589793;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_matrix;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;out vec4 v_data0;out vec4 v_data1; #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur vec2 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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1) {gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : u_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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}`),_n=K(`uniform sampler2D u_texture;in vec2 v_texture_pos;void main() {vec4 surface_color=texture(u_texture,v_texture_pos);glFragColor=surface_color;}`,`uniform mat4 u_matrix;uniform float u_ele_delta;in vec3 a_pos3d;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=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}`),vn=K(`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() {glFragColor=pack(v_depth);}`,`uniform mat4 u_matrix;uniform float u_ele_delta;in vec3 a_pos3d;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=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}`),yn=K(`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);glFragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}`,`uniform mat4 u_matrix;uniform float u_ele_delta;in vec3 a_pos3d;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=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}`),bn=K(`in vec4 v_color;void main() { #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0);return; #endif glFragColor=v_color;}`,`in vec3 a_pos;in vec3 a_normal;uniform mat4 u_matrix;uniform highp vec4 u_color;uniform lowp float u_opacity;out vec4 v_color; #define FACTOR 16384.0 #define LIGHT_DIRECTION_NORTH vec3(0,1,0) #define LIGHT_DIRECTION_SOUTH vec3(0,-1,0) #define LIGHT_DIRECTION_EAST vec3(-1,0,0) #define LIGHT_DIRECTION_WEST vec3(1,0,0) #define LIGHT_DIRECTION_TOP vec3(0,0,1) void main() {vec4 color=u_color;gl_Position=u_matrix*vec4(a_pos,1.0);vec3 n=vec3(a_normal/FACTOR)*vec3(-1.0,-1.0,1.0);float north=dot(LIGHT_DIRECTION_NORTH,n);float south=dot(LIGHT_DIRECTION_SOUTH,n);float east=dot(LIGHT_DIRECTION_EAST,n);float west=dot(LIGHT_DIRECTION_WEST,n);float top=dot(LIGHT_DIRECTION_TOP,n);north=(north+1.0)*0.5;south=(south+1.0)*0.5;east=(east+1.0)*0.5;west=(west+1.0)*0.5;float diffuseColor=smoothstep(0.0,1.0,north*0.25+south*0.4+east*0.25+west*0.4+top*0.25);v_color=vec4(color.xyz*diffuseColor,color.a)*u_opacity;}`),xn=K(`uniform lowp float u_texture_blend_factor;uniform sampler2D u_image;in vec4 v_color;in vec2 v_texture_pos0;in vec2 v_texture_pos1;void main() { #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0);return; #endif vec4 color0=texture(u_image,v_texture_pos0);vec4 color1=texture(u_image,v_texture_pos1);vec4 blendedTexture=mix(color0,color1,u_texture_blend_factor);glFragColor=v_color*blendedTexture;}`,`in vec3 a_pos;in vec3 a_normal;in vec2 a_texture_pos0;in vec2 a_texture_pos1;uniform mat4 u_matrix;uniform highp vec4 u_color;uniform lowp float u_opacity;out vec4 v_color;out vec2 v_texture_pos0;out vec2 v_texture_pos1; #define FACTOR 16384.0 #define LIGHT_DIRECTION_NORTH vec3(0,1,0) #define LIGHT_DIRECTION_SOUTH vec3(0,-1,0) #define LIGHT_DIRECTION_EAST vec3(-1,0,0) #define LIGHT_DIRECTION_WEST vec3(1,0,0) #define LIGHT_DIRECTION_TOP vec3(0,0,1) void main() {vec4 color=u_color;gl_Position=u_matrix*vec4(a_pos,1.0);v_texture_pos0=a_texture_pos0;v_texture_pos1=a_texture_pos1;vec3 n=vec3(a_normal/FACTOR)*vec3(-1.0,-1.0,1.0);float north=dot(LIGHT_DIRECTION_NORTH,n);float south=dot(LIGHT_DIRECTION_SOUTH,n);float east=dot(LIGHT_DIRECTION_EAST,n);float west=dot(LIGHT_DIRECTION_WEST,n);float top=dot(LIGHT_DIRECTION_TOP,n);north=(north+1.0)*0.5;south=(south+1.0)*0.5;east=(east+1.0)*0.5;west=(west+1.0)*0.5;float diffuseColor=smoothstep(0.0,1.0,north*0.25+south*0.4+east*0.25+west*0.4+top*0.25);v_color=vec4(color.xyz*diffuseColor,color.a)*u_opacity;}`),Sn=K(`uniform highp sampler2DShadow u_shadow_map;uniform highp vec2 u_shadow_map_size;uniform highp float u_shadow_bias;uniform highp float u_shadow_intensity;in vec4 v_color;in vec4 v_light_pos;in float v_normal_z;void main() { #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0);return; #endif float shadow=calculate_shadow(v_light_pos,u_shadow_map,u_shadow_map_size,u_shadow_bias,u_shadow_intensity);shadow*=smoothstep(0.1,0.4,v_normal_z);vec3 finalRgb=v_color.rgb*(1.0-shadow);glFragColor=vec4(finalRgb,v_color.a);}`,`in vec3 a_pos;in vec3 a_normal;uniform mat4 u_matrix;uniform mat4 u_light_matrix;uniform highp vec4 u_color;uniform lowp float u_opacity;uniform highp float u_shadow_normal_bias;out vec4 v_color;out vec4 v_light_pos;out float v_normal_z; #define FACTOR 16384.0 #define LIGHT_DIRECTION_NORTH vec3(0,1,0) #define LIGHT_DIRECTION_SOUTH vec3(0,-1,0) #define LIGHT_DIRECTION_EAST vec3(-1,0,0) #define LIGHT_DIRECTION_WEST vec3(1,0,0) #define LIGHT_DIRECTION_TOP vec3(0,0,1) void main() {vec4 color=u_color;vec3 n0=vec3(a_normal/FACTOR);vec3 n1=n0*vec3(-1.0,-1.0,1.0);gl_Position=u_matrix*vec4(a_pos,1.0);vec3 offsetPos=a_pos+n0*u_shadow_normal_bias;v_light_pos=u_light_matrix*vec4(offsetPos,1.0);float north=dot(LIGHT_DIRECTION_NORTH,n1);float south=dot(LIGHT_DIRECTION_SOUTH,n1);float east=dot(LIGHT_DIRECTION_EAST,n1);float west=dot(LIGHT_DIRECTION_WEST,n1);float top=dot(LIGHT_DIRECTION_TOP,n1);north=(north+1.0)*0.5;south=(south+1.0)*0.5;east=(east+1.0)*0.5;west=(west+1.0)*0.5;float diffuseColor=smoothstep(0.0,1.0,north*0.25+south*0.4+east*0.25+west*0.4+top*0.25);v_color=vec4(color.xyz*diffuseColor,color.a)*u_opacity;v_normal_z=n1.z;}`),Cn=K(`uniform lowp float u_texture_blend_factor;uniform sampler2D u_image;uniform highp sampler2DShadow u_shadow_map;uniform highp vec2 u_shadow_map_size;uniform highp float u_shadow_bias;uniform highp float u_shadow_intensity;in vec4 v_color;in vec2 v_texture_pos0;in vec2 v_texture_pos1;in vec4 v_light_pos;in float v_normal_z;void main() { #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0);return; #endif vec4 color0=texture(u_image,v_texture_pos0);vec4 color1=texture(u_image,v_texture_pos1);vec4 blendedTexture=mix(color0,color1,u_texture_blend_factor);vec4 baseColor=v_color*blendedTexture;float shadow=calculate_shadow(v_light_pos,u_shadow_map,u_shadow_map_size,u_shadow_bias,u_shadow_intensity);shadow*=smoothstep(0.1,0.4,v_normal_z);vec3 finalRgb=baseColor.rgb*(1.0-shadow);glFragColor=vec4(finalRgb,baseColor.a);}`,`in vec3 a_pos;in vec3 a_normal;in vec2 a_texture_pos0;in vec2 a_texture_pos1;uniform mat4 u_matrix;uniform mat4 u_light_matrix;uniform highp vec4 u_color;uniform lowp float u_opacity;uniform highp float u_shadow_normal_bias;out vec4 v_color;out vec2 v_texture_pos0;out vec2 v_texture_pos1;out vec4 v_light_pos;out float v_normal_z; #define FACTOR 16384.0 #define LIGHT_DIRECTION_NORTH vec3(0,1,0) #define LIGHT_DIRECTION_SOUTH vec3(0,-1,0) #define LIGHT_DIRECTION_EAST vec3(-1,0,0) #define LIGHT_DIRECTION_WEST vec3(1,0,0) #define LIGHT_DIRECTION_TOP vec3(0,0,1) void main() {vec4 color=u_color;vec3 n0=vec3(a_normal/FACTOR);vec3 n1=n0*vec3(-1.0,-1.0,1.0);gl_Position=u_matrix*vec4(a_pos,1.0);vec3 offsetPos=a_pos+n0*u_shadow_normal_bias;v_light_pos=u_light_matrix*vec4(offsetPos,1.0);v_texture_pos0=a_texture_pos0;v_texture_pos1=a_texture_pos1;float north=dot(LIGHT_DIRECTION_NORTH,n1);float south=dot(LIGHT_DIRECTION_SOUTH,n1);float east=dot(LIGHT_DIRECTION_EAST,n1);float west=dot(LIGHT_DIRECTION_WEST,n1);float top=dot(LIGHT_DIRECTION_TOP,n1);north=(north+1.0)*0.5;south=(south+1.0)*0.5;east=(east+1.0)*0.5;west=(west+1.0)*0.5;float diffuseColor=smoothstep(0.0,1.0,north*0.25+south*0.4+east*0.25+west*0.4+top*0.25);v_color=vec4(color.xyz*diffuseColor,color.a)*u_opacity;v_normal_z=n1.z;}`);function K(e,t){let n=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),i=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=i?i.concat(r):r,o=t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);o&&(o=o.map(e=>{let t=e.split(` `);return t[t.length-1]}),o=[...new Set(o)]);let s={};return{fragmentSource:e=e.replace(n,(e,t,n,r,i)=>(s[i]=!0,t===`define`?`\n#ifndef HAS_UNIFORM_u_${i}\nin ${n} ${r} ${i};\n#else\nuniform ${n} ${r} u_${i};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${i}\n ${n} ${r} ${i} = u_${i};\n#endif\n`)),vertexSource:t=t.replace(n,(e,t,n,r,i)=>{let a=r===`float`?`vec2`:`vec4`,o=i.match(/color/)?`color`:a;return s[i]?t===`define`?`\n#ifndef HAS_UNIFORM_u_${i}\nuniform lowp float u_${i}_t;\nin ${n} ${a} a_${i};\nout ${n} ${r} ${i};\n#else\nuniform ${n} ${r} u_${i};\n#endif\n`:o===`vec4`?`\n#ifndef HAS_UNIFORM_u_${i}\n ${i} = a_${i};\n#else\n ${n} ${r} ${i} = u_${i};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${i}\n ${i} = unpack_mix_${o}(a_${i}, u_${i}_t);\n#else\n ${n} ${r} ${i} = u_${i};\n#endif\n`:t===`define`?`\n#ifndef HAS_UNIFORM_u_${i}\nuniform lowp float u_${i}_t;\nin ${n} ${a} a_${i};\n#else\nuniform ${n} ${r} u_${i};\n#endif\n`:o===`vec4`?`\n#ifndef HAS_UNIFORM_u_${i}\n ${n} ${r} ${i} = a_${i};\n#else\n ${n} ${r} ${i} = u_${i};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${i}\n ${n} ${r} ${i} = unpack_mix_${o}(a_${i}, u_${i}_t);\n#else\n ${n} ${r} ${i} = u_${i};\n#endif\n`}),staticAttributes:o,staticUniforms:a}}var wn={prelude:Ht,background:Ut,backgroundPattern:Wt,circle:Gt,clippingMask:Kt,heatmap:qt,heatmapTexture:Jt,collisionBox:Yt,collisionCircle:Xt,debug:Zt,fill:Qt,fillOutline:$t,fillOutlinePattern:en,fillPattern:tn,fillExtrusion:nn,fillExtrusionPattern:an,fillExtrusionGradation:rn,hillshadePrepare:on,hillshade:sn,lineExtrusion:cn,line:ln,lineGradient:un,linePattern:dn,lineSDF:fn,raster:pn,symbolIcon:mn,symbolSDF:hn,symbolTextAndIcon:gn,terrain:_n,terrainDepth:vn,terrainCoords:yn,meshBatch:bn,meshBatchTexture:xn,meshObject:bn,meshObjectTexture:xn,shadowedMeshObject:Sn,shadowedMeshObjectTexture:Cn,shadowedMeshBatch:Sn,shadowedMeshBatchTexture:Cn,meshShadowMap:K(`void main() {glFragColor=vec4(1.0);}`,`in vec3 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,1.0);}`),shadowReceiverPlane:K(`uniform highp sampler2DShadow u_shadow_map;uniform highp vec2 u_shadow_map_size;uniform highp float u_shadow_bias;uniform highp float u_shadow_intensity;in vec4 v_light_pos;void main() { #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0);return; #endif float shadow=calculate_shadow(v_light_pos,u_shadow_map,u_shadow_map_size,u_shadow_bias,u_shadow_intensity);glFragColor=vec4(0.0,0.0,0.0,shadow);}`,`in vec2 a_pos;uniform mat4 u_matrix;uniform mat4 u_light_matrix;out vec4 v_light_pos;void main() {vec4 pos=vec4(a_pos,0,1);gl_Position=u_matrix*pos;v_light_pos=u_light_matrix*pos;}`)};class Tn{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,n,r,i,a,o,s){this.context=e;let c=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!c&&e({u_matrix:e,u_ele_delta:t}),Dn=(e,t,n)=>({u_matrix:e,u_texture:0,u_terrain_coords_id:t/255,u_ele_delta:n}),On=(e,t)=>({u_matrix:e,u_texture:0,u_ele_delta:t});function kn(e){let t=[];for(let n=0;n({u_depth:new e.aS(t,n.u_depth),u_terrain:new e.aS(t,n.u_terrain),u_terrain_dim:new e.aR(t,n.u_terrain_dim),u_terrain_matrix:new e.aT(t,n.u_terrain_matrix),u_terrain_unpack:new e.aU(t,n.u_terrain_unpack),u_terrain_exaggeration:new e.aR(t,n.u_terrain_exaggeration)}))(t,S),this.binderUniforms=i?i.getUniforms(t,S):[]}draw(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){let _=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(n),e.setStencilMode(r),e.setColorMode(i),e.setCullFace(a),s){e.activeTexture.set(_.TEXTURE2),_.bindTexture(_.TEXTURE_2D,s.depthTexture),e.activeTexture.set(_.TEXTURE3),_.bindTexture(_.TEXTURE_2D,s.texture);for(let e in this.terrainUniforms)this.terrainUniforms[e].set(s[e])}for(let e in this.fixedUniforms)this.fixedUniforms[e].set(o[e]);m&&m.setUniforms(e,this.binderUniforms,f,{zoom:p});let v={[_.LINES]:2,[_.TRIANGLES]:3,[_.LINE_STRIP]:1}[t];for(let n of d.get()){let r=n.vaos||(n.vaos={});(r[c]||(r[c]=new Tn)).bind(e,this,l,m?m.getPaintVertexBuffers():[],u,n.vertexOffset,h,g),_.drawElements(t,n.primitiveLength*v,_.UNSIGNED_SHORT,n.primitiveOffset*v*2)}}}function jn(e,t,n){let r=1/ft(n,1,t.transform.tileZoom),i=2**n.tileID.overscaledZ,a=n.tileSize*2**t.transform.tileZoom/i,o=a*(n.tileID.canonical.x+n.tileID.wrap*i),s=a*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[r,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}let Mn=(t,n,r,i)=>{let a=n.style.light,o=a.properties.get(`position`),s=ce(o.x,o.y,o.z),c=function(){var t=new e.A(9);return e.A!=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}();a.properties.get(`anchor`)===`viewport`&&function(e,t){var n=Math.sin(t),r=Math.cos(t);e[0]=r,e[1]=n,e[2]=0,e[3]=-n,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1}(c,-n.transform.angle),function(e,t,n){var r=t[0],i=t[1],a=t[2];e[0]=r*n[0]+i*n[3]+a*n[6],e[1]=r*n[1]+i*n[4]+a*n[7],e[2]=r*n[2]+i*n[5]+a*n[8]}(s,s,c);let l=a.properties.get(`color`);return{u_matrix:t,u_lightpos:s,u_lightintensity:a.properties.get(`intensity`),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+r,u_opacity:i}},Nn=(e,t)=>({u_matrix:e,u_opacity:t}),Pn=(t,n,r,i,a,o,s)=>e.e(Mn(t,n,r,i),jn(o,n,s),{u_height_factor:-(2**a.overscaledZ)/s.tileSize/8}),Fn=e=>({u_matrix:e}),In=(t,n,r,i)=>e.e(Fn(t),jn(r,n,i)),Ln=(e,t)=>({u_matrix:e,u_world:t}),Rn=(t,n,r,i,a)=>e.e(In(t,n,r,i),{u_world:a}),zn=(e,t,n,r)=>{let i=e.transform,a,o;if(r.paint.get(`circle-pitch-alignment`)===`map`){let e=ft(n,1,i.zoom);a=!0,o=[e,e]}else a=!1,o=i.pixelsToGLUnits;return{u_camera_to_center_distance:i.cameraToCenterDistance,u_scale_with_map:+(r.paint.get(`circle-pitch-scale`)===`map`),u_matrix:e.translatePosMatrix(t.posMatrix,n,r.paint.get(`circle-translate`),r.paint.get(`circle-translate-anchor`)),u_pitch_with_map:+a,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:o}},Bn=(e,t,n)=>{let r=ft(n,1,t.zoom),i=2**(t.zoom-n.tileID.overscaledZ),a=n.tileID.overscaleFactor();return{u_matrix:e,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:r,u_extrude_scale:[t.pixelsToGLUnits[0]/(r*i),t.pixelsToGLUnits[1]/(r*i)],u_overscale_factor:a}},Vn=(e,t,n)=>({u_matrix:e,u_inv_matrix:t,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),Hn=(e,t,n=1)=>({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:n}),Un=e=>({u_matrix:e}),Wn=(e,t,n,r)=>({u_matrix:e,u_extrude_scale:ft(t,1,n),u_intensity:r}),Gn=(t,n,r,i)=>{let a=e.ap();e.aY(a,0,t.width,t.height,0,0,1);let o=t.context.gl;return{u_matrix:a,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:r,u_color_ramp:i,u_opacity:n.paint.get(`heatmap-opacity`)}};function Kn(t,n){let r=2**n.canonical.z,i=n.canonical.y;return[new e.a4(0,i/r).toLngLat().lat,new e.a4(0,(i+1)/r).toLngLat().lat]}let qn=(e,t,n,r)=>({u_matrix:e,u_opacity:t,u_ratio:n,u_device_pixel_ratio:r}),Jn=(e,t,n,r)=>{let i=e.transform;return{u_matrix:$n(e,t,n,r),u_ratio:1/ft(t,1,i.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},Yn=(t,n,r,i,a)=>e.e(Jn(t,n,r,a),{u_image:0,u_image_height:i}),Xn=(e,t,n,r,i)=>{let a=e.transform,o=Qn(t,a);return{u_matrix:$n(e,t,n,i),u_texsize:t.imageAtlasTexture.size,u_ratio:1/ft(t,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[o,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Zn=(t,n,r,i,a,o)=>{let s=t.lineAtlas,c=Qn(n,t.transform),l=r.layout.get(`line-cap`)===`round`,u=s.getDash(i.from,l),d=s.getDash(i.to,l),f=u.width*a.fromScale,p=d.width*a.toScale;return e.e(Jn(t,n,r,o),{u_patternscale_a:[c/f,-u.height/2],u_patternscale_b:[c/p,-d.height/2],u_sdfgamma:s.width/(256*Math.min(f,p)*t.pixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:d.y,u_mix:a.t})};function Qn(e,t){return 1/ft(e,1,t.tileZoom)}function $n(e,t,n,r){return e.translatePosMatrix(r?r.posMatrix:t.tileID.posMatrix,t,n.paint.get(`line-translate`),n.paint.get(`line-translate-anchor`))}let er=(e,t,n,r,i)=>{return{u_matrix:e,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*i.paint.get(`raster-opacity`),u_image0:0,u_image1:1,u_brightness_low:i.paint.get(`raster-brightness-min`),u_brightness_high:i.paint.get(`raster-brightness-max`),u_saturation_factor:(o=i.paint.get(`raster-saturation`),o>0?1-1/(1.001-o):-o),u_contrast_factor:(a=i.paint.get(`raster-contrast`),a>0?1/(1-a):1+a),u_spin_weights:tr(i.paint.get(`raster-hue-rotate`))};var a,o};function tr(e){e*=Math.PI/180;let t=Math.sin(e),n=Math.cos(e);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}let nr=(e,t,n,r,i,a,o,s,c,l,u)=>{let d=i.transform;return{u_is_size_zoom_constant:+(e===`constant`||e===`source`),u_is_size_feature_constant:+(e===`constant`||e===`camera`),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:d.cameraToCenterDistance,u_pitch:d.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:d.width/d.height,u_fade_change:i.options.fadeDuration?i.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:o,u_coord_matrix:s,u_is_text:+c,u_pitch_with_map:+r,u_texsize:l,u_texture:0,u_brightness_low:Math.max(0,u),u_brightness_high:Math.min(1+u,1)}},rr=(t,n,r,i,a,o,s,c,l,u,d,f)=>{let p=a.transform;return e.e(nr(t,n,r,i,a,o,s,c,l,u,f),{u_gamma_scale:i?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:1,u_lightness:f})},ir=(t,n,r,i,a,o,s,c,l,u,d)=>e.e(rr(t,n,r,i,a,o,s,c,!0,l,0,d),{u_texsize_icon:u,u_texture_icon:1}),ar=(e,t,n)=>({u_matrix:e,u_opacity:t,u_color:n}),or=(t,n,r,i,a,o)=>e.e(function(e,t,n,r){let i=n.imageManager.getPattern(e.from.toString()),a=n.imageManager.getPattern(e.to.toString()),{width:o,height:s}=n.imageManager.getPixelSize(),c=2**r.tileID.overscaledZ,l=r.tileSize*2**n.transform.tileZoom/c,u=l*(r.tileID.canonical.x+r.tileID.wrap*c),d=l*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[o,s],u_mix:t.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/ft(r,1,n.transform.tileZoom),u_pixel_coord_upper:[u>>16,d>>16],u_pixel_coord_lower:[65535&u,65535&d]}}(i,o,r,a),{u_matrix:t,u_opacity:n}),sr=(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_opacity:new e.aR(t,n.u_opacity),u_color:new e.aX(t,n.u_color)}),cr=(t,n)=>({u_image:new e.aS(t,n.u_image),u_texture_blend_factor:new e.aR(t,n.u_texture_blend_factor)}),lr=(t,n)=>({u_light_matrix:new e.aT(t,n.u_light_matrix),u_shadow_map:new e.aS(t,n.u_shadow_map),u_shadow_map_size:new e.aW(t,n.u_shadow_map_size),u_shadow_bias:new e.aR(t,n.u_shadow_bias),u_shadow_intensity:new e.aR(t,n.u_shadow_intensity),u_shadow_normal_bias:new e.aR(t,n.u_shadow_normal_bias)}),ur=(t,n)=>e.e(sr(t,n),cr(t,n)),dr=(t,n)=>e.e(sr(t,n),lr(t,n)),fr=(t,n)=>e.e(sr(t,n),cr(t,n),lr(t,n)),pr=(e,t,n)=>({u_matrix:e,u_opacity:t,u_color:n}),mr=e=>({u_image:0,u_texture_blend_factor:e}),hr=(e,t,n,r,i,a)=>({u_light_matrix:e,u_shadow_map:t,u_shadow_map_size:[n,n],u_shadow_bias:r,u_shadow_intensity:a,u_shadow_normal_bias:i}),gr=pr,_r=(t,n,r,i=0)=>e.e(pr(t,n,r),mr(i)),vr=(t,n,r,i,a,o,s,c,l)=>e.e(pr(t,r,i),hr(n,a,o,s,c,l)),yr=(t,n,r,i,a,o,s,c,l,u)=>e.e(pr(t,r,i),mr(a),hr(n,o,s,c,l,u)),br=e=>({u_matrix:e}),xr=(e,t,n,r,i,a)=>({u_matrix:e,u_light_matrix:t,u_shadow_map:n,u_shadow_map_size:[r,r],u_shadow_bias:i,u_shadow_intensity:a}),q={fillExtrusion:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_lightpos:new e.aV(t,n.u_lightpos),u_lightintensity:new e.aR(t,n.u_lightintensity),u_lightcolor:new e.aV(t,n.u_lightcolor),u_vertical_gradient:new e.aR(t,n.u_vertical_gradient),u_opacity:new e.aR(t,n.u_opacity)}),fillExtrusionGradation:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_opacity:new e.aR(t,n.u_opacity)}),fillExtrusionPattern:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_lightpos:new e.aV(t,n.u_lightpos),u_lightintensity:new e.aR(t,n.u_lightintensity),u_lightcolor:new e.aV(t,n.u_lightcolor),u_vertical_gradient:new e.aR(t,n.u_vertical_gradient),u_height_factor:new e.aR(t,n.u_height_factor),u_image:new e.aS(t,n.u_image),u_texsize:new e.aW(t,n.u_texsize),u_pixel_coord_upper:new e.aW(t,n.u_pixel_coord_upper),u_pixel_coord_lower:new e.aW(t,n.u_pixel_coord_lower),u_scale:new e.aV(t,n.u_scale),u_fade:new e.aR(t,n.u_fade),u_opacity:new e.aR(t,n.u_opacity)}),fill:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix)}),fillPattern:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_image:new e.aS(t,n.u_image),u_texsize:new e.aW(t,n.u_texsize),u_pixel_coord_upper:new e.aW(t,n.u_pixel_coord_upper),u_pixel_coord_lower:new e.aW(t,n.u_pixel_coord_lower),u_scale:new e.aV(t,n.u_scale),u_fade:new e.aR(t,n.u_fade)}),fillOutline:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_world:new e.aW(t,n.u_world)}),fillOutlinePattern:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_world:new e.aW(t,n.u_world),u_image:new e.aS(t,n.u_image),u_texsize:new e.aW(t,n.u_texsize),u_pixel_coord_upper:new e.aW(t,n.u_pixel_coord_upper),u_pixel_coord_lower:new e.aW(t,n.u_pixel_coord_lower),u_scale:new e.aV(t,n.u_scale),u_fade:new e.aR(t,n.u_fade)}),circle:(t,n)=>({u_camera_to_center_distance:new e.aR(t,n.u_camera_to_center_distance),u_scale_with_map:new e.aS(t,n.u_scale_with_map),u_pitch_with_map:new e.aS(t,n.u_pitch_with_map),u_extrude_scale:new e.aW(t,n.u_extrude_scale),u_device_pixel_ratio:new e.aR(t,n.u_device_pixel_ratio),u_matrix:new e.aT(t,n.u_matrix)}),collisionBox:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_camera_to_center_distance:new e.aR(t,n.u_camera_to_center_distance),u_pixels_to_tile_units:new e.aR(t,n.u_pixels_to_tile_units),u_extrude_scale:new e.aW(t,n.u_extrude_scale),u_overscale_factor:new e.aR(t,n.u_overscale_factor)}),collisionCircle:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_inv_matrix:new e.aT(t,n.u_inv_matrix),u_camera_to_center_distance:new e.aR(t,n.u_camera_to_center_distance),u_viewport_size:new e.aW(t,n.u_viewport_size)}),debug:(t,n)=>({u_color:new e.aX(t,n.u_color),u_matrix:new e.aT(t,n.u_matrix),u_overlay:new e.aS(t,n.u_overlay),u_overlay_scale:new e.aR(t,n.u_overlay_scale)}),clippingMask:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix)}),heatmap:(t,n)=>({u_extrude_scale:new e.aR(t,n.u_extrude_scale),u_intensity:new e.aR(t,n.u_intensity),u_matrix:new e.aT(t,n.u_matrix)}),heatmapTexture:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_world:new e.aW(t,n.u_world),u_image:new e.aS(t,n.u_image),u_color_ramp:new e.aS(t,n.u_color_ramp),u_opacity:new e.aR(t,n.u_opacity)}),hillshade:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_image:new e.aS(t,n.u_image),u_latrange:new e.aW(t,n.u_latrange),u_light:new e.aW(t,n.u_light),u_shadow:new e.aX(t,n.u_shadow),u_highlight:new e.aX(t,n.u_highlight),u_accent:new e.aX(t,n.u_accent)}),hillshadePrepare:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_image:new e.aS(t,n.u_image),u_dimension:new e.aW(t,n.u_dimension),u_zoom:new e.aR(t,n.u_zoom),u_unpack:new e.aU(t,n.u_unpack)}),lineExtrusion:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_opacity:new e.aR(t,n.u_opacity),u_ratio:new e.aR(t,n.u_ratio),u_device_pixel_ratio:new e.aR(t,n.u_device_pixel_ratio)}),line:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_ratio:new e.aR(t,n.u_ratio),u_device_pixel_ratio:new e.aR(t,n.u_device_pixel_ratio),u_units_to_pixels:new e.aW(t,n.u_units_to_pixels)}),lineGradient:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_ratio:new e.aR(t,n.u_ratio),u_device_pixel_ratio:new e.aR(t,n.u_device_pixel_ratio),u_units_to_pixels:new e.aW(t,n.u_units_to_pixels),u_image:new e.aS(t,n.u_image),u_image_height:new e.aR(t,n.u_image_height)}),linePattern:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_texsize:new e.aW(t,n.u_texsize),u_ratio:new e.aR(t,n.u_ratio),u_device_pixel_ratio:new e.aR(t,n.u_device_pixel_ratio),u_image:new e.aS(t,n.u_image),u_units_to_pixels:new e.aW(t,n.u_units_to_pixels),u_scale:new e.aV(t,n.u_scale),u_fade:new e.aR(t,n.u_fade)}),lineSDF:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_ratio:new e.aR(t,n.u_ratio),u_device_pixel_ratio:new e.aR(t,n.u_device_pixel_ratio),u_units_to_pixels:new e.aW(t,n.u_units_to_pixels),u_patternscale_a:new e.aW(t,n.u_patternscale_a),u_patternscale_b:new e.aW(t,n.u_patternscale_b),u_sdfgamma:new e.aR(t,n.u_sdfgamma),u_image:new e.aS(t,n.u_image),u_tex_y_a:new e.aR(t,n.u_tex_y_a),u_tex_y_b:new e.aR(t,n.u_tex_y_b),u_mix:new e.aR(t,n.u_mix)}),raster:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_tl_parent:new e.aW(t,n.u_tl_parent),u_scale_parent:new e.aR(t,n.u_scale_parent),u_buffer_scale:new e.aR(t,n.u_buffer_scale),u_fade_t:new e.aR(t,n.u_fade_t),u_opacity:new e.aR(t,n.u_opacity),u_image0:new e.aS(t,n.u_image0),u_image1:new e.aS(t,n.u_image1),u_brightness_low:new e.aR(t,n.u_brightness_low),u_brightness_high:new e.aR(t,n.u_brightness_high),u_saturation_factor:new e.aR(t,n.u_saturation_factor),u_contrast_factor:new e.aR(t,n.u_contrast_factor),u_spin_weights:new e.aV(t,n.u_spin_weights)}),symbolIcon:(t,n)=>({u_is_size_zoom_constant:new e.aS(t,n.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aS(t,n.u_is_size_feature_constant),u_size_t:new e.aR(t,n.u_size_t),u_size:new e.aR(t,n.u_size),u_camera_to_center_distance:new e.aR(t,n.u_camera_to_center_distance),u_pitch:new e.aR(t,n.u_pitch),u_rotate_symbol:new e.aS(t,n.u_rotate_symbol),u_aspect_ratio:new e.aR(t,n.u_aspect_ratio),u_fade_change:new e.aR(t,n.u_fade_change),u_matrix:new e.aT(t,n.u_matrix),u_label_plane_matrix:new e.aT(t,n.u_label_plane_matrix),u_coord_matrix:new e.aT(t,n.u_coord_matrix),u_is_text:new e.aS(t,n.u_is_text),u_pitch_with_map:new e.aS(t,n.u_pitch_with_map),u_texsize:new e.aW(t,n.u_texsize),u_texture:new e.aS(t,n.u_texture),u_brightness_low:new e.aR(t,n.u_brightness_low),u_brightness_high:new e.aR(t,n.u_brightness_high)}),symbolSDF:(t,n)=>({u_is_size_zoom_constant:new e.aS(t,n.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aS(t,n.u_is_size_feature_constant),u_size_t:new e.aR(t,n.u_size_t),u_size:new e.aR(t,n.u_size),u_camera_to_center_distance:new e.aR(t,n.u_camera_to_center_distance),u_pitch:new e.aR(t,n.u_pitch),u_rotate_symbol:new e.aS(t,n.u_rotate_symbol),u_aspect_ratio:new e.aR(t,n.u_aspect_ratio),u_fade_change:new e.aR(t,n.u_fade_change),u_matrix:new e.aT(t,n.u_matrix),u_label_plane_matrix:new e.aT(t,n.u_label_plane_matrix),u_coord_matrix:new e.aT(t,n.u_coord_matrix),u_is_text:new e.aS(t,n.u_is_text),u_pitch_with_map:new e.aS(t,n.u_pitch_with_map),u_texsize:new e.aW(t,n.u_texsize),u_texture:new e.aS(t,n.u_texture),u_gamma_scale:new e.aR(t,n.u_gamma_scale),u_device_pixel_ratio:new e.aR(t,n.u_device_pixel_ratio),u_is_halo:new e.aS(t,n.u_is_halo),u_lightness:new e.aR(t,n.u_lightness)}),symbolTextAndIcon:(t,n)=>({u_is_size_zoom_constant:new e.aS(t,n.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aS(t,n.u_is_size_feature_constant),u_size_t:new e.aR(t,n.u_size_t),u_size:new e.aR(t,n.u_size),u_camera_to_center_distance:new e.aR(t,n.u_camera_to_center_distance),u_pitch:new e.aR(t,n.u_pitch),u_rotate_symbol:new e.aS(t,n.u_rotate_symbol),u_aspect_ratio:new e.aR(t,n.u_aspect_ratio),u_fade_change:new e.aR(t,n.u_fade_change),u_matrix:new e.aT(t,n.u_matrix),u_label_plane_matrix:new e.aT(t,n.u_label_plane_matrix),u_coord_matrix:new e.aT(t,n.u_coord_matrix),u_is_text:new e.aS(t,n.u_is_text),u_pitch_with_map:new e.aS(t,n.u_pitch_with_map),u_texsize:new e.aW(t,n.u_texsize),u_texsize_icon:new e.aW(t,n.u_texsize_icon),u_texture:new e.aS(t,n.u_texture),u_texture_icon:new e.aS(t,n.u_texture_icon),u_gamma_scale:new e.aR(t,n.u_gamma_scale),u_device_pixel_ratio:new e.aR(t,n.u_device_pixel_ratio),u_is_halo:new e.aS(t,n.u_is_halo),u_lightness:new e.aR(t,n.u_lightness)}),background:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_opacity:new e.aR(t,n.u_opacity),u_color:new e.aX(t,n.u_color)}),backgroundPattern:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_opacity:new e.aR(t,n.u_opacity),u_image:new e.aS(t,n.u_image),u_pattern_tl_a:new e.aW(t,n.u_pattern_tl_a),u_pattern_br_a:new e.aW(t,n.u_pattern_br_a),u_pattern_tl_b:new e.aW(t,n.u_pattern_tl_b),u_pattern_br_b:new e.aW(t,n.u_pattern_br_b),u_texsize:new e.aW(t,n.u_texsize),u_mix:new e.aR(t,n.u_mix),u_pattern_size_a:new e.aW(t,n.u_pattern_size_a),u_pattern_size_b:new e.aW(t,n.u_pattern_size_b),u_scale_a:new e.aR(t,n.u_scale_a),u_scale_b:new e.aR(t,n.u_scale_b),u_pixel_coord_upper:new e.aW(t,n.u_pixel_coord_upper),u_pixel_coord_lower:new e.aW(t,n.u_pixel_coord_lower),u_tile_units_to_pixels:new e.aR(t,n.u_tile_units_to_pixels)}),terrain:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_texture:new e.aS(t,n.u_texture),u_ele_delta:new e.aR(t,n.u_ele_delta)}),terrainDepth:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_ele_delta:new e.aR(t,n.u_ele_delta)}),terrainCoords:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_texture:new e.aS(t,n.u_texture),u_terrain_coords_id:new e.aR(t,n.u_terrain_coords_id),u_ele_delta:new e.aR(t,n.u_ele_delta)}),meshBatch:sr,meshBatchTexture:ur,shadowedMeshBatch:dr,shadowedMeshBatchTexture:fr,meshObject:sr,meshObjectTexture:ur,shadowedMeshObject:dr,shadowedMeshObjectTexture:fr,meshShadowMap:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix)}),shadowReceiverPlane:(t,n)=>({u_matrix:new e.aT(t,n.u_matrix),u_light_matrix:new e.aT(t,n.u_light_matrix),u_shadow_map:new e.aS(t,n.u_shadow_map),u_shadow_map_size:new e.aW(t,n.u_shadow_map_size),u_shadow_bias:new e.aR(t,n.u_shadow_bias),u_shadow_intensity:new e.aR(t,n.u_shadow_intensity)})};class Sr{constructor(e,t,n){this.context=e;let r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=!!n,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw Error(`Attempted to update data while not in dynamic mode.`);this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let Cr={Int8:`BYTE`,Uint8:`UNSIGNED_BYTE`,Int16:`SHORT`,Uint16:`UNSIGNED_SHORT`,Int32:`INT`,Uint32:`UNSIGNED_INT`,Float32:`FLOAT`};class wr{constructor(e,t,n,r){this.length=t.length,this.attributes=n,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;let i=e.gl;this.buffer=i.createBuffer(),e.bindVertexBuffer.set(this.buffer),i.bufferData(i.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||t.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let n=0;n0){let n=e.ap(),r=v;e.a_(n,_.placementInvProjMatrix,t.transform.glCoordMatrix),e.a_(n,n,_.placementViewportMatrix),d.push({circleArray:b,circleOffset:p,transform:r,invTransform:n,coord:h}),f+=b.length/4,p=f}y&&u.draw(c,l.LINES,Q.disabled,li.disabled,t.colorModeForRenderPass(),$.disabled,Bn(v,t.transform,g),t.style.map.terrain&&t.style.map.terrain.getTerrainData(h),r.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,null,t.transform.zoom,null,null,y.collisionVertexBuffer)}if(!s||!d.length)return;let m=t.useProgram(`collisionCircle`),h=new e.a$;h.resize(4*f),h._trim();let g=0;for(let e of d)for(let t=0;t=0&&(h[g.associatedIconIndex]={shiftedAnchor:E,angle:D})}else lt(g.numGlyphs,p)}if(u){m.clear();let n=t.icon.placedSymbolArray;for(let t=0;tt.style.map.terrain.getElevation(c,e,n):null;nt(l,c.posMatrix,t,a,ae,oe,v,u,e)}let le=t.translatePosMatrix(c.posMatrix,i,o,s),ue=y||a&&w||ce?fi:ae,de=t.translatePosMatrix(oe,i,o,s,!0),fe=m&&r.paint.get(a?`text-halo-width`:`icon-halo-width`).constantOr(1)!==0,M;M=m?l.iconsInText?ir(C.kind,O,b,v,t,le,ue,de,A,ne,p):rr(C.kind,O,b,v,t,le,ue,de,a,A,0,p):nr(C.kind,O,b,v,t,le,ue,de,a,A,p);let N={program:D,buffers:d,uniformValues:M,atlasTexture:j,atlasTextureIcon:re,atlasInterpolation:ee,atlasInterpolationIcon:te,isSDF:m,hasHalo:fe};if(x&&l.canOverlap){S=!0;let t=d.segments.get();for(let n of t)T.push({segments:new e.S([n]),sortKey:n.sortKey,state:N,terrainData:k})}else T.push({segments:d.segments,sortKey:0,state:N,terrainData:k})}S&&T.sort((e,t)=>e.sortKey-t.sortKey);for(let e of T){let n=e.state;if(m.activeTexture.set(h.TEXTURE0),n.atlasTexture.bind(n.atlasInterpolation,h.CLAMP_TO_EDGE),n.atlasTextureIcon&&(m.activeTexture.set(h.TEXTURE1),n.atlasTextureIcon&&n.atlasTextureIcon.bind(n.atlasInterpolationIcon,h.CLAMP_TO_EDGE)),n.isSDF){let i=n.uniformValues;n.hasHalo&&(i.u_is_halo=1,_i(n.buffers,e.segments,r,t,n.program,C,d,f,i,e.terrainData)),i.u_is_halo=0}_i(n.buffers,e.segments,r,t,n.program,C,d,f,n.uniformValues,e.terrainData)}}function _i(e,t,n,r,i,a,o,s,c,l){let u=r.context;i.draw(u,u.gl.TRIANGLES,a,o,s,$.disabled,c,l,n.id,e.layoutVertexBuffer,e.indexBuffer,t,n.paint,r.transform.zoom,e.programConfigurations.get(n.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function vi(t,n,r,i){let a=t.context,o=a.gl,s=li.disabled,c=new oi([o.ONE,o.ONE],e.aZ.transparent,[!0,!0,!0,!0]),l=n.getBucket(r);if(!l)return;let u=i.key,d=r.heatmapFbos.get(u);d||(d=bi(a,n.tileSize,n.tileSize),r.heatmapFbos.set(u,d)),a.bindFramebuffer.set(d.framebuffer),a.viewport.set([0,0,n.tileSize,n.tileSize]),a.clear({color:e.aZ.transparent});let f=l.programConfigurations.get(r.id),p=t.useProgram(`heatmap`,f),m=t.style.map.terrain.getTerrainData(i);p.draw(a,o.TRIANGLES,Q.disabled,s,c,$.disabled,Wn(i.posMatrix,n,t.transform.zoom,r.paint.get(`heatmap-intensity`)),m,r.id,l.layoutVertexBuffer,l.indexBuffer,l.segments,r.paint,t.transform.zoom,f)}function yi(e,t,n){let r=e.context,i=r.gl;r.setColorMode(e.colorModeForRenderPass());let a=xi(r,t),o=n.key,s=t.heatmapFbos.get(o);s&&(r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,s.colorAttachment.get()),r.activeTexture.set(i.TEXTURE1),a.bind(i.LINEAR,i.CLAMP_TO_EDGE),e.useProgram(`heatmapTexture`).draw(r,i.TRIANGLES,Q.disabled,li.disabled,e.colorModeForRenderPass(),$.disabled,Gn(e,t,0,1),null,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,e.transform.zoom),s.destroy(),t.heatmapFbos.delete(o))}function bi(e,t,n){var r,i;let a=e.gl,o=a.createTexture();a.bindTexture(a.TEXTURE_2D,o),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);let s=(r=e.HALF_FLOAT)==null?a.UNSIGNED_BYTE:r,c=(i=e.RGBA16F)==null?a.RGBA:i;a.texImage2D(a.TEXTURE_2D,0,c,t,n,0,a.RGBA,s,null);let l=e.createFramebuffer(t,n,!1,!1);return l.colorAttachment.set(o),l}function xi(e,t){return t.colorRampTexture||(t.colorRampTexture=new M(e,t.colorRamp,e.gl.RGBA)),t.colorRampTexture}function Si(e,t,n,r,i,a,o){let s=e.context.gl,c=n.paint.get(`fill-pattern`),l=c&&c.constantOr(1),u=n.getCrossfadeParameters(),d,f,p,m,h;o?(f=l&&!n.getPaintProperty(`fill-outline-color`)?`fillOutlinePattern`:`fillOutline`,d=s.LINES):(f=l?`fillPattern`:`fill`,d=s.TRIANGLES);for(let g of r){let r=t.getTile(g);if(l&&!r.patternsLoaded())continue;let _=r.getBucket(n);if(!_)continue;let v=_.programConfigurations.get(n.id),y=e.useProgram(f,v),b=e.style.map.terrain&&e.style.map.terrain.getTerrainData(g);l&&(e.context.activeTexture.set(s.TEXTURE0),r.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),v.updatePaintBuffers(u));let x=c.constantOr(null);if(x&&r.imageAtlas){let e=r.imageAtlas,t=e.patternPositions[x.to.toString()],n=e.patternPositions[x.from.toString()];t&&n&&v.setConstantPatternPositions(t,n)}let S=e.translatePosMatrix(g.posMatrix,r,n.paint.get(`fill-translate`),n.paint.get(`fill-translate-anchor`));if(o){m=_.indexBuffer2,h=_.segments2;let t=[s.drawingBufferWidth,s.drawingBufferHeight];p=f===`fillOutlinePattern`&&l?Rn(S,e,u,r,t):Ln(S,t)}else m=_.indexBuffer,h=_.segments,p=l?In(S,e,u,r):Fn(S);y.draw(e.context,d,i,e.stencilModeForClipping(g),a,$.disabled,p,b,n.id,_.layoutVertexBuffer,m,h,n.paint,e.transform.zoom,v)}}function Ci(e,t,n,r,i,a,o){let s=e.context,c=s.gl,l=n.paint.get(`fill-extrusion-pattern`),u=l.constantOr(1),d=n.getCrossfadeParameters(),f=n.paint.get(`fill-extrusion-opacity`),p=!!n._transitionablePaint.getValue(`fill-extrusion-gradation-top-color`)||!!n._transitionablePaint.getValue(`fill-extrusion-gradation-bottom-color`);for(let m of r){let r=t.getTile(m),h=r.getBucket(n);if(!h)continue;let g=h.programConfigurations.get(n.id),_=e.useProgram(u?`fillExtrusionPattern`:p?`fillExtrusionGradation`:`fillExtrusion`,g);u&&(e.context.activeTexture.set(c.TEXTURE0),r.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),g.updatePaintBuffers(d));let v=l.constantOr(null);if(v&&r.imageAtlas){let e=r.imageAtlas,t=e.patternPositions[v.to.toString()],n=e.patternPositions[v.from.toString()];t&&n&&g.setConstantPatternPositions(t,n)}let y=e.translatePosMatrix(m.posMatrix,r,n.paint.get(`fill-extrusion-translate`),n.paint.get(`fill-extrusion-translate-anchor`)),b=n.paint.get(`fill-extrusion-vertical-gradient`),x=u?Pn(y,e,b,f,m,d,r):p?Nn(y,f):Mn(y,e,b,f),S=e.style.map.terrain&&e.style.map.terrain.getTerrainData(m);_.draw(s,s.gl.TRIANGLES,i,a,o,$.backCCW,x,S,n.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,n.paint,e.transform.zoom,g,e.style.map.terrain&&h.centroidVertexBuffer)}}function wi(e,t,n,r,i,a,o){let s=e.context,c=s.gl,l=n.fbo;if(!l)return;let u=e.useProgram(`hillshade`),d=e.style.map.terrain&&e.style.map.terrain.getTerrainData(t);s.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,l.colorAttachment.get());let f=((e,t,n,r)=>{let i=n.paint.get(`hillshade-shadow-color`),a=n.paint.get(`hillshade-highlight-color`),o=n.paint.get(`hillshade-accent-color`),s=n.paint.get(`hillshade-illumination-direction`)*(Math.PI/180);n.paint.get(`hillshade-illumination-anchor`)===`viewport`&&(s-=e.transform.angle);let c=!e.options.moving;return{u_matrix:r?r.posMatrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped(),c),u_image:0,u_latrange:Kn(0,t.tileID),u_light:[n.paint.get(`hillshade-exaggeration`),s],u_shadow:i,u_highlight:a,u_accent:o}})(e,n,r,d?t:null);u.draw(s,c.TRIANGLES,i,a,o,$.disabled,f,d,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}function Ti(t,n,r,i,a,o){let s=t.context,c=s.gl,l=n.dem;if(l&&l.data){let u=l.dim,d=l.stride,f=l.getPixels();if(s.activeTexture.set(c.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||t.getTileTexture(d),n.demTexture){let e=n.demTexture;e.update(f,{premultiply:!1}),e.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else n.demTexture=new M(s,f,c.RGBA,{premultiply:!1}),n.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);s.activeTexture.set(c.TEXTURE0);let p=n.fbo;if(!p){let e=new M(s,{width:u,height:u,data:null},c.RGBA);e.bind(c.LINEAR,c.CLAMP_TO_EDGE),p=n.fbo=s.createFramebuffer(u,u,!0,!1),p.colorAttachment.set(e.texture)}s.bindFramebuffer.set(p.framebuffer),s.viewport.set([0,0,u,u]),t.useProgram(`hillshadePrepare`).draw(s,c.TRIANGLES,i,a,o,$.disabled,((t,n)=>{let r=n.stride,i=e.ap();return e.aY(i,0,e.a2,-e.a2,0,0,1),e.aa(i,i,[0,-e.a2,0]),{u_matrix:i,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ,u_unpack:n.getUnpackVector()}})(n.tileID,l),null,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),n.needsHillshadePrepare=!1}}function Ei(t,n,r,i,a,o,s){if(!s&&t>0){let a=e.k.now(),s=(a-n.timeAdded)/t,c=r?(a-r.timeAdded)/t:-1,l=i.getSource(),u=o.coveringZoomLevel({tileSize:l.tileSize,roundZoom:l.roundZoom}),d=!r||Math.abs(r.tileID.overscaledZ-u)>Math.abs(n.tileID.overscaledZ-u),f=d&&n.refreshedUponExpiration?1:e.ao(d?s:1-c,0,1);return n.refreshedUponExpiration&&s>=1&&(n.refreshedUponExpiration=!1),r?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}function Di(t,n){let r=`${t.style.map._getMapId()}-lightness`,i=n<0?new e.aZ(0,0,0,1):new e.aZ(1,1,1,1),a=Math.abs(n);if(a===0)return;let o=t.context,s=o.gl,c=t.transform,l=c.tileSize;if(t.renderPass!==`translucent`)return;let u=li.disabled,d=t.depthModeForSublayer(0,Q.ReadOnly),f=t.colorModeForRenderPass(),p=t.useProgram(`background`),m=c.coveringTiles({tileSize:l});for(let e of m){let n=t.transform.calculatePosMatrix(e.toUnwrapped()),c=ar(n,a,i),l=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);p.draw(o,s.TRIANGLES,d,u,f,$.disabled,c,l,r,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}}let Oi=new e.aZ(1,0,0,1),ki=new e.aZ(0,1,0,1),Ai=new e.aZ(0,0,1,1),ji=new e.aZ(1,0,1,1),Mi=new e.aZ(0,1,1,1);function Ni(e,t,n,r){Fi(e,0,t+n/2,e.transform.width,n,r)}function Pi(e,t,n,r){Fi(e,t-n/2,0,n,e.transform.height,r)}function Fi(e,t,n,r,i,a){let o=e.context,s=e.pixelRatio,c=o.gl;c.enable(c.SCISSOR_TEST),c.scissor(t*s,n*s,r*s,i*s),o.clear({color:a}),c.disable(c.SCISSOR_TEST)}function Ii(t,n,r,i){let a=t.context,o=a.gl,s=r.posMatrix,c=t.useProgram(`debug`),l=Q.disabled,u=li.disabled,d=t.colorModeForRenderPass(),f=`$debug`,p=t.style.map.terrain&&t.style.map.terrain.getTerrainData(r);a.activeTexture.set(o.TEXTURE0);let m=i?i[0].tile.tileSize:n?n.getTile(r).tileSize:512,h=512/Math.min(m,512)*(r.overscaledZ/t.transform.zoom)*.5,g=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(g+=` => ${r.overscaledZ}`);let _=``;if(i){let e=Date.now(),n=``,r=0;for(let{sourceId:t,type:a,tile:o}of i){if(a!==`vector`)continue;let{dynamicProperty:i,latestRawTileData:s}=o,c=zi(new Date(e-o.timeAdded)),l=s&&s.byteLength?s.byteLength:0;if(r+=l,n+=`${t}<${a}> [loaded=${c}, size=${Ri(l)}]\n`,i){let{version:e,properties:t}=i,a=JSON.stringify(t).length;r+=a,n+=`DP [version=${e||0}, size=${Ri(a)}, count=${t.length}]\n`}}_=`${g}, total size=${Ri(r)}\n`,_+=n,Li(t,_,20,!1)}else if(n){let e=n.getTileByID(r.key).latestRawTileData;_=`${g} ${Math.floor((e&&e.byteLength||0)/1024)}kb`,Li(t,_,36,!0)}c.draw(a,o.TRIANGLES,l,u,oi.alphaBlended,$.disabled,Hn(s,e.aZ.transparent,h),null,f,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),c.draw(a,o.LINE_STRIP,l,u,d,$.disabled,Hn(s,e.aZ.red),p,f,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function Li(e,t,n,r){e.initDebugOverlayCanvas();let i=e.debugOverlayCanvas,a=e.context.gl,o=i.getContext(`2d`),s=`bold ${n}px Open Sans, sans-serif`,c=n+6,l=t.split(` `).filter(e=>e);o.font=s;let u=function(e,t,n,r,i){let a=e.reduce((e,t)=>Math.max(e,t),0),o=Math.ceil(a)+2*n;return Math.max(i,o,r+e.length*t)}(l.map(e=>o.measureText(e).width),c,5,5,512);i.width===u&&i.height===u||(i.width=u,i.height=u),o.clearRect(0,0,i.width,i.height),r&&(o.shadowColor=`white`,o.shadowBlur=2,o.lineWidth=1.5,o.strokeStyle=`white`),o.textBaseline=`top`,o.font=s;let d=5;for(let e of l)o.fillText(e,5,d),r&&o.strokeText(e,5,d),d+=c;e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}function Ri(e){let t=1048576,n=1073741824;return e<1024?`${e} b`:ee!==m[0]))for(let _=0;_=p.length||(t.activeTexture.set(n.TEXTURE0),p[v].bind(n.LINEAR,n.CLAMP_TO_EDGE),r.draw(t,n.TRIANGLES,o,s,c,$.backCCW,i,l,u,h,a.indexBuffer,new e.S([g[_]]),f,d))}else m[0]>=0&&m[0]n.style.map.terrain.getElevation(a,e,t):null)}}}(i,t,r,n,r.layout.get(`text-rotation-alignment`),r.layout.get(`text-pitch-alignment`),a),r.paint.get(`icon-opacity`).constantOr(1)!==0&&gi(t,n,r,i,!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`),s,c,o),r.paint.get(`text-opacity`).constantOr(1)!==0&&gi(t,n,r,i,!0,r.paint.get(`text-translate`),r.paint.get(`text-translate-anchor`),r.layout.get(`text-rotation-alignment`),r.layout.get(`text-pitch-alignment`),r.layout.get(`text-keep-upright`),s,c,o),n.map.showCollisionBoxes&&(di(t,n,r,i,r.paint.get(`text-translate`),r.paint.get(`text-translate-anchor`),!0),di(t,n,r,i,r.paint.get(`icon-translate`),r.paint.get(`icon-translate-anchor`),!1))},circle:function(t,n,r,i){if(t.renderPass!==`translucent`)return;let a=r.paint.get(`circle-opacity`),o=r.paint.get(`circle-stroke-width`),s=r.paint.get(`circle-stroke-opacity`),c=!r.layout.get(`circle-sort-key`).isConstant();if(a.constantOr(1)===0&&(o.constantOr(1)===0||s.constantOr(1)===0))return;let l=t.context,u=l.gl,d=t.depthModeForSublayer(0,Q.ReadOnly),f=li.disabled,p=t.colorModeForRenderPass(),m=[];for(let a=0;ae.sortKey-t.sortKey);for(let e of m){let{programConfiguration:n,program:i,layoutVertexBuffer:a,indexBuffer:o,uniformValues:s,terrainData:c}=e.state;i.draw(l,u.TRIANGLES,d,f,p,$.disabled,s,c,r.id,a,o,e.segments,r.paint,t.transform.zoom,n)}},heatmap:function(t,n,r,i){if(r.paint.get(`heatmap-opacity`)===0)return;let a=t.context;if(t.style.map.terrain){for(let e of i){let i=n.getTile(e);n.hasRenderableParent(e)||(t.renderPass===`offscreen`?vi(t,i,r,e):t.renderPass===`translucent`&&yi(t,r,e))}a.viewport.set([0,0,t.width,t.height])}else t.renderPass===`offscreen`?function(t,n,r,i){let a=t.context,o=a.gl,s=li.disabled,c=new oi([o.ONE,o.ONE],e.aZ.transparent,[!0,!0,!0,!0]);(function(t,n,r){let i=t.gl;t.activeTexture.set(i.TEXTURE1),t.viewport.set([0,0,n.width/4,n.height/4]);let a=r.heatmapFbos.get(e.b2);a?(i.bindTexture(i.TEXTURE_2D,a.colorAttachment.get()),t.bindFramebuffer.set(a.framebuffer)):(a=bi(t,n.width/4,n.height/4),r.heatmapFbos.set(e.b2,a))})(a,t,r),a.clear({color:e.aZ.transparent});for(let e=0;e256&&this.clearStencil(),n.setColorMode(oi.disabled),n.setDepthMode(Q.disabled);let i=this.useProgram(`clippingMask`);this._tileClippingMaskIDs={};for(let e of t){let t=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,a=this.style.map.terrain&&this.style.map.terrain.getTerrainData(e);i.draw(n,r.TRIANGLES,Q.disabled,new li({func:r.ALWAYS,mask:0},t,255,r.KEEP,r.KEEP,r.REPLACE),oi.disabled,$.disabled,Un(e.posMatrix),a,`$clipping`,this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new li({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new li({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){let t=this.context.gl,n=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),r=n[n.length-1].overscaledZ,i=n[0].overscaledZ-r+1;if(i>1){this.currentStencilSource=void 0,this.nextStencilID+i>256&&this.clearStencil();let e={};for(let n=0;n=0;this.currentLayer--){let e=this.style._layers[r[this.currentLayer]],t=i[e.source],o=a[e.source];this._renderTileClippingMasks(e,o),this.renderLayer(this,t,e,o),c===null&&Xi(e,n.lightness)&&(c=this.currentLayer)}this.renderPass=`translucent`;let l=!!this.getShadowMapTexture(),u=-1,d=!l;if(l){for(let e=r.length-1;e>=0;e--)if(this.style._layers[r[e]].is3D()){u=e;break}}for(this.currentLayer=0;this.currentLayer=u&&(Ji(this,i,o),d=!0),c===this.currentLayer&&Di(this,n.lightness)}if(d||Ji(this,i,o),this.options.showTileBoundaries&&!this.options.showMoreTileInfos){let e=Object.values(this.style._layers),t=this._extractSelectedSource(e);t&&Zi.debug(this,t,t.getVisibleCoordinates())}if(this.options.showMoreTileInfos){let e=Object.values(this.style._layers);(function(e,t){let n=Object.values(t);for(let t=0;t0),a&&(e.b9(this.terrainFacilitator.matrix,i),this.terrainFacilitator.renderTime=e.k.now(),this.terrainFacilitator.dirty=!1,function(t,n){let r=t.context,i=r.gl,a=e.k.devicePixelRatio,o=t.transform,s=new Q(i.LEQUAL,Q.ReadWrite,[0,1]),c=n.getTerrainMesh(),l=n.sourceCache.getRenderableTiles(),u=t.useProgram(`terrainDepth`);r.bindFramebuffer.set(n.getFramebuffer(`depth`).framebuffer),r.viewport.set([0,0,t.width/a,t.height/a]),r.clear({color:e.aZ.transparent,depth:1});for(let e of l){let t=e.tileID,a=n.getTerrainData(t),l=o.calculatePosMatrix(t.toUnwrapped()),d=En(l,n.getMeshFrameDelta(o.zoom));u.draw(r,i.TRIANGLES,s,li.disabled,oi.unblended,$.backCCW,d,a,`terrain`,c.vertexBuffer,c.indexBuffer,c.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}(this,n),function(t,n){let r=t.context,i=r.gl,a=e.k.devicePixelRatio,o=t.transform,s=new Q(i.LEQUAL,Q.ReadWrite,[0,1]),c=n.getTerrainMesh(),l=n.getCoordsTexture(),u=n.sourceCache.getRenderableTiles(),d=t.useProgram(`terrainCoords`);r.bindFramebuffer.set(n.getFramebuffer(`coords`).framebuffer),r.viewport.set([0,0,t.width/a,t.height/a]),r.clear({color:e.aZ.transparent,depth:1}),n.coordsIndex=[];for(let e of u){let t=e.tileID,a=n.getTerrainData(t);r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,l.texture);let u=o.calculatePosMatrix(t.toUnwrapped()),f=Dn(u,255-n.coordsIndex.length,n.getMeshFrameDelta(o.zoom));d.draw(r,i.TRIANGLES,s,li.disabled,oi.unblended,$.backCCW,f,a,`terrain`,c.vertexBuffer,c.indexBuffer,c.segments),n.coordsIndex.push(t.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}(this,n))}gpuTimingStart(e){if(!this.options.gpuTiming)return;let t=this.context.extTimerQuery,n=this.gpuTimers[e.id];n||(n=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:t.createQueryEXT()}),n.calls++,t.beginQueryEXT(t.TIME_ELAPSED_EXT,n.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;let e=this.context.extTimerQuery;e.endQueryEXT(e.TIME_ELAPSED_EXT)}collectGpuTimers(){let e=this.gpuTimers;return this.gpuTimers={},e}queryGpuTimers(e){let t={};for(let n in e){let r=e[n],i=this.context.extTimerQuery,a=i.getQueryObjectEXT(r.query,i.QUERY_RESULT_EXT)/1e6;i.deleteQueryEXT(r.query),t[n]=a}return t}translatePosMatrix(t,n,r,i,a){if(!r[0]&&!r[1])return t;let o=a?i===`map`?this.transform.angle:0:i===`viewport`?-this.transform.angle:0;if(o){let e=Math.sin(o),t=Math.cos(o);r=[r[0]*t-r[1]*e,r[0]*e+r[1]*t]}let s=ce(a?r[0]:ft(n,r[0],this.transform.zoom),a?r[1]:ft(n,r[1],this.transform.zoom),0),c=new Float32Array(16);return e.aa(c,t,s),c}saveTileTexture(e){let t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.imageManager.getPattern(e.from.toString()),n=this.imageManager.getPattern(e.to.toString());return!t||!n}useProgram(e,t){this.cache=this.cache||{};let n=e+(t?t.cacheKey:``)+(this._showOverdrawInspector?`/overdraw`:``)+(this.style.map.terrain?`/terrain`:``);return this.cache[n]||(this.cache[n]=new An(this.context,e,wn[e],t,q[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[n]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}getShadowMapTexture(){return this._shadowMapFramebuffer?this._shadowMapFramebuffer.depthTexture:null}_prepareShadowMap(){this._shadowMapFramebuffer||(this._shadowMapFramebuffer=new ai(this.context,Bi));let t=this.style.light,n=t.properties.get(`position`),r=ce(n.x,n.y,n.z);if(t.properties.get(`anchor`)===`viewport`){let t=e.ap();e.aq(t,t,-this.transform.angle),function(e,t,n){var r=t[0],i=t[1],a=t[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];e[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/(o=o||1),e[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,e[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o}(r,r,t)}let i=le([],r),a=1/this.transform.pixelPerMeter,o=this.transform._fov,s=this.transform.width/this.transform.height,c=this.transform.nearZ,l=this.transform.farZ,u=Math.sqrt(1+s*s)*Math.tan(.5*o),d=u*u,f;f=d>=(l-c)/(l+c)?l*u:.5*Math.sqrt((l-c)*(l-c)+2*(l*l+c*c)*d+(l+c)*(l+c)*d*d);let p=Math.max(f*a,1e3),m=ce(0,0,0),h=ce(0,0,1),g=function(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}([],m,i,p),_=new Float64Array(16),v=new Float64Array(16),y=new Float64Array(16);e.ba(_,g,m,h),e.aY(v,-p,p,-p,p,.1,4*p),e.ac(y,v,_);let b=this.transform.point.x,x=this.transform.point.y,S=e.a9(new Float64Array(16));e.ab(S,S,[a,-a,1]),e.aa(S,S,[-b,-x,0]),e.ac(this.lightModelViewProjectionMatrix,y,S)}_renderShadowMap(e,t,n){if(!e.some(e=>{let t=this.style._layers[e];return t.type===`mesh-object`?t.paint.get(`mesh-object-cast-shadows`):t.type===`mesh-batch`&&t.paint.get(`mesh-batch-cast-shadows`)}))return;this._prepareShadowMap();let r=this.context;r.bindFramebuffer.set(this._shadowMapFramebuffer.framebuffer),r.viewport.set([0,0,Bi,Bi]),r.clear({depth:1});for(let r of e){let e=this.style._layers[r];if(e.isHidden(this.transform.zoom))continue;let i=t[e.source],a=n[e.source];i&&a&&a.length&&(e.type===`mesh-object`&&e.paint.get(`mesh-object-cast-shadows`)?Ui(this,i,e,a):e.type===`mesh-batch`&&e.paint.get(`mesh-batch-cast-shadows`)&&Ki(this,i,e,a))}r.bindFramebuffer.set(null),r.viewport.set([0,0,this.width,this.height])}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement(`canvas`),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new M(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._shadowMapFramebuffer&&(this._shadowMapFramebuffer.destroy(),this._shadowMapFramebuffer=null)}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}_extractSelectedSource(e){let t,n;return e.forEach(e=>{e.source&&!e.isHidden(this.transform.zoom)&&(e.source!==(n&&n.id)&&(n=this.style.sourceCaches[e.source]),(!t||t.getSource().maxzoom{if(e.source&&!e.isHidden(this.transform.zoom)){let r=this.style.sourceCaches[e.source],i=r.id;n[i]||(n[i]=!0,t.push(r))}}),t.forEach(e=>{let{type:t,tileSize:n}=e.getSource();a||(a=t===`raster`),i{let{type:t}=e.getSource();e.getVisibleCoordinates().forEach(n=>{let o=e.getTile(n);if(n.canonical.zMath.floor(this.transform.zoom)&&(!a||o.tileSize{let a=1/(r=e.as([],r,t))[3]/n*i;return e.bb(r,r,[a,a,1/r[3],a])}),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(e=>{let t=le([],function(e,t,n){var r=t[0],i=t[1],a=t[2],o=n[0],s=n[1],c=n[2];return e[0]=i*c-a*s,e[1]=a*o-r*c,e[2]=r*s-i*o,e}([],de([],a[e[0]],a[e[1]]),de([],a[e[2]],a[e[1]]))),n=-((r=t)[0]*(i=a[e[1]])[0]+r[1]*i[1]+r[2]*i[2]);var r,i;return t.concat(n)});return new ea(a,o)}}class ta{constructor(e,t){this.min=e,this.max=t,this.center=function(e,t){return e[0]=.5*t[0],e[1]=.5*t[1],e[2]=.5*t[2],e}([],function(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}([],this.min,this.max))}quadrant(e){let t=[e%2==0,e<2],n=se(this.min),r=se(this.max);for(let e=0;e=0&&o++;if(o===0)return 0;o!==n.length&&(r=!1)}if(r)return 2;for(let e=0;e<3;e++){let n=Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let i=0;ithis.max[e]-this.min[e])return 0}return 1}}class na{constructor(e=0,t=0,n=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(n)||n<0||isNaN(r)||r<0)throw Error(`Invalid value for edge-insets, top, bottom, left and right must all be numbers`);this.top=e,this.bottom=t,this.left=n,this.right=r}interpolate(t,n,r){return n.top!=null&&t.top!=null&&(this.top=e.L(t.top,n.top,r)),n.bottom!=null&&t.bottom!=null&&(this.bottom=e.L(t.bottom,n.bottom,r)),n.left!=null&&t.left!=null&&(this.left=e.L(t.left,n.left,r)),n.right!=null&&t.right!=null&&(this.right=e.L(t.right,n.right,r)),this}getCenter(t,n){let r=e.ao((this.left+t-this.right)/2,0,t),i=e.ao((this.top+n-this.bottom)/2,0,n);return new e.P(r,i)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new na(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ra{constructor(t,n,r,i,a){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=a===void 0||!!a,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=r==null?0:r,this._maxPitch=i==null?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new e.Y(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new na,this._posMatrixCache={},this._alignedPosMatrixCache={},this._elevation=0,this.minElevationForCurrentTile=0}clone(){let e=new ra(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.lngRange=e.lngRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.minElevationForCurrentTile=e.minElevationForCurrentTile,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}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.angle/Math.PI*180}set bearing(t){let n=-e.bd(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var t=new e.A(4);return e.A!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}(),function(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(n),c=Math.cos(n);e[0]=r*c+a*s,e[1]=i*c+o*s,e[2]=r*-s+a*c,e[3]=i*-s+o*c}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){let n=e.ao(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){let t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.max(0,Math.floor(t)),this.zoomFraction=t-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get pixelPerMeter(){return this._pixelPerMeter}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,n){this._unmodified=!1,this._edgeInsets.interpolate(e,t,n),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let t=(e.roundZoom?Math.round:Math.floor)((e.upscalingZoom===void 0?this.zoom:this.zoom+e.upscalingZoom)+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}getVisibleUnwrappedCoordinates(t){let n=[new e.be(0,t)];if(this._renderWorldCopies){let r=this.pointCoordinate(new e.P(0,0)),i=this.pointCoordinate(new e.P(this.width,0)),a=this.pointCoordinate(new e.P(this.width,this.height)),o=this.pointCoordinate(new e.P(0,this.height)),s=Math.floor(Math.min(r.x,i.x,a.x,o.x)),c=Math.floor(Math.max(r.x,i.x,a.x,o.x));for(let r=s-1;r<=c+1;r++)r!==0&&n.push(new e.be(r,t))}return n}coveringTiles(t){var n,r;let i=this.coveringZoomLevel(t),a=i;if(t.minzoom!==void 0&&it.maxzoom&&(i=t.maxzoom);let o=this.pointCoordinate(this.getCameraPoint()),s=e.a4.fromLngLat(this.center),c=2**i,l=[c*o.x,c*o.y,0],u=[c*s.x,c*s.y,0],d=ea.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,i),f=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(f=i);let p=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,m=e=>({aabb:new ta([e*c,0,0],[(e+1)*c,c,0]),zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),h=[],g=[],_=i,v=t.reparseOverscaled?a:i;if(this._renderWorldCopies)for(let e=1;e<=3;e++)h.push(m(-e)),h.push(m(e));for(h.push(m(0));h.length>0;){let i=h.pop(),a=i.x,o=i.y,s=i.fullyVisible;if(!s){let e=i.aabb.intersects(d);if(e===0)continue;s=e===2}let c=t.terrain?l:u,m=i.aabb.distanceX(c),y=i.aabb.distanceY(c),b=Math.max(Math.abs(m),Math.abs(y));if(i.zoom===_||b>p+(1<<_-i.zoom)-2&&i.zoom>=f){let t=_-i.zoom,n=l[0]-.5-(a<>1),d=i.zoom+1,f=i.aabb.quadrant(c);if(t.terrain){let a=new e.a1(d,i.wrap,d,l,u),o=t.terrain.getMinMaxElevation(a),s=(n=o.minElevation)==null?this.elevation:n,c=(r=o.maxElevation)==null?this.elevation:r;f=new ta([f.min[0],f.min[1],s],[f.max[0],f.max[1],c])}h.push({aabb:f,zoom:d,x:l,y:u,wrap:i.wrap,fullyVisible:s})}}return g.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return 2**e}scaleZoom(e){return Math.log(e)/Math.LN2}project(t){let n=e.ao(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new e.P(e._(t.lng)*this.worldSize,e.Z(n)*this.worldSize)}unproject(t){return new e.a4(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoomAndCenter(t){let n=this.screenPointToLocation(this.centerPoint,t),r=t?t.getElevationForLngLatZoom(n,this.tileZoom):0;if(this.elevation-r===0)return;let i=e.bf(1,this.center.lat)*this.worldSize,a=this.cameraToCenterDistance/i,o=e.a4.fromLngLat(this.center,this.elevation),s=this.cameraCoordinateFromCenterAndRotation(this.center,this.elevation,this.pitch,this.bearing,a);this._elevation=r;let c=this.calculateCenterFromCameraLngLatAlt(s.toLngLat(),e.bg(s.z,o.y),this.bearing,this.pitch);this._elevation=c.elevation,this._center=c.center,this.zoom=c.zoom}calculateCenterFromCameraLngLatAlt(t,n,r,i){let a=r===void 0?this.bearing:r,o=i=i===void 0?this.pitch:i,s=e.a4.fromLngLat(t,n),c=-Math.cos(e.bh(o)),l=Math.sin(e.bh(o)),u=l*Math.sin(e.bh(a)),d=-l*Math.cos(e.bh(a)),f=this.elevation,p=n-f,m;c*p>=0||Math.abs(c)<.1?(m=1e4,f=n+m*c):m=-p/c;let h,g,_=e.bg(1,s.y),v=0;do{if(v+=1,v>10)break;g=m/_,h=new e.a4(s.x+u*g,s.y+d*g),_=1/h.meterInMercatorCoordinateUnits()}while(Math.abs(m-g*_)>1e-12);let y=h.toLngLat(),b=e.bh(this.fov);return{center:y,elevation:f,zoom:this.scaleZoom(this.height/2/Math.tan(b/2)/g/this.tileSize)}}setLocationAtPoint(t,n){let r=this.pointCoordinate(n),i=this.pointCoordinate(this.centerPoint),a=this.locationCoordinate(t),o=new e.a4(a.x-(r.x-i.x),a.y-(r.y-i.y));this.center=this.coordinateLocation(o),this._renderWorldCopies&&(this.center=this.center.wrap())}screenPointToLocation(e,t){var n;return(n=this.pointCoordinate(e,t))==null?void 0:n.toLngLat()}locationPoint(e,t){return t?this.coordinatePoint(this.locationCoordinate(e),t.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,t){return this.coordinateLocation(this.pointCoordinate(e,t))}locationCoordinate(t){return e.a4.fromLngLat(t)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(t,n){if(n){let e=n.pointCoordinate(t);if(e!=null)return e}let r=[t.x,t.y,0,1],i=[t.x,t.y,1,1];e.as(r,r,this.pixelMatrixInverse),e.as(i,i,this.pixelMatrixInverse);let a=r[3],o=i[3],s=r[1]/a,c=i[1]/o,l=r[2]/a,u=i[2]/o,d=l===u?0:(0-l)/(u-l);return new e.a4(e.L(r[0]/a,i[0]/o,d)/this.worldSize,e.L(s,c,d)/this.worldSize)}coordinatePoint(t,n=0,r=this.pixelMatrix){let i=[t.x*this.worldSize,t.y*this.worldSize,n,1];return e.as(i,i,r),new e.P(i[0]/i[3],i[1]/i[3])}getBounds(){let t=Math.max(0,this.height/2-this.getHorizon());return new ve().extend(this.pointLocation(new e.P(0,t))).extend(this.pointLocation(new e.P(this.width,t))).extend(this.pointLocation(new e.P(this.width,this.height))).extend(this.pointLocation(new e.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ve([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}cameraCoordinateFromCenterAndRotation(t,n,r,i,a){let o=e.a4.fromLngLat(t,n),s=a*e.bf(1,t.lat),c=s*Math.cos(e.bh(r)),l=Math.sqrt(s*s-c*c),u=l*Math.sin(e.bh(-i)),d=l*Math.cos(e.bh(-i));return new e.a4(o.x+u,o.y+d,o.z+c)}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){let r=t.key,i=n?this._alignedPosMatrixCache:this._posMatrixCache;if(i[r])return i[r];let a=t.canonical,o=this.worldSize/this.zoomScale(a.z),s=a.x+2**a.z*t.wrap,c=e.a9(new Float64Array(16));return e.aa(c,c,[s*o,a.y*o,0]),e.ab(c,c,[o/e.a2,o/e.a2,1]),e.ac(c,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,c),i[r]=new Float32Array(c),i[r]}calculateTileMatrix(t){let n=t.canonical,r=this.worldSize/this.zoomScale(n.z),i=n.x+2**n.z*t.wrap,a=e.ap();return e.aa(a,a,[i*r,n.y*r,0]),e.ab(a,a,[r/e.a2,r/e.a2,1]),a}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,r,i,a=-90,o=90,s=-180,c=180,l=this.size,u=this._unmodified;if(this.latRange){let n=this.latRange;a=e.Z(n[1])*this.worldSize,o=e.Z(n[0])*this.worldSize,t=o-ao&&(i=o-t)}if(this.lngRange){let e=d.x,t=l.x/2;e-tc&&(r=c-t)}r===void 0&&i===void 0||(this.center=this.unproject(new e.P(r===void 0?d.x:r,i===void 0?d.y:i))),this._unmodified=u,this._constraining=!1}_calcMatrices(){if(!this.height)return;let t=this.centerOffset,n=this.point.x,r=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=e.bf(1,this.center.lat)*this.worldSize;let i=e.a9(new Float64Array(16));e.ab(i,i,[this.width/2,-this.height/2,1]),e.aa(i,i,[1,-1,0]),this.labelPlaneMatrix=i,i=e.a9(new Float64Array(16)),e.ab(i,i,[1,-1,1]),e.aa(i,i,[-1,-1,0]),e.ab(i,i,[2/this.width,2/this.height,1]),this.glCoordMatrix=i;let a=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),o=Math.min(this.elevation,this.minElevationForCurrentTile),s=a-o*this._pixelPerMeter/Math.cos(this._pitch),c=o<0?s:a,l=Math.PI/2+this._pitch,u=this._fov*(.5+t.y/this.height),d=Math.sin(u)*c/Math.sin(e.ao(Math.PI-l-u,.01,Math.PI-.01)),f=this.getHorizon(),p=2*Math.atan(f/this.cameraToCenterDistance)*(.5+t.y/(2*f)),m=Math.sin(p)*c/Math.sin(e.ao(Math.PI-l-p,.01,Math.PI-.01)),h=Math.min(d,m);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*h+c),this.nearZ=this.height/50,i=new Float64Array(16),e.bi(i,this._fov,this.width/this.height,this.nearZ,this.farZ),i[8]=2*-t.x/this.width,i[9]=2*t.y/this.height,this.projectionMatrix=e.ar(i),e.ab(i,i,[1,-1,1]),e.aa(i,i,[0,0,-this.cameraToCenterDistance]),e.bj(i,i,this._pitch),e.aq(i,i,this.angle),e.aa(i,i,[-n,-r,0]),this.mercatorMatrix=e.ab([],i,[this.worldSize,this.worldSize,this.worldSize]),e.ab(i,i,[1,1,this._pixelPerMeter]),this.pixelMatrix=e.ac(new Float64Array(16),this.labelPlaneMatrix,i),e.aa(i,i,[0,0,-this.elevation]),this.modelViewProjectionMatrix=i,this.invModelViewProjectionMatrix=e.aB([],i),this.pixelMatrix3D=e.ac(new Float64Array(16),this.labelPlaneMatrix,i);let g=this.width%2/2,_=this.height%2/2,v=Math.cos(this.angle),y=Math.sin(this.angle),b=n-Math.round(n)+v*g+y*_,x=r-Math.round(r)+v*_+y*g,S=new Float64Array(i);if(e.aa(S,S,[b>.5?b-1:b,x>.5?x-1:x,0]),this.alignedModelViewProjectionMatrix=S,i=e.aB(new Float64Array(16),this.pixelMatrix),!i)throw Error(`failed to invert matrix`);this.pixelMatrixInverse=i,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let t=this.pointCoordinate(new e.P(0,0)),n=e.av(t.x*this.worldSize,t.y*this.worldSize,0,1);return e.as(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,t))}getCameraQueryGeometry(t){let n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let r=n.x,i=n.y,a=n.x,o=n.y;for(let e of t)r=Math.min(r,e.x),i=Math.min(i,e.y),a=Math.max(a,e.x),o=Math.max(o,e.y);return[new e.P(r,i),new e.P(a,i),new e.P(a,o),new e.P(r,o),new e.P(r,i)]}}lngLatToCameraDepth(t,n){let r=this.locationCoordinate(t),i=[r.x*this.worldSize,r.y*this.worldSize,n,1];return e.as(i,i,this.modelViewProjectionMatrix),i[2]/i[3]}}class ia{constructor(t){this._hashName=t&&encodeURIComponent(t),e.$([`_getCurrentHash`,`_onHashChange`,`_updateHash`],this),this._updateHash=function(e){let t=!1,n=null,r=()=>{n=null,t&&(e(),n=setTimeout(r,300),t=!1)};return()=>(t=!0,n||r(),n)}(this._updateHashUnthrottled.bind(this))}addTo(e){return this._map=e,window.addEventListener(`hashchange`,this._onHashChange,!1),this._map.on(`moveend`,this._updateHash),this}remove(){return window.removeEventListener(`hashchange`,this._onHashChange,!1),this._map.off(`moveend`,this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(e){let t=this._map.getCenter(),n=Math.round(100*this._map.getZoom())/100,r=10**Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.round(t.lng*r)/r,a=Math.round(t.lat*r)/r,o=this._map.getBearing(),s=this._map.getPitch(),c=``;if(c+=e?`/${i}/${a}/${n}`:`${n}/${a}/${i}`,(o||s)&&(c+=`/`+Math.round(10*o)/10),s&&(c+=`/${Math.round(s)}`),this._hashName){let e=this._hashName,t=!1,n=window.location.hash.slice(1).split(`&`).map(n=>{let r=n.split(`=`)[0];return r===e?(t=!0,`${r}=${c}`):n}).filter(e=>e);return t||n.push(`${e}=${c}`),`#${n.join(`&`)}`}return`#${c}`}_getCurrentHash(){let e=window.location.hash.replace(`#`,``);if(this._hashName){let t;return e.split(`&`).map(e=>e.split(`=`)).forEach(e=>{e[0]===this._hashName&&(t=e)}),(t&&t[1]||``).split(`/`)}return e.split(`/`)}_onHashChange(){let e=this._getCurrentHash();if(e.length>=3&&!e.some(e=>isNaN(e))){let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0}return!1}_updateHashUnthrottled(){let e=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,e)}catch(e){}}}let aa={linearity:.3,easing:e.bk(0,0,.3,1)},oa=e.e({deceleration:2500,maxSpeed:1400},aa),sa=e.e({deceleration:20,maxSpeed:1400},aa),ca=e.e({deceleration:1e3,maxSpeed:360},aa),la=e.e({deceleration:1e3,maxSpeed:90},aa);class ua{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.k.now(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,n=e.k.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(e.k.prefersReducedMotion||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;let n={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of this._inertiaBuffer)n.zoom+=e.zoomDelta||0,n.bearing+=e.bearingDelta||0,n.pitch+=e.pitchDelta||0,e.panDelta&&n.pan._add(e.panDelta),e.around&&(n.around=e.around),e.pinchAround&&(n.pinchAround=e.pinchAround);let r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,i={};if(n.pan.mag()){let a=fa(n.pan.mag(),r,e.e({},oa,t||{}));i.offset=n.pan.mult(a.amount/n.pan.mag()),i.center=this._map.transform.center,da(i,a)}if(n.zoom){let e=fa(n.zoom,r,sa);i.zoom=this._map.transform.zoom+e.amount,da(i,e)}if(n.bearing){let t=fa(n.bearing,r,ca);i.bearing=this._map.transform.bearing+e.ao(t.amount,-179,179),da(i,t)}if(n.pitch){let e=fa(n.pitch,r,la);i.pitch=this._map.transform.pitch+e.amount,da(i,e)}if(i.zoom||i.bearing){let e=n.pinchAround===void 0?n.around:n.pinchAround;i.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),e.e(i,{noMoveStart:!0})}}function da(e,t){(!e.duration||e.durationn.unproject(e)),c=a.reduce((e,t,n,r)=>e.add(t.div(r.length)),new e.P(0,0));super(t,{points:a,point:c,lngLats:o,lngLat:n.unproject(c),originalEvent:r}),this._defaultPrevented=!1}}class ha extends e.o{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,n){super(e,{originalEvent:n}),this._defaultPrevented=!1}}class ga{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new ha(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new pa(e.type,this._map,e))}mouseup(e){this._map.fire(new pa(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new pa(e.type,this._map,e))}dblclick(e){return this._firePreventable(new pa(e.type,this._map,e))}mouseover(e){this._map.fire(new pa(e.type,this._map,e))}mouseout(e){this._map.fire(new pa(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ma(e.type,this._map,e))}touchmove(e){this._map.fire(new ma(e.type,this._map,e))}touchend(e){this._map.fire(new ma(e.type,this._map,e))}touchcancel(e){this._map.fire(new ma(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class _a{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(e){this._map.fire(new pa(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new pa(`contextmenu`,this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new pa(e.type,this._map,e)),this._map.listens(`contextmenu`)&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class va{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(s.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let n=t;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)e.fitScreenCoordinates(r,i,this._map.getBearing(),{linear:!0})};this._fireEvent(`boxzoomcancel`,t)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent(`boxzoomcancel`,e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove(`mapboxgl-crosshair`),this._box&&(s.remove(this._box),this._box=null),s.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new e.o(t,{originalEvent:n}))}}function ya(e,t){let n={};for(let r=0;rthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=function(t){let n=new e.P(0,0);for(let e of t)n._add(e);return n.div(t.length)}(n),this.touches=ya(r,n)))}touchmove(e,t,n){if(this.aborted||!this.centroid)return;let r=ya(n,t);for(let e in this.touches){let t=r[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,n){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),n.length===0){let e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class xa{constructor(e){this.singleTap=new ba(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,n){this.singleTap.touchstart(e,t,n)}touchmove(e,t,n){this.singleTap.touchmove(e,t,n)}touchend(e,t,n){let r=this.singleTap.touchend(e,t,n);if(r){let t=e.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(r)<30;if(t&&n||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class Sa{constructor(){this._zoomIn=new xa({numTouches:1,numTaps:2}),this._zoomOut=new xa({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,n){this._zoomIn.touchstart(e,t,n),this._zoomOut.touchstart(e,t,n)}touchmove(e,t,n){this._zoomIn.touchmove(e,t,n),this._zoomOut.touchmove(e,t,n)}touchend(e,t,n){let r=this._zoomIn.touchend(e,t,n),i=this._zoomOut.touchend(e,t,n);return r?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(r)},{originalEvent:e})}):i?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(i)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let Ca={0:1,2:2};class wa{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(e,t){return!1}_move(e,t){return{}}mousedown(e,t){if(this._lastPoint)return;let n=s.mouseButton(e);this._correctButton(e,n)&&(this._lastPoint=t,this._eventButton=n)}mousemoveWindow(e,t){let n=this._lastPoint;if(n){if(e.preventDefault(),function(e,t){let n=Ca[t];return e.buttons===void 0||(e.buttons&n)!==n}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(n)0&&(this._active=!0);let i=ya(r,n),a=new e.P(0,0),o=new e.P(0,0),s=0;for(let e in i){let t=i[e],n=this._touches[e];n&&(a._add(t),o._add(t.sub(n)),s++,i[e]=t)}if(this._touches=i,sMath.abs(e.x)}class Ia extends ka{reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(e){this._lastPoints=e,Fa(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,n){let r=e[0].sub(this._lastPoints[0]),i=e[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(r,i,n.timeStamp),this._valid)return this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+i.y)/2*-.5}}gestureBeginsVertically(e,t,n){if(this._valid!==void 0)return this._valid;let r=e.mag()>=2,i=t.mag()>=2;if(!r&&!i)return;if(!r||!i)return this._firstMove===void 0&&(this._firstMove=n),n-this._firstMove<100&&void 0;let a=e.y>0==t.y>0;return Fa(e)&&Fa(t)&&a}}let La={panStep:100,bearingStep:15,pitchStep:10};class Ra{constructor(){let e=La;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,n=0,r=0,i=0,a=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?n=-1:(e.preventDefault(),i=-1);break;case 39:e.shiftKey?n=1:(e.preventDefault(),i=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),a=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(n=0,r=0),{cameraAnimation:o=>{let s=o.getZoom();o.easeTo({duration:300,easeId:`keyboardHandler`,easing:za,zoom:t?Math.round(s)+t*(e.shiftKey?2:1):s,bearing:o.getBearing()+n*this._bearingStep,pitch:o.getPitch()+r*this._pitchStep,offset:[-i*this._panStep,-a*this._panStep],center:o.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function za(e){return e*(2-e)}let Ba=4.000244140625;class Va{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,e.$([`_onTimeout`],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}setAroundLngLat(t){this._aroundLngLat=t&&e.Y.convert(t)}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=e&&e.around===`center`)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,r=e.k.now(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,n!==0&&n%Ba==0?this._type=`wheel`:n!==0&&Math.abs(n)<4?this._type=`trackpad`:i>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(i*n)<200?`trackpad`:`wheel`,this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(e){this._type=`wheel`,this._delta-=this._lastValue,this._active||this._start(e)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let n=s.mousePos(this._el,t),r=this._aroundLngLat?this._aroundLngLat:e.Y.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n));this._aroundPoint=this._map.transform.locationPoint(r),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let t=this._map.transform;if(this._delta!==0){let e=this._type===`wheel`&&Math.abs(this._delta)>Ba?this._wheelZoomRate:this._defaultZoomRate,n=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&n!==0&&(n=1/n);let r=typeof this._targetZoom==`number`?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(r*n))),this._type===`wheel`&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let n=typeof this._targetZoom==`number`?this._targetZoom:t.zoom,r=this._startZoom,i=this._easing,a,o=!1;if(this._type===`wheel`&&r&&i){let t=Math.min((e.k.now()-this._lastWheelEventTime)/200,1),s=i(t);a=e.L(r,n,s),t<1?this._frameId||(this._frameId=!0):o=!0}else a=n,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!o,zoomDelta:a-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=e.bl;if(this._prevEase){let t=this._prevEase,r=(e.k.now()-t.start)/t.duration,i=t.easing(r+.01)-t.easing(r),a=.27/Math.sqrt(i*i+1e-4)*.01,o=Math.sqrt(.0729-a*a);n=e.bk(a,o,.25,1)}return this._prevEase={start:e.k.now(),duration:t,easing:n},n}blur(){this.reset()}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ha{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Ua{constructor(){this.reset()}blur(){this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:n.getZoom()+(e.shiftKey?-1:1),around:n.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Wa{constructor(){this._tap=new xa({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(e,t,n){if(this._swipePoint)return;if(!this._tapTime)return void this._tap.touchstart(e,t,n);let r=t[0],i=e.timeStamp-this._tapTime<500,a=this._tapPoint.dist(r)<30;i&&a?n.length>0&&(this._swipePoint=r,this._swipeTouch=n[0].identifier):this.reset()}touchmove(e,t,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;let r=t[0],i=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:i/128}}}else this._tap.touchmove(e,t,n)}touchend(e,t,n){if(this._tapTime)this._swipePoint&&n.length===0&&this.reset();else{let r=this._tap.touchend(e,t,n);r&&(this._tapTime=e.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 Ga{constructor(e,t,n){this._el=e,this._mousePan=t,this._touchPan=n}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add(`mapboxgl-touch-drag-pan`)}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove(`mapboxgl-touch-drag-pan`)}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Ka{constructor(e,t,n){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=n}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class qa{constructor(e,t,n,r){this._el=e,this._touchZoom=t,this._touchRotate=n,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add(`mapboxgl-touch-zoom-rotate`)}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove(`mapboxgl-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()}}let Ja=e=>e.zoom||e.drag||e.pitch||e.rotate;class Ya extends e.o{}function Xa(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class Za{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ua(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),e.$([`handleEvent`,`handleWindowEvent`],this);let 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(let[e,t,n]of this._listeners)s.addEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,n)}destroy(){for(let[e,t,n]of this._listeners)s.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(e){let t=this._map,n=t.getCanvasContainer();this._add(`mapEvent`,new ga(t,e));let r=t.boxZoom=new va(t,e);this._add(`boxZoom`,r);let i=new Sa,a=new Ua;t.doubleClickZoom=new Ha(a,i),this._add(`tapZoom`,i),this._add(`clickZoom`,a);let o=new Wa;this._add(`tapDragZoom`,o);let s=t.touchPitch=new Ia;this._add(`touchPitch`,s);let c=new Ea(e),l=new Da(e);t.dragRotate=new Ka(e,c,l),this._add(`mouseRotate`,c,[`mousePitch`]),this._add(`mousePitch`,l,[`mouseRotate`]);let u=new Ta(e),d=new Oa(e);t.dragPan=new Ga(n,u,d),this._add(`mousePan`,u),this._add(`touchPan`,d,[`touchZoom`,`touchRotate`]);let f=new Pa,p=new Ma;t.touchZoomRotate=new qa(n,p,f,o),this._add(`touchRotate`,f,[`touchPan`,`touchZoom`]),this._add(`touchZoom`,p,[`touchPan`,`touchRotate`]);let m=t.scrollZoom=new Va(t,this);this._add(`scrollZoom`,m,[`mousePan`]);let h=t.keyboard=new Ra;this._add(`keyboard`,h),this._add(`blockableMapEvent`,new _a(t));for(let n of[`boxZoom`,`doubleClickZoom`,`tapDragZoom`,`touchPitch`,`dragRotate`,`dragPan`,`touchZoomRotate`,`scrollZoom`,`keyboard`])e.interactive&&e[n]&&t[n].enable(e[n])}_add(e,t,n){this._handlers.push({handlerName:e,handler:t,allowed:n}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ja(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,n){for(let r in e)if(r!==n&&(!t||t.indexOf(r)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){let t=[];for(let n of e)this._el.contains(n.target)&&t.push(n);return t}handleEvent(e,t){this._updatingCamera=!0;let n=e.type===`renderFrame`?void 0:e,r={needsRenderFrame:!1},i={},a={},o=e.touches,c=o?this._getMapTouches(o):void 0,l=c?s.touchPos(this._el,c):s.mousePos(this._el,e);for(let{handlerName:o,handler:s,allowed:u}of this._handlers){if(!s.isEnabled())continue;let d;this._blockedByActive(a,u,o)?s.reset():s[t||e.type]&&(d=s[t||e.type](e,l,c),this.mergeHandlerResult(r,i,d,o,n),d&&d.needsRenderFrame&&this._triggerRenderFrame()),(d||s.isActive())&&(a[o]=s)}let u={};for(let e in this._previousActiveHandlers)a[e]||(u[e]=n);this._previousActiveHandlers=a,(Object.keys(u).length||Xa(r))&&(this._changes.push([r,i,u]),this._triggerRenderFrame()),(Object.keys(a).length||Xa(r))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:d}=r;d&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],d(this._map))}mergeHandlerResult(t,n,r,i,a){if(!r)return;e.e(t,r);let o={handlerName:i,originalEvent:r.originalEvent||a};r.zoomDelta!==void 0&&(n.zoom=o),r.panDelta!==void 0&&(n.drag=o),r.pitchDelta!==void 0&&(n.pitch=o),r.bearingDelta!==void 0&&(n.rotate=o)}_applyChanges(){let t={},n={},r={};for(let[i,a,o]of this._changes)i.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(i.panDelta)),i.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+i.pitchDelta),i.around!==void 0&&(t.around=i.around),i.pinchAround!==void 0&&(t.pinchAround=i.pinchAround),i.noInertia&&(t.noInertia=i.noInertia),e.e(n,a),e.e(r,o);this._updateMapTransform(t,n,r),this._changes=[]}_updateMapTransform(e,t,n){let r=this._map,i=r._getTransformForUpdate(),a=r.terrain;if(!(Xa(e)||a&&this._terrainMovement))return this._fireEvents(t,n,!0);let{panDelta:o,zoomDelta:s,bearingDelta:c,pitchDelta:l,around:u,pinchAround:d}=e;d!==void 0&&(u=d),r._stop(!0),u=u||r.transform.centerPoint;let f=i.pointLocation(o?u.sub(o):u);c&&(i.bearing+=c),l&&(i.pitch+=l),s&&(i.zoom+=s),a?this._terrainMovement||!t.drag&&!t.zoom?t.drag&&this._terrainMovement?i.center=i.pointLocation(i.centerPoint.sub(o)):i.setLocationAtPoint(f,u):(this._terrainMovement=!0,this._map._elevationFreeze=!0,i.setLocationAtPoint(f,u)):i.setLocationAtPoint(f,u),r._applyUpdatedTransform(i),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,n,!0)}_fireEvents(t,n,r){let i=Ja(this._eventsInProgress),a=Ja(t),o={};for(let e in t){let{originalEvent:n}=t[e];this._eventsInProgress[e]||(o[`${e}start`]=n),this._eventsInProgress[e]=t[e]}!i&&a&&this._fireEvent(`movestart`,a.originalEvent);for(let e in o)this._fireEvent(e,o[e]);a&&this._fireEvent(`move`,a.originalEvent);for(let e in t){let{originalEvent:n}=t[e];this._fireEvent(e,n)}let s={},c;for(let e in this._eventsInProgress){let{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],c=n[t]||r,s[`${e}end`]=c)}for(let e in s)this._fireEvent(e,s[e]);let l=Ja(this._eventsInProgress);if((i||a)&&!l&&this._terrainMovement){this._terrainMovement=!1,this._map._elevationFreeze=!1;let e=this._map._getTransformForUpdate();e.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(e)}if(r&&(i||a)&&!l){this._updatingCamera=!0;let t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),n=e=>e!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Ya(`renderFrame`,{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Qa extends e.E{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this.on(`moveend`,()=>{delete this._requestedCameraState}),e.$([`_renderFrameCallback`],this)}getCenter(){return new e.Y(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,n,r){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.e({offset:t},n),r)}panTo(t,n,r){return this.easeTo(e.e({center:t},n),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,n,r){return this.easeTo(e.e({zoom:t},n),r)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(t,n,r){return this.easeTo(e.e({bearing:t},n),r)}resetNorth(t,n){return this.rotateTo(0,e.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(e.e({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(e,t){return Math.abs(this.getBearing()){if(this._zooming&&(r.zoom=e.L(i,c,t)),this._rotating&&(r.bearing=e.L(a,l,t)),this._pitching&&(r.pitch=e.L(o,u,t)),this._padding&&(r.interpolatePadding(s,d,t),p=r.centerPoint.add(f)),this.terrain&&this._updateElevation(t),y)r.setLocationAtPoint(y,b);else{let e=r.zoomScale(r.zoom-i),n=(c>i?Math.min(2,v):Math.max(.5,v))**(1-t),a=r.unproject(g.add(_.mult(t*n)).mult(e));r.setLocationAtPoint(r.renderWorldCopies?a.wrap():a,p)}this._applyUpdatedTransform(r),this._fireMoveEvents(n)},e=>{this._afterEase(n,e)},t),this}_prepareEase(t,n,r={}){this._moving=!0,n||r.moving||this.fire(new e.o(`movestart`,t)),this._zooming&&!r.zooming&&this.fire(new e.o(`zoomstart`,t)),this._rotating&&!r.rotating&&this.fire(new e.o(`rotatestart`,t)),this._pitching&&!r.pitching&&this.fire(new e.o(`pitchstart`,t))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){let e=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(e-(n-(e*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=e.L(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoomAndCenter(this.terrain)}_fireMoveEvents(t){this.fire(new e.o(`move`,t)),this._zooming&&this.fire(new e.o(`zoom`,t)),this._rotating&&this.fire(new e.o(`rotate`,t)),this._pitching&&this.fire(new e.o(`pitch`,t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;let r=this._zooming,i=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new e.o(`zoomend`,t)),i&&this.fire(new e.o(`rotateend`,t)),a&&this.fire(new e.o(`pitchend`,t)),this.fire(new e.o(`moveend`,t))}flyTo(t,n){if(!t.essential&&e.k.prefersReducedMotion){let r=e.X(t,[`center`,`zoom`,`bearing`,`pitch`,`around`]);return this.jumpTo(r,n)}this.stop(),t=e.e({offset:[0,0],speed:1.2,curve:1.42,easing:e.bl},t);let r=this._getTransformForUpdate(),i=r.zoom,a=r.bearing,o=r.pitch,s=r.padding,c=`zoom`in t?e.ao(+t.zoom,r.minZoom,r.maxZoom):i,l=`bearing`in t?this._normalizeBearing(t.bearing,a):a,u=`pitch`in t?+t.pitch:o,d=`padding`in t?t.padding:r.padding,f=r.zoomScale(c-i),p=e.P.convert(t.offset),m=r.centerPoint.add(p),h=r.pointLocation(m),g=e.Y.convert(t.center||h);this._normalizeCenter(g,r);let _=r.project(h),v=r.project(g).sub(_),y=t.curve,b=Math.max(r.width,r.height),x=b/f,S=v.mag();if(`minZoom`in t){let n=e.ao(Math.min(t.minZoom,i,c),r.minZoom,r.maxZoom),a=b/r.zoomScale(n-i);y=Math.sqrt(a/S*2)}let C=y*y;function w(e){let t=(x*x-b*b+(e?-1:1)*C*C*S*S)/(2*(e?x:b)*C*S);return Math.log(Math.sqrt(t*t+1)-t)}function T(e){return(Math.exp(e)-Math.exp(-e))/2}function E(e){return(Math.exp(e)+Math.exp(-e))/2}let D=w(0),O=function(e){return E(D)/E(D+y*e)},k=function(e){return b*((E(D)*(T(t=D+y*e)/E(t))-T(D))/C)/S;var t},A=(w(1)-D)/y;if(Math.abs(S)<1e-6||!isFinite(A)){if(Math.abs(b-x)<1e-6)return this.easeTo(t,n);let e=xt.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=a!==l,this._pitching=u!==o,this._padding=!r.isPaddingEqual(d),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(g),this._ease(t=>{let f=t*A,h=1/O(f);r.zoom=t===1?c:i+r.scaleZoom(h),this._rotating&&(r.bearing=e.L(a,l,t)),this._pitching&&(r.pitch=e.L(o,u,t)),this._padding&&(r.interpolatePadding(s,d,t),m=r.centerPoint.add(p)),this.terrain&&this._updateElevation(t);let y=t===1?g:r.unproject(_.add(v.mult(k(f))).mult(h));r.setLocationAtPoint(r.renderWorldCopies?y.wrap():y,m),this._applyUpdatedTransform(r),this._fireMoveEvents(n)},()=>{this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}if(!e){let e=this.handlers;e&&e.stop(!1)}return this}_ease(t,n,r){!1===r.animate||r.duration===0?(t(1),n()):(this._easeStart=e.k.now(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let t=Math.min((e.k.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()}_normalizeBearing(t,n){t=e.bd(t,-180,180);let r=Math.abs(t-n);return Math.abs(t-360-n)180?-360:n<-180?360:0}_applyUpdatedTransform(e){let t=[];if(this.terrain&&t.push(e=>this._elevateCameraIfInsideTerrain(e)),!t.length)return;let n=e.clone();for(let e of t){let t=n.clone(),{center:r,zoom:i,pitch:a,bearing:o,elevation:s}=e(t);r&&(t.center=r),i!==void 0&&(t.zoom=i),a!==void 0&&(t.pitch=a),o!==void 0&&(t.bearing=o),s!==void 0&&(t.elevation=s),n.apply(t)}this.transform.apply(n)}_getTransformForUpdate(){return this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){let t=e.getCameraPosition(),n=this.terrain.getElevationForLngLatZoom(t.lngLat,e.zoom);if(t.altitude(n.value&&(e+=`${n.key}=${n.value}${rtypeof e==`string`?e:``)):typeof this.options.customAttribution==`string`&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let t=this._map.style.sourceCaches;for(let n in t){let r=t[n];if(r.used){let t=r.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e.sort((e,t)=>e.length-t.length),e=e.filter((t,n)=>{for(let r=n+1;r=0)return!1;return!0});let n=e.join(` | `);n!==this._attribHTML&&(this._attribHTML=n,e.length?(this._innerContainer.innerHTML=n,this._container.classList.remove(`mapboxgl-attrib-empty`)):this._container.classList.add(`mapboxgl-attrib-empty`),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add(`mapboxgl-compact`):this._container.classList.remove(`mapboxgl-compact`,`mapboxgl-compact-show`)}}class eo{constructor(){e.$([`_updateLogo`],this),e.$([`_updateCompact`],this)}onAdd(e){this._map=e,this._container=s.create(`div`,`mapboxgl-ctrl`);let t=s.create(`a`,`mapboxgl-ctrl-logo`);return t.target=`_blank`,t.rel=`noopener nofollow`,t.href=`https://www.mapbox.com/`,t.setAttribute(`aria-label`,this._map._getUIString(`LogoControl.Title`)),t.setAttribute(`rel`,`noopener nofollow`),this._container.appendChild(t),this._container.style.display=`none`,this._map.on(`sourcedata`,this._updateLogo),this._updateLogo(),this._map.on(`resize`,this._updateCompact),this._updateCompact(),this._container}onRemove(){s.remove(this._container),this._map.off(`sourcedata`,this._updateLogo),this._map.off(`resize`,this._updateCompact)}getDefaultPosition(){return`bottom-left`}_updateLogo(e){e&&e.sourceDataType!==`metadata`||(this._container.style.display=this._logoRequired()?`block`:`none`)}_logoRequired(){if(!this._map.style)return;let e=this._map.style.sourceCaches;for(let t in e)if(e[t].getSource().mapbox_logo)return!0;return!1}_updateCompact(){let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add(`mapboxgl-compact`):t.classList.remove(`mapboxgl-compact`)}}}class to{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,n=t?this._queue.concat(t):this._queue;for(let t of n)if(t.id===e)return void(t.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw Error(`Attempting to run(), but is already running.`);let t=this._currentlyRunning=this._queue;this._queue=[];for(let n of t)if(!n.cancelled&&(n.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}let no={"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":`Mapbox logo`,"NavigationControl.ResetBearing":`Reset bearing to north`,"NavigationControl.ZoomIn":`Zoom in`,"NavigationControl.ZoomOut":`Zoom out`,"ScaleControl.Feet":`ft`,"ScaleControl.Meters":`m`,"ScaleControl.Kilometers":`km`,"ScaleControl.Miles":`mi`,"ScaleControl.NauticalMiles":`nm`};class ro extends e.E{constructor(t){super(),this._lastTilesetChange=e.k.now(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.sourceCache.usedForTerrain=!0,this.sourceCache.tileSize=this.tileSize*2**this.deltaZoom}destroy(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];let r={},i=t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n});for(let t of i){let n=t.key;r[n]=!0,this._renderableTilesKeys.push(n),this._tiles[n]||(t.posMatrix=new Float64Array(16),e.aY(t.posMatrix,0,e.a2,0,e.a2,0,1),this._tiles[n]=new Oe(t,this.tileSize))}for(let e in this._tiles)r[e]||delete this._tiles[e]}freeRtt(e){for(let t in this._tiles){let n=this._tiles[t];(!e||n.tileID.equals(e)||n.tileID.isChildOf(e)||e.isChildOf(n.tileID))&&(n.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(t){let n={};for(let r of this._renderableTilesKeys){let i=this._tiles[r].tileID;if(i.canonical.equals(t.canonical)){let i=t.clone();i.posMatrix=new Float64Array(16),e.aY(i.posMatrix,0,e.a2,0,e.a2,0,1),n[r]=i}else if(i.canonical.isChildOf(t.canonical)){let a=t.clone();a.posMatrix=new Float64Array(16);let o=i.canonical.z-t.canonical.z,s=i.canonical.x-(i.canonical.x>>o<>o<>o;e.aY(a.posMatrix,0,l,0,l,0,1),e.aa(a.posMatrix,a.posMatrix,[-s*l,-c*l,0]),n[r]=a}else if(t.canonical.isChildOf(i.canonical)){let a=t.clone();a.posMatrix=new Float64Array(16);let o=t.canonical.z-i.canonical.z,s=t.canonical.x-(t.canonical.x>>o<>o<>o;e.aY(a.posMatrix,0,e.a2,0,e.a2,0,1),e.aa(a.posMatrix,a.posMatrix,[s*l,c*l,0]),e.ab(a.posMatrix,a.posMatrix,[1/2**o,1/2**o,0]),n[r]=a}}return n}getSourceTile(e,t){let n=this.sourceCache._source,r=e.overscaledZ-this.deltaZoom;if(r>n.maxzoom&&(r=n.maxzoom),r=n.minzoom&&(!i||!i.dem);)i=this.sourceCache.getTileByID(e.scaledTo(r--).key);return i}tilesAfterTime(t=e.k.now()){return Object.values(this._tiles).filter(e=>e.timeAdded>=t)}}class io{constructor(e,t,n){this.vertexBuffer=e,this.indexBuffer=t,this.segments=n}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var ao=e.a3([{name:`a_pos3d`,type:`Int16`,components:3}]);class oo{constructor(e,t,n){this.painter=e,this.sourceCache=new ro(t),this.options=n,this.exaggeration=n.exaggeration===void 0?1:n.exaggeration,this.meshSize=128,this.qualityFactor=2,this.coordsIndex=[],this._demMatrixCache={},this._coordsTextureSize=1024}getElevationForLngLatZoom(t,n){if(!function(t,n){let{x:r,y:i}=e.a4.fromLngLat(n);return!(t<0||t>25||i<0||i>=1||r<0||r>=1)}(n,t.wrap()))return 0;let{tileID:r,mercatorX:i,mercatorY:a}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(r,i%e.a2,a%e.a2)}getMinTileElevationForLngLatZoom(e,t){var n;let{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(e,t);return(n=this.getMinMaxElevation(r).minElevation)==null?0:n}getElevation(t,n,r,i=e.a2){return this.getDEMElevation(t,n,r,i)*this.exaggeration}getDEMElevation(t,n,r,i=e.a2){if(n<0||n>=i||r<0||r>=i)return 0;let a=this.getTerrainData(t),o=a.tile&&a.tile.dem;if(!o)return 0;let s=function(e,t,n){var r=t[0],i=t[1];return e[0]=n[0]*r+n[4]*i+n[12],e[1]=n[1]*r+n[5]*i+n[13],e}([],[n/i*e.a2,r/i*e.a2],a.u_terrain_matrix),c=[s[0]*o.dim,s[1]*o.dim],l=Math.floor(c[0]),u=Math.floor(c[1]),d=c[0]-l,f=c[1]-u;return o.get(l,u)*(1-d)*(1-f)+o.get(l+1,u)*d*(1-f)+o.get(l,u+1)*(1-d)*f+o.get(l+1,u+1)*d*f}getTerrainData(t){if(!this._emptyDemTexture){let t=this.painter.context,n=new e.l({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new M(t,n,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new M(t,new e.l({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=e.a9([])}let n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){let e=this.painter,t=e.context,r=t.gl,i=n.dem.getPixels();n.demTexture=e.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(i,{premultiply:!1}):n.demTexture=new M(t,i,r.RGBA,{premultiply:!1}),n.demTexture.bind(r.NEAREST,r.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}let r=n&&n+n.tileID.key+t.key;if(r&&!this._demMatrixCache[r]){let r=this.sourceCache.sourceCache._source.maxzoom,i=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=r?i=t.canonical.z-r:e.w(`cannot calculate elevation if elevation maxzoom > source.maxzoom`));let a=t.canonical.x-(t.canonical.x>>i<>i<>8<<4|e>>8,n[t+3]=0;let r=new e.l({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),i=new M(t,r,t.gl.RGBA,{premultiply:!1});return i.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=i,i}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);let n=new Uint8Array(4),r=this.painter.context,i=r.gl;r.bindFramebuffer.set(this.getFramebuffer(`coords`).framebuffer),i.readPixels(t.x,this.painter.height/e.k.devicePixelRatio,1,1,i.RGBA,i.UNSIGNED_BYTE,n),r.bindFramebuffer.set(null);let a=n[0]+(n[2]>>4<<8),o=n[1]+((15&n[2])<<8),s=this.coordsIndex[255-n[3]],c=s&&this.sourceCache.getTileByID(s);if(!c)return null;let l=this._coordsTextureSize,u=(1<e.id!==t),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw Error(`No free RenderPool available, call freeAllObjects() required!`);let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length!e.inUse)}_createObject(e){let t=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),n=new M(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return n.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),t.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),t.colorAttachment.set(n.texture),{id:e,fbo:t,texture:n,stamp:-1,inUse:!1}}}let co={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class lo{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new so(e.context,30,t.sourceCache.tileSize*t.qualityFactor)}destroy(){this.pool.destroy()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(n=>!e._layers[n].isHidden(t)),this._coordsDescendingInv={};for(let t in e.sourceCaches){this._coordsDescendingInv[t]={};let n=e.sourceCaches[t].getVisibleCoordinates();for(let e of n){let n=this.terrain.sourceCache.getTerrainCoords(e);for(let e in n)this._coordsDescendingInv[t][e]||(this._coordsDescendingInv[t][e]=[]),this._coordsDescendingInv[t][e].push(n[e])}}this._coordsDescendingInvStr={};for(let t of e._order){let n=e._layers[t],r=n.source;if(co[n.type]&&!this._coordsDescendingInvStr[r]){this._coordsDescendingInvStr[r]={};for(let e in this._coordsDescendingInv[r])this._coordsDescendingInvStr[r][e]=this._coordsDescendingInv[r][e].map(e=>e.key).sort().join()}}for(let e of this._renderableTiles)for(let t in this._coordsDescendingInvStr){let n=this._coordsDescendingInvStr[t][e.tileID.key];n&&n!==e.rttCoords[t]&&(e.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;let n=t.type,r=this.painter,i=this.terrain,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(co[n]&&(this._prevType&&co[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(co[this._prevType]||co[n]&&a){this._prevType=n;let t=this._stacks.length-1,a=this._stacks[t]||[];for(let n of this._renderableTiles){if(this.pool.isFull()&&(Yi(r,i,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[t]){let e=this.pool.getObjectForId(n.rtt[t].id);if(e.stamp===n.rtt[t].stamp){this.pool.useObject(e);continue}}let o=this.pool.getOrCreateFreeObject();this.pool.useObject(o),this.pool.stampObject(o),n.rtt[t]={id:o.id,stamp:o.stamp},r.context.bindFramebuffer.set(o.fbo.framebuffer),r.context.clear({color:e.aZ.transparent,stencil:0}),r.currentStencilSource=void 0;for(let e=0;et.preventDefault()}),s.mousePos(this.element,t)),s.addEventListener(window,`mousemove`,this.mousemove),s.addEventListener(window,`mouseup`,this.mouseup)}mousemove(e){this.move(e,s.mousePos(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){e.targetTouches.length===1?(this._startPos=this._lastPos=s.touchPos(this.element,e.targetTouches)[0],this.down({type:`mousedown`,button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos)):this.reset()}touchmove(e){e.targetTouches.length===1?(this._lastPos=s.touchPos(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos)):this.reset()}touchend(e){e.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)180;){let e=r.locationPoint(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!==i.lng&&r.locationPoint(t).y>r.height/2-r.getHorizon()?t:i}let go={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 _o(e,t,n){let r=e.classList;for(let e in go)r.remove(`mapboxgl-${n}-anchor-${e}`);r.add(`mapboxgl-${n}-anchor-${t}`)}class vo extends e.E{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=e.e({element:t},n)),e.$([`_update`,`_onMove`,`_onUp`,`_addDragHandler`,`_onMapClick`,`_onKeyPress`],this),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._isDragging=!1,this._state=`inactive`,this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||`auto`,this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!==`auto`?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),t&&t.element)this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=s.create(`div`),this._element.setAttribute(`aria-label`,`Map marker`);let n=s.createNS(`http://www.w3.org/2000/svg`,`svg`);n.setAttributeNS(null,`display`,`block`),n.setAttributeNS(null,`height`,`41px`),n.setAttributeNS(null,`width`,`27px`),n.setAttributeNS(null,`viewBox`,`0 0 27 41`);let r=s.createNS(`http://www.w3.org/2000/svg`,`g`);r.setAttributeNS(null,`stroke`,`none`),r.setAttributeNS(null,`stroke-width`,`1`),r.setAttributeNS(null,`fill`,`none`),r.setAttributeNS(null,`fill-rule`,`evenodd`);let i=s.createNS(`http://www.w3.org/2000/svg`,`g`);i.setAttributeNS(null,`fill-rule`,`nonzero`);let a=s.createNS(`http://www.w3.org/2000/svg`,`g`);a.setAttributeNS(null,`transform`,`translate(3.0, 29.0)`),a.setAttributeNS(null,`fill`,`#000000`);for(let e of[{rx:`10.5`,ry:`5.25002273`},{rx:`10.5`,ry:`5.25002273`},{rx:`9.5`,ry:`4.77275007`},{rx:`8.5`,ry:`4.29549936`},{rx:`7.5`,ry:`3.81822308`},{rx:`6.5`,ry:`3.34094679`},{rx:`5.5`,ry:`2.86367051`},{rx:`4.5`,ry:`2.38636864`}]){let t=s.createNS(`http://www.w3.org/2000/svg`,`ellipse`);t.setAttributeNS(null,`opacity`,`0.04`),t.setAttributeNS(null,`cx`,`10.5`),t.setAttributeNS(null,`cy`,`5.80029008`),t.setAttributeNS(null,`rx`,e.rx),t.setAttributeNS(null,`ry`,e.ry),a.appendChild(t)}let o=s.createNS(`http://www.w3.org/2000/svg`,`g`);o.setAttributeNS(null,`fill`,this._color);let c=s.createNS(`http://www.w3.org/2000/svg`,`path`);c.setAttributeNS(null,`d`,`M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z`),o.appendChild(c);let l=s.createNS(`http://www.w3.org/2000/svg`,`g`);l.setAttributeNS(null,`opacity`,`0.25`),l.setAttributeNS(null,`fill`,`#000000`);let u=s.createNS(`http://www.w3.org/2000/svg`,`path`);u.setAttributeNS(null,`d`,`M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z`),l.appendChild(u);let d=s.createNS(`http://www.w3.org/2000/svg`,`g`);d.setAttributeNS(null,`transform`,`translate(6.0, 7.0)`),d.setAttributeNS(null,`fill`,`#FFFFFF`);let f=s.createNS(`http://www.w3.org/2000/svg`,`g`);f.setAttributeNS(null,`transform`,`translate(8.0, 8.0)`);let p=s.createNS(`http://www.w3.org/2000/svg`,`circle`);p.setAttributeNS(null,`fill`,`#000000`),p.setAttributeNS(null,`opacity`,`0.25`),p.setAttributeNS(null,`cx`,`5.5`),p.setAttributeNS(null,`cy`,`5.5`),p.setAttributeNS(null,`r`,`5.4999962`);let m=s.createNS(`http://www.w3.org/2000/svg`,`circle`);m.setAttributeNS(null,`fill`,`#FFFFFF`),m.setAttributeNS(null,`cx`,`5.5`),m.setAttributeNS(null,`cy`,`5.5`),m.setAttributeNS(null,`r`,`5.4999962`),f.appendChild(p),f.appendChild(m),i.appendChild(a),i.appendChild(o),i.appendChild(l),i.appendChild(d),i.appendChild(f),n.appendChild(i),n.setAttributeNS(null,`height`,41*this._scale+`px`),n.setAttributeNS(null,`width`,27*this._scale+`px`),this._element.appendChild(n),this._offset=e.P.convert(t&&t.offset||[0,-14])}this._element.classList.add(`mapboxgl-marker`),this._element.addEventListener(`dragstart`,e=>{e.preventDefault()}),this._element.addEventListener(`mousedown`,e=>{e.preventDefault()}),_o(this._element,this._anchor,`marker`),this._popup=null}addTo(e){return this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on(`move`,this._update),e.on(`moveend`,this._update),e.on(`terrain`,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(`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),s.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.Y.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener(`keypress`,this._onKeyPress),this._originalTabIndex||this._element.removeAttribute(`tabindex`)),e){if(!(`offset`in e.options)){let t=13.5,n=Math.sqrt(t**2/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[n,-1*(24.6+n)],"bottom-right":[-n,-1*(24.6+n)],left:[t,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute(`tabindex`),this._originalTabIndex||this._element.setAttribute(`tabindex`,`0`),this._element.addEventListener(`keypress`,this._onKeyPress)}return this}_onKeyPress(e){let t=e.code,n=e.charCode||e.keyCode;t!==`Space`&&t!==`Enter`&&n!==32&&n!==13||this.togglePopup()}_onMapClick(e){let t=e.originalEvent.target,n=this._element;this._popup&&(t===n||n.contains(t))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered||e&&(e.isOpen()?e.remove():e.addTo(this._map)),this}_update(t){if(!this._map)return;let n=this._map.loaded()&&!this._map.isMoving();((t==null?void 0:t.type)===`terrain`||(t==null?void 0:t.type)===`render`&&!n)&&this._map.once(`render`,this._update),this._map.transform.renderWorldCopies&&(this._lngLat=ho(this._lngLat,this._flatPos,this._map.transform)),this._pos=this._flatPos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let r=``;this._rotationAlignment===`viewport`||this._rotationAlignment===`auto`?r=`rotateZ(${this._rotation}deg)`:this._rotationAlignment===`map`&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let i=``;this._pitchAlignment===`viewport`||this._pitchAlignment===`auto`?i=`rotateX(0deg)`:this._pitchAlignment===`map`&&(i=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!==`moveend`||(this._pos=this._pos.round()),s.setTransform(this._element,`${go[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${r}`),e.k.frameAsync(new AbortController).then(()=>{this._updateOpacity(t&&t.type===`moveend`)})}_updateOpacity(t=!1){if(!this._map||!this._map.terrain)return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let n=this._map,r=n.terrain.depthAtPoint(this._pos),i=n.terrain.getElevationForLngLatZoom(this._lngLat,n.transform.tileZoom);if(n.transform.lngLatToCameraDepth(this._lngLat,i)-r<.006)return void(this._element.style.opacity=this._opacity);let a=-this._offset.y/n.transform._pixelPerMeter,o=Math.sin(n.getPitch()*Math.PI/180)*a,s=n.terrain.depthAtPoint(new e.P(this._pos.x,this._pos.y-this._offset.y)),c=n.transform.lngLatToCameraDepth(this._lngLat,i+o)-s>.006;this._popup&&this._popup.isOpen()&&c&&this._popup.remove(),this._element.style.opacity=c?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){let 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`,this._state===`pending`&&(this._state=`active`,this.fire(new e.o(`dragstart`))),this.fire(new e.o(`drag`)))}_onUp(){this._element.style.pointerEvents=`auto`,this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off(`mousemove`,this._onMove),this._map.off(`touchmove`,this._onMove),this._state===`active`&&this.fire(new e.o(`dragend`)),this._state=`inactive`}_addDragHandler(e){this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.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))}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||`auto`,this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!==`auto`?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return e===void 0&&t===void 0&&(this._opacity=`1`,this._opacityWhenCovered=`0.2`),e!==void 0&&(this._opacity=e),t!==void 0&&(this._opacityWhenCovered=t),this._map&&this._updateOpacity(!0),this}}let yo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},bo,xo=0,So=!1,Co={maxWidth:100,unit:`metric`};function wo(e,t,n){let r=n&&n.maxWidth||100,i=e._container.clientHeight/2,a=e.unproject([0,i]),o=e.unproject([r,i]),s=a.distanceTo(o);if(n&&n.unit===`imperial`){let n=3.2808*s;n>5280?To(t,r,n/5280,e._getUIString(`ScaleControl.Miles`)):To(t,r,n,e._getUIString(`ScaleControl.Feet`))}else n&&n.unit===`nautical`?To(t,r,s/1852,e._getUIString(`ScaleControl.NauticalMiles`)):s>=1e3?To(t,r,s/1e3,e._getUIString(`ScaleControl.Kilometers`)):To(t,r,s,e._getUIString(`ScaleControl.Meters`))}function To(e,t,n,r){let i=function(e){let t=10**(`${Math.floor(e)}`.length-1),n=e/t;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}(n),t*n}(n);e.style.width=i/n*t+`px`,e.innerHTML=`${i} ${r}`}let Eo={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:``,maxWidth:`240px`},Do=[`a[href]`,`[tabindex]:not([tabindex='-1'])`,`[contenteditable]:not([contenteditable='false'])`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`].join(`, `);function Oo(t){if(t){if(typeof t==`number`){let n=Math.round(Math.sqrt(.5*t**2));return{center:new e.P(0,0),top:new e.P(0,t),"top-left":new e.P(n,n),"top-right":new e.P(-n,n),bottom:new e.P(0,-t),"bottom-left":new e.P(n,-n),"bottom-right":new e.P(-n,-n),left:new e.P(t,0),right:new e.P(-t,0)}}if(t instanceof e.P||Array.isArray(t)){let n=e.P.convert(t);return{center:n,top:n,"top-left":n,"top-right":n,bottom:n,"bottom-left":n,"bottom-right":n,left:n,right:n}}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 Oo(new e.P(0,0))}let ko={extend:(t,...n)=>e.e(t,...n),run(e){e()},logToElement(e,t=!1,n=`log`){let r=window.document.getElementById(n);r&&(t&&(r.innerHTML=``),r.innerHTML+=`
${e}`)}},Ao={version:a,supported:function(e){return t=!!e&&e.failIfMajorPerformanceCaveat,!(typeof window>`u`||typeof document>`u`||!Object.hasOwn||!function(){let e=document.createElement(`canvas`);e.width=e.height=1;let t=e.getContext(`2d`);return!!t&&t.getImageData(0,0,1,1).width===e.width}()||!function(e){return e?(r===void 0&&(r=i(!0)),r):(n===void 0&&(n=i(!1)),n)}(t));var t},webpSupported:l,setRTLTextPlugin:e.bu,getRTLTextPluginStatus:e.bt,Map:class extends Qa{constructor(t){if(e.bq.mark(e.br.create),(t=e.e({},uo,t)).minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw Error(`maxZoom must be greater than or equal to minZoom`);if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw Error(`maxPitch must be greater than or equal to minPitch`);if(t.minPitch!=null&&t.minPitch<0)throw Error(`minPitch must be greater than or equal to 0`);if(t.maxPitch!=null&&t.maxPitch>60)throw Error(`maxPitch must be less than or equal to 60`);if(super(new ra(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),t),this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=t.collectResourceTiming,this._renderTaskQueue=new to,this._controls=[],this._mapId=e.V(),this._locale=e.e({},no,t.locale),this._clickTolerance=t.clickTolerance,this._language=fo[t.language],this._englishWrapWidthMultiplier=t.englishWrapWidthMultiplier,this._maxCanvasSize=t.maxCanvasSize,this._overridePixelRatio=t.pixelRatio,this._initialLoading=!0,this._lightness=0,this._imageQueueHandle=(()=>{let e=m++;return h[e]=()=>this.isMoving(),e})(),this._requestManager=new T(t.transformRequest,t.accessToken),typeof t.container==`string`){if(this._container=document.getElementById(t.container),!this._container)throw Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw Error(`Invalid type: 'container' must be a String or HTMLElement.`);this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),e.$([`_onWindowOnline`,`_onWindowResize`,`_onMapScroll`,`_contextLost`,`_contextRestored`],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw Error(`Failed to initialize WebGL.`);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)}),typeof window<`u`&&(window.addEventListener(`online`,this._onWindowOnline,!1),window.addEventListener(`resize`,this._onWindowResize,!1),window.addEventListener(`orientationchange`,this._onWindowResize,!1)),this.handlers=new Za(this,t),this._hash=t.hash&&new ia(typeof t.hash==`string`&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,e.e({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new $a({customAttribution:t.customAttribution})),this.addControl(new eo,t.logoPosition),this.on(`style.load`,()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on(`data`,t=>{this._update(t.dataType===`style`),this.fire(new e.o(`${t.dataType}data`,t))}),this.on(`dataloading`,t=>{this.fire(new e.o(`${t.dataType}dataloading`,t))})}_getMapId(){return this._mapId}addControl(t,n){if(n===void 0&&(n=t.getDefaultPosition?t.getDefaultPosition():`top-right`),!t||!t.onAdd)return this.fire(new e.m(Error(`Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.`)));let r=t.onAdd(this);this._controls.push(t);let i=this._controlPositions[n];return n.indexOf(`bottom`)===-1?i.appendChild(r):i.insertBefore(r,i.firstChild),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.m(Error(`Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.`)));let n=this._controls.indexOf(t);return n>-1&&this._controls.splice(n,1),t.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}resize(t,n){let[r,i]=this._containerDimensions();if(!n&&r===this.transform.width&&i===this.transform.height)return this;let a=this._getClampedPixelRatio(r,i);if(this._resizeCanvas(r,i,a),this.painter.resize(r,i,a),this.transform.resize(r,i),this.painter.overLimit()){let e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight],a=this._getClampedPixelRatio(r,i),this._resizeCanvas(r,i,a),this.painter.resize(r,i,a)}let o=!this._moving;return o&&this.fire(new e.o(`movestart`,t)).fire(new e.o(`move`,t)),this.fire(new e.o(`resize`,t)),o&&this.fire(new e.o(`moveend`,t)),this}_getClampedPixelRatio(e,t){let n=this.getPixelRatio();if(!this._maxCanvasSize)return n;let[r,i]=this._maxCanvasSize,a=e*n,o=t*n;return Math.min(a>r?r/a:1,o>i?i/o:1)*n}getPixelRatio(){var t;return(t=this._overridePixelRatio)==null?e.k.devicePixelRatio:t}setPixelRatio(e){this._overridePixelRatio=e,this.resize(null,!0)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(ve.convert(e)),this._update()}setMinZoom(e){if((e=e==null?-2:e)>=-2&&e<=this.transform.maxZoom)return this.transform.minZoom=e,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=e,this._update(),this.getZoom()>e&&this.setZoom(e),this;throw Error(`maxZoom must be greater than the current minZoom`)}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=e==null?0:e)<0)throw Error(`minPitch must be greater than or equal to 0`);if(e>=0&&e<=this.transform.maxPitch)return this.transform.minPitch=e,this._update(),this.getPitch()60)throw Error(`maxPitch must be less than or equal to 60`);if(e>=this.transform.minPitch)return this.transform.maxPitch=e,this._update(),this.getPitch()>e&&this.setPitch(e),this;throw Error(`maxPitch must be greater than the current minPitch`)}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this._update()}project(t){return this.transform.locationPoint(e.Y.convert(t),this.terrain)}unproject(t){return this.transform.pointLocation(e.P.convert(t),this.terrain)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_createDelegatedListener(e,t,n){if(e===`mouseenter`||e===`mouseover`){let r=!1;return{layer:t,listener:n,delegates:{mousemove:i=>{let a=this.getLayer(t)?this.queryRenderedFeatures(i.point,{layers:[t]}):[];a.length?r||(r=!0,n.call(this,new pa(e,this,i.originalEvent,{features:a}))):r=!1},mouseout:()=>{r=!1}}}}if(e===`mouseleave`||e===`mouseout`){let r=!1;return{layer:t,listener:n,delegates:{mousemove:i=>{(this.getLayer(t)?this.queryRenderedFeatures(i.point,{layers:[t]}):[]).length?r=!0:r&&(r=!1,n.call(this,new pa(e,this,i.originalEvent)))},mouseout:t=>{r&&(r=!1,n.call(this,new pa(e,this,t.originalEvent)))}}}}{let r=e=>{let r=this.getLayer(t)?this.queryRenderedFeatures(e.point,{layers:[t]}):[];r.length&&(e.features=r,n.call(this,e),delete e.features)};return{layer:t,listener:n,delegates:{[e]:r}}}}on(e,t,n){if(n===void 0)return super.on(e,t);let r=this._createDelegatedListener(e,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(r);for(let e in r.delegates)this.on(e,r.delegates[e]);return this}once(e,t,n){if(n===void 0)return super.once(e,t);let r=this._createDelegatedListener(e,t,n);for(let e in r.delegates)this.once(e,r.delegates[e]);return this}off(e,t,n){return n===void 0?super.off(e,t):(this._delegatedListeners&&this._delegatedListeners[e]&&(()=>{let r=this._delegatedListeners[e];for(let e=0;e{t?this.fire(new e.m(t)):r&&this._updateDiff(r,n)})}else typeof t==`object`&&this._updateDiff(t,n)}_updateDiff(t,n){try{this.style.setState(t)&&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,n)}}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(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(t){let n=this.style&&this.style.sourceCaches[t];if(n!==void 0)return n.loaded();this.fire(new e.m(Error(`There is no source with ID '${t}'`)))}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off(`data`,this._terrainDataCallback),t){if(this.style._validate(e.U.terrain,`terrain`,t,null))return;let n=this.style.sourceCaches[t.source];if(!n)throw Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain===null&&n.reload();for(let n in this.style._layers){let r=this.style._layers[n];r.type===`hillshade`&&r.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 oo(this.painter,n,t),this.painter.renderToTexture=new lo(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=e=>{e.dataType===`style`?this.terrain.sourceCache.freeRtt():e.dataType===`source`&&e.tile&&(e.sourceId!==t.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(e.tile.tileID))},this.style.on(`data`,this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache&&this.terrain.sourceCache.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destroy(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new e.o(`terrain`,{terrain:t})),this}getTerrain(){return this.terrain?this.terrain.options:null}areTilesLoaded(){let e=this.style&&this.style.sourceCaches;for(let t in e){let n=e[t]._tiles;for(let e in n){let t=n[e];if(t.state!==`loaded`&&t.state!==`errored`)return!1}}return!0}addSourceType(e,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,n)}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}addImage(t,n,{pixelRatio:r=1,sdf:i=!1,stretchX:a,stretchY:o,content:s}={}){if(this._lazyInitEmptyStyle(),n instanceof HTMLImageElement||e.a(n)){let{width:c,height:l,data:u}=e.k.getImageData(n);this.style.addImage(t,{data:new e.l({width:c,height:l},u),pixelRatio:r,stretchX:a,stretchY:o,content:s,sdf:i,version:0})}else{if(n.width===void 0||n.height===void 0)return this.fire(new e.m(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:c,height:l,data:u}=n,d=n;this.style.addImage(t,{data:new e.l({width:c,height:l},new Uint8Array(u)),pixelRatio:r,stretchX:a,stretchY:o,content:s,sdf:i,version:0,userImage:d}),d.onAdd&&d.onAdd(this,t)}}}updateImage(t,n){let r=this.style.getImage(t);if(!r)return this.fire(new e.m(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:i,height:a,data:o}=n instanceof HTMLImageElement||e.a(n)?e.k.getImageData(n):n;if(i===void 0||a===void 0)return this.fire(new e.m(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(i!==r.data.width||a!==r.data.height)return this.fire(new e.m(Error(`The width and height of the updated image must be that same as the previous version of the image`)));let s=!(n instanceof HTMLImageElement||e.a(n));r.data.replace(o,s),this.style.updateImage(t,r)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.m(Error(`Missing required image id`))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(t,n){y(this._requestManager.transformRequest(t,e.R.Image),n)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}setLayerZoomRange(e,t,n){return this.style.setLayerZoomRange(e,t,n),this._update(!0)}setFilter(e,t,n={}){return this.style.setFilter(e,t,n),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,n,r={}){return this.style.setPaintProperty(e,t,n,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,n,r={}){return this.style.setLayoutProperty(e,t,n,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue(`background-color`)!==`rgb(250, 128, 114)`&&e.w(`This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.`)}_setupContainer(){let e=this._container;e.classList.add(`mapboxgl-map`),(this._missingCSSCanary=s.create(`div`,`mapboxgl-canary`,e)).style.visibility=`hidden`,this._detectMissingCSS();let t=this._canvasContainer=s.create(`div`,`mapboxgl-canvas-container`,e);this._interactive&&t.classList.add(`mapboxgl-interactive`),this._canvas=s.create(`canvas`,`mapboxgl-canvas`,t),this._canvas.addEventListener(`webglcontextlost`,this._contextLost,!1),this._canvas.addEventListener(`webglcontextrestored`,this._contextRestored,!1),this._canvas.setAttribute(`tabindex`,`0`),this._canvas.setAttribute(`aria-label`,`Map`),this._canvas.setAttribute(`role`,`region`);let n=this._containerDimensions(),r=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],r);let i=this._controlContainer=s.create(`div`,`mapboxgl-control-container`,e),a=this._controlPositions={};[`top-left`,`top-right`,`bottom-left`,`bottom-right`].forEach(e=>{a[e]=s.create(`div`,`mapboxgl-ctrl-${e}`,i)}),this._container.addEventListener(`scroll`,this._onMapScroll,!1)}_resizeCanvas(e,t,n){this._canvas.width=Math.floor(n*e),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){let n=e.e({},t,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext(`webgl2`,n);r?(this.painter=new $i(r,this.transform),l.testSupport(r)):this.fire(new e.m(Error(`Failed to initialize WebGL`)))}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.o(`webglcontextlost`,{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.resize(),this._update(),this.fire(new e.o(`webglcontextrestored`,{originalEvent:t}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(t){let n,r=0,i=this.painter.context.extTimerQuery;if(this.listens(`gpu-timing-frame`)&&(n=i.createQueryEXT(),i.beginQueryEXT(i.TIME_ELAPSED_EXT,n),r=e.k.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let a=!1,o=this._initialLoading?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;let t=this.transform.zoom,n=e.k.now();this.style.zoomHistory.update(t,n);let r=new e.ai(t,{now:n,fadeDuration:o,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),i=r.crossFadingFactor();i===1&&i===this._crossFadingFactor||(a=!0,this._crossFadingFactor=i),this.style.update(r)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,o,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showMoreTileInfos:this.showMoreTileInfos,showOverdrawInspector:this._showOverdrawInspector,showTerrainWireframe:this._showTerrainWireframe,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,initialLoading:this._initialLoading,showPadding:this.showPadding,gpuTiming:!!this.listens(`gpu-timing-layer`),lightness:this._lightness}),this.fire(new e.o(`render`)),this.loaded()&&!this._loaded&&(this._loaded=!0,e.bq.mark(e.br.load),this.fire(new e.o(`load`))),this.style&&(this.style.hasTransitions()||a)&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens(`gpu-timing-frame`)){let t=e.k.now()-r;i.endQueryEXT(i.TIME_ELAPSED_EXT,n),setTimeout(()=>{let r=i.getQueryObjectEXT(n,i.QUERY_RESULT_EXT)/1e6;i.deleteQueryEXT(n),this.fire(new e.o(`gpu-timing-frame`,{cpuTime:t,gpuTime:r}))},50)}if(this.listens(`gpu-timing-layer`)){let t=this.painter.collectGpuTimers();setTimeout(()=>{let n=this.painter.queryGpuTimers(t);this.fire(new e.o(`gpu-timing-layer`,{layerTimes:n}))},50)}let s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&(this.fire(new e.o(`idle`)),this._initialLoading&&(this._initialLoading=!1)),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,e.bq.mark(e.br.fullLoad)),this}remove(){this._hash&&this._hash.remove();for(let e of this._controls)e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),typeof window<`u`&&(window.removeEventListener(`resize`,this._onWindowResize,!1),window.removeEventListener(`orientationchange`,this._onWindowResize,!1),window.removeEventListener(`online`,this._onWindowOnline,!1)),delete h[this._imageQueueHandle],C();let t=this.painter.context.gl.getExtension(`WEBGL_lose_context`);t&&t.loseContext(),this._canvas.removeEventListener(`webglcontextlost`,this._contextLost,!1),this._canvas.removeEventListener(`webglcontextrestored`,this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove(`mapboxgl-map`),this._container.removeEventListener(`scroll`,this._onMapScroll,!1),e.bq.clearMetrics(),this._removed=!0,this.fire(new e.o(`remove`))}triggerRepaint(){this.style&&!this._frame&&(this._frame=e.k.frame(t=>{e.bq.frame(t),this._frame=null,this._render(t)}))}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get showMoreTileInfos(){return!!this._showMoreTileInfos}set showMoreTileInfos(e){this._showMoreTileInfos!==e&&(this._showMoreTileInfos=e,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}_setCacheLimits(t,n){e.bs(t,n)}get language(){return this._language}set language(e){let t=fo[e];t&&this._language!==e&&(this._language=t,this.style.reloadAllSource())}get englishWrapWidthMultiplier(){return this._englishWrapWidthMultiplier}set englishWrapWidthMultiplier(e){this._englishWrapWidthMultiplier!==e&&(this._englishWrapWidthMultiplier=e,this.style.reloadAllSource())}getCameraTargetElevation(){return this.transform.elevation}setLightness(t){this._lightness=e.ao(t,-1,1),this.triggerRepaint()}},NavigationControl:class{constructor(t){this.options=e.e({},po,t),this._container=s.create(`div`,`mapboxgl-ctrl mapboxgl-ctrl-group`),this._container.addEventListener(`contextmenu`,e=>e.preventDefault()),this.options.showZoom&&(e.$([`_setButtonTitle`,`_updateZoomButtons`],this),this._zoomInButton=this._createButton(`mapboxgl-ctrl-zoom-in`,e=>this._map.zoomIn({},{originalEvent:e})),s.create(`span`,`mapboxgl-ctrl-icon`,this._zoomInButton).setAttribute(`aria-hidden`,`true`),this._zoomOutButton=this._createButton(`mapboxgl-ctrl-zoom-out`,e=>this._map.zoomOut({},{originalEvent:e})),s.create(`span`,`mapboxgl-ctrl-icon`,this._zoomOutButton).setAttribute(`aria-hidden`,`true`)),this.options.showCompass&&(e.$([`_rotateCompassArrow`],this),this._compass=this._createButton(`mapboxgl-ctrl-compass`,e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=s.create(`span`,`mapboxgl-ctrl-icon`,this._compass),this._compassIcon.setAttribute(`aria-hidden`,`true`))}_updateZoomButtons(){let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),n=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute(`aria-disabled`,t.toString()),this._zoomOutButton.setAttribute(`aria-disabled`,n.toString())}_rotateCompassArrow(){let e=this.options.visualizePitch?`scale(${1/Math.cos(this._map.transform.pitch*(Math.PI/180))**.5}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e}onAdd(e){return this._map=e,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._map.on(`rotate`,this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new mo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){s.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._map.off(`rotate`,this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let n=s.create(`button`,e,this._container);return n.type=`button`,n.addEventListener(`click`,t),n}_setButtonTitle(e,t){let n=this._map._getUIString(`NavigationControl.${t}`);e.title=n,e.setAttribute(`aria-label`,n)}},GeolocateControl:class extends e.E{constructor(t){super(),this.options=e.e({},yo,t),e.$([`_onSuccess`,`_onError`,`_onZoom`,`_finish`,`_setupUI`,`_updateCamera`,`_updateMarker`],this)}onAdd(e){var t;return this._map=e,this._container=s.create(`div`,`mapboxgl-ctrl mapboxgl-ctrl-group`),t=this._setupUI,bo===void 0?window.navigator.permissions===void 0?(bo=!!window.navigator.geolocation,t(bo)):window.navigator.permissions.query({name:`geolocation`}).then(e=>{bo=e.state!==`denied`,t(bo)}):t(bo),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),s.remove(this._container),this._map.off(`zoom`,this._onZoom),this._map=void 0,xo=0,So=!1}_isOutOfMapMaxBounds(e){let t=this._map.getMaxBounds(),n=e.coords;return t&&(n.longitudet.getEast()||n.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case`WAITING_ACTIVE`:this._watchState=`ACTIVE_ERROR`,this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-active`),this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-active-error`);break;case`ACTIVE_LOCK`:this._watchState=`ACTIVE_ERROR`,this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-active`),this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-active-error`),this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-waiting`);break;case`BACKGROUND`:this._watchState=`BACKGROUND_ERROR`,this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-background`),this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-background-error`),this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-waiting`)}}_onSuccess(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.o(`outofmaxbounds`,t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case`WAITING_ACTIVE`:case`ACTIVE_LOCK`:case`ACTIVE_ERROR`:this._watchState=`ACTIVE_LOCK`,this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-waiting`),this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-active-error`),this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-active`);break;case`BACKGROUND`:case`BACKGROUND_ERROR`:this._watchState=`BACKGROUND`,this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-waiting`),this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-background-error`),this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-background`)}this.options.showUserLocation&&this._watchState!==`OFF`&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!==`ACTIVE_LOCK`||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove(`mapboxgl-user-location-dot-stale`),this.fire(new e.o(`geolocate`,t)),this._finish()}}_updateCamera(t){let n=new e.Y(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy,i=this._map.getBearing(),a=e.e({bearing:i},this.options.fitBoundsOptions),o=ve.fromLngLat(n,r);this._map.fitBounds(o,a,{geolocateSource:!0})}_updateMarker(t){if(t){let n=new e.Y(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let e=this._map._container.clientHeight/2,t=this._map.unproject([0,e]),n=this._map.unproject([1,e]),r=t.distanceTo(n),i=Math.ceil(2*this._accuracy/r);this._circleElement.style.width=`${i}px`,this._circleElement.style.height=`${i}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(t){if(this._map){if(this.options.trackUserLocation){if(t.code===1){this._watchState=`OFF`,this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-waiting`),this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-active`),this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-active-error`),this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-background`),this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-background-error`),this._geolocateButton.disabled=!0;let e=this._map._getUIString(`GeolocateControl.LocationNotAvailable`);this._geolocateButton.title=e,this._geolocateButton.setAttribute(`aria-label`,e),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&So)return;this._setErrorState()}}this._watchState!==`OFF`&&this.options.showUserLocation&&this._dotElement.classList.add(`mapboxgl-user-location-dot-stale`),this.fire(new e.o(`error`,t)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(t){if(this._container.addEventListener(`contextmenu`,e=>e.preventDefault()),this._geolocateButton=s.create(`button`,`mapboxgl-ctrl-geolocate`,this._container),s.create(`span`,`mapboxgl-ctrl-icon`,this._geolocateButton).setAttribute(`aria-hidden`,`true`),this._geolocateButton.type=`button`,!1===t){e.w(`Geolocation support is not available so the GeolocateControl will be disabled.`);let t=this._map._getUIString(`GeolocateControl.LocationNotAvailable`);this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute(`aria-label`,t)}else{let e=this._map._getUIString(`GeolocateControl.FindMyLocation`);this._geolocateButton.title=e,this._geolocateButton.setAttribute(`aria-label`,e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute(`aria-pressed`,`false`),this._watchState=`OFF`),this.options.showUserLocation&&(this._dotElement=s.create(`div`,`mapboxgl-user-location-dot`),this._userLocationDotMarker=new vo(this._dotElement),this._circleElement=s.create(`div`,`mapboxgl-user-location-accuracy-circle`),this._accuracyCircleMarker=new vo({element:this._circleElement,pitchAlignment:`map`}),this.options.trackUserLocation&&(this._watchState=`OFF`),this._map.on(`zoom`,this._onZoom)),this._geolocateButton.addEventListener(`click`,this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on(`movestart`,t=>{t.geolocateSource||this._watchState!==`ACTIVE_LOCK`||t.originalEvent&&t.originalEvent.type===`resize`||(this._watchState=`BACKGROUND`,this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-background`),this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-active`),this.fire(new e.o(`trackuserlocationend`)))})}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.o(`trackuserlocationstart`));break;case`WAITING_ACTIVE`:case`ACTIVE_LOCK`:case`ACTIVE_ERROR`:case`BACKGROUND_ERROR`:xo--,So=!1,this._watchState=`OFF`,this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-waiting`),this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-active`),this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-active-error`),this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-background`),this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-background-error`),this.fire(new e.o(`trackuserlocationend`));break;case`BACKGROUND`:this._watchState=`ACTIVE_LOCK`,this._geolocateButton.classList.remove(`mapboxgl-ctrl-geolocate-background`),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.o(`trackuserlocationstart`))}switch(this._watchState){case`WAITING_ACTIVE`:this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-waiting`),this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-active`);break;case`ACTIVE_LOCK`:this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-active`);break;case`ACTIVE_ERROR`:this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-waiting`),this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-active-error`);break;case`BACKGROUND`:this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-background`);break;case`BACKGROUND_ERROR`:this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-waiting`),this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-background-error`)}if(this._watchState===`OFF`&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let e;this._geolocateButton.classList.add(`mapboxgl-ctrl-geolocate-waiting`),this._geolocateButton.setAttribute(`aria-pressed`,`true`),xo++,xo>1?(e={maximumAge:6e5,timeout:0},So=!0):(e=this.options.positionOptions,So=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}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(`mapboxgl-ctrl-geolocate-waiting`),this._geolocateButton.setAttribute(`aria-pressed`,`false`),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:$a,ScaleControl:class{constructor(t){this.options=e.e({},Co,t),e.$([`_onMove`,`setUnit`],this)}getDefaultPosition(){return`bottom-left`}_onMove(){wo(this._map,this._container,this.options)}onAdd(e){return this._map=e,this._container=s.create(`div`,`mapboxgl-ctrl mapboxgl-ctrl-scale`,e.getContainer()),this._map.on(`move`,this._onMove),this._onMove(),this._container}onRemove(){s.remove(this._container),this._map.off(`move`,this._onMove),this._map=void 0}setUnit(e){this.options.unit=e,wo(this._map,this._container,this.options)}},FullscreenControl:class{constructor(t){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.`)),e.$([`_onClickFullscreen`,`_changeIcon`],this),`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=s.create(`div`,`mapboxgl-ctrl mapboxgl-ctrl-group`),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display=`none`,e.w(`This device does not support fullscreen mode.`)),this._controlContainer}onRemove(){s.remove(this._controlContainer),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){let e=this._fullscreenButton=s.create(`button`,`mapboxgl-ctrl-fullscreen`,this._controlContainer);s.create(`span`,`mapboxgl-ctrl-icon`,e).setAttribute(`aria-hidden`,`true`),e.type=`button`,this._updateTitle(),this._fullscreenButton.addEventListener(`click`,this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute(`aria-label`,e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?`FullscreenControl.Exit`:`FullscreenControl.Enter`)}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle(`mapboxgl-ctrl-shrink`),this._fullscreenButton.classList.toggle(`mapboxgl-ctrl-fullscreen`),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends e.E{constructor(t){super(),this.options=e.e(Object.create(Eo),t),e.$([`_update`,`_onClose`,`remove`,`_onMouseMove`,`_onMouseUp`,`_onDrag`],this)}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(`mapboxgl-popup-track-pointer`),this._map._canvasContainer.classList.add(`mapboxgl-track-pointer`)):this._map.on(`move`,this._update),this.fire(new e.o(`open`)),this}isOpen(){return!!this._map}remove(){return this._content&&s.remove(this._content),this._container&&(s.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),delete this._map),this.fire(new e.o(`close`)),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.Y.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(`mapboxgl-popup-track-pointer`),this._map._canvasContainer.classList.remove(`mapboxgl-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(`mapboxgl-popup-track-pointer`),this._map._canvasContainer.classList.add(`mapboxgl-track-pointer`)),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let t=document.createDocumentFragment(),n=document.createElement(`body`),r;for(n.innerHTML=e;r=n.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=s.create(`div`,`mapboxgl-popup-content`,this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){this._container&&this._container.classList.add(e)}removeClassName(e){this._container&&this._container.classList.remove(e)}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}_createCloseButton(){this.options.closeButton&&(this._closeButton=s.create(`button`,`mapboxgl-popup-close-button`,this._content),this._closeButton.type=`button`,this._closeButton.setAttribute(`aria-label`,`Close popup`),this._closeButton.innerHTML=`×`,this._closeButton.addEventListener(`click`,this._onClose))}_onMouseUp(e){this._update(e.point)}_onMouseMove(e){this._update(e.point)}_onDrag(e){this._update(e.point)}_update(e){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=s.create(`div`,`mapboxgl-popup`,this._map.getContainer()),this._tip=s.create(`div`,`mapboxgl-popup-tip`,this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(` `).forEach(e=>this._container.classList.add(e)),this._trackPointer&&this._container.classList.add(`mapboxgl-popup-track-pointer`)),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ho(this._lngLat,this._flatPos,this._map.transform)),this._trackPointer&&!e))return;let t=this._pos=this._flatPos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationPoint(this._lngLat));let n=this.options.anchor,r=Oo(this.options.offset);if(!n){let e=this._container.offsetWidth,i=this._container.offsetHeight,a;a=t.y+r.bottom.ythis._map.transform.height-i?[`bottom`]:[],t.xthis._map.transform.width-e/2&&a.push(`right`),n=a.length===0?`bottom`:a.join(`-`)}let i=t.add(r[n]).round();s.setTransform(this._container,`${go[n]} translate(${i.x}px,${i.y}px)`),_o(this._container,n,`popup`)}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(Do);e&&e.focus()}_onClose(){this.remove()}},Marker:vo,Style:zt,LngLat:e.Y,LngLatBounds:ve,Point:e.P,MercatorCoordinate:e.a4,Evented:e.E,PathInterpolator:Ye,config:c,prewarm:function(){ze().acquire(Fe)},clearPrewarmedResources:function(){let e=Re;e&&e.isPreloaded()&&e.numActive()===1&&(e.release(Fe),Re=null)},get accessToken(){return c.ACCESS_TOKEN},set accessToken(e){c.ACCESS_TOKEN=e},get baseApiUrl(){return c.API_URL},set baseApiUrl(e){c.API_URL=e},get workerCount(){return Ie.workerCount},set workerCount(e){Ie.workerCount=e},get maxParallelImageRequests(){return c.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){c.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage(t){e.bv(t)},get workerUrl(){return c.WORKER_URL},set workerUrl(e){c.WORKER_URL=e}};return ko.extend(Ao,{isSafari:e.am,getPerformanceMetrics:e.bq.getPerformanceMetrics}),Ao}),n}))}))()),l=class{static getGPUInfo(e){e||(e=document.createElement(`canvas`).getContext(`webgl2`));let t=e.getExtension(`WEBGL_debug_renderer_info`);return t?this.extractGPUInfo(e.getParameter(t.UNMASKED_RENDERER_WEBGL)):null}static createProgram(e,t,n){let r=e.createProgram(),i=this.createShader(e,e.VERTEX_SHADER,t),a=this.createShader(e,e.FRAGMENT_SHADER,n);if(e.attachShader(r,i),e.attachShader(r,a),e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS)){let t=e.getProgramInfoLog(r);throw e.deleteProgram(r),Error(`Program failed to link: ${t}`)}e.deleteShader(i),e.deleteShader(a);let o={program:r},s=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES);for(let t=0;tr.indexOf(`intel`)?n=null:(n=[`Intel`],0<=r.indexOf(`mobile`)&&n.push(`Mobile`),(0<=r.indexOf(`gma`)||0<=r.indexOf(`graphics media accelerator`))&&n.push(`GMA`),0<=r.indexOf(`haswell`)?n.push(`Haswell`):0<=r.indexOf(`ivy`)?n.push(`HD 4000`):0<=r.indexOf(`sandy`)?n.push(`HD 3000`):0<=r.indexOf(`ironlake`)?n.push(`HD`):(0<=r.indexOf(`hd`)&&n.push(`HD`),(r=r.match(t))&&n.push(r[1].toUpperCase())),n=n.join(` `)),n)return n;if(n=e,0>n.indexOf(`nvidia`)&&0>n.indexOf(`quadro`)&&0>n.indexOf(`geforce`)&&0>n.indexOf(`nvs`))n=null;else{r=[`nVidia`],0<=n.indexOf(`geforce`)&&r.push(`geForce`),0<=n.indexOf(`quadro`)&&r.push(`Quadro`),0<=n.indexOf(`nvs`)&&r.push(`NVS`),n.match(/\bion\b/)&&r.push(`ION`),n.match(/gtx\b/)?r.push(`GTX`):n.match(/gts\b/)?r.push(`GTS`):n.match(/gt\b/)?r.push(`GT`):n.match(/gs\b/)?r.push(`GS`):n.match(/ge\b/)?r.push(`GE`):n.match(/fx\b/)&&r.push(`FX`);let e=n.match(t);e&&r.push(e[1].toUpperCase().replace(`GS`,``)),0<=n.indexOf(`titan`)?r.push(`TITAN`):0<=n.indexOf(`ti`)&&r.push(`Ti`),n=r.join(` `)}if(n)return n;if(r=e,0>r.indexOf(`amd`)&&0>r.indexOf(`ati`)&&0>r.indexOf(`radeon`)&&0>r.indexOf(`firegl`)&&0>r.indexOf(`firepro`))n=null;else{n=[`AMD`],0<=r.indexOf(`mobil`)&&n.push(`Mobility`);let e=r.indexOf(`radeon`);0<=e&&n.push(`Radeon`),0<=r.indexOf(`firepro`)?n.push(`FirePro`):0<=r.indexOf(`firegl`)&&n.push(`FireGL`),0<=r.indexOf(`hd`)&&n.push(`HD`),(r=(0<=e?r.substring(e):r).match(t))&&n.push(r[1].toUpperCase().replace(`HD`,``)),n=n.join(` `)}return n||e.substring(0,100)}},u,d=class{static get isBlacklistDevice(){if(this._isBlacklistDevice===null)try{this._isBlacklistDevice=this.checkBlacklistDevice()}catch(e){this._isBlacklistDevice=!0}return this._isBlacklistDevice}static checkBlacklistDevice(){let e=this.createWebGLContext();if(!e)return!0;try{if(!e.getShaderPrecisionFormat||!e.getParameter||!e.getExtension||!e.getParameter(e.MAX_RENDERBUFFER_SIZE))return!0;let t=e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT),n=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT);return!t||!n||23>t.precision||23>n.precision||this.isBlacklistGraphicCard(l.getGPUInfo(e))}finally{let t=e.getExtension&&e.getExtension(`WEBGL_lose_context`);t&&t.loseContext()}}static isBlacklistGraphicCard(e){if(!e)return!1;let t=this.normalizeGraphicCard(e);return this.BLACKLIST_GRAPHIC_CARDS.some(e=>t.indexOf(this.normalizeGraphicCard(e))>-1)}static normalizeGraphicCard(e){return e.toLowerCase().replace(/\((?:tm|r|c)\)|[™®]/g,` `).replace(/[^a-z0-9]/g,``)}static createWebGLContext(){return document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:!0})}};u=d,u.BLACKLIST_GRAPHIC_CARDS=[`Intel 965GM`,`swiftshader`,`Intel B43`,`software adapter`,`Intel G41`,`llvmpipe`,`Intel G45`,`Intel G965`,`microsoft basic render driver`,`Intel GMA 3600`,`vmware svga 3d`,`Intel Mobile 4`,`Intel Mobile 45`,`Intel Mobile 965`,`Adreno 680`],u._isBlacklistDevice=null;var f=window.naver.maps?window.naver.maps.__export():null;(function(){window.naver&&window.naver.maps&&window.naver.maps.glEnabled||(c.LngLat.prototype.toLatLng=function(){return new f.LatLng(this.lat,this.lng)},c.LngLatBounds.prototype.toLatLngBounds=function(){let e=this.getSouthWest(),t=this.getNorthEast();return f.LatLngBounds.bounds(new f.LatLng(e.lat,e.lng),new f.LatLng(t.lat,t.lng))},f.LatLng.prototype.toLngLat=function(){return new c.LngLat(this.x,this.y)},f.LatLngBounds.prototype.toLngLatBounds=function(){let e=this.getSW().toLngLat(),t=this.getNE().toLngLat();return new c.LngLatBounds(e,t)},f.Point.prototype.toPointGeometry=function(){return new c.Point(this.x,this.y)},f.glSupported=function(){return!d.isBlacklistDevice&&c.supported({failIfMajorPerformanceCaveat:!0})})})();var p=f;f.Position;var m=f.DOM,h=f.DOMEvent;f.Size;var g=f.Point,_=f.LatLng;f.PointBounds,f.LatLngBounds,f.KVO,f.KVOArray,f.Event,f.EPSG3857;var v=f.glSupported,y=function(e){return e.DEV=`DEV`,e.TEST=`TEST`,e.STG=`STG`,e.REAL=`REAL`,e}({}),b=function(e){return e.TILE_IMAGE=`TILE_IMAGE`,e.TILE_PICKER=`TILE_PICKER`,e.INDOOR_MASTER=`INDOOR_MASTER`,e.INDOOR_GROUND_TILE=`INDOOR_GROUND_TILE`,e.COMMANDO=`COMMANDO`,e.WEATHER=`WEATHER`,e.OPEN_API=`OPEN_API`,e.KSA_COMMAND=`KSA_COMMAND`,e.KSA_RTL_TEXT_PLUGIN=`KSA_RTL_TEXT_PLUGIN`,e}({}),x={DEV:{TILE_IMAGE:{source:`https://test-nrb.map.naver.com/styles`},TILE_PICKER:{source:`https://test-nrb.map.naver.com/picker/{type}/{tileVersion}/{z}/{x}/{y}.{format}`},INDOOR_MASTER:{source:`https://test-admin-nvb-map.navercorp.com/indoor/indoor/getMetadata?format=geojson&floorArea=true`},INDOOR_GROUND_TILE:{source:`https://test-nrb.map.naver.com/styles/{type}/{tileVersion}/{z}/{x}/{y}`},COMMANDO:{source:`https://test-cmdo.map.naver.com/v1/test-maps-web-sdk/props`},KSA_COMMAND:{source:`https://global-bff-stage.baladyplus.sa/cmdo/v1/ksa-maps-app/props`},KSA_RTL_TEXT_PLUGIN:{source:`https://ssl.pstatic.net/static/maps/mantle/mapbox-gl-rtl-text@0.3.0/mapbox-gl-rtl-text.js`},WEATHER:{source:`https://test-nws-map.naver.com`},OPEN_API:{source:`https://dev-oapi.map.naver.com`}},TEST:{TILE_IMAGE:{source:`https://test-nrb.map.naver.com/styles`},TILE_PICKER:{source:`https://test-nrb.map.naver.com/picker/{type}/{tileVersion}/{z}/{x}/{y}.{format}`},INDOOR_MASTER:{source:`https://test-admin-nvb-map.navercorp.com/indoor/indoor/getMetadata?format=geojson&floorArea=true`},INDOOR_GROUND_TILE:{source:`https://test-nrb.map.naver.com/styles/{type}/{tileVersion}/{z}/{x}/{y}`},COMMANDO:{source:`https://cmdo.map.naver.com/v1/test-maps-web-sdk/props`},KSA_COMMAND:{source:`https://global-bff-stage.baladyplus.sa/cmdo/v1/ksa-maps-app/props`},KSA_RTL_TEXT_PLUGIN:{source:`https://ssl.pstatic.net/static/maps/mantle/mapbox-gl-rtl-text@0.3.0/mapbox-gl-rtl-text.js`},WEATHER:{source:`https://test-nws-map.naver.com`},OPEN_API:{source:`https://test-oapi.map.naver.com`}},STG:{TILE_IMAGE:{source:`https://map.pstatic.net/nrb/styles`},TILE_PICKER:{source:`https://map.pstatic.net/nrb/picker/{type}/{tileVersion}/{z}/{x}/{y}.{format}`},INDOOR_MASTER:{source:`https://map.pstatic.net/nvbpc/indoor/indoor/getMetadata?format=geojson&floorArea=true`},INDOOR_GROUND_TILE:{source:`https://map.pstatic.net/nrb/styles/{type}/{tileVersion}/{z}/{x}/{y}`},COMMANDO:{source:`https://cmdo.map.naver.com/v1/stg-maps-web-sdk/props`},KSA_COMMAND:{source:`https://global-bff-stage.baladyplus.sa/cmdo/v1/ksa-maps-app/props`},KSA_RTL_TEXT_PLUGIN:{source:`https://map-static.baladyplus.net/openapi-map/v4/static/mapbox/mapbox-gl-rtl-text@0.3.0/mapbox-gl-rtl-text.js`},WEATHER:{source:`https://map.pstatic.net/nws`},OPEN_API:{source:`https://stg-oapi.map.naver.com`}},REAL:{TILE_IMAGE:{source:`https://map.pstatic.net/nrb/styles`},TILE_PICKER:{source:`https://map.pstatic.net/nrb/picker/{type}/{tileVersion}/{z}/{x}/{y}.{format}`},INDOOR_MASTER:{source:`https://map.pstatic.net/nvbpc/indoor/indoor/getMetadata?format=geojson&floorArea=true`},INDOOR_GROUND_TILE:{source:`https://map.pstatic.net/nrb/styles/{type}/{tileVersion}/{z}/{x}/{y}`},COMMANDO:{source:`https://cmdo.map.naver.com/v1/maps-web-sdk/props`},KSA_COMMAND:{source:`https://global-bff.baladyplus.sa/cmdo/v1/ksa-maps-app/props`},KSA_RTL_TEXT_PLUGIN:{source:`https://map-static.baladyplus.net/openapi-map/v4/static/mapbox/mapbox-gl-rtl-text@0.3.0/mapbox-gl-rtl-text.js`},WEATHER:{source:`https://map.pstatic.net/nws`},OPEN_API:{source:`https://oapi.map.naver.com`}}},S=class e{static getInstance(){return e.instance||(e.instance=new e),e.instance}constructor(){let e=this.getNodeEnv(),t=this.createServerPhaseBy(e);this.init(t)}createServerPhaseBy(e){let t;return t=e===`development`?`TEST`:e.indexOf(`internal`)===0?e.replace(`internal-`,``).toUpperCase():`REAL`,t}init(e){e!==void 0&&this.setServerPhase(e)}getNodeEnv(){return`production`}static setServerPhase(e){this.getInstance().serverPhase=e}static getPath(e,t){return this.getInstance().getPath(this.getInstance().serverPhase,e,t)}static getTestPath(e){return this.getInstance().getTestPath(this.getInstance().serverPhase,e)}static getServerPhase(){return this.getInstance().serverPhase}getPath(e,t,n){let r=x[e];return r?r[t]&&r[t].source?this.composePath(r[t].source,n):r.extends?this.getPath(r.extends,t,n):``:``}getTestPath(e,t){let n=x[e];return n?n[t]&&n[t].source&&n[t].test?n[t].ignoreTest?``:this.composePath(n[t].source,n[t].test):n.extends?this.getTestPath(n.extends,t):``:``}composePath(e,t){let n=e;for(let e in t)n=n.replace(`{${e}}`,t[e]);return n=n.replace(`{cache}`,``+Math.random()),n}setServerPhase(e){this.serverPhase=e}},C={CENTER:0,TOP_LEFT:1,TOP_CENTER:2,TOP_RIGHT:3,LEFT_CENTER:4,LEFT_TOP:5,LEFT_BOTTOM:6,RIGHT_TOP:7,RIGHT_CENTER:8,RIGHT_BOTTOM:9,BOTTOM_LEFT:10,BOTTOM_CENTER:11,BOTTOM_RIGHT:12},w={KOREAN:`ko`,ENGLISH:`en`,CHINESE:`zh`,JAPANESE:`ja`},T={contextmenu:`rightclick`};(window.location.host+``).split(`:`)[0];var E=window.location.href+``,D=window.location.protocol.indexOf(`https`)===0,O=E.indexOf(`local`)>-1;E.indexOf(`mantle_debug=true`);var k=(window.devicePixelRatio||1)>1?2:1,A=(D?`https://ssl.pstatic.net/static`:`http://static.naver.net`)+`/maps/mantle/`+k+`x`;A+``;var j=D?`https://nrbe.pstatic.net/styles`:`http://nrbe.map.naver.net/styles`,ee=p.IS_IN_HOUSE?S.getPath(b.TILE_IMAGE):j,te=`https://map.pstatic.net/nrs/api/v1/raster/satellite/metadata`,ne=`https://map.pstatic.net/nrs/api/v1/raster/satellite`;p.MIN_API_CONTROL_ZINDEX=1;var re=`© NAVER Corp.`,ie=`Point`,ae=`LineString`,oe=`Polygon`,se=`Feature`,ce=`FeatureCollection`,le=`basic`,ue=`terrain`,de=`satellite`,fe=`dbasic`,M=`nrs-satellite`,N=`dterrain`,P={NORMAL:`normal`,TERRAIN:`terrain`,SATELLITE:`satellite`,HYBRID:`hybrid`,DARK:`dark`,DARK_TERRAIN:`dark_terrain`,WEATHER:`weather`,WEATHER_GRAYSCALE:`weathergrayscale`,WEATHER_BASIC:`weatherbasic`},F={CCTV:`cctv`,BICYCLE:`bicycle`,STREET:`street`,MOUNTAIN:`mountain`,CADASTRAL:`cadastral`,TRAFFIC:`traffic`,TRANSIT:`transit`,INDOOR_GND:`indoor_gnd`,INDOOR_TILE_MAP:`indoor_tile_map`,INDOOR_POI:`indoor_poi`,INDOOR_VIEW:`indoorview`,INDOOR_VIEW_DARK:`indoorview_dark`,INDOOR:`indoor`,AD_INDOOR:`ad&indoor`,REALTY:`realty`},I={BACKGROUND:`bg`,OVERLAY:`ol`,OVERLAY_HYBRID:`oh`,POI_KOREAN:`lko`,POI_ENGLISH:`len`,POI_CHINESE:`lzh`,POI_JAPANESE:`lja`,BYCYCLE:`br`,PANORAMA:`pr`,STREET:`ps`,CADASTRAL:`lp`,HIKING_TRAIL:`ar`,CTT:`ctt`,SUBWAY:`sw`,TRANSIT:`ts`,BUS_STATION:`bs`,INDOOR:`ib`,CCTV:`cctv`,REALTY_RAIL:`rtrl`,REALTY_ROAD:`rtrd`,REALTY_REGION:`rtrg`},pe=[`bg`,`ol`,`sw`,`bs`,`ts`,`ps`,`pr`,`br`,`ar`,`rtrl`,`rtrd`,`rtrg`,`lp`,`ctt`,`cctv`,`lko`,`len`,`lzh`,`lja`,`ib`],L=function(e){return e.VECTOR=`vector`,e.HYBRID=`hybrid`,e}({}),me=function(e){return e.POI=`poi4osm`,e.BUS=`bus`,e.INDOOR_GND=`indoorgnd`,e.INDOOR_POI=`indoor_poi`,e}({}),he={poi4osm:`POI`,cctv:`CCTV`,airview:`PANORAMA`,bus:`TRANSIT`,indoorgnd:`indoorMaster`,indoor_poi:`INDOOR_POI`},R=`AD_POI`,z=[`place`,`subwayStation`,`subwayStationTransfer`],B={click:`overlay_click`,dblclick:`overlay_dblclick`,rightclick:`overlay_rightclick`,mousemove:`overlay_mousemove`},ge=Object.keys(B),_e=k>1?`@2x`:``,V=`__windLayer`,ve={type:`FeatureCollection`,features:[]},H=function(e){return e.DEFAULT=`default`,e.OVERLAY=`overlay`,e.TRANSIT_BUS=`transit_bus`,e.TRANSIT_SUBWAY=`transit_subway`,e.POI_CI=`poi_ci`,e.POI=`poi`,e.BUILDING_3D=`building_3d`,e.REALTY=`realty`,e.REALTY_RAIL=`realty_rail`,e.REALTY_REGION=`realty_region`,e.REALTY_ROAD=`realty_road`,e.AD=`ad`,e.AD_INDOOR=`ad&indoor`,e.LANDPARCEL=`landparcel`,e.MOUNTAIN=`mountain`,e.INDOOR=`indoor`,e.INDOORGND=`indoorgnd`,e.INDOOR_POI=`indoor_poi`,e.CCTV=`cctv`,e.PANORAMA=`panorama`,e.BIKE=`bike`,e.CTT=`ctt`,e.TRANSIT=`transit`,e.TRANSIT_EMPHASIS=`transit_emphasis`,e.SUBWAY=`subway`,e.BUILDING=`building`,e.BUILDING_2D_ONLY=`building_2d_only`,e.BUILDING_HAS_3D=`building_has_3d`,e.DATA_ADMIN=`data_admin`,e.DATA_INDOOR_FLOOR=`data_indoor_floor`,e.DATA_INDOOR_MASTER=`data_indoor_master`,e.MESH_OBJECT_BUILDING=`mesh_object_building`,e.QIBLA=`qibla`,e}({});function ye(e){"@babel/helpers - typeof";return ye=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ye(e)}function be(e,t){if(ye(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(ye(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function xe(e){var t=be(e,`string`);return ye(t)==`symbol`?t:t+``}function Se(e,t,n){return(t=xe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t{if(Object.getOwnPropertyNames)for(let n of t){let t=Object.getOwnPropertyNames(n.prototype);for(let r of t)e.prototype[r]||(e.prototype[r]=n.prototype[r])}return e},Ee=(e,t,n,r=``)=>{for(let i of n)e[i]=t[i+r]},De=(e,t)=>{let n=e;for(let e in t)n=n.replace(`{${e}}`,t[e]);return n},Oe=(((we=navigator)==null||(we=we.userAgentData)==null?void 0:we.platform)||navigator.platform).toLowerCase(),ke=navigator.userAgent.toLowerCase(),Ae=navigator.vendor.toLowerCase(),je=()=>/win/.test(Oe),Me=()=>/mac/.test(Oe),Ne=()=>/edg/.test(ke),Pe=()=>/chrome/.test(ke)&&/google/.test(Ae),Fe=(e,t,n,r=64)=>{let i=[],a=111320*Math.cos(e.y*Math.PI/180),o,s,c,l=n/110574,u=t/a;for(let t=0;t{let n=Math.PI/180,r=e.lat()*n,i=t.lat()*n,a=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((t.lng()-e.lng())*n);return 6371e3*Math.acos(Math.min(a,1))},Le=e=>{let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a[0]),n=Math.min(n,a[1]),r=Math.max(r,a[0]),i=Math.max(i,a[1]);return[t,n,r,i]},Re=e=>Array.isArray(e)||e instanceof p.Point||e instanceof p.PointBounds?!1:`center`in e||`zoom`in e||`around`in e||`bearing`in e||`rotation`in e||`pitch`in e||`tilt`in e,ze=e=>`duration`in e||`easing`in e||`offset`in e||`animate`in e,Be=e=>`top`in e||`left`in e||`right`in e||`bottom`in e||`maxZoom`in e,Ve=e=>{let t=U({},e);return e.center&&e.center instanceof p.LatLng&&(t.center=e.center.toLngLat()),e.around&&e.around instanceof p.LatLng&&(t.around=e.around.toLngLat()),`tilt`in e&&(t.pitch=e.tilt),`rotation`in e&&(t.bearing=e.rotation),t},W=e=>{let t={},{easing:n,duration:r}=e;if(p.hasValue(r)&&(t.duration=r),n&&p.isString(n))switch(n){case`linear`:t.easing=e=>e;break;case`easeInCubic`:t.easing=e=>e*e*e;break;case`easeOutCubic`:t.easing=e=>--e*e*e+1;break;default:delete e.easing}return t},He=e=>{let t={padding:{left:0,right:0,bottom:0,top:0}};return`left`in e&&(t.padding.left=e.left),`right`in e&&(t.padding.right=e.right),`top`in e&&(t.padding.top=e.top),`bottom`in e&&(t.padding.bottom=e.bottom),`maxZoom`in e&&(t.maxZoom=e.maxZoom),t},Ue=(e,t)=>{let n=null,r=t[`map-types`];switch(e){case P.NORMAL:case P.WEATHER_BASIC:n=r.basic;break;case P.TERRAIN:n=r.terrain;break;case P.SATELLITE:n=r.satellite;break;case P.HYBRID:var i;n=(i=r.satellite_overlay)==null?r.satellite:i;break;case P.DARK:n=r.dbasic;break;case P.DARK_TERRAIN:n=r.dterrain;break;case P.WEATHER:n=r.weather;break;case P.WEATHER_GRAYSCALE:n=r.grayscale}return n&&n.categories?n.categories:{}},We=(e,t)=>{let n=null;for(let r=0,i=t.length;r{let t=-1,n,r,i=e.layers,a=i.length;for(let e=a-1;e>=0;e--){let n=i[e];if(n.layout.visibility===`visible`&&ct(n)){t=e;break}}if(t>=0)for(let e=t;eqe(e,t)||Je(e,t)||Ye(e,t),qe=(e,t)=>{var n;return((n=e[H.DEFAULT])==null?void 0:n.indexOf(t))>=0},Je=(e,t)=>{var n;return((n=e[H.OVERLAY])==null?void 0:n.indexOf(t))>=0},Ye=(e,t)=>{var n;return((n=e[H.TRANSIT_SUBWAY])==null?void 0:n.indexOf(t))>=0},Xe=(e,t)=>{var n;return((n=e[H.POI])==null?void 0:n.indexOf(t))>=0},Ze=(e,t)=>{var n;return((n=e[H.TRANSIT_BUS])==null?void 0:n.indexOf(t))>=0},Qe=(e,t)=>{var n;return((n=e[H.LANDPARCEL])==null?void 0:n.indexOf(t))>=0},$e=(e,t)=>{var n;return((n=e[H.MOUNTAIN])==null?void 0:n.indexOf(t))>=0},et=(e,t)=>{var n;return((n=e[H.MOUNTAIN])==null?void 0:n.indexOf(`!${t}`))>=0},tt=(e,t)=>{var n;return((n=e[H.INDOORGND])==null?void 0:n.indexOf(t))>=0},nt=(e,t)=>{var n,r;return((n=e[H.INDOOR])==null?void 0:n.indexOf(t))>=0||((r=e[H.INDOOR_POI])==null?void 0:r.indexOf(t))>=0},rt=(e,t)=>{var n;return((n=e[H.PANORAMA])==null?void 0:n.indexOf(t))>=0},it=(e,t)=>{var n;return((n=e[H.CCTV])==null?void 0:n.indexOf(t))>=0},at=(e,t)=>{var n;return((n=e[H.BIKE])==null?void 0:n.indexOf(t))>=0},ot=(e,t)=>{var n;return((n=e[H.REALTY])==null?void 0:n.indexOf(t))>=0},st=e=>!e.metadata.group&&ct(e),ct=e=>e.metadata&&e.metadata[`overlay-layer`]===`under-symbol`,lt=/^([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,ut=[1,1,1,1],dt=e=>{let t=typeof e==`string`?e.replace(`#`,``):``;if(!lt.test(t))return ut.slice();let n=t.length<=4?1:2,r=[];for(let e=0;e<4;e++){let i=t.substring(e*n,(e+1)*n),a=i?parseInt(n===1?i+i:i,16):255;r.push(a/255)}return r};function ft(e,t,n,r){let i=new pt(e,t,n,r);return function(e){return i.solve(e)}}function pt(e,t,n,r){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=r}pt.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;let n=e,r,i;for(let a=0;a<8;a++){if(r=this.sampleCurveX(n)-e,Math.abs(r)r?a=n:o=n,n=(o-a)*.5+a;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var mt=[`A`,`AREA`,`BUTTON`,`EMBED`,`INPUT`,`OBJECT`,`SELECT`,`TEXTAREA`],ht=.3,gt=ft(0,0,ht,1),_t=1400,vt=2500,yt=class extends p.MapAction{constructor(e){super(e),this.filterLayers=[],p.forEach(ge,e=>{this._listeningEvents[e]=!0});let t=e.get(`disableRotateTilt`);e.set(`disableRotateTilt`,!p.hasValue(t)||t),this.bindTo([`scrollWheel`,`disableDoubleClickZoom`,`disableRotateTilt`,`zoomOrigin`],e)}destroy(){this._unlistenMapbox(),super.destroy()}setMapModel(e){super.setMapModel(e),this.bindTo(`mapbox`,e),this._listenMapbox()}addFilterLayer(e){let t=Array.isArray(e)?e:[e];p.forEach(t,e=>{this.filterLayers.indexOf(e)<0&&this.filterLayers.push(e)})}removeFilterLayer(e){let t=Array.isArray(e)?e:[e];p.forEach(t,e=>{let t=this.filterLayers.indexOf(e);t>=0&&this.filterLayers.splice(t,1)})}panToBounds(e,t,n){let r=this.get(`mapbox`);r&&r.fitBounds([e.minX(),e.minY(),e.maxX(),e.maxY()],U(U({},t),{},{padding:n,linear:!0}))}panTo(e,t){let n=this.get(`mapbox`);n&&(p.Event.trigger(this,`panning`),n.panTo(e.toLngLat(),t))}panBy(e,t,n){let r=this.get(`mapbox`);r&&r.panBy([e.x,e.y],p.extend({animate:!1},t),n)}zoomBy(e,t,n){let r=this.get(`zoom`)+e;return t=t?p.box(t,_):this.get(`center`),this.easeTo({around:t,zoom:r,animate:!!n}),!0}setZoom(e,t){if(!this.get(`mapbox`))return!1;let n=this.get(`zoom`),r=this._mapModel.getValidDeltaZoom(e-n),i=n+r;if(i===n||!this._mapModel.isValidZoom(i))return!1;let a=this.get(`mapSystemProjection`),o=this._getZoomOrigin()||this._mapModel.getCenterPixel();return this.zoomBy(r,a.fromOffsetToCoord(o),t),!0}jumpTo(e){this._mapModel&&this._mapModel.jumpTo(e)}easeTo(e){let t=this.get(`mapbox`);t&&t.easeTo(Ve(e))}setView(e,t,n){let r=this.get(`mapbox`);if(!r)return;let i=e.toLngLat(),{x:a,y:o}=r.project(i),s=this.get(`rotation`);r.fitScreenCoordinates([a-1,o-1],[a+1,o+1],s,U(U({},n),{},{maxZoom:t}))}stopEasing(){let e=this.get(`mapbox`);e&&e.stop()}isZooming(){let e=this.get(`mapbox`);return e?e.isZooming():!1}isTranRunning(e){let t=this.get(`mapbox`);return t?t.isMoving():!1}isDragging(){return this._isMapDragging}containerTopLeft_changed(e){}zoomingBy(){}initZoomEffector(){}_listenMapbox(){let e=this.get(`mapbox`);if(!e)return;this._unlistenMapbox();let t=this.handleEvent.bind(this),n=(n,r)=>{let i=r?r.bind(this):t;return e.on(n,i),{type:n,listener:i}};this._mapboxListeners=[n(`webglcontextlost`,this.handleWebGLContext),n(`webglcontextrestored`,this.handleWebGLContext),n(`idle`,this._onIdle),n(`render`,this._onRender),n(`zoomstart`,this._onZoomStart),n(`zoom`,this._onZoom),n(`zoomend`),n(`touchcancel`),n(`render`),n(`error`),n(`load`),n(`movestart`),n(`move`),n(`moveend`,this._onMoveEnd),n(`dragend`),n(`dragstart`),n(`drag`)]}_getTransform(){let e=this.get(`mapbox`);if(e)return e.transform}_transformSetLocationAtPoint(e,t){let n=this._getTransform();if(!n)return;let r=e.toPointGeometry?e.toPointGeometry():e,i=t.toPointGeometry?t.toPointGeometry():t;n.setLocationAtPoint(r,i)}_transformPointLocation(e){let t=this._getTransform();if(t)return t.pointLocation(e.toPointGeometry?e.toPointGeometry():e)}_transformScaleZoom(e){let t=this._getTransform();return t&&t.scaleZoom(e)||1}_unlistenMapbox(){let e=this.get(`mapbox`);if(!e)return;let t=this._mapboxListeners;if(t){for(let n of t)e.off(n.type,n.listener);this._mapboxListeners=[]}}_getPointerEvent(e,t){let n=e.target===this.get(`mapbox`)?e:null,r=null;if(n&&`lngLat`in n)r={},r.type=n.type,r.originalEvent=n.originalEvent,n.type&&n.type.indexOf(`key`)===0?r.keyboardEvent=r.originalEvent:(r.pointerEvent=n.originalEvent,r.offset=n.point,r.coord=n.lngLat.toLatLng(),r.latlng=r.coord.clone(),r.point=this.get(`mapSystemProjection`).fromCoordToPoint(r.coord));else{if(n){if(n.originalEvent)r=super._getPointerEvent(n.originalEvent,t),r.originalEvent=n.originalEvent;else{r={};for(let e in n)e!==`target`&&(r[e]=n[e])}}else r=super._getPointerEvent(e,t);if(r)delete r.domEvent;else return e}return r}__fireMapboxEvent(e,t){let n=this.get(`mapbox`);n&&n.fire(t||e.type,{originalEvent:e})}_isRotateAction(e){if(this.get(`disableRotateTilt`))return!1;let t=e.which,n=this.get(`shiftKey`);return n&&t===h.MOUSE_LBUTTON||!n&&t===h.MOUSE_RBUTTON}_initDrag(){super._initDrag(),delete this._startPoint,delete this._startTilt,delete this._startRotation,this._dragRotating=!1,this._dragTilting=!1,this._inertia=null}_drainInertiaBuffer(){let e=this._inertia;if(!e)return;let t=Date.now();for(;e.length>0&&t-e[0][0]>160;)e.shift()}_getMouseOffset(e){let t=this._mapView.get(`mapDiv`),n=t.getBoundingClientRect(),r=e.touches?e.touches[0]:e;return new p.Point(r.clientX-n.left-t.clientLeft,r.clientY-n.top-t.clientTop)}handleEvent(e,t){t=t||e.type;let n=!e;if(e&&this._listeningEvents[t]&&(n=!0),!n)return;if(t.indexOf(`zoom`)>-1){p.Event.trigger(this,t);return}let r=[t],i=null;if(e&&(i=this._getPointerEvent(e,t),r.push(i)),!(ge.indexOf(t)>=0&&!this._isMapCanvasEvent(i))){if(!(this.isDragging()||this.isTranRunning())&&i&&this.filterLayers&&this.filterLayers.length>0&&ge.indexOf(t)>=0){let{offset:e}=i,n=this._map,a=this.filterLayers,o=this.get(`mapbox`).queryRenderedFeatures([e.x,e.y]),s=o.filter(e=>a.indexOf(e.layer.id)>=0),c=o&&o.length>0?o[0].layer.id:``;if(c&&a.indexOf(c)>=0){let e=s.length>0?s[0].properties.__overlayId:``,i=e&&n.getOverlayManager().get(e);if(i&&i.getClickable()){let e=B[t];r[0]=e,r[1].type=e}}}i&&p.Agent.mobile&&t===`click`&&this._triggerTap(i),this.trigger.apply(this,r)}}_isMapCanvasEvent(e){let t=e&&e.originalEvent,n=t&&t.target;if(!n)return!0;let r=this.get(`mapbox`),i=r&&r.getCanvasContainer(),a=this._map&&this._map.getPanes().floatPane,o=n;for(;o&&o!==i;){if(o.__clickable===!1)return!0;if(o.__clickable||o===a||mt.indexOf(o.tagName)>-1)return!1;o=o.parentElement}return!0}handleWebGLContext(e){p.Event.trigger(this,e.type,e)}_onUp(e){this._dragTilting&&this.handleEvent(e,`tiltend`),this._dragRotating&&this.handleEvent(e,`rotateend`),super._onUp(e)}_onDblClick(e){if(this.handleEvent(e,`dblclick`),this.get(`disableDoubleClickZoom`))return;let t=this.get(`mapSystemProjection`),n=this._getZoomOrigin(e);this.zoomBy(1,t.fromOffsetToCoord(n),!0)}_onDragReady(e){if(this._prevPinch)return;this.kineticPan(null),this._down&&this._initDrag(),this._down=!0;let t=this._getMouseOffset(e);this._startPoint=t.clone(),this._startTilt=this.get(`tilt`),this._startRotation=this.get(`rotation`),this._dragTilting=!1,this._dragRotating=!1,this._inertia=[[Date.now(),t.toPointGeometry()]]}_onDrag(e){if(!this._down)return;let t=this._getMouseOffset(e);this._isRotateAction(e)?this._rotateOrTilt(e):this._drag(e),this._drainInertiaBuffer(),this._inertia.push([Date.now(),t.toPointGeometry()])}_onDragEnd(e){let t=this.get(`disableKineticPan`);this.__fireMapboxEvent(e,`dragend`),this._drainInertiaBuffer();let n=()=>{this.__fireMapboxEvent(e,`moveend`),this._initDrag()},r=this._inertia;if(r.length<2){n();return}let i=r[r.length-1],a=r[0],o=i[1].sub(a[1]),s=(i[0]-a[0])/1e3;if(t||s===0||i[1].equals(a[1])){n();return}let c=o.clone().mult(ht/s),l=c.mag();l>_t&&(l=_t,c=c.unit().mult(l));let u=l/(vt*ht),d=c.mult(-u/2);this.panBy(d,{animate:!0,duration:u*1e3,easing:e=>gt(e)},{originalEvent:e}),this._initDrag()}_drag(e){let t=this._getMouseOffset(e).clone(),n=this._inertia[this._inertia.length-1][1],r=new p.Point(n.x,n.y);if(!this._isMapDragging){if(r=this._startPoint.clone(),p.Math.distance(r,t)<4)return;this.__fireMapboxEvent(e,`dragstart`),this.__fireMapboxEvent(e,`movestart`),this._isMapDragging=!0}this.stopEasing(),this._transformSetLocationAtPoint(this._transformPointLocation(r.toPointGeometry()),t.toPointGeometry()),this.__fireMapboxEvent(e,`drag`),this.__fireMapboxEvent(e,`move`)}_rotateOrTilt(e){let t=this._getMouseOffset(e),n=t.clone(),r=this._inertia[this._inertia.length-1][1],i=new p.Point(r.x,r.y),a=n.clone().sub(i);a.x=(a.x>0?1:-1)*Math.min(Math.abs(a.x),10);let o=this.get(`tilt`);o=Math.min(60,Math.max(0,o-a.y));let s=this.get(`size`).height/2;t.y{let r=new Image;r.crossOrigin=`Anonymous`,r.onload=e=>{t(r)},r.onerror=e=>{n(e)},r.src=e})}static loadArraybuffer(e){return new Promise((t,n)=>{let r=new XMLHttpRequest;r.open(`GET`,e,!0),r.responseType=`arraybuffer`,r.withCredentials=!1,r.onerror=e=>n(`arraybuffer loading fail.`),r.onload=e=>{if(r.response.byteLength===0&&r.status===200){t(r.response);return}r.status>=200&&r.status<300&&r.response?t(r.response):n(r.statusText)},r.send()})}static loadJSON(e,t){return new Promise((n,r)=>{let i=new XMLHttpRequest;i.open(`GET`,e,!0),i.setRequestHeader(`Accept`,`application/json`),i.onerror=e=>r(`JSON loading fail.`),i.onload=a=>{if(i.status>=200&&i.status<300&&i.response){let a;try{a=JSON.parse(i.response)}catch(e){r(`JSON parsing error.`);return}n(a),t&&t(e,a)}else r(i.statusText)},i.send()})}},xt={title:`NAVER`,link:`https://navercorp.com`},St={title:`OpenStreetMap`,area:p.SOUTH_KOREA_AREA,link:`http://www.openstreetmap.org/copyright`,exclude:!0},Ct=[{title:`OpenStreetMap`,link:`http://www.openstreetmap.org/copyright`},{title:`Natural Earth`,link:`http://www.naturalearthdata.com/`}],wt=[xt,St],Tt=[xt,St,{title:`국토지리정보원`,bounds:[p.LatLngBounds(p.LatLng(36.9604682,126.7654746),p.LatLng(38.1834428,127.8062689)),p.LatLngBounds(p.LatLng(33.1940984,126.1631646),p.LatLng(33.5666617,126.9448023)),p.LatLngBounds(p.LatLng(34.2894075,126.1667903),p.LatLng(36.157058,127.916409)),p.LatLngBounds(p.LatLng(37.0338716,127.1017059),p.LatLng(38.6097027,129.4009515)),p.LatLngBounds(p.LatLng(34.7636795,127.5739401),p.LatLng(37.1422076,129.6170151)),p.LatLngBounds(p.LatLng(37.2844933,130.6524052),p.LatLng(37.6950155,131.0788897)),p.LatLngBounds(p.LatLng(35.9625217,125.5567761),p.LatLng(37.2537581,128.6557701))]}],Et=[{title:`서울시설공단`},{title:`국토교통부`},{title:`경기도교통정보센터`}],Dt,Ot=21,kt=(e,t)=>{let{url:n}=t,r=`nrb/styles`;if(!(n.indexOf(r)>-1))return!0;let i=`${r}/${{[P.NORMAL]:le,[P.TERRAIN]:ue,[P.SATELLITE]:de,[P.HYBRID]:de,[P.DARK]:fe,[P.DARK_TERRAIN]:N}[e]}`,a=`mt=${I.INDOOR}`;return n.indexOf(a)>-1?[P.NORMAL,P.TERRAIN,P.DARK,P.DARK_TERRAIN].indexOf(e)>-1:n.indexOf(i)>-1},At=(e,t,n)=>{let r=n==null?void 0:n.useRealty,i=p.clone(t);(e!==P.NORMAL||!r)&&delete i.tilemap_realty_basic,i.indoorgnd&&(i.indoorgnd.promoteId=`id`);let a={ko:`ko-KR`,ja:`ja-JP`,en:`en-UK`,zh:`zh-CN`},o=i.poi4osm;if(o){let e=p.USER_LANGUAGE,t=a[w.KOREAN],n=a[e],r=t;e&&n&&n!==t&&(r+=`,${n}`);let i=new URL(o.url);i.searchParams.delete(`contentLanguage`),i.searchParams.append(`contentLanguage`,r),o.url=decodeURIComponent(i.href)}let s=[];return p.forEach(i,(t,n)=>{t.type===`raster`&&(kt(e,t)||s.push(n),_e||(t.url=t.url.replace(`@2x`,_e)))}),p.forEach(s,e=>{delete i[e]}),i},jt=(e,t,n,r)=>{if(!t)return[];let i=r==null?void 0:r.useAdvertisement,a=r==null?void 0:r.useRealty,o=[H.BUILDING_3D,H.POI_CI];a||o.push(H.REALTY,H.REALTY_RAIL,H.REALTY_REGION,H.REALTY_ROAD),e===P.SATELLITE&&o.push(H.TRANSIT_BUS,H.TRANSIT_SUBWAY,H.OVERLAY,H.POI);let s=e===P.SATELLITE?[H.DEFAULT]:[H.DEFAULT,H.OVERLAY,H.TRANSIT_SUBWAY,H.POI];i&&s.push(H.AD);let c=t.categories,l=[],u=[],d=e=>u.indexOf(e)>=0;return p.forEach(Object.keys(c),e=>{var t;((t=c[e])==null?void 0:t.length)===0||o.indexOf(e)>=0||u.push(...c[e])}),p.forEach(n,e=>{let{metadata:t}=e;if(!t)return;let n=U(U({},e),{},{layout:U({},e.layout),paint:U({},e.paint)});if(st(n)){n.layout.visibility=`visible`,l.push(n);return}let r=t.group;if(d(r)){n.layout.visibility=`none`;for(let e=0,t=s.length;e=0){n.layout.visibility=`visible`;break}}n.type===`symbol`&&(it(c,r)||rt(c,r))&&n.layout[`icon-allow-overlap`]&&(n.layout[`icon-always-allow-overlap`]=!0),n.id.indexOf(`시각단서`)>=0&&n.type===`fill`&&(n.paint=U(U({},n.paint),{},{"fill-color-transition":{duration:0,delay:0},"fill-color":[`case`,[`boolean`,[`feature-state`,`hover`],!1],`#d1b8ee`,`#ebe4f3`],"fill-opacity":[`case`,[`boolean`,[`feature-state`,`hover`],!1],.5,.4]})),l.push(n)}}),l},Mt=()=>{if(p.IS_IN_HOUSE)return S.getPath(b.COMMANDO);let e=p.NCP_KEY_ID,t=p.NCP_ENV,n=p.LOCATION_REAL_URL,r=new Date().getTime(),i=`${S.getPath(b.OPEN_API)}/v3/props`+(e?`?ncpKeyId=`+e:``)+(t?`&env=`+t:``)+`&url=`+encodeURIComponent(n)+`&time=`+r;return D?i:i.replace(`https://`,`http://`)},Nt=class e extends p.NaverStyleMapTypeOptions{constructor(e){super(e),this.projection=p.EPSG3857}static loadStyles(e,t=!1,n=!1,r=!1){return new Promise((i,a)=>{G.loadJSON(Mt()).then(o=>{let{styleUrls:{default:s,hybrid:c,minimap:l},emergency:u}=o,d=e===L.VECTOR?s:c,f=t?l:d,m=u==null?void 0:u.limitZoom;return p.IS_IN_HOUSE&&u!=null&&u.status?a({limitZoom:m}):f?G.loadJSON(f).then(e=>{if(this.USE_COMPLETE_FONT=!!(e.metadata&&e.metadata[`fallback-glyphs`]),t){let{layers:t,sources:n,metadata:r}=e;return delete e.sources.ctt,this.WEATHER_MAP_STYLES.NORMAL=U(U({},e),{},{name:P.WEATHER,layers:jt(P.NORMAL,r[`map-types`].weather,t)}),this.WEATHER_MAP_STYLES.GRAYSCALE=U(U({},e),{},{name:P.WEATHER_GRAYSCALE,layers:jt(P.NORMAL,r[`map-types`].grayscale,t)}),this.WEATHER_MAP_STYLES.SATELLITE=U(U({},e),{},{name:P.SATELLITE,layers:jt(P.SATELLITE,r[`map-types`].satellite,t)}),this.WEATHER_MAP_STYLES.BASIC=U(U({},e),{},{name:P.WEATHER_BASIC,sources:At(P.NORMAL,n),layers:jt(P.WEATHER_BASIC,r[`map-types`].basic,t)}),i({limitZoom:m})}let{metadata:a,sources:o,layers:s}=e,{basic:c,satellite:l,satellite_overlay:u,terrain:d,dbasic:f,dterrain:p}=a[`map-types`],h=U(U({},e),{},{name:P.NORMAL,sources:At(P.NORMAL,o,{useRealty:r}),layers:jt(P.NORMAL,c,s,{useAdvertisement:n,useRealty:r})}),g=U(U({},e),{},{name:P.TERRAIN,sources:At(P.TERRAIN,o),layers:jt(P.TERRAIN,d,s)}),_=U(U({},e),{},{name:P.SATELLITE,sources:At(P.SATELLITE,o),layers:jt(P.SATELLITE,l,s)}),v=U(U({},e),{},{name:P.HYBRID,sources:At(P.HYBRID,o),layers:jt(P.HYBRID,u==null?l:u,s)}),y=U(U({},e),{},{name:P.DARK,sources:At(P.DARK,o),layers:jt(P.DARK,f,s)}),b=U(U({},e),{},{name:P.DARK_TERRAIN,sources:At(P.DARK_TERRAIN,o),layers:jt(P.DARK_TERRAIN,p,s)});this.MAP_STYLES={NORMAL:h,TERRAIN:g,SATELLITE:_,HYBRID:v,DARK:y,DARK_TERRAIN:b},i({limitZoom:m})}):a(Error(`Style URL is missing.`))}).catch(e=>{a(e)})})}static getMapTypes(t){let n={normal:e.getNormalMap(t),terrain:e.getTerrainMap(t),satellite:e.getSatelliteMap(t),hybrid:e.getHybridMap(t)};p.IS_IN_HOUSE&&(n.dark=e.getDarkMap(t),n.dark_terrain=e.getDarkTerrainMap(t));let r=new p.MapTypeRegistry(n);return r.VENDOR=re,r.uid=`naver:vectormap:default`,r}static getWeatherMapTypes(t){let n=new p.MapTypeRegistry({normal:e.getWeatherNormalMap(t),grayscale:e.getWeatherGrayscaleMap(t),satellite:e.getWeatherSatelliteMap(t),basic:e.getWeatherBasicMap(t)});return n.VENDOR=re,n.uid=`naver:vectormap:default`,n}static getWeatherMapStyleSource(){let t=e.WEATHER_MAP_STYLES.NORMAL;if(t)return t.sources.weather}static getNormalMap(t){return Ft({uid:`naver:normal-vt`,name:`일반`,styles:e.MAP_STYLES.NORMAL,maxZoom:Ot},t)}static getTerrainMap(t){return Ft({uid:`naver:normal-vt:terrain-vt`,name:`지형도`,styles:e.MAP_STYLES.TERRAIN,maxZoom:Ot},t)}static getSatelliteMap(t){return Ft({uid:`naver:satellite-vt`,name:`위성`,styles:e.MAP_STYLES.SATELLITE,darktheme:!0,maxZoom:Ot},t)}static getHybridMap(t){return Ft({uid:`naver:satellite-vt:hybrid-vt`,name:`겹쳐보기`,styles:e.MAP_STYLES.HYBRID,darktheme:!0,maxZoom:Ot},t)}static getDarkMap(t){return Ft({uid:`naver:dark-vt`,name:`다크`,styles:e.MAP_STYLES.DARK,darktheme:!0,maxZoom:Ot},t)}static getDarkTerrainMap(t){return Ft({uid:`naver:dark-vt:terrain-vt`,name:`다크지형도`,styles:e.MAP_STYLES.DARK_TERRAIN,darktheme:!0,maxZoom:Ot},t)}static getWeatherNormalMap(t){return Ft({uid:`naver:normal-vt`,name:`일반`,styles:e.WEATHER_MAP_STYLES.NORMAL},t)}static getWeatherBasicMap(t){return Ft({uid:`naver:basic-vt`,name:`네이버일반`,styles:e.WEATHER_MAP_STYLES.BASIC},t)}static getWeatherGrayscaleMap(t){return Ft({uid:`naver:gray-vt`,name:`그레이스케일`,styles:e.WEATHER_MAP_STYLES.GRAYSCALE,darktheme:!0},t)}static getWeatherSatelliteMap(t){return Ft({uid:`naver:satellite-vt`,name:`위성`,styles:e.WEATHER_MAP_STYLES.SATELLITE,darktheme:!0},t)}};Dt=Nt,Dt.MAP_STYLES={},Dt.WEATHER_MAP_STYLES={},Dt.USE_COMPLETE_FONT=!1;var Pt={"world-vt":Ct,"normal-vt":wt,"satellite-vt":Tt},Ft=(...e)=>{let t=[],n;for(let n=0,r=e.length;ne.title.indexOf(`OpenStreetMap`)===-1):n.provider=e}return new bt(n.styles,new Nt(n))};p.NaverVectorMapTypeOptions=Nt;var It=class extends p.KVO{constructor(){super(),this._prevTargetId=null,this._prevTargetClicked=!1,this._overlayIds=[],this._listeners=[],this._queue=[]}ready(e){this._map=e,this._initEvent(),this.flush()}flush(){this._queue.forEach(e=>this.add(e)),this._queue=[]}destroy(){p.Event.removeListener(this._listeners),this._overlayIds.forEach(e=>{let t=this.get(e);t.remove(),t.detachMapbox(),this.set(e,null)}),this._queue.forEach(e=>e.detachMapbox()),this._map=null,this._overlayIds=[],this._queue=[]}add(e){if(!this._map){this._queue.push(e);return}let t=e.getId(),n=e.getLayerIds(),r=this.getOrderIndex(t,e);if(this.getIndex(t)>-1)throw Error(`Id: should be UNIQUE`);this._overlayIds.splice(r,0,t),this.set(t,e),this.setRefLayerId(r),e.draw(),this._map.getMapAction().addFilterLayer(n)}update(e){let t=this.getIndex(e);this._overlayIds.splice(t,1);let n=this.getOrderIndex(e);this._overlayIds.splice(n,0,e),t!==n&&(this.setRefLayerId(n),this.get(this.getId(n)).rearrange())}remove(e){let t=this.getIndex(e);if(t<0)return;this._overlayIds.splice(t,1);let n=this.get(e),r=n.getLayerIds();this._map.getMapAction().removeFilterLayer(r),n.remove(),this.set(e,null);let i=this._map.mapTypes,a=i.getTypeIds();p.forEach(i,(t,n)=>{if(a.indexOf(n)<0||!t.mapTypeStyle)return;let i=t.mapTypeStyle;p.forEach(r,e=>{let t=i.layers.findIndex(t=>t.id===e);t>-1&&i.layers.splice(t,1)}),i.sources[e]&&delete i.sources[e]})}setRefLayerId(e){let t,n=this.get(this.getId(e)),r=n.DRAWING_UNDER_SYMBOL,i=this._getAfterOverlay(n,r);i?t=i.getLayerIds()[0]:r&&(t=Ge(this._map.getMapbox().getStyle()).layerId),n.set(`refLayerId`,t)}getIndex(e){return this._overlayIds.findIndex(t=>t===e)}getOrderIndex(e,t){let n=t||this.get(e),r=this._overlayIds.findIndex(e=>this.get(e).get(`zIndex`)>n.get(`zIndex`));return r<0?this._overlayIds.length:r}getId(e){return this._overlayIds[e]}has(e){let t=0,n=this._overlayIds.length;for(;t{let t=e.properties&&e.properties.__overlayId;if(!(t&&this.get(t))||c.indexOf(t)>-1)return;let{id:n,type:r,geometry:i,properties:a}=e;s.push(U(U({},n?{id:n}:{}),{},{type:r,geometry:i,properties:a})),c.push(t)}),s}getAllLayerIds(){let e=[];return this._overlayIds.forEach(t=>{e=e.concat(this.get(t).getLayerIds())}),e}getLayerIdsUnderSymbol(){return this._getLayerIds(!0)}getLayerIdsAboveSymbol(){return this._getLayerIds(!1)}updateUnderSymbolOverlays(){this._overlayIds.forEach(e=>{let t=this.get(e);if(!t.DRAWING_UNDER_SYMBOL)return;let n=this.getIndex(e);this.setRefLayerId(n),t.rearrange()})}_initEvent(){ge.concat([`mousedown`,`mouseup`,`touchstart`,`touchend`]).forEach(e=>{let t=B[e]||e;this._listeners.push(this._map.addListener(t,this._getListener(e)))}),this._listeners.push(this._map.addListener(`mousemove`,this._getListener(`mousemove`)))}_getListener(e){return t=>{if(this._overlayIds.length<1)return;B[e]&&(t.type=e);let n=this._map,r=n.getMapAction(),i=t.offset;if(r.isDragging()||r.isTranRunning())return;let a=this.getAllLayerIds(),o=n.getMapbox().queryRenderedFeatures([[i.x-3,i.y-3],[i.x+3,i.y+3]])||[],s=o.filter(e=>a.indexOf(e.layer.id)>=0),c=o.length>0&&a.indexOf(o[0].layer.id)>=0&&s.length>0?s[0].properties.__overlayId:``,l=c&&this.get(c),u=l&&l.getClickable();u&&(t.data=s[0].toJSON());let d=this._prevTargetId,f=this._prevTargetClicked;if(e===`mousemove`){let e,n;d&&!c?e=this.get(d):!d&&c?n=l:d&&c&&d!==c&&(e=this.get(d),n=l),e&&e.getClickable()&&e.trigger(`mouseout`,U(U({},t),{},{type:`mouseout`})),n&&n.getClickable()&&n.trigger(`mouseover`,U(U({},t),{},{type:`mouseover`})),this._prevTargetId=c}if(!u){let n=this._map.getCursor();f&&(n===`open`||n===`closed`||n===`pointer`)&&(this._prevTargetClicked=!1,this._map.setCursor(`open`)),e!==`mousemove`&&B[e]&&this._map.trigger(e,t);return}this._map.setCursor(`pointer`),this._prevTargetClicked=!0,this.get(c).trigger(e,t)}}_getLayerIdsByTypes(e){let t=[];return this._overlayIds.forEach(n=>{let r=this.get(n);!r||e.indexOf(r.OVERLAY_TYPE)<0||(t=t.concat(r.getLayerIds()))}),t}_getLayerIds(e){let t=[];return this._overlayIds.filter(t=>{let n=this.get(t);return n?!e||n.DRAWING_UNDER_SYMBOL===e:!1}).forEach(e=>{t=t.concat(this.get(e).getLayerIds())}),t}_getAfterOverlay(e,t=!1){let n=this._overlayIds.filter(e=>{var n;return!!((n=this.get(e))!=null&&n.DRAWING_UNDER_SYMBOL)===t}).find(t=>this.get(t).get(`zIndex`)>e.get(`zIndex`));return n?this.get(n):null}};function Lt(e,t,n){let r,i,a,o,s;t==null&&(t=100);function c(){let l=Date.now()-o;l=0?r=setTimeout(c,t-l):(r=null,n||(s=e.apply(a,i),a=i=null))}return function(){a=this,i=arguments,o=Date.now();let l=n&&!r;return r||(r=setTimeout(c,t)),l&&(s=e.apply(a,i),a=i=null),s}}function Rt(e,t,n,r,i){zt(e,t,n||0,r||e.length-1,i||Vt)}function zt(e,t,n,r,i){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);zt(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(Bt(e,n,t),i(e[r],a)>0&&Bt(e,n,r);o0;)s--}i(e[n],a)===0?Bt(e,n,s):(s++,Bt(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function Bt(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Vt(e,t){return et)}var Ht=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}search(e){let t=this.data,n=[];if(!$t(e,t))return n;let r=this.toBBox,i=[];for(;t;){for(let a=0;a=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)}_split(e,t){let n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);let a=this._chooseSplitIndex(n,i,r),o=en(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,Ut(n,this.toBBox),Ut(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=en([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Ut(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,i=1/0,a=1/0;for(let o=t;o<=n-t;o++){let t=Wt(e,0,o,this.toBBox),s=Wt(e,o,n,this.toBBox),c=Zt(t,s),l=Jt(t)+Jt(s);c=t;r--){let t=e.children[r];Gt(o,e.leaf?i(t):t),s+=Yt(o)}return s}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)Gt(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():Ut(e[t],this.toBBox)}};function Ut(e,t){Wt(e,0,e.children.length,t,e)}function Wt(e,t,n,r,i){i||(i=en(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let a=t;a=e.minX&&t.maxY>=e.minY}function en(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function tn(e,t,n,r,i){let a=[t,n];for(;a.length;){if(n=a.pop(),t=a.pop(),n-t<=r)continue;let o=t+Math.ceil((n-t)/r/2)*r;Rt(e,o,t,n,i),a.push(t,o,o,n)}}var nn,rn=22,an=class e extends p.NaverStyleMapTypeOptions{static getNormalMap(e){return sn({uid:`naver:normal`,name:`일반`,tileType:`basic`,overlayType:`bg.ol.sw.lko`,originalOverlayType:`bg.ol.sw.lko`,maxZoom:rn},e)}static getSatelliteMap(e){return sn({uid:`naver:satellite`,name:`위성`,tileType:`satellite`,overlayType:`bg`,originalOverlayType:`bg`,darktheme:!0,maxZoom:rn},e)}static getHybridMap(e){return sn({uid:`naver:satellite:hybrid`,name:`겹쳐보기`,tileType:`satellite`,overlayType:`bg.ol.sw.lko`,originalOverlayType:`bg.ol.sw.lko`,darktheme:!0,maxZoom:rn},e)}static getTerrainMap(e){return sn({uid:`naver:normal:terrain`,name:`지형도`,tileType:`terrain`,overlayType:`bg.ol.sw.lko`,originalOverlayType:`bg.ol.sw.lko`,maxZoom:rn},e)}static getDarkMap(e){return sn({uid:`naver:dark`,name:`다크`,tileType:`dbasic`,overlayType:`bg.ol.sw.lko`,originalOverlayType:`bg.ol.sw.lko`,darktheme:!0,maxZoom:rn},e)}static getDarkTerrainMap(e){return sn({uid:`naver:normal:dark:terrain`,name:`다크지형도`,tileType:`dterrain`,overlayType:`bg.ol.sw.lko`,originalOverlayType:`bg.ol.sw.lko`,darktheme:!0,maxZoom:rn},e)}static getMountainLayer(e){return sn({uid:`naver:mountain`,name:`등산로`,imgFormat:0,tileType:`basic`,overlayType:`ar`,overview:!1},e)}static getCctvLayer(e){return sn({uid:`naver:cctv`,name:`cctv`,imgFormat:0,tileType:`basic`,overlayType:`cctv`,overview:!1},e)}static getTransitLayer(e){return sn({uid:`naver:transit`,name:`transit`,imgFormat:0,tileType:`basic`,overlayType:`bs`,overview:!1},e)}static getRealtyLayer(e){return sn({uid:`naver:realty`,name:`부동산`,imgFormat:0,tileType:`basic`,overlayType:`rtrl.rtrd.rtrg`,overview:!1},e)}static getStreetLayer(e){return sn({uid:`naver:street`,name:`거리뷰`,imgFormat:0,tileType:`basic`,overlayType:`pr`,overview:!1},e)}static getSimpleStreetLayer(e){return sn({uid:`naver:simplestreet`,name:`거리뷰`,imgFormat:0,tileType:`basic`,overlayType:`ps`,overview:!1},e)}toTileUrl(e,t,n,r,i,a,o,s,c,l){let u=this.map.getMapTypeId()===P.SATELLITE&&s===I.BACKGROUND,d=this.versions[M];return u&&d&&p.IS_IN_HOUSE?[this._getLocationInHouseNrs(),n,e,t].join(`/`)+`.jpg?version=`+d:(this.map.get(`emergency`)&&(o=``),[this._getLocation(),r,i,n,e,t].join(`/`)+o+`.`+a+this._getQuery(s,l))}_getLocation(){return ee}_getLocationInHouseNrs(){return ne}_getScaleFactor(){return _e}_getExclusionOverlayTypes(){return[I.POI_KOREAN,I.POI_ENGLISH,I.POI_CHINESE,I.POI_JAPANESE]}static mixin(){e.mixed||(Te(p.NaverStyleMapTypeOptions,e),p.NaverStyleMapTypeOptions.getNormalMap=e.getNormalMap,p.NaverStyleMapTypeOptions.getSatelliteMap=e.getSatelliteMap,p.NaverStyleMapTypeOptions.getHybridMap=e.getHybridMap,p.NaverStyleMapTypeOptions.getTerrainMap=e.getTerrainMap,p.NaverStyleMapTypeOptions.getDarkMap=e.getDarkMap,p.NaverStyleMapTypeOptions.getDarkTerrainMap=e.getDarkTerrainMap,p.NaverStyleMapTypeOptions.getMountainLayer=e.getMountainLayer,p.NaverStyleMapTypeOptions.getCctvLayer=e.getCctvLayer,p.NaverStyleMapTypeOptions.getStreetLayer=e.getStreetLayer,p.NaverStyleMapTypeOptions.getTransitLayer=e.getTransitLayer,p.NaverStyleMapTypeOptions.getRealtyLayer=e.getRealtyLayer,p.NaverStyleMapTypeOptions.prototype.toTileUrl=e.prototype.toTileUrl,p.NaverStyleMapTypeOptions.prototype._getLocation=e.prototype._getLocation,p.NaverStyleMapTypeOptions.prototype._getScaleFactor=e.prototype._getScaleFactor,p.NaverStyleMapTypeOptions.prototype._getExclusionOverlayTypes=e.prototype._getExclusionOverlayTypes,e.mixed=!0)}};nn=an,nn.mixed=!1;var on={world:Ct,normal:wt,satellite:Tt,cctv:Et},sn=(...e)=>{let t=[];for(let n=0,r=e.length;ne.title.indexOf(`OpenStreetMap`)===-1):n.provider=e}return new p.ImageMapType(new p.NaverStyleMapTypeOptions(n))},cn=class{constructor(e){this.DEBOUNCE_TIME=500,this.FILE_FORMAT=`json`,this.INDOOR_MAP_TYPE=`indoor`,this.CRS_TYPE=`EPSG:4326`,this.CACHE_SIZE=128,this.LAYER_PRIORITY=[`INDOOR_POI`,`CCTV`,`PANORAMA`,`TRANSIT`,`POI`],this.map=null,this.indoorGroundInfo=null,this.features=null,this.cacheMap={},this.cacheArray=[],this.tree=null,this.map=e,this.tree=new Ht,this.listenMapEvents(),this.update()}destroy(){this.clear(),this.cacheMap=null,this.cacheArray=null,this.map&&(this.unlistenMapEvents(),this.map=null)}queryFeatures(e){let t=this.tree.search({minX:e.x,minY:e.y,maxX:e.x,maxY:e.y});if(!t||t.length===0)return null;let n=[],r=[],i=t.length;for(let e=0;ethis.LAYER_PRIORITY.indexOf(e.source)-this.LAYER_PRIORITY.indexOf(t.source))}setIndoorInfo(e,t){this.indoorGroundInfo={zone:e,zorder:t},this.update()}clearIndoorInfo(){this.indoorGroundInfo=null}findFeatures(e){if(!this.features)return null;let t=[],n=e.length,r=this.features.length;for(let i=0;i{this.update()},t=e=>{e!==`transit`&&e.name!==`transit`&&this.update()};this.mapListeners=[p.Event.addListener(this.map.getMapAction(),`idle`,Lt(e,this.DEBOUNCE_TIME,!1)),p.Event.addListener(this.map,`mapType_changed`,e),p.Event.addListener(this.map,`addLayer`,t),p.Event.addListener(this.map,`removeLayer`,t),p.Event.addListener(this.map,`airWaterView_changed`,e)]}unlistenMapEvents(){p.Event.removeListener(this.mapListeners)}clear(){this.features=null,this.tree.clear()}update(){if(!p.IS_IN_HOUSE||this.map.get(`emergency`))return;this.clear();let e=this.map.getMapModel(),t=e.get(`tileIndexArray`).get(`indexes`);if(!t||t.length===0)return;let n=this.getLayerOverlayQuery();if(!n)return;let r=this.FILE_FORMAT,i=e.get(`zoom`),a=this.getCrsQuery(),o=this.map.getMapTypeId(),s=this.getMapTypeName(o),c=this.getMapTypeTileVersion(o),l=[];t.forEach(e=>{let t=e.xIndex,o=e.yIndex,u=i,d=S.getPath(b.TILE_PICKER,{x:t,y:o,z:u,format:r,tileVersion:c,type:s});if(d+=`?${n}&${a}`,l.push(this.loadPickerData(d)),this.indoorGroundInfo){let e=this.getIndoorGroundQuery(),n=S.getPath(b.TILE_PICKER,{x:t,y:o,z:u,format:r,tileVersion:c,type:this.INDOOR_MAP_TYPE});n+=`?${e}&${a}`,l.push(this.loadPickerData(n))}}),Promise.all(l).then(e=>{!e||e.length===0||(this.updateFeatures(e),this.updateTree())})}loadPickerData(e){if(this.cacheMap[e]){let t=this.cacheMap[e];return Promise.resolve(t)}return G.loadJSON(e,this.addPickerApiData.bind(this))}addPickerApiData(e,t){if(!this.cacheMap[e])for(t.key=e,this.cacheMap[e]=t,this.cacheArray.push(t);this.cacheArray.length>this.CACHE_SIZE;){let e=this.cacheArray.splice(0,1)[0];this.cacheMap[e.key]=void 0,delete this.cacheMap[e.key]}}updateFeatures(e){let t=[],n=e.length;for(let r=0;r{let{boundary:n,properties:r}=t;!n||!r.id||p.forEach(n,n=>{let r=n.bbox,i={id:t.properties.id,minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]};e.push(i)})}),this.tree.load(e)}getUniqueFeatures(e){let t=[],n=[],r=e.length;for(let i=0;i=0||(n.push(r),t.push(a))}return n}getIndoorGroundQuery(){return`zone=${this.indoorGroundInfo.zone}&zorder=${this.indoorGroundInfo.zorder}`}getCrsQuery(){return`crs=${this.CRS_TYPE}`}getLayerOverlayQuery(){let{uid:e}=this.map.getMapType(),{uid:t}=p.NaverStyleMapTypeOptions.getSatelliteMap(),n=(()=>{let e=p.USER_LANGUAGE;return e===w.ENGLISH?I.POI_ENGLISH:e===w.CHINESE?I.POI_CHINESE:e===w.JAPANESE?I.POI_JAPANESE:I.POI_KOREAN})(),r=e===t||this.map.layers.cadastral?[]:[I.TRANSIT,n],i=this.map.layers.getLayerNames();if(!i||i.length===0)return r.length>0?`mt=${r.join(`.`)}`:null;let a=[],o=i.length;for(let e=0;epe.indexOf(e)-pe.indexOf(t));return s.length>0?`mt=${s.join(`.`)}`:null}getMapTypeName(e){let t;switch(e){case`normal`:t=p.NaverStyleMapTypeOptions.getNormalMap();break;case`terrain`:t=p.NaverStyleMapTypeOptions.getTerrainMap();break;case`satellite`:t=p.NaverStyleMapTypeOptions.getSatelliteMap();break;case`hybrid`:t=p.NaverStyleMapTypeOptions.getHybridMap();break;case`dark`:t=p.NaverStyleMapTypeOptions.getDarkMap();break;case`dark_terrain`:t=p.NaverStyleMapTypeOptions.getDarkTerrainMap()}let{tileType:n}=t.getOptions();return n}getMapTypeTileVersion(e){let t={normal:le,terrain:ue,satellite:de,hybrid:de,dark:fe,dark_terrain:N}[e];return an.getVersions()[t]}};function ln(e,t,n){let r=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(let i=0,a=t.length-1;ie[1]!=l>e[1]&&e[0]<(c-o)*(e[1]-s)/(l-s)+o&&(r=!r)}return r}var un=class extends p.Layer{constructor(e){super(),this.NAME=`indoor`,this.INDOOR_MASTER_LAYER=`indoorMaster`,this.MIN_ZOOM=17,this.MAX_ZOOM=22,this.OPTIONS={minZoom:this.MIN_ZOOM,maxZoom:this.MAX_ZOOM,tileSize:new p.Size(256,256),getTile:this.getTile.bind(this)},this.indoorMasterMeta=null,this.indoorMasterObjectTree=new Ht,this.indoorMasterObjectMap={},this.indoorMasterObjects=[],this.indoorGroundObject=null,this.name=this.NAME,this._initRegistry(this.OPTIONS);let t=this.registry;if(!t.getSelectedTypeId()){let e=t.getTypeIds();e.length&&t.setSelectedTypeId(e[0])}this.options=p.extend({zIndex:12,overlayMap:!0},e),this.initMetadata()}getMinZoom(){return this.getMap()?this.MIN_ZOOM-1:null}showIndoor(e,t){this.setIndoorGroundObject({zone:e,zorder:t,tileUrl:this.getIndoorGroundTileUrl(e,t)}),this.removeAllIndoorMasterObjects(),this.refresh(!1)}hideIndoor(){this.setIndoorGroundObject(null),this.refresh(!1)}updateIndoor(){if(!this.indoorGroundObject)return;let{zone:e,zorder:t}=this.indoorGroundObject;this.setIndoorGroundObject({zone:e,zorder:t,tileUrl:this.getIndoorGroundTileUrl(e,t)}),this.refresh(!1)}hasIndoorGroundObject(){return!!this.indoorGroundObject}setIndoorGroundObject(e){this.indoorGroundObject=e}queryFeatures(e){if(!this.indoorMasterObjectTree.data)return null;let t=this.indoorMasterObjectTree.search({minX:e.x,minY:e.y,maxX:e.x,maxY:e.y});if(!t||t.length===0)return null;let n=[],r=t.map(e=>e.id),i=this.indoorMasterObjects.length;for(let e=0;e-1&&n.push(this.indoorMasterObjects[e])}if(n.length===0)return null;let a=null,o=[e.x,e.y];for(let e=0;eln(o,e))){a=n[e];break}}if(a)break}if(!a)return null;let s=a.polygon.getBounds();return{type:se,source:null,layer:{id:this.INDOOR_MASTER_LAYER,source:null,indoorMaster:!0,poi:!1},bbox:[s.minX(),s.minY(),s.maxX(),s.maxY()],properties:a.properties}}initMetadata(){let e=S.getPath(b.INDOOR_MASTER);G.loadJSON(e).then(e=>{this.indoorMasterMeta=e,this.refresh(!1)})}listenMapEvents(e){e&&(this.mapListeners=[p.Event.addListener(e,`zoom_changed`,()=>{this.removeAllIndoorMasterObjects()})])}unlistenMapEvents(){p.Event.removeListener(this.mapListeners)}removeAllIndoorMasterObjects(){p.forEach(this.indoorMasterObjects,e=>{p.Event.removeListener(e.listeners),e.polygon.setMap(null)}),this.indoorGroundObject||(this.indoorMasterObjects=[],this.indoorMasterObjectMap={},this.indoorMasterObjectTree.clear())}addIndoorMasterObject(e,t){let n=t.properties,r=n.id,i=t.geometry.coordinates,a=[];p.forEach(i,e=>{p.forEach(e,e=>{a.push(e)})});let o={map:this.map,paths:a,fillColor:`#ebe4f3`,strokeColor:`#8353b4`,fillOpacity:.15,strokeOpacity:.15,zIndex:10,clickable:!0},s=new p.Polygon(o),c=s.getBounds(),l=e=>{let t=e.pointerEvent.type,n=T[t]||t;if([`click`,`rightclick`].indexOf(n)>-1){let{coord:t,pointerEvent:r,offset:i,point:a}=e;p.Event.trigger(this.map.getMapAction(),n,{coord:t,latlng:t,offset:i,point:a,domEvent:r,pointerEvent:r,originalEvent:r,type:n});return}e.overlay.setOptions({fillColor:t===`mouseover`?o.strokeColor:o.fillColor})},u=[p.Event.addListener(s,`click`,l),p.Event.addListener(s,`rightclick`,l),p.Event.addListener(s,`mouseover`,l),p.Event.addListener(s,`mouseout`,l)],d={properties:n,coordinates:a,geometry:t.geometry.type===`MultiPolygon`?t.geometry.coordinates:[t.geometry.coordinates],polygon:s,listeners:u};this.indoorMasterObjectMap[e]=d,this.indoorMasterObjects.push(d),this.indoorMasterObjectTree.insert({id:r,minX:c.minX(),minY:c.minY(),maxX:c.maxX(),maxY:c.maxY()})}isDuplicatedIndoorMaster(e){let t=!1,n=this.indoorMasterObjects.length;for(let r=0;r=0:!1;return`${S.getPath(b.INDOOR_GROUND_TILE)}${_e}.png?mt=ib.lko${n?`.ps`:``}&zone=${e}&zorder=${t}`}getTile(e,t,n){if(!this.indoorMasterMeta||nthis.MAX_ZOOM)return null;if(this.indoorGroundObject){let r=this.map.getMapTypeId(),i=this._getMapTypeName(r),a=an.getVersions()[i],o=this.indoorGroundObject.tileUrl,s=De(o,{x:e,y:t,z:n,type:i,tileVersion:a==null?``:a}),c=this.registry.getSelectedType().tileSize;return new p.ImageTile({tileIndex:{xIndex:e,yIndex:t},urls:[s],size:c,imgonload:null,imgonerror:null})}let r=document.createElement(`div`),i=De(this.indoorMasterMeta.tiles[0],{x:e,y:t,z:n});return G.loadJSON(i).then(n=>{if(!this.map||this.indoorGroundObject||!n||!n.features||n.features.length===0)return;let r=n.features.length;for(let i=0;i{if(!e)return t;let n=e.getMin(),r=e.getMax(),i=(r.x-n.x)*k,a=(r.y-n.y)*k;if(i===0||a===0)return t;let o=t.getContext(`2d`).getImageData(n.x*k,n.y*k,i,a),s=document.createElement(`canvas`),c=s.getContext(`2d`);return s.width=i,s.height=a,c.putImageData(o,0,0),s}).then(e=>t?this.canvasToBlob(e):Promise.resolve(e.toDataURL(`image/png`)))}async mantleToCanvas(){var e=this;await e.loadLibraries();let{offsetWidth:t,offsetHeight:n}=e.map.getElement(),r=document.createElement(`canvas`),i=r.getContext(`2d`),a=t*k,o=n*k;r.width=a,r.height=o;let{x:s,y:c}=e.map.getMapView().getContainerDivOffset();e.drawTileImages(i,s,c);let l=s*k,u=c*k;return await e.drawPanesToCanvas(i,l,u,a,o,t,n),r}async mapboxToCanvas(){var e=this;await e.loadLibraries();let{offsetWidth:t,offsetHeight:n}=e.map.getElement(),r=document.createElement(`canvas`),i=r.getContext(`2d`),a=t*k,o=n*k;r.width=a,r.height=o;let s=e.map.getMapView().get(`containerDiv`),{x:c,y:l}=e.getElementTranslation(s),u=c*k,d=l*k,f=e.map.getMapbox(),p=await e.takeMapboxScreenshot(f);return await e.drawMapboxCanvas(i,p,f.getCanvas(),u,d,a,o),await e.drawPanesToCanvas(i,u,d,a,o,t,n),r}async drawPanesToCanvas(e,t,n,r,i,a,o){let s=this.map.getMapView().get(`panes`),c=[];p.forEach(s,e=>{let t=new Promise(t=>{let n=setTimeout(()=>t(null),1e4);try{modernScreenshot.domToCanvas(e,{width:a,height:o,scale:k,backgroundColor:null}).then(e=>{clearTimeout(n),t(e)}).catch(()=>{clearTimeout(n),t(null)})}catch(e){clearTimeout(n),t(null)}});c.push(t)}),(await Promise.all(c)).forEach(a=>{a&&e.drawImage(a,0,0,a.width,a.height,t,n,r,i)})}drawTileImages(e,t,n){let r=this.map.getMapView().get(`tilePane`).querySelectorAll(`img`),i=r.length;for(let a=0;a{e.once(`render`,()=>{t(e.getCanvas().toDataURL())}),e.triggerRepaint()})}drawMapboxCanvas(e,t,n,r,i,a,o){return new Promise((s,c)=>{let l=new Image;l.onload=()=>{e.drawImage(l,0,0,n.width,n.height,r,i,a,o),s()},l.onerror=()=>c(Error(`Failed to load mapbox screenshot image`)),l.src=t})}canvasToBlob(e){return new Promise(t=>e.msToBlob?t(e.msToBlob()):e.toBlob(t))}getElementTranslation(e){let{x:t,y:n}=p.DOM.getTranslate(e);return{x:parseInt(t,10),y:parseInt(n,10)}}loadLibraries(){return typeof modernScreenshot<`u`?Promise.resolve():new Promise((e,t)=>{let n=document.createElement(`script`);n.async=!0,n.src=this.MODERN_SCREENSHOT,n.onload=()=>e(),n.onerror=()=>t(),document.body.appendChild(n)})}},fn=null,pn=class extends p.Layer{constructor(){super(),this.INDOOR_VIEW_SOURCE=`indoorview`,this.indoorMasterLayers=[],this.indoorMasterLayersEvents=[],this.indoorMasterLayersOpacities={},this.indoorTilePoiLayers=[],this.indoorGroundObject=null,this.indoorGroundHoverID=null,this.indoorGroundSourceInfo=null,this.isIndoorSourceTileMap=!1,this._boundMouseEventHandler=this.mouseEventHandler.bind(this),this.name=`indoor`,this._initRegistry({})}getMinZoom(){if(!this.getMap())return null;let e=null;return p.forEach(this.indoorMasterLayers,t=>{let n=t.minzoom;p.hasValue(n)&&(e||(e=n),e=Math.min(e,n))}),e}showIndoorGround(){this.getMap()&&this._setIndoorGroundLayersVisible(!0)}hideIndoorGround(){this.getMap()&&this._setIndoorGroundLayersVisible(!1)}showIndoor(e,t){let n=this.map.getMapbox(),r=n.getStyle().layers,i=this.map.getOptions(`glType`),a=this.map.getOptions(`advertisement`);if(!fn){let e=i===L.VECTOR?this.INDOOR_VECTOR_SOURCE:this.INDOOR_HYBRID_SOURCE,t=this.INDOOR_POI_SOURCE,r=this.INDOOR_VIEW_SOURCE;fn={tile:n.getSource(e).tiles[0],poi:n.getSource(t).tiles[0],indoorview:n.getSource(r)?n.getSource(r).tiles[0]:``}}this.setIndoorGroundObject({zone:e,zorder:t}),this.updateIndoorTileSource(),this.updateIndoorPoiSource(),this.updateIndoorStreetViewOverlay();let o=[...this.getValidLayerGroupNameList(F.INDOOR_TILE_MAP),...this.getValidLayerGroupNameList(F.INDOOR_POI)];a&&o.push(...this.getValidLayerGroupNameList(F.AD_INDOOR)),p.forEach(r,e=>{if(!e.metadata||!e.metadata.group)return;let t=e.metadata.group;o.indexOf(t)>=0&&(n.setLayoutProperty(e.id,`visibility`,`visible`),this.indoorTilePoiLayers.push(e))}),p.forEach(this.indoorMasterLayers,e=>{let t=e.type===`fill`?`fill-opacity`:`line-opacity`;n.setPaintProperty(e.id,t,0)}),n.triggerRepaint(),this.map.setCursor(`open`)}hideIndoor(){let e=this.map.getMapbox();this.setIndoorGroundObject(null),this.updateIndoorStreetViewOverlay(),p.forEach(this.indoorTilePoiLayers,t=>{e.setLayoutProperty(t.id,`visibility`,`none`)}),p.forEach(this.indoorMasterLayers,t=>{let{id:n,type:r}=t,i=r===`fill`?`fill-opacity`:`line-opacity`;e.setPaintProperty(n,i,this.indoorMasterLayersOpacities[n])}),this.indoorTilePoiLayers=[]}updateIndoor(){this.indoorGroundObject&&(this.updateIndoorTileSource(),this.updateIndoorStreetViewOverlay())}hasIndoorGroundObject(){return!!this.indoorGroundObject}refresh(){if(!this.map)return;let e=this.map;this.setMap(null),this.setMap(e)}_addToMap(e){let t=e.getOptions(`glType`),{layers:n}=e.getMapbox().getStyle(),r=this.getValidLayerGroupNameList(F.INDOOR),i=this.getValidLayerGroupNameList(F.INDOOR_POI);for(let e=0,s=n.length;e-1){let e=t===L.VECTOR?`INDOOR_VECTOR_SOURCE`:`INDOOR_HYBRID_SOURCE`;this[e]=c}else i.indexOf(l)>-1&&(this.INDOOR_POI_SOURCE=c)}}this.INDOOR_POI_SOURCE||(this.INDOOR_POI_SOURCE=`indoor`),this.INDOOR_VECTOR_SOURCE||(this.INDOOR_VECTOR_SOURCE=`indoor`),this.INDOOR_HYBRID_SOURCE||(this.INDOOR_HYBRID_SOURCE=`tilemap_indoor`),this.isIndoorSourceTileMap=this.INDOOR_HYBRID_SOURCE===`tilemap_indoor`,e.layers.set(this.name,this),e.set(`${this.name}Layer`,this)}_renderLayer(e){let t=this.map.getMapbox();if(e){let{layers:e}=t.getStyle(),n=this.getValidLayerGroupNameList(F.INDOOR_GND);if(!n)return;let r=this.map.get(`isShowingIndoorGround`)===!1?`none`:`visible`;p.forEach(e,e=>{if(!e.metadata||!e.metadata.group)return;let i=e.metadata.group;if(n.indexOf(i)>=0){let{id:n,type:i}=e,o=i===`fill`?`fill-opacity`:`line-opacity`;if(t.setLayoutProperty(n,`visibility`,r),i===`fill`&&(this.indoorMasterLayersEvents.push(n),t.on(`mousemove`,n,this._boundMouseEventHandler),t.on(`mouseleave`,n,this._boundMouseEventHandler)),this.indoorMasterLayers.push(e),!(n in this.indoorMasterLayersOpacities)){var a;this.indoorMasterLayersOpacities[n]=(a=t.getPaintProperty(n,o))==null?1:a}this.indoorGroundObject&&t.setPaintProperty(n,o,0)}})}else p.forEach(this.indoorMasterLayersEvents,e=>{t.off(`mousemove`,e,this._boundMouseEventHandler),t.off(`mouseleave`,e,this._boundMouseEventHandler)}),p.forEach(this.indoorMasterLayers,e=>{t.setLayoutProperty(e.id,`visibility`,`none`)}),this.indoorMasterLayers=[],this.indoorMasterLayersEvents=[],this.indoorGroundObject||(this.indoorMasterLayersOpacities={})}mouseEventHandler(e){if(!this.map)return;let t=this.map.getMapbox(),n=()=>{if(this.indoorGroundHoverID&&this.indoorGroundSourceInfo){let{source:e,sourceLayer:n}=this.indoorGroundSourceInfo;t.setFeatureState({source:e,sourceLayer:n,id:this.indoorGroundHoverID},{hover:!1}),this.indoorGroundHoverID=null}};if(this.indoorGroundObject){n();return}if(e.type===`mousemove`){if(this.map.getCursor()!==`pointer`&&this.map.setCursor(`pointer`),!e.features||e.features.length===0)return;let{id:n,source:r,sourceLayer:i}=e.features[0];if(this.indoorGroundSourceInfo||(this.indoorGroundSourceInfo={source:r,sourceLayer:i}),n===this.indoorGroundHoverID)return;this.indoorGroundHoverID&&t.setFeatureState({source:r,sourceLayer:i,id:this.indoorGroundHoverID},{hover:!1}),this.indoorGroundHoverID=n,t.setFeatureState({source:r,sourceLayer:i,id:this.indoorGroundHoverID},{hover:!0})}else this.map.setCursor(`open`),n()}setIndoorGroundObject(e){this.indoorGroundObject=e}getStreetLayer(){return!this.map||!this.map.layers?null:this.map.layers[F.STREET]}updateIndoorTileSource(){let e=this.map.getMapbox(),t=this.map.getOptions(`glType`)===L.VECTOR?this.INDOOR_VECTOR_SOURCE:this.INDOOR_HYBRID_SOURCE,n=e.getSource(t),{zone:r,zorder:i}=this.indoorGroundObject,a=!!this.getStreetLayer();n.type===`vector`?n.tiles=[De(fn.tile,{zone:r,zorder:i})]:n.type===`raster`&&(n.tiles=[`${fn.tile}${a?`.ps`:``}&zone=${r}&zorder=${i}`]);let o=e.style.sourceCaches[t];o.clearTiles(),o.update(e.transform)}updateIndoorPoiSource(){let e=this.map.getOptions(`glType`)===L.VECTOR?this.INDOOR_VECTOR_SOURCE:this.INDOOR_HYBRID_SOURCE;if(this.INDOOR_POI_SOURCE===e)return;let t=this.map.getMapbox(),n=t.getSource(this.INDOOR_POI_SOURCE),{zone:r,zorder:i}=this.indoorGroundObject;n.tiles=[De(fn.poi,{zone:r,zorder:i})];let a=t.style.sourceCaches[this.INDOOR_POI_SOURCE];a.clearTiles(),a.update(t.transform)}updateIndoorStreetViewOverlay(){if(!fn||this.isIndoorSourceTileMap)return;let e=!!this.getStreetLayer(),t=this.map.getMapbox(),n=t.getStyle().layers.filter(e=>{var t;return[F.INDOOR_VIEW,F.INDOOR_VIEW_DARK].indexOf((t=e.metadata)==null?void 0:t.group)>-1}),r=t.getSource(this.INDOOR_VIEW_SOURCE);if(!n.length||!r)return;if(this.indoorGroundObject){let{zone:e,zorder:t}=this.indoorGroundObject;r.tiles=[De(fn.indoorview,{zone:e,zorder:t})]}else r.tiles=[fn.indoorview];let i=!!this.indoorGroundObject&&e;p.forEach(n,e=>{t.setLayoutProperty(e.id,`visibility`,i?`visible`:`none`)});let a=()=>{let e=t.style.sourceCaches[this.INDOOR_VIEW_SOURCE];e.clearTiles(),e.update(t.transform)};i?a():t.once(`render`,a)}_setIndoorGroundLayersVisible(e){let t=this.map.getMapbox();p.forEach(this.indoorMasterLayers,n=>{t.setLayoutProperty(n.id,`visibility`,e?`visible`:`none`)})}},mn=class{constructor(e){this.TIMEOUT_DELAY=6e5,this._map=null,this._map=e,this._initialMaxZoom=e.getMaxZoom(),this._modified=!1,this._map.addListenerOnce(`init`,()=>{this.start()})}destroy(){this.stop(),this._map=null}handleEmergency(e,t){if(!this._map)return;let n=this._map.get(`renderMode`);if(this._map.set(`emergency`,e),n===2&&e&&this._map.switchTo(1),this._modified){let e=t{this.refresh()},this.TIMEOUT_DELAY)}stop(){this._timer&&(window.clearTimeout(this._timer),this._timer=null)}refresh(){if(this._map){if(this._map.get(`renderMode`)===2&&document.visibilityState===`visible`){let e=S.getPath(b.COMMANDO);G.loadJSON(e).then(e=>{if(!e||!e.emergency)return;let{limitZoom:t,status:n}=e.emergency;this.handleEmergency(n,t)}).catch(e=>{})}this._timer=window.setTimeout(this.refresh.bind(this),this.TIMEOUT_DELAY)}}applyMaxZoom(e){if(!this._map)return;let t=this._map.get(`renderMode`)===1?e+1:e;enew Uint8Array(Math.round(e)*Math.round(t)*4),gn=class{constructor(){this.DEFAULT_RANK=9999999999,this.IMAGE_PREFIX=`transparent-image-`,this.SOURCE_ID=`transparent-symbol-source`,this.LAYER_ID=`transparent-symbol-layer`,this._map=null,this._features=[],this._imageSizeCache={},this._sourceDirty=!1,this._flushRafId=0}destroy(){var e;this._cancelSourceFlush();let t=(e=this._map)==null?void 0:e.getMapbox();t&&(t.getLayer(this.LAYER_ID)&&t.removeLayer(this.LAYER_ID),t.getSource(this.SOURCE_ID)&&t.removeSource(this.SOURCE_ID)),this._map=null,this._features=[],this._imageSizeCache={}}ready(e){this._map=e}add(e){let t=this._toDataDrivenFeature(e);this._features.push(t),this._addImage(e),this._addSourceIfNeeded(),this._requestSourceFlush(),this._updateLayer()}remove(e){let t=e.get(`_nmarker_id`),n=this._features.findIndex(e=>e.id&&e.id===t);n>-1&&(this._features.splice(n,1),this._requestSourceFlush());let r=this._getIconImageId(t);this._removeImage(r)}update(e){let t=e.get(`_nmarker_id`),n=this._features.findIndex(e=>e.id&&e.id===t);if(n<0)return;this._updateImage(e);let r=this._features[n],i=this._toDataDrivenFeature(e);p.equals(r,i)||(this._features[n]=i,this._requestSourceFlush())}getLayerId(){return this.LAYER_ID}_addImage(e){let t=e.get(`_nmarker_id`),n=this._getIconImageId(t),r=this._map.getMapbox();if(r.hasImage(n))return;let{width:i,height:a}=this._getMarkerSize(e);r.addImage(n,{width:i,height:a,data:hn(i,a)}),this._imageSizeCache[n]={width:i,height:a}}_removeImage(e){let t=this._map.getMapbox();t.hasImage(e)&&t.removeImage(e),delete this._imageSizeCache[e]}_updateImage(e){let t=this._map.getMapbox(),n=e.get(`_nmarker_id`),r=this._getIconImageId(n),i=t.hasImage(r),a=this._imageSizeCache[r],o=this._getMarkerSize(e);if(i&&a&&o.equals(a))return;i&&t.removeImage(r);let{width:s,height:c}=o;t.addImage(r,{width:s,height:c,data:hn(s,c)}),this._imageSizeCache[r]={width:s,height:c}}_requestSourceFlush(){this._sourceDirty=!0,!this._flushRafId&&(this._flushRafId=requestAnimationFrame(()=>{this._flushRafId=0,this._flushSource()}))}_cancelSourceFlush(){this._flushRafId&&(cancelAnimationFrame(this._flushRafId),this._flushRafId=0),this._sourceDirty=!1}_flushSource(){!this._sourceDirty||!this._map||(this._updateSource(),this._sourceDirty=!1)}_addSourceIfNeeded(){let e=this.SOURCE_ID,t=this._map.getMapbox();t.getSource(e)||t.addSource(e,{type:`geojson`,data:this._getSourceData()})}_updateSource(){let e=this._map.getMapbox();if(!e)return;let t=e.getSource(this.SOURCE_ID);t&&t.setData(this._getSourceData())}_getSourceData(){return{type:ce,features:this._features.filter(e=>e.properties&&e.properties.__visible)}}_updateLayer(){let e=this.LAYER_ID,t=this._map.getMapbox();t.getLayer(e)||t.addLayer({id:e,type:`symbol`,source:this.SOURCE_ID,layout:{"icon-allow-overlap":!0,"icon-always-allow-overlap":!0,"icon-anchor":[`get`,`__iconAnchor`],"icon-image":[`get`,`__iconImage`],"icon-offset":[`get`,`__iconOffset`],"symbol-placement-priority":[`get`,`__rank`]}})}_toDataDrivenFeature(e){let t=e.toFeature(),n=e.get(`_nmarker_id`),r=e._icon,i=r&&r.anchor&&r.anchor.x&&r.anchor.y,a=i?`top-left`:`center`,o=i?[-r.anchor.x,-r.anchor.y]:[0,0];return e.get(`collisionBoxSize`)&&(a=`center`,o=[0,0]),t.id=n,t.properties=U(U({},t.properties),{},{__rank:this.DEFAULT_RANK,__visible:e.getVisible(),__iconImage:this._getIconImageId(n),__iconOffset:o,__iconAnchor:a}),t}_getIconImageId(e){return`${this.IMAGE_PREFIX}${e}`}_getMarkerSize(e){let t=e.get(`collisionBoxSize`);if(t)return p.box(t,p.Size).round();let n=e._icon;if(n&&n.size&&n.size.width&&n.size.height)return p.box(n.size,p.Size);let r=n&&n.getElement?n.getElement():e.getElement(),{width:i,height:a}=p.DOM.getSize(r);return i===0&&a===0?p.Size(24,24):p.Size(i,a).round()}},_n=class extends p.Layer{constructor(e){let t=p.extend({forceOverlayToMapType:!0},e);super(`transit`,p.NaverStyleMapTypeOptions.getTransitLayer(),t)}isEnabled(e){return this._checkLayerSupported(e)}_checkLayerSupported(e){let t=e.layers&&e.layers.get(F.CADASTRAL);return e.getMapTypeId()!==P.SATELLITE&&!t}},vn=(e,t)=>{let{url:n,size:r,scaledSize:i,origin:a,anchor:o}=e,s=p.box(r,p.Size),c=i?p.box(i,p.Size):s,l=a?p.box(a,p.Point):p.Point(0,0),u=p.calcAnchorPosition(s,o);return{url:n,scaledSize:[c.width,c.height],size:[s.width,s.height],origin:[l.x,l.y],anchor:[u.x,u.y],overlayId:t}},yn=class e{static getInstance(){return e.instance||(e.instance=new e),e.instance}constructor(){this.cache={}}static loadImage(e,t){let n=vn(e,t);return this.getInstance().loadImage(n)}static removeImage(e){this.getInstance().removeImage(e)}static reset(){this.getInstance().reset()}loadImage(e){let t=this.generateImageKey(e),{url:n,origin:r,size:i,scaledSize:a,anchor:o}=e;return G.loadImage(n).then(e=>{if(this.hasImage(t)){let{image:e,pixelRatio:n}=this.getImage(t);return{key:t,pixelRatio:n,image:e,anchor:o}}this.canvas||(this.canvas=document.createElement(`canvas`));let{width:n,height:s}=e,c=this.canvas,l=c.getContext(`2d`,{willReadFrequently:!0}),u=a?[n/a[0],s/a[1]]:[1,1],d=i[0]*u[0],f=i[1]*u[1],p=r[0]*u[0],m=r[1]*u[1],h=u[0];c.width=d,c.height=f,l.clearRect(0,0,d,f),l.drawImage(e,p,m,d,f,0,0,d,f);let g=l.getImageData(0,0,d,f),_={data:new Uint8Array(g.data.buffer),width:g.width,height:g.height};return this.setImage(t,{image:_,pixelRatio:h}),{key:t,pixelRatio:h,image:_,anchor:o}})}hasImage(e){return!!this.cache[e]}removeImage(e){this.hasImage(e)&&delete this.cache[e]}generateImageKey(e){let{overlayId:t,url:n,origin:r,size:i}=e;return`${t}_${n.replace(/^https?:\/\//,``)}_${r[0]}/${r[1]}_${i[0]}/${i[1]}`}getImage(e){return this.cache[e]}setImage(e,t){this.cache[e]=t}reset(){this.canvas&&(this.canvas.width=0,this.canvas.height=0,this.canvas=null);for(let e in this.cache)this.removeImage(e);this.cache={}}},bn,xn=function(e){return e.NOT_FOUND=`NOT_FOUND`,e.SERVER_ERROR=`SERVER_ERROR`,e}({}),Sn=(e,t)=>{let n=[],r=[H.DEFAULT],i=e.categories,a=[];return Object.keys(i).forEach(e=>{(i[e]||[]).length>0&&a.push(...i[e])}),p.forEach(t,e=>{var t;let o=e==null||(t=e.metadata)==null?void 0:t.group;if(!(!o||a.indexOf(o)<0)){e.layout.visibility=`none`;for(let t=0,n=r.length;t=0){e.layout.visibility=`visible`;break}}n.push(e)}}),n},Cn=e=>{let t=p.NCP_KEY_ID,n=p.NCP_ENV,r=p.LOCATION_REAL_URL,i=new Date().getTime(),a=`${S.getPath(b.OPEN_API)}/v3/styler/props`+(t?`?ncpKeyId=`+t:``)+(e?`&styleMetadataId=`+e:``)+(n?`&env=`+n:``)+`&url=`+encodeURIComponent(r)+`&time=`+i;return D?a:a.replace(`https://`,`http://`)},K=class e extends p.NaverStyleMapTypeOptions{constructor(e){super(e),this.projection=p.EPSG3857}static loadStyles(e){return new Promise((t,n)=>{G.loadJSON(Cn(e.customStyleId)).then(e=>{let{default:r}=e;if(!r)return n({errorType:`NOT_FOUND`});G.loadJSON(r).then(e=>{var n,r;let i=(n=(r=e.metadata)==null?void 0:r[`map-types`])==null?{}:n,a=Object.keys(i)[0];this.MAP_STYLES={NORMAL:U(U({},e),{},{name:`normal`,layers:a?Sn(i[a],e.layers):e.layers})},t()}).catch(()=>{n({errorType:`NOT_FOUND`})})}).catch(()=>{n({errorType:`SERVER_ERROR`})})})}static getMapTypes(t){let n=new p.MapTypeRegistry({normal:e.getNormalMap(t)});return n.VENDOR=re,n.uid=`naver:vectormap:default`,n}static getNormalMap(t){return Tn({uid:`naver:normal-vt`,name:`일반`,styles:e.MAP_STYLES.NORMAL},t)}};bn=K,bn.MAP_STYLES={};var wn={"normal-vt":wt},Tn=(...e)=>{let t=[],n;for(let n=0,r=e.length;n{let n=p.clone(t);return n.mesh_batch&&delete n.mesh_batch,n},kn=(e,t,n,r)=>{if(!t)return[];let i=r==null?void 0:r.dayOrNight,a=[],o=[],s=[H.INDOOR,H.INDOORGND,H.INDOOR_POI,H.BUILDING,H.BUILDING_2D_ONLY,H.BUILDING_HAS_3D,H.DATA_ADMIN,H.DATA_INDOOR_FLOOR,H.MESH_OBJECT_BUILDING,H.QIBLA,H.TRANSIT_EMPHASIS];e===P.SATELLITE&&s.push(H.OVERLAY,H.TRANSIT,H.SUBWAY);let c=[H.DEFAULT,H.OVERLAY,H.TRANSIT,H.SUBWAY],l=t.categories,u=e=>o.indexOf(e)>=0,d=e=>!i||!e||e===i||e===`both`;return p.forEach(Object.keys(l),e=>{var t;((t=l[e])==null?void 0:t.length)===0||s.indexOf(e)>=0||o.push(...l[e])}),p.forEach(n,e=>{let{metadata:t}=e;if(!t||!d(t[`day-night`]))return;let n=U(U({},e),{},{layout:U({},e.layout),paint:U({},e.paint)}),r=t.group;if(u(r)){n.layout.visibility=`none`;for(let e=0,t=c.length;e=0){n.layout.visibility=`visible`;break}}a.push(n)}}),a},An=class e extends p.NaverStyleMapTypeOptions{constructor(e){super(e),this.projection=p.EPSG3857}static loadStyles(){return new Promise((e,t)=>{let n=S.getPath(b.KSA_COMMAND);G.loadJSON(n).then(t=>{let n=t.styleUrls;return G.loadJSON(n.default).then(t=>{let{metadata:n,sources:r,layers:i}=t,{basic:a,satellite:o,hybrid:s}=n[`map-types`],c=U(U({},t),{},{name:P.NORMAL,sources:On(P.NORMAL,r),layers:kn(P.NORMAL,a,i,{dayOrNight:`day`})}),l=U(U({},t),{},{name:P.SATELLITE,sources:On(P.SATELLITE,r),layers:kn(P.SATELLITE,o,i,{dayOrNight:`day`})}),u=U(U({},t),{},{name:P.HYBRID,sources:On(P.HYBRID,r),layers:kn(P.HYBRID,s==null?o:s,i,{dayOrNight:`day`})});this.MAP_STYLES={NORMAL:c,SATELLITE:l,HYBRID:u},e()})}).catch(e=>{t(e)})})}static getMapTypes(t){let n={normal:e.getNormalMap(t),satellite:e.getSatelliteMap(t),hybrid:e.getHybridMap(t)},r=new p.MapTypeRegistry(n);return r.VENDOR=re,r.uid=`naver:vectormap:default`,r}static getNormalMap(t){return Mn({uid:`naver:normal-vt`,name:`일반`,styles:e.MAP_STYLES.NORMAL,maxZoom:Dn},t)}static getSatelliteMap(t){return Mn({uid:`naver:satellite-vt`,name:`위성`,styles:e.MAP_STYLES.SATELLITE,darktheme:!0,maxZoom:Dn},t)}static getHybridMap(t){return Mn({uid:`naver:satellite-vt:hybrid-vt`,name:`겹쳐보기`,styles:e.MAP_STYLES.HYBRID,darktheme:!0,maxZoom:Dn},t)}};En=An,En.MAP_STYLES={};var jn={"normal-vt":wt,"satellite-vt":wt},Mn=(...e)=>{let t=[],n;for(let n=0,r=e.length;n{this.destroy(!0)},100);return}if(this.set(`renderMode`,n),n===2){this._destroy2D();let e=this._mapOptions,t=!p.IS_IN_HOUSE&&e.get(`customStyleId`),n=!!e.get(`ksa`);[L.VECTOR,L.HYBRID].indexOf(e.get(`glType`))<0&&this._initGLType(),this._mapAction=new yt(e),t?this._loadNcpStylerStyles(r):n?this._loadKsaMapStyles(r):this._loadNaverMapStyles(r)}else this._destroyGL(()=>{for(let e of Fn)In[e]&&(this[e]=In[e]);this._initParts();let e=this._get2DMapTypes();this._mapOptions.set(`mapTypes`,e),r&&(this._assemble(this.getMapTypeId()),this.initCustomObjects2D()),this._mapModel.get(`center`)&&(this._mapModel.update(this._mapModel.get(`center`),null,null,new p.Point(0,0)),this._triggerRedraw()),this.listenMapEvents()});p.Event.once(this,`init`,()=>{this._handleTransitLayer()})}}destroy(e){if(this._isDestroyed=!0,this._destroyGLManagers(),this._mapbox){let e=this._mapbox.getCanvas();e.width=0,e.height=0,this._mapbox.remove(),this._mapbox=null}this.emergencyHandler&&this.emergencyHandler.destroy(),Bn.call(this,e),yn.reset()}setOptions(e,...t){if(!this.isReady){this._pendingOptions.push(arguments);return}let n=this._mapOptions;if(typeof e==`string`){let t=e,r=arguments[1];t===`padding`?r=p.extend(n.get(`padding`),r):[`minZoom`,`maxZoom`].indexOf(t)>-1&&(r=this.get(`renderMode`)===2?r:r+1),n.setRefinedOption(t,r)}else p.forEach(e,p.bind(function(e,t){this.setOptions(t,e)},this))}pickAll(e){let t={type:ce,features:[]};return t.features=this.queryRenderedFeatures(e).map(e=>{let{id:t,type:n,properties:r,geometry:i}=e,a={id:t,type:n,properties:r,geometry:i};return a.id||delete a.id,a}),t}queryOverlayFeatures(e,t){let n=this.getOverlayManager();return n?n.queryFeatures(p.box(e),t):[]}queryRenderedFeatures(e,t){e=p.box(e);let n=[];if(this.get(`renderMode`)===2){let t=null,r=e=>{let{type:n,source:r,layer:i,properties:a,geometry:o}=e;if(!Object.prototype.hasOwnProperty.call(he,r)||[me.POI,me.INDOOR_POI].indexOf(r)>=0&&z.indexOf(a.type)<0)return null;t===null&&(t=this._getAdLayerIds());let s=t.indexOf(i.id)>-1,c=he[r],l=r===me.INDOOR_GND?{id:c,source:c,indoorMaster:!0,poi:!1}:{id:s?R:c,source:c};return r===me.INDOOR_GND?{type:n,properties:a,source:c,layer:l,bbox:Le(o.coordinates[0])}:{type:n,geometry:o,properties:a,source:c,layer:l}},i=this.getMapbox(),a=i.project([e.x,e.y]),o=i.queryRenderedFeatures(a);p.forEach(o,e=>{let t=r(e);t&&n.push(t)})}else p.forEach([this.picker,this.indoorLayer],t=>{if(!t)return;let r=t.queryFeatures(e);r&&(r=p.isArray(r)?r:[r],n.push(...r))});if(t&&t.layers){let e=[];return p.forEach(n,n=>{t.layers.indexOf(n.layer.id)>=0&&e.push(n)}),e}return n}showIndoor(e,t){this.isActiveIndoorLayer()&&this.indoorLayer.showIndoor(e,t),this.picker&&this.picker.setIndoorInfo(e,t),this._overlayManager&&this._overlayManager.updateUnderSymbolOverlays()}hideIndoor(){this.isActiveIndoorLayer()&&this.indoorLayer.hideIndoor(),this.picker&&this.picker.clearIndoorInfo(),this._overlayManager&&this._overlayManager.updateUnderSymbolOverlays()}showIndoorGround(){this.get(`renderMode`)!==1&&(this.isActiveIndoorLayer()&&this.indoorLayer.showIndoorGround(),this.set(`isShowingIndoorGround`,!0))}hideIndoorGround(){this.get(`renderMode`)!==1&&(this.isActiveIndoorLayer()&&this.indoorLayer.hideIndoorGround(),this.set(`isShowingIndoorGround`,!1))}isActiveIndoorLayer(){return!!(this.indoorLayer&&this.indoorLayer.getMap())}getScreenshot(e,t){let n;return n=e instanceof p.PointBounds?e:new p.PointBounds(e),this.screenshot.takeScreenshot(n,t)}queryAdvertisementFeatures(e){e=p.box(e,p.LatLngBounds);let t=[],n=this.getMapbox();if(!n)return t;let r=n.project(e.getMin().toArray()),i=n.project(e.getMax().toArray()),a=n.queryRenderedFeatures([r,i],{layers:this._getAdLayerIds()});for(let n=0,r=a.length;n{t instanceof p.Point||(e[n]=p.box(t,p.LatLng))});let t;t=e[0]instanceof p.LatLng?p.LatLngBounds:p.PointBounds,e=t.bounds.apply(t,e)}else e=p.box(e,p.LatLngBounds);let n=null;t&&Be(t)&&(n=He(t)),this._mapModel.fitBounds(e,n)}panToGL(e,t){e=p.box(e,p.LatLng);let n=null;t&&ze(t)&&(n=W(t)),this._mapAction.panTo(e,n)}panToBoundsGL(e,t,n){e=p.box(e,p.LatLngBounds);let r=W(p.extend({duration:1e3,easing:`easeOutCubic`},t)),i=p.extend(p.trbl(),n);this._mapAction.panToBounds(e,r,i)}panByGL(e){e&&(e=p.box(e,p.Point),this._mapAction.panBy(e))}morphGL(e,t,n){let r=W({duration:500,easing:`easeOutCubic`}),i;i=Re(e)?p.extend(r,Ve(e)):p.extend(r,{center:p.box(e,p.LatLng).toLngLat()}),p.hasValue(t)&&(i.zoom=t),n&&ze(n)&&p.extend(i,W(n)),this._mapAction.easeTo(i)}setViewGL(e,t,n){let r=p.box(e,p.LatLng),i=p.hasValue(t)?t:this.getZoom(),a=p.extend({padding:{left:0,top:0,bottom:0,right:0},duration:500,easing:`easeOutCubic`,linear:!0},n);p.extend(a,W(a)),p.extend(a,He(a.padding)),this._mapAction.setView(r,i,a)}setLayerSourceMetadataUrl(e,t){let n=this._mapbox;if(!n)return;let r=n.getSource(e);r&&r.setUrl(t)}_mapType_changedGL(e){if(!e||!(e instanceof bt)||!this.get(`projection`))return;if(!this.isGLReady())return this.addListenerOnce(`glReady`,this._mapType_changed.bind(this,e));let t=this._mapbox.getStyle();if(!t)return;let n=t.name,r=e.getMapTypeStyle(),i=!1;if(typeof r==`string`){let e,t=r.substring(r.lastIndexOf(`/`)+1);if(t.length>0)e=t.replace(`.json`,``);else throw Error(`style path is invalid`);n!==e&&(i=!0)}else n!==r.name&&(i=!0);if(i){let e=e=>{this._updateLayersLayout(e),this._injectLayersToStyle(e),this._mapbox.setStyle(e,{diff:!0})};typeof r==`string`?G.loadJSON(r).then(t=>{e(t)}).catch(e=>{}):e(r)}this._mapModel.set(`mapTypeId`,this.getMapTypeId()),this._adjustZoomLimit(e)}_size_changedGL(e){In._size_changed.apply(this,[e]),this._resizeMapboxContainer()}_resizeMapboxContainer(){if(!this._mapbox)return;let e=this._mapbox.getCenter();this._mapbox.resize(),this._mapbox.setCenter(e)}initCustomObjects2D(){this.picker=new cn(this),this.indoorLayer=new un}initCustomObjectsGL(){this.indoorLayer=new pn}_initUserLanguage(e){if(p.USER_LANGUAGE||!e||!e.language)return;let t=e.language;t&&[w.KOREAN,w.ENGLISH,w.CHINESE,w.JAPANESE].indexOf(t)>-1&&(p.USER_LANGUAGE=t)}_initMapOptions(e){let{gl:t,zoom:n,minZoom:r,maxZoom:i,disableIndoorLayer:a,weather:o}=e,s=t&&p.glSupported(),c=p.hasValue(n)?n:15;s||(c=Math.round(c+1));let l=s?20:21,u=new p.MapOptions(this,U(U({},e),{},{zoom:c,minZoom:p.hasValue(r)?s?r:r+1:0,maxZoom:p.hasValue(i)?s?i:i+1:l,disableIndoorLayer:!p.hasValue(a)||a,weather:p.hasValue(o)?o:!1}));return r!==null&&u.set(`userMinZoom`,u.get(`minZoom`)),i!==null&&u.set(`userMaxZoom`,u.get(`maxZoom`)),p.IS_IN_HOUSE&&this._initServerPhase(u),this._listenMapOptions(u),this._mapOptions=u,u}_initServerPhase(e){if(!e.get(`gl`))return;let t=e.get(`serverPhase`)||(!D&&O?y.DEV:void 0);S.getInstance().init(t)}_addCopyrightControls(){Ln.apply(this),this._addInternalControl(`mapAttributionControl`,p.MapAttributionControl);let e=this._mapOptions.get(`mapAttributionControl`),t=this._mapOptions.get(`mapAttributionControlOptions`),n=this.mapAttributionControl&&this.mapAttributionControl.get(`scale`);e&&this.setOptions(`mapDataControl`,!1),e&&t&&n&&this.setOptions(`scaleControl`,!1)}_addDefaultControls(){Rn.apply(this),S.getServerPhase()!==y.REAL&&this._addInternalControl(`debuggerControl`,p.DebuggerControl)}_loadMeta(){let e=this._mapOptions,t=e.get(`gl`);if(!e.get(`ksa`)||!t){zn.apply(this);return}setTimeout(()=>{this.initMap({})},10)}_initGLParts(){let e=this._mapModel,t=this._mapView,n=this._mapOptions,r=n.get(`perceivedPerformance`);this.isGLReady()&&e.get(`center`)&&e.set(`zoom`,this._mapModel.get(`zoom`)-1,!0),this._overlayManager=new It,this._markerManager=new gn;let i=this.__isEnabledMapStyler?this._getStylerMapTypes():this._getGLMapTypes();this._changeRegistry(i);let a=this._createMapbox(n,i);this._mapbox=a,t.setMapbox(a),e.setMapbox(a),this._extendProjection(),n.set(`mapTypes`,i),this._fakeRasterMap&&r&&(a.getCanvasContainer().style.visibility=`hidden`),this.isGLReady()?this._onMapboxLoad():a.once(`load`,this._onMapboxLoad.bind(this)),this._boundOnMapboxMove||(this._boundOnMapboxMove=this._onMapboxMove.bind(this)),a.on(`move`,this._boundOnMapboxMove)}_get2DMapTypes(){let e=this.mapTypes||this._mapOptions.get(`mapTypes`);return(e.uid||``).indexOf(`naver:vectormap`)===0?an.getMapTypes():e}_getGLMapTypes(){let e=this.mapTypes||this._mapOptions.get(`mapTypes`);if((e.uid||``).indexOf(`naver:imagemap`)!==0)return e;let t=this._mapOptions,n=t.get(`weather`),r=t.get(`ksa`);return n?Nt.getWeatherMapTypes():r?An.getMapTypes():Nt.getMapTypes()}_getStylerMapTypes(){return K.getMapTypes()}_loadNaverMapStyles(e){let t=this._mapOptions,n=t.get(`glType`),r=t.get(`perceivedPerformance`),i=t.get(`weather`),a=t.get(`advertisement`),o=t.get(`realty`),s=t.get(`userMinZoom`),c=t.get(`userMaxZoom`);Nt.loadStyles(n,i,a,o).then(n=>{if(this._isGLModeActive()){if(!e&&r){this._fakeRasterMap=this._createRasterMapbox(t);let e=this._fakeRasterMap.getCanvasContainer();e.style.position=`absolute`,e.style.zIndex=`100`}this._afterStylesLoaded(e),p.hasValue(n==null?void 0:n.limitZoom)&&n.limitZoom{if(!this._isGLModeActive())return;if(!p.IS_IN_HOUSE){p.console.once(`네이버 지도 Open API 인증이 실패하였습니다. 클라이언트 아이디와 웹 서비스 URL을 확인해 주세요.`),this.destroy(!0);return}this._fakeRasterMap&&(this._fakeRasterMap.remove(),this._fakeRasterMap=null);let n=()=>{let n=this._mapModel.get(`zoom`);if((t==null?void 0:t.limitZoom){n()})})}_loadNcpStylerStyles(e){let t=this._mapOptions.get(`customStyleId`);K.loadStyles({customStyleId:t}).then(()=>{this._isGLModeActive()&&(this.__isEnabledMapStyler=!0,this._afterStylesLoaded(e))}).catch(n=>{this._isGLModeActive()&&((n==null?void 0:n.errorType)===xn.NOT_FOUND?(p.console.once(`"${t}" 해당하는 스타일이 없기 때문에 기본 지도로 전환합니다. "customStyleId" 값을 다시 확인해주세요.`),this._loadNaverMapStyles(e)):(n==null?void 0:n.errorType)===xn.SERVER_ERROR&&this.destroy(!0))})}_loadKsaMapStyles(e){An.loadStyles().then(()=>{this._afterStylesLoaded(e)}).catch(()=>{this._isGLModeActive()&&(p.console.once(`Failed to load Saudi Arabia map styles.`),this.destroy(!0))})}_isGLModeActive(){return!this._isDestroyed&&this.get(`renderMode`)===2}_afterStylesLoaded(e){if(this._isGLModeActive()){for(let e of Fn)this[e]=this[`${e}GL`];this._initGLParts(),this._mapAction.setMapModel(this.getMapModel()),e&&(this._assemble(this.getMapTypeId()),this._onMapboxMove()),this.listenMapEventsGL()}}_createRasterMapbox(e){if(this._fakeRasterMap)return;let t=e.get(`zoom`),n=e.get(`center`),r=e.get(`mapTypeId`),{mapType:i,subType:a}=(()=>{let e=`bg.ol.ts.lko`;return r===P.HYBRID?{mapType:de,subType:e}:r===P.TERRAIN?{mapType:ue,subType:e}:r===P.DARK?{mapType:fe,subType:e}:r===P.DARK_TERRAIN?{mapType:N,subType:e}:r===P.SATELLITE?{mapType:de,subType:`bg`}:{mapType:le,subType:e}})(),o={version:8,sources:{raster:{url:`${ee}/${i}.json?fmt=png&mt=${a}`,tileSize:256,type:`raster`}},layers:[{type:`raster`,source:`raster`,id:`raster`}]};return new c.Map({container:this._mapView.getTarget(),center:[n.x,n.y],zoom:t,style:o,boxZoom:!1,scrollZoom:!1,doubleClickZoom:!1,dragRotate:!1,pitchWithRotate:!1,attributionControl:!1})}_createMapbox(e,t){if(this._mapbox)return this._mapbox;let n=t?t.get(e.mapTypeId):e.mapTypes[e.mapTypeId],r=e.get(`maxBounds`);r&&!Array.isArray(r)&&(r=r.toLngLatBounds());let i=this._mapModel,a=e.get(`zoom`),o=e.get(`center`),s=e.get(`padding`);if(i.get(`center`)&&(a=i.get(`zoom`),o=i.get(`center`)),e.get(`ksa`)){let e=c.getRTLTextPluginStatus();(e===`unavailable`||e===`error`)&&c.setRTLTextPlugin(S.getPath(b.KSA_RTL_TEXT_PLUGIN),null)}let l=new c.Map({container:this._mapView.getElement(),interactive:!0,zoom:a,center:[o.x,o.y],style:n.getMapTypeStyle(),bearing:0,pitch:0,hash:!1,trackResize:!1,minZoom:this.getMinZoom()||0,maxZoom:this.getMaxZoom()||20,maxBounds:r,keyboard:!1,boxZoom:!1,dragRotate:!1,touchZoomRotate:!1,dragPan:!1,scrollZoom:e.scrollWheel,doubleClickZoom:!1,fadeDuration:50,attributionControl:!1,language:p.USER_LANGUAGE,localIdeographFontFamily:null,refreshExpiredTiles:!1,validateStyle:S.getServerPhase()!==y.REAL,maxCanvasSize:p.Agent.mobile?[4096,4096]:void 0});return s&&l.setPadding(s),l}_onMapboxMove(){this._triggerRedraw()}_onMapboxLoad(){let e=this._mapOptions,t=this._mapModel,n=this.getMapbox(),r=t.get(`center`),i=t.get(`zoom`),a=t.get(`rotation`),o=t.get(`tilt`),s=e.get(`zoomOrigin`);if(n.jumpTo({center:[r.x,r.y],zoom:i}),(a!==0||o!==0)&&n.easeTo({bearing:a,pitch:o,duration:Pn,animate:!0}),e.get(`scrollWheel`)&&(s?(n.scrollZoom.disable(),n.scrollZoom.enable({around:`center`})):n.scrollZoom.enable(),je()&&(Ne()||Pe())?n.scrollZoom.setZoomRate(1/450):n.scrollZoom.setZoomRate(1/200)),this._mapPane2D&&(this._mapPane2D.setMap(null),delete this._mapPane2D),this._triggerRedraw(),this._glReady=!0,this._overlayManager.ready(this),this._markerManager.ready(this),p.DOM.removeElement(this._mapbox._controlContainer),p.DOM.removeElement(this._mapbox._missingCSSCanary),this._fakeRasterMap){let e=this._mapbox.getCanvasContainer();e.style.visibility=`visible`;let t=this._fakeRasterMap.getCanvasContainer();p.DOM.animate(t,{opacity:0},{duration:300,easing:`easeInCubic`,complete:()=>{requestAnimationFrame(()=>{let e=this._fakeRasterMap.getCanvas();e.width=0,e.height=0,this._fakeRasterMap.remove(),this._fakeRasterMap=null,e&&(e.remove(),e=null),t&&(t.remove(),t=null)})}})}this.trigger(`glReady`),this.trigger(`tilesloaded`),this.trigger(`init`,{mapTypes:this.mapTypes.getTypeIds(),listOfFailed:[],tileTypes:[],listOfTileFailed:[],isFailed:!1})}_updateLayersLayout(e){let t=!!(this.layers&&this.layers[F.CADASTRAL]),n=!!(this.layers&&this.layers[F.MOUNTAIN]),r=!!(this.layers&&this.layers[F.TRANSIT]),i=!!(this.layers&&this.layers[F.STREET]),a=!!(this.layers&&this.layers[F.REALTY]&&e.name===P.NORMAL),o=!!(this.layers&&this.layers[F.CCTV]),s=!!(this.layers&&this.layers[F.BICYCLE]),c=e,l=Ue(c.name,c.metadata),u=this.getOptions(`glType`),d=this.getOptions(`disableIndoorLayer`);p.forEach(c.layers,e=>{if(!e.metadata||!e.metadata.group)return;let c=e.metadata.group;if(u===L.HYBRID&&Ke(l,c)){e.layout.visibility=t||a?`none`:`visible`;return}if(Qe(l,c)?e.layout.visibility=t?`visible`:`none`:Xe(l,c)&&(e.layout.visibility=t?`none`:`visible`),$e(l,c)?e.layout.visibility=n?`visible`:`none`:et(l,c)&&(e.layout.visibility=n?`none`:`visible`),tt(l,c)?e.layout.visibility=d?`none`:`visible`:nt(l,c)&&(e.layout.visibility=`none`),Ze(l,c)&&(e.layout.visibility=(this.__isPcWeb||r)&&!t?`visible`:`none`),rt(l,c)){if([F.INDOOR_VIEW,F.INDOOR_VIEW_DARK].indexOf(c)>-1){var f;e.layout.visibility=i&&(f=this.indoorLayer)!=null&&f.hasIndoorGroundObject()?`visible`:`none`}else e.layout.visibility=i?`visible`:`none`}ot(l,c)&&(e.layout.visibility=a?`visible`:`none`),it(l,c)&&(e.layout.visibility=o?`visible`:`none`),at(l,c)&&(e.layout.visibility=s?`visible`:`none`)})}_injectLayersToStyle(e){let t=this._mapbox,n=t.getStyle().layers;p.forEach(n,t=>{let n=t,r=We(n.id,e.layers);r&&n.layout.visibility!==r.layout.visibility&&(r.layout.visibility=n.layout.visibility)});let r=(n,r)=>{let i=[],{layerIndex:a}=Ge(e);p.forEach(n,n=>{let r=t.getLayer(n);if(r&&r.source){let n=t.getSource(r.source),a=n.serialize(),o=r.serialize(),s=!!We(o.id,e.layers);a&&(e.sources[n.id]=a),o&&!s&&i.push(o)}}),r&&a?e.layers.splice(a,0,...i):e.layers.push(...i)},i=this.getOverlayManager(),a=i.getLayerIdsUnderSymbol(),o=i.getLayerIdsAboveSymbol(),s=this.getMarkerManager();o.push(s.getLayerId()),r(a,!0),r(o,!1)}listenMapEvents(){let e=()=>{if(!this.initStatus||this.getOptions(`disableIndoorLayer`))return;this.indoorLayer||(this.indoorLayer=new un);let{uid:e}=this.getMapType(),{uid:t}=p.NaverStyleMapTypeOptions.getSatelliteMap(),{uid:n}=p.NaverStyleMapTypeOptions.getHybridMap();if([t,n].indexOf(e)>-1){this.indoorLayer.setIndoorGroundObject(null),this.indoorLayer.setMap(null);return}this.indoorLayer.setMap(this)};this.mapListeners=[p.Event.addListener(this,`init`,t=>{!t||t.isFailed||(this.initCustomObjects2D(),e())}),p.Event.addListener(this,`mapType_changed`,()=>{e(),this._handleTransitLayer()}),p.Event.addListener(this,`addLayer`,e=>{!this.indoorLayer||e.name!==F.STREET||this.indoorLayer.updateIndoor()}),p.Event.addListener(this,`removeLayer`,e=>{!this.indoorLayer||e!==F.STREET||this.indoorLayer.updateIndoor()}),p.Event.once(this,`tilesloaded`,()=>{e()}),p.Event.addListener(this,`cadastralLayer_changed`,this._handleTransitLayer.bind(this))]}listenMapEventsGL(){let e=()=>{if(this.getOptions(`disableIndoorLayer`))return;this.indoorLayer||(this.indoorLayer=new pn);let{uid:e}=this.getMapType(),{uid:t}=p.NaverVectorMapTypeOptions.getSatelliteMap(),{uid:n}=p.NaverVectorMapTypeOptions.getHybridMap();if([t,n].indexOf(e)>-1){this.indoorLayer.setMap(null);return}this.indoorLayer.getMap()?this.indoorLayer.refresh():this.indoorLayer.setMap(this)};this.mapListeners=[p.Event.addListener(this,`init`,t=>{!t||t.isFailed||(this.initCustomObjectsGL(),e())}),p.Event.addListener(this,`mapType_changed`,()=>{e(),this._handleTransitLayer()}),p.Event.addListener(this,`addLayer`,e=>{!this.indoorLayer||e.name!==F.STREET||this.indoorLayer.updateIndoor()}),p.Event.addListener(this,`removeLayer`,e=>{!this.indoorLayer||e!==F.STREET||this.indoorLayer.updateIndoor()}),p.Event.addListener(this,`webglcontextlost`,()=>{this._mapOptions.get(`ksa`)||this.switchTo(1)}),p.Event.addListener(this,`cadastralLayer_changed`,this._handleTransitLayer.bind(this))]}unlistenMapEvents(){p.Event.removeListener(this.mapListeners)}_destroy2D(){this.unlistenMapEvents();let e=this._mapAction;e&&e.destroy(),this.mapPane&&(this._mapPane2D=this.mapPane),this.picker&&(this.picker.destroy(),this.picker=null),this.indoorLayer&&(this.indoorLayer.setMap(null),this.indoorLayer=null),this.limitZoomHandler&&(this.limitZoomHandler.destroy(),this.limitZoomHandler=null)}_destroyGL(e){this.unlistenMapEvents();let t=this._mapbox;if(!t){e&&e();return}let n=Math.round(this._mapModel.get(`zoom`)),r=()=>{t.off(`move`,this._boundOnMapboxMove),delete this._boundOnMapboxMove;let r=this._mapView,i=this._mapAction;i&&i.destroy(),this._destroyGLManagers(),r&&r.setMapbox&&r.setMapbox(null),this.indoorLayer&&(this.indoorLayer.setMap(null),this.indoorLayer=null),this._mapModel.setMapbox(null),this._mapModel.set(`zoom`,n+1,!0),t.scrollZoom.disable(),e&&e()};this.getRotation()!==0||this.getTilt()!==0?(t.once(`moveend`,r),t.easeTo({zoom:n,bearing:0,pitch:0,duration:Pn,animate:!0})):r()}_destroyGLManagers(){let e=this._overlayManager,t=this._markerManager;e&&(e.destroy(),delete this._overlayManager),t&&(t.destroy(),delete this._markerManager)}_extendProjection(){let e=this.get(`mapSystemProjection`);if(!e)return;let t=this._mapView;e.fromPageXYToOffset=function(e){let n=t.getMapOffset();return e.clone().sub(n).sub(this.get(`containerTopLeft`))},e.fromPageXYToPoint=function(e){let t=this.fromPageXYToOffset(e);return this.fromOffsetToPoint(t)},e.fromPageXYToCoord=function(e){let t=this.fromPageXYToOffset(e);return this.fromOffsetToCoord(t)}}_initGLType(){this._mapOptions.set(`glType`,L.HYBRID,!0)}_handleTransitLayer(){if(!this.__isPcWeb)return;this.transitLayer||(this.transitLayer=new _n);let e=this.transitLayer.isEnabled(this);this.transitLayer.setMap(e?this:null)}_getAdLayerIds(){let e=[],t=this.getMapbox(),n=t&&t.getStyle(),r=n&&n.metadata;if(!r||!r[`map-types`])return e;let i=this.getMapTypeId(),a=this.getOptions(`mapTypes`)[i],o=n.layers,s=a.getMapTypeStyle().name,c=Ue(s,r),l=[...c[H.AD]||[],...c[H.AD_INDOOR]||[]];if(l.length===0)return e;for(let t=0,n=o.length;t-1&&e.push(n.id)}return e}static mixin(){e.mixed||(Te(p.Map,e),p.Map.prototype.switchTo=e.prototype.switchTo,p.Map.prototype.pickAll=e.prototype.pickAll,p.Map.prototype.destroy=e.prototype.destroy,p.Map.prototype._initUserLanguage=e.prototype._initUserLanguage,p.Map.prototype._addCopyrightControls=e.prototype._addCopyrightControls,p.Map.prototype._addDefaultControls=e.prototype._addDefaultControls,p.Map.prototype._loadMeta=e.prototype._loadMeta,p.Map.prototype.setOptions=e.prototype.setOptions,p.Map.prototype._initMapOptions=e.prototype._initMapOptions,p.Map.prototype.setZoom=e.prototype.setZoom,p.Map.prototype.getZoom=e.prototype.getZoom,p.Map.prototype.getMinZoom=e.prototype.getMinZoom,p.Map.prototype.getMaxZoom=e.prototype.getMaxZoom,p.Map.prototype.updateBy=e.prototype.updateBy,p.Map.prototype.morph=e.prototype.morph,p.Map.prototype.setView=e.prototype.setView,p.Map.prototype.autoResize=e.prototype.autoResize,e.mixed=!0)}};Nn=Vn,Nn.mixed=!1;var Hn=class extends p.MapSystemProjection{constructor(e){super(e),this._mapModel=e,this.bindTo(`mapbox`,e)}fromCoordToOffset(e){if(!e)return null;if(e instanceof g){let{x:t,y:n}=e;e=[t,n]}else{let{lng:t,lat:n}=e;e=[t,n]}let t=this.get(`mapbox`).project(e);return new g(t.x,t.y)}fromOffsetToCoord(e){if(!e)return null;if(e instanceof g){let{x:t,y:n}=e;e=[t,n]}let t=this.get(`mapbox`).unproject(e);return new _(t.lat,t.lng)}fromOffsetToPoint(e){let t=this.fromOffsetToCoord(e);return this.fromCoordToPoint(t)}fromCoordToPixelPoint(e){let t=this.get(`zoom`),n=this.fromCoordToPoint(e).clone();return this.scaleUp(n,t+1),n}fromPointToOffset(e){let t=this.fromPointToCoord(e);return this.fromCoordToOffset(t)}getDestinationCoord(e,t,n){return new p.LatLng(e.y,e.x).destinationPoint(t,n)}getDistance(e,t){let n=p.Math.radianPerDegree,r=e.y,i=t.y,a=e.x,o=t.x,s=(i-r)*n,c=(o-a)*n,l=Math.sin(s/2)*Math.sin(s/2)+Math.cos(r*n)*Math.cos(i*n)*Math.sin(c/2)*Math.sin(c/2);return 2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))*6378137}scaleDown(e,t){let n=this.factor(t);return e instanceof p.Point||e instanceof p.Size?e.div(n,n):e/n}scaleUp(e,t){let n=this.factor(t);return e instanceof p.Point||e instanceof p.Size?e.mul(n,n):e*n}factor(e){return 2**(e-(this.get(`projection`).minZoom||0))}},Un,Wn=[`projectionTopLeft`,`containerTopLeft`,`center`,`centerPoint`,`zoom`],Gn=[`padding_changed`,`mapTypeMinZoom_changed`,`mapTypeMaxZoom_changed`,`userMinZoom_changed`,`userMaxZoom_changed`,`setCenter`,`getCenter`,`setCenterPoint`,`getCenterPoint`,`setZoom`,`getZoom`,`setTilt`,`getTilt`,`setRotation`,`getRotation`,`getBounds`,`fitBounds`],Kn=p.MapModel.prototype,qn=class e extends p.MapModel{constructor(...e){super(...e),this._boundOnMapboxMove=null}setMapbox(e){let t=this.get(`mapbox`);t&&this._boundOnMapboxMove&&(t.off(`move`,this._boundOnMapboxMove),delete this._boundOnMapboxMove),this.set(`mapbox`,e),e?this.__switchTo(2):this.__switchTo(1)}getMapbox(){return this.get(`mapbox`)}calcBounds(){let e=this.get(`mapbox`),t=this.get(`zoom`);return!e&&this.get(`renderMode`)===2&&(t+=1),this.calcBoundsBy(this.get(`centerPoint`),t)}padding_changedGL(){}mapTypeMinZoom_changedGL(){let e=this.get(`mapbox`);if(!e)return;let t=this.getFittableMinZoom();t!==!1&&e.setMinZoom(t)}mapTypeMaxZoom_changedGL(){let e=this.get(`mapbox`);if(!e)return;let t=this.getFittableMaxZoom();t!==!1&&e.setMaxZoom(t)}userMinZoom_changedGL(e){let t=this.get(`mapbox`);!t||t.getMinZoom()===e||(e>this.get(`zoom`)&&this.setZoom(e,!0),t.setMinZoom(e))}userMaxZoom_changedGL(e){let t=this.get(`mapbox`);!t||t.getMaxZoom()===e||(e{this.removeLayer(e)}),this._layerIds=[]}removeLayer(e){!this._mapbox||!this._mapbox.getLayer(e)||this._mapbox.removeLayer(e)}detachMapbox(){this._mapbox=null}setMapGL(e){if(e||(e=null),e&&e.get(`renderMode`)===1){this.switchTo(1,e);return}if(this.getMap()){var t;this.onRemove(),this._unbindMap(),(t=this.get(`map`).getOverlayManager())==null||t.remove(this.getId()),this._mapbox=null}this.set(`map`,e),e&&(this._mapbox=e.getMapbox(),this._bindMap(e),this.onAdd(),e.getOverlayManager().add(this))}onAddGL(){}onRemoveGL(){}_switchTo(e,t){e===2?(Ee(this,this,er,`GL`),this.__renderMode=2,this._id=p.guid(),this._layerIds=[]):(Ee(this,tr,er),this.__renderMode=1)}_bindMapGL(e){let t=e.getMapModel();this.bindTo([`mapSystemProjection`,`padding`,`paddingOffset`,`renderMode`,`containerTopLeft`],t),this._renderModeListener=this.addListener(`renderMode_changed`,this._renderMode_changed.bind(this))}_unbindMapGL(){this.unbind(`mapSystemProjection`),this.unbind(`padding`),this.unbind(`paddingOffset`),this.unbind(`renderMode`),this.unbind(`containerTopLeft`),p.Event.removeListener(this._renderModeListener)}setOverlayIdProperties(e){e.properties?e.properties.__overlayId=this._id:e.properties={__overlayId:this._id}}static mixin(){e.mixed||(Te(p.OverlayView,e),e.mixed=!0)}};$n=nr,$n.mixed=!1;var rr={solid:[1],shortdash:[2,1],shortdot:[1,1],shortdashdot:[2,1,1,1],shortdashdotdot:[2,1,1,1,1,1],dot:[1,2],dash:[3,2],longdash:[7,2],dashdot:[3,2,1,2],longdashdot:[7,2,1,2],longdashdotdot:[7,2,1,2,1,2]},ir={line:{strokeWeight:`paint:line-width`,strokeOpacity:`paint:line-opacity`,strokeColor:`paint:line-color`,strokeStyle:`paint:line-dasharray`,strokeLineCap:`layout:line-cap`,strokeLineJoin:`layout:line-join`,visible:`layout:visibility`},fill:{fillColor:`paint:fill-color`,fillOpacity:`paint:fill-opacity`,visible:`layout:visibility`},symbol:{visible:`layout:visibility`},text:{visible:`layout:visibility`}},ar=Object.keys(rr).slice(1),or=class{constructor(){}static getStyle(e,t,n,r,i){if(!ir[e]||!ir[e][t])return null;let a=ir[e][t].split(`:`),o=a[0],s=a[1];switch(t){case`visible`:n=n?`visible`:`none`;break;case`strokeStyle`:n=this._getDashStyle(n,r,i);break;case`fillColor`:n=n===`none`?`rgba(0, 0, 0, 0)`:n}return{which:o,key:s,value:n}}static _getDashStyle(e,t,n){var r;if(Array.isArray(e)){let t=[];return p.forEach(e,e=>{t.push(e/(n||1))}),t}let i=[],a=(r=rr[e])==null?rr.solid:r;for(let e=0,n=a.length,r;e1&&(e%2==0?r=r===1?0:r:r*=2),i[e]=r;return i.length<2&&(i=null),i}},sr,cr=[`setStyles`,`setVisible`,`setZIndex`,`draw`],lr=p.AbstractShapeOverlay.prototype,ur=class e extends p.AbstractShapeOverlay{remove(){this.removeAllLayers(),this.removeSource()}addGeojsonSource(e){let t=p.hasValue(this.tolerance)?{tolerance:this.tolerance}:null;super.addSource(`geojson`,{type:se,geometry:{type:this.GEO_TYPE,coordinates:e}},t)}updateGeojsonSource(e){super.updateSource({type:se,geometry:{type:this.GEO_TYPE,coordinates:e}})}addLayers(){this.LAYER_TYPES.forEach(e=>{let t=this._getRefinedStyle(e);super.addLayer(e,t)})}updateStyle(e,t){let n=this.get(`strokeLineCap`),r=this.get(`strokeWeight`);this.LAYER_TYPES.forEach(i=>{let a=or.getStyle(i,e,t,n,r);a&&super.updateLayerProperty(i,a)})}rearrange(){this.removeAllLayers(),this.addLayers()}isReady(){let e=this.get(`map`);return!!(e&&e.isGLReady()&&!this.PROPERTIES_NAME.some(e=>!this[e]))}setStylesGL(e,...t){let n=this.PROPERTIES_NAME||[],r=this;if(typeof e==`string`){let r=e,i=t[0];if(r===`zIndex`)this.setZIndex(i);else if(n.indexOf(r)===-1)this.set(r,i),this.updateStyle(r,i);else throw Error(`The ${r} is not style property.`)}else p.forEach(e,(e,t)=>{r.setStyles(t,e)})}setVisibleGL(e){this.set(`visible`,e),this._layerIds.forEach(()=>{this.updateStyle(`visible`,e)})}setZIndexGL(e){if(e<0||this.get(`zIndex`)===e)return;let t=this.get(`map`),n=t&&t.getOverlayManager();this.set(`zIndex`,e),n&&n.has(this.getId())&&n.update(this.getId())}drawGL(){if(!this.isReady())return;let e=this._getCoordinates();this.hasSource()?this.updateGeojsonSource(e):(this.addGeojsonSource(e),this.addLayers())}_switchTo(e,t){let n=t==null?this.getMap():t,r=this._getOptions();e===2?(this.setMap(null),Ee(this,this,cr,`GL`),p.OverlayView.prototype._switchTo.apply(this,[e,r]),n.isGLReady()&&n.getOverlayManager()?(this.setMap(n),this.setOptions(r)):n.addListenerOnce(`glReady`,()=>{this.setMap(n),this.setOptions(this._getOptions())})):(this.setMap(null),Ee(this,lr,cr),p.OverlayView.prototype._switchTo.apply(this,[e,r]),Ee(this,lr,[`onAdd`,`onRemove`]),this.setMap(n),this.setOptions(r),this._initEvent())}_getCoordinates(){throw Error(`must implements`)}_getOptions(){let e={};return Object.keys(this.DEFAULT_OPTIONS).forEach(t=>{t!==`map`&&(e[t]=this.get(t))}),e}_getRefinedStyle(e){let t={layout:{},__layout:{},paint:{},__paint:{}},n=this.get(`strokeLineCap`),r=this.get(`strokeWeight`);return p.forEach(this.DEFAULT_OPTIONS,(i,a)=>{let o=or.getStyle(e,a,this.get(a),n,r);o&&(o.value&&(t[o.which][o.key]=o.value),t[`__`+o.which][o.key]=o.value)}),t}static mixin(){e.mixed||(Te(p.AbstractShapeOverlay,e),p.AbstractShapeOverlay.prototype._switchTo=e.prototype._switchTo,e.mixed=!0)}};sr=ur,sr.mixed=!1;var dr,fr=[`simplifyLevel_changed`],pr=p.Polygon.prototype,mr=class e extends p.Polygon{drawGL(){if(!this.isReady())return;let e=this._getCoordinates();this.GEO_TYPE!==`MultiPolygon`&&e[0]&&e[0].length===2?(this.GEO_TYPE=ae,e=e[0]):this.GEO_TYPE=this.getGeometryType(),this.hasSource()?this.updateGeojsonSource(e):(this.addGeojsonSource(e),this.addLayers())}_onRenderModeChanged(e,t=void 0){e===this.__renderMode||!this.__renderMode&&e===1||(e===2?(Ee(this,this,fr,`GL`),this.GEO_TYPE=this.getGeometryType(),this.LAYER_TYPES=[`fill`,`line`]):(Ee(this,pr,fr),delete this.GEO_TYPE,delete this.LAYER_TYPES),super._switchTo(e,t))}_getCoordinates(){if(this.GEO_TYPE===`MultiPolygon`)return this._raw.geometry.coordinates;let e=this.getPaths().getArray().map(e=>e.getArray().map(e=>[e.x,e.y])),t=e.length;for(let n=0;n2&&(r[0]!==i[0]||r[1]!==i[1])&&t.push(t[0]),t.length===3&&(r[0]===i[0]||r[1]===i[1])&&t.pop()}return e}getGeometryType(){return this._raw&&this._raw.geometry?this._raw.geometry.type:oe}simplifyLevel_changedGL(){}static mixin(){e.mixed||(Te(p.Polygon,e),p.Polygon.prototype.switchTo=e.prototype._onRenderModeChanged,p.Polygon.prototype.drawGL=e.prototype.drawGL,p.Polygon.prototype._getCoordinates=e.prototype._getCoordinates,e.mixed=!0)}};dr=mr,dr.mixed=!1;var hr,gr=[`simplifyLevel_changed`],_r=p.Polyline.prototype,vr=class e extends p.Polyline{_onRenderModeChanged(e,t=void 0){e===this.__renderMode||!this.__renderMode&&e===1||(e===2?(Ee(this,this,gr,`GL`),this.GEO_TYPE=ae,this.LAYER_TYPES=[`line`]):(Ee(this,_r,gr),delete this.GEO_TYPE,delete this.LAYER_TYPES),super._switchTo(e,t))}_getCoordinates(){return this.getPath().getArray().map(e=>{let t=e;return[t.x,t.y]})}_simplifyLevel_changedGL(){}static mixin(){e.mixed||(Te(p.Polyline,e),p.Polyline.prototype.switchTo=e.prototype._onRenderModeChanged,p.Polyline.prototype._getCoordinates=e.prototype._getCoordinates,e.mixed=!0)}};hr=vr,hr.mixed=!1;var yr,br=class e extends p.Circle{_onRenderModeChanged(e,t=void 0){e===this.__renderMode||!this.__renderMode&&e===1||(e===2?(this.GEO_TYPE=oe,this.LAYER_TYPES=[`fill`,`line`]):(delete this.GEO_TYPE,delete this.LAYER_TYPES),super._switchTo(e,t))}_getCoordinates(){let e=[],t=this.getRadius(),n=Fe(this.getCenter(),t,t,64);return e.push(n),e}static mixin(){e.mixed||(Te(p.Circle,e),p.Circle.prototype.switchTo=e.prototype._onRenderModeChanged,p.Circle.prototype._getCoordinates=e.prototype._getCoordinates,e.mixed=!0)}};yr=br,yr.mixed=!1;var xr,q=class e extends p.Ellipse{_onRenderModeChanged(e,t=void 0){e===this.__renderMode||!this.__renderMode&&e===1||(e===2?(this.GEO_TYPE=oe,this.LAYER_TYPES=[`fill`,`line`]):(delete this.GEO_TYPE,delete this.LAYER_TYPES),super._switchTo(e,t))}_getCoordinates(){let e=[],t=this.getBounds(),n=(t.minX()+t.maxX())/2,r=(t.minY()+t.maxY())/2,i=new p.LatLng(t.maxY(),n),a=new p.LatLng(r,t.minX()),o=new p.LatLng(r,n),s=Fe(o,Ie(a,o),Ie(i,o),64);return e.push(s),e}static mixin(){e.mixed||(Te(p.Ellipse,e),p.Ellipse.prototype.switchTo=e.prototype._onRenderModeChanged,p.Ellipse.prototype._getCoordinates=e.prototype._getCoordinates,e.mixed=!0)}};xr=q,xr.mixed=!1;var Sr,Cr=class e extends p.Rectangle{_onRenderModeChanged(e,t=void 0){e===this.__renderMode||!this.__renderMode&&e===1||(e===2?(this.GEO_TYPE=oe,this.LAYER_TYPES=[`fill`,`line`]):(delete this.GEO_TYPE,delete this.LAYER_TYPES),super._switchTo(e,t))}_getCoordinates(){let e=[],t=this.getBounds(),n=[[t.minX(),t.minY()],[t.maxX(),t.minY()],[t.maxX(),t.maxY()],[t.minX(),t.maxY()]];return n.push(n[0]),e.push(n),e}static mixin(){e.mixed||(Te(p.Rectangle,e),p.Rectangle.prototype.switchTo=e.prototype._onRenderModeChanged,p.Rectangle.prototype._getCoordinates=e.prototype._getCoordinates,e.mixed=!0)}};Sr=Cr,Sr.mixed=!1;var wr,J=class e extends p.Layer{setMap(e){let t=this.getMap();if(e!==t){if(e&&e.get(`renderMode`)===2){this.switchTo(2,e);return}if(!(e&&!this._checkLayerSupported(e))){if(this._beforeSetMap(e),e){this.map=e;let t=this.getLayerType(),n=t.getMapTypeOptions?t.getMapTypeOptions():null,r=!this.options.forceOverlayToMapType;n&&(n.map=e),r&&this._initPane().setMapTypeRegistry(this.registry),this._listenEvent(e),this._updateRegistry(e),this._addToMap(e)}else t&&(this._destroy(),this._unlistenEvent());return this.set(`map`,e),this._afterSetMap(e),!0}}}_checkLayerSupported(e){return!0}_listenEvent(e){this._unlistenEvent(),this._renderModeListener=p.Event.addListener(e,`renderMode_changed`,this._renderMode_changed.bind(this))}_unlistenEvent(){this._renderModeListener&&(p.Event.removeListener(this._renderModeListener),this._renderModeListener=null)}switchTo(e,t=void 0){}_renderMode_changed(e){this._onRenderModeChanged&&this._onRenderModeChanged(e)}static mixin(){e.mixed||(Te(p.Layer,e),p.Layer.prototype.setMap=e.prototype.setMap,p.Layer.prototype._checkLayerSupported=e.prototype._checkLayerSupported,e.mixed=!0)}};wr=J,wr.mixed=!1;var Y=class extends p.Layer{constructor(e){let t=p.extend({forceOverlayToMapType:!0},e);super(`mountain`,p.NaverStyleMapTypeOptions.getMountainLayer(),t)}};p.MountainLayer=Y;var Tr=class extends p.Layer{constructor(e){let t=p.extend({forceOverlayToMapType:!0},e);super(`cctv`,p.NaverStyleMapTypeOptions.getCctvLayer(),t),this._cctvLayerFilter={}}setFilter(e,t){let n=this.getMap();if(!n||n.get(`renderMode`)!==2)return;let r=n.getMapbox();p.forEach(this._layerIds,n=>{this._cctvLayerFilter[n]||(this._cctvLayerFilter[n]=p.clone(r.getFilter(n)));let i=this._cctvLayerFilter[n];if(t){let a=p.clone(i);a.push([`in`,e,...t]),r.setFilter(n,a)}else r.setFilter(n,i)})}},Er=100,Dr=class extends p.CustomControl{constructor(e){super(e),this.mapListeners=[],this.providersHash={},this.prepareDOM(this.getElement())}_getDefaultControlOptions(){return{logo:!1,scale:!0,position:C.RIGHT_BOTTOM}}_beforeSetMap(e){this.map&&!e&&this.unlistenMapEvents()}_afterSetMap(e){e&&(this.initProviders(),this.listenMapEvents(),this.updateDisplayList())}prepareDOM(e){let t=`${A}/new-naver-logo-normal.png`;e.style.cssText+=`display: flex; font-size: 1px; font-family: -apple-system, BlinkMacSystemFont, helvetica, 'Apple SD Gothic Neo', sans-serif; line-height: 1px; align-items: flex-end`,e.style.padding=p.Agent.mobile?`0 6px 5px`:`0 15px 9px 6px`,this.attributionElement=p.DOM.createElement(`div`,`margin-left: 4px; font-size: 10px; font-weight: 500; color: #1c1c1c; line-height: 12px; letter-spacing: -0.3px; order: 2; text-shadow: rgba(255, 255, 255, 0.7) 1px 1px, rgba(255, 255, 255, 0.7) -1px 1px, rgba(255, 255, 255, 0.7) 1px -1px, rgba(255, 255, 255, 0.7) -1px -1px; order: 2;`),this.get(`logo`)&&(this.logoElement=p.DOM.createElement(`div`,`width: 45px; height: 10px; margin-bottom: 1px; order: 1; cursor: pointer;`),this.logoElement.innerHTML=`NAVER`,this.logoImageElement=this.logoElement.getElementsByTagName(`img`)[0],this.logoElement.onclick=()=>{window.open(xt.link,`_blank`)},e.appendChild(this.logoElement)),this.get(`scale`)&&(this.scaleElement=p.DOM.createElement(`div`,`display: inline-flex; margin-left: 9px; font-size: 1px; line-height: 1px; order: 3; align-items: center;`),this.scaleDistanceSpan=p.DOM.createElement(`span`,`font-size: 10px; font-weight: 500; color: #1c1c1c; line-height: 12px; text-shadow: rgba(255, 255, 255, 0.7) 1px 1px, rgba(255, 255, 255, 0.7) -1px 1px, rgba(255, 255, 255, 0.7) 1px -1px, rgba(255, 255, 255, 0.7) -1px -1px;`),this.scaleFigureSpan=p.DOM.createElement(`span`,`margin-left: 3px; width: 50px; height: 6px; border: 2px solid #000; border-width: 0 2px 2px; box-sizing: border-box; transition: width 0.2s ease-in-out;`),this.scaleElement.appendChild(this.scaleDistanceSpan),this.scaleElement.appendChild(this.scaleFigureSpan),e.appendChild(this.scaleElement)),e.appendChild(this.attributionElement)}listenMapEvents(){this.mapListeners=[p.Event.addListener(this.map,`mapType_changed`,this.onMapTypeChanged.bind(this)),p.Event.addListener(this.map,`addLayer`,this.onAddLayer.bind(this)),p.Event.addListener(this.map,`removeLayer`,this.onRemoveLayer.bind(this)),p.Event.addListener(this.map.getMapAction(),`idle`,this.onIdle.bind(this))]}unlistenMapEvents(){p.Event.removeListener(this.mapListeners)}updateDisplayList(){let e=this.getElement().parentElement;e.style.height=`auto`,this.updateAttributions(),this.updateScale()}initProviders(){let{provider:e}=this.map.getMapType().getOptions();this.providersHash.basemap=e,this.checkValidation(this.providersHash.basemap)}getProviders(){let e=this.getMap().getSize().width<650,t=[];return p.forEach(this.providersHash,(n,r)=>{e&&r!==`basemap`||p.forEach(n,e=>{Object.prototype.hasOwnProperty.call(e,`validation`)&&!e.validation||t.push(e)})}),t}updateAttributions(){let e=this.get(`logo`);this.attributionElement.innerHTML=e?``:`© `;let t=0,n=!!p.Agent.mobile,r=this.getProviders(),i=[],a=r.length;for(let o=0;o${r}`:r;o{this.checkValidation(e)}),this.updateDisplayList()}checkValidation(e){let t=this.map.getBounds();p.forEach(e,e=>{let n=!1;if(!e.bounds&&!e.area){e.validation=!0;return}if(e.validation=!1,e.area&&t.isInsidePolygon){let n=t.isInsidePolygon(e.area);e.validation=e.exclude?!n:n}else{let r=Array.isArray(e.bounds)?e.bounds:[e.bounds],i=r.length;for(let a=0;a=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:this.getDecimalRoundNum(n),t*n}addUnitToDistance(e){let t=`m`;return e>=1e3&&(e/=1e3,t=`km`),`${e}${t}`}adjustColor(){let e=this.map.getMapType().darktheme,t=e?`#f8f8f8`:`#1c1c1c`,n=e?`rgba(0, 0, 0, 0.7) 1px 1px, rgba(0, 0, 0, 0.7) -1px 1px, rgba(0, 0, 0, 0.7) 1px -1px, rgba(0, 0, 0, 0.7) -1px -1px`:`rgba(255, 255, 255, 0.7) 1px 1px, rgba(255, 255, 255, 0.7) -1px 1px, rgba(255, 255, 255, 0.7) 1px -1px, rgba(255, 255, 255, 0.7) -1px -1px`,r=e?`#fff`:`#000`;this.attributionElement.style.color=t,this.attributionElement.style.textShadow=n,this.get(`scale`)&&(this.scaleDistanceSpan.style.color=t,this.scaleDistanceSpan.style.textShadow=n,this.scaleFigureSpan.style.borderRightColor=r,this.scaleFigureSpan.style.borderLeftColor=r,this.scaleFigureSpan.style.borderBottomColor=r),this.get(`logo`)&&(e?this.logoImageElement.src=this.logoImageElement.src.replace(`-normal.png`,`-dark.png`):this.logoImageElement.src=this.logoImageElement.src.replace(`-dark.png`,`-normal.png`))}};p.MapAttributionControl=Dr;function Or(e,t){return new Promise(n=>{p.Event.once(e,t,()=>n())})}var kr=class extends p.CustomControl{constructor(e){super(e),this.prepareDOM(this.getElement())}_getDefaultControlOptions(){return{position:C.BOTTOM_CENTER}}_afterSetMap(e){if(!e)return;if(this.setupStats(),e.get(`renderMode`)!==2){this.setupGUI(this.setupRasterGUI.bind(this));return}let t=e.controls?Promise.resolve():Or(e,`assemble`),n=e.isGLReady()?Promise.resolve():Or(e,`init`);t.then(()=>n).then(()=>{this.setupGUI(this.setupVectorGUI.bind(this))})}prepareDOM(e){e.style.cssText+=`background: #424242; box-sizing: content-box !important; user-select: none; z-index: 100`;let t=p.DOM.createElement(`div`,`padding-left: 0.1rem; display: flex; flex-wrap: wrap; flex-direction: column;`);this.statsContainer=p.DOM.createElement(`div`),this.guiContainer=p.DOM.createElement(`div`),t.appendChild(this.statsContainer),t.appendChild(this.guiContainer),e.appendChild(t)}setupStats(){let e=`debugger_stats`;if(document.getElementById(e))return;let t=document.createElement(`script`);t.onload=()=>{let t=new Stats;t.dom.style.cssText=`display: flex; flex-wrap: wrap; cursor: pointer; z-index: 999;`,p.forEach(t.dom.children,e=>{e.style.display=`inline-block`,e.style.width=`80px`,e.style.height=`44px`,e.style.marginRight=`2px`}),t.dom.id=e,this.statsContainer.appendChild(t.dom),this.resize(),requestAnimationFrame(function e(){t.update(),requestAnimationFrame(e)})},t.src=`https://mrdoob.github.io/stats.js/build/stats.min.js`,document.head.appendChild(t)}updateMapType(e){this.map&&this.map.setMapTypeId(e===`none`?`normal`:e)}resize(){this.setPosition(this.getOptions(`position`))}setupGUI(e){let t=`debugger_gui`;if(document.getElementById(t))return;let n=document.createElement(`script`);n.onload=()=>{let n=new dat.GUI({autoPlace:!1,closed:!0});e&&e(n),n.domElement.id=t,n.close(),this.guiContainer.style.marginBottom=`1.5rem`,this.guiContainer.appendChild(n.domElement);let r=n.domElement.querySelectorAll(`input`);for(let e of r)e.style.cssText+=`-webkit-appearance: auto; appearance:auto;`;let i=n.domElement.querySelectorAll(`.cr`);for(let e of i)e.style.margin=`0`;this.resize()},n.src=`https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.7/dat.gui.min.js`,document.head.appendChild(n)}setupRasterGUI(e){this.map&&(p.Event.addDOMListener(e.__closeButton,`click`,this.resize.bind(this)),e.add({map_types:`none`},`map_types`,[`none`,`dark`,`dark_terrain`]).listen().onChange(e=>{this.updateMapType(e)}))}setupVectorGUI(e){if(!this.map||this.map.get(`renderMode`)!==2)return;let t={style_url:``,collision_boxes:!1,map_types:`none`,rendering_mode:this.map.getOptions(`glType`)===L.VECTOR?L.VECTOR:L.HYBRID};p.Event.addDOMListener(e.__closeButton,`click`,this.resize.bind(this)),e.add(t,`style_url`).listen().onFinishChange(e=>{this.updateStyleURL(e)}),e.add(t,`rendering_mode`,{vector:L.VECTOR,hybrid:L.HYBRID}).listen().onFinishChange(e=>{this.updateRenderingMode(e)}),e.add(t,`map_types`,[`none`,`dark`,`dark_terrain`]).listen().onChange(e=>{this.updateMapType(e)}),e.add(t,`collision_boxes`).listen().onFinishChange(e=>{this.updateCollisionBoxes(e)});let n=this.map.getMapbox().scrollZoom._defaultZoomRate||.005;e.add({zoom_rate:1/n},`zoom_rate`,1,1e3,10).listen().onFinishChange(e=>{this.updateZoomRate(`trackpad`,e)})}updateStyleURL(e){e&&this.map.getMapbox().setStyle(e,{diff:!1})}updateRenderingMode(e){let t=this.map,n=this.map.getMapbox();!t||!n||t.getOptions(`glType`)===e||Nt.loadStyles(e).then(()=>{let r=t.getMapTypeId(),i=Nt.getMapTypes(),a=i.get(r).getMapTypeStyle();t.setOptions(`glType`,e),t._changeRegistry(i),t._updateLayersLayout(a),t._injectLayersToStyle(a),n.setStyle(a,{diff:!1})})}updateCollisionBoxes(e){let t=this.map.getMapbox();t.showCollisionBoxes=e}updateZoomRate(e,t){let n=this.map.getMapbox();if(n.scrollZoom){let r=e===`wheel`?`setWheelZoomRate`:`setZoomRate`;n.scrollZoom[r](1/t)}}};p.DebuggerControl=kr;var Ar=class{constructor(e,t,n,r){this.stability=8,this.sensitivity=100,this.tolerance=1.1,this.delay=150,this.stability=e==null?8:Math.abs(e),this.sensitivity=t==null?100:1+Math.abs(t),this.tolerance=n==null?1.1:1+Math.abs(n),this.delay=r==null?150:r;let i=()=>{let e=[],t=this.stability*2;for(let n=1;1<=t?n<=t:n>=t;1<=t?n++:n--)e.push(null);return e};this.lastUpDeltas=i(),this.lastDownDeltas=i(),this.deltasTimestamp=i()}check(e){e=e.originalEvent||e;let t;return e.wheelDelta==null?e.deltaY==null?(e.detail!=null||e.detail===0)&&(t=e.detail*-40):t=e.deltaY*-40:t=e.wheelDelta,this.deltasTimestamp.push(Date.now()),this.deltasTimestamp.shift(),t>0?(this.lastUpDeltas.push(t),this.lastUpDeltas.shift(),this.isInertia(1)):(this.lastDownDeltas.push(t),this.lastDownDeltas.shift(),this.isInertia(-1))}isInertia(e){let t=e===-1?this.lastDownDeltas:this.lastUpDeltas;if(t[0]===null)return e;if(this.deltasTimestamp[this.stability*2-2]+this.delay>Date.now()&&t[0]===t[this.stability*2-1])return!1;let n=t.slice(0,this.stability),r=t.slice(this.stability,this.stability*2),i=n.reduce((e,t)=>e+t),a=r.reduce((e,t)=>e+t),o=i/n.length,s=a/r.length;return Math.abs(o)0?1:-1,a=this._getZoomOrigin(e);this.zoomBy(i,a,!0)}static mixin(){e.mixed||(Te(p.MapAction,e),p.MapAction.prototype._onWheel=e.prototype._onWheel,e.mixed=!0)}};jr=Pr,jr.mixed=!1;var Fr,Ir=class e extends p.MapOptions{limitMinZoom(e){return this.isDefaultMapType()?e>5?e:5:e}limitMaxBounds(e){if(!this.isDefaultMapType())return e;e=p.box(e);let t=p.LatLngBounds({lng:100.28,lat:26.43},{lng:160.12,lat:49.55});return t.hasBounds(e)?e:t}static mixin(){e.mixed||(Te(p.MapOptions,e),p.MapOptions.prototype.limitMinZoom=e.prototype.limitMinZoom,p.MapOptions.prototype.limitMaxBounds=e.prototype.limitMaxBounds,e.mixed=!0)}};Fr=Ir,Fr.mixed=!1;var Lr=function(e){return e.RADIUS=`radius`,e.DISTANCE=`distance`,e}({}),Rr={COLOR:`#000000`,HALO_COLOR:`#ffffff`,HALO_WIDTH:1},zr={COLOR:`#ffffff`,HALO_COLOR:`#000000`,HALO_WIDTH:1.5},Br=0,Vr=21,Hr=new p.Point(0,1.1),Ur=5,Wr=12,Gr=`radius`,Kr=7,qr=30,Jr=5,Yr=9999999999,Xr=2,Zr=[`draw`,`onAdd`,`onRemove`,`setVisible`,`setZIndex`,`setStyles`,`featureCollection_changed`],Qr=class e extends p.OverlayView{constructor(e){var t;super(),this.OVERLAY_TYPE=`MarkerGroup`,this.STYLES_NAME=[`icon`,`stylingFunction`,`zIndex`],this._markers=[],this._listeners=[],this._mapboxImageIds=[],this._useText=!1,this._useAutoColor=!1,this._clusterMarkers={},this._clusterMarkersOnScreen={},this._userVisible=!0,this.DEFAULT_OPTIONS={map:null,featureCollection:{type:ce,features:[]},stylingFunction:null,icon:null,text:null,subText:null,clickable:!0,visible:!0,zIndex:0},this._useAutoColor=!((t=e.text)!=null&&t.color),this.setOptions(p.extend({},this.DEFAULT_OPTIONS,e)),this._userVisible=this.get(`visible`)!==!1}setOptions(e,...t){if(typeof e==`string`){let n=e,r=t[0],i={};this.STYLES_NAME.indexOf(n)>=0?this.setStyles(n,r):n===`visible`?this.setVisible(r):(i[n]=r,this.setValues(i))}else p.forEach(e,(e,t)=>{t!==`map`&&this.setOptions(t,e)}),e.map!==void 0&&this.setMap(e.map)}getOptions(e){let t={};if(e!==void 0)return this.get(e);var n;return p.forEach((n=this.DEFAULT_OPTIONS)==null?{}:n,(e,n)=>{t[n]=this.get(n)}),t}setClickable(e){this.set(`clickable`,e)}getClickable(){return this.get(`clickable`)}getVisible(){return this.get(`visible`)}_onRenderModeChanged(e){this.switchTo(e)}setStyles(e,...t){if(typeof e==`string`){let n=e,r=t[0],i={};if(this.STYLES_NAME.indexOf(e)<0)return;if(n===`zIndex`){this.setZIndex(r);return}this.set(n,r),i[n]=r,p.forEach(this._markers,e=>{e.setOptions(i)})}else p.forEach(e,(e,t)=>{this.setStyles(t,e)})}setZIndex(e){e<0||(this.set(`zIndex`,e),p.forEach(this._markers,t=>{t.setZIndex(e)}))}setVisible(e){this._userVisible=e,this.get(`visible`)!==e&&(this.set(`visible`,e),p.forEach(this._markers,t=>{t.setOptions(`visible`,e)}))}onAdd(){if(!this.getMap())return;let{features:e}=this.getOptions(`featureCollection`);e&&(p.forEach(e,e=>{let t=this.createMantleSimpleMarker(e);t&&this._markers.push(t)}),this._listeners.push(this.map.addListener(`zoom_changed`,this.updateVisible.bind(this))))}onRemove(){p.Event.removeListener(this._listeners),this._listeners=[],p.forEach(this._markers,e=>{e.setMap(null)}),this._markers=[]}draw(){}createMantleSimpleMarker(e){let t=[`click`,`dblclick`,`mousedown`,`mousemove`,`mouseup`,`rightclick`],{stylingFunction:n,icon:r,clickable:i,zIndex:a}=this.getOptions(),o=n?n(e):r;if(!o)return;let s=this._getVisibility(),c=new p.SimpleMarker({map:this.getMap()||null,position:e.geometry.coordinates,icon:o,visible:s,clickable:i,zIndex:a,__raw:e});return t.forEach(e=>{this._listeners.push(c.addListener(e,t=>{p.Event.trigger(this,e,this.getEventObject(t))}))}),c}getEventObject(e){return U(U({},e),{},{latlng:e.coord,data:e.overlay?e.overlay.__raw:null})}featureCollection_changed(e){let t=this.getMap(),{features:n}=e;if(!t||!n)return;let r=[],i=[];p.forEach(this._markers,e=>{let{id:t}=e.__raw;t&&n.findIndex(e=>e.id&&e.id===t)>=0?r.push(e):e.setMap(null)}),p.forEach(n,e=>{let{id:t}=e;if(t&&r.findIndex(e=>{var n;return((n=e.__raw)==null?void 0:n.id)===t})>=0)return;let n=this.createMantleSimpleMarker(e);n&&i.push(n)}),this._markers=r.concat(i)}setZIndexGL(e){if(e<0)return;this.set(`zIndex`,e);let t=this.get(`map`),n=t&&t.getOverlayManager(),r=this.getId();n&&n.has(r)&&n.update(r)}setVisibleGL(e){this._userVisible=e,this.get(`visible`)!==e&&(this.set(`visible`,e),this.updateStyle(`visible`,e),p.forEach(this._clusterMarkersOnScreen,t=>{!t||!t.getMap()||t.setVisible(e)}))}setStylesGL(e,...t){if(typeof e==`string`){let n=e,r=t[0];if(this.STYLES_NAME.indexOf(e)<0)return;n===`zIndex`?this.setZIndex(r):n===`icon`||n===`stylingFunction`?(this.set(n,r),this.updateFeatures()):(this.set(n,r),this.updateStyle(n,r))}else p.forEach(e,(e,t)=>{this.setStyles(t,e)})}onAddGL(){if(!this.getMap())return;let e=this.getMap();this._listeners.push(e.addListener(`mapType_changed`,e=>{if(!this._useText||!this._useAutoColor)return;let t=e&&e.darktheme,n=this.getOptions(`featureCollection`),{features:r}=n;p.forEach(r,e=>{this.updateFeatureTextProperties(e,t)}),this.updateSource(n)})),this._listeners.push(e.addListener(`render`,this.updateVisible.bind(this))),this._listeners.push(e.addListener(`render`,this.updateCluster.bind(this)))}onRemoveGL(){p.Event.removeListener(this._listeners),this._listeners=[],this.removeClusterMarkers()}switchTo(t,n=void 0){if(t===this.__renderMode||!this.__renderMode&&t===1)return;let r=n==null?this.getMap():n,i=this.getOptions(),a=e=>{this.getOptions(),this.setMap(e)};t===2?(this.setMap(null),Ee(this,this,Zr,`GL`),super._switchTo(t,i),this.GEO_TYPE=ce,this.LAYER_TYPES=[`symbol`],r.isGLReady()&&r.getOverlayManager()?a(r):r.addListenerOnce(`glReady`,()=>{a(r)})):(this.setMap(null),Ee(this,e.prototype,Zr),super._switchTo(t,i),Ee(this,e.prototype,[`onAdd`,`onRemove`]),this.setMap(r),delete this.GEO_TYPE,delete this.LAYER_TYPES)}drawGL(){let e=this.getMap();if(!(e&&e.isGLReady()))return;let t=this.getOptions(`featureCollection`),n=this.createMapboxFeatures(t);this.hasSource()||(this.addSource(null),this.addLayers()),Promise.all(n).then(()=>{this.getMap()&&this.updateSource(t)})}remove(){this.removeAllLayers(),this.removeSource();let e=this.getMap().getMapbox();p.forEach(this._mapboxImageIds,t=>{e.removeImage(t)}),this._mapboxImageIds=[]}rearrange(){this.removeAllLayers(),this.addLayers()}addSource(e){if(this.hasSource())return;let t=this.getOptions(`cluster`),n={type:`geojson`,data:e};if(t){let{type:e,maxZoom:r,radius:i,distance:a}=this.getClusterOptions(t);n.cluster=!0,n.clusterType=e,n.clusterMaxZoom=r,n.clusterRadius=i,n.clusterDistance=a}this._mapbox.addSource(this._id,n)}addLayers(){let{text:e,subText:t}=this.getOptions();p.forEach(this.LAYER_TYPES,n=>{let r={layout:{},__layout:{},paint:{},__paint:{}},i={"symbol-z-order":`source`,"icon-allow-overlap":!0,"icon-always-allow-overlap":!0,"icon-padding":0,"icon-image":[`get`,`__iconImage`]},a=Yr,{minZoom:o=Br,maxZoom:s=Vr,allowOverlap:c=!1,size:l=Wr,maxWidth:u=Ur}=e||{};if(this._useText&&(i[`symbol-placement-priority`]={stops:[[o-.1,0],[o,a],[s,a],[s+.1,0]]}),r.layout=r.__layout=i,this.addLayer(n,r),this._useText){let e=Object.create(r),n={"symbol-placement-priority":9999999998,"symbol-sort-key":[`get`,`__sortKey`],"text-allow-overlap":c,"text-anchor":`top`,"text-offset":[`get`,`__textOffset`],"text-line-height":1.15,"text-letter-spacing":-.04,"text-padding":0,"text-max-width":u,"text-font":[`NotoSansCJKkr-Medium${Nt.USE_COMPLETE_FONT?`-Complete`:``}`],"text-size":l,"text-field":{stops:[[o-1,``],[o,`{__textField}`],[s+1,``]]}},i={"text-halo-width":[`get`,`__textHaloWidth`],"text-halo-color":[`get`,`__textHaloColor`],"text-color":[`get`,`__textColor`]};t&&t.content&&(n[`subtext-field`]={stops:[[o-1,``],[o,`{__subTextField}`],[s+1,``]]},n[`subtext-size`]=t.size||l-Xr,i[`subtext-halo-width`]=[`get`,`__subTextHaloWidth`],i[`subtext-halo-color`]=[`get`,`__subTextHaloColor`],i[`subtext-color`]=[`get`,`__subTextColor`]),e.layout=e.__layout=n,e.paint=e.__paint=i,this.addLayer(`text`,e)}});let n=this.getLayerIds();this.getMap().getMapAction().addFilterLayer(n),this.setZIndex(this.get(`zIndex`))}updateStyle(e,t){this.getMap()&&this.LAYER_TYPES.concat(`text`).forEach(n=>{let r=or.getStyle(n,e,t);r&&r.value&&this.updateLayerProperty(n,r)})}createMapboxFeatures(e){let t=[],{features:n}=e,{icon:r,text:i,subText:a,stylingFunction:o}=this.getOptions(),s=this.getMap().getMapbox(),c=(e,t,n)=>{s.hasImage(e)||(s.addImage(e,t,{pixelRatio:n}),this._mapboxImageIds.push(e))};if(p.forEach(n,e=>{(!e.properties||typeof e.properties!=`object`)&&(e.properties={})}),this._useText=!1,i&&i.content){let e=this.map.getMapType(),t=i.content,s=i.offset,c=i.size||Wr,l=a&&a.content,u=e.darktheme;p.forEach(n,(e,i)=>{if(!(o&&o(e)||!o&&r)){delete e.properties.__textField,delete e.properties.__subTextField;return}let a=typeof t==`function`?t(e):t;if(e.properties.__textField=a,e.properties.__textOffset=this.resolveTextOffset(e,s,c),e.properties.__sortKey=n.length-i,l){let t=typeof l==`function`?l(e):l;e.properties.__subTextField=t}else delete e.properties.__subTextField;this.updateFeatureTextProperties(e,u)}),this._useText=!0}else p.forEach(n,e=>{delete e.properties.__textField,delete e.properties.__textOffset,delete e.properties.__subTextField});return p.forEach(n,e=>{delete e.properties.__iconImage,delete e.properties.__iconAnchor}),o?p.forEach(n,e=>{let n=o(e);n&&t.push(yn.loadImage(n,this._id).then(t=>{let{key:n,pixelRatio:r,image:i,anchor:a}=t;c(n,i,r),e.properties.__iconImage=n,e.properties.__iconAnchor=a,e.properties.__overlayId=this._id}).catch(()=>{delete e.properties.__iconImage,delete e.properties.__iconAnchor}))}):r&&t.push(yn.loadImage(r,this._id).then(e=>{let{key:t,pixelRatio:r,image:i}=e;c(t,i,r),p.forEach(n,e=>{e.properties.__iconImage=t,e.properties.__overlayId=this._id})}).catch(()=>{p.forEach(n,e=>{delete e.properties.__iconImage})})),t}resolveTextOffset(e,t,n){let r=typeof t==`function`?t(e,n):t,i=p.hasValue(r)?p.box(r,p.Point):Hr;return[i.x,i.y]}updateFeatureTextProperties(e,t){let n=this.getOptions(`text`)||{},r=this.getOptions(`subText`),i,a,o;this._useAutoColor?(i=t?zr.COLOR:Rr.COLOR,a=t?zr.HALO_COLOR:Rr.HALO_COLOR,o=t?zr.HALO_WIDTH:Rr.HALO_WIDTH):(i=n.color||Rr.COLOR,a=n.haloColor||Rr.HALO_COLOR,o=n.haloWidth||Rr.HALO_WIDTH),e.properties.__textColor=i,e.properties.__textHaloColor=a,e.properties.__textHaloWidth=o,r&&(e.properties.__subTextColor=r.color||Rr.COLOR,e.properties.__subTextHaloColor=r.haloColor||Rr.HALO_COLOR,e.properties.__subTextHaloWidth=r.haloWidth||Rr.HALO_WIDTH)}featureCollection_changedGL(e){this.updateFeatures(e,!0)}updateFeatures(e,t=!1){if(!this.getMap())return;let n=e||this.getOptions(`featureCollection`),r=this.createMapboxFeatures(n);Promise.all(r).then(()=>{this.getMap()&&(t&&this.removeClusterMarkers(),this.updateSource(n))})}updateCluster(){let e=this.getMap(),t=this.getOptions(`cluster`);if(!e||!t||!t.content)return;let n=e.getMapbox();if(!n||!n.isSourceLoaded(this._id))return;let{content:r}=t,i=this._clusterMarkers,a={},o=n.querySourceFeatures(this._id);p.forEach(o,t=>{let n=t.properties,o=t.geometry.coordinates;if(!n.cluster)return;let{cluster_id:s,point_count:c}=n,l=i[s],u=new p.LatLng(o[1],o[0]);l?l&&!l.getPosition().equals(u)&&l.setPosition(u):(l=r({position:u,count:c}),l.set(`__clusterId`,s),l.set(`__clusterPointCount`,c),l.addListener(`click`,this.onClusterEventHandler.bind(this,`cluster_click`)),l.addListener(`rightclick`,this.onClusterEventHandler.bind(this,`cluster_rightclick`)),i[s]=l),a[s]=l,this._clusterMarkersOnScreen[s]||l.setMap(e)});let s=Object.keys(this._clusterMarkersOnScreen);p.forEach(s,e=>{a[e]||this._clusterMarkersOnScreen[e].setMap(null)}),this._clusterMarkersOnScreen=a}onClusterEventHandler(e,t){let n=this.getMap(),r=this.getOptions(`cluster`),i=t.overlay;if(!n||!i||!r)return;let a=Math.floor(n.getZoom()),o=n.getMaxZoom(),s=i.get(`__clusterId`),c=i.get(`__clusterPointCount`),l=p.isFunction(r.type)?r.type(a):r.type,u=n.getMapbox().getSource(this._id);u.getClusterLeaves(s,c,0,(n,r)=>{n||(t.data=r,u.getClusterExpansionZoom(s,(n,i)=>{n||(t.cluster={type:l,expansionZoom:Math.min(i,o),features:r},p.Event.trigger(this,e,t))}))})}removeClusterMarkers(){p.forEach(this._clusterMarkers,e=>{e&&(e.clearListeners(),e.getMap()&&e.setMap(null))}),this._clusterMarkers={},this._clusterMarkersOnScreen={}}getClusterOptions(e){return p.extend({type:Gr,maxZoom:Kr,radius:qr,distance:Jr},e)}cluster_changed(e){if(!this.getMap())return;let t=this.getMap().getMapbox();if(!t||!t.isSourceLoaded(this._id))return;this.removeClusterMarkers();let n=this.get(`featureCollection`),r=t.getSource(this._id),i=!!e,a=this.getClusterOptions(e);r.workerOptions.cluster=i,i&&(a.radius*=16,r.setClusterOptions(a)),r.setData(n)}text_changed(){this.updateTextAndSubText()}subText_changed(){this.updateTextAndSubText()}updateVisible(){if(!this.getMap())return;let e=this._getVisibility(),t=this._userVisible;this.setVisible(e),this._userVisible=t}updateTextAndSubText(){var e;let t=(e=this.map)==null?void 0:e.getMapbox(),n=this.getOptions(`text`),r=this.getOptions(`subText`);if(!t)return;this._useAutoColor=!(n!=null&&n.color);let i=this.getOptions(`featureCollection`),a=this.createMapboxFeatures(i);Promise.all(a).then(()=>{this.updateSource(i);let e=this.getLayerId(`text`),a=(n==null?void 0:n.size)||Wr;if(n){let r=n.maxWidth||Ur;t.setLayoutProperty(e,`text-max-width`,r),t.setLayoutProperty(e,`text-size`,a)}if(r){let n=r.size||a-Xr;t.setLayoutProperty(e,`subtext-size`,n)}})}_getVisibility(){let e=this.getMap();if(!e||!this._userVisible)return!1;let t=e.getZoom(),n=this.getOptions(`minZoom`),r=this.getOptions(`maxZoom`);return!n&&!r||(p.hasValue(n)||(n=e.getMinZoom()),p.hasValue(r)||(r=e.getMaxZoom()),t>=n&&t<=r)}},$r=class extends p.OverlayView{constructor(e){super(),this.DOM_EVENTS=[`click`,`mousedown`,`mouseup`,`contextmenu`],this._listeners=[],this.DEFAULT_OPTIONS={icon:null,position:null,map:null,visible:!0,zIndex:0,clickable:!0},this._element=this.createElement(),this._offset=new p.Point(0,0),this.setOptions(p.extend({},this.DEFAULT_OPTIONS,e))}setOptions(e,t){if(typeof e==`string`){let n=e,r=`set${p.capitalize(n)}`;this[r]?this[r](t):this.set(n,t)}else p.forEach(e,(e,t)=>{t!==`map`&&this.setOptions(t,e)}),e.map&&this.setMap(e.map)}setPosition(e){e&&(this._position=p.box(e),this.draw())}getPosition(){return this._position}setIcon(e){let t=p.boxToIcon(e||null),{size:n,scaledSize:r,anchor:i}=t;(n||r)&&(t.anchor=p.calcAnchorPosition(n||r,i)),this._icon=t,this.update(this._icon)}getIcon(){return this._icon}setVisible(e){this._visible!==e&&(this._visible=e,p.DOM.visible(this._element,e))}getVisible(){return this._visible}setZIndex(e){this._zIndex=e,p.DOM.setZIndex(this._element,e)}getZIndex(){return this._zIndex}draw(){if(!this.getMap())return;let e=this.getProjection(),t=this.getPosition(),n=e.fromCoordToOffset(t),r=new p.Point(n.x-this._offset.x,n.y-this._offset.y);p.DOM.setOffsetWithAnchor(this._element,r,this._icon?this._icon.anchor:0)}onAdd(){this.getPanes().overlayImage.appendChild(this._element),this.addEventListener()}onRemove(){this.removeEventListener(),p.DOM.removeElement(this._element)}createElement(){let e=document.createElement(`div`);return e.style.cssText=`position:absolute;overflow:hidden;width:22px;height:35px;box-sizing:content-box !important`,e}update(e){let{url:t,scaledSize:n,size:r,origin:i}=e,a=n||r,o=i||p.Point(0,0),s=this._element,c=`position:absolute;width:${a.width}px;height:${a.height}px;left:-${o.x}px;top:-${o.y}px;-webkit-user-drag:none;user-drag:none`;s.style.width=`${r.width}px`,s.style.height=`${r.height}px`,s.innerHTML=``}addEventListener(){if(!this._element)return;let e=this._element.childNodes[0];for(let t=0,n=this.DOM_EVENTS.length,r;t{let n,r=e,i;switch(e){case`mousedown`:this.__dp__={x:t.pageX,y:t.pageY};break;case`click`:r=p.Math.distance(this.__dp__,{x:t.pageX,y:t.pageY})<4?this._getSingleClickType(t):null}return[n,r,i]};return n=>{if(!this.map||!this.clickable)return;let r=p.DOMEvent.fix(n),i=this.getPointerEvent(r),a=t(e,r);p.forEach(a,e=>{e&&p.Event.trigger(this,T[e]||e,i)})}}getPointerEvent(e){let t=e.pos(),n=p.Point(t.pageX,t.pageY),r=this.getProjection(),i=this.get(`containerTopLeft`),a=this.getMapOffset(),o=p.Point(n.x-a.x,n.y-a.y).sub(i),s=r.fromOffsetToPoint(o);return{offset:o,point:s,coord:r.fromPointToCoord(s),pointerEvent:e,domEvent:e,originalEvent:e,overlay:this}}getCursorState(e){return e=e||this.cursor,this.clickable?e||`pointer`:`inherit`}clickable_changed(e){this._element&&(this._element.childNodes[0].__clickable=!!e,this.set(`cursor`,this.cursor))}cursor_changed(e){if(!this._element)return;let t=this.getCursorState(e||`pointer`),n=this._element.childNodes[0];this._element.style.cursor=`inherit`,n.style.cursor=t}};p.SimpleMarker=$r;var ei={outlineColor:`strokeColor`,outlineWeight:`strokeWeight`,outlineOpacity:`strokeOpacity`},ti=class extends p.OverlayView{constructor(e){super(),this.DEFAULT_OPTIONS={map:null,path:[],strokeColor:`#007EEA`,strokeStyle:`solid`,strokeOpacity:1,strokeWeight:2,strokeLineCap:`round`,strokeLineJoin:`round`,outlineColor:`#111111`,outlineWeight:2,outlineOpacity:1,visible:!0,clickable:!1,simplifyLevel:1,zIndex:1,pane:null},this.OVERLAY_TYPE=`PathPolyline`,this.PROPERTIES_NAME=[`path`,`map`],this.setOptions(p.extend({},this.DEFAULT_OPTIONS,e))}setOptions(e,...t){var n;let r=(n=this.PROPERTIES_NAME)==null?[]:n;if(typeof e==`string`){let n=e,i=t[0],a={};p.getIndexOfElement(r,n)===-1?this.setStyles(n,i):(a[n]=i,this.setValues(a))}else p.forEach(e,(e,t)=>{t!==`map`&&this.setOptions(t,e)}),e.map!==void 0&&this.setMap(e.map)}getOptions(e){let t={};return e===void 0?(p.forEach(this.DEFAULT_OPTIONS||{},(e,n)=>{t[n]=this.get(n)}),t):this.get(e)}setStyles(e,...t){var n;let r=(n=this.PROPERTIES_NAME)==null?[]:n;if(typeof e==`string`){let n=e,i=t[0];if(p.getIndexOfElement(r,n)===-1)this.set(n,i),this.setPolylinesStyles(n,i);else throw Error(`The ${n} is not style property.`)}else p.forEach(e,(e,t)=>{this.setStyles(t,e)})}setZIndex(e){this.set(`zIndex`,e),this._basePolyline.setZIndex(e),this._outPolyline.setZIndex(e-1)}getZIndex(){return this.get(`zIndex`)}setVisible(e){this.set(`visible`,e),this._basePolyline.setVisible(e),this._outPolyline.setVisible(this.getOutlineVisible())}getVisible(){return this.get(`visible`)}getBasePolyline(){return this._basePolyline}getOutPolyline(){return this._outPolyline}setClickable(e){this.set(`clickable`,e),this._basePolyline.setClickable(e),this._outPolyline.setClickable(e)}onAdd(){var e;if(!this.getMap())return;let t=this.getOptions(),{strokeColor:n,strokeStyle:r,strokeOpacity:i,strokeWeight:a,strokeLineCap:o,strokeLineJoin:s,outlineColor:c,outlineWeight:l,outlineOpacity:u,visible:d,clickable:f,simplifyLevel:m,zIndex:h,pane:g}=t,_=(e=t.path)==null?[]:e,v=this.getMap();this._basePolyline=new p.Polyline({map:v,path:_,strokeColor:n,strokeStyle:r,strokeOpacity:i,strokeWeight:a,strokeLineCap:o,strokeLineJoin:s,visible:d,clickable:f,simplifyLevel:m,zIndex:h,pane:g}),this._outPolyline=new p.Polyline({map:v,path:_,strokeColor:c,strokeOpacity:u,strokeWeight:a+l,strokeLineCap:o,strokeLineJoin:s,visible:this.getOutlineVisible(),clickable:!1,simplifyLevel:m,zIndex:h-1,pane:g})}onRemove(){this._basePolyline&&this._basePolyline.setMap(null),this._outPolyline&&this._outPolyline.setMap(null)}draw(){}setPolylinesStyles(e,t){if(!(!this._basePolyline||!this._outPolyline))switch(e){case`strokeStyle`:this._basePolyline.setStyles(e,t),this._outPolyline.setVisible(this.getOutlineVisible());break;case`strokeWeight`:this._basePolyline.setStyles(e,t),this._outPolyline.setStyles(e,t+this.getOptions(`outlineWeight`));break;case`outlineWeight`:this._outPolyline.setStyles(ei[e],t+this.getOptions(ei[e]));break;case`outlineColor`:case`outlineOpacity`:this._outPolyline.setStyles(ei[e],t);break;default:this._basePolyline.setStyles(e,t)}}getOutlineVisible(){return this.getVisible()&&this.getOptions(`strokeStyle`)===`solid`}},ni=10,ri=class{constructor(e,t){this._coordinates=e,this._interval=t,this._interpolator=new c.PathInterpolator}destroy(){this._interpolator.reset([]),this._interpolator=null,this._coordinates=[],this._patternPoints=[],this._mapbox=null}addTo(e){this._mapbox=e}makePatternPoints(){this._patternPoints=[];let e=this._interval;if(!this._mapbox||isNaN(e)||e<=0)return;let t=this._coordinates.map(e=>this._mapbox.project(e)),n=this._interpolator;n.reset(t,ni);let r=n.length;if(!r)return;let i=0;for(;i<=r;){let t=i/r,a=Math.min((i+e)/r,1),o=n.lerp(t),s=n.lerp(a).angleTo(o)*(180/Math.PI)+90;this._patternPoints.push({angle:s,coordinate:this._mapbox.unproject(o).toArray()}),i+=e}}toGeoJSON(e){return{type:`FeatureCollection`,features:this._patternPoints&&this._patternPoints.length>0?this._patternPoints.map(t=>({type:`Feature`,properties:U(U({},e?{__overlayId:e}:{}),{},{__angle:t.angle}),geometry:{type:`Point`,coordinates:t.coordinate}})):[]}}},X=[`draw`,`setPaths`,`setVisible`,`setZIndex`,`setStyles`,`setPatternIcon`],Z={DASH:`dash`,SOLID:`solid`,PATTERN:`pattern`},ii={strokeColors:`strokeColor`,strokeStyles:`strokeStyle`},ai=class e extends p.OverlayView{constructor(e){super(),this.OVERLAY_TYPE=`PathOverlay`,this.STYLES_NAME=[`strokeColor`,`strokeColors`,`strokeStyle`,`strokeStyles`,`strokeOpacity`,`strokeWeight`,`strokeLineCap`,`strokeLineJoin`,`outlineColor`,`outlineWeight`,`outlineOpacity`,`zIndex`],this._pathPolylines=[],this._listeners=[],this.DRAWING_UNDER_SYMBOL=!0,this.__onUpdatePatternDebounce=Lt(this.updatePattern.bind(this),50,!1),this.__onUpdatePattern=this.updatePattern.bind(this),this.DEFAULT_OPTIONS={map:null,paths:[],strokeColor:`#007EEA`,strokeColors:[],strokeStyle:`solid`,strokeStyles:[],strokeOpacity:1,strokeWeight:2,strokeLineCap:`round`,strokeLineJoin:`round`,outlineColor:`#111111`,outlineWeight:2,outlineOpacity:1,visible:!0,clickable:!1,simplifyLevel:1,zIndex:1,pane:null,patternIcon:null,patternInterval:30},this.setOptions(p.extend({},this.DEFAULT_OPTIONS,e))}setOptions(e,...t){if(typeof e==`string`){let n=e,r=t[0],i={};this.STYLES_NAME.indexOf(n)>=0?this.setStyles(n,r):(i[n]=r,this.setValues(i))}else p.forEach(e,(e,t)=>{t!==`map`&&this.setOptions(t,e)}),e.map!==void 0&&this.setMap(e.map)}getOptions(e){let t={};return e===void 0?(p.forEach(this.DEFAULT_OPTIONS||{},(e,n)=>{n!==`map`&&(t[n]=this.get(n))}),t):this.get(e)}setClickable(e){this.set(`clickable`,e)}getClickable(){return this.get(`clickable`)}_onRenderModeChanged(e){this.switchTo(e)}setVisible(e){this.get(`visible`)!==e&&(this.set(`visible`,e),p.forEach(this._pathPolylines,t=>{t.setVisible(e)}))}setPaths(e){this.set(`paths`,e),this.getMap()&&(this.onRemove(),this.onAdd())}setZIndex(e){this.set(`zIndex`,e),p.forEach(this._pathPolylines,t=>{t.setZIndex(e)})}setStyles(e,...t){if(typeof e==`string`){var n;let r=e,i=t[0],a={};if(this.STYLES_NAME.indexOf(e)<0)return;if(r===`zIndex`){this.setZIndex(i);return}this.set(r,i);let o=(n=ii[r])==null?r:n;p.forEach(this._pathPolylines,(e,t)=>{a[o]=Array.isArray(i)&&i[t]?i[t]:i,e.setStyles(a)})}else p.forEach(e,(e,t)=>{this.setStyles(t,e)})}setPatternIcon(e){this.set(`patternIcon`,e)}onAdd(){var e;if(!this.getMap())return;let t=[`click`,`dblclick`,`mousedown`,`mousemove`,`mouseup`],n=this.getOptions(),{strokeColor:r,strokeColors:i,strokeStyle:a,strokeStyles:o,strokeOpacity:s,strokeWeight:c,strokeLineCap:l,strokeLineJoin:u,outlineColor:d,outlineWeight:f,outlineOpacity:m,visible:h,clickable:g,simplifyLevel:_,zIndex:v,pane:y}=n,b=(e=n.paths)==null?[]:e,x={map:this.getMap(),strokeColor:r,strokeWeight:c,strokeOpacity:s,strokeLineCap:l,strokeLineJoin:u,outlineColor:d,outlineWeight:f,outlineOpacity:m,visible:h,clickable:g,simplifyLevel:_,zIndex:v,pane:y};p.forEach(b,(e,n)=>{var s,c;let l=new ti(U(U({},x),{},{path:e,strokeColor:(s=i[n])==null?r:s,strokeStyle:(c=o[n])==null?a:c}));p.forEach(t,e=>{this._listeners.push(l.getBasePolyline().addListener(e,t=>{p.Event.trigger(this,e,this.getEventObject(t))}))}),this._pathPolylines.push(l)})}onRemove(){p.Event.removeListener(this._listeners),this._listeners=[],p.forEach(this._pathPolylines,e=>{e.setMap(null)}),this._pathPolylines=[]}draw(){}getEventObject(e){return U(U({},e),{},{overlay:this})}setVisibleGL(e){this.get(`visible`)!==e&&(this.set(`visible`,e),this.updateStyle(`visible`,e))}setPathsGL(e){this.set(`paths`,e);let t=this.createPathFeatureCollectionList();this.updateSource(t),this.updatePattern()}setZIndexGL(e){this.set(`zIndex`,e);let t=this.getMap(),n=t&&t.getOverlayManager(),r=this.getId();n&&n.has(r)&&n.update(r)}setStylesGL(e,...t){if(typeof e==`string`){let n=e,r=t[0];if(this.STYLES_NAME.indexOf(e)<0)return;n===`zIndex`?this.setZIndex(r):(this.set(n,r),(n===`strokeColors`||n===`strokeStyle`||n===`strokeStyles`)&&(this.updateSource(this.createPathFeatureCollectionList()),this.updatePattern()),this.updateStyle(n,r))}else p.forEach(e,(e,t)=>{this.setStyles(t,e)})}setPatternIconGL(e){if(this.set(`patternIcon`,e),e)this.draw();else if(this._patternImageId&&!e){let e=this.getSourceId(Z.PATTERN);this.hasSource(e)&&this._mapbox.getSource(e).setData(ve),this.removePatternImage()}}switchTo(t,n=void 0){if(t===this.__renderMode||!this.__renderMode&&t===1)return;let r=n==null?this.getMap():n,i=this.getOptions(),a=e=>{this.getOptions(),this.setMap(e)};t===2?(this.setMap(null),Ee(this,this,X,`GL`),super._switchTo(t,i),this.GEO_TYPE=ce,this.LAYER_TYPES=[`outline`,`line`,`dash`,`pattern`],r.isGLReady()&&r.getOverlayManager()?a(r):r.addListenerOnce(`glReady`,()=>{a(r)})):(this.setMap(null),Ee(this,e.prototype,X),super._switchTo(t,i),Ee(this,e.prototype,[`onAdd`,`onRemove`]),this.setMap(r),delete this.GEO_TYPE,delete this.LAYER_TYPES)}drawGL(){let e=this.getMap();if(!(e&&e.isGLReady()))return;let t=this.getOptions(`patternIcon`),n=this.createPathFeatureCollectionList(),r=t?this.createPatternFeatureCollection():ve;t&&this.addPatternImage(t),this.hasSource()?this.updateSource(n,r):(this.addSource(n,r),this.addLayers())}remove(){this.removeAllLayers(),this.removeSource(),this.removePatternImage()}rearrange(){let e=this._mapbox,t=this.getLayerId(Z.PATTERN),n=e.getLayer(t),r=n&&n.getLayoutProperty(`icon-image`);this.removeAllLayers(),this.addLayers(),e.getLayer(t)&&r&&(e.setLayoutProperty(t,`icon-image`,r),e.setLayoutProperty(t,`visibility`,`visible`))}onAddGL(){this._mapbox&&(this._mapbox.on(`zoom`,this.__onUpdatePatternDebounce),this._mapbox.on(`resize`,this.__onUpdatePattern))}onRemoveGL(){this._mapbox&&(this._mapbox.off(`zoom`,this.__onUpdatePatternDebounce),this._mapbox.off(`resize`,this.__onUpdatePattern))}addPatternImage(e){let t=this._patternImageId,n=this._mapbox;yn.loadImage(e,this._id).then(e=>{let{key:r,pixelRatio:i,image:a}=e;if(r===t)return;this._patternImageId=r,n.hasImage(r)||n.addImage(r,a,{pixelRatio:i}),t&&n.hasImage(t)&&n.removeImage(t);let o=this.getLayerId(Z.PATTERN);n.getLayer(o)&&(n.setLayoutProperty(o,`icon-image`,r),n.setLayoutProperty(o,`visibility`,`visible`))}).catch(()=>{})}removePatternImage(){let e=this._patternImageId,t=this._mapbox;if(!e)return;this._patternImageId=null,t.removeImage(e);let n=this.getLayerId(Z.PATTERN);t.getLayer(n)&&t.setLayoutProperty(n,`visibility`,`none`)}addSource(e,t){let n=(e,t)=>{this.hasSource(e)||this._mapbox.addSource(e,{type:`geojson`,data:t})};n(this.getSourceId(Z.SOLID),e[0]),n(this.getSourceId(Z.DASH),e[1]),n(this.getSourceId(Z.PATTERN),t)}removeSource(){p.forEach(Z,e=>{let t=this.getSourceId(e);this.hasSource(t)&&this._mapbox.removeSource(t)})}updateSource(e,t){p.forEach(Z,n=>{let r=this.getSourceId(n);if(!this.hasSource(r))return;let i=(()=>{if(n===Z.SOLID)return e[0];if(n===Z.DASH)return e[1];if(n===Z.PATTERN)return t})();i&&this._mapbox.getSource(r).setData(i)})}hasSource(e){let t=e==null?this.getSourceId(Z.SOLID):e;return!!(this._mapbox&&this._mapbox.getSource(t))}addLayers(){p.forEach(this.LAYER_TYPES,e=>{let t=this.getRefinedStyle(e);this.addLayer(e,t)})}addLayer(e,t){let n=this.getLayerId(e);if(this._mapbox.getLayer(n))return;let r=e===`pattern`,i=this.getSourceId(r?Z.PATTERN:e===`dash`?Z.DASH:Z.SOLID);this._mapbox.addLayer({id:n,type:r?`symbol`:`line`,source:i,layout:t.layout,paint:t.paint},this.get(`refLayerId`)),this._layerIds.push(n)}updateStyle(e,t){if(!this.getMap())return;let n=this.getOptions(`strokeLineCap`),r=this.getOptions(`strokeWeight`),i=[],a,o;switch(e){case`outlineColor`:case`outlineWeight`:case`outlineOpacity`:i=[`outline`],a=or.getStyle(`line`,e.replace(`outline`,`stroke`),e===`outlineWeight`?r+t:t);break;case`strokeColors`:case`strokeColor`:i=[`line`,`dash`],a={which:`paint`,key:`line-color`,value:e===`strokeColors`?[`get`,`__lineColor`]:t};break;case`strokeWeight`:i=[`line`,`dash`],a=or.getStyle(`line`,e,t,n,r),o=or.getStyle(`line`,e,t+this.getOptions(`outlineWeight`),n,r);break;case`strokeOpacity`:i=[`line`,`dash`],a=or.getStyle(`line`,e,t,n,r);break;case`strokeStyle`:case`strokeStyles`:i=[`dash`],a={which:`paint`,key:`line-dasharray`,value:this.getDashArray()};break;default:i=[`outline`,`line`,`dash`],a=or.getStyle(`line`,e,t,n,r)}let s=e=>e&&p.hasValue(e.value);p.forEach(i,e=>{s(a)&&this.updateLayerProperty(e,a)}),s(o)&&this.updateLayerProperty(`outline`,o)}createPathFeatureCollectionList(){let e=[],t=[],{paths:n,strokeColor:r,strokeColors:i,strokeStyle:a,strokeStyles:o}=this.getOptions();return p.forEach(n,(n,s)=>{var c,l;let u=this.getCoordinates(n),d=(c=i[s])==null?r:c,f=(l=o[s])==null?a:l,p={type:se,geometry:{type:ae,coordinates:u},properties:{__lineColor:d,__overlayId:this._id}};if(this.hasOutline(f)){p.properties.__type=Z.SOLID,e.push(p);return}p.properties.__type=Z.DASH,t.push(p)}),[{type:ce,features:e},{type:ce,features:t}]}createPatternFeatureCollection(){let{paths:e,strokeStyles:t,patternInterval:n}=this.getOptions(),r=[];for(let n=0,i=e.length;n{let{x:t,y:n}=p.box(e);return[t,n]})}getDashArray(){let{strokeStyle:e,strokeStyles:t,strokeLineCap:n,strokeWeight:r}=this.getOptions(),i=[...t,e].find(e=>ar.indexOf(e)>-1);return i?or.getStyle(`line`,`strokeStyle`,i,n,r).value:[0,2]}getRefinedStyle(e){let{visible:t,outlineColor:n,outlineWeight:r,outlineOpacity:i,strokeLineCap:a,strokeLineJoin:o,strokeWeight:s,strokeOpacity:c}=this.getOptions(),l={layout:{visibility:t?`visible`:`none`,"line-cap":a,"line-join":o},paint:{}},u=this.getDashArray();switch(e){case`outline`:l.paint={"line-color":n,"line-width":s+r,"line-opacity":i};break;case`dash`:l.paint={"line-color":[`get`,`__lineColor`],"line-opacity":c,"line-width":s,"line-dasharray":u};break;case`line`:l.paint={"line-color":[`get`,`__lineColor`],"line-opacity":c,"line-width":s};break;case`pattern`:l.layout={"icon-allow-overlap":!0,"icon-always-allow-overlap":!0,"icon-image":``,"icon-rotate":[`get`,`__angle`],visibility:`none`}}return l}hasOutline(e){return e&&e===`solid`||!e}getSourceId(e){if(typeof e==`string`)return`${this._id}-${e}`;let{properties:t}=e;return`${t.__overlayId}-${t.__type}`}clickable_changed(e){p.forEach(this._pathPolylines,t=>{t.setClickable(e)})}},oi,si=[`setPatternIcon`,`onAdd`,`onRemove`,`draw`],Q=p.PatternPolyline.prototype,ci=class e extends p.PatternPolyline{setPatternIconGL(e){this.set(`patternIcon`,e),e?this._addPatternIcon(e):this._removePatternIcon()}rearrange(){this.removeAllLayers(),this.addLayers()}drawGL(){if(!this.getMap()||!this._hasValidPattern())return;this._patternImageId||this._addPatternIcon(this.get(`patternIcon`));let e=this._createPatternFeatureCollection();this.hasSource()?this.updateSource(e):(this.addSource(`geojson`,e),this.addLayers())}onAddGL(){this._mapbox&&(this._createListeners(),this._mapbox.on(`zoom`,this.__onUpdatePatternDebounce),this._mapbox.on(`resize`,this.__onUpdatePattern))}onRemoveGL(){this._mapbox&&(this._mapbox.off(`zoom`,this.__onUpdatePatternDebounce),this._mapbox.off(`resize`,this.__onUpdatePattern))}addLayers(){let e=this._patternImageId,t={type:`symbol`,layout:{"icon-allow-overlap":!0,"icon-always-allow-overlap":!0,"icon-image":e||``,"icon-rotate":[`get`,`__angle`],visibility:e?`visible`:`none`},paint:{}};super.addLayer(`symbol`,t,!0)}remove(){this.removeAllLayers(),this.removeSource(),this._patternImageId&&(this._mapbox.removeImage(this._patternImageId),this._patternImageId=null)}switchTo(e,t){this._onRenderModeChanged(e,t)}_onRenderModeChanged(e,t=void 0){if(e===this.__renderMode||!this.__renderMode&&e===1)return;let n=t==null?this.getMap():t;e===2?(this.setMap(null),Ee(this,this,si,`GL`),p.OverlayView.prototype._switchTo.apply(this,[e]),this.GEO_TYPE=ie,this.LAYER_TYPES=[`symbol`],this.DRAWING_UNDER_SYMBOL=!0,n.isGLReady()&&n.getOverlayManager()?this.setMap(n):n.addListenerOnce(`glReady`,()=>{this.setMap(n)})):(this.setMap(null),Ee(this,Q,si),p.OverlayView.prototype._switchTo.apply(this,[e]),Ee(this,Q,[`onAdd`,`onRemove`]),this.setMap(n),delete this.GEO_TYPE,delete this.LAYER_TYPES,delete this.DRAWING_UNDER_SYMBOL)}_addPatternIcon(e){let t=this._patternImageId,n=this._mapbox;yn.loadImage(e,this._id).then(e=>{let{key:r,pixelRatio:i,image:a}=e;if(r===t)return;this._patternImageId=r,n.hasImage(r)||n.addImage(r,a,{pixelRatio:i}),t&&n.hasImage(t)&&n.removeImage(t);let o=this.getLayerId(this.LAYER_TYPES[0]);n.getLayer(o)&&(n.setLayoutProperty(o,`icon-image`,r),n.setLayoutProperty(o,`visibility`,`visible`))}).catch(()=>{})}_removePatternIcon(){let e=this._patternImageId,t=this._mapbox;if(!e)return;let n=this.getLayerId(this.LAYER_TYPES[0]);t.getLayer(n)&&t.setLayoutProperty(n,`visibility`,`none`),t.removeImage(e),this._patternImageId=null}_updatePattern(){if(!this._hasValidPattern())return;let e=this._createPatternFeatureCollection();this.updateSource(e)}_hasValidPattern(){let e=this.get(`patternIcon`),t=this.get(`patternInterval`);return!!(e&&t)}_createPatternFeatureCollection(){let e=new ri(this._getCoordinates(),this.get(`patternInterval`));return e.addTo(this._mapbox),e.makePatternPoints(),e.toGeoJSON()}_getCoordinates(){return this.getPath().getArray().map(e=>{let t=e;return[t.x,t.y]})}_createListeners(){this.__onUpdatePatternDebounce=Lt(this._updatePattern.bind(this),50,!1),this.__onUpdatePattern=this._updatePattern.bind(this)}static mixin(){e.mixed||(Te(p.PatternPolyline,e),p.PatternPolyline.prototype.switchTo=e.prototype._onRenderModeChanged,p.PatternPolyline.prototype.onAddGL=e.prototype.onAddGL,p.PatternPolyline.prototype.onRemoveGL=e.prototype.onRemoveGL,e.mixed=!0)}};oi=ci,oi.mixed=!1;var li=function(e){return e.Rail=`rail`,e.Road=`road`,e.Region=`region`,e}({}),$=[`rail`,`road`,`region`],ui={rail:I.REALTY_RAIL,road:I.REALTY_ROAD,region:I.REALTY_REGION},di=class extends p.Layer{constructor(e){let t=p.extend({types:$,forceOverlayToMapType:!0},e),n=Array.isArray(t.types)?[...t.types]:[t.types];super(`realty`,fi(n),t),this._types=n.sort()}setRealtyTypes(e){let t=(Array.isArray(e)?[...e]:[e]).sort();if(p.equals(this._types,t))return;this._types=t.filter(e=>$.indexOf(e)>-1);let n=fi(this._types);this._initRegistry(n);let r=this.getMap();if(r){if(r.get(`renderMode`)===2){var i,a;this._updateCadastralRealtyLayers(!!((i=r.layers)!=null&&i[F.CADASTRAL]),!!((a=r.layers)!=null&&a[F.REALTY]),!0)}else this.refresh()}}getRealtyTypes(){return this._types}};function fi(e){let t=pi(e);return p.NaverStyleMapTypeOptions.getRealtyLayer({overlayType:t.join(`.`)})}var pi=e=>{let t=e.map(e=>ui[e]).filter(Boolean);return p.NaverStyleMapTypeOptions.sortOverlay(t.join(`.`)).split(`.`)};p.RealtyLayer=di;var mi,hi=function(e){return e.ROAD_GROUP_ID=`group_id`,e.CCTV_LIST=`matrix`,e}({}),gi=[`setMap`],_i=p.Layer.prototype,vi=p.Layer.prototype.setMap,yi=class e extends p.Layer{_onRenderModeChanged(e,t=void 0){if(e===this.__renderMode||!this.__renderMode&&e===1)return;let n=t==null?this.getMap():t;e===2?(this.setMap(null),Ee(this,this,gi,`GL`),this.__renderMode=2,n.isGLReady()&&n.getOverlayManager()?this.setMap(n):n.addListenerOnce(`glReady`,()=>{this.setMap(n)})):(this.setMap(null),Ee(this,_i,gi),this.__renderMode=1,this.setMap(n))}setMapGL(e){let t=this.getMap();if(e!==t&&!(e&&!this._checkLayerSupported(e))){if(t&&t.get(`renderMode`)===1||e&&e.get(`renderMode`)===1){vi.apply(this,[e]);return}if(this._beforeSetMap(e),e){this.map=e;let t=this.getLayerType(),n=t.getMapTypeOptions?t.getMapTypeOptions():null;n&&(n.map=e),this._listenEvent(e),this._addToMap(e),this._setLayerProperties(),this._renderLayer(!0)}else t&&(this._renderLayer(!1),this._destroy(),this._unlistenEvent());return this.set(`map`,e),this._afterSetMap(e),!0}}getValidLayerGroupNameList(e){let t=e||this.name,n=this._getMetadataCategories(),r;switch(t){case F.CCTV:r=n[H.CCTV];break;case F.BICYCLE:r=n[H.BIKE];break;case F.STREET:r=n[H.PANORAMA],r=r.filter(e=>e!==F.INDOOR_VIEW&&e!==F.INDOOR_VIEW_DARK);break;case F.MOUNTAIN:r=n[H.MOUNTAIN];break;case F.TRAFFIC:r=n[H.CTT];break;case F.TRANSIT:r=n[H.TRANSIT_BUS];break;case F.INDOOR_GND:r=n[H.INDOORGND];break;case F.INDOOR_TILE_MAP:case F.INDOOR:r=n[H.INDOOR];break;case F.INDOOR_POI:r=n[H.INDOOR_POI];break;case F.AD_INDOOR:r=n[H.AD_INDOOR];break;case F.REALTY:r=n[H.REALTY]}return r||[]}_getMetadataCategories(){let e=this.getMap();if(!e)return{};let t=e.getMapTypeId(),{metadata:n,name:r}=e.getOptions(`mapTypes`)[t].getMapTypeStyle();return Ue(r,n)}_getMapboxAllLayers(){let e=this.getMap();return!e||!e.getMapbox()?[]:e.getMapbox().getStyle().layers}_renderLayer(e){if(!this.map)return;let t=this.map.getMapbox(),{layers:n}=t.getStyle(),r=this.getValidLayerGroupNameList();p.forEach(n,n=>{if(!n.metadata||!n.metadata.group)return;let i=n.id,a=n.metadata.group,o=a,s=`!${a}`,c;r.indexOf(o)>-1?(this._sourceId||(this._sourceId=n.source),this._layerIds||(this._layerIds=[]),this._layerIds.indexOf(i)<0&&this._layerIds.push(i),c=e?`visible`:`none`):r.indexOf(s)>-1&&(c=e?`none`:`visible`),p.hasValue(c)&&t.setLayoutProperty(i,`visibility`,c)});let i=[];p.forEach(this._layerIds,e=>{t.getLayer(e)||i.push(e)}),this._layerIds=(this._layerIds||[]).filter(e=>i.indexOf(e)<0)}_updateCadastralRealtyLayers(e,t,n=!1){let r=this.map.getMapTypeId(),i=this.map.getOptions(`realty`),a=this.map.getOptions(`glType`);if(!i||a!==L.HYBRID||r!==P.NORMAL)return;let o,s=this.map.getMapbox(),c=this._getMetadataCategories(),l=this._getMapboxAllLayers();if(p.forEach(l,r=>{if(!r.metadata||!r.metadata.group)return;let i=r.metadata.group,a=r.id;ot(c,i)&&(o=r.source),!n&&(Ke(c,i)&&s.setLayoutProperty(a,`visibility`,e||t?`none`:`visible`),Qe(c,i)&&s.setLayoutProperty(a,`visibility`,t?`none`:e?`visible`:`none`),Xe(c,i)&&s.setLayoutProperty(a,`visibility`,e?`none`:`visible`))}),o){var u;let t=s.getSource(o),n=(u=this.map.layers)==null?void 0:u[F.REALTY],r=pi(n?n.getRealtyTypes():$),i=[I.BACKGROUND,I.OVERLAY,I.SUBWAY,...r,...e?[I.CADASTRAL]:[]],a=new URL(t.tiles[0]);a.searchParams.delete(`mt`),a.searchParams.append(`mt`,i.join(`.`)),t.tiles[0]=decodeURIComponent(a.href);let c=s.style.sourceCaches[o];c.clearTiles(),c.update(s.transform)}}setMinZoom(e){this._updateLayerMinMaxZoom(`minzoom`,e)}setMaxZoom(e){this._updateLayerMinMaxZoom(`maxzoom`,e)}setFilter(e,t){}_setLayerProperties(){this.options&&p.forEach(this.options,(e,t)=>{let n=`set${p.capitalize(t)}`;this[n]&&this[n](e)})}_updateLayerMinMaxZoom(e,t){var n;let r=(n=this.map)==null?void 0:n.getMapbox();if(!r)return;let i=!1,a=r.getStyle().layers,o=this.getValidLayerGroupNameList();p.forEach(a,n=>{if(!n.metadata||!n.metadata.group)return;let a=n.id,s=n.metadata.group;if(o.indexOf(s)>=0){let n=r.getLayer(a);n[e]=t,n.getLayoutProperty(`visibility`)===`visible`&&(i=!0)}}),i&&r.triggerRepaint()}static mixin(){e.mixed||(Te(p.Layer,e),p.Layer.prototype.switchTo=e.prototype._onRenderModeChanged,p.Layer.prototype._updateCadastralRealtyLayers=e.prototype._updateCadastralRealtyLayers,p.Layer.prototype._getMetadataCategories=e.prototype._getMetadataCategories,p.Layer.prototype._getMapboxAllLayers=e.prototype._getMapboxAllLayers,e.mixed=!0)}};mi=yi,mi.mixed=!1;var bi,xi=class e extends p.Layer{_renderLayer(e){var t;if(!this.map)return;let n=this.map.getMapbox(),r=this._getMetadataCategories(),i=this._getMapboxAllLayers(),a=this.map.getOptions(`glType`)===L.HYBRID;p.forEach(i,t=>{if(!t.metadata||!t.metadata.group)return;let i=t.metadata.group,o=t.id;if(a&&Ke(r,i)||Xe(r,i)){n.setLayoutProperty(o,`visibility`,e?`none`:`visible`);return}Qe(r,i)&&n.setLayoutProperty(o,`visibility`,e?`visible`:`none`)}),this._updateCadastralRealtyLayers(e,!!((t=this.map.layers)!=null&&t[F.REALTY]))}static mixin(){e.mixed||(Te(p.CadastralLayer,e),p.CadastralLayer.prototype._renderLayer=e.prototype._renderLayer,e.mixed=!0)}};bi=xi,bi.mixed=!1;var Si,Ci=class e extends p.Marker{toFeature(){let e=this._nmarker_id;return{type:se,geometry:{type:ie,coordinates:p.DataUtil.toPoint(this.getPosition())},id:e,properties:{}}}draw(){if(!this.map||!this.position||!this._icon.anchor||this._dragStarted)return;let e=this.getProjection(),t=this.position,n=e.fromCoordToOffset(t);if(this.stopTransition(),this.animation)this.startTransition(this._wrapper,n,this._icon.anchor,this.animation);else if(this.draggable)p.DOM.setOffsetWithAnchor(this._wrapper,n,this._icon.anchor);else{let e=this.map.getMapbox(),t=this.map.getMapAction(),r=e&&e.isMoving()||t.isDragging&&t.isDragging(),i=this._icon.anchor||p.Point(0,0),a=p.Point(n.x-i.x,n.y-i.y);r||a.round(),this._updateDOM(a)}this.get(`ef_overlayimage`)&&p.DOM.transform(this._wrapper,1,0,0,{x:0,y:0})}_onAddGL(){if(this._isCollidedMarker()){if(!this.map.isGLReady()){this.map.addListenerOnce(`glReady`,this._onAddGL.bind(this));return}this.map.getMarkerManager().add(this)}}_onRemoveGL(){if(this._isCollidedMarker()){if(!this.map.isGLReady()){this.map.addListenerOnce(`glReady`,this._onRemoveGL.bind(this));return}this.map.getMarkerManager().remove(this)}}_updateGL(){if(this._isCollidedMarker()){if(!this.map.isGLReady()){this.map.addListenerOnce(`glReady`,this._updateGL.bind(this));return}this.map.getMarkerManager().update(this)}}draggable_changed(e){this._updateDraggable(e),this._resetDOM(),this.draw()}visible_changed(){this._updateGL()}collisionBoxSize_changed(){this._updateGL()}_updateDOM(e){this._wrapper.style.transform=`translate3d(${e.x}px, ${e.y}px, 0)`}_resetDOM(){this._wrapper.style.left=``,this._wrapper.style.top=``,this._wrapper.style.transform=``}_isCollidedMarker(){return this.map&&this.map.getOptions(`gl`)&&this.getOptions(`collisionBehavior`)}static mixin(){e.mixed||(Te(p.Marker,e),p.Marker.prototype.toFeature=e.prototype.toFeature,p.Marker.prototype.draw=e.prototype.draw,p.Marker.prototype.draggable_changed=e.prototype.draggable_changed,p.Marker.prototype.visible_changed=e.prototype.visible_changed,p.Marker.prototype._updateGL=e.prototype._updateGL,p.Marker.prototype._onAddGL=e.prototype._onAddGL,p.Marker.prototype._onRemoveGL=e.prototype._onRemoveGL,e.mixed=!0)}};Si=Ci,Si.mixed=!1;var wi,Ti=class e extends p.MapDataProvider{_create(e){let t=e,n=document.createDocumentFragment(),r=document.createDocumentFragment(),i=this._control.getPopupElement().getElementsByTagName(`div`)[0];if(p.forEach(t.provider,(e,t)=>{if(e.title===xt.title)return;let i=U(U({},e),{},{title:e.title.indexOf(`/`)>-1?e.title:` /${e.title}`}),a=this._createItemElements(i),o=e.bounds&&[];i.bounds&&(!p.getLiteralType(e.bounds)&&i.bounds.length?p.forEach(e.bounds,function(e){o.push(p.box(e))}):o=[p.box(i.bounds)]),this._items.push({el:a[0],cloneEl:a[1],bounds:o,area:i.area||null,exclude:i.exclude}),n.appendChild(a[0]),r.appendChild(a[1])}),this._isBasemap){let t=this._createItemElements({title:e.vendor||``});this._items.push({el:t[0],cloneEl:t[1]}),this._vendorElement.appendChild(t[0]),r.insertBefore(t[1],r.firstChild),i.insertBefore(r,i.firstChild)}else i.appendChild(r);this._element.appendChild(n)}static mixin(){e.mixed||(Te(p.MapDataProvider,e),p.MapDataProvider.prototype._create=e.prototype._create,e.mixed=!0)}};wi=Ti,wi.mixed=!1;var Ei=function(e){return e.Temperature=`temperature`,e.EffectiveTemperature=`effectiveTemperature`,e.Humidity=`humidity`,e.WindSpeed=`windSpeed`,e.Precipitation=`precipitation`,e.Snow=`snow`,e.Wind=`wind`,e}({}),Di=class extends p.Layer{constructor(e){if(super(`weather`,{},e),this.WEATHER_TYPE_URL_PARAMETER=`category`,this.WEATHER_TIME_URL_PARAMETER=`forecastTime`,this._source=null,this._layers=[],this._loaded=!1,this._isInitial=!1,!e||!e.time||!e.type)throw Error(`Invalid options for Weather layer, time and type must be required`);this._id=p.guid(),this._boundOnSourceData=this._onSourceData.bind(this),this._boundOnData=this._onData.bind(this),this._debouncedOnIdle=Lt(this._onIdle.bind(this),100,!1),this.setOptions(e)}destroy(){this._mapbox&&(p.forEach(this._layers,e=>{this._mapbox.removeLayer(e.id)}),this._mapbox.removeSource(this._id),this._mapbox.off(`sourcedata`,this._boundOnSourceData),this._mapbox.off(`data`,this._boundOnData),this._mapbox.off(`idle`,this._debouncedOnIdle),p.Event.removeListener(this._mapListeners),this._layers=[],this._source=null,this._mapbox=null,this._map=null)}setOptions(e){e.type&&(this._type=e.type),e.time&&(this._time=e.time),this.getMap()&&this.updateLayerSource()}getOptions(e){return this[`_${e}`]?this[`_${e}`]:{type:this._type,time:this._time}}loaded(){return this._loaded}setWeatherType(e){!e||e===this._type||(this._type=e,this.updateLayerSource())}getWeatherType(){return this._type}setWeatherTime(e){!e||e===this._time||(this._time=e,this.updateDynamicPropertiesUrl())}getWeatherTime(){return this._time}setOpacity(e){this._opacity=e,this._mapbox&&p.forEach(this._layers,t=>{this._mapbox.setPaintProperty(t.id,`fill-opacity`,e)})}getOpacity(){return this._mapbox?this._mapbox.getPaintProperty(this._layers[0].id,`fill-opacity`):this._opacity}setMap(e){let t=this.getMap();if(e===t)return;!this._isInitial&&e&&this.init(e);let n=this._map.getOptions(`weather`),r=this._map.getOptions(`gl`);if(e&&(!r||!n)){p.console.info("벡터맵(`gl=true`)에서만 날씨 레이어를 제공하며, 사용하기 위해서 지도 초기화 시 `weather` 속성을 `true` 로 지정해주세요.\n자세한 사항은 아래 페이지 참고 부탁드립니다.\nhttps://pages.oss.navercorp.com/Maps/maps.js/docs/tutorial-2-Weather.html");return}if(!this._loaded){this.addListenerOnce(`load`,()=>{this.setMap(e)});return}return this._beforeSetMap(e),e?(this.map=e,this._addToMap(e),this._renderLayer(!0)):t&&(this._renderLayer(!1),this._destroy()),this.set(`map`,e),this._afterSetMap(e),!1}_beforeSetMap(e){if(!e||!this._mapbox)return;let t=e.layers.get(this.name);t&&p.console.info(`날씨 레이어가 이미 사용 중입니다. 중복으로 사용할 경우 겹침 현상이 발생할 수 있습니다. 유형: ${t._type}, 시간: ${t._time}`),this.updateLayerSource()}_afterSetMap(e){this._mapbox&&(this._mapbox.off(`idle`,this._debouncedOnIdle),e&&this._mapbox.on(`idle`,this._debouncedOnIdle))}_renderLayer(e){this._mapbox&&p.forEach(this._layers,t=>{this._mapbox.setLayoutProperty(t.id,`visibility`,e?`visible`:`none`)})}init(e){let t=e.getMapbox();this._map=e,this._mapbox=t;let n=Nt.getWeatherMapStyleSource();!n||!t||(t.addSource(this._id,n),this._source=t.getSource(this._id),t.on(`sourcedata`,this._boundOnSourceData),t.on(`data`,this._boundOnData),this._mapListeners=[p.Event.addListener(this._map,`mapType_changed`,this._onMapTypeChanged.bind(this))],this._isInitial=!0)}_onSourceData(e){!this._loaded&&e.isSourceLoaded&&(this._loaded=!0,p.Event.trigger(this,`load`))}_onData(e){if(e.sourceId===this._id&&e.isSourceLoaded&&e.dataType===`source`&&!e.sourceDataType){let e=[];this.__prevType&&this.__prevType!==this._type&&e.push(`type`),this.__prevTime&&this.__prevTime!==this._time&&e.push(`time`);for(let t=0;t{this.updateLayerSource()}))}getWeatherTypeToUrlParameter(e){let t;switch(e){case`temperature`:t=`temp`;break;case`effectiveTemperature`:t=`feel_temp`;break;case`humidity`:t=`humidity`;break;case`windSpeed`:t=`wind_speed`;break;case`precipitation`:t=`precipitation`;break;case`snow`:t=`snow`}return t}getWeatherMetadata(e){if(!this._map)return;let t=this._map,n={Temperature:`temp`,EffectiveTemperature:`feel_temp`,Humidity:`humidity`,WindSpeed:`wind_speed`,Precipitation:`precipitation`,Snow:`snow`},r=t.getMapTypeId(),{metadata:i,name:a}=t.getOptions(`mapTypes`)[r].getMapTypeStyle(),o=Ue(a,i),s;switch(e){case`temperature`:s=n.Temperature;break;case`effectiveTemperature`:s=n.EffectiveTemperature;break;case`humidity`:s=n.Humidity;break;case`windSpeed`:s=n.WindSpeed;break;case`precipitation`:s=n.Precipitation;break;case`snow`:s=n.Snow}return o[s]&&o[s].length>0?o[s]:null}updateDynamicPropertiesUrl(){if(!this._source)return;let e=new URL(this._source.getDynamicPropertiesUrl());e.searchParams.delete(this.WEATHER_TIME_URL_PARAMETER),e.searchParams.append(this.WEATHER_TIME_URL_PARAMETER,this._time),e.searchParams.delete(this.WEATHER_TYPE_URL_PARAMETER),e.searchParams.append(this.WEATHER_TYPE_URL_PARAMETER,this.getWeatherTypeToUrlParameter(this._type)),this._source.setDynamicPropertiesUrl(decodeURIComponent(e.href))}updateLayerProperties(){if(!this._mapbox)return;p.forEach(this._layers,e=>{this._mapbox.removeLayer(e.id)}),this._layers=[];let{layers:e}=this._mapbox.getStyle(),t=this.getWeatherMetadata(this._type)||[],n,r;p.forEach(e,e=>{if(!e.metadata||!e.metadata.group)return;let i=e.metadata.group;t.indexOf(i)>-1&&(n=e.id,r=p.clone(e),r.id=`${this._id}-${e.id}`,r.source=this._id,r.metadata={},r.paint[`fill-opacity-transition`]={duration:0,delay:0},this._mapbox.addLayer(r,n),this._layers.push(r))}),p.forEach(this._layers,e=>{this._mapbox.setLayoutProperty(e.id,`visibility`,this.getMap()?`visible`:`none`),p.hasValue(this._opacity)&&this._mapbox.setPaintProperty(e.id,`fill-opacity`,this._opacity)})}updateLayerSource(){this.updateLayerProperties(),this.updateDynamicPropertiesUrl()}},Oi=class{constructor(e){this.id=e,this.type=`custom`}setMap(e){var t;let n=this.getMap();if(e===n)return;let r=(t=e||n)==null?void 0:t.getMapbox();r&&(this._beforeSetMap(e),e?r.addLayer(this):n&&r.removeLayer(this.id),this._map=e,this._afterSetMap(e))}getMap(){return this._map}_beforeSetMap(e){}_afterSetMap(e){}onAdd(e,t){}onRemove(e,t){}prerender(e,t){}render(e,t){}},ki=`precision mediump float;attribute vec2 a_pos;varying vec2 v_tex_pos;void main() {v_tex_pos=a_pos;gl_Position=vec4(1.0-2.0*a_pos,0,1);}`,Ai=`precision mediump float;uniform sampler2D u_screen;uniform float u_opacity;varying vec2 v_tex_pos;void main() {vec4 color=texture2D(u_screen,1.0-v_tex_pos);gl_FragColor=vec4(floor(255.0*color*u_opacity)/255.0);}`,ji=`precision mediump float;attribute float a_index;uniform sampler2D u_particles;uniform float u_particles_res;uniform float u_pixel_ratio;varying vec2 v_particle_pos;void main() {vec4 color=texture2D(u_particles,vec2( fract(a_index/u_particles_res),floor(a_index/u_particles_res)/u_particles_res));v_particle_pos=vec2(color.r/255.0+color.b,color.g/255.0+color.a);gl_PointSize=min(1.0*u_pixel_ratio,2.0);gl_Position=vec4(2.0*v_particle_pos.x-1.0,1.0-2.0*v_particle_pos.y,0,1);}`,Mi=`precision mediump float;uniform vec4 u_color;uniform vec2 u_map_bounds_min;uniform vec2 u_map_bounds_max;uniform vec2 u_data_bounds_min;uniform vec2 u_data_bounds_max;varying vec2 v_particle_pos;vec2 lookup_lnglat(const vec2 pos,const vec2 domain) {float mx=fract(u_map_bounds_min.x+pos.x*domain.x);float my=u_map_bounds_max.y+pos.y*domain.y;float lng=mx*360.0-180.0;float y=180.0-my*360.0;float lat=360.0/3.141592654*atan(exp(y*3.141592654/180.0))-90.0;return vec2(lng,lat);}void main() {vec2 domain=vec2(abs(u_map_bounds_min.x-u_map_bounds_max.x),abs(u_map_bounds_min.y-u_map_bounds_max.y));vec2 lnglat=lookup_lnglat(v_particle_pos,domain);vec4 color;if (lnglat.x < u_data_bounds_min.x || lnglat.x > u_data_bounds_max.x || lnglat.y < u_data_bounds_min.y || lnglat.y > u_data_bounds_max.y ) {color=vec4(0.0,0.0,0.0,0.0);} else {color=u_color;}gl_FragColor=color;}`,Ni=`precision highp float;uniform sampler2D u_wind;uniform sampler2D u_particles;uniform float u_rand_seed;uniform float u_speed_factor;uniform float u_drop_rate;uniform float u_drop_rate_bump;uniform vec2 u_wind_res;uniform vec2 u_wind_min;uniform vec2 u_wind_max;uniform vec2 u_map_bounds_min;uniform vec2 u_map_bounds_max;uniform vec2 u_data_bounds_min;uniform vec2 u_data_bounds_max;uniform vec2 u_window_size;varying vec2 v_tex_pos;const vec3 rand_constants=vec3(12.9898,78.233,4375.85453);float rand(const vec2 co) {float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}vec2 lookup_wind(const vec2 uv) {vec2 px=1.0/u_wind_res;vec2 vc=(floor(uv*u_wind_res))*px;vec2 f=fract(uv*u_wind_res);vec2 tl=texture2D(u_wind,vc).rg;vec2 tr=texture2D(u_wind,vc+vec2(px.x,0)).rg;vec2 bl=texture2D(u_wind,vc+vec2(0,px.y)).rg;vec2 br=texture2D(u_wind,vc+px).rg;return mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);}vec2 lookup_lnglat(const vec2 pos,const vec2 domain) {float mx=fract(u_map_bounds_min.x+pos.x*domain.x);float my=u_map_bounds_max.y+pos.y*domain.y;float lng=mx*360.0-180.0;float y=180.0-my*360.0;float lat=360.0/3.141592654*atan(exp(y*3.141592654/180.0))-90.0;return vec2(lng,lat);}void main() {vec4 color=texture2D(u_particles,v_tex_pos);vec2 pos=vec2(color.r/255.0+color.b,color.g/255.0+color.a);vec2 domain=vec2(abs(u_map_bounds_min.x-u_map_bounds_max.x),abs(u_map_bounds_min.y-u_map_bounds_max.y));vec2 lnglat=lookup_lnglat(pos,domain);vec2 lnglat_domain=vec2(u_data_bounds_max.x-u_data_bounds_min.x,u_data_bounds_max.y-u_data_bounds_min.y);vec2 pos_lookup=vec2((lnglat.x-u_data_bounds_min.x)/lnglat_domain.x,(lnglat.y-u_data_bounds_min.y)/lnglat_domain.y);vec2 velocity=mix(u_wind_min,u_wind_max,lookup_wind(pos_lookup));float speed_t=length(velocity)/length(u_wind_max);vec2 aspectRatioDistortion=vec2(1.0,u_window_size.x/u_window_size.y);vec2 offset=vec2(velocity.x,-velocity.y)*aspectRatioDistortion*0.0005*u_speed_factor;pos=fract(1.0+pos+offset);vec2 seed=(pos+v_tex_pos)*u_rand_seed;float drop_rate=u_drop_rate+speed_t*u_drop_rate_bump;float drop=step(1.0-drop_rate,rand(seed));vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));pos=mix(pos,random_pos,drop);gl_FragColor=vec4(fract(pos*255.0),floor(pos*255.0)/255.0);}`,Pi=`precision highp float;attribute vec2 a_corner;attribute vec2 a_uv;attribute vec2 a_grid;uniform sampler2D u_wind;uniform vec2 u_wind_res;uniform vec2 u_wind_min;uniform vec2 u_wind_max;uniform vec2 u_map_bounds_min;uniform vec2 u_map_bounds_max;uniform vec2 u_png_bounds_min;uniform vec2 u_png_bounds_max;uniform vec2 u_wind_bounds_min;uniform vec2 u_wind_bounds_max;uniform vec2 u_arrow_size;varying vec2 v_uv;varying float v_visible;vec2 lookup_wind(const vec2 uv) {vec2 px=1.0/u_wind_res;vec2 vc=(floor(uv*u_wind_res))*px;vec2 f=fract(uv*u_wind_res);vec2 tl=texture2D(u_wind,vc).rg;vec2 tr=texture2D(u_wind,vc+vec2(px.x,0)).rg;vec2 bl=texture2D(u_wind,vc+vec2(0,px.y)).rg;vec2 br=texture2D(u_wind,vc+px).rg;return mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);}vec2 lookup_lnglat(const vec2 pos,const vec2 domain) {float mx=fract(u_map_bounds_min.x+pos.x*domain.x);float my=u_map_bounds_max.y+pos.y*domain.y;float lng=mx*360.0-180.0;float y=180.0-my*360.0;float lat=360.0/3.141592654*atan(exp(y*3.141592654/180.0))-90.0;return vec2(lng,lat);}void main() {v_uv=a_uv;vec2 domain=vec2(abs(u_map_bounds_min.x-u_map_bounds_max.x),abs(u_map_bounds_min.y-u_map_bounds_max.y));vec2 lnglat=lookup_lnglat(a_grid,domain);if (lnglat.x < u_wind_bounds_min.x || lnglat.x > u_wind_bounds_max.x || lnglat.y < u_wind_bounds_min.y || lnglat.y > u_wind_bounds_max.y) {v_visible=0.0;gl_Position=vec4(2.0,2.0,2.0,1.0);return;}vec2 lnglat_domain=u_png_bounds_max-u_png_bounds_min;vec2 pos_lookup=(lnglat-u_png_bounds_min)/lnglat_domain;vec2 velocity=mix(u_wind_min,u_wind_max,lookup_wind(pos_lookup));if (length(velocity) < 0.0001) {v_visible=0.0;gl_Position=vec4(2.0,2.0,2.0,1.0);return;}float angle=atan(velocity.y,velocity.x);float c=cos(angle);float s=sin(angle);vec2 rotated=vec2(c*a_corner.x-s*a_corner.y,s*a_corner.x+c*a_corner.y);vec2 center=vec2(a_grid.x*2.0-1.0,1.0-a_grid.y*2.0);vec2 offset=rotated*u_arrow_size;v_visible=1.0;gl_Position=vec4(center+offset,0.0,1.0);}`,Fi=`precision mediump float;uniform sampler2D u_arrow;varying vec2 v_uv;varying float v_visible;void main() {if (v_visible < 0.5) {discard;}gl_FragColor=texture2D(u_arrow,v_uv);}`,Ii=class{constructor(e,t,n){this.fadeOpacity=.996,this.numParticles=4096,this.speedFactor=.25,this.dropRate=.003,this.dropRateBump=.01,this.particleColor=[1,1,1,.88],this.arrowSpacing=40,this.arrowSize=18,this._status=`play`,this._arrowInstanceCount=0,this._quadVertices=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),this._map=e,this._gl=t,this.initOptions(n),this.initGL(t)}destroy(){let e=this._gl;e.deleteProgram(this._screenProgram.program),e.deleteProgram(this._drawProgram.program),e.deleteProgram(this._updateProgram.program),e.deleteProgram(this._arrowProgram.program),this._arrowTexture&&(e.deleteTexture(this._arrowTexture),this._arrowTexture=null),e.deleteBuffer(this._quadBuffer),e.deleteBuffer(this._particleIndexBuffer),e.deleteBuffer(this._arrowQuadBuffer),e.deleteBuffer(this._arrowUvBuffer),e.deleteBuffer(this._arrowGridBuffer),e.deleteTexture(this._screenTexture),e.deleteTexture(this._backgroundTexture),e.deleteTexture(this._windTexture),e.deleteTexture(this._particleStateTexture0),e.deleteTexture(this._particleStateTexture1),e.deleteFramebuffer(this._framebuffer),this._windData=null,this._gl=null,this._map=null}initOptions(e){for(let t in e)this[t]!==void 0&&(this[t]=t===`particleColor`?dt(e[t]):e[t])}initGL(e){this._framebuffer=e.createFramebuffer(),this._screenProgram=l.createProgram(e,ki,Ai),this._drawProgram=l.createProgram(e,ji,Mi),this._updateProgram=l.createProgram(e,ki,Ni),this._arrowProgram=l.createProgram(e,Pi,Fi),this._arrowQuadBuffer=l.createBuffer(e,new Float32Array([-.5,-.5,.5,-.5,-.5,.5,-.5,.5,.5,-.5,.5,.5])),this._arrowUvBuffer=l.createBuffer(e,new Float32Array([0,1,1,1,0,0,0,0,1,1,1,0])),this._quadBuffer=l.createBuffer(e,this._quadVertices),this.resize(),this.updateParticles()}resize(){let e=this._gl,{width:t,height:n}=e.canvas,r=new Uint8Array(t*n*4);this._screenTexture&&e.deleteTexture(this._screenTexture),this._backgroundTexture&&e.deleteTexture(this._backgroundTexture),this._screenTexture=l.createTexture(e,r,t,n,{wrapping:e.CLAMP_TO_EDGE,filter:e.NEAREST}),this._backgroundTexture=l.createTexture(e,r,t,n,{wrapping:e.CLAMP_TO_EDGE,filter:e.NEAREST}),this.updateArrowGrid()}updateArrowGrid(){let e=this._gl,t=window.devicePixelRatio||1,n=Math.max(8,this.arrowSpacing)*t,{width:r,height:i}=e.canvas,a=Math.max(1,Math.floor(r/n)),o=Math.max(1,Math.floor(i/n)),s=(r-(a-1)*n)/2,c=(i-(o-1)*n)/2,u=new Float32Array(a*o*2),d=0;for(let e=0;en[e]).join(`,`),a=`${S.getPath(b.WEATHER)}/v1/api/dfs/timeSeries?category=${i}`;return t&&t.caller&&(a+=`&serviceCaller=${t.caller}`),new Promise((t,i)=>{G.loadJSON(a).then(i=>{if(e){let r=n[e];t(i[r])}else t(r.reduce((e,t)=>{let r=n[t];return r?U(U({},e),{},{[t]:i[r]}):e},{}))}).catch(e=>{i(e)})})}},zi=class extends Oi{constructor(e){let t=`${p.guid()}-wind`;if(super(t),this._loadSeq=0,this._loadListener=null,this.__onMoveStart=()=>this.onMoveEventHandler(`movestart`),this.__onMoveEnd=()=>this.onMoveEventHandler(`moveend`),this.__onResize=()=>this.onResizeEventHandler(),!e||!e.time)throw Error(`Invalid options for Windlayer, time must be required`);this._loaded=!1,this._windData=null,this._options=p.extend({numParticles:4096,fadeOpacity:.97,speedFactor:.25,dropRate:.003,dropRateBump:.01,particleColor:`#ffffffe0`,arrowSpacing:50,arrowSize:16,caller:Li.Default},e),this.loadWindData().catch(e=>{})}setOptions(e,t){if(typeof e==`string`){let n=e;if(n===`time`){this.setWeatherTime(t);return}if(n===`arrowIcon`){this._options[n]=t,this.loadArrowImage();return}this._options[n]=t}else for(let t in e)this.setOptions(t,e[t]);this.updateWindData()}getOptions(e){return e?this._options[e]:this._options}setWeatherTime(e){this._options.time!==e&&(this._options.time=e,this.loadWindData().then(t=>{var n;t&&((n=this._renderer)==null||n.setWindData(this._windData),p.Event.trigger(this,`time_changed`,e))}).catch(e=>{}))}getWeatherTime(){return this._options.time}onAdd(e,t){if(!this._loaded){this._loadListener=p.Event.once(this,`load`,this.onAdd.bind(this,e,t));return}this._loadListener=null,this._mapbox=e,this._renderer=new Ii(e,t,this._options),this._windData&&(this._renderer.setWindData(this._windData),this._mapbox.triggerRepaint()),this._arrowImage?this._renderer.setArrowImage(this._arrowImage):this.loadArrowImage(),this.addEventListeners(e)}onRemove(e,t){var n;this._loadListener&&(p.Event.removeListener(this._loadListener),this._loadListener=null),this.removeEventListeners(e),(n=this._renderer)==null||n.destroy(),this._renderer=null,this._mapbox=null}render(e,t){this.shouldRender()&&(this._renderer.render(),this._mapbox.triggerRepaint())}isPlaying(){return this._renderer&&this._renderer.getStatus()===`play`}_beforeSetMap(e){let t=e||this._map;t&&t.set(V,e?this:null)}loadWindData(){let{time:e,caller:t}=this._options,n=`${S.getPath(b.WEATHER)}/v1/api/dfs/wind/metadata?forecastTime=${e}&serviceCaller=${t}`,r=++this._loadSeq;return new Promise((e,t)=>{G.loadJSON(n).then(n=>{let{windTexturePngUrl:i,windExtent:a,uvMinMax:o,pngExtent:s}=n,{umin:c,vmin:l,umax:u,vmax:d}=o,{lo1:f,la1:m,lo2:h,la2:g}=a,{minX:_,minY:v,maxX:y,maxY:b}=s,x={},S=new Image;S.crossOrigin=`anonymous`,S.onload=()=>{if(r!==this._loadSeq){e(!1);return}x.width=S.width,x.height=S.height,x.uvMinMax=[c,l,u,d],x.windExtent=[f,m,h,g],x.pngExtent=[_,v,y,b],x.imageData=S,this._windData=x;let t=!this._loaded;this._loaded=!0,t&&p.Event.trigger(this,`load`),e(!0)},S.onerror=e=>{t(e)},S.src=i}).catch(e=>{t(e)})})}loadArrowImage(){let e=this._options.arrowIcon;if(this._arrowImage=null,!e){this._renderer&&this._renderer.clearArrowImage();return}G.loadImage(e).then(t=>{this._options.arrowIcon===e&&(this._arrowImage=t,this._renderer&&(this._renderer.setArrowImage(t),this._mapbox&&this._mapbox.triggerRepaint()))}).catch(e=>{})}updateWindData(){if(this._renderer)for(let e in this._options){let t=this._options[e];if(this._renderer[e]!==void 0){if(e===`particleColor`){this._renderer[e]=dt(t);continue}this._renderer[e]=t,e===`numParticles`?this._renderer.updateParticles():e===`arrowSpacing`&&this._renderer.updateArrowGrid()}}}shouldRender(){return this._loaded&&!!this._windData}addEventListeners(e){e.on(`movestart`,this.__onMoveStart),e.on(`moveend`,this.__onMoveEnd),e.on(`resize`,this.__onResize)}removeEventListeners(e){e.off(`movestart`,this.__onMoveStart),e.off(`moveend`,this.__onMoveEnd),e.off(`resize`,this.__onResize)}onMoveEventHandler(e){if(this._renderer){if(e===`movestart`){this._renderer.setStatus(`pause`),this._renderer.clear();return}this._renderer.setStatus(`play`)}}onResizeEventHandler(){this._renderer&&(this._renderer.setStatus(`pause`),this._renderer.resize())}},Bi,Vi=p.TrafficLayer.prototype._addToMap,Hi=`ctt`,Ui=class e extends p.TrafficLayer{setFilter(e,t){let n=this.getMap();if(!n||n.get(`renderMode`)!==2)return;let r=this._sourceId||Hi,i=n.getMapbox().getSource(r);this._cttSourceUrl||(this._cttSourceUrl=i.url);let a=t?`naver/${e}/${t}`:`naver`,o=new URL(this._cttSourceUrl);o.pathname=o.pathname.replace(`/wmts/naver`,`/wmts/${a}`),o.searchParams.delete(`dataType`),t?o.searchParams.append(`dataType`,`major`):o.searchParams.append(`dataType`,`default`),i.setUrl(decodeURIComponent(o.href))}_addToMap(e){if(e.get(`renderMode`)===2){e.layers.set(this.name,this),e.set(`${this.name}Layer`,this);return}Vi.apply(this,[e])}static mixin(){e.mixed||(Te(p.TrafficLayer,e),p.TrafficLayer.prototype.setFilter=e.prototype.setFilter,p.TrafficLayer.prototype._addToMap=e.prototype._addToMap,e.mixed=!0)}};Bi=Ui,Bi.mixed=!1;var Wi,Gi=[`airview`,`waterview`,`airview_dark`,`waterview_dark`],Ki=yi.prototype._renderLayer,qi=class e extends p.StreetLayer{setAirWaterView(e){this._airWaterView=e;let t=e?an.getStreetLayer():an.getSimpleStreetLayer();this._initRegistry(t);let n=this.getMap();n&&(p.Event.trigger(n,`airWaterView_changed`,e),n.get(`renderMode`)===2?this._updateStreetLayers():this.refresh())}isVisibleAirWaterView(){return this._airWaterView===void 0||!!this._airWaterView}_renderLayer(e){Ki.apply(this,[e]),this._updateStreetLayers(e)}_updateStreetLayers(e){if(!this.getMap())return;let t=this.map.getMapbox();p.forEach(this._layerIds,n=>{var r;let i=t.getLayer(n),a=i==null||(r=i.metadata)==null?void 0:r.group;if(!a||Gi.indexOf(a)<0)return;let o=t.getLayoutProperty(n,`visibility`),s=e===!1||this._airWaterView===!1?`none`:`visible`;o!==s&&t.setLayoutProperty(n,`visibility`,s)})}static mixin(){e.mixed||(Te(p.StreetLayer,e),p.StreetLayer.prototype._renderLayer=e.prototype._renderLayer,e.mixed=!0)}};Wi=qi,Wi.mixed=!1;var Ji,Yi=class e extends p.RealtyLayer{_renderLayer(e){var t;if(!this.map)return;let n=this.map.getMapbox(),r=this._getMetadataCategories(),i=this._getMapboxAllLayers(),a=this.map.getOptions(`glType`)===L.HYBRID,o=this.map.getMapTypeId()===P.NORMAL;p.forEach(i,t=>{if(!t.metadata||!t.metadata.group)return;let i=t.metadata.group,s=t.id;if(o&&a&&Ke(r,i)){n.setLayoutProperty(s,`visibility`,e?`none`:`visible`);return}ot(r,i)&&n.setLayoutProperty(s,`visibility`,e?`visible`:`none`)}),this._updateCadastralRealtyLayers(!!((t=this.map.layers)!=null&&t[F.CADASTRAL]),e)}static mixin(){e.mixed||(Te(p.RealtyLayer,e),p.RealtyLayer.prototype._renderLayer=e.prototype._renderLayer,e.mixed=!0)}};Ji=Yi,Ji.mixed=!1,(function(){window.naver&&window.naver.maps&&window.naver.maps.glEnabled||(Vn.mixin(),qn.mixin(),Qn.mixin(),Pr.mixin(),Ir.mixin(),J.mixin(),an.mixin(),nr.mixin(),ur.mixin(),mr.mixin(),vr.mixin(),br.mixin(),q.mixin(),Cr.mixin(),ci.mixin(),yi.mixin(),xi.mixin(),Ui.mixin(),qi.mixin(),Yi.mixin(),Ci.mixin(),Ti.mixin(),window.naver.maps.Util.extend(window.naver,{glEnabled:!0}),window.naver.maps.Util.extend(window.naver.maps,{NaverVectorMapTypeOption:Nt,VectorMapType:bt,MountainLayer:Y,CctvLayer:Tr,TransitLayer:_n,IndoorLayer:un,RealtyLayer:di,RealtyType:li,WeatherWindLayer:zi,WeatherLayer:Di,WeatherType:Ei,WeatherCaller:Li,MapAttributionControl:Dr,MapDataProvider:Ti,DebuggerControl:kr,MarkerGroup:Qr,SimpleMarker:$r,PathOverlay:ai,WebGLHelper:l,WeatherHelper:Ri,GLType:L,ClusterType:Lr,LayerFilterType:hi,glEnabled:!0}),window.naver.maps.Util.glSupported=v)})()})();