@ccrpc/webmapgl 0.18.8 → 0.18.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/gl-address-search_52.cjs.entry.js +1 -1
- package/dist/cjs/gl-address-search_52.cjs.entry.js.map +1 -1
- package/dist/collection/components/legend-item/legend-item.css +4 -0
- package/dist/esm/gl-address-search_52.entry.js +1 -1
- package/dist/esm/gl-address-search_52.entry.js.map +1 -1
- package/dist/webmapgl/p-1bffb772.entry.js +8 -0
- package/dist/webmapgl/p-1bffb772.entry.js.map +1 -0
- package/dist/webmapgl/webmapgl.esm.js +1 -1
- package/package.json +1 -1
- package/dist/webmapgl/p-41aed25d.entry.js +0 -8
- package/dist/webmapgl/p-41aed25d.entry.js.map +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{r as t,h as e,H as i,d as n,e as o,f as s,i as r,j as a,w as l}from"./p-23450e8b.js";import{_ as h}from"./p-9554b2b5.js";import{a as c,g as u,t as d,b as f}from"./p-1109414b.js";import{p,m,g}from"./p-4084433f.js";import{c as b,a as v,g as w}from"./p-7183ba4d.js";import{g as y,c as x,a as _}from"./p-1e77b5bd.js";import{G as k}from"./p-45316f86.js";import{h as M,i as z,c as S,a as C,b as E,r as A,d as I,e as T,f as P,g as $,j as F,k as O,l as D}from"./p-8538de1a.js";import{p as j,a as L}from"./p-b4215fed.js";import{o as R,c as N,h as B}from"./p-b2d007f6.js";import{i as U}from"./p-b4056f43.js";import{f as q,p as V,g as G}from"./p-0f957630.js";import{c as Z}from"./p-97497869.js";import{c as W,a as J,b as X,d as H,s as K,e as Y,f as Q,r as tt,g as et}from"./p-20f51faf.js";import{g as it}from"./p-8e599a9d.js";import{d as nt}from"./p-c76826f0.js";import{m as ot,u as st}from"./p-fcd4273e.js";import{c as rt}from"./p-afa7ec7a.js";import{h as at}from"./p-e150c324.js";import"./p-387cea7f.js";import"./p-94c84e79.js";import"./p-565ab761.js";import"./p-eb6f4547.js";import"./p-771a6f32.js";const lt="gl-address-search{background-color:white;display:flex;flex-direction:column;left:0;position:absolute;top:0;width:100%;z-index:1000;max-height:100%}gl-address-search ion-searchbar{flex:none}gl-address-search ion-list.list-ios{margin-bottom:0;overflow-y:scroll}";const ht="gl-address-search{display:flex;flex-direction:column;left:0;position:absolute;top:0;width:100%;z-index:1000;max-height:100%}gl-address-search ion-searchbar{flex:none}gl-address-search ion-list.list-md{margin-bottom:0;overflow-y:scroll}";const ct=class{constructor(e){t(this,e);this.callChange=()=>this.handleChange();this.callFocus=()=>this.handleFocus();this.callClick=t=>this.handleClick(t);this.mode=undefined;this.bboxArray=undefined;this.hasFocus=false;this.hasValue=false;this.results=[];this.bbox=undefined;this.jobId="gl-address-search";this.limit=10;this.maxZoom=18;this.placeholder=h("webmapgl.address-search.prompt");this.url=undefined;this.zoomPadding=20}async componentWillLoad(){this.parseBbox();if(this.lazyGeocodeCtrl==undefined)this.lazyGeocodeCtrl=await c("gl-geocode-controller")}async handleGeocode(t){if(t.detail.options.jobId===this.jobId)this.results=t.detail.response}handleBodyClick(){this.hasFocus=false}handleKey(t){if(t.key==="ArrowUp")this.handleUp(t);else if(t.key==="ArrowDown")this.handleDown(t)}handleDown(t){let e;if(document.activeElement.tagName==="ION-ITEM"){this.unsetFocus();e=document.activeElement.nextElementSibling}if(e==undefined)e=this.el.querySelector("ion-item");if(e!=null){t.preventDefault();this.setFocus(e)}}handleUp(t){if(document.activeElement.tagName==="ION-ITEM"){t.preventDefault();this.unsetFocus();let e=document.activeElement.previousElementSibling;if(e!=undefined){this.setFocus(e)}else if(this.input!=undefined){this.input.querySelector("input").focus()}}}parseBbox(){this.bboxArray=typeof this.bbox==="string"?this.bbox.split(",").map((t=>parseFloat(t))):this.bbox}setFocus(t){let e=t.shadowRoot.querySelector("button");e.focus();e.style.color="#3880ff"}unsetFocus(){let t=document.activeElement.shadowRoot.querySelector("button");t.style.color=null}formatAddress(t,e){let i=[];if(t.name!=null&&t.name!==t.city)i.push(t.name);if(t.street!=null){i.push(t.housenumber!=null?t.housenumber+" "+t.street:t.street)}if(t.city!=null)i.push(t.city);if(i.length!==0&&t.county!=null)i.push(t.county);if(i.length!==0)return i.join(", ");else return e}async selectResult(t){let e=this.el.closest("gl-map");e.map.fitBounds(t.bbox,{maxZoom:this.maxZoom,padding:this.zoomPadding});this.hasFocus=false}async geocode(){this.lazyGeocodeCtrl.forward({address:this.input.value,url:this.url,bbox:this.bboxArray,bounded:true,jobId:this.jobId,limit:this.limit})}resultButtonFunction(t){return()=>this.selectResult(t)}renderResults(){if(this.results.length===0||!this.hasValue||!this.hasFocus)return null;let t=this.results.map((t=>e("ion-item",{button:true,onClick:this.resultButtonFunction(t),"aria-label":"Address Result"},e("ion-icon",{name:"pin",slot:"start","aria-hidden":"true"}),e("ion-label",null,this.formatAddress(t.address,t.display)))));return e("ion-list",{lines:"full"},t)}handleChange(){var t;if(((t=this.input)===null||t===void 0?void 0:t.value)!=undefined){this.hasValue=true;this.geocode()}else{this.hasValue=false;if(this.results.length!==0)this.results=[]}}handleFocus(){this.hasFocus=true}handleClick(t){t.stopPropagation()}render(){return e(i,null,e("ion-searchbar",{ref:t=>this.input=t,placeholder:this.placeholder,onIonChange:this.callChange,onIonFocus:this.callFocus,onClick:this.callClick}),this.renderResults())}get el(){return n(this)}static get watchers(){return{bbox:["parseBbox"]}}};ct.style={ios:lt,md:ht};const ut="gl-app{display:block;height:100%;width:100%}gl-app .pane-main{bottom:0;display:flex;flex-direction:column;left:0;position:relative;right:0;top:0;width:100%;height:100%}gl-app .map-content .fixed-content{display:flex;flex-direction:column;height:100%;left:0;position:absolute;top:0;width:100%}gl-app .map-content ion-fab.fab-vertical-bottom{bottom:30px}";const dt=class{constructor(e){t(this,e);this.label=undefined;this.menu=true;this.menuLabel=h("webmapgl.app.menulabel");this.splitPane=true;this.menuType="push"}componentDidLoad(){this.el.querySelector("gl-map").resizeMap()}getMenu(){if(this.menu===true){return e("ion-menu",{"content-id":"main",type:this.menuType},e("ion-header",null,e("ion-toolbar",null,e("ion-title",null,this.menuLabel))),e("ion-content",null,e("div",{class:"gl-menu-content"},e("slot",{name:"menu"}))))}else if(this.menu==="custom"){return e("slot",{name:"menu"})}}getMenuButton(){if(this.menu===true)return e("ion-menu-toggle",null,e("ion-button",{"aria-label":"Menu Button"},e("ion-icon",{"aria-hidden":"true",slot:"icon-only",name:"menu"})))}getMain(){return e("div",{class:"pane-main",id:"main"},e("ion-header",null,e("ion-toolbar",null,e("ion-buttons",{slot:"start"},this.getMenuButton(),e("slot",{name:"start-buttons"})),e("ion-buttons",{slot:"end"},e("slot",{name:"end-buttons"})),e("ion-title",null,this.label))),e("ion-content",{scrollX:false,scrollY:false,class:"map-content"},e("div",{class:"fixed-content",slot:"fixed"},e("slot",null))),e("slot",{name:"after-content"}),e("ion-footer",null,e("slot",{name:"footer"})))}render(){let t=[this.getMenu(),this.getMain()];if(this.splitPane)t=[e("ion-split-pane",{"content-id":"main"},t)];return e("ion-app",null,t)}get el(){return n(this)}};dt.style=ut;const ft=class{constructor(e){t(this,e);this.basemapMakeSelection=t=>this.setBasemap(t.detail.value)}componentWillLoad(){this.activeBasemap=this.getBasemapStyles().filter((t=>t.enabled))[0].url}getBasemapStyles(){return Array.from(document.querySelectorAll("gl-style")).filter((t=>t.basemap))}setBasemap(t){this.activeBasemap=t;this.getBasemapStyles().forEach((e=>e.enabled=e.url===t))}render(){const t=h("webmapgl.basemap-switcher.header");let i=this.getBasemapStyles().map((t=>e("ion-item",null,t.thumbnail!=undefined?e("ion-thumbnail",{slot:"start"},e("img",{src:t.thumbnail,alt:t.name})):null,e("ion-radio",{value:t.url},e("ion-label",{"text-wrap":true},t.name)))));return e("ion-content",null,e("ion-list",null,e("ion-radio-group",{onIonChange:this.basemapMakeSelection,value:this.activeBasemap},e("ion-list-header",null,t),i)))}};let pt;const mt=()=>{if(typeof window==="undefined"){return new Map}else{if(!pt){const t=window;t.Ionicons=t.Ionicons||{};pt=t.Ionicons.map=t.Ionicons.map||new Map}return pt}};const gt=t=>{let e=wt(t.src);if(e){return e}e=vt(t.name,t.icon,t.mode,t.ios,t.md);if(e){return bt(e)}if(t.icon){e=wt(t.icon);if(e){return e}e=wt(t.icon[t.mode]);if(e){return e}}return null};const bt=t=>{const e=mt().get(t);if(e){return e}return o(`svg/${t}.svg`)};const vt=(t,e,i,n,o)=>{i=(i&&_t(i))==="ios"?"ios":"md";if(n&&i==="ios"){t=_t(n)}else if(o&&i==="md"){t=_t(o)}else{if(!t&&e&&!yt(e)){t=e}if(xt(t)){t=_t(t)}}if(!xt(t)||t.trim()===""){return null}const s=t.replace(/[a-z]|-|\d/gi,"");if(s!==""){return null}return t};const wt=t=>{if(xt(t)){t=t.trim();if(yt(t)){return t}}return null};const yt=t=>t.length>0&&/(\/|\.)/.test(t);const xt=t=>typeof t==="string";const _t=t=>t.toLowerCase();const kt=(t,e=[])=>{const i={};e.forEach((e=>{if(t.hasAttribute(e)){const n=t.getAttribute(e);if(n!==null){i[e]=t.getAttribute(e)}t.removeAttribute(e)}}));return i};const Mt=t=>{if(t){if(t.dir!==""){return t.dir.toLowerCase()==="rtl"}}return(document===null||document===void 0?void 0:document.dir.toLowerCase())==="rtl"};const zt=class{constructor(e){t(this,e);this.selectBasemap=t=>this.openPopover(t)}async openPopover(t){const e={component:document.createElement("gl-basemap-switcher"),ev:t};const i=await p.create(e);await i.present();return i}render(){let t=h("webmapgl.basemaps.title");return e("ion-button",{onClick:this.selectBasemap,title:t,"aria-label":t},e("ion-icon",{"aria-hidden":"true",slot:"icon-only",name:"earth"}))}get el(){return n(this)}};const St=class{constructor(e){t(this,e);this.clickPopover=t=>this.openPopover(t)}async openPopover(t){const e={component:document.createElement("gl-download-list"),componentProps:{files:Array.from(this.el.querySelectorAll("gl-download-file"))},ev:t};const i=await p.create(e);await i.present();return i}render(){let t=h("webmapgl.download-button.title");return e("ion-button",{onClick:this.clickPopover,title:t,"aria-label":t},e("ion-icon",{"aria-hidden":"true",slot:"icon-only",name:"download-sharp"}))}get el(){return n(this)}};const Ct=class{constructor(e){t(this,e);this.label=undefined;this.size=undefined;this.url=undefined;this.format=undefined}};const Et=class{constructor(e){t(this,e);this.files=undefined}render(){const t=h("webmapgl.download-list.header");let i=this.files.map((t=>{let i=[t.format,t.size].filter((t=>t)).join(", ");if(i!=undefined)i=`(${i})`;let n=h("webmapgl.download-list.download",{file:t.label});return e("ion-item",null,e("ion-label",{"text-wrap":true},t.label," ",i),e("ion-button",{slot:"end",href:t.url,target:"_blank",title:n,"aria-label":n},e("ion-icon",{"aria-hidden":"true",slot:"icon-only",name:"download"})))}));return e("ion-content",null,e("ion-list",null,e("ion-list-header",null,t),i))}};const At="gl-drawer{flex-direction:column;height:50%}gl-drawer.gl-drawer-closed{display:none}gl-drawer.gl-drawer-open{display:flex}gl-drawer ion-content{height:100%}";const It=class{constructor(e){t(this,e);this.glDrawerToggle=s(this,"glDrawerToggle",7);this.closeDrawerClick=()=>this.open=false;this.content=undefined;this.drawerTitle=undefined;this.mapId=undefined;this.open=false}openChanged(t){this.glDrawerToggle.emit({open:t})}componentDidUpdate(){let t=u(this.mapId);t.resizeMap()}async toggle(){this.open=!this.open}render(){return e(i,{class:{"gl-drawer-closed":!this.open,"gl-drawer-open":this.open}},e("ion-header",null,e("ion-toolbar",null,e("ion-buttons",{slot:"start"},e("slot",{name:"toolbar-start-buttons"})),e("ion-title",null,this.drawerTitle),e("ion-buttons",{slot:"end"},e("slot",{name:"toolbar-end-buttons"}),e("ion-button",{title:"Close",onClick:this.closeDrawerClick,"aria-label":"Close"},e("ion-icon",{"aria-hidden":"true",slot:"icon-only",name:"close"}))))),e("ion-content",null,e("slot",null)))}static get watchers(){return{open:["openChanged"]}}};It.style=At;const Tt=class{constructor(e){t(this,e);this.clickToggle=()=>this.toggleDrawer();this.icon="settings";this.buttonTitle=h("webmapgl.drawer-toggle.label");this.disabled=false}async componentWillLoad(){if(this.drawer==undefined)this.drawer=await c("gl-drawer")}toggleDrawer(){this.drawer.open=!this.drawer.open}render(){return e("ion-button",{onClick:this.clickToggle,title:this.buttonTitle,disabled:this.disabled,"aria-label":this.buttonTitle},e("ion-icon",{"aria-hidden":"true",slot:"icon-only",name:this.icon}))}get el(){return n(this)}};const Pt=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]];const $t=(()=>{if(typeof document==="undefined"){return false}const t=Pt[0];const e={};for(const i of Pt){const n=i?.[1];if(n in document){for(const[n,o]of i.entries()){e[t[n]]=o}return e}}return false})();const Ft={change:$t.fullscreenchange,error:$t.fullscreenerror};let Ot={request(t=document.documentElement,e){return new Promise(((i,n)=>{const o=()=>{Ot.off("change",o);i()};Ot.on("change",o);const s=t[$t.requestFullscreen](e);if(s instanceof Promise){s.then(o).catch(n)}}))},exit(){return new Promise(((t,e)=>{if(!Ot.isFullscreen){t();return}const i=()=>{Ot.off("change",i);t()};Ot.on("change",i);const n=document[$t.exitFullscreen]();if(n instanceof Promise){n.then(i).catch(e)}}))},toggle(t,e){return Ot.isFullscreen?Ot.exit():Ot.request(t,e)},onchange(t){Ot.on("change",t)},onerror(t){Ot.on("error",t)},on(t,e){const i=Ft[t];if(i){document.addEventListener(i,e,false)}},off(t,e){const i=Ft[t];if(i){document.removeEventListener(i,e,false)}},raw:$t};Object.defineProperties(Ot,{isFullscreen:{get:()=>Boolean(document[$t.fullscreenElement])},element:{enumerable:true,get:()=>document[$t.fullscreenElement]??undefined},isEnabled:{enumerable:true,get:()=>Boolean(document[$t.fullscreenEnabled])}});if(!$t){Ot={isEnabled:false}}const Dt=Ot;const jt=class{constructor(e){t(this,e);this.clickToggle=()=>this.toggleFullscreen();this.fullscreen=false}componentDidLoad(){Dt.on("change",(()=>this.fullscreen=Dt.isFullscreen))}toggleFullscreen(){Dt.isFullscreen?Dt.exit():Dt.request()}render(){let t=this.fullscreen?h("webmapgl.fullscreen.exit"):h("webmapgl.fullscreen.enter");if(Dt.isEnabled)return e("ion-button",{onClick:this.clickToggle,title:t,"aria-label":t},e("ion-icon",{slot:"icon-only",name:this.fullscreen?"contract":"expand","aria-hidden":"true"}))}};const Lt=class{constructor(e){t(this,e)}render(){return e("ion-item-group",null,e("slot",{name:"start"}),e("slot",null),e("slot",{name:"end"}))}get el(){return n(this)}};const Rt="gl-legend-item .item ion-thumbnail{height:40px;width:40px}gl-legend-item ion-label{white-space:wrap !important}";const Nt=class{constructor(e){t(this,e);this.onToggle=t=>this.setVisible(t.detail.checked);this.visible=undefined;this.layers=undefined;this.image=undefined;this.toggle=false;this.styleId=undefined;this.widget="item"}async componentWillLoad(){this.handleStyleId()}async handleStyleId(){let t=await this.getStyle();if(t!=undefined)this.update(t.json)}handleStyleAdded(t){if(t.detail.id===this.styleId)this.update(t.detail.style.json)}handleStyleUpdated(t){if(t.detail.id===this.styleId)this.update(t.detail.style.json)}async getStyle(){let t=document.querySelector(`gl-style#${this.styleId}`);if(t!=undefined)await t.componentOnReady();return t}getVisible(t){const e=d(this.layers);if(e==undefined||e.length===0)return true;if(t.layers==undefined||t.layers.length===0)return false;for(let i of t.layers){if(e.indexOf(i.id)!==-1){if("layout"in i&&i.layout!=undefined){return i.layout.visibility!=="none"}else return true}}}async setVisible(t){if(this.visible===t)return;let e=d(this.layers);let i=await this.getStyle();if(i==undefined)return;let n=Object.assign({},i.json);n.layers=(n.layers||[]).map((i=>{if(e.indexOf(i.id)!==-1){if(!("layout"in i)||i.layout==undefined)i["layout"]={};i["layout"]["visibility"]=t?"visible":"none"}return i}));i.json=n}update(t){if(t!=null)this.visible=this.getVisible(t)}render(){let t=[];if(this.image!=undefined)t.push(e("ion-thumbnail",{slot:"start"},e("img",{src:this.image,alt:this.el.textContent})));t.push(e("ion-label",null,e("slot",null)));if(this.toggle)t.push(e("ion-toggle",{slot:"end",checked:this.visible,onIonChange:this.onToggle,"aria-label":"Toggle Layer"}));if(this.widget==="divider")return e("ion-item-divider",null,t);return e("ion-item",null,t)}get el(){return n(this)}static get watchers(){return{styleId:["handleStyleId"]}}};Nt.style=Rt;var Bt=b((function(t,e){(function(e,i){t.exports=i()})(v,(function(){var t,e,i;function n(n,o){if(!t){t=o}else if(!e){e=o}else{var s="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);";var r={};t(r);i=o(r);if(typeof window!=="undefined"){i.workerUrl=window.URL.createObjectURL(new Blob([s],{type:"text/javascript"}))}}}n(["exports"],(function(t){function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i=n;function n(t,e){this.x=t,this.y=e}n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),n=Math.sin(t),o=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-n*(this.y-e.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t};var o=e(i),s=r;function r(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}r.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var o=this.sampleCurveX(i)-t;if(Math.abs(o)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=o/s}var r=0,a=1;for(i=t,n=0;n<20&&(o=this.sampleCurveX(i),!(Math.abs(o-t)<e));n++)t>o?r=i:a=i,i=.5*(a-r)+r;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var a=e(s);function l(t,e,i,n){const o=new a(t,e,i,n);return function(t){return o.solve(t)}}const h=l(.25,.1,.25,1);function c(t,e,i){return Math.min(i,Math.max(e,t))}function u(t,e,i){const n=i-e,o=((t-e)%n+n)%n+e;return o===e?i:o}function d(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}let f=1;function p(t,e,i){const n={};for(const o in t)n[o]=e.call(i||this,t[o],o,t);return n}function m(t,e,i){const n={};for(const o in t)e.call(i||this,t[o],o,t)&&(n[o]=t[o]);return n}function g(t){return Array.isArray(t)?t.map(g):"object"==typeof t&&t?p(t,g):t}const b={};function v(t){b[t]||("undefined"!=typeof console&&console.warn(t),b[t]=!0)}function w(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function y(t){let e=0;for(let i,n,o=0,s=t.length,r=s-1;o<s;r=o++)i=t[o],n=t[r],e+=(n.x-i.x)*(i.y+n.y);return e}function x(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}let _=null;function k(t){if(null==_){const e=t.navigator?t.navigator.userAgent:null;_=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return _}function M(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const z="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let S,C;const E={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:t=>(S||(S=document.createElement("a")),S.href=t,S.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==C&&(C=matchMedia("(prefers-reduced-motion: reduce)")),C.matches)}},A={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class I extends Error{constructor(t,e,i,n){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=n}}const T=x()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href,P=t=>A.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))];function $(t,e){const i=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:T(),signal:i.signal});let o=!1,s=!1;"json"===t.type&&n.headers.set("Accept","application/json");return s||fetch(n).then((i=>i.ok?(i=>{("arrayBuffer"===t.type||"image"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text()).then((t=>{s||(o=!0,e(null,t,i.headers.get("Cache-Control"),i.headers.get("Expires")))})).catch((t=>{s||e(new Error(t.message))}))})(i):i.blob().then((n=>e(new I(i.status,i.statusText,t.url,n)))))).catch((t=>{20!==t.code&&e(new Error(t.message))})),{cancel:()=>{s=!0,o||i.abort()}}}const F=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(x()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!x())return(P(t.url)||$)(t,e)}if(!(/^file:/.test(i=t.url)||/^file:/.test(T())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return $(t,e);if(x()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(t,e){const i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(i.responseType="arraybuffer");for(const e in t.headers)i.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===t.credentials,i.onerror=()=>{e(new Error(i.statusText))},i.onload=()=>{if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){let n=i.response;if("json"===t.type)try{n=JSON.parse(i.response)}catch(t){return e(t)}e(null,n,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else{const n=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});e(new I(i.status,i.statusText,t.url,n))}},i.send(t.body),{cancel:()=>i.abort()}}(t,e)},O=function(t,e){return F(d(t,{type:"arrayBuffer"}),e)};function D(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;const e=new URL(t),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function j(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function L(t,e,i){if(i&&i[t]){const n=i[t].indexOf(e);-1!==n&&i[t].splice(n,1)}}class R{constructor(t,e={}){d(this,e),this.type=t}}class N extends R{constructor(t,e={}){super("error",d({error:t},e))}}class B{on(t,e){return this._listeners=this._listeners||{},j(t,e,this._listeners),this}off(t,e){return L(t,e,this._listeners),L(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},j(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new R(t,e||{}));const i=t.type;if(this.listens(i)){t.target=this;const e=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of e)i.call(this,t);const n=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const e of n)L(i,e,this._oneTimeListeners),e.call(this,t);const o=this._eventedParent;o&&(d(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),o.fire(t))}else t instanceof N&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var U={$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:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},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",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const q=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function V(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return q.forEach((t=>{t in e&&(i[t]=e[t])})),i}function G(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!G(t[i],e[i]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t)if(!G(t[i],e[i]))return!1;return!0}return t===e}const Z={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function W(t,e,i){i.push({command:Z.addSource,args:[t,e[t]]})}function J(t,e,i){e.push({command:Z.removeSource,args:[t]}),i[t]=!0}function X(t,e,i,n){J(t,i,n),W(t,e,i)}function H(t,e,i){let n;for(n in t[i])if(Object.prototype.hasOwnProperty.call(t[i],n)&&"data"!==n&&!G(t[i][n],e[i][n]))return!1;for(n in e[i])if(Object.prototype.hasOwnProperty.call(e[i],n)&&"data"!==n&&!G(t[i][n],e[i][n]))return!1;return!0}function K(t,e,i,n,o,s){let r;for(r in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,r)&&(G(t[r],e[r])||i.push({command:s,args:[n,r,e[r],o]}));for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&!Object.prototype.hasOwnProperty.call(t,r)&&(G(t[r],e[r])||i.push({command:s,args:[n,r,e[r],o]}))}function Y(t){return t.id}function Q(t,e){return t[e.id]=e,t}class tt{constructor(t,e,i,n){this.message=(t?`${t}: `:"")+i,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function et(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}class it extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class nt{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new nt(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const ot={kind:"null"},st={kind:"number"},rt={kind:"string"},at={kind:"boolean"},lt={kind:"color"},ht={kind:"object"},ct={kind:"value"},ut={kind:"collator"},dt={kind:"formatted"},ft={kind:"padding"},pt={kind:"resolvedImage"},mt={kind:"variableAnchorOffsetCollection"};function gt(t,e){return{kind:"array",itemType:t,N:e}}function bt(t){if("array"===t.kind){const e=bt(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const vt=[ot,st,rt,at,lt,dt,ht,gt(ct),ft,pt,mt];function wt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!wt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of vt)if(!wt(t,e))return null}return`Expected ${bt(t)} but found ${bt(e)} instead.`}function yt(t,e){return e.some((e=>e.kind===t.kind))}function xt(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function _t(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const kt=.96422,Mt=.82521,zt=4/29,St=6/29,Ct=3*St*St,Et=St*St*St,At=Math.PI/180,It=180/Math.PI;function Tt(t){return(t%=360)<0&&(t+=360),t}function Pt([t,e,i,n]){let o,s;const r=Ft((.2225045*(t=$t(t))+.7168786*(e=$t(e))+.0606169*(i=$t(i)))/1);t===e&&e===i?o=s=r:(o=Ft((.4360747*t+.3850649*e+.1430804*i)/kt),s=Ft((.0139322*t+.0971045*e+.7141733*i)/Mt));const a=116*r-16;return[a<0?0:a,500*(o-r),200*(r-s),n]}function $t(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ft(t){return t>Et?Math.pow(t,1/3):t/Ct+zt}function Ot([t,e,i,n]){let o=(t+16)/116,s=isNaN(e)?o:o+e/500,r=isNaN(i)?o:o-i/200;return o=1*jt(o),s=kt*jt(s),r=Mt*jt(r),[Dt(3.1338561*s-1.6168667*o-.4906146*r),Dt(-.9787684*s+1.9161415*o+.033454*r),Dt(.0719453*s-.2289914*o+1.4052427*r),n]}function Dt(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function jt(t){return t>St?t*t*t:Ct*(t-zt)}function Lt(t){return parseInt(t.padEnd(2,t),16)/255}function Rt(t,e){return Nt(e?t/100:t,0,1)}function Nt(t,e,i){return Math.min(Math.max(e,t),i)}function Bt(t){return!t.some(Number.isNaN)}const Ut={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class qt{constructor(t,e,i,n=1,o=!0){this.r=t,this.g=e,this.b=i,this.a=n,o||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,e,i,n]))}static parse(t){if(t instanceof qt)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=Ut[t];if(e){const[t,i,n]=e;return[t/255,i/255,n/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let i=1;return[Lt(t.slice(i,i+=e)),Lt(t.slice(i,i+=e)),Lt(t.slice(i,i+=e)),Lt(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,i,n,o,s,r,a,l,h,c,u,d]=e,f=[o||" ",a||" ",c].join("");if(" "===f||" /"===f||",,"===f||",,,"===f){const t=[n,r,h].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[Nt(+i/e,0,1),Nt(+s/e,0,1),Nt(+l/e,0,1),u?Rt(+u,d):1];if(Bt(t))return t}}return}}const i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[t,e,n,o,s,r,a,l,h]=i,c=[n||" ",s||" ",a].join("");if(" "===c||" /"===c||",,"===c||",,,"===c){const t=[+e,Nt(+o,0,100),Nt(+r,0,100),l?Rt(+l,h):1];if(Bt(t))return function([t,e,i,n]){function o(n){const o=(n+t/30)%12,s=e*Math.min(i,1-i);return i-s*Math.max(-1,Math.min(o-3,9-o,1))}return t=Tt(t),e/=100,i/=100,[o(0),o(8),o(4),n]}(t)}}}(t);return e?new qt(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:n}=this,o=n||1/0;return this.overwriteGetter("rgb",[t/o,e/o,i/o,n])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,n,o]=Pt(t),s=Math.sqrt(i*i+n*n);return[Math.round(1e4*s)?Tt(Math.atan2(n,i)*It):NaN,s,e,o]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Pt(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,n]=this.rgb;return`rgba(${[t,e,i].map((t=>Math.round(255*t))).join(",")},${n})`}}qt.black=new qt(0,0,0,1),qt.white=new qt(1,1,1,1),qt.transparent=new qt(0,0,0,0),qt.red=new qt(1,0,0,1);class Vt{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Gt{constructor(t,e,i,n,o){this.text=t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=o}}class Zt{constructor(t){this.sections=t}static fromString(t){return new Zt([new Gt(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Zt?t:Zt.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class Wt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Wt)return t;if("number"==typeof t)return new Wt([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new Wt(t)}}toString(){return JSON.stringify(this.values)}}const Jt=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Xt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Xt)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const i=t[e],n=t[e+1];if("string"!=typeof i||!Jt.has(i))return;if(!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new Xt(t)}}toString(){return JSON.stringify(this.values)}}class Ht{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Ht({name:t,available:!1}):null}}function Kt(t,e,i,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Yt(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof qt||t instanceof Vt||t instanceof Zt||t instanceof Wt||t instanceof Xt||t instanceof Ht)return!0;if(Array.isArray(t)){for(const e of t)if(!Yt(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Yt(t[e]))return!1;return!0}return!1}function Qt(t){if(null===t)return ot;if("string"==typeof t)return rt;if("boolean"==typeof t)return at;if("number"==typeof t)return st;if(t instanceof qt)return lt;if(t instanceof Vt)return ut;if(t instanceof Zt)return dt;if(t instanceof Wt)return ft;if(t instanceof Xt)return mt;if(t instanceof Ht)return pt;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=Qt(e);if(i){if(i===t)continue;i=ct;break}i=t}return gt(i||ct,e)}return ht}function te(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof qt||t instanceof Zt||t instanceof Wt||t instanceof Xt||t instanceof Ht?t.toString():JSON.stringify(t)}class ee{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Yt(t[1]))return e.error("invalid value");const i=t[1];let n=Qt(i);const o=e.expectedType;return"array"!==n.kind||0!==n.N||!o||"array"!==o.kind||"number"==typeof o.N&&0!==o.N||(n=o),new ee(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ie{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const ne={string:rt,number:st,boolean:at,object:ht};class oe{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,n=1;const o=t[0];if("array"===o){let o,s;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in ne)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);o=ne[i],n++}else o=ct;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}i=gt(o,s)}else{if(!ne[o])throw new Error(`Types doesn't contain name = ${o}`);i=ne[o]}const s=[];for(;n<t.length;n++){const i=e.parse(t[n],n,ct);if(!i)return null;s.push(i)}return new oe(i,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!wt(this.type,Qt(i)))return i;if(e===this.args.length-1)throw new ie(`Expected value to be of type ${bt(this.type)}, but found ${bt(Qt(i))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const se={"to-boolean":at,"to-color":lt,"to-number":st,"to-string":rt};class re{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(!se[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const n=se[i],o=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],i,ct);if(!n)return null;o.push(n)}return new re(n,o)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,i;for(const n of this.args){if(e=n.evaluate(t),i=null,e instanceof qt)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Kt(e[0],e[1],e[2],e[3]),!i))return new qt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ie(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const i of this.args){e=i.evaluate(t);const n=Wt.parse(e);if(n)return n}throw new ie(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const i of this.args){e=i.evaluate(t);const n=Xt.parse(e);if(n)return n}throw new ie(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new ie(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return Zt.fromString(te(this.args[0].evaluate(t)));case"resolvedImage":return Ht.fromString(te(this.args[0].evaluate(t)));default:return te(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const ae=["Unknown","Point","LineString","Polygon"];class le{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?ae[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=qt.parse(t)),e}}class he{constructor(t,e,i=[],n,o=new nt,s=[]){this.registry=t,this.path=i,this.key=i.map((t=>`[${t}]`)).join(""),this.scope=o,this.errors=s,this.expectedType=n,this._isConstant=e}parse(t,e,i,n,o={}){return e?this.concat(e,i,n)._parse(t,o):this._parse(t,o)}_parse(t,e){function i(t,e,i){return"assert"===i?new oe(e,[t]):"coerce"===i?new re(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const o=this.registry[n];if(o){let n=o.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,o=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==o.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==o.kind&&"string"!==o.kind)if("padding"!==t.kind||"value"!==o.kind&&"number"!==o.kind&&"array"!==o.kind)if("variableAnchorOffsetCollection"!==t.kind||"value"!==o.kind&&"array"!==o.kind){if(this.checkSubtype(t,o))return null}else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof ee)&&"resolvedImage"!==n.type.kind&&this._isConstant(n)){const e=new le;try{n=new ee(n.type,n.evaluate(e))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,o=i?this.scope.concat(i):this.scope;return new he(this.registry,this._isConstant,n,e||null,o,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new it(i,t))}checkSubtype(t,e){const i=wt(t,e);return i&&this.error(i),i}}class ce{constructor(t,e,i){this.type=ut,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,at);if(!n)return null;const o=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,at);if(!o)return null;let s=null;return i.locale&&(s=e.parse(i.locale,1,rt),!s)?null:new ce(n,o,s)}evaluate(t){return new Vt(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}const ue=8192;function de(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function fe(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function pe(t,e){const i=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(i*o*ue),Math.round(n*o*ue)]}function me(t,e,i){const n=t[0]-e[0],o=t[1]-e[1],s=t[0]-i[0],r=t[1]-i[1];return n*r-s*o==0&&n*s<=0&&o*r<=0}function ge(t,e){let i=!1;for(let r=0,a=e.length;r<a;r++){const a=e[r];for(let e=0,r=a.length;e<r-1;e++){if(me(t,a[e],a[e+1]))return!1;(o=a[e])[1]>(n=t)[1]!=(s=a[e+1])[1]>n[1]&&n[0]<(s[0]-o[0])*(n[1]-o[1])/(s[1]-o[1])+o[0]&&(i=!i)}}var n,o,s;return i}function be(t,e){for(let i=0;i<e.length;i++)if(ge(t,e[i]))return!0;return!1}function ve(t,e,i,n){const o=n[0]-i[0],s=n[1]-i[1],r=(t[0]-i[0])*s-o*(t[1]-i[1]),a=(e[0]-i[0])*s-o*(e[1]-i[1]);return r>0&&a<0||r<0&&a>0}function we(t,e,i){for(const h of i)for(let i=0;i<h.length-1;++i)if(0!=(a=[(r=h[i+1])[0]-(s=h[i])[0],r[1]-s[1]])[0]*(l=[(o=e)[0]-(n=t)[0],o[1]-n[1]])[1]-a[1]*l[0]&&ve(n,o,s,r)&&ve(s,r,n,o))return!0;var n,o,s,r,a,l;return!1}function ye(t,e){for(let i=0;i<t.length;++i)if(!ge(t[i],e))return!1;for(let i=0;i<t.length-1;++i)if(we(t[i],t[i+1],e))return!1;return!0}function xe(t,e){for(let i=0;i<e.length;i++)if(ye(t,e[i]))return!0;return!1}function _e(t,e,i){const n=[];for(let o=0;o<t.length;o++){const s=[];for(let n=0;n<t[o].length;n++){const r=pe(t[o][n],i);de(e,r),s.push(r)}n.push(s)}return n}function ke(t,e,i){const n=[];for(let o=0;o<t.length;o++){const s=_e(t[o],e,i);n.push(s)}return n}function Me(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const e=.5*n;let o=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===o&&(o=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=o}de(e,t)}function ze(t,e,i,n){const o=Math.pow(2,n.z)*ue,s=[n.x*ue,n.y*ue],r=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];Me(n,e,i,o),r.push(n)}return r}function Se(t,e,i,n){const o=Math.pow(2,n.z)*ue,s=[n.x*ue,n.y*ue],r=[];for(const i of t){const t=[];for(const n of i){const i=[n.x+s[0],n.y+s[1]];de(e,i),t.push(i)}r.push(t)}if(e[2]-e[0]<=o/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of r)for(const n of t)Me(n,e,i,o)}var a;return r}class Ce{constructor(t,e){this.type=at,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Yt(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const i=e.features[t].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new Ce(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Ce(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Ce(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=t.canonicalID();if("Polygon"===e.type){const s=_e(e.coordinates,n,o),r=ze(t.geometry(),i,n,o);if(!fe(i,n))return!1;for(const t of r)if(!ge(t,s))return!1}if("MultiPolygon"===e.type){const s=ke(e.coordinates,n,o),r=ze(t.geometry(),i,n,o);if(!fe(i,n))return!1;for(const t of r)if(!be(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=t.canonicalID();if("Polygon"===e.type){const s=_e(e.coordinates,n,o),r=Se(t.geometry(),i,n,o);if(!fe(i,n))return!1;for(const t of r)if(!ye(t,s))return!1}if("MultiPolygon"===e.type){const s=ke(e.coordinates,n,o),r=Se(t.geometry(),i,n,o);if(!fe(i,n))return!1;for(const t of r)if(!xe(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Ee{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new Ee(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Ae{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const i=t[0],n=Ae.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const o=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,r=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[n,s]of r){a=new he(e.registry,Ie,e.path,null,e.scope);const r=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],o=Array.isArray(n)?n[e-1]:n.type,s=a.parse(i,1+r.length,o);if(!s){l=!0;break}r.push(s)}if(!l)if(Array.isArray(n)&&n.length!==r.length)a.error(`Expected ${n.length} arguments, but found ${r.length} instead.`);else{for(let t=0;t<r.length;t++){const e=Array.isArray(n)?n[t]:n.type,i=r[t];a.concat(t+1).checkSubtype(e,i.type)}if(0===a.errors.length)return new Ae(i,o,s,r)}}if(1===r.length)e.errors.push(...a.errors);else{const i=(r.length?r:s).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(bt).join(", ")})`:`(${bt(e.type)}...)`;var e})).join(" | "),n=[];for(let i=1;i<t.length;i++){const o=e.parse(t[i],1+n.length);if(!o)return null;n.push(bt(o.type))}e.error(`Expected arguments of type ${i}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){Ae.definitions=e;for(const i in e)t[i]=Ae}}function Ie(t){if(t instanceof Ee)return Ie(t.boundExpression);if(t instanceof Ae&&"error"===t.name)return!1;if(t instanceof ce)return!1;if(t instanceof Ce)return!1;const e=t instanceof re||t instanceof oe;let i=!0;return t.eachChild((t=>{i=e?i&&Ie(t):i&&t instanceof ee})),!!i&&Te(t)&&$e(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Te(t){if(t instanceof Ae){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Ce)return!1;let e=!0;return t.eachChild((t=>{e&&!Te(t)&&(e=!1)})),e}function Pe(t){if(t instanceof Ae&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Pe(t)&&(e=!1)})),e}function $e(t,e){if(t instanceof Ae&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!$e(t,e)&&(i=!1)})),i}function Fe(t,e){const i=t.length-1;let n,o,s=0,r=i,a=0;for(;s<=r;)if(a=Math.floor((s+r)/2),n=t[a],o=t[a+1],n<=e){if(a===i||e<o)return a;s=a+1}else{if(!(n>e))throw new ie("Input is not a number.");r=a-1}return 0}class Oe{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,st);if(!i)return null;const n=[];let o=null;e.expectedType&&"value"!==e.expectedType.kind&&(o=e.expectedType);for(let i=1;i<t.length;i+=2){const s=1===i?-1/0:t[i],r=t[i+1],a=i,l=i+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const h=e.parse(r,l,o);if(!h)return null;o=o||h.type,n.push([s,h])}return new Oe(o,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const o=e.length;return n>=e[o-1]?i[o-1].evaluate(t):i[Fe(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function De(t,e,i){return t+i*(e-t)}function je(t,e,i){return t.map(((t,n)=>De(t,e[n],i)))}const Le={number:De,color:function(t,e,i,n="rgb"){switch(n){case"rgb":{const[n,o,s,r]=je(t.rgb,e.rgb,i);return new qt(n,o,s,r,!1)}case"hcl":{const[n,o,s,r]=t.hcl,[a,l,h,c]=e.hcl;let u,d;if(isNaN(n)||isNaN(a))isNaN(n)?isNaN(a)?u=NaN:(u=a,1!==s&&0!==s||(d=l)):(u=n,1!==h&&0!==h||(d=o));else{let t=a-n;a>n&&t>180?t-=360:a<n&&n-a>180&&(t+=360),u=n+i*t}const[f,p,m,g]=function([t,e,i,n]){return t=isNaN(t)?0:t*At,Ot([i,Math.cos(t)*e,Math.sin(t)*e,n])}([u,null!=d?d:De(o,l,i),De(s,h,i),De(r,c,i)]);return new qt(f,p,m,g,!1)}case"lab":{const[n,o,s,r]=Ot(je(t.lab,e.lab,i));return new qt(n,o,s,r,!1)}}},array:je,padding:function(t,e,i){return new Wt(je(t.values,e.values,i))},variableAnchorOffsetCollection:function(t,e,i){const n=t.values,o=e.values;if(n.length!==o.length)throw new ie(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const s=[];for(let t=0;t<n.length;t+=2){if(n[t]!==o[t])throw new ie(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${n[t]}, to[${t}]: ${o[t]}`);s.push(n[t]);const[e,r]=n[t+1],[a,l]=o[t+1];s.push([De(e,a,i),De(r,l,i)])}return new Xt(s)}};class Re{constructor(t,e,i,n,o){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of o)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,n){let o=0;if("exponential"===t.name)o=Ne(e,t.base,i,n);else if("linear"===t.name)o=Ne(e,1,i,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;o=new a(s[0],s[1],s[2],s[3]).solve(Ne(e,1,i,n))}return o}static parse(t,e){let[i,n,o,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(o=e.parse(o,2,st),!o)return null;const r=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=lt:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t<s.length;t+=2){const i=s[t],n=s[t+1],o=t+3,l=t+4;if("number"!=typeof i)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(r.length&&r[r.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',o);const h=e.parse(n,l,a);if(!h)return null;a=a||h.type,r.push([i,h])}return _t(a,st)||_t(a,lt)||_t(a,ft)||_t(a,mt)||_t(a,gt(st))?new Re(a,i,n,o,r):e.error(`Type ${bt(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const o=e.length;if(n>=e[o-1])return i[o-1].evaluate(t);const s=Fe(e,n),r=Re.interpolationFactor(this.interpolation,n,e[s],e[s+1]),a=i[s].evaluate(t),l=i[s+1].evaluate(t);switch(this.operator){case"interpolate":return Le[this.type.kind](a,l,r);case"interpolate-hcl":return Le.color(a,l,r,"hcl");case"interpolate-lab":return Le.color(a,l,r,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Ne(t,e,i,n){const o=n-i,s=t-i;return 0===o?0:1===e?s/o:(Math.pow(e,s)-1)/(Math.pow(e,o)-1)}class Be{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let i=null;const n=e.expectedType;n&&"value"!==n.kind&&(i=n);const o=[];for(const n of t.slice(1)){const t=e.parse(n,1+o.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,o.push(t)}if(!i)throw new Error("No output type");const s=n&&o.some((t=>wt(n,t.type)));return new Be(s?ct:i,o)}evaluate(t){let e,i=null,n=0;for(const o of this.args)if(n++,i=o.evaluate(t),i&&i instanceof Ht&&!i.available&&(e||(e=i.name),i=null,n===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}class Ue{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n<t.length-1;n+=2){const o=t[n];if("string"!=typeof o)return e.error(`Expected string, but found ${typeof o} instead.`,n);if(/[^a-zA-Z0-9_]/.test(o))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;i.push([o,s])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return n?new Ue(i,n):null}outputDefined(){return this.result.outputDefined()}}class qe{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,st),n=e.parse(t[2],2,gt(e.expectedType||ct));return i&&n?new qe(n.type.itemType,i,n):null}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new ie(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new ie(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new ie(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Ve{constructor(t,e){this.type=at,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ct),n=e.parse(t[2],2,ct);return i&&n?yt(i.type,[at,rt,st,ot,ct])?new Ve(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!xt(e,["boolean","string","number","null"]))throw new ie(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Qt(e))} instead.`);if(!xt(i,["string","array"]))throw new ie(`Expected second argument to be of type array or string, but found ${bt(Qt(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Ge{constructor(t,e,i){this.type=st,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ct),n=e.parse(t[2],2,ct);if(!i||!n)return null;if(!yt(i.type,[at,rt,st,ot,ct]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`);if(4===t.length){const o=e.parse(t[3],3,st);return o?new Ge(i,n,o):null}return new Ge(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!xt(e,["boolean","string","number","null"]))throw new ie(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Qt(e))} instead.`);if(!xt(i,["string","array"]))throw new ie(`Expected second argument to be of type array or string, but found ${bt(Qt(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return i.indexOf(e,n)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Ze{constructor(t,e,i,n,o,s){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=o,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const o={},s=[];for(let r=2;r<t.length-1;r+=2){let a=t[r];const l=t[r+1];Array.isArray(a)||(a=[a]);const h=e.concat(r);if(0===a.length)return h.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return h.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,Qt(t)))return null}else i=Qt(t);if(void 0!==o[String(t)])return h.error("Branch labels must be unique.");o[String(t)]=s.length}const c=e.parse(l,r,n);if(!c)return null;n=n||c.type,s.push(c)}const r=e.parse(t[1],1,ct);if(!r)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==r.type.kind&&e.concat(1).checkSubtype(i,r.type)?null:new Ze(i,n,r,o,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(Qt(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class We{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n=[];for(let o=1;o<t.length-1;o+=2){const s=e.parse(t[o],o,at);if(!s)return null;const r=e.parse(t[o+1],o+1,i);if(!r)return null;n.push([s,r]),i=i||r.type}const o=e.parse(t[t.length-1],t.length-1,i);if(!o)return null;if(!i)throw new Error("Can't infer output type");return new We(i,n,o)}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}}class Je{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ct),n=e.parse(t[2],2,st);if(!i||!n)return null;if(!yt(i.type,[gt(ct),rt,ct]))return e.error(`Expected first argument to be of type array or string, but found ${bt(i.type)} instead`);if(4===t.length){const o=e.parse(t[3],3,st);return o?new Je(i.type,i,n,o):null}return new Je(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!xt(e,["string","array"]))throw new ie(`Expected first argument to be of type array or string, but found ${bt(Qt(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(i,n)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Xe(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function He(t,e,i,n){return 0===n.compare(e,i)}function Ke(t,e,i){const n="=="!==t&&"!="!==t;return class o{constructor(t,e,i){this.type=at,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let s=e.parse(t[1],1,ct);if(!s)return null;if(!Xe(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${bt(s.type)}'.`);let r=e.parse(t[2],2,ct);if(!r)return null;if(!Xe(i,r.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${bt(r.type)}'.`);if(s.type.kind!==r.type.kind&&"value"!==s.type.kind&&"value"!==r.type.kind)return e.error(`Cannot compare types '${bt(s.type)}' and '${bt(r.type)}'.`);n&&("value"===s.type.kind&&"value"!==r.type.kind?s=new oe(r.type,[s]):"value"!==s.type.kind&&"value"===r.type.kind&&(r=new oe(s.type,[r])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==r.type.kind&&"value"!==s.type.kind&&"value"!==r.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,ut),!a)return null}return new o(s,r,a)}evaluate(o){const s=this.lhs.evaluate(o),r=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){const e=Qt(s),i=Qt(r);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new ie(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=Qt(s),i=Qt(r);if("string"!==t.kind||"string"!==i.kind)return e(o,s,r)}return this.collator?i(o,s,r,this.collator.evaluate(o)):e(o,s,r)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const Ye=Ke("==",(function(t,e,i){return e===i}),He),Qe=Ke("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!He(0,e,i,n)})),ti=Ke("<",(function(t,e,i){return e<i}),(function(t,e,i,n){return n.compare(e,i)<0})),ei=Ke(">",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),ii=Ke("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),ni=Ke(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0}));class oi{constructor(t,e,i,n,o){this.type=rt,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,st);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let o=null;if(n.locale&&(o=e.parse(n.locale,1,rt),!o))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,rt),!s))return null;let r=null;if(n["min-fraction-digits"]&&(r=e.parse(n["min-fraction-digits"],1,st),!r))return null;let a=null;return n["max-fraction-digits"]&&(a=e.parse(n["max-fraction-digits"],1,st),!a)?null:new oi(i,o,s,r,a)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class si{constructor(t){this.type=dt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const n=[];let o=!1;for(let i=1;i<=t.length-1;++i){const s=t[i];if(o&&"object"==typeof s&&!Array.isArray(s)){o=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,st),!t))return null;let i=null;if(s["text-font"]&&(i=e.parse(s["text-font"],1,gt(rt)),!i))return null;let r=null;if(s["text-color"]&&(r=e.parse(s["text-color"],1,lt),!r))return null;const a=n[n.length-1];a.scale=t,a.font=i,a.textColor=r}else{const s=e.parse(t[i],1,ct);if(!s)return null;const r=s.type.kind;if("string"!==r&&"value"!==r&&"null"!==r&&"resolvedImage"!==r)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new si(n)}evaluate(t){return new Zt(this.sections.map((e=>{const i=e.content.evaluate(t);return Qt(i)===pt?new Gt("",i,null,null,null):new Gt(te(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}}class ri{constructor(t){this.type=pt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,rt);return i?new ri(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=Ht.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class ai{constructor(t){this.type=st,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${bt(i.type)} instead.`):new ai(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new ie(`Expected value to be of type string or array, but found ${bt(Qt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const li={"==":Ye,"!=":Qe,">":ei,"<":ti,">=":ni,"<=":ii,array:oe,at:qe,boolean:oe,case:We,coalesce:Be,collator:ce,format:si,image:ri,in:Ve,"index-of":Ge,interpolate:Re,"interpolate-hcl":Re,"interpolate-lab":Re,length:ai,let:Ue,literal:ee,match:Ze,number:oe,"number-format":oi,object:oe,slice:Je,step:Oe,string:oe,"to-boolean":re,"to-color":re,"to-number":re,"to-string":re,var:Ee,within:Ce};function hi(t,[e,i,n,o]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const s=o?o.evaluate(t):1,r=Kt(e,i,n,s);if(r)throw new ie(r);return new qt(e/255,i/255,n/255,s,!1)}function ci(t,e){return t in e}function ui(t,e){const i=e[t];return void 0===i?null:i}function di(t){return{type:t}}function fi(t){return{result:"success",value:t}}function pi(t){return{result:"error",value:t}}function mi(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function gi(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function bi(t){return!!t.expression&&t.expression.interpolated}function vi(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function wi(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function yi(t){return t}function xi(t,e){const i="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],o=n||!(n||void 0!==t.property),s=t.type||(bi(e)?"exponential":"interval");if(i||"padding"===e.type){const n=i?qt.parse:Wt.parse;(t=et({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],n(t[1])]))),t.default=n(t.default?t.default:e.default)}if(t.colorSpace&&"rgb"!==(r=t.colorSpace)&&"hcl"!==r&&"lab"!==r)throw new Error(`Unknown color space: "${t.colorSpace}"`);var r;let a,l,h;if("exponential"===s)a=zi;else if("interval"===s)a=Mi;else if("categorical"===s){a=ki,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];h=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);a=Si}if(n){const i={},n=[];for(let e=0;e<t.stops.length;e++){const o=t.stops[e],s=o[0].zoom;void 0===i[s]&&(i[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},n.push(s)),i[s].stops.push([o[0].value,o[1]])}const o=[];for(const t of n)o.push([i[t].zoom,xi(i[t],e)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:Re.interpolationFactor.bind(void 0,s),zoomStops:o.map((t=>t[0])),evaluate:({zoom:i},n)=>zi({stops:o,base:t.base},e,i).evaluate(i,n)}}if(o){const i="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Re.interpolationFactor.bind(void 0,i),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:i})=>a(t,e,i,l,h)}}return{kind:"source",evaluate(i,n){const o=n&&n.properties?n.properties[t.property]:void 0;return void 0===o?_i(t.default,e.default):a(t,e,o,l,h)}}}function _i(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function ki(t,e,i,n,o){return _i(typeof i===o?n[i]:void 0,t.default,e.default)}function Mi(t,e,i){if("number"!==vi(i))return _i(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const o=Fe(t.stops.map((t=>t[0])),i);return t.stops[o][1]}function zi(t,e,i){const n=void 0!==t.base?t.base:1;if("number"!==vi(i))return _i(t.default,e.default);const o=t.stops.length;if(1===o)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[o-1][0])return t.stops[o-1][1];const s=Fe(t.stops.map((t=>t[0])),i),r=function(t,e,i,n){const o=n-i,s=t-i;return 0===o?0:1===e?s/o:(Math.pow(e,s)-1)/(Math.pow(e,o)-1)}(i,n,t.stops[s][0],t.stops[s+1][0]),a=t.stops[s][1],l=t.stops[s+1][1],h=Le[e.type]||yi;return"function"==typeof a.evaluate?{evaluate(...e){const i=a.evaluate.apply(void 0,e),n=l.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==n)return h(i,n,r,t.colorSpace)}}:h(a,l,r,t.colorSpace)}function Si(t,e,i){switch(e.type){case"color":i=qt.parse(i);break;case"formatted":i=Zt.fromString(i.toString());break;case"resolvedImage":i=Ht.fromString(i.toString());break;case"padding":i=Wt.parse(i);break;default:vi(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0)}return _i(i,t.default,e.default)}Ae.register(li,{error:[{kind:"error"},[rt],(t,[e])=>{throw new ie(e.evaluate(t))}],typeof:[rt,[ct],(t,[e])=>bt(Qt(e.evaluate(t)))],"to-rgba":[gt(st,4),[lt],(t,[e])=>{const[i,n,o,s]=e.evaluate(t).rgb;return[255*i,255*n,255*o,s]}],rgb:[lt,[st,st,st],hi],rgba:[lt,[st,st,st,st],hi],has:{type:at,overloads:[[[rt],(t,[e])=>ci(e.evaluate(t),t.properties())],[[rt,ht],(t,[e,i])=>ci(e.evaluate(t),i.evaluate(t))]]},get:{type:ct,overloads:[[[rt],(t,[e])=>ui(e.evaluate(t),t.properties())],[[rt,ht],(t,[e,i])=>ui(e.evaluate(t),i.evaluate(t))]]},"feature-state":[ct,[rt],(t,[e])=>ui(e.evaluate(t),t.featureState||{})],properties:[ht,[],t=>t.properties()],"geometry-type":[rt,[],t=>t.geometryType()],id:[ct,[],t=>t.id()],zoom:[st,[],t=>t.globals.zoom],"heatmap-density":[st,[],t=>t.globals.heatmapDensity||0],"line-progress":[st,[],t=>t.globals.lineProgress||0],accumulated:[ct,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[st,di(st),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[st,di(st),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:st,overloads:[[[st,st],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[st],(t,[e])=>-e.evaluate(t)]]},"/":[st,[st,st],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[st,[st,st],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[st,[],()=>Math.LN2],pi:[st,[],()=>Math.PI],e:[st,[],()=>Math.E],"^":[st,[st,st],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[st,[st],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[st,[st],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[st,[st],(t,[e])=>Math.log(e.evaluate(t))],log2:[st,[st],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[st,[st],(t,[e])=>Math.sin(e.evaluate(t))],cos:[st,[st],(t,[e])=>Math.cos(e.evaluate(t))],tan:[st,[st],(t,[e])=>Math.tan(e.evaluate(t))],asin:[st,[st],(t,[e])=>Math.asin(e.evaluate(t))],acos:[st,[st],(t,[e])=>Math.acos(e.evaluate(t))],atan:[st,[st],(t,[e])=>Math.atan(e.evaluate(t))],min:[st,di(st),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[st,di(st),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[st,[st],(t,[e])=>Math.abs(e.evaluate(t))],round:[st,[st],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[st,[st],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[st,[st],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[at,[rt,ct],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[at,[ct],(t,[e])=>t.id()===e.value],"filter-type-==":[at,[rt],(t,[e])=>t.geometryType()===e.value],"filter-<":[at,[rt,ct],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n<o}],"filter-id-<":[at,[ct],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[at,[rt,ct],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n>o}],"filter-id->":[at,[ct],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[at,[rt,ct],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[at,[ct],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[at,[rt,ct],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[at,[ct],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[at,[ct],(t,[e])=>e.value in t.properties()],"filter-has-id":[at,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[at,[gt(rt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[at,[gt(ct)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[at,[rt,gt(ct)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[at,[rt,gt(ct)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const o=i+n>>1;if(e[o]===t)return!0;e[o]>t?n=o-1:i=o+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:at,overloads:[[[at,at],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[di(at),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:at,overloads:[[[at,at],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[di(at),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[at,[at],(t,[e])=>!e.evaluate(t)],"is-supported-script":[at,[rt],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[rt,[rt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[rt,[rt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[rt,di(ct),(t,e)=>e.map((e=>te(e.evaluate(t)))).join("")],"resolved-locale":[rt,[ut],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Ci{constructor(t,e){var i;this.expression=t,this._warningHistory={},this._evaluator=new le,this._defaultValue=e?"color"===(i=e).type&&wi(i.default)?new qt(0,0,0,0):"color"===i.type?qt.parse(i.default)||null:"padding"===i.type?Wt.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?Xt.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,n,o,s){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,o,s){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new ie(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Ei(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in li}function Ai(t,e){const i=new he(li,Ie,[],e?function(t){const e={color:lt,string:rt,number:st,enum:rt,boolean:at,formatted:dt,padding:ft,resolvedImage:pt,variableAnchorOffsetCollection:mt};return"array"===t.type?gt(e[t.value]||ct,t.length):e[t.type]}(e):void 0),n=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?fi(new Ci(n,e)):pi(i.errors)}class Ii{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Pe(e.expression)}evaluateWithoutErrorHandling(t,e,i,n,o,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,o,s)}evaluate(t,e,i,n,o,s){return this._styleExpression.evaluate(t,e,i,n,o,s)}}class Ti{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Pe(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,i,n,o,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,o,s)}evaluate(t,e,i,n,o,s){return this._styleExpression.evaluate(t,e,i,n,o,s)}interpolationFactor(t,e,i){return this.interpolationType?Re.interpolationFactor(this.interpolationType,t,e,i):0}}function Pi(t,e){const i=Ai(t,e);if("error"===i.result)return i;const n=i.value.expression,o=Te(n);if(!o&&!mi(e))return pi([new it("","data expressions not supported")]);const s=$e(n,["zoom"]);if(!s&&!gi(e))return pi([new it("","zoom expressions not supported")]);const r=Fi(n);return r||s?r instanceof it?pi([r]):r instanceof Re&&!bi(e)?pi([new it("",'"interpolate" expressions cannot be used with this property')]):fi(r?new Ti(o?"camera":"composite",i.value,r.labels,r instanceof Re?r.interpolation:void 0):new Ii(o?"constant":"source",i.value)):pi([new it("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class $i{constructor(t,e){this._parameters=t,this._specification=e,et(this,xi(this._parameters,this._specification))}static deserialize(t){return new $i(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Fi(t){let e=null;if(t instanceof Ue)e=Fi(t.result);else if(t instanceof Be){for(const i of t.args)if(e=Fi(i),e)break}else(t instanceof Oe||t instanceof Re)&&t.input instanceof Ae&&"zoom"===t.input.name&&(e=t);return e instanceof it||t.eachChild((t=>{const i=Fi(t);i instanceof it?e=i:!e&&i?e=new it("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new it("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Oi(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Oi(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Di={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ji(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Oi(t)||(t=Ni(t));const e=Ai(t,Di);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,i,n)=>e.value.evaluate(t,i,{},n),needGeometry:Ri(t)}}function Li(t,e){return t<e?-1:t>e?1:0}function Ri(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(Ri(t[e]))return!0;return!1}function Ni(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Bi(t[1],t[2],"=="):"!="===e?Vi(Bi(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Bi(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Ni))):"all"===e?["all"].concat(t.slice(1).map(Ni)):"none"===e?["all"].concat(t.slice(1).map(Ni).map(Vi)):"in"===e?Ui(t[1],t.slice(2)):"!in"===e?Vi(Ui(t[1],t.slice(2))):"has"===e?qi(t[1]):"!has"===e?Vi(qi(t[1])):"within"!==e||t;var i}function Bi(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Ui(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Li)]]:["filter-in-small",t,["literal",e]]}}function qi(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Vi(t){return["!",t]}function Gi(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const i of t)e+=`${Gi(i)},`;return`${e}]`}const i=Object.keys(t).sort();let n="{";for(let e=0;e<i.length;e++)n+=`${JSON.stringify(i[e])}:${Gi(t[i[e]])},`;return`${n}}`}function Zi(t){let e="";for(const i of q)e+=`/${Gi(t[i])}`;return e}function Wi(t){const e=t.value;return e?[new tt(t.key,e,"constants have been deprecated as of v8")]:[]}function Ji(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Xi(t){if(Array.isArray(t))return t.map(Xi);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Xi(t[i]);return e}return Ji(t)}function Hi(t){const e=t.key,i=t.value,n=t.valueSpec||{},o=t.objectElementValidators||{},s=t.style,r=t.styleSpec,a=t.validateSpec;let l=[];const h=vi(i);if("object"!==h)return[new tt(e,i,`object expected, ${h} found`)];for(const t in i){const h=t.split(".")[0],c=n[h]||n["*"];let u;if(o[h])u=o[h];else if(n[h])u=a;else if(o["*"])u=o["*"];else{if(!n["*"]){l.push(new tt(e,i[t],`unknown property "${t}"`));continue}u=a}l=l.concat(u({key:(e?`${e}.`:e)+t,value:i[t],valueSpec:c,style:s,styleSpec:r,object:i,objectKey:t,validateSpec:a},i))}for(const t in n)o[t]||n[t].required&&void 0===n[t].default&&void 0===i[t]&&l.push(new tt(e,i,`missing required property "${t}"`));return l}function Ki(t){const e=t.value,i=t.valueSpec,n=t.style,o=t.styleSpec,s=t.key,r=t.arrayElementValidator||t.validateSpec;if("array"!==vi(e))return[new tt(s,e,`array expected, ${vi(e)} found`)];if(i.length&&e.length!==i.length)return[new tt(s,e,`array length ${i.length} expected, length ${e.length} found`)];if(i["min-length"]&&e.length<i["min-length"])return[new tt(s,e,`array length at least ${i["min-length"]} expected, length ${e.length} found`)];let a={type:i.value,values:i.values};o.$version<7&&(a.function=i.function),"object"===vi(i.value)&&(a=i.value);let l=[];for(let i=0;i<e.length;i++)l=l.concat(r({array:e,arrayIndex:i,value:e[i],valueSpec:a,validateSpec:t.validateSpec,style:n,styleSpec:o,key:`${s}[${i}]`}));return l}function Yi(t){const e=t.key,i=t.value,n=t.valueSpec;let o=vi(i);return"number"===o&&i!=i&&(o="NaN"),"number"!==o?[new tt(e,i,`number expected, ${o} found`)]:"minimum"in n&&i<n.minimum?[new tt(e,i,`${i} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&i>n.maximum?[new tt(e,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]}function Qi(t){const e=t.valueSpec,i=Ji(t.value.type);let n,o,s,r={};const a="categorical"!==i&&void 0===t.value.property,l=!a,h="array"===vi(t.value.stops)&&"array"===vi(t.value.stops[0])&&"object"===vi(t.value.stops[0][0]),c=Hi({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new tt(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Ki({key:t.key,value:n,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:u})),"array"===vi(n)&&0===n.length&&e.push(new tt(t.key,n,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&a&&c.push(new tt(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||c.push(new tt(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!bi(t.valueSpec)&&c.push(new tt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!mi(t.valueSpec)?c.push(new tt(t.key,t.value,"property functions not supported")):a&&!gi(t.valueSpec)&&c.push(new tt(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!h||void 0!==t.value.property||c.push(new tt(t.key,t.value,'"property" property is required')),c;function u(t){let i=[];const n=t.value,a=t.key;if("array"!==vi(n))return[new tt(a,n,`array expected, ${vi(n)} found`)];if(2!==n.length)return[new tt(a,n,`array length 2 expected, length ${n.length} found`)];if(h){if("object"!==vi(n[0]))return[new tt(a,n,`object expected, ${vi(n[0])} found`)];if(void 0===n[0].zoom)return[new tt(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new tt(a,n,"object stop key must have value")];if(s&&s>Ji(n[0].zoom))return[new tt(a,n[0].zoom,"stop zoom values must appear in ascending order")];Ji(n[0].zoom)!==s&&(s=Ji(n[0].zoom),o=void 0,r={}),i=i.concat(Hi({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Yi,value:d}}))}else i=i.concat(d({key:`${a}[0]`,value:n[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},n));return Ei(Xi(n[1]))?i.concat([new tt(`${a}[1]`,n[1],"expressions are not allowed in function stops.")]):i.concat(t.validateSpec({key:`${a}[1]`,value:n[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function d(t,s){const a=vi(t.value),l=Ji(t.value),h=null!==t.value?t.value:s;if(n){if(a!==n)return[new tt(t.key,h,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new tt(t.key,h,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let n=`number expected, ${a} found`;return mi(e)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new tt(t.key,h,n)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==o&&l<o?[new tt(t.key,h,"stop domain values must appear in ascending order")]:(o=l,"categorical"===i&&l in r?[new tt(t.key,h,"stop domain values must be unique")]:(r[l]=!0,[])):[new tt(t.key,h,`integer expected, found ${l}`)]}}function tn(t){const e=("property"===t.expressionContext?Pi:Ai)(Xi(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new tt(`${t.key}${e.key}`,t.value,e.message)));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new tt(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Pe(i))return[new tt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Pe(i))return[new tt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!$e(i,["zoom","feature-state"]))return[new tt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Te(i))return[new tt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function en(t){const e=t.key,i=t.value,n=t.valueSpec,o=[];return Array.isArray(n.values)?-1===n.values.indexOf(Ji(i))&&o.push(new tt(e,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(Ji(i))&&o.push(new tt(e,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),o}function nn(t){return Oi(Xi(t.value))?tn(et({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):on(t)}function on(t){const e=t.value,i=t.key;if("array"!==vi(e))return[new tt(i,e,`array expected, ${vi(e)} found`)];const n=t.styleSpec;let o,s=[];if(e.length<1)return[new tt(i,e,"filter array must have at least 1 element")];switch(s=s.concat(en({key:`${i}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Ji(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Ji(e[1])&&s.push(new tt(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new tt(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(o=vi(e[1]),"string"!==o&&s.push(new tt(`${i}[1]`,e[1],`string expected, ${o} found`)));for(let r=2;r<e.length;r++)o=vi(e[r]),"$type"===Ji(e[1])?s=s.concat(en({key:`${i}[${r}]`,value:e[r],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==o&&"number"!==o&&"boolean"!==o&&s.push(new tt(`${i}[${r}]`,e[r],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)s=s.concat(on({key:`${i}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":o=vi(e[1]),2!==e.length?s.push(new tt(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==o&&s.push(new tt(`${i}[1]`,e[1],`string expected, ${o} found`));break;case"within":o=vi(e[1]),2!==e.length?s.push(new tt(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==o&&s.push(new tt(`${i}[1]`,e[1],`object expected, ${o} found`))}return s}function sn(t,e){const i=t.key,n=t.validateSpec,o=t.style,s=t.styleSpec,r=t.value,a=t.objectKey,l=s[`${e}_${t.layerType}`];if(!l)return[];const h=a.match(/^(.*)-transition$/);if("paint"===e&&h&&l[h[1]]&&l[h[1]].transition)return n({key:i,value:r,valueSpec:s.transition,style:o,styleSpec:s});const c=t.valueSpec||l[a];if(!c)return[new tt(i,r,`unknown property "${a}"`)];let u;if("string"===vi(r)&&mi(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(r)))return[new tt(i,r,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];const d=[];return"symbol"===t.layerType&&("text-field"===a&&o&&!o.glyphs&&d.push(new tt(i,r,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&wi(Xi(r))&&"identity"===Ji(r.type)&&d.push(new tt(i,r,'"text-font" does not support identity functions'))),d.concat(n({key:t.key,value:r,valueSpec:c,style:o,styleSpec:s,expressionContext:"property",propertyType:e,propertyKey:a}))}function rn(t){return sn(t,"paint")}function an(t){return sn(t,"layout")}function ln(t){let e=[];const i=t.value,n=t.key,o=t.style,s=t.styleSpec;i.type||i.ref||e.push(new tt(n,i,'either "type" or "ref" is required'));let r=Ji(i.type);const a=Ji(i.ref);if(i.id){const s=Ji(i.id);for(let r=0;r<t.arrayIndex;r++){const t=o.layers[r];Ji(t.id)===s&&e.push(new tt(n,i.id,`duplicate layer id "${i.id}", previously used at line ${t.id.__line__}`))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in i&&e.push(new tt(n,i[t],`"${t}" is prohibited for ref layers`))})),o.layers.forEach((e=>{Ji(e.id)===a&&(t=e)})),t?t.ref?e.push(new tt(n,i.ref,"ref cannot reference another ref layer")):r=Ji(t.type):e.push(new tt(n,i.ref,`ref layer "${a}" not found`))}else if("background"!==r)if(i.source){const t=o.sources&&o.sources[i.source],s=t&&Ji(t.type);t?"vector"===s&&"raster"===r?e.push(new tt(n,i.source,`layer "${i.id}" requires a raster source`)):"raster"===s&&"raster"!==r?e.push(new tt(n,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==s||i["source-layer"]?"raster-dem"===s&&"hillshade"!==r?e.push(new tt(n,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==r||!i.paint||!i.paint["line-gradient"]||"geojson"===s&&t.lineMetrics||e.push(new tt(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new tt(n,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new tt(n,i.source,`source "${i.source}" not found`))}else e.push(new tt(n,i,'missing required property "source"'));return e=e.concat(Hi({key:n,value:i,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${n}.type`,value:i.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:nn,layout:t=>Hi({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>an(et({layerType:r},t))}}),paint:t=>Hi({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>rn(et({layerType:r},t))}})}})),e}function hn(t){const e=t.value,i=t.key,n=vi(e);return"string"!==n?[new tt(i,e,`string expected, ${n} found`)]:[]}const cn={promoteId:function({key:t,value:e}){if("string"===vi(e))return hn({key:t,value:e});{const i=[];for(const n in e)i.push(...hn({key:`${t}.${n}`,value:e[n]}));return i}}};function un(t){const e=t.value,i=t.key,n=t.styleSpec,o=t.style,s=t.validateSpec;if(!e.type)return[new tt(i,e,'"type" is required')];const r=Ji(e.type);let a;switch(r){case"vector":case"raster":case"raster-dem":return a=Hi({key:i,value:e,valueSpec:n[`source_${r.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:cn,validateSpec:s}),a;case"geojson":if(a=Hi({key:i,value:e,valueSpec:n.source_geojson,style:o,styleSpec:n,validateSpec:s,objectElementValidators:cn}),e.cluster)for(const t in e.clusterProperties){const[n,o]=e.clusterProperties[t],r="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...tn({key:`${i}.${t}.map`,value:o,validateSpec:s,expressionContext:"cluster-map"})),a.push(...tn({key:`${i}.${t}.reduce`,value:r,validateSpec:s,expressionContext:"cluster-reduce"}))}return a;case"video":return Hi({key:i,value:e,valueSpec:n.source_video,style:o,validateSpec:s,styleSpec:n});case"image":return Hi({key:i,value:e,valueSpec:n.source_image,style:o,validateSpec:s,styleSpec:n});case"canvas":return[new tt(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return en({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:o,validateSpec:s,styleSpec:n})}}function dn(t){const e=t.value,i=t.styleSpec,n=i.light,o=t.style;let s=[];const r=vi(e);if(void 0===e)return s;if("object"!==r)return s=s.concat([new tt("light",e,`object expected, ${r} found`)]),s;for(const r in e){const a=r.match(/^(.*)-transition$/);s=s.concat(a&&n[a[1]]&&n[a[1]].transition?t.validateSpec({key:r,value:e[r],valueSpec:i.transition,validateSpec:t.validateSpec,style:o,styleSpec:i}):n[r]?t.validateSpec({key:r,value:e[r],valueSpec:n[r],validateSpec:t.validateSpec,style:o,styleSpec:i}):[new tt(r,e[r],`unknown property "${r}"`)])}return s}function fn(t){const e=t.value,i=t.styleSpec,n=i.terrain,o=t.style;let s=[];const r=vi(e);if(void 0===e)return s;if("object"!==r)return s=s.concat([new tt("terrain",e,`object expected, ${r} found`)]),s;for(const r in e)s=s.concat(n[r]?t.validateSpec({key:r,value:e[r],valueSpec:n[r],validateSpec:t.validateSpec,style:o,styleSpec:i}):[new tt(r,e[r],`unknown property "${r}"`)]);return s}function pn(t){let e=[];const i=t.value,n=t.key;if(Array.isArray(i)){const o=[],s=[];for(const r in i)i[r].id&&o.includes(i[r].id)&&e.push(new tt(n,i,`all the sprites' ids must be unique, but ${i[r].id} is duplicated`)),o.push(i[r].id),i[r].url&&s.includes(i[r].url)&&e.push(new tt(n,i,`all the sprites' URLs must be unique, but ${i[r].url} is duplicated`)),s.push(i[r].url),e=e.concat(Hi({key:`${n}[${r}]`,value:i[r],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return hn({key:n,value:i})}const mn={"*":()=>[],array:Ki,boolean:function(t){const e=t.value,i=t.key,n=vi(e);return"boolean"!==n?[new tt(i,e,`boolean expected, ${n} found`)]:[]},number:Yi,color:function(t){const e=t.key,i=t.value,n=vi(i);return"string"!==n?[new tt(e,i,`color expected, ${n} found`)]:qt.parse(String(i))?[]:[new tt(e,i,`color expected, "${i}" found`)]},constants:Wi,enum:en,filter:nn,function:Qi,layer:ln,object:Hi,source:un,light:dn,terrain:fn,string:hn,formatted:function(t){return 0===hn(t).length?[]:tn(t)},resolvedImage:function(t){return 0===hn(t).length?[]:tn(t)},padding:function(t){const e=t.key,i=t.value;if("array"===vi(i)){if(i.length<1||i.length>4)return[new tt(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const n={type:"number"};let o=[];for(let s=0;s<i.length;s++)o=o.concat(t.validateSpec({key:`${e}[${s}]`,value:i[s],validateSpec:t.validateSpec,valueSpec:n}));return o}return Yi({key:e,value:i,valueSpec:{}})},variableAnchorOffsetCollection:function(t){const e=t.key,i=t.value,n=vi(i),o=t.styleSpec;if("array"!==n||i.length<1||i.length%2!=0)return[new tt(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let n=0;n<i.length;n+=2)s=s.concat(en({key:`${e}[${n}]`,value:i[n],valueSpec:o.layout_symbol["text-anchor"]})),s=s.concat(Ki({key:`${e}[${n+1}]`,value:i[n+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:o}));return s},sprite:pn};function gn(t){const e=t.value,i=t.valueSpec,n=t.styleSpec;return t.validateSpec=gn,i.expression&&wi(Ji(e))?Qi(t):i.expression&&Ei(Xi(e))?tn(t):i.type&&mn[i.type]?mn[i.type](t):Hi(et({},t,{valueSpec:i.type?n[i.type]:i}))}function bn(t){const e=t.value,i=t.key,n=hn(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new tt(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new tt(i,e,'"glyphs" url must include a "{range}" token'))),n}function vn(t,e=U){let i=[];return i=i.concat(gn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:gn,objectElementValidators:{glyphs:bn,"*":()=>[]}})),t.constants&&(i=i.concat(Wi({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:gn}))),yn(i)}function wn(t){return function(e){return t({...e,validateSpec:gn})}}function yn(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function xn(t){return function(...e){return yn(t.apply(this,e))}}vn.source=xn(wn(un)),vn.sprite=xn(wn(pn)),vn.glyphs=xn(wn(bn)),vn.light=xn(wn(dn)),vn.terrain=xn(wn(fn)),vn.layer=xn(wn(ln)),vn.filter=xn(wn(nn)),vn.paintProperty=xn(wn(rn)),vn.layoutProperty=xn(wn(an));const _n=vn,kn=_n.light,Mn=_n.paintProperty,zn=_n.layoutProperty;function Sn(t,e){let i=!1;if(e&&e.length)for(const n of e)t.fire(new N(new Error(n.message))),i=!0;return i}class Cn{constructor(t,e,i){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const o=new Int32Array(this.arrayBuffer);t=o[0],this.d=(e=o[1])+2*(i=o[2]);for(let t=0;t<this.d*this.d;t++){const e=o[3+t],i=o[3+t+1];n.push(e===i?null:o.subarray(e,i))}const s=o[3+n.length+1];this.keys=o.subarray(o[3+n.length],s),this.bboxes=o.subarray(s),this.insert=this._insertReadonly}else{this.d=e+2*i;for(let t=0;t<this.d*this.d;t++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;const o=i/e*t;this.min=-o,this.max=t+o}insert(t,e,i,n,o){this._forEachCell(e,i,n,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,i,n,o,s){this.cells[o].push(s)}query(t,e,i,n,o){const s=this.min,r=this.max;if(t<=s&&e<=s&&r<=i&&r<=n&&!o)return Array.prototype.slice.call(this.keys);{const s=[];return this._forEachCell(t,e,i,n,this._queryCell,s,{},o),s}}_queryCell(t,e,i,n,o,s,r,a){const l=this.cells[o];if(null!==l){const o=this.keys,h=this.bboxes;for(let c=0;c<l.length;c++){const u=l[c];if(void 0===r[u]){const l=4*u;(a?a(h[l+0],h[l+1],h[l+2],h[l+3]):t<=h[l+2]&&e<=h[l+3]&&i>=h[l+0]&&n>=h[l+1])?(r[u]=!0,s.push(o[u])):r[u]=!1}}}}_forEachCell(t,e,i,n,o,s,r,a){const l=this._convertToCellCoord(t),h=this._convertToCellCoord(e),c=this._convertToCellCoord(i),u=this._convertToCellCoord(n);for(let d=l;d<=c;d++)for(let l=h;l<=u;l++){const h=this.d*l+d;if((!a||a(this._convertFromCellCoord(d),this._convertFromCellCoord(l),this._convertFromCellCoord(d+1),this._convertFromCellCoord(l+1)))&&o.call(this,t,e,i,n,h,s,r,a))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let i=0;for(let t=0;t<this.cells.length;t++)i+=this.cells[t].length;const n=new Int32Array(e+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let o=e;for(let e=0;e<t.length;e++){const i=t[e];n[3+e]=o,n.set(i,o),o+=i.length}return n[3+t.length]=o,n.set(this.keys,o),o+=this.keys.length,n[3+t.length+1]=o,n.set(this.bboxes,o),o+=this.bboxes.length,n.buffer}static serialize(t,e){const i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}}static deserialize(t){return new Cn(t.buffer)}}const En={};function An(t,e,i={}){if(En[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),En[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}An("Object",Object),An("TransferableGridIndex",Cn),An("Color",qt),An("Error",Error),An("AJAXError",I),An("ResolvedImage",Ht),An("StylePropertyFunction",$i),An("StyleExpression",Ci,{omit:["_evaluator"]}),An("ZoomDependentExpression",Ti),An("ZoomConstantExpression",Ii),An("CompoundExpression",Ae,{omit:["_evaluate"]});for(const t in li)li[t]._classRegistryKey||An(`Expression_${t}`,li[t]);function In(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function Tn(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob)return t;if(In(t))return e&&e.push(t),t;if(M(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const i=t;return e&&e.push(i.buffer),i}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const i=[];for(const n of t)i.push(Tn(n,e));return i}if("object"==typeof t){const i=t.constructor,n=i._classRegistryKey;if(!n)throw new Error("can't serialize object of unregistered class");if(!En[n])throw new Error(`${n} is not registered.`);const o=i.serialize?i.serialize(t,e):{};if(i.serialize){if(e&&o===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const i in t){if(!t.hasOwnProperty(i))continue;if(En[n].omit.indexOf(i)>=0)continue;const s=t[i];o[i]=En[n].shallow.indexOf(i)>=0?s:Tn(s,e)}t instanceof Error&&(o.message=t.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(o.$name=n),o}throw new Error("can't serialize object of type "+typeof t)}function Pn(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||In(t)||M(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(Pn);if("object"==typeof t){const e=t.$name||"Object";if(!En[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=En[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const n=Object.create(i.prototype);for(const i of Object.keys(t)){if("$name"===i)continue;const o=t[i];n[i]=En[e].shallow.indexOf(i)>=0?o:Pn(o)}return n}throw new Error("can't deserialize object of type "+typeof t)}class $n{constructor(){this.first=!0}update(t,e){const i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}}const Fn={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function On(t){for(const e of t)if(Ln(e.charCodeAt(0)))return!0;return!1}function Dn(t){for(const e of t)if(!jn(e.charCodeAt(0)))return!1;return!0}function jn(t){return!(Fn.Arabic(t)||Fn["Arabic Supplement"](t)||Fn["Arabic Extended-A"](t)||Fn["Arabic Presentation Forms-A"](t)||Fn["Arabic Presentation Forms-B"](t))}function Ln(t){return!(746!==t&&747!==t&&(t<4352||!(Fn["Bopomofo Extended"](t)||Fn.Bopomofo(t)||Fn["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Fn["CJK Compatibility Ideographs"](t)||Fn["CJK Compatibility"](t)||Fn["CJK Radicals Supplement"](t)||Fn["CJK Strokes"](t)||!(!Fn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Fn["CJK Unified Ideographs Extension A"](t)||Fn["CJK Unified Ideographs"](t)||Fn["Enclosed CJK Letters and Months"](t)||Fn["Hangul Compatibility Jamo"](t)||Fn["Hangul Jamo Extended-A"](t)||Fn["Hangul Jamo Extended-B"](t)||Fn["Hangul Jamo"](t)||Fn["Hangul Syllables"](t)||Fn.Hiragana(t)||Fn["Ideographic Description Characters"](t)||Fn.Kanbun(t)||Fn["Kangxi Radicals"](t)||Fn["Katakana Phonetic Extensions"](t)||Fn.Katakana(t)&&12540!==t||!(!Fn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Fn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Fn["Unified Canadian Aboriginal Syllabics"](t)||Fn["Unified Canadian Aboriginal Syllabics Extended"](t)||Fn["Vertical Forms"](t)||Fn["Yijing Hexagram Symbols"](t)||Fn["Yi Syllables"](t)||Fn["Yi Radicals"](t))))}function Rn(t){return!(Ln(t)||function(t){return!!(Fn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Fn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Fn["Letterlike Symbols"](t)||Fn["Number Forms"](t)||Fn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Fn["Control Pictures"](t)&&9251!==t||Fn["Optical Character Recognition"](t)||Fn["Enclosed Alphanumerics"](t)||Fn["Geometric Shapes"](t)||Fn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Fn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Fn["CJK Symbols and Punctuation"](t)||Fn.Katakana(t)||Fn["Private Use Area"](t)||Fn["CJK Compatibility Forms"](t)||Fn["Small Form Variants"](t)||Fn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Nn(t){return t>=1424&&t<=2303||Fn["Arabic Presentation Forms-A"](t)||Fn["Arabic Presentation Forms-B"](t)}function Bn(t,e){return!(!e&&Nn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Fn.Khmer(t))}function Un(t){for(const e of t)if(Nn(e.charCodeAt(0)))return!0;return!1}const qn="deferred",Vn="loading",Gn="loaded";let Zn=null,Wn="unavailable",Jn=null;const Xn=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(Wn="error"),Zn&&Zn(t)};function Hn(){Kn.fire(new R("pluginStateChange",{pluginStatus:Wn,pluginURL:Jn}))}const Kn=new B,Yn=function(){return Wn},Qn=function(){if(Wn!==qn||!Jn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Wn=Vn,Hn(),Jn&&O({url:Jn},(t=>{t?Xn(t):(Wn=Gn,Hn())}))},to={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Wn===Gn||null!=to.applyArabicShaping,isLoading:()=>Wn===Vn,setState(t){if(!x())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Wn=t.pluginStatus,Jn=t.pluginURL},isParsed(){if(!x())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=to.applyArabicShaping&&null!=to.processBidirectionalText&&null!=to.processStyledBidirectionalText},getPluginURL(){if(!x())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Jn}};class eo{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new $n,this.transition={})}isSupportedScript(t){return function(t,e){for(const i of t)if(!Bn(i.charCodeAt(0),e))return!1;return!0}(t,to.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}}}class io{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(wi(t))return new $i(t,e);if(Ei(t)){const i=Pi(t,e);if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return i.value}{let i=t;return"color"===e.type&&"string"==typeof t?i=qt.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)&&(i=Xt.parse(t)):i=Wt.parse(t),{kind:"constant",evaluate:()=>i}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class no{constructor(t){this.property=t,this.value=new io(t,void 0)}transitioned(t,e){return new so(this.property,this.value,e,d({},t.transition,this.transition),t.now)}untransitioned(){return new so(this.property,this.value,null,{},0)}}class oo{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return g(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new no(this._values[t].property)),this._values[t].value=new io(this._values[t].property,null===e?void 0:g(e))}getTransition(t){return g(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new no(this._values[t].property)),this._values[t].transition=g(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n)}return t}transitioned(t,e){const i=new ro(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(t,e._values[n]);return i}untransitioned(){const t=new ro(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class so{constructor(t,e,i,n,o){this.property=t,this.value=e,this.begin=o+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){const n=t.now||0,o=this.value.possiblyEvaluate(t,e,i),s=this.prior;if(s){if(n>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(n<this.begin)return s.possiblyEvaluate(t,e,i);{const r=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,i),o,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}(r))}}return o}}class ro{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const n=new ho(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(t,e,i);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class ao{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return void 0!==this._values[t].value}getValue(t){return g(this._values[t].value)}setValue(t,e){this._values[t]=new io(this._values[t].property,null===e?void 0:g(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){const n=new ho(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(t,e,i);return n}}class lo{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,i,n){return this.property.evaluate(this.value,this.parameters,t,e,i,n)}}class ho{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class co{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,i){const n=Le[this.specification.type];return n?n(t,e,i):t}}class uo{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,n){return new lo(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,n)}:t.expression,e)}interpolate(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new lo(this,{kind:"constant",value:void 0},t.parameters);const n=Le[this.specification.type];if(n){const o=n(t.value.value,e.value.value,i);return new lo(this,{kind:"constant",value:o},t.parameters)}return t}evaluate(t,e,i,n,o,s){return"constant"===t.kind?t.value:t.evaluate(e,i,n,o,s)}}class fo extends uo{possiblyEvaluate(t,e,i,n){if(void 0===t.value)return new lo(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const o=t.expression.evaluate(e,null,{},i,n),s="resolvedImage"===t.property.specification.type&&"string"!=typeof o?o.name:o,r=this._calculate(s,s,s,e);return new lo(this,{kind:"constant",value:r},e)}if("camera"===t.expression.kind){const i=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new lo(this,{kind:"constant",value:i},e)}return new lo(this,t.expression,e)}evaluate(t,e,i,n,o,s){if("source"===t.kind){const r=t.evaluate(e,i,n,o,s);return this._calculate(r,r,r,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,n),t.evaluate({zoom:Math.floor(e.zoom)},i,n),t.evaluate({zoom:Math.floor(e.zoom)+1},i,n),e):t.value}_calculate(t,e,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class po{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,n){if(void 0!==t.value){if("constant"===t.expression.kind){const o=t.expression.evaluate(e,null,{},i,n);return this._calculate(o,o,o,e)}return this._calculate(t.expression.evaluate(new eo(Math.floor(e.zoom-1),e)),t.expression.evaluate(new eo(Math.floor(e.zoom),e)),t.expression.evaluate(new eo(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class mo{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,n){return!!t.expression.evaluate(e,null,{},i,n)}interpolate(){return!1}}class go{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const i=t[e];i.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new io(i,void 0),o=this.defaultTransitionablePropertyValues[e]=new no(i);this.defaultTransitioningPropertyValues[e]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}}}An("DataDrivenProperty",uo),An("DataConstantProperty",co),An("CrossFadedDataDrivenProperty",fo),An("CrossFadedProperty",po),An("ColorRampProperty",mo);const bo="-transition";class vo extends B{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new ao(e.layout)),e.paint)){this._transitionablePaint=new oo(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ho(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,i={}){null!=e&&this._validate(zn,`layers.${this.id}.layout.${t}`,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(bo)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if(null!=e&&this._validate(Mn,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(bo))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const i=this._transitionablePaint._values[t],n="cross-faded-data-driven"===i.property.specification["property-type"],o=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const r=this._transitionablePaint._values[t].value;return r.isDataDriven()||o||n||this._handleOverridablePaintPropertyUpdate(t,s,r)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),m(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,i,n,o={}){return(!o||!1!==o.validate)&&Sn(this,t.call(_n,{key:e,layerType:this.type,objectKey:i,value:n,styleSpec:U,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof lo&&mi(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const wo={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class yo{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class xo{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function _o(t,e=1){let i=0,n=0;return{members:t.map((t=>{const o=wo[t.type].BYTES_PER_ELEMENT,s=i=ko(i,Math.max(e,o)),r=t.components||1;return n=Math.max(n,o),i+=o*r,{name:t.name,type:t.type,components:r,offset:s}})),size:ko(i,Math.max(n,e)),alignment:e}}function ko(t,e){return Math.ceil(t/e)*e}class Mo extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=i,t}}Mo.prototype.bytesPerElement=4,An("StructArrayLayout2i4",Mo);class zo extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const o=3*t;return this.int16[o+0]=e,this.int16[o+1]=i,this.int16[o+2]=n,t}}zo.prototype.bytesPerElement=6,An("StructArrayLayout3i6",zo);class So extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,n)}emplace(t,e,i,n,o){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=n,this.int16[s+3]=o,t}}So.prototype.bytesPerElement=8,An("StructArrayLayout4i8",So);class Co extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,o,s){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n,o,s)}emplace(t,e,i,n,o,s,r){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=o,this.int16[a+4]=s,this.int16[a+5]=r,t}}Co.prototype.bytesPerElement=12,An("StructArrayLayout2i4i12",Co);class Eo extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,o,s){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n,o,s)}emplace(t,e,i,n,o,s,r){const a=4*t,l=8*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.uint8[l+4]=n,this.uint8[l+5]=o,this.uint8[l+6]=s,this.uint8[l+7]=r,t}}Eo.prototype.bytesPerElement=8,An("StructArrayLayout2i4ub8",Eo);class Ao extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=i,t}}Ao.prototype.bytesPerElement=8,An("StructArrayLayout2f8",Ao);class Io extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,o,s,r,a,l,h){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,n,o,s,r,a,l,h)}emplace(t,e,i,n,o,s,r,a,l,h,c){const u=10*t;return this.uint16[u+0]=e,this.uint16[u+1]=i,this.uint16[u+2]=n,this.uint16[u+3]=o,this.uint16[u+4]=s,this.uint16[u+5]=r,this.uint16[u+6]=a,this.uint16[u+7]=l,this.uint16[u+8]=h,this.uint16[u+9]=c,t}}Io.prototype.bytesPerElement=20,An("StructArrayLayout10ui20",Io);class To extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,o,s,r,a,l,h,c,u){const d=this.length;return this.resize(d+1),this.emplace(d,t,e,i,n,o,s,r,a,l,h,c,u)}emplace(t,e,i,n,o,s,r,a,l,h,c,u,d){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=i,this.int16[f+2]=n,this.int16[f+3]=o,this.uint16[f+4]=s,this.uint16[f+5]=r,this.uint16[f+6]=a,this.uint16[f+7]=l,this.int16[f+8]=h,this.int16[f+9]=c,this.int16[f+10]=u,this.int16[f+11]=d,t}}To.prototype.bytesPerElement=24,An("StructArrayLayout4i4ui4i24",To);class Po extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const o=3*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=n,t}}Po.prototype.bytesPerElement=12,An("StructArrayLayout3f12",Po);class $o extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}$o.prototype.bytesPerElement=4,An("StructArrayLayout1ul4",$o);class Fo extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,o,s,r,a,l){const h=this.length;return this.resize(h+1),this.emplace(h,t,e,i,n,o,s,r,a,l)}emplace(t,e,i,n,o,s,r,a,l,h){const c=10*t,u=5*t;return this.int16[c+0]=e,this.int16[c+1]=i,this.int16[c+2]=n,this.int16[c+3]=o,this.int16[c+4]=s,this.int16[c+5]=r,this.uint32[u+3]=a,this.uint16[c+8]=l,this.uint16[c+9]=h,t}}Fo.prototype.bytesPerElement=20,An("StructArrayLayout6i1ul2ui20",Fo);class Oo extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,o,s){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n,o,s)}emplace(t,e,i,n,o,s,r){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=o,this.int16[a+4]=s,this.int16[a+5]=r,t}}Oo.prototype.bytesPerElement=12,An("StructArrayLayout2i2i2i12",Oo);class Do extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,n,o)}emplace(t,e,i,n,o,s){const r=4*t,a=8*t;return this.float32[r+0]=e,this.float32[r+1]=i,this.float32[r+2]=n,this.int16[a+6]=o,this.int16[a+7]=s,t}}Do.prototype.bytesPerElement=16,An("StructArrayLayout2f1f2i16",Do);class jo extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,n)}emplace(t,e,i,n,o){const s=12*t,r=3*t;return this.uint8[s+0]=e,this.uint8[s+1]=i,this.float32[r+1]=n,this.float32[r+2]=o,t}}jo.prototype.bytesPerElement=12,An("StructArrayLayout2ub2f12",jo);class Lo extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const o=3*t;return this.uint16[o+0]=e,this.uint16[o+1]=i,this.uint16[o+2]=n,t}}Lo.prototype.bytesPerElement=6,An("StructArrayLayout3ui6",Lo);class Ro extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n,o,s,r,a,l,h,c,u,d,f,p,m,g){const b=this.length;return this.resize(b+1),this.emplace(b,t,e,i,n,o,s,r,a,l,h,c,u,d,f,p,m,g)}emplace(t,e,i,n,o,s,r,a,l,h,c,u,d,f,p,m,g,b){const v=24*t,w=12*t,y=48*t;return this.int16[v+0]=e,this.int16[v+1]=i,this.uint16[v+2]=n,this.uint16[v+3]=o,this.uint32[w+2]=s,this.uint32[w+3]=r,this.uint32[w+4]=a,this.uint16[v+10]=l,this.uint16[v+11]=h,this.uint16[v+12]=c,this.float32[w+7]=u,this.float32[w+8]=d,this.uint8[y+36]=f,this.uint8[y+37]=p,this.uint8[y+38]=m,this.uint32[w+10]=g,this.int16[v+22]=b,t}}Ro.prototype.bytesPerElement=48,An("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ro);class No extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n,o,s,r,a,l,h,c,u,d,f,p,m,g,b,v,w,y,x,_,k,M,z,S,C){const E=this.length;return this.resize(E+1),this.emplace(E,t,e,i,n,o,s,r,a,l,h,c,u,d,f,p,m,g,b,v,w,y,x,_,k,M,z,S,C)}emplace(t,e,i,n,o,s,r,a,l,h,c,u,d,f,p,m,g,b,v,w,y,x,_,k,M,z,S,C,E){const A=32*t,I=16*t;return this.int16[A+0]=e,this.int16[A+1]=i,this.int16[A+2]=n,this.int16[A+3]=o,this.int16[A+4]=s,this.int16[A+5]=r,this.int16[A+6]=a,this.int16[A+7]=l,this.uint16[A+8]=h,this.uint16[A+9]=c,this.uint16[A+10]=u,this.uint16[A+11]=d,this.uint16[A+12]=f,this.uint16[A+13]=p,this.uint16[A+14]=m,this.uint16[A+15]=g,this.uint16[A+16]=b,this.uint16[A+17]=v,this.uint16[A+18]=w,this.uint16[A+19]=y,this.uint16[A+20]=x,this.uint16[A+21]=_,this.uint16[A+22]=k,this.uint32[I+12]=M,this.float32[I+13]=z,this.float32[I+14]=S,this.uint16[A+30]=C,this.uint16[A+31]=E,t}}No.prototype.bytesPerElement=64,An("StructArrayLayout8i15ui1ul2f2ui64",No);class Bo extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Bo.prototype.bytesPerElement=4,An("StructArrayLayout1f4",Bo);class Uo extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const o=3*t;return this.uint16[6*t+0]=e,this.float32[o+1]=i,this.float32[o+2]=n,t}}Uo.prototype.bytesPerElement=12,An("StructArrayLayout1ui2f12",Uo);class qo extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const o=4*t;return this.uint32[2*t+0]=e,this.uint16[o+2]=i,this.uint16[o+3]=n,t}}qo.prototype.bytesPerElement=8,An("StructArrayLayout1ul2ui8",qo);class Vo extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,t}}Vo.prototype.bytesPerElement=4,An("StructArrayLayout2ui4",Vo);class Go extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Go.prototype.bytesPerElement=2,An("StructArrayLayout1ui2",Go);class Zo extends xo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,n)}emplace(t,e,i,n,o){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=i,this.float32[s+2]=n,this.float32[s+3]=o,t}}Zo.prototype.bytesPerElement=16,An("StructArrayLayout4f16",Zo);class Wo extends yo{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 o(this.anchorPointX,this.anchorPointY)}}Wo.prototype.size=20;class Jo extends Fo{get(t){return new Wo(this,t)}}An("CollisionBoxArray",Jo);class Xo extends yo{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Xo.prototype.size=48;class Ho extends Ro{get(t){return new Xo(this,t)}}An("PlacedSymbolArray",Ho);class Ko extends yo{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Ko.prototype.size=64;class Yo extends No{get(t){return new Ko(this,t)}}An("SymbolInstanceArray",Yo);class Qo extends Bo{getoffsetX(t){return this.float32[1*t+0]}}An("GlyphOffsetArray",Qo);class ts extends zo{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}An("SymbolLineVertexArray",ts);class es extends yo{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}es.prototype.size=12;class is extends Uo{get(t){return new es(this,t)}}An("TextAnchorOffsetArray",is);class ns extends yo{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]}}ns.prototype.size=8;class os extends qo{get(t){return new ns(this,t)}}An("FeatureIndexArray",os);class ss extends Mo{}class rs extends Mo{}class as extends Mo{}class ls extends Co{}class hs extends Eo{}class cs extends Ao{}class us extends Io{}class ds extends To{}class fs extends Po{}class ps extends $o{}class ms extends Oo{}class gs extends jo{}class bs extends Lo{}class vs extends Vo{}const ws=_o([{name:"a_pos",components:2,type:"Int16"}],4),{members:ys}=ws;class xs{constructor(t=[]){this.segments=t}prepareSegment(t,e,i,n){let o=this.segments[this.segments.length-1];return t>xs.MAX_VERTEX_ARRAY_LENGTH&&v(`Max vertices per segment is ${xs.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!o||o.vertexLength+t>xs.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==n)&&(o={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==n&&(o.sortKey=n),this.segments.push(o)),o}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,n){return new xs([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}}function _s(t,e){return 256*(t=c(Math.floor(t),0,255))+c(Math.floor(e),0,255)}xs.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,An("SegmentVector",xs);const ks=_o([{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 Ms={exports:{}},zs={exports:{}};zs.exports=function(t,e){var i,n,o,s,r,a,l,h;for(n=t.length-(i=3&t.length),o=e,r=3432918353,a=461845907,h=0;h<n;)l=255&t.charCodeAt(h)|(255&t.charCodeAt(++h))<<8|(255&t.charCodeAt(++h))<<16|(255&t.charCodeAt(++h))<<24,++h,o=27492+(65535&(s=5*(65535&(o=(o^=l=(65535&(l=(l=(65535&l)*r+(((l>>>16)*r&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&t.charCodeAt(h+2))<<16;case 2:l^=(255&t.charCodeAt(h+1))<<8;case 1:o^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(h)))*r+(((l>>>16)*r&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return o^=t.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0};var Ss=zs.exports,Cs={exports:{}};Cs.exports=function(t,e){for(var i,n=t.length,o=e^n,s=0;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(i>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:o^=(255&t.charCodeAt(s+2))<<16;case 2:o^=(255&t.charCodeAt(s+1))<<8;case 1:o=1540483477*(65535&(o^=255&t.charCodeAt(s)))+((1540483477*(o>>>16)&65535)<<16)}return o=1540483477*(65535&(o^=o>>>13))+((1540483477*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0};var Es=Ss,As=Cs.exports;Ms.exports=Es,Ms.exports.murmur3=Es,Ms.exports.murmur2=As;var Is=e(Ms.exports);class Ts{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,n){this.ids.push(Ps(t)),this.positions.push(e,i,n)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=Ps(t);let i=0,n=this.ids.length-1;for(;i<n;){const t=i+n>>1;this.ids[t]>=e?n=t:i=t+1}const o=[];for(;this.ids[i]===e;)o.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return o}static serialize(t,e){const i=new Float64Array(t.ids),n=new Uint32Array(t.positions);return $s(i,n,0,i.length-1),e&&e.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(t){const e=new Ts;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Ps(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Is(String(t))}function $s(t,e,i,n){for(;i<n;){const o=t[i+n>>1];let s=i-1,r=n+1;for(;;){do{s++}while(t[s]<o);do{r--}while(t[r]>o);if(s>=r)break;Fs(t,s,r),Fs(e,3*s,3*r),Fs(e,3*s+1,3*r+1),Fs(e,3*s+2,3*r+2)}r-i<n-r?($s(t,e,i,r),i=r+1):($s(t,e,r+1,n),n=r)}}function Fs(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}An("FeaturePositionMap",Ts);class Os{constructor(t,e){this.gl=t.gl,this.location=e}}class Ds extends Os{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class js extends Os{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class Ls extends Os{constructor(t,e){super(t,e),this.current=qt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const Rs=new Float32Array(16);function Ns(t){return[_s(255*t.r,255*t.g),_s(255*t.b,255*t.a)]}class Bs{constructor(t,e,i){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return"color"===this.type?new Ls(t,e):new Ds(t,e)}}class Us{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,i,n){const o="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;o&&t.set(o)}getBinding(t,e,i){return"u_pattern"===i.substr(0,9)?new js(t,e):new Ds(t,e)}}class qs{constructor(t,e,i,n){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new n}populatePaintArray(t,e,i,n,o){const s=this.paintVertexArray.length,r=this.expression.evaluate(new eo(0),e,{},n,[],o);this.paintVertexArray.resize(t),this._setPaintValue(s,t,r)}updatePaintArray(t,e,i,n){const o=this.expression.evaluate({zoom:0},i,n);this._setPaintValue(t,e,o)}_setPaintValue(t,e,i){if("color"===this.type){const n=Ns(i);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,n[0],n[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Vs{constructor(t,e,i,n,o,s){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=i,this.useIntegerZoom=n,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new s}populatePaintArray(t,e,i,n,o){const s=this.expression.evaluate(new eo(this.zoom),e,{},n,[],o),r=this.expression.evaluate(new eo(this.zoom+1),e,{},n,[],o),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,s,r)}updatePaintArray(t,e,i,n){const o=this.expression.evaluate({zoom:this.zoom},i,n),s=this.expression.evaluate({zoom:this.zoom+1},i,n);this._setPaintValue(t,e,o,s)}_setPaintValue(t,e,i,n){if("color"===this.type){const o=Ns(i),s=Ns(n);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,o[0],o[1],s[0],s[1])}else{for(let o=t;o<e;o++)this.paintVertexArray.emplace(o,i,n);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,n=c(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(n)}getBinding(t,e,i){return new Ds(t,e)}}class Gs{constructor(t,e,i,n,o,s){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=n,this.layerId=s,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(t,e,i){const n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],i)}updatePaintArray(t,e,i,n,o){this._setPaintValues(t,e,i.patterns&&i.patterns[this.layerId],o)}_setPaintValues(t,e,i,n){if(!n||!i)return;const{min:o,mid:s,max:r}=i,a=n[o],l=n[s],h=n[r];if(a&&l&&h)for(let i=t;i<e;i++)this.zoomInPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],a.tl[0],a.tl[1],a.br[0],a.br[1],l.pixelRatio,a.pixelRatio),this.zoomOutPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],h.tl[0],h.tl[1],h.br[0],h.br[1],l.pixelRatio,h.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,ks.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,ks.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Zs{constructor(t,e,i){this.binders={},this._buffers=[];const n=[];for(const o in t.paint._values){if(!i(o))continue;const s=t.paint.get(o);if(!(s instanceof lo&&mi(s.property.specification)))continue;const r=Js(o,t.type),a=s.value,l=s.property.specification.type,h=s.property.useIntegerZoom,c=s.property.specification["property-type"],u="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===a.kind)this.binders[o]=u?new Us(a.value,r):new Bs(a.value,r,l),n.push(`/u_${o}`);else if("source"===a.kind||u){const i=Xs(o,l,"source");this.binders[o]=u?new Gs(a,l,h,e,i,t.id):new qs(a,r,l,i),n.push(`/a_${o}`)}else{const t=Xs(o,l,"composite");this.binders[o]=new Vs(a,r,l,h,e,t),n.push(`/z_${o}`)}}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof qs||e instanceof Vs?e.maxValue:0}populatePaintArrays(t,e,i,n,o){for(const s in this.binders){const r=this.binders[s];(r instanceof qs||r instanceof Vs||r instanceof Gs)&&r.populatePaintArray(t,e,i,n,o)}}setConstantPatternPositions(t,e){for(const i in this.binders){const n=this.binders[i];n instanceof Us&&n.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,i,n,o){let s=!1;for(const r in t){const a=e.getPositions(r);for(const e of a){const a=i.feature(e.index);for(const i in this.binders){const l=this.binders[i];if((l instanceof qs||l instanceof Vs||l instanceof Gs)&&!0===l.expression.isStateDependent){const h=n.paint.get(i);l.expression=h.value,l.updatePaintArray(e.start,e.end,a,t[r],o),s=!0}}}}return s}defines(){const t=[];for(const e in this.binders){const i=this.binders[e];(i instanceof Bs||i instanceof Us)&&t.push(...i.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof qs||i instanceof Vs)for(let e=0;e<i.paintVertexAttributes.length;e++)t.push(i.paintVertexAttributes[e].name);else if(i instanceof Gs)for(let e=0;e<ks.members.length;e++)t.push(ks.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof Bs||i instanceof Us||i instanceof Vs)for(const e of i.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const i=[];for(const n in this.binders){const o=this.binders[n];if(o instanceof Bs||o instanceof Us||o instanceof Vs)for(const s of o.uniformNames)if(e[s]){const r=o.getBinding(t,e[s],s);i.push({name:s,property:n,binding:r})}}return i}setUniforms(t,e,i,n){for(const{name:t,property:o,binding:s}of e)this.binders[o].setUniform(s,n,i.get(o),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const i=this.binders[e];if(t&&i instanceof Gs){const e=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(i instanceof qs||i instanceof Vs)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(const e in this.binders){const i=this.binders[e];(i instanceof qs||i instanceof Vs||i instanceof Gs)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof qs||e instanceof Vs||e instanceof Gs)&&e.destroy()}}}class Ws{constructor(t,e,i=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new Zs(n,e,i);this.needsUpload=!1,this._featureMap=new Ts,this._bufferOffset=0}populatePaintArrays(t,e,i,n,o,s){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,e,n,o,s);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,n){for(const o of i)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(t,this._featureMap,e,o,n)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Js(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function Xs(t,e,i){const n={color:{source:Ao,composite:Zo},number:{source:Bo,composite:Ao}},o=function(t){return{"line-pattern":{source:us,composite:us},"fill-pattern":{source:us,composite:us},"fill-extrusion-pattern":{source:us,composite:us}}[t]}(t);return o&&o[i]||n[e][i]}An("ConstantBinder",Bs),An("CrossFadedConstantBinder",Us),An("SourceExpressionBinder",qs),An("CrossFadedCompositeBinder",Gs),An("CompositeExpressionBinder",Vs),An("ProgramConfiguration",Zs,{omit:["_buffers"]}),An("ProgramConfigurationSet",Ws);const Hs=8192,Ks=Math.pow(2,14)-1,Ys=-Ks-1;function Qs(t){const e=Hs/t.extent,i=t.loadGeometry();for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.length;t++){const i=n[t],o=Math.round(i.x*e),s=Math.round(i.y*e);i.x=c(o,Ys,Ks),i.y=c(s,Ys,Ks),(o<i.x||o>i.x+1||s<i.y||s>i.y+1)&&v("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function tr(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Qs(t):[]}}function er(t,e,i,n,o){t.emplaceBack(2*e+(n+1)/2,2*i+(o+1)/2)}class ir{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new rs,this.indexArray=new bs,this.segments=new xs,this.programConfigurations=new Ws(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){const n=this.layers[0],o=[];let s=null,r=!1;"circle"===n.type&&(s=n.layout.get("circle-sort-key"),r=!s.isConstant());for(const{feature:e,id:n,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,h=tr(e,t);if(!this.layers[0]._featureFilter.filter(new eo(this.zoom),h,i))continue;const c=r?s.evaluate(h,{},i):void 0,u={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?h.geometry:Qs(e),patterns:{},sortKey:c};o.push(u)}r&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of o){const{geometry:o,index:s,sourceLayerIndex:r}=n,a=t[s].feature;this.addFeature(n,o,s,i),e.featureIndex.insert(a,o,s,r,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ys),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,n){for(const i of e)for(const e of i){const i=e.x,n=e.y;if(i<0||i>=Hs||n<0||n>=Hs)continue;const o=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),s=o.vertexLength;er(this.layoutVertexArray,i,n,-1,-1),er(this.layoutVertexArray,i,n,1,-1),er(this.layoutVertexArray,i,n,1,1),er(this.layoutVertexArray,i,n,-1,1),this.indexArray.emplaceBack(s,s+1,s+2),this.indexArray.emplaceBack(s,s+3,s+2),o.vertexLength+=4,o.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},n)}}function nr(t,e){for(let i=0;i<t.length;i++)if(dr(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(dr(t,e[i]))return!0;return!!ar(t,e)}function or(t,e,i){return!!dr(t,e)||!!hr(e,t,i)}function sr(t,e){if(1===t.length)return ur(e,t[0]);for(let i=0;i<e.length;i++){const n=e[i];for(let e=0;e<n.length;e++)if(dr(t,n[e]))return!0}for(let i=0;i<t.length;i++)if(ur(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(ar(t,e[i]))return!0;return!1}function rr(t,e,i){if(t.length>1){if(ar(t,e))return!0;for(let n=0;n<e.length;n++)if(hr(e[n],t,i))return!0}for(let n=0;n<t.length;n++)if(hr(t[n],e,i))return!0;return!1}function ar(t,e){if(0===t.length||0===e.length)return!1;for(let i=0;i<t.length-1;i++){const n=t[i],o=t[i+1];for(let t=0;t<e.length-1;t++)if(lr(n,o,e[t],e[t+1]))return!0}return!1}function lr(t,e,i,n){return w(t,i,n)!==w(e,i,n)&&w(t,e,i)!==w(t,e,n)}function hr(t,e,i){const n=i*i;if(1===e.length)return t.distSqr(e[0])<n;for(let i=1;i<e.length;i++)if(cr(t,e[i-1],e[i])<n)return!0;return!1}function cr(t,e,i){const n=e.distSqr(i);if(0===n)return t.distSqr(e);const o=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/n;return t.distSqr(o<0?e:o>1?i:i.sub(e)._mult(o)._add(e))}function ur(t,e){let i,n,o,s=!1;for(let r=0;r<t.length;r++){i=t[r];for(let t=0,r=i.length-1;t<i.length;r=t++)n=i[t],o=i[r],n.y>e.y!=o.y>e.y&&e.x<(o.x-n.x)*(e.y-n.y)/(o.y-n.y)+n.x&&(s=!s)}return s}function dr(t,e){let i=!1;for(let n=0,o=t.length-1;n<t.length;o=n++){const s=t[n],r=t[o];s.y>e.y!=r.y>e.y&&e.x<(r.x-s.x)*(e.y-s.y)/(r.y-s.y)+s.x&&(i=!i)}return i}function fr(t,e,i){const n=i[0],o=i[2];if(t.x<n.x&&e.x<n.x||t.x>o.x&&e.x>o.x||t.y<n.y&&e.y<n.y||t.y>o.y&&e.y>o.y)return!1;const s=w(t,e,i[0]);return s!==w(t,e,i[1])||s!==w(t,e,i[2])||s!==w(t,e,i[3])}function pr(t,e,i){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:i.programConfigurations.get(e.id).getMaxValue(t)}function mr(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function gr(t,e,i,n,s){if(!e[0]&&!e[1])return t;const r=o.convert(e)._mult(s);"viewport"===i&&r._rotate(-n);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(r));return a}let br,vr;An("CircleBucket",ir,{omit:["layers"]});var wr={get paint(){return vr=vr||new go({"circle-radius":new uo(U.paint_circle["circle-radius"]),"circle-color":new uo(U.paint_circle["circle-color"]),"circle-blur":new uo(U.paint_circle["circle-blur"]),"circle-opacity":new uo(U.paint_circle["circle-opacity"]),"circle-translate":new co(U.paint_circle["circle-translate"]),"circle-translate-anchor":new co(U.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new co(U.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new co(U.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new uo(U.paint_circle["circle-stroke-width"]),"circle-stroke-color":new uo(U.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new uo(U.paint_circle["circle-stroke-opacity"])})},get layout(){return br=br||new go({"circle-sort-key":new uo(U.layout_circle["circle-sort-key"])})}},yr=1e-6,xr="undefined"!=typeof Float32Array?Float32Array:Array;function _r(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function kr(t,e,i){var n=e[0],o=e[1],s=e[2],r=e[3],a=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],f=e[10],p=e[11],m=e[12],g=e[13],b=e[14],v=e[15],w=i[0],y=i[1],x=i[2],_=i[3];return t[0]=w*n+y*a+x*u+_*m,t[1]=w*o+y*l+x*d+_*g,t[2]=w*s+y*h+x*f+_*b,t[3]=w*r+y*c+x*p+_*v,t[4]=(w=i[4])*n+(y=i[5])*a+(x=i[6])*u+(_=i[7])*m,t[5]=w*o+y*l+x*d+_*g,t[6]=w*s+y*h+x*f+_*b,t[7]=w*r+y*c+x*p+_*v,t[8]=(w=i[8])*n+(y=i[9])*a+(x=i[10])*u+(_=i[11])*m,t[9]=w*o+y*l+x*d+_*g,t[10]=w*s+y*h+x*f+_*b,t[11]=w*r+y*c+x*p+_*v,t[12]=(w=i[12])*n+(y=i[13])*a+(x=i[14])*u+(_=i[15])*m,t[13]=w*o+y*l+x*d+_*g,t[14]=w*s+y*h+x*f+_*b,t[15]=w*r+y*c+x*p+_*v,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Mr,zr=kr;function Sr(t,e,i){var n=e[0],o=e[1],s=e[2],r=e[3];return t[0]=i[0]*n+i[4]*o+i[8]*s+i[12]*r,t[1]=i[1]*n+i[5]*o+i[9]*s+i[13]*r,t[2]=i[2]*n+i[6]*o+i[10]*s+i[14]*r,t[3]=i[3]*n+i[7]*o+i[11]*s+i[15]*r,t}Mr=new xr(4),xr!=Float32Array&&(Mr[0]=0,Mr[1]=0,Mr[2]=0,Mr[3]=0);class Cr extends vo{constructor(t){super(t,wr)}createBucket(t){return new ir(t)}queryRadius(t){const e=t;return pr("circle-radius",this,e)+pr("circle-stroke-width",this,e)+mr(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,i,n,o,s,r,a){const l=gr(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,r),h=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),c="map"===this.paint.get("circle-pitch-alignment"),u=c?l:function(t,e){return t.map((t=>Er(t,e)))}(l,a),d=c?h*r:h;for(const t of n)for(const e of t){const t=c?e:Er(e,a);let i=d;const n=Sr([],[e.x,e.y,0,1],a);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=n[3]/s.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=s.cameraToCenterDistance/n[3]),or(u,t,i))return!0}return!1}}function Er(t,e){const i=Sr([],[t.x,t.y,0,1],e);return new o(i[0]/i[3],i[1]/i[3])}class Ar extends ir{}let Ir;An("HeatmapBucket",Ar,{omit:["layers"]});var Tr={get paint(){return Ir=Ir||new go({"heatmap-radius":new uo(U.paint_heatmap["heatmap-radius"]),"heatmap-weight":new uo(U.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new co(U.paint_heatmap["heatmap-intensity"]),"heatmap-color":new mo(U.paint_heatmap["heatmap-color"]),"heatmap-opacity":new co(U.paint_heatmap["heatmap-opacity"])})}};function Pr(t,{width:e,height:i},n,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*i*n)throw new RangeError(`mismatched image size. expected: ${o.length} but got: ${e*i*n}`)}else o=new Uint8Array(e*i*n);return t.width=e,t.height=i,t.data=o,t}function $r(t,{width:e,height:i},n){if(e===t.width&&i===t.height)return;const o=Pr({},{width:e,height:i},n);Fr(t,o,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},n),t.width=e,t.height=i,t.data=o.data}function Fr(t,e,i,n,o,s){if(0===o.width||0===o.height)return e;if(o.width>t.width||o.height>t.height||i.x>t.width-o.width||i.y>t.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||n.x>e.width-o.width||n.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const r=t.data,a=e.data;if(r===a)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<o.height;l++){const h=((i.y+l)*t.width+i.x)*s,c=((n.y+l)*e.width+n.x)*s;for(let t=0;t<o.width*s;t++)a[c+t]=r[h+t]}return e}class Or{constructor(t,e){Pr(this,t,1,e)}resize(t){$r(this,t,1)}clone(){return new Or({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,n,o){Fr(t,e,i,n,o,1)}}class Dr{constructor(t,e){Pr(this,t,4,e)}resize(t){$r(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Dr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,n,o){Fr(t,e,i,n,o,4)}}function jr(t){const e={},i=t.resolution||256,n=t.clips?t.clips.length:1,o=t.image||new Dr({width:i,height:n});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const s=(i,n,s)=>{e[t.evaluationKey]=s;const r=t.expression.evaluate(e);o.data[i+n+0]=Math.floor(255*r.r/r.a),o.data[i+n+1]=Math.floor(255*r.g/r.a),o.data[i+n+2]=Math.floor(255*r.b/r.a),o.data[i+n+3]=Math.floor(255*r.a)};if(t.clips)for(let e=0,o=0;e<n;++e,o+=4*i)for(let n=0,r=0;n<i;n++,r+=4){const a=n/(i-1),{start:l,end:h}=t.clips[e];s(o,r,l*(1-a)+h*a)}else for(let t=0,e=0;t<i;t++,e+=4)s(0,e,t/(i-1));return o}An("AlphaImage",Or),An("RGBAImage",Dr);class Lr extends vo{createBucket(t){return new Ar(t)}constructor(t){super(t,Tr),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=jr({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}let Rr;var Nr={get paint(){return Rr=Rr||new go({"hillshade-illumination-direction":new co(U.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new co(U.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new co(U.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new co(U.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new co(U.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new co(U.paint_hillshade["hillshade-accent-color"])})}};class Br extends vo{constructor(t){super(t,Nr)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}const Ur=_o([{name:"a_pos",components:2,type:"Int16"}],4),{members:qr}=Ur;var Vr={exports:{}};function Gr(t,e,i){i=i||2;var n,o,s,r,a,l,h,c=e&&e.length,u=c?e[0]*i:t.length,d=Zr(t,0,u,i,!0),f=[];if(!d||d.next===d.prev)return f;if(c&&(d=function(t,e,i,n){var o,s,r,a=[];for(o=0,s=e.length;o<s;o++)(r=Zr(t,e[o]*n,o<s-1?e[o+1]*n:t.length,n,!1))===r.next&&(r.steiner=!0),a.push(na(r));for(a.sort(Qr),o=0;o<a.length;o++)i=ta(a[o],i);return i}(t,e,d,i)),t.length>80*i){n=s=t[0],o=r=t[1];for(var p=i;p<u;p+=i)(a=t[p])<n&&(n=a),(l=t[p+1])<o&&(o=l),a>s&&(s=a),l>r&&(r=l);h=0!==(h=Math.max(s-n,r-o))?32767/h:0}return Jr(d,f,i,n,o,h,0),f}function Zr(t,e,i,n,o){var s,r;if(o===ga(t,e,i,n)>0)for(s=e;s<i;s+=n)r=fa(s,t[s],t[s+1],r);else for(s=i-n;s>=e;s-=n)r=fa(s,t[s],t[s+1],r);return r&&aa(r,r.next)&&(pa(r),r=r.next),r}function Wr(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!aa(n,n.next)&&0!==ra(n.prev,n,n.next))n=n.next;else{if(pa(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function Jr(t,e,i,n,o,s,r){if(t){!r&&s&&function(t,e,i,n){var o=t;do{0===o.z&&(o.z=ia(o.x,o.y,e,i,n)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==t);o.prevZ.nextZ=null,o.prevZ=null,function(t){var e,i,n,o,s,r,a,l,h=1;do{for(i=t,t=null,s=null,r=0;i;){for(r++,n=i,a=0,e=0;e<h&&(a++,n=n.nextZ);e++);for(l=h;a>0||l>0&&n;)0!==a&&(0===l||!n||i.z<=n.z)?(o=i,i=i.nextZ,a--):(o=n,n=n.nextZ,l--),s?s.nextZ=o:t=o,o.prevZ=s,s=o;i=n}s.nextZ=null,h*=2}while(r>1)}(o)}(t,n,o,s);for(var a,l,h=t;t.prev!==t.next;)if(a=t.prev,l=t.next,s?Hr(t,n,o,s):Xr(t))e.push(a.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),pa(t),t=l.next,h=l.next;else if((t=l)===h){r?1===r?Jr(t=Kr(Wr(t),e,i),e,i,n,o,s,2):2===r&&Yr(t,e,i,n,o,s):Jr(Wr(t),e,i,n,o,s,1);break}}}function Xr(t){var e=t.prev,i=t,n=t.next;if(ra(e,i,n)>=0)return!1;for(var o=e.x,s=i.x,r=n.x,a=e.y,l=i.y,h=n.y,c=o<s?o<r?o:r:s<r?s:r,u=a<l?a<h?a:h:l<h?l:h,d=o>s?o>r?o:r:s>r?s:r,f=a>l?a>h?a:h:l>h?l:h,p=n.next;p!==e;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&oa(o,a,s,l,r,h,p.x,p.y)&&ra(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Hr(t,e,i,n){var o=t.prev,s=t,r=t.next;if(ra(o,s,r)>=0)return!1;for(var a=o.x,l=s.x,h=r.x,c=o.y,u=s.y,d=r.y,f=a<l?a<h?a:h:l<h?l:h,p=c<u?c<d?c:d:u<d?u:d,m=a>l?a>h?a:h:l>h?l:h,g=c>u?c>d?c:d:u>d?u:d,b=ia(f,p,e,i,n),v=ia(m,g,e,i,n),w=t.prevZ,y=t.nextZ;w&&w.z>=b&&y&&y.z<=v;){if(w.x>=f&&w.x<=m&&w.y>=p&&w.y<=g&&w!==o&&w!==r&&oa(a,c,l,u,h,d,w.x,w.y)&&ra(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==o&&y!==r&&oa(a,c,l,u,h,d,y.x,y.y)&&ra(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;w&&w.z>=b;){if(w.x>=f&&w.x<=m&&w.y>=p&&w.y<=g&&w!==o&&w!==r&&oa(a,c,l,u,h,d,w.x,w.y)&&ra(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;y&&y.z<=v;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==o&&y!==r&&oa(a,c,l,u,h,d,y.x,y.y)&&ra(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Kr(t,e,i){var n=t;do{var o=n.prev,s=n.next.next;!aa(o,s)&&la(o,n,n.next,s)&&ua(o,s)&&ua(s,o)&&(e.push(o.i/i|0),e.push(n.i/i|0),e.push(s.i/i|0),pa(n),pa(n.next),n=t=s),n=n.next}while(n!==t);return Wr(n)}function Yr(t,e,i,n,o,s){var r=t;do{for(var a=r.next.next;a!==r.prev;){if(r.i!==a.i&&sa(r,a)){var l=da(r,a);return r=Wr(r,r.next),l=Wr(l,l.next),Jr(r,e,i,n,o,s,0),void Jr(l,e,i,n,o,s,0)}a=a.next}r=r.next}while(r!==t)}function Qr(t,e){return t.x-e.x}function ta(t,e){var i=function(t,e){var i,n=e,o=t.x,s=t.y,r=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var a=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=o&&a>r&&(r=a,i=n.x<n.next.x?n:n.next,a===o))return i}n=n.next}while(n!==e);if(!i)return null;var l,h=i,c=i.x,u=i.y,d=1/0;n=i;do{o>=n.x&&n.x>=c&&o!==n.x&&oa(s<u?o:r,s,c,u,s<u?r:o,s,n.x,n.y)&&(l=Math.abs(s-n.y)/(o-n.x),ua(n,t)&&(l<d||l===d&&(n.x>i.x||n.x===i.x&&ea(i,n)))&&(i=n,d=l)),n=n.next}while(n!==h);return i}(t,e);if(!i)return e;var n=da(i,t);return Wr(n,n.next),Wr(i,i.next)}function ea(t,e){return ra(t.prev,t,e.prev)<0&&ra(e.next,t,t.next)<0}function ia(t,e,i,n,o){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function na(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function oa(t,e,i,n,o,s,r,a){return(o-r)*(e-a)>=(t-r)*(s-a)&&(t-r)*(n-a)>=(i-r)*(e-a)&&(i-r)*(s-a)>=(o-r)*(n-a)}function sa(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&la(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(ua(t,e)&&ua(e,t)&&function(t,e){var i=t,n=!1,o=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&o<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(ra(t.prev,t,e.prev)||ra(t,e.prev,e))||aa(t,e)&&ra(t.prev,t,t.next)>0&&ra(e.prev,e,e.next)>0)}function ra(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function aa(t,e){return t.x===e.x&&t.y===e.y}function la(t,e,i,n){var o=ca(ra(t,e,i)),s=ca(ra(t,e,n)),r=ca(ra(i,n,t)),a=ca(ra(i,n,e));return o!==s&&r!==a||!(0!==o||!ha(t,i,e))||!(0!==s||!ha(t,n,e))||!(0!==r||!ha(i,t,n))||!(0!==a||!ha(i,e,n))}function ha(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function ca(t){return t>0?1:t<0?-1:0}function ua(t,e){return ra(t.prev,t,t.next)<0?ra(t,e,t.next)>=0&&ra(t,t.prev,e)>=0:ra(t,e,t.prev)<0||ra(t,t.next,e)<0}function da(t,e){var i=new ma(t.i,t.x,t.y),n=new ma(e.i,e.x,e.y),o=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=o,o.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function fa(t,e,i,n){var o=new ma(t,e,i);return n?(o.next=n.next,o.prev=n,n.next.prev=o,n.next=o):(o.prev=o,o.next=o),o}function pa(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ma(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ga(t,e,i,n){for(var o=0,s=e,r=i-n;s<i;s+=n)o+=(t[r]-t[s])*(t[s+1]+t[r+1]),r=s;return o}Vr.exports=Gr,Vr.exports.default=Gr,Gr.deviation=function(t,e,i,n){var o=e&&e.length,s=Math.abs(ga(t,0,o?e[0]*i:t.length,i));if(o)for(var r=0,a=e.length;r<a;r++)s-=Math.abs(ga(t,e[r]*i,r<a-1?e[r+1]*i:t.length,i));var l=0;for(r=0;r<n.length;r+=3){var h=n[r]*i,c=n[r+1]*i,u=n[r+2]*i;l+=Math.abs((t[h]-t[u])*(t[c+1]-t[h+1])-(t[h]-t[c])*(t[u+1]-t[h+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},Gr.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},n=0,o=0;o<t.length;o++){for(var s=0;s<t[o].length;s++)for(var r=0;r<e;r++)i.vertices.push(t[o][s][r]);o>0&&i.holes.push(n+=t[o-1].length)}return i};var ba=e(Vr.exports);function va(t,e,i,n,o){wa(t,e,i||0,n||t.length-1,o||xa)}function wa(t,e,i,n,o){for(;n>i;){if(n-i>600){var s=n-i+1,r=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(r-s/2<0?-1:1);wa(t,e,Math.max(i,Math.floor(e-r*l/s+h)),Math.min(n,Math.floor(e+(s-r)*l/s+h)),o)}var c=t[e],u=i,d=n;for(ya(t,i,e),o(t[n],c)>0&&ya(t,i,n);u<d;){for(ya(t,u,d),u++,d--;o(t[u],c)<0;)u++;for(;o(t[d],c)>0;)d--}0===o(t[i],c)?ya(t,i,d):ya(t,++d,n),d<=e&&(i=d+1),e<=d&&(n=d-1)}}function ya(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function xa(t,e){return t<e?-1:t>e?1:0}function _a(t,e){const i=t.length;if(i<=1)return[t];const n=[];let o,s;for(let e=0;e<i;e++){const i=y(t[e]);0!==i&&(t[e].area=Math.abs(i),void 0===s&&(s=i<0),s===i<0?(o&&n.push(o),o=[t[e]]):o.push(t[e]))}if(o&&n.push(o),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(va(n[t],e,1,n[t].length-1,ka),n[t]=n[t].slice(0,e));return n}function ka(t,e){return e.area-t.area}function Ma(t,e,i){const n=i.patternDependencies;let o=!1;for(const i of e){const e=i.paint.get(`${t}-pattern`);e.isConstant()||(o=!0);const s=e.constantOr(null);s&&(o=!0,n[s.to]=!0,n[s.from]=!0)}return o}function za(t,e,i,n,o){const s=o.patternDependencies;for(const r of e){const e=r.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},i,{},o.availableImages),a=e.evaluate({zoom:n},i,{},o.availableImages),l=e.evaluate({zoom:n+1},i,{},o.availableImages);t=t&&t.name?t.name:t,a=a&&a.name?a.name:a,l=l&&l.name?l.name:l,s[t]=!0,s[a]=!0,s[l]=!0,i.patterns[r.id]={min:t,mid:a,max:l}}}return i}class Sa{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new as,this.indexArray=new bs,this.indexArray2=new vs,this.programConfigurations=new Ws(t.layers,t.zoom),this.segments=new xs,this.segments2=new xs,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=Ma("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),o=!n.isConstant(),s=[];for(const{feature:r,id:a,index:l,sourceLayerIndex:h}of t){const t=this.layers[0]._featureFilter.needGeometry,c=tr(r,t);if(!this.layers[0]._featureFilter.filter(new eo(this.zoom),c,i))continue;const u=o?n.evaluate(c,{},i,e.availableImages):void 0,d={id:a,properties:r.properties,type:r.type,sourceLayerIndex:h,index:l,geometry:t?c.geometry:Qs(r),patterns:{},sortKey:u};s.push(d)}o&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:o,index:s,sourceLayerIndex:r}=n;if(this.hasPattern){const t=za("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,o,s,i,{});e.featureIndex.insert(t[s].feature,o,s,r,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,qr),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,i,n,o){for(const t of _a(e,500)){let e=0;for(const i of t)e+=i.length;const i=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=i.vertexLength,o=[],s=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&s.push(o.length/2);const i=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=i.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),o.push(e[0].x),o.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),o.push(e[t].x),o.push(e[t].y);i.vertexLength+=e.length,i.primitiveLength+=e.length}const r=ba(o,s);for(let t=0;t<r.length;t+=3)this.indexArray.emplaceBack(n+r[t],n+r[t+1],n+r[t+2]);i.vertexLength+=e,i.primitiveLength+=r.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,o,n)}}let Ca,Ea;An("FillBucket",Sa,{omit:["layers","patternFeatures"]});var Aa={get paint(){return Ea=Ea||new go({"fill-antialias":new co(U.paint_fill["fill-antialias"]),"fill-opacity":new uo(U.paint_fill["fill-opacity"]),"fill-color":new uo(U.paint_fill["fill-color"]),"fill-outline-color":new uo(U.paint_fill["fill-outline-color"]),"fill-translate":new co(U.paint_fill["fill-translate"]),"fill-translate-anchor":new co(U.paint_fill["fill-translate-anchor"]),"fill-pattern":new fo(U.paint_fill["fill-pattern"])})},get layout(){return Ca=Ca||new go({"fill-sort-key":new uo(U.layout_fill["fill-sort-key"])})}};class Ia extends vo{constructor(t){super(t,Aa)}recalculate(t,e){super.recalculate(t,e);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Sa(t)}queryRadius(){return mr(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,i,n,o,s,r){return sr(gr(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,r),n)}isTileClipped(){return!0}}const Ta=_o([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Pa=_o([{name:"a_centroid",components:2,type:"Int16"}],4),{members:$a}=Ta;var Fa={},Oa=i,Da=ja;function ja(t,e,i,n,o){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=o,t.readFields(La,this,e)}function La(t,e,i){1==t?e.id=i.readVarint():2==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos<i;){var n=e._keys[t.readVarint()],o=e._values[t.readVarint()];e.properties[n]=o}}(i,e):3==t?e.type=i.readVarint():4==t&&(e._geometry=i.pos)}function Ra(t){for(var e,i,n=0,o=0,s=t.length,r=s-1;o<s;r=o++)n+=((i=t[r]).x-(e=t[o]).x)*(e.y+i.y);return n}ja.types=["Unknown","Point","LineString","Polygon"],ja.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,n=1,o=0,s=0,r=0,a=[];t.pos<i;){if(o<=0){var l=t.readVarint();n=7&l,o=l>>3}if(o--,1===n||2===n)s+=t.readSVarint(),r+=t.readSVarint(),1===n&&(e&&a.push(e),e=[]),e.push(new Oa(s,r));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&a.push(e),a},ja.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,n=0,o=0,s=0,r=1/0,a=-1/0,l=1/0,h=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();i=7&c,n=c>>3}if(n--,1===i||2===i)(o+=t.readSVarint())<r&&(r=o),o>a&&(a=o),(s+=t.readSVarint())<l&&(l=s),s>h&&(h=s);else if(7!==i)throw new Error("unknown command "+i)}return[r,l,a,h]},ja.prototype.toGeoJSON=function(t,e,i){var n,o,s=this.extent*Math.pow(2,i),r=this.extent*t,a=this.extent*e,l=this.loadGeometry(),h=ja.types[this.type];function c(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+r)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+a)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var u=[];for(n=0;n<l.length;n++)u[n]=l[n][0];c(l=u);break;case 2:for(n=0;n<l.length;n++)c(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var i,n,o=[],s=0;s<e;s++){var r=Ra(t[s]);0!==r&&(void 0===n&&(n=r<0),n===r<0?(i&&o.push(i),i=[t[s]]):i.push(t[s]))}return i&&o.push(i),o}(l),n=0;n<l.length;n++)for(o=0;o<l[n].length;o++)c(l[n][o])}1===l.length?l=l[0]:h="Multi"+h;var d={type:"Feature",geometry:{type:h,coordinates:l},properties:this.properties};return"id"in this&&(d.id=this.id),d};var Na=Da,Ba=Ua;function Ua(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(qa,this,e),this.length=this._features.length}function qa(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():5===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):3===t?e._keys.push(i.readString()):4===t&&e._values.push(function(t){for(var e=null,i=t.readVarint()+t.pos;t.pos<i;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(i))}Ua.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Na(this._pbf,e,this.extent,this._keys,this._values)};var Va=Ba;function Ga(t,e,i){if(3===t){var n=new Va(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}Fa.VectorTile=function(t,e){this.layers=t.readFields(Ga,{},e)},Fa.VectorTileFeature=Da,Fa.VectorTileLayer=Ba;const Za=Fa.VectorTileFeature.types,Wa=Math.pow(2,13);function Ja(t,e,i,n,o,s,r,a){t.emplaceBack(e,i,2*Math.floor(n*Wa)+r,o*Wa*2,s*Wa*2,Math.round(a))}class Xa{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ls,this.centroidVertexArray=new ss,this.indexArray=new bs,this.programConfigurations=new Ws(t.layers,t.zoom),this.segments=new xs,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.features=[],this.hasPattern=Ma("fill-extrusion",this.layers,e);for(const{feature:n,id:o,index:s,sourceLayerIndex:r}of t){const t=this.layers[0]._featureFilter.needGeometry,a=tr(n,t);if(!this.layers[0]._featureFilter.filter(new eo(this.zoom),a,i))continue;const l={id:o,sourceLayerIndex:r,index:s,geometry:t?a.geometry:Qs(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(za("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,s,i,{}),e.featureIndex.insert(n,l.geometry,s,r,this.index,!0)}}addFeatures(t,e,i){for(const t of this.features){const{geometry:n}=t;this.addFeature(t,n,t.index,e,i)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$a),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Pa.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,i,n,o){const s={x:0,y:0,vertexCount:0};for(const i of _a(e,500)){let e=0;for(const t of i)e+=t.length;let n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of i){if(0===t.length)continue;if(Ka(t))continue;let e=0;for(let i=0;i<t.length;i++){const o=t[i];if(i>=1){const r=t[i-1];if(!Ha(o,r)){n.vertexLength+4>xs.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=o.sub(r)._perp()._unit(),i=r.dist(o);e+i>32768&&(e=0),Ja(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,0,e),Ja(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,1,e),s.x+=2*o.x,s.y+=2*o.y,s.vertexCount+=2,e+=i,Ja(this.layoutVertexArray,r.x,r.y,t.x,t.y,0,0,e),Ja(this.layoutVertexArray,r.x,r.y,t.x,t.y,0,1,e),s.x+=2*r.x,s.y+=2*r.y,s.vertexCount+=2;const a=n.vertexLength;this.indexArray.emplaceBack(a,a+2,a+1),this.indexArray.emplaceBack(a+1,a+2,a+3),n.vertexLength+=4,n.primitiveLength+=2}}}}if(n.vertexLength+e>xs.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==Za[t.type])continue;const o=[],r=[],a=n.vertexLength;for(const t of i)if(0!==t.length){t!==i[0]&&r.push(o.length/2);for(let e=0;e<t.length;e++){const i=t[e];Ja(this.layoutVertexArray,i.x,i.y,0,0,1,1,0),s.x+=i.x,s.y+=i.y,s.vertexCount+=1,o.push(i.x),o.push(i.y)}}const l=ba(o,r);for(let t=0;t<l.length;t+=3)this.indexArray.emplaceBack(a+l[t],a+l[t+2],a+l[t+1]);n.primitiveLength+=l.length/3,n.vertexLength+=e}for(let t=0;t<s.vertexCount;t++)this.centroidVertexArray.emplaceBack(Math.floor(s.x/s.vertexCount),Math.floor(s.y/s.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,o,n)}}function Ha(t,e){return t.x===e.x&&(t.x<0||t.x>Hs)||t.y===e.y&&(t.y<0||t.y>Hs)}function Ka(t){return t.every((t=>t.x<0))||t.every((t=>t.x>Hs))||t.every((t=>t.y<0))||t.every((t=>t.y>Hs))}let Ya;An("FillExtrusionBucket",Xa,{omit:["layers","features"]});var Qa={get paint(){return Ya=Ya||new go({"fill-extrusion-opacity":new co(U["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new uo(U["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new co(U["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new co(U["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new fo(U["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new uo(U["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new uo(U["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new co(U["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class tl extends vo{constructor(t){super(t,Qa)}createBucket(t){return new Xa(t)}queryRadius(){return mr(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,i,n,s,r,a,l){const h=gr(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),r.angle,a),c=this.paint.get("fill-extrusion-height").evaluate(e,i),u=this.paint.get("fill-extrusion-base").evaluate(e,i),d=function(t,e,i,n){const s=[];for(const i of t){const t=[i.x,i.y,0,1];Sr(t,t,e),s.push(new o(t[0]/t[3],t[1]/t[3]))}return s}(h,l),f=function(t,e,i,n){const s=[],r=[],a=n[8]*e,l=n[9]*e,h=n[10]*e,c=n[11]*e,u=n[8]*i,d=n[9]*i,f=n[10]*i,p=n[11]*i;for(const e of t){const t=[],i=[];for(const s of e){const e=s.x,r=s.y,m=n[0]*e+n[4]*r+n[12],g=n[1]*e+n[5]*r+n[13],b=n[2]*e+n[6]*r+n[14],v=n[3]*e+n[7]*r+n[15],w=b+h,y=v+c,x=m+u,_=g+d,k=b+f,M=v+p,z=new o((m+a)/y,(g+l)/y);z.z=w/y,t.push(z);const S=new o(x/M,_/M);S.z=k/M,i.push(S)}s.push(t),r.push(i)}return[s,r]}(n,u,c,l);return function(t,e,i){let n=1/0;sr(i,e)&&(n=il(i,e[0]));for(let o=0;o<e.length;o++){const s=e[o],r=t[o];for(let t=0;t<s.length-1;t++){const e=s[t],o=[e,s[t+1],r[t+1],r[t],e];nr(i,o)&&(n=Math.min(n,il(i,o)))}}return n!==1/0&&n}(f[0],f[1],d)}}function el(t,e){return t.x*e.x+t.y*e.y}function il(t,e){if(1===t.length){let i=0;const n=e[i++];let o;for(;!o||n.equals(o);)if(o=e[i++],!o)return 1/0;for(;i<e.length;i++){const s=e[i],r=t[0],a=o.sub(n),l=s.sub(n),h=r.sub(n),c=el(a,a),u=el(a,l),d=el(l,l),f=el(h,a),p=el(h,l),m=c*d-u*u,g=(d*f-u*p)/m,b=(c*p-u*f)/m,v=n.z*(1-g-b)+o.z*g+s.z*b;if(isFinite(v))return v}return 1/0}{let t=1/0;for(const i of e)t=Math.min(t,i.z);return t}}const nl=_o([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ol}=nl,sl=_o([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:rl}=sl,al=Fa.VectorTileFeature.types,ll=Math.cos(Math.PI/180*37.5),hl=Math.pow(2,14)/.5;class cl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new hs,this.layoutVertexArray2=new cs,this.indexArray=new bs,this.programConfigurations=new Ws(t.layers,t.zoom),this.segments=new xs,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=Ma("line",this.layers,e);const n=this.layers[0].layout.get("line-sort-key"),o=!n.isConstant(),s=[];for(const{feature:e,id:r,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,h=tr(e,t);if(!this.layers[0]._featureFilter.filter(new eo(this.zoom),h,i))continue;const c=o?n.evaluate(h,{},i):void 0,u={id:r,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?h.geometry:Qs(e),patterns:{},sortKey:c};s.push(u)}o&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:o,index:s,sourceLayerIndex:r}=n;if(this.hasPattern){const t=za("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,o,s,i,{});e.featureIndex.insert(t[s].feature,o,s,r,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,rl)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ol),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,i,n,o){const s=this.layers[0].layout,r=s.get("line-join").evaluate(t,{}),a=s.get("line-cap"),l=s.get("line-miter-limit"),h=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const i of e)this.addLine(i,t,r,a,l,h);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,o,n)}addLine(t,e,i,n,o,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const r="Polygon"===al[e.type];let a=t.length;for(;a>=2&&t[a-1].equals(t[a-2]);)a--;let l=0;for(;l<a-1&&t[l].equals(t[l+1]);)l++;if(a<(r?3:2))return;"bevel"===i&&(o=1.05);const h=this.overscaling<=16?15*Hs/(512*this.overscaling):0,c=this.segments.prepareSegment(10*a,this.layoutVertexArray,this.indexArray);let u,d,f,p,m;this.e1=this.e2=-1,r&&(u=t[a-2],m=t[l].sub(u)._unit()._perp());for(let e=l;e<a;e++){if(f=e===a-1?r?t[l+1]:void 0:t[e+1],f&&t[e].equals(f))continue;m&&(p=m),u&&(d=u),u=t[e],m=f?f.sub(u)._unit()._perp():p,p=p||m;let g=p.add(m);0===g.x&&0===g.y||g._unit();const b=p.x*m.x+p.y*m.y,v=g.x*m.x+g.y*m.y,w=0!==v?1/v:1/0,y=2*Math.sqrt(2-2*v),x=v<ll&&d&&f,_=p.x*m.y-p.y*m.x>0;if(x&&e>l){const t=u.dist(d);if(t>2*h){const e=u.sub(u.sub(d)._mult(h/t)._round());this.updateDistance(d,e),this.addCurrentVertex(e,p,0,0,c),d=e}}const k=d&&f;let M=k?i:r?"butt":n;if(k&&"round"===M&&(w<s?M="miter":w<=2&&(M="fakeround")),"miter"===M&&w>o&&(M="bevel"),"bevel"===M&&(w>2&&(M="flipbevel"),w<o&&(M="miter")),d&&this.updateDistance(d,u),"miter"===M)g._mult(w),this.addCurrentVertex(u,g,0,0,c);else if("flipbevel"===M){if(w>100)g=m.mult(-1);else{const t=w*p.add(m).mag()/p.sub(m).mag();g._perp()._mult(t*(_?-1:1))}this.addCurrentVertex(u,g,0,0,c),this.addCurrentVertex(u,g.mult(-1),0,0,c)}else if("bevel"===M||"fakeround"===M){const t=-Math.sqrt(w*w-1),e=_?t:0,i=_?0:t;if(d&&this.addCurrentVertex(u,p,e,i,c),"fakeround"===M){const t=Math.round(180*y/Math.PI/20);for(let e=1;e<t;e++){let i=e/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+b*(b*(3.55645-1.43519*b)-3.2452))*t*t+(.848013+b*(.215638*b-1.06021)))}const n=m.sub(p)._mult(i)._add(p)._unit()._mult(_?-1:1);this.addHalfVertex(u,n.x,n.y,!1,_,0,c)}}f&&this.addCurrentVertex(u,m,-e,-i,c)}else if("butt"===M)this.addCurrentVertex(u,g,0,0,c);else if("square"===M){const t=d?1:-1;this.addCurrentVertex(u,g,t,t,c)}else"round"===M&&(d&&(this.addCurrentVertex(u,p,0,0,c),this.addCurrentVertex(u,p,1,1,c,!0)),f&&(this.addCurrentVertex(u,m,-1,-1,c,!0),this.addCurrentVertex(u,m,0,0,c)));if(x&&e<a-1){const t=u.dist(f);if(t>2*h){const e=u.add(f.sub(u)._mult(h/t)._round());this.updateDistance(u,e),this.addCurrentVertex(e,m,0,0,c),u=e}}}}addCurrentVertex(t,e,i,n,o,s=!1){const r=e.y*n-e.x,a=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,s,!1,i,o),this.addHalfVertex(t,r,a,s,!0,-n,o),this.distance>hl/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,i,n,o,s))}addHalfVertex({x:t,y:e},i,n,o,s,r,a){const l=.5*(this.lineClips?this.scaledDistance*(hl-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(o?1:0),(e<<1)+(s?1:0),Math.round(63*i)+128,Math.round(63*n)+128,1+(0===r?0:r<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const h=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,h),a.primitiveLength++),s?this.e2=h:this.e1=h}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}let ul,dl;An("LineBucket",cl,{omit:["layers","patternFeatures"]});var fl={get paint(){return dl=dl||new go({"line-opacity":new uo(U.paint_line["line-opacity"]),"line-color":new uo(U.paint_line["line-color"]),"line-translate":new co(U.paint_line["line-translate"]),"line-translate-anchor":new co(U.paint_line["line-translate-anchor"]),"line-width":new uo(U.paint_line["line-width"]),"line-gap-width":new uo(U.paint_line["line-gap-width"]),"line-offset":new uo(U.paint_line["line-offset"]),"line-blur":new uo(U.paint_line["line-blur"]),"line-dasharray":new po(U.paint_line["line-dasharray"]),"line-pattern":new fo(U.paint_line["line-pattern"]),"line-gradient":new mo(U.paint_line["line-gradient"])})},get layout(){return ul=ul||new go({"line-cap":new co(U.layout_line["line-cap"]),"line-join":new uo(U.layout_line["line-join"]),"line-miter-limit":new co(U.layout_line["line-miter-limit"]),"line-round-limit":new co(U.layout_line["line-round-limit"]),"line-sort-key":new uo(U.layout_line["line-sort-key"])})}};class pl extends uo{possiblyEvaluate(t,e){return e=new eo(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,n){return e=d({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,n)}}let ml;class gl extends vo{constructor(t){super(t,fl),this.gradientVersion=0,ml||(ml=new pl(fl.paint.properties["line-width"].specification),ml.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Oe,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=ml.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new cl(t)}queryRadius(t){const e=t,i=bl(pr("line-width",this,e),pr("line-gap-width",this,e)),n=pr("line-offset",this,e);return i/2+Math.abs(n)+mr(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,n,s,r,a){const l=gr(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),r.angle,a),h=a/2*bl(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),c=this.paint.get("line-offset").evaluate(e,i);return c&&(n=function(t,e){const i=[];for(let n=0;n<t.length;n++){const s=t[n],r=[];for(let t=0;t<s.length;t++){const i=s[t-1],n=s[t],a=s[t+1],l=0===t?new o(0,0):n.sub(i)._unit()._perp(),h=t===s.length-1?new o(0,0):a.sub(n)._unit()._perp(),c=l._add(h)._unit(),u=c.x*h.x+c.y*h.y;0!==u&&c._mult(1/u),r.push(c._mult(e)._add(n))}i.push(r)}return i}(n,c*a)),function(t,e,i){for(let n=0;n<e.length;n++){const o=e[n];if(t.length>=3)for(let e=0;e<o.length;e++)if(dr(t,o[e]))return!0;if(rr(t,o,i))return!0}return!1}(l,n,h)}isTileClipped(){return!0}}function bl(t,e){return e>0?e+2*t:t}const vl=_o([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),wl=_o([{name:"a_projected_pos",components:3,type:"Float32"}],4);_o([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const yl=_o([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);_o([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const xl=_o([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),_l=_o([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function kl(t,e,i){return t.sections.forEach((t=>{t.text=function(t,e,i){const n=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),to.applyArabicShaping&&(t=to.applyArabicShaping(t)),t}(t.text,e,i)})),t}_o([{name:"triangle",components:3,type:"Uint16"}]),_o([{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"}]),_o([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),_o([{type:"Float32",name:"offsetX"}]),_o([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),_o([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Ml={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var zl=24,Sl=Al,Cl=function(t,e,i,n,o){var s,r,a=8*o-n-1,l=(1<<a)-1,h=l>>1,c=-7,u=i?o-1:0,d=i?-1:1,f=t[e+u];for(u+=d,s=f&(1<<-c)-1,f>>=-c,c+=a;c>0;s=256*s+t[e+u],u+=d,c-=8);for(r=s&(1<<-c)-1,s>>=-c,c+=n;c>0;r=256*r+t[e+u],u+=d,c-=8);if(0===s)s=1-h;else{if(s===l)return r?NaN:1/0*(f?-1:1);r+=Math.pow(2,n),s-=h}return(f?-1:1)*r*Math.pow(2,s-n)},El=function(t,e,i,n,o,s){var r,a,l,h=8*s-o-1,c=(1<<h)-1,u=c>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,r=c):(r=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-r))<1&&(r--,l*=2),(e+=r+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(r++,l/=2),r+u>=c?(a=0,r=c):r+u>=1?(a=(e*l-1)*Math.pow(2,o),r+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,o),r=0));o>=8;t[i+f]=255&a,f+=p,a/=256,o-=8);for(r=r<<o|a,h+=o;h>0;t[i+f]=255&r,f+=p,r/=256,h-=8);t[i+f-p]|=128*m};function Al(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Al.Varint=0,Al.Fixed64=1,Al.Bytes=2,Al.Fixed32=5;var Il=4294967296,Tl=1/Il,Pl="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function $l(t){return t.type===Al.Bytes?t.readVarint()+t.pos:t.pos+1}function Fl(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Ol(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var o=i.pos-1;o>=t;o--)i.buf[o+n]=i.buf[o]}function Dl(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function jl(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function Ll(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function Rl(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function Nl(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function Bl(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function Ul(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function ql(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function Vl(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function Gl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Zl(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function Wl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Al.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),o=n>>3,s=this.pos;this.type=7&n,t(o,e,this),this.pos===s&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Gl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Wl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Gl(this.buf,this.pos)+Gl(this.buf,this.pos+4)*Il;return this.pos+=8,t},readSFixed64:function(){var t=Gl(this.buf,this.pos)+Wl(this.buf,this.pos+4)*Il;return this.pos+=8,t},readFloat:function(){var t=Cl(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Cl(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,o,s=i.buf;if(n=(112&(o=s[i.pos++]))>>4,o<128)return Fl(t,n,e);if(n|=(127&(o=s[i.pos++]))<<3,o<128)return Fl(t,n,e);if(n|=(127&(o=s[i.pos++]))<<10,o<128)return Fl(t,n,e);if(n|=(127&(o=s[i.pos++]))<<17,o<128)return Fl(t,n,e);if(n|=(127&(o=s[i.pos++]))<<24,o<128)return Fl(t,n,e);if(n|=(1&(o=s[i.pos++]))<<31,o<128)return Fl(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Pl?function(t,e,i){return Pl.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var n="",o=e;o<i;){var s,r,a,l=t[o],h=null,c=l>239?4:l>223?3:l>191?2:1;if(o+c>i)break;1===c?l<128&&(h=l):2===c?128==(192&(s=t[o+1]))&&(h=(31&l)<<6|63&s)<=127&&(h=null):3===c?(r=t[o+2],128==(192&(s=t[o+1]))&&128==(192&r)&&((h=(15&l)<<12|(63&s)<<6|63&r)<=2047||h>=55296&&h<=57343)&&(h=null)):4===c&&(r=t[o+2],a=t[o+3],128==(192&(s=t[o+1]))&&128==(192&r)&&128==(192&a)&&((h=(15&l)<<18|(63&s)<<12|(63&r)<<6|63&a)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,c=1):h>65535&&(h-=65536,n+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),n+=String.fromCharCode(h),o+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Al.Bytes)return t.push(this.readVarint(e));var i=$l(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Al.Bytes)return t.push(this.readSVarint());var e=$l(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Al.Bytes)return t.push(this.readBoolean());var e=$l(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Al.Bytes)return t.push(this.readFloat());var e=$l(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Al.Bytes)return t.push(this.readDouble());var e=$l(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Al.Bytes)return t.push(this.readFixed32());var e=$l(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Al.Bytes)return t.push(this.readSFixed32());var e=$l(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Al.Bytes)return t.push(this.readFixed64());var e=$l(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Al.Bytes)return t.push(this.readSFixed64());var e=$l(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Al.Varint)for(;this.buf[this.pos++]>127;);else if(e===Al.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Al.Fixed32)this.pos+=4;else{if(e!==Al.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Zl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Zl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Zl(this.buf,-1&t,this.pos),Zl(this.buf,Math.floor(t*Tl),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Zl(this.buf,-1&t,this.pos),Zl(this.buf,Math.floor(t*Tl),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,n;if(t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){var i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var n,o,s=0;s<e.length;s++){if((n=e.charCodeAt(s))>55295&&n<57344){if(!o){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):o=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,o=n;continue}n=o-55296<<10|n-56320|65536,o=null}else o&&(t[i++]=239,t[i++]=191,t[i++]=189,o=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&Ol(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),El(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),El(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var n=this.pos-i;n>=128&&Ol(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,Al.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Dl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,jl,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Nl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Ll,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Rl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Bl,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Ul,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,ql,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Vl,e)},writeBytesField:function(t,e){this.writeTag(t,Al.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Al.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Al.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Al.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Al.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Al.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Al.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Al.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Al.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Al.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Jl=e(Sl);const Xl=3;function Hl(t,e,i){1===t&&i.readMessage(Kl,e)}function Kl(t,e,i){if(3===t){const{id:t,bitmap:n,width:o,height:s,left:r,top:a,advance:l}=i.readMessage(Yl,{});e.push({id:t,bitmap:new Or({width:o+2*Xl,height:s+2*Xl},n),metrics:{width:o,height:s,left:r,top:a,advance:l}})}}function Yl(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}const Ql=Xl;function th(t){let e=0,i=0;for(const n of t)e+=n.w*n.h,i=Math.max(i,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let o=0,s=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const i=n[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,s=Math.max(s,e.y+e.h),o=Math.max(o,e.x+e.w),e.w===i.w&&e.h===i.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(n.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:o,h:s,fill:e/(o*s)||0}}const eh=1;class ih{constructor(t,{pixelRatio:e,version:i,stretchX:n,stretchY:o,content:s}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=o,this.content=s,this.version=i}get tl(){return[this.paddedRect.x+eh,this.paddedRect.y+eh]}get br(){return[this.paddedRect.x+this.paddedRect.w-eh,this.paddedRect.y+this.paddedRect.h-eh]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*eh)/this.pixelRatio,(this.paddedRect.h-2*eh)/this.pixelRatio]}}class nh{constructor(t,e){const i={},n={};this.haveRenderCallbacks=[];const o=[];this.addImages(t,i,o),this.addImages(e,n,o);const{w:s,h:r}=th(o),a=new Dr({width:s||1,height:r||1});for(const e in t){const n=t[e],o=i[e].paddedRect;Dr.copy(n.data,a,{x:0,y:0},{x:o.x+eh,y:o.y+eh},n.data)}for(const t in e){const i=e[t],o=n[t].paddedRect,s=o.x+eh,r=o.y+eh,l=i.data.width,h=i.data.height;Dr.copy(i.data,a,{x:0,y:0},{x:s,y:r},i.data),Dr.copy(i.data,a,{x:0,y:h-1},{x:s,y:r-1},{width:l,height:1}),Dr.copy(i.data,a,{x:0,y:0},{x:s,y:r+h},{width:l,height:1}),Dr.copy(i.data,a,{x:l-1,y:0},{x:s-1,y:r},{width:1,height:h}),Dr.copy(i.data,a,{x:0,y:0},{x:s+l,y:r},{width:1,height:h})}this.image=a,this.iconPositions=i,this.patternPositions=n}addImages(t,e,i){for(const n in t){const o=t[n],s={x:0,y:0,w:o.data.width+2*eh,h:o.data.height+2*eh};i.push(s),e[n]=new ih(s,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)}patchUpdatedImage(t,e,i){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,o]=t.tl;i.update(e.data,void 0,{x:n,y:o})}}var oh;An("ImagePosition",ih),An("ImageAtlas",nh),t.WritingMode=void 0,(oh=t.WritingMode||(t.WritingMode={}))[oh.none=0]="none",oh[oh.horizontal=1]="horizontal",oh[oh.vertical=2]="vertical",oh[oh.horizontalOnly=3]="horizontalOnly";const sh=-17;class rh{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const i=new rh;return i.scale=t||1,i.fontStack=e,i}static forImage(t){const e=new rh;return e.imageName=t,e}}class ah{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const i=new ah;for(let n=0;n<t.sections.length;n++){const o=t.sections[n];o.image?i.addImageSection(o):i.addTextSection(o,e)}return i}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e="";for(let i=0;i<t.length;i++){const n=t.charCodeAt(i+1)||null,o=t.charCodeAt(i-1)||null;e+=n&&Rn(n)&&!Ml[t[i+1]]||o&&Rn(o)&&!Ml[t[i-1]]||!Ml[t[i]]?t[i]:Ml[t[i]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&hh[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let i=this.text.length-1;i>=0&&i>=t&&hh[this.text.charCodeAt(i)];i--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const i=new ah;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(rh.forText(t.scale,t.fontStack||e));const i=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(i)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void v("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(rh.forImage(e)),this.sectionIndex.push(this.sections.length-1)):v("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function lh(e,i,n,o,s,r,a,l,h,c,u,d,f,p,m,g){const b=ah.fromFeature(e,s);let v;d===t.WritingMode.vertical&&b.verticalizePunctuation();const{processBidirectionalText:w,processStyledBidirectionalText:y}=to;if(w&&1===b.sections.length){v=[];const t=w(b.toString(),gh(b,c,r,i,o,p,m));for(const e of t){const t=new ah;t.text=e,t.sections=b.sections;for(let i=0;i<e.length;i++)t.sectionIndex.push(0);v.push(t)}}else if(y){v=[];const t=y(b.text,b.sectionIndex,gh(b,c,r,i,o,p,m));for(const e of t){const t=new ah;t.text=e[0],t.sectionIndex=e[1],t.sections=b.sections,v.push(t)}}else v=function(t,e){const i=[],n=t.text;let o=0;for(const n of e)i.push(t.substring(o,n)),o=n;return o<n.length&&i.push(t.substring(o,n.length)),i}(b,gh(b,c,r,i,o,p,m));const x=[],_={positionedLines:x,text:b.toString(),top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:d,iconsInText:!1,verticalizable:!1};return function(e,i,n,o,s,r,a,l,h,c,u,d){let f=0,p=sh,m=0,g=0;const b="right"===l?1:"left"===l?0:.5;let v=0;for(const a of s){a.trim();const s=a.getMaxScale(),l=(s-1)*zl,y={positionedGlyphs:[],lineOffset:0};e.positionedLines[v]=y;const x=y.positionedGlyphs;let _=0;if(!a.length()){p+=r,++v;continue}for(let r=0;r<a.length();r++){const m=a.getSection(r),g=a.getSectionIndex(r),b=a.getCharCode(r);let v=0,y=null,k=null,M=null,z=zl;const S=!(h===t.WritingMode.horizontal||!u&&!Ln(b)||u&&(hh[b]||(w=b,Fn.Arabic(w)||Fn["Arabic Supplement"](w)||Fn["Arabic Extended-A"](w)||Fn["Arabic Presentation Forms-A"](w)||Fn["Arabic Presentation Forms-B"](w))));if(m.imageName){const t=o[m.imageName];if(!t)continue;M=m.imageName,e.iconsInText=e.iconsInText||!0,k=t.paddedRect;const i=t.displaySize;m.scale=m.scale*zl/d,y={width:i[0],height:i[1],left:eh,top:-Ql,advance:S?i[1]:i[0]},v=l+(zl-i[1]*m.scale),z=y.advance;const n=S?i[0]*m.scale-zl*s:i[1]*m.scale-zl*s;n>0&&n>_&&(_=n)}else{const t=n[m.fontStack],e=t&&t[b];if(e&&e.rect)k=e.rect,y=e.metrics;else{const t=i[m.fontStack],e=t&&t[b];if(!e)continue;y=e.metrics}v=(s-m.scale)*zl}S?(e.verticalizable=!0,x.push({glyph:b,imageName:M,x:f,y:p+v,vertical:S,scale:m.scale,fontStack:m.fontStack,sectionIndex:g,metrics:y,rect:k}),f+=z*m.scale+c):(x.push({glyph:b,imageName:M,x:f,y:p+v,vertical:S,scale:m.scale,fontStack:m.fontStack,sectionIndex:g,metrics:y,rect:k}),f+=y.advance*m.scale+c)}0!==x.length&&(m=Math.max(f-c,m),vh(x,0,x.length-1,b,_)),f=0;const k=r*s+_;y.lineOffset=Math.max(_,l),p+=k,g=Math.max(k,g),++v}var w;const y=p-sh,{horizontalAlign:x,verticalAlign:_}=bh(a);(function(t,e,i,n,o,s,r,a,l){const h=(e-i)*o;let c=0;c=s!==r?-a*n-sh:(-n*l+.5)*r;for(const e of t)for(const t of e.positionedGlyphs)t.x+=h,t.y+=c})(e.positionedLines,b,x,_,m,g,r,y,s.length),e.top+=-_*y,e.bottom=e.top+y,e.left+=-x*m,e.right=e.left+m}(_,i,n,o,v,a,l,h,d,c,f,g),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(x)&&_}const hh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ch={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function uh(t,e,i,n,o,s){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*zl/s+o:0}{const n=i[e.fontStack],s=n&&n[t];return s?s.metrics.advance*e.scale+o:0}}function dh(t,e,i,n){const o=Math.pow(t-e,2);return n?t<e?o/2:2*o:o+Math.abs(i)*i}function fh(t,e,i){let n=0;return 10===t&&(n-=1e4),i&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function ph(t,e,i,n,o,s){let r=null,a=dh(e,i,o,s);for(const t of n){const n=dh(e-t.x,i,o,s)+t.badness;n<=a&&(r=t,a=n)}return{index:t,x:e,priorBreak:r,badness:a}}function mh(t){return t?mh(t.priorBreak).concat(t.index):[]}function gh(t,e,i,n,o,s,r){if("point"!==s)return[];if(!t)return[];const a=[],l=function(t,e,i,n,o,s){let r=0;for(let i=0;i<t.length();i++){const a=t.getSection(i);r+=uh(t.getCharCode(i),a,n,o,e,s)}return r/Math.max(1,Math.ceil(r/i))}(t,e,i,n,o,r),h=t.text.indexOf("")>=0;let c=0;for(let i=0;i<t.length();i++){const s=t.getSection(i),d=t.getCharCode(i);if(hh[d]||(c+=uh(d,s,n,o,e,r)),i<t.length()-1){const e=!((u=d)<11904||!(Fn["Bopomofo Extended"](u)||Fn.Bopomofo(u)||Fn["CJK Compatibility Forms"](u)||Fn["CJK Compatibility Ideographs"](u)||Fn["CJK Compatibility"](u)||Fn["CJK Radicals Supplement"](u)||Fn["CJK Strokes"](u)||Fn["CJK Symbols and Punctuation"](u)||Fn["CJK Unified Ideographs Extension A"](u)||Fn["CJK Unified Ideographs"](u)||Fn["Enclosed CJK Letters and Months"](u)||Fn["Halfwidth and Fullwidth Forms"](u)||Fn.Hiragana(u)||Fn["Ideographic Description Characters"](u)||Fn["Kangxi Radicals"](u)||Fn["Katakana Phonetic Extensions"](u)||Fn.Katakana(u)||Fn["Vertical Forms"](u)||Fn["Yi Radicals"](u)||Fn["Yi Syllables"](u)));(ch[d]||e||s.imageName)&&a.push(ph(i+1,c,l,a,fh(d,t.getCharCode(i+1),e&&h),!1))}}var u;return mh(ph(t.length(),c,l,a,0,!0))}function bh(t){let e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function vh(t,e,i,n,o){if(!n&&!o)return;const s=t[i],r=(t[i].x+s.metrics.advance*s.scale)*n;for(let n=e;n<=i;n++)t[n].x-=r,t[n].y+=o}function wh(t,e,i){const{horizontalAlign:n,verticalAlign:o}=bh(i),s=e[0]-t.displaySize[0]*n,r=e[1]-t.displaySize[1]*o;return{image:t,top:r,bottom:r+t.displaySize[1],left:s,right:s+t.displaySize[0]}}function yh(t,e,i,n,o,s){const r=t.image;let a;if(r.content){const t=r.content,e=r.pixelRatio||1;a=[t[0]/e,t[1]/e,r.displaySize[0]-t[2]/e,r.displaySize[1]-t[3]/e]}const l=e.left*s,h=e.right*s;let c,u,d,f;"width"===i||"both"===i?(f=o[0]+l-n[3],u=o[0]+h+n[1]):(f=o[0]+(l+h-r.displaySize[0])/2,u=f+r.displaySize[0]);const p=e.top*s,m=e.bottom*s;return"height"===i||"both"===i?(c=o[1]+p-n[0],d=o[1]+m+n[2]):(c=o[1]+(p+m-r.displaySize[1])/2,d=c+r.displaySize[1]),{image:r,top:c,right:u,bottom:d,left:f,collisionPadding:a}}const xh=255,_h=128,kh=xh*_h;function Mh(t,e){const{expression:i}=e;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new eo(t+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=i;let o=0;for(;o<e.length&&e[o]<=t;)o++;o=Math.max(0,o-1);let s=o;for(;s<e.length&&e[s]<t+1;)s++;s=Math.min(e.length-1,s);const r=e[o],a=e[s];return"composite"===i.kind?{kind:"composite",minZoom:r,maxZoom:a,interpolationType:n}:{kind:"camera",minZoom:r,maxZoom:a,minSize:i.evaluate(new eo(r)),maxSize:i.evaluate(new eo(a)),interpolationType:n}}}function zh(t,e,i){let n="never";const o=t.get(e);return o?n=o:t.get(i)&&(n="always"),n}const Sh=Fa.VectorTileFeature.types,Ch=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Eh(t,e,i,n,o,s,r,a,l,h,c,u,d){const f=a?Math.min(kh,Math.round(a[0])):0,p=a?Math.min(kh,Math.round(a[1])):0;t.emplaceBack(e,i,Math.round(32*n),Math.round(32*o),s,r,(f<<1)+(l?1:0),p,16*h,16*c,256*u,256*d)}function Ah(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function Ih(t){for(const e of t.sections)if(Un(e.text))return!0;return!1}class Th{constructor(t){this.layoutVertexArray=new ds,this.indexArray=new bs,this.programConfigurations=t,this.segments=new xs,this.dynamicLayoutVertexArray=new fs,this.opacityVertexArray=new ps,this.hasVisibleVertices=!1,this.placedSymbolArray=new Ho}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,i,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,vl.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,wl.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Ch,!0),this.opacityVertexBuffer.itemSize=1),(i||n)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}An("SymbolBuffers",Th);class Ph{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new xs,this.collisionVertexArray=new gs}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,yl.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}An("CollisionBuffers",Ph);class $h{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=_r([]),this.placementViewportMatrix=_r([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Mh(this.zoom,i["text-size"]),this.iconSizeData=Mh(this.zoom,i["icon-size"]);const n=this.layers[0].layout,o=n.get("symbol-sort-key"),s=n.get("symbol-z-order");this.canOverlap="never"!==zh(n,"text-overlap","text-allow-overlap")||"never"!==zh(n,"icon-overlap","icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==s&&!o.isConstant(),this.sortFeaturesByY=("viewport-y"===s||"auto"===s&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===n.get("symbol-placement")&&(this.writingModes=n.get("text-writing-mode").map((e=>t.WritingMode[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Th(new Ws(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Th(new Ws(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Qo,this.lineVertexArray=new ts,this.symbolInstances=new Yo,this.textAnchorOffsets=new is}calculateGlyphDependencies(t,e,i,n,o){for(let s=0;s<t.length;s++)if(e[t.charCodeAt(s)]=!0,(i||n)&&o){const i=Ml[t.charAt(s)];i&&(e[i.charCodeAt(0)]=!0)}}populate(e,i,n){const o=this.layers[0],s=o.layout,r=s.get("text-font"),a=s.get("text-field"),l=s.get("icon-image"),h=("constant"!==a.value.kind||a.value.value instanceof Zt&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==r.value.kind||r.value.value.length>0),c="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,u=s.get("symbol-sort-key");if(this.features=[],!h&&!c)return;const d=i.iconDependencies,f=i.glyphDependencies,p=i.availableImages,m=new eo(this.zoom);for(const{feature:i,id:a,index:l,sourceLayerIndex:g}of e){const e=o._featureFilter.needGeometry,b=tr(i,e);if(!o._featureFilter.filter(m,b,n))continue;let v,w;if(e||(b.geometry=Qs(i)),h){const t=o.getValueAndResolveTokens("text-field",b,n,p),e=Zt.factory(t);Ih(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Yn()||this.hasRTLText&&to.isParsed())&&(v=kl(e,o,b))}if(c){const t=o.getValueAndResolveTokens("icon-image",b,n,p);w=t instanceof Ht?t:Ht.fromString(t)}if(!v&&!w)continue;const y=this.sortFeaturesByKey?u.evaluate(b,{},n):void 0;if(this.features.push({id:a,text:v,icon:w,index:l,sourceLayerIndex:g,geometry:b.geometry,properties:i.properties,type:Sh[i.type],sortKey:y}),w&&(d[w.name]=!0),v){const e=r.evaluate(b,{},n).join(","),i="viewport"!==s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.WritingMode.vertical)>=0;for(const t of v.sections)if(t.image)d[t.image.name]=!0;else{const n=On(v.toString()),o=t.fontStack||e,s=f[o]=f[o]||{};this.calculateGlyphDependencies(t.text,s,i,this.allowVerticalPlacement,n)}}}"line"===s.get("symbol-placement")&&(this.features=function(t){const e={},i={},n=[];let o=0;function s(e){n.push(t[e]),o++}function r(t,e,o){const s=i[t];return delete i[t],i[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(o[0]),s}function a(t,i,o){const s=e[i];return delete e[i],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=o[0].concat(n[s].geometry[0]),s}function l(t,e,i){const n=i?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let h=0;h<t.length;h++){const c=t[h],u=c.geometry,d=c.text?c.text.toString():null;if(!d){s(h);continue}const f=l(d,u),p=l(d,u,!0);if(f in i&&p in e&&i[f]!==e[p]){const t=a(f,p,u),o=r(f,p,n[t].geometry);delete e[f],delete i[p],i[l(d,n[o].geometry,!0)]=o,n[t].geometry=null}else f in i?r(f,p,u):p in e?a(f,p,u):(s(h),e[f]=o-1,i[p]=o-1)}return n.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const i=this.lineVertexArray.length;if(void 0!==t.segment){let i=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const o={};for(let n=t.segment+1;n<e.length;n++)o[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:i},n<e.length-1&&(i+=e[n+1].dist(e[n]));for(let i=t.segment||0;i>=0;i--)o[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:n},i>0&&(n+=e[i-1].dist(e[i]));for(let t=0;t<e.length;t++){const e=o[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,i,n,o,s,r,a,l,h,c,u,d){const f=e.indexArray,p=e.layoutVertexArray,m=e.segments.prepareSegment(4*i.length,p,f,this.canOverlap?r.sortKey:void 0),g=this.glyphOffsetArray.length,b=m.vertexLength,v=this.allowVerticalPlacement&&a===t.WritingMode.vertical?Math.PI/2:0,w=r.text&&r.text.sections;for(let t=0;t<i.length;t++){const{tl:o,tr:s,bl:a,br:h,tex:c,pixelOffsetTL:u,pixelOffsetBR:g,minFontScaleX:b,minFontScaleY:y,glyphOffset:x,isSDF:_,sectionIndex:k}=i[t],M=m.vertexLength,z=x[1];Eh(p,l.x,l.y,o.x,z+o.y,c.x,c.y,n,_,u.x,u.y,b,y),Eh(p,l.x,l.y,s.x,z+s.y,c.x+c.w,c.y,n,_,g.x,u.y,b,y),Eh(p,l.x,l.y,a.x,z+a.y,c.x,c.y+c.h,n,_,u.x,g.y,b,y),Eh(p,l.x,l.y,h.x,z+h.y,c.x+c.w,c.y+c.h,n,_,g.x,g.y,b,y),Ah(e.dynamicLayoutVertexArray,l,v),f.emplaceBack(M,M+1,M+2),f.emplaceBack(M+1,M+2,M+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(x[0]),t!==i.length-1&&k===i[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(p.length,r,r.index,{},d,w&&w[k])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,b,h,c,l.segment,n?n[0]:0,n?n[1]:0,o[0],o[1],a,0,!1,0,u)}_addCollisionDebugVertex(t,e,i,n,o,s){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,n,o,Math.round(s.x),Math.round(s.y))}addCollisionDebugVertices(t,e,i,n,s,r,a){const l=s.segments.prepareSegment(4,s.layoutVertexArray,s.indexArray),h=l.vertexLength,c=s.layoutVertexArray,u=s.collisionVertexArray,d=a.anchorX,f=a.anchorY;this._addCollisionDebugVertex(c,u,r,d,f,new o(t,e)),this._addCollisionDebugVertex(c,u,r,d,f,new o(i,e)),this._addCollisionDebugVertex(c,u,r,d,f,new o(i,n)),this._addCollisionDebugVertex(c,u,r,d,f,new o(t,n)),l.vertexLength+=4;const p=s.indexArray;p.emplaceBack(h,h+1),p.emplaceBack(h+1,h+2),p.emplaceBack(h+2,h+3),p.emplaceBack(h+3,h),l.primitiveLength+=4}addDebugCollisionBoxes(t,e,i,n){for(let o=t;o<e;o++){const t=this.collisionBoxArray.get(o);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,n?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ph(ms,xl.members,vs),this.iconCollisionBox=new Ph(ms,xl.members,vs);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,i,n,o,s,r,a,l){const h={};for(let n=e;n<i;n++){const e=t.get(n);h.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},h.textFeatureIndex=e.featureIndex;break}for(let e=n;e<o;e++){const i=t.get(e);h.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},h.verticalTextFeatureIndex=i.featureIndex;break}for(let e=s;e<r;e++){const i=t.get(e);h.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},h.iconFeatureIndex=i.featureIndex;break}for(let e=a;e<l;e++){const i=t.get(e);h.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},h.verticalIconFeatureIndex=i.featureIndex;break}return h}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const i=t.placedSymbolArray.get(e),n=i.vertexStartIndex+4*i.numGlyphs;for(let e=i.vertexStartIndex;e<n;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),i=Math.cos(t),n=[],o=[],s=[];for(let t=0;t<this.symbolInstances.length;++t){s.push(t);const r=this.symbolInstances.get(t);n.push(0|Math.round(e*r.anchorX+i*r.anchorY)),o.push(r.featureIndex)}return s.sort(((t,e)=>n[t]-n[e]||o[e]-o[t])),s}addToSortKeyRanges(t,e){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,i)=>{t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Fh,Oh;An("SymbolBucket",$h,{omit:["layers","collisionBoxArray","features","compareText"]}),$h.MAX_GLYPHS=65535,$h.addDynamicAttributes=Ah;var Dh={get paint(){return Oh=Oh||new go({"icon-opacity":new uo(U.paint_symbol["icon-opacity"]),"icon-color":new uo(U.paint_symbol["icon-color"]),"icon-halo-color":new uo(U.paint_symbol["icon-halo-color"]),"icon-halo-width":new uo(U.paint_symbol["icon-halo-width"]),"icon-halo-blur":new uo(U.paint_symbol["icon-halo-blur"]),"icon-translate":new co(U.paint_symbol["icon-translate"]),"icon-translate-anchor":new co(U.paint_symbol["icon-translate-anchor"]),"text-opacity":new uo(U.paint_symbol["text-opacity"]),"text-color":new uo(U.paint_symbol["text-color"],{runtimeType:lt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new uo(U.paint_symbol["text-halo-color"]),"text-halo-width":new uo(U.paint_symbol["text-halo-width"]),"text-halo-blur":new uo(U.paint_symbol["text-halo-blur"]),"text-translate":new co(U.paint_symbol["text-translate"]),"text-translate-anchor":new co(U.paint_symbol["text-translate-anchor"])})},get layout(){return Fh=Fh||new go({"symbol-placement":new co(U.layout_symbol["symbol-placement"]),"symbol-spacing":new co(U.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new co(U.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new uo(U.layout_symbol["symbol-sort-key"]),"symbol-z-order":new co(U.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new co(U.layout_symbol["icon-allow-overlap"]),"icon-overlap":new co(U.layout_symbol["icon-overlap"]),"icon-ignore-placement":new co(U.layout_symbol["icon-ignore-placement"]),"icon-optional":new co(U.layout_symbol["icon-optional"]),"icon-rotation-alignment":new co(U.layout_symbol["icon-rotation-alignment"]),"icon-size":new uo(U.layout_symbol["icon-size"]),"icon-text-fit":new co(U.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new co(U.layout_symbol["icon-text-fit-padding"]),"icon-image":new uo(U.layout_symbol["icon-image"]),"icon-rotate":new uo(U.layout_symbol["icon-rotate"]),"icon-padding":new uo(U.layout_symbol["icon-padding"]),"icon-keep-upright":new co(U.layout_symbol["icon-keep-upright"]),"icon-offset":new uo(U.layout_symbol["icon-offset"]),"icon-anchor":new uo(U.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new co(U.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new co(U.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new co(U.layout_symbol["text-rotation-alignment"]),"text-field":new uo(U.layout_symbol["text-field"]),"text-font":new uo(U.layout_symbol["text-font"]),"text-size":new uo(U.layout_symbol["text-size"]),"text-max-width":new uo(U.layout_symbol["text-max-width"]),"text-line-height":new co(U.layout_symbol["text-line-height"]),"text-letter-spacing":new uo(U.layout_symbol["text-letter-spacing"]),"text-justify":new uo(U.layout_symbol["text-justify"]),"text-radial-offset":new uo(U.layout_symbol["text-radial-offset"]),"text-variable-anchor":new co(U.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new uo(U.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new uo(U.layout_symbol["text-anchor"]),"text-max-angle":new co(U.layout_symbol["text-max-angle"]),"text-writing-mode":new co(U.layout_symbol["text-writing-mode"]),"text-rotate":new uo(U.layout_symbol["text-rotate"]),"text-padding":new co(U.layout_symbol["text-padding"]),"text-keep-upright":new co(U.layout_symbol["text-keep-upright"]),"text-transform":new uo(U.layout_symbol["text-transform"]),"text-offset":new uo(U.layout_symbol["text-offset"]),"text-allow-overlap":new co(U.layout_symbol["text-allow-overlap"]),"text-overlap":new co(U.layout_symbol["text-overlap"]),"text-ignore-placement":new co(U.layout_symbol["text-ignore-placement"]),"text-optional":new co(U.layout_symbol["text-optional"])})}};class jh{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:ot,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}An("FormatSectionOverride",jh,{omit:["defaultValue"]});class Lh extends vo{constructor(t){super(t,Dh)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const i of t)e.indexOf(i)<0&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,n){const o=this.layout.get(t).evaluate(e,{},i,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||Ei(s.value)||!o?o:function(t,e){return e.replace(/{([^{}]+)}/g,((e,i)=>i in t?String(t[i]):""))}(e.properties,o)}createBucket(t){return new $h(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Dh.paint.overridableProperties){if(!Lh.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new jh(e),n=new Ci(i,e.property.specification);let o=null;o="constant"===e.value.kind||"source"===e.value.kind?new Ii("source",n):new Ti("composite",n,e.value.zoomStops),this.paint._values[t]=new lo(e.property,o,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&Lh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),n=Dh.paint.properties[e];let o=!1;const s=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(o=!0)};if("constant"===i.value.kind&&i.value.value instanceof Zt)s(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{o||(e instanceof ee&&Qt(e.value)===dt?s(e.value.sections):e instanceof si?s(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return o}}let Rh;var Nh={get paint(){return Rh=Rh||new go({"background-color":new co(U.paint_background["background-color"]),"background-pattern":new po(U.paint_background["background-pattern"]),"background-opacity":new co(U.paint_background["background-opacity"])})}};class Bh extends vo{constructor(t){super(t,Nh)}}let Uh;var qh={get paint(){return Uh=Uh||new go({"raster-opacity":new co(U.paint_raster["raster-opacity"]),"raster-hue-rotate":new co(U.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new co(U.paint_raster["raster-brightness-min"]),"raster-brightness-max":new co(U.paint_raster["raster-brightness-max"]),"raster-saturation":new co(U.paint_raster["raster-saturation"]),"raster-contrast":new co(U.paint_raster["raster-contrast"]),"raster-resampling":new co(U.paint_raster["raster-resampling"]),"raster-fade-duration":new co(U.paint_raster["raster-fade-duration"])})}};class Vh extends vo{constructor(t){super(t,qh)}}class Gh extends vo{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Zh{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{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(){delete this._channel,this._callback=()=>{}}}const Wh=6371008.8;class Jh{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Jh(u(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,i=this.lat*e,n=t.lat*e,o=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return Wh*Math.acos(Math.min(o,1))}static convert(t){if(t instanceof Jh)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Jh(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Jh(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Xh=2*Math.PI*Wh;function Hh(t){return Xh*Math.cos(t*Math.PI/180)}function Kh(t){return(180+t)/360}function Yh(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Qh(t,e){return t/Hh(e)}function tc(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class ec{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){const i=Jh.convert(t);return new ec(Kh(i.lng),Yh(i.lat),Qh(e,i.lat))}toLngLat(){return new Jh(360*this.x-180,tc(this.y))}toAltitude(){return this.z*Hh(tc(this.y))}meterInMercatorCoordinateUnits(){return 1/Xh*(t=tc(this.y),1/Math.cos(t*Math.PI/180));var t}}function ic(t,e,i){var n=2*Math.PI*6378137/256/Math.pow(2,i);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class nc{constructor(t,e,i){if(t<0||t>25||i<0||i>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error(`x=${e}, y=${i}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=i,this.key=rc(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){const n=(s=this.y,r=this.z,a=ic(256*(o=this.x),256*(s=Math.pow(2,r)-s-1),r),l=ic(256*(o+1),256*(s+1),r),a[0]+","+a[1]+","+l[0]+","+l[1]);var o,s,r,a,l;const h=function(t,e,i){let n,o="";for(let s=t;s>0;s--)n=1<<s-1,o+=(e&n?1:0)+(i&n?2:0);return o}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,h).replace(/{bbox-epsg-3857}/g,n)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new o((t.x*e-this.x)*Hs,(t.y*e-this.y)*Hs)}toString(){return`${this.z}/${this.x}/${this.y}`}}class oc{constructor(t,e){this.wrap=t,this.canonical=e,this.key=rc(t,e.z,e.z,e.x,e.y)}}class sc{constructor(t,e,i,n,o){if(t<i)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new nc(i,+n,+o),this.key=rc(e,t,i,n,o)}clone(){return new sc(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new sc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new sc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-t;return t>this.canonical.z?rc(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):rc(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new sc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,i=2*this.canonical.x,n=2*this.canonical.y;return[new sc(e,this.wrap,e,i,n),new sc(e,this.wrap,e,i+1,n),new sc(e,this.wrap,e,i,n+1),new sc(e,this.wrap,e,i+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new sc(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new sc(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new oc(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new ec(t.x-this.wrap,t.y))}}function rc(t,e,i,n,o){(t*=2)<0&&(t=-1*t-1);const s=1<<i;return(s*s*t+s*o+n).toString(36)+i.toString(36)+e.toString(36)}An("CanonicalTileID",nc),An("OverscaledTileID",sc,{omit:["posMatrix"]});class ac{constructor(t,e,i){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(i&&"mapbox"!==i&&"terrarium"!==i)return void v(`"${i}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=e.height;const n=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=i||"mapbox";for(let t=0;t<n;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(n,t)]=this.data[this._idx(n-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,n)]=this.data[this._idx(t,n-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(n,-1)]=this.data[this._idx(n-1,0)],this.data[this._idx(-1,n)]=this.data[this._idx(0,n-1)],this.data[this._idx(n,n)]=this.data[this._idx(n-1,n-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<n;t++)for(let e=0;e<n;e++){const i=this.get(t,e);i>this.max&&(this.max=i),i<this.min&&(this.min=i)}}get(t,e){const i=new Uint8Array(this.data.buffer),n=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(i[n],i[n+1],i[n+2])}getUnpackVector(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,i){return(256*t*256+256*e+i)/10-1e4}_unpackTerrarium(t,e,i){return 256*t+e+i/256-32768}getPixels(){return new Dr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,o=e*this.dim+this.dim,s=i*this.dim,r=i*this.dim+this.dim;switch(e){case-1:n=o-1;break;case 1:o=n+1}switch(i){case-1:s=r-1;break;case 1:r=s+1}const a=-e*this.dim,l=-i*this.dim;for(let e=s;e<r;e++)for(let i=n;i<o;i++)this.data[this._idx(i,e)]=t.data[this._idx(i+a,e+l)]}}An("DEMData",ac);class lc{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class hc{constructor(t,e,i,n,o){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=n,this.properties=t.properties,this.id=o}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class cc{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Cn(Hs,16,0),this.grid3D=new Cn(Hs,16,0),this.featureIndexArray=new os,this.promoteId=e}insert(t,e,i,n,o,s){const r=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,n,o);const a=s?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const i=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<i.length;t++){const e=i[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y)}n[0]<Hs&&n[1]<Hs&&n[2]>=0&&n[3]>=0&&a.insert(r,n[0],n[1],n[2],n[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Fa.VectorTile(new Jl(this.rawTileData)).layers,this.sourceLayerCoder=new lc(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,n){this.loadVTLayers();const s=t.params||{},r=Hs/t.tileSize/t.scale,a=ji(s.filter),l=t.queryGeometry,h=t.queryPadding*r,c=dc(l),u=this.grid.query(c.minX-h,c.minY-h,c.maxX+h,c.maxY+h),d=dc(t.cameraQueryGeometry),f=this.grid3D.query(d.minX-h,d.minY-h,d.maxX+h,d.maxY+h,((e,i,n,s)=>function(t,e,i,n,s){for(const o of t)if(e<=o.x&&i<=o.y&&n>=o.x&&s>=o.y)return!0;const r=[new o(e,i),new o(e,s),new o(n,s),new o(n,i)];if(t.length>2)for(const e of r)if(dr(t,e))return!0;for(let e=0;e<t.length-1;e++)if(fr(t[e],t[e+1],r))return!0;return!1}(t.cameraQueryGeometry,e-h,i-h,n+h,s+h)));for(const t of f)u.push(t);u.sort(fc);const p={};let m;for(let o=0;o<u.length;o++){const h=u[o];if(h===m)continue;m=h;const c=this.featureIndexArray.get(h);let d=null;this.loadMatchingFeature(p,c.bucketIndex,c.sourceLayerIndex,c.featureIndex,a,s.layers,s.availableImages,e,i,n,((e,i,n)=>(d||(d=Qs(e)),i.queryIntersectsFeature(l,e,n,d,this.z,t.transform,r,t.pixelPosMatrix))))}return p}loadMatchingFeature(t,e,i,n,o,s,r,a,l,h,c){const u=this.bucketLayerIDs[e];if(s&&!function(t,e){for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>=0)return!0;return!1}(s,u))return;const f=this.sourceLayerCoder.decode(i),p=this.vtLayers[f].feature(n);if(o.needGeometry){const t=tr(p,!0);if(!o.filter(new eo(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!o.filter(new eo(this.tileID.overscaledZ),p))return;const m=this.getId(p,f);for(let e=0;e<u.length;e++){const i=u[e];if(s&&s.indexOf(i)<0)continue;const o=a[i];if(!o)continue;let f={};m&&h&&(f=h.getState(o.sourceLayer||"_geojsonTileLayer",m));const g=d({},l[i]);g.paint=uc(g.paint,o.paint,p,f,r),g.layout=uc(g.layout,o.layout,p,f,r);const b=!c||c(p,o,f);if(!b)continue;const v=new hc(p,this.z,this.x,this.y,m);v.layer=g;let w=t[i];void 0===w&&(w=t[i]=[]),w.push({featureIndex:n,feature:v,intersectionZ:b})}}lookupSymbolFeatures(t,e,i,n,o,s,r,a){const l={};this.loadVTLayers();const h=ji(o);for(const o of t)this.loadMatchingFeature(l,i,n,o,h,s,r,a,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const i of e)if(t===i)return!0;return!1}getId(t,e){let i=t.id;return this.promoteId&&(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof i&&(i=Number(i))),i}}function uc(t,e,i,n,o){return p(t,((t,s)=>{const r=e instanceof ho?e.get(s):null;return r&&r.evaluate?r.evaluate(i,n,o):r}))}function dc(t){let e=1/0,i=1/0,n=-1/0,o=-1/0;for(const s of t)e=Math.min(e,s.x),i=Math.min(i,s.y),n=Math.max(n,s.x),o=Math.max(o,s.y);return{minX:e,minY:i,maxX:n,maxY:o}}function fc(t,e){return e-t}function pc(t,e,i,n,s){const r=[];for(let a=0;a<t.length;a++){const l=t[a];let h;for(let t=0;t<l.length-1;t++){let a=l[t],c=l[t+1];a.x<e&&c.x<e||(a.x<e?a=new o(e,a.y+(e-a.x)/(c.x-a.x)*(c.y-a.y))._round():c.x<e&&(c=new o(e,a.y+(e-a.x)/(c.x-a.x)*(c.y-a.y))._round()),a.y<i&&c.y<i||(a.y<i?a=new o(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i)._round():c.y<i&&(c=new o(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i)._round()),a.x>=n&&c.x>=n||(a.x>=n?a=new o(n,a.y+(n-a.x)/(c.x-a.x)*(c.y-a.y))._round():c.x>=n&&(c=new o(n,a.y+(n-a.x)/(c.x-a.x)*(c.y-a.y))._round()),a.y>=s&&c.y>=s||(a.y>=s?a=new o(a.x+(s-a.y)/(c.y-a.y)*(c.x-a.x),s)._round():c.y>=s&&(c=new o(a.x+(s-a.y)/(c.y-a.y)*(c.x-a.x),s)._round()),h&&a.equals(h[h.length-1])||(h=[a],r.push(h)),h.push(c)))))}}return r}An("FeatureIndex",cc,{omit:["rawTileData","sourceLayerCoder"]});class mc extends o{constructor(t,e,i,n){super(t,e),this.angle=i,void 0!==n&&(this.segment=n)}clone(){return new mc(this.x,this.y,this.angle,this.segment)}}function gc(t,e,i,n,o){if(void 0===e.segment||0===i)return!0;let s=e,r=e.segment+1,a=0;for(;a>-i/2;){if(r--,r<0)return!1;a-=t[r].dist(s),s=t[r]}a+=t[r].dist(t[r+1]),r++;const l=[];let h=0;for(;a<i/2;){const e=t[r],i=t[r+1];if(!i)return!1;let s=t[r-1].angleTo(e)-e.angleTo(i);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:s}),h+=s;a-l[0].distance>n;)h-=l.shift().angleDelta;if(h>o)return!1;r++,a+=e.dist(i)}return!0}function bc(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function vc(t,e,i){return t?.6*e*i:0}function wc(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function yc(t,e,i,n,o,s){const r=vc(i,o,s),a=wc(i,n)*s;let l=0;const h=bc(t)/2;for(let i=0;i<t.length-1;i++){const n=t[i],o=t[i+1],s=n.dist(o);if(l+s>h){const c=(h-l)/s,u=Le.number(n.x,o.x,c),d=Le.number(n.y,o.y,c),f=new mc(u,d,o.angleTo(n),i);return f._round(),!r||gc(t,f,a,r,e)?f:void 0}l+=s}}function xc(t,e,i,n,o,s,r,a,l){const h=vc(n,s,r),c=wc(n,o),u=c*r,d=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-u<e/4&&(e=u+e/4),_c(t,d?e/2*a%e:(c/2+2*s)*r*a%e,e,h,i,u,d,!1,l)}function _c(t,e,i,n,o,s,r,a,l){const h=s/2,c=bc(t);let u=0,d=e-i,f=[];for(let e=0;e<t.length-1;e++){const r=t[e],a=t[e+1],p=r.dist(a),m=a.angleTo(r);for(;d+i<u+p;){d+=i;const g=(d-u)/p,b=Le.number(r.x,a.x,g),v=Le.number(r.y,a.y,g);if(b>=0&&b<l&&v>=0&&v<l&&d-h>=0&&d+h<=c){const i=new mc(b,v,m,e);i._round(),n&&!gc(t,i,s,n,o)||f.push(i)}}u+=p}return a||f.length||r||(f=_c(t,u/2,i,n,o,s,r,!0,l)),f}An("Anchor",mc);const kc=eh;function Mc(t,e,i,n){const s=[],r=t.image,a=r.pixelRatio,l=r.paddedRect.w-2*kc,h=r.paddedRect.h-2*kc,c=t.right-t.left,u=t.bottom-t.top,d=r.stretchX||[[0,l]],f=r.stretchY||[[0,h]],p=(t,e)=>t+e[1]-e[0],m=d.reduce(p,0),g=f.reduce(p,0),b=l-m,v=h-g;let w=0,y=m,x=0,_=g,k=0,M=b,z=0,S=v;if(r.content&&n){const t=r.content;w=zc(d,0,t[0]),x=zc(f,0,t[1]),y=zc(d,t[0],t[2]),_=zc(f,t[1],t[3]),k=t[0]-w,z=t[1]-x,M=t[2]-t[0]-y,S=t[3]-t[1]-_}const C=(n,s,l,h)=>{const d=Cc(n.stretch-w,y,c,t.left),f=Ec(n.fixed-k,M,n.stretch,m),p=Cc(s.stretch-x,_,u,t.top),b=Ec(s.fixed-z,S,s.stretch,g),v=Cc(l.stretch-w,y,c,t.left),C=Ec(l.fixed-k,M,l.stretch,m),E=Cc(h.stretch-x,_,u,t.top),A=Ec(h.fixed-z,S,h.stretch,g),I=new o(d,p),T=new o(v,p),P=new o(v,E),$=new o(d,E),F=new o(f/a,b/a),O=new o(C/a,A/a),D=e*Math.PI/180;if(D){const t=Math.sin(D),e=Math.cos(D),i=[e,-t,t,e];I._matMult(i),T._matMult(i),$._matMult(i),P._matMult(i)}const j=n.stretch+n.fixed,L=s.stretch+s.fixed;return{tl:I,tr:T,bl:$,br:P,tex:{x:r.paddedRect.x+kc+j,y:r.paddedRect.y+kc+L,w:l.stretch+l.fixed-j,h:h.stretch+h.fixed-L},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:F,pixelOffsetBR:O,minFontScaleX:M/a/c,minFontScaleY:S/a/u,isSDF:i}};if(n&&(r.stretchX||r.stretchY)){const t=Sc(d,b,m),e=Sc(f,v,g);for(let i=0;i<t.length-1;i++){const n=t[i],o=t[i+1];for(let t=0;t<e.length-1;t++)s.push(C(n,e[t],o,e[t+1]))}}else s.push(C({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:h+1}));return s}function zc(t,e,i){let n=0;for(const o of t)n+=Math.max(e,Math.min(i,o[1]))-Math.max(e,Math.min(i,o[0]));return n}function Sc(t,e,i){const n=[{fixed:-kc,stretch:0}];for(const[e,i]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(i-e)})}return n.push({fixed:e+kc,stretch:i}),n}function Cc(t,e,i,n){return t/e*i+n}function Ec(t,e,i,n){return t-e*i/n}class Ac{constructor(t,e,i,n,s,r,a,l,h,c){if(this.boxStartIndex=t.length,h){let t=r.top,e=r.bottom;const i=r.collisionPadding;i&&(t-=i[1],e+=i[3]);let n=e-t;n>0&&(n=Math.max(10,n),this.circleDiameter=n)}else{let h=r.top*a-l[0],u=r.bottom*a+l[2],d=r.left*a-l[3],f=r.right*a+l[1];const p=r.collisionPadding;if(p&&(d-=p[0]*a,h-=p[1]*a,f+=p[2]*a,u+=p[3]*a),c){const t=new o(d,h),e=new o(f,h),i=new o(d,u),n=new o(f,u),s=c*Math.PI/180;t._rotate(s),e._rotate(s),i._rotate(s),n._rotate(s),d=Math.min(t.x,e.x,i.x,n.x),f=Math.max(t.x,e.x,i.x,n.x),h=Math.min(t.y,e.y,i.y,n.y),u=Math.max(t.y,e.y,i.y,n.y)}t.emplaceBack(e.x,e.y,d,h,f,u,i,n,s)}this.boxEndIndex=t.length}}class Ic{constructor(t=[],e=Tc){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,n=e[t];for(;t>0;){const o=t-1>>1,s=e[o];if(i(n,s)>=0)break;e[t]=s,t=o}e[t]=n}_down(t){const{data:e,compare:i}=this,n=this.length>>1,o=e[t];for(;t<n;){let n=1+(t<<1),s=e[n];const r=n+1;if(r<this.length&&i(e[r],s)<0&&(n=r,s=e[r]),i(s,o)>=0)break;e[t]=s,t=n}e[t]=o}}function Tc(t,e){return t<e?-1:t>e?1:0}function Pc(t,e=1,i=!1){let n=1/0,s=1/0,r=-1/0,a=-1/0;const l=t[0];for(let t=0;t<l.length;t++){const e=l[t];(!t||e.x<n)&&(n=e.x),(!t||e.y<s)&&(s=e.y),(!t||e.x>r)&&(r=e.x),(!t||e.y>a)&&(a=e.y)}const h=Math.min(r-n,a-s);let c=h/2;const u=new Ic([],$c);if(0===h)return new o(n,s);for(let e=n;e<r;e+=h)for(let i=s;i<a;i+=h)u.push(new Fc(e+c,i+c,c,t));let d=function(t){let e=0,i=0,n=0;const o=t[0];for(let t=0,s=o.length,r=s-1;t<s;r=t++){const s=o[t],a=o[r],l=s.x*a.y-a.x*s.y;i+=(s.x+a.x)*l,n+=(s.y+a.y)*l,e+=3*l}return new Fc(i/e,n/e,0,t)}(t),f=u.length;for(;u.length;){const n=u.pop();(n.d>d.d||!d.d)&&(d=n,i&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,f)),n.max-d.d<=e||(c=n.h/2,u.push(new Fc(n.p.x-c,n.p.y-c,c,t)),u.push(new Fc(n.p.x+c,n.p.y-c,c,t)),u.push(new Fc(n.p.x-c,n.p.y+c,c,t)),u.push(new Fc(n.p.x+c,n.p.y+c,c,t)),f+=4)}return i&&(console.log(`num probes: ${f}`),console.log(`best distance: ${d.d}`)),d.p}function $c(t,e){return e.max-t.max}function Fc(t,e,i,n){this.p=new o(t,e),this.h=i,this.d=function(t,e){let i=!1,n=1/0;for(let o=0;o<e.length;o++){const s=e[o];for(let e=0,o=s.length,r=o-1;e<o;r=e++){const o=s[e],a=s[r];o.y>t.y!=a.y>t.y&&t.x<(a.x-o.x)*(t.y-o.y)/(a.y-o.y)+o.x&&(i=!i),n=Math.min(n,cr(t,o,a))}}return(i?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}var Oc;t.TextAnchorEnum=void 0,(Oc=t.TextAnchorEnum||(t.TextAnchorEnum={}))[Oc.center=1]="center",Oc[Oc.left=2]="left",Oc[Oc.right=3]="right",Oc[Oc.top=4]="top",Oc[Oc.bottom=5]="bottom",Oc[Oc["top-left"]=6]="top-left",Oc[Oc["top-right"]=7]="top-right",Oc[Oc["bottom-left"]=8]="bottom-left",Oc[Oc["bottom-right"]=9]="bottom-right";const Dc=7,jc=Number.POSITIVE_INFINITY;function Lc(t,e){return e[1]!==jc?function(t,e,i){let n=0,o=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":o=i-Dc;break;case"bottom-right":case"bottom-left":case"bottom":o=-i+Dc}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,o]}(t,e[0],e[1]):function(t,e){let i=0,n=0;e<0&&(e=0);const o=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=o-Dc;break;case"bottom-right":case"bottom-left":n=-o+Dc;break;case"bottom":n=-e+Dc;break;case"top":n=e-Dc}switch(t){case"top-right":case"bottom-right":i=-o;break;case"top-left":case"bottom-left":i=o;break;case"left":i=e;break;case"right":i=-e}return[i,n]}(t,e[0])}function Rc(t,e,i){var n;const o=t.layout,s=null===(n=o.get("text-variable-anchor-offset"))||void 0===n?void 0:n.evaluate(e,{},i);if(s){const t=s.values,e=[];for(let i=0;i<t.length;i+=2){const n=e[i]=t[i],o=t[i+1].map((t=>t*zl));n.startsWith("top")?o[1]-=Dc:n.startsWith("bottom")&&(o[1]+=Dc),e[i+1]=o}return new Xt(e)}const r=o.get("text-variable-anchor");if(r){let n;n=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[o.get("text-radial-offset").evaluate(e,{},i)*zl,jc]:o.get("text-offset").evaluate(e,{},i).map((t=>t*zl));const s=[];for(const t of r)s.push(t,Lc(t,n));return new Xt(s)}return null}function Nc(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Bc(e,i,n,o,s,r,a,l,h,c,u){let d=r.textMaxSize.evaluate(i,{});void 0===d&&(d=a);const f=e.layers[0].layout,p=f.get("icon-offset").evaluate(i,{},u),m=qc(n.horizontal),g=a/24,b=e.tilePixelRatio*g,w=e.tilePixelRatio*d/24,y=e.tilePixelRatio*l,x=e.tilePixelRatio*f.get("symbol-spacing"),_=f.get("text-padding")*e.tilePixelRatio,k=function(t,e,i,n=1){const o=t.get("icon-padding").evaluate(e,{},i),s=o&&o.values;return[s[0]*n,s[1]*n,s[2]*n,s[3]*n]}(f,i,u,e.tilePixelRatio),M=f.get("text-max-angle")/180*Math.PI,z="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),S="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),C=f.get("symbol-placement"),E=x/2,A=f.get("icon-text-fit");let I;o&&"none"!==A&&(e.allowVerticalPlacement&&n.vertical&&(I=yh(o,n.vertical,A,f.get("icon-text-fit-padding"),p,g)),m&&(o=yh(o,m,A,f.get("icon-text-fit-padding"),p,g)));const T=(l,d)=>{d.x<0||d.x>=Hs||d.y<0||d.y>=Hs||function(e,i,n,o,s,r,a,l,h,c,u,d,f,p,m,g,b,w,y,x,_,k,M,z,S){const C=e.addToLineVertexArray(i,n);let E,A,I,T,P=0,$=0,F=0,O=0,D=-1,j=-1;const L={};let R=Is("");if(e.allowVerticalPlacement&&o.vertical){const t=l.layout.get("text-rotate").evaluate(_,{},z)+90;I=new Ac(h,i,c,u,d,o.vertical,f,p,m,t),a&&(T=new Ac(h,i,c,u,d,a,b,w,m,t))}if(s){const n=l.layout.get("icon-rotate").evaluate(_,{}),o="none"!==l.layout.get("icon-text-fit"),r=Mc(s,n,M,o),f=a?Mc(a,n,M,o):void 0;A=new Ac(h,i,c,u,d,s,b,w,!1,n),P=4*r.length;const p=e.iconSizeData;let m=null;"source"===p.kind?(m=[_h*l.layout.get("icon-size").evaluate(_,{})],m[0]>kh&&v(`${e.layerIds[0]}: Value for "icon-size" is >= ${xh}. Reduce your "icon-size".`)):"composite"===p.kind&&(m=[_h*k.compositeIconSizes[0].evaluate(_,{},z),_h*k.compositeIconSizes[1].evaluate(_,{},z)],(m[0]>kh||m[1]>kh)&&v(`${e.layerIds[0]}: Value for "icon-size" is >= ${xh}. Reduce your "icon-size".`)),e.addSymbols(e.icon,r,m,x,y,_,t.WritingMode.none,i,C.lineStartIndex,C.lineLength,-1,z),D=e.icon.placedSymbolArray.length-1,f&&($=4*f.length,e.addSymbols(e.icon,f,m,x,y,_,t.WritingMode.vertical,i,C.lineStartIndex,C.lineLength,-1,z),j=e.icon.placedSymbolArray.length-1)}const N=Object.keys(o.horizontal);for(const n of N){const s=o.horizontal[n];if(!E){R=Is(s.text);const t=l.layout.get("text-rotate").evaluate(_,{},z);E=new Ac(h,i,c,u,d,s,f,p,m,t)}const a=1===s.positionedLines.length;if(F+=Uc(e,i,s,r,l,m,_,g,C,o.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,a?N:[n],L,D,k,z),a)break}o.vertical&&(O+=Uc(e,i,o.vertical,r,l,m,_,g,C,t.WritingMode.vertical,["vertical"],L,j,k,z));const B=E?E.boxStartIndex:e.collisionBoxArray.length,U=E?E.boxEndIndex:e.collisionBoxArray.length,q=I?I.boxStartIndex:e.collisionBoxArray.length,V=I?I.boxEndIndex:e.collisionBoxArray.length,G=A?A.boxStartIndex:e.collisionBoxArray.length,Z=A?A.boxEndIndex:e.collisionBoxArray.length,W=T?T.boxStartIndex:e.collisionBoxArray.length,J=T?T.boxEndIndex:e.collisionBoxArray.length;let X=-1;const H=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;X=H(E,X),X=H(I,X),X=H(A,X),X=H(T,X);const K=X>-1?1:0;K&&(X*=S/zl),e.glyphOffsetArray.length>=$h.MAX_GLYPHS&&v("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==_.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,_.sortKey);const Y=Rc(l,_,z),[Q,tt]=function(e,i){const n=e.length,o=null==i?void 0:i.values;if((null==o?void 0:o.length)>0)for(let i=0;i<o.length;i+=2){const n=o[i+1];e.emplaceBack(t.TextAnchorEnum[o[i]],n[0],n[1])}return[n,e.length]}(e.textAnchorOffsets,Y);e.symbolInstances.emplaceBack(i.x,i.y,L.right>=0?L.right:-1,L.center>=0?L.center:-1,L.left>=0?L.left:-1,L.vertical||-1,D,j,R,B,U,q,V,G,Z,W,J,c,F,O,P,$,K,0,f,X,Q,tt)}(e,d,l,n,o,s,I,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,b,[_,_,_,_],z,h,y,k,S,p,i,r,c,u,a)};if("line"===C)for(const t of pc(i.geometry,0,0,Hs,Hs)){const i=xc(t,x,M,n.vertical||m,o,24,w,e.overscaling,Hs);for(const n of i)m&&Vc(e,m.text,E,n)||T(t,n)}else if("line-center"===C){for(const t of i.geometry)if(t.length>1){const e=yc(t,M,n.vertical||m,o,24,w);e&&T(t,e)}}else if("Polygon"===i.type)for(const t of _a(i.geometry,0)){const e=Pc(t,16);T(t[0],new mc(e.x,e.y,0))}else if("LineString"===i.type)for(const t of i.geometry)T(t,new mc(t[0].x,t[0].y,0));else if("Point"===i.type)for(const t of i.geometry)for(const e of t)T([e],new mc(e.x,e.y,0))}function Uc(t,e,i,n,s,r,a,l,h,c,u,d,f,p,m){const g=function(t,e,i,n,s,r,a,l){const h=n.layout.get("text-rotate").evaluate(r,{})*Math.PI/180,c=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const r=n.rect||{};let u=Ql+1,d=!0,f=1,p=0;const m=(s||l)&&n.vertical,g=n.metrics.advance*n.scale/2;if(l&&e.verticalizable&&(p=t.lineOffset/2-(n.imageName?-(zl-n.metrics.width*n.scale)/2:(n.scale-1)*zl)),n.imageName){const t=a[n.imageName];d=t.sdf,f=t.pixelRatio,u=eh/f}const b=s?[n.x+g,n.y]:[0,0];let v=s?[0,0]:[n.x+g+i[0],n.y+i[1]-p],w=[0,0];m&&(w=v,v=[0,0]);const y=(n.metrics.left-u)*n.scale-g+v[0],x=(-n.metrics.top-u)*n.scale+v[1],_=y+r.w*n.scale/f,k=x+r.h*n.scale/f,M=new o(y,x),z=new o(_,x),S=new o(y,k),C=new o(_,k);if(m){const t=new o(-g,g-sh),e=-Math.PI/2,i=zl/2-g,s=new o(5-sh-i,-(n.imageName?i:0)),r=new o(...w);M._rotateAround(e,t)._add(s)._add(r),z._rotateAround(e,t)._add(s)._add(r),S._rotateAround(e,t)._add(s)._add(r),C._rotateAround(e,t)._add(s)._add(r)}if(h){const t=Math.sin(h),e=Math.cos(h),i=[e,-t,t,e];M._matMult(i),z._matMult(i),S._matMult(i),C._matMult(i)}const E=new o(0,0),A=new o(0,0);c.push({tl:M,tr:z,bl:S,br:C,tex:r,writingMode:e.writingMode,glyphOffset:b,sectionIndex:n.sectionIndex,isSDF:d,pixelOffsetTL:E,pixelOffsetBR:A,minFontScaleX:0,minFontScaleY:0})}return c}(0,i,l,s,r,a,n,t.allowVerticalPlacement),b=t.textSizeData;let w=null;"source"===b.kind?(w=[_h*s.layout.get("text-size").evaluate(a,{})],w[0]>kh&&v(`${t.layerIds[0]}: Value for "text-size" is >= ${xh}. Reduce your "text-size".`)):"composite"===b.kind&&(w=[_h*p.compositeTextSizes[0].evaluate(a,{},m),_h*p.compositeTextSizes[1].evaluate(a,{},m)],(w[0]>kh||w[1]>kh)&&v(`${t.layerIds[0]}: Value for "text-size" is >= ${xh}. Reduce your "text-size".`)),t.addSymbols(t.text,g,w,l,r,a,c,e,h.lineStartIndex,h.lineLength,f,m);for(const e of u)d[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function qc(t){for(const e in t)return t[e];return null}function Vc(t,e,i,n){const o=t.compareText;if(e in o){const t=o[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<i)return!0}else o[e]=[];return o[e].push(n),!1}const Gc=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Zc{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,i]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const n=i>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const o=Gc[15&i];if(!o)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[r]=new Uint32Array(t,4,1);return new Zc(r,s,o,t)}constructor(t,e=64,i=Float64Array,n){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const o=Gc.indexOf(this.ArrayType),s=2*t*this.ArrayType.BYTES_PER_ELEMENT,r=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-r%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${i}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+r+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+s+r+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+r+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+o]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=e,i}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Wc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:s,nodeSize:r}=this,a=[0,o.length-1,0],l=[];for(;a.length;){const h=a.pop()||0,c=a.pop()||0,u=a.pop()||0;if(c-u<=r){for(let r=u;r<=c;r++){const a=s[2*r],h=s[2*r+1];a>=t&&a<=i&&h>=e&&h<=n&&l.push(o[r])}continue}const d=u+c>>1,f=s[2*d],p=s[2*d+1];f>=t&&f<=i&&p>=e&&p<=n&&l.push(o[d]),(0===h?t<=f:e<=p)&&(a.push(u),a.push(d-1),a.push(1-h)),(0===h?i>=f:n>=p)&&(a.push(d+1),a.push(c),a.push(1-h))}return l}within(t,e,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:s}=this,r=[0,n.length-1,0],a=[],l=i*i;for(;r.length;){const h=r.pop()||0,c=r.pop()||0,u=r.pop()||0;if(c-u<=s){for(let i=u;i<=c;i++)Kc(o[2*i],o[2*i+1],t,e)<=l&&a.push(n[i]);continue}const d=u+c>>1,f=o[2*d],p=o[2*d+1];Kc(f,p,t,e)<=l&&a.push(n[d]),(0===h?t-i<=f:e-i<=p)&&(r.push(u),r.push(d-1),r.push(1-h)),(0===h?t+i>=f:e+i>=p)&&(r.push(d+1),r.push(c),r.push(1-h))}return a}}function Wc(t,e,i,n,o,s){if(o-n<=i)return;const r=n+o>>1;Jc(t,e,r,n,o,s),Wc(t,e,i,n,r-1,1-s),Wc(t,e,i,r+1,o,1-s)}function Jc(t,e,i,n,o,s){for(;o>n;){if(o-n>600){const r=o-n+1,a=i-n+1,l=Math.log(r),h=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*h*(r-h)/r)*(a-r/2<0?-1:1);Jc(t,e,i,Math.max(n,Math.floor(i-a*h/r+c)),Math.min(o,Math.floor(i+(r-a)*h/r+c)),s)}const r=e[2*i+s];let a=n,l=o;for(Xc(t,e,n,i),e[2*o+s]>r&&Xc(t,e,n,o);a<l;){for(Xc(t,e,a,l),a++,l--;e[2*a+s]<r;)a++;for(;e[2*l+s]>r;)l--}e[2*n+s]===r?Xc(t,e,n,l):(l++,Xc(t,e,l,o)),l<=i&&(n=l+1),i<=l&&(o=l-1)}}function Xc(t,e,i,n){Hc(t,i,n),Hc(e,2*i,2*n),Hc(e,2*i+1,2*n+1)}function Hc(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Kc(t,e,i,n){const o=t-i,s=e-n;return o*o+s*s}var Yc;t.PerformanceMarkers=void 0,(Yc=t.PerformanceMarkers||(t.PerformanceMarkers={})).create="create",Yc.load="load",Yc.fullLoad="fullLoad";let Qc=null,tu=[];const eu=1e3/60,iu="loadTime",nu="fullLoadTime",ou={mark(t){performance.mark(t)},frame(t){const e=t;null!=Qc&&tu.push(e-Qc),Qc=e},clearMetrics(){Qc=null,tu=[],performance.clearMeasures(iu),performance.clearMeasures(nu);for(const e in t.PerformanceMarkers)performance.clearMarks(t.PerformanceMarkers[e])},getPerformanceMetrics(){performance.measure(iu,t.PerformanceMarkers.create,t.PerformanceMarkers.load),performance.measure(nu,t.PerformanceMarkers.create,t.PerformanceMarkers.fullLoad);const e=performance.getEntriesByName(iu)[0].duration,i=performance.getEntriesByName(nu)[0].duration,n=tu.length,o=1/(tu.reduce(((t,e)=>t+e),0)/n/1e3),s=tu.filter((t=>t>eu)).reduce(((t,e)=>t+(e-eu)/eu),0);return{loadTime:e,fullLoadTime:i,fps:o,percentDroppedFrames:s/(n+s)*100,totalFrames:n}}};t.AJAXError=I,t.ARRAY_TYPE=xr,t.Actor=class{constructor(t,e,i){this.receive=t=>{const e=t.data,i=e.id;if(i&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[i];const t=this.cancelCallbacks[i];delete this.cancelCallbacks[i],t&&t()}else x()||e.mustQueue?(this.tasks[i]=e,this.taskQueue.push(i),this.invoker.trigger()):this.processTask(i,e)},this.process=()=>{if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)},this.target=t,this.parent=e,this.mapId=i,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new Zh(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=x()?t:window}send(t,e,i,n,o=!1){const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(this.callbacks[s]=i);const r=k(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:t,hasCallback:!!i,targetMapId:n,mustQueue:o,sourceMapId:this.mapId,data:Tn(e,r)},r),{cancel:()=>{i&&delete this.callbacks[s],this.target.postMessage({id:s,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}processTask(t,e){if("<response>"===e.type){const i=this.callbacks[t];delete this.callbacks[t],i&&(e.error?i(Pn(e.error)):i(null,Pn(e.data)))}else{let i=!1;const n=k(this.globalScope)?void 0:[],o=e.hasCallback?(e,o)=>{i=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?Tn(e):null,data:Tn(o,n)},n)}:t=>{i=!0};let s=null;const r=Pn(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,r,o);else if(this.parent.getWorkerSource){const t=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,t[0],r.source)[t[1]](r,o)}else o(new Error(`Could not find function ${e.type}`));!i&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},t.AlphaImage=Or,t.CanonicalTileID=nc,t.CollisionBoxArray=Jo,t.CollisionCircleLayoutArray=class extends Do{},t.Color=qt,t.DEMData=ac,t.DataConstantProperty=co,t.DictionaryCoder=lc,t.EXTENT=Hs,t.ErrorEvent=N,t.EvaluationParameters=eo,t.Event=R,t.Evented=B,t.FeatureIndex=cc,t.FillBucket=Sa,t.FillExtrusionBucket=Xa,t.GeoJSONFeature=hc,t.ImageAtlas=nh,t.ImagePosition=ih,t.KDBush=Zc,t.LineBucket=cl,t.LineStripIndexArray=class extends Go{},t.LngLat=Jh,t.MercatorCoordinate=ec,t.ONE_EM=zl,t.OverscaledTileID=sc,t.PerformanceUtils=ou,t.Point=o,t.Pos3dArray=class extends zo{},t.PosArray=ss,t.Properties=go,t.Protobuf=Jl,t.QuadTriangleArray=class extends Lo{},t.RGBAImage=Dr,t.RasterBoundsArray=class extends So{},t.RequestPerformance=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.SegmentVector=xs,t.SymbolBucket=$h,t.Transitionable=oo,t.TriangleIndexArray=bs,t.Uniform1f=Ds,t.Uniform1i=class extends Os{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.Uniform2f=class extends Os{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},t.Uniform3f=class extends Os{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},t.Uniform4f=js,t.UniformColor=Ls,t.UniformMatrix4f=class extends Os{constructor(t,e){super(t,e),this.current=Rs}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.UnwrappedTileID=oc,t.ValidationError=tt,t.ZoomHistory=$n,t.addDynamicAttributes=Ah,t.arrayBufferToImage=function(t,e){const i=new Image;i.onload=()=>{e(null,i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame((()=>{i.src=z}))},i.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const n=new Blob([new Uint8Array(t)],{type:"image/png"});i.src=t.byteLength?URL.createObjectURL(n):z},t.arrayBufferToImageBitmap=function(t,e){const i=new Blob([new Uint8Array(t)],{type:"image/png"});createImageBitmap(i).then((t=>{e(null,t)})).catch((t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))},t.asyncAll=function(t,e,i){if(!t.length)return i(null,[]);let n=t.length;const o=new Array(t.length);let s=null;t.forEach(((t,r)=>{e(t,((t,e)=>{t&&(s=t),o[r]=e,0==--n&&i(s,o)}))}))},t.bezier=l,t.browser=E,t.clamp=c,t.clipLine=pc,t.clone=function(t){var e=new xr(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=g,t.collisionCircleLayout=_l,t.config=A,t.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.create=function(){var t=new xr(16);return xr!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.createExpression=Ai,t.createFilter=ji,t.createLayout=_o,t.createStyleLayer=function(t){if("custom"===t.type)return new Gh(t);switch(t.type){case"background":return new Bh(t);case"circle":return new Cr(t);case"fill":return new Ia(t);case"fill-extrusion":return new tl(t);case"heatmap":return new Lr(t);case"hillshade":return new Br(t);case"line":return new gl(t);case"raster":return new Vh(t);case"symbol":return new Lh(t)}},t.deepEqual=function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let n=0;n<e.length;n++)if(!t(e[n],i[n]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(e).length!==Object.keys(i).length)return!1;for(const n in e)if(!t(e[n],i[n]))return!1;return!0}return e===i},t.defaultEasing=h,t.derefLayers=function(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=V(t[i],e[t[i].ref]));return t},t.diffStyles=function(t,e){if(!t)return[{command:Z.setStyle,args:[e]}];let i=[];try{if(!G(t.version,e.version))return[{command:Z.setStyle,args:[e]}];G(t.center,e.center)||i.push({command:Z.setCenter,args:[e.center]}),G(t.zoom,e.zoom)||i.push({command:Z.setZoom,args:[e.zoom]}),G(t.bearing,e.bearing)||i.push({command:Z.setBearing,args:[e.bearing]}),G(t.pitch,e.pitch)||i.push({command:Z.setPitch,args:[e.pitch]}),G(t.sprite,e.sprite)||i.push({command:Z.setSprite,args:[e.sprite]}),G(t.glyphs,e.glyphs)||i.push({command:Z.setGlyphs,args:[e.glyphs]}),G(t.transition,e.transition)||i.push({command:Z.setTransition,args:[e.transition]}),G(t.light,e.light)||i.push({command:Z.setLight,args:[e.light]});const n={},o=[];!function(t,e,i,n){let o;for(o in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,o)&&(Object.prototype.hasOwnProperty.call(e,o)||J(o,i,n));for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&(Object.prototype.hasOwnProperty.call(t,o)?G(t[o],e[o])||("geojson"===t[o].type&&"geojson"===e[o].type&&H(t,e,o)?i.push({command:Z.setGeoJSONSourceData,args:[o,e[o].data]}):X(o,e,i,n)):W(o,e,i))}(t.sources,e.sources,o,n);const s=[];t.layers&&t.layers.forEach((t=>{n[t.source]?i.push({command:Z.removeLayer,args:[t.id]}):s.push(t)})),i=i.concat(o),function(t,e,i){e=e||[];const n=(t=t||[]).map(Y),o=e.map(Y),s=t.reduce(Q,{}),r=e.reduce(Q,{}),a=n.slice(),l=Object.create(null);let h,c,u,d,f,p,m;for(h=0,c=0;h<n.length;h++)u=n[h],Object.prototype.hasOwnProperty.call(r,u)?c++:(i.push({command:Z.removeLayer,args:[u]}),a.splice(a.indexOf(u,c),1));for(h=0,c=0;h<o.length;h++)u=o[o.length-1-h],a[a.length-1-h]!==u&&(Object.prototype.hasOwnProperty.call(s,u)?(i.push({command:Z.removeLayer,args:[u]}),a.splice(a.lastIndexOf(u,a.length-c),1)):c++,p=a[a.length-h],i.push({command:Z.addLayer,args:[r[u],p]}),a.splice(a.length-h,0,u),l[u]=!0);for(h=0;h<o.length;h++)if(u=o[h],d=s[u],f=r[u],!l[u]&&!G(d,f))if(G(d.source,f.source)&&G(d["source-layer"],f["source-layer"])&&G(d.type,f.type)){for(m in K(d.layout,f.layout,i,u,null,Z.setLayoutProperty),K(d.paint,f.paint,i,u,null,Z.setPaintProperty),G(d.filter,f.filter)||i.push({command:Z.setFilter,args:[u,f.filter]}),G(d.minzoom,f.minzoom)&&G(d.maxzoom,f.maxzoom)||i.push({command:Z.setLayerZoomRange,args:[u,f.minzoom,f.maxzoom]}),d)Object.prototype.hasOwnProperty.call(d,m)&&"layout"!==m&&"paint"!==m&&"filter"!==m&&"metadata"!==m&&"minzoom"!==m&&"maxzoom"!==m&&(0===m.indexOf("paint.")?K(d[m],f[m],i,u,m.slice(6),Z.setPaintProperty):G(d[m],f[m])||i.push({command:Z.setLayerProperty,args:[u,m,f[m]]}));for(m in f)Object.prototype.hasOwnProperty.call(f,m)&&!Object.prototype.hasOwnProperty.call(d,m)&&"layout"!==m&&"paint"!==m&&"filter"!==m&&"metadata"!==m&&"minzoom"!==m&&"maxzoom"!==m&&(0===m.indexOf("paint.")?K(d[m],f[m],i,u,m.slice(6),Z.setPaintProperty):G(d[m],f[m])||i.push({command:Z.setLayerProperty,args:[u,m,f[m]]}))}else i.push({command:Z.removeLayer,args:[u]}),p=a[a.lastIndexOf(u)+1],i.push({command:Z.addLayer,args:[f,p]})}(s,e.layers,i)}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:Z.setStyle,args:[e]}]}return i},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.earthRadius=Wh,t.emitValidationErrors=Sn,t.emptyStyle=function(){const t={},e=U.$version;for(const i in U.$root){const n=U.$root[i];if(n.required){let o=null;o="version"===i?e:"array"===n.type?[]:{},null!=o&&(t[i]=o)}}return t},t.equals=function(t,e){var i=t[0],n=t[1],o=t[2],s=t[3],r=t[4],a=t[5],l=t[6],h=t[7],c=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13],g=t[14],b=t[15],v=e[0],w=e[1],y=e[2],x=e[3],_=e[4],k=e[5],M=e[6],z=e[7],S=e[8],C=e[9],E=e[10],A=e[11],I=e[12],T=e[13],P=e[14],$=e[15];return Math.abs(i-v)<=yr*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(n-w)<=yr*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(o-y)<=yr*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(s-x)<=yr*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(r-_)<=yr*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(a-k)<=yr*Math.max(1,Math.abs(a),Math.abs(k))&&Math.abs(l-M)<=yr*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(h-z)<=yr*Math.max(1,Math.abs(h),Math.abs(z))&&Math.abs(c-S)<=yr*Math.max(1,Math.abs(c),Math.abs(S))&&Math.abs(u-C)<=yr*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(d-E)<=yr*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(f-A)<=yr*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(p-I)<=yr*Math.max(1,Math.abs(p),Math.abs(I))&&Math.abs(m-T)<=yr*Math.max(1,Math.abs(m),Math.abs(T))&&Math.abs(g-P)<=yr*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(b-$)<=yr*Math.max(1,Math.abs(b),Math.abs($))},t.evaluateSizeForFeature=function(t,{uSize:e,uSizeT:i},{lowerSize:n,upperSize:o}){return"source"===t.kind?n/_h:"composite"===t.kind?Le.number(n/_h,o/_h,i):e},t.evaluateSizeForZoom=function(t,e){let i=0,n=0;if("constant"===t.kind)n=t.layoutSize;else if("source"!==t.kind){const{interpolationType:o,minZoom:s,maxZoom:r}=t,a=o?c(Re.interpolationFactor(o,e,s,r),0,1):0;"camera"===t.kind?n=Le.number(t.minSize,t.maxSize,a):i=a}return{uSizeT:i,uSize:n}},t.evented=Kn,t.extend=d,t.filterObject=m,t.findLineIntersection=function(t,e,i,n){const s=e.y-t.y,r=e.x-t.x,a=n.y-i.y,l=n.x-i.x,h=a*r-l*s;if(0===h)return null;const c=(l*(t.y-i.y)-a*(t.x-i.x))/h;return new o(t.x+c*r,t.y+c*s)},t.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.getAnchorAlignment=bh,t.getAnchorJustification=Nc,t.getArrayBuffer=O,t.getDefaultExportFromCjs=e,t.getJSON=function(t,e){return F(d(t,{type:"json"}),e)},t.getOverlapMode=zh,t.getProtocolAction=P,t.getRTLTextPluginStatus=Yn,t.getReferrer=T,t.getVideo=function(t,e){const i=window.document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let e=0;e<t.length;e++){const n=window.document.createElement("source");D(t[e])||(i.crossOrigin="Anonymous"),n.src=t[e],i.appendChild(n)}return{cancel:()=>{}}},t.groupByLayout=function(t,e){const i={};for(let n=0;n<t.length;n++){const o=e&&e[t[n].id]||Zi(t[n]);e&&(e[t[n].id]=o);let s=i[o];s||(s=i[o]=[]),s.push(t[n])}const n=[];for(const t in i)n.push(i[t]);return n},t.identity=_r,t.interpolate=Le,t.invert=function(t,e){var i=e[0],n=e[1],o=e[2],s=e[3],r=e[4],a=e[5],l=e[6],h=e[7],c=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],g=e[14],b=e[15],v=i*a-n*r,w=i*l-o*r,y=i*h-s*r,x=n*l-o*a,_=n*h-s*a,k=o*h-s*l,M=c*m-u*p,z=c*g-d*p,S=c*b-f*p,C=u*g-d*m,E=u*b-f*m,A=d*b-f*g,I=v*A-w*E+y*C+x*S-_*z+k*M;return I?(t[0]=(a*A-l*E+h*C)*(I=1/I),t[1]=(o*E-n*A-s*C)*I,t[2]=(m*k-g*_+b*x)*I,t[3]=(d*_-u*k-f*x)*I,t[4]=(l*S-r*A-h*z)*I,t[5]=(i*A-o*S+s*z)*I,t[6]=(g*y-p*k-b*w)*I,t[7]=(c*k-d*y+f*w)*I,t[8]=(r*E-a*S+h*M)*I,t[9]=(n*S-i*E-s*M)*I,t[10]=(p*_-m*y+b*v)*I,t[11]=(u*y-c*_-f*v)*I,t[12]=(a*z-r*C-l*M)*I,t[13]=(i*C-n*z+o*M)*I,t[14]=(m*w-p*x-g*v)*I,t[15]=(c*x-u*w+d*v)*I,t):null},t.isImageBitmap=M,t.isSafari=k,t.isWorker=x,t.keysDifference=function(t,e){const i=[];for(const n in t)n in e||i.push(n);return i},t.lazyLoadRTLTextPlugin=function(){to.isLoading()||to.isLoaded()||"deferred"!==Yn()||Qn()},t.makeRequest=F,t.mapObject=p,t.mercatorXfromLng=Kh,t.mercatorYfromLat=Yh,t.mercatorZfromAltitude=Qh,t.mul=zr,t.mul$1=function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t},t.multiply=kr,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.operations=Z,t.ortho=function(t,e,i,n,o,s,r){var a=1/(e-i),l=1/(n-o),h=1/(s-r);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+i)*a,t[13]=(o+n)*l,t[14]=(r+s)*h,t[15]=1,t},t.parseCacheControl=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,i,n,o)=>{const s=n||o;return e[i]=!s||s.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e},t.parseGlyphPbf=function(t){return new Jl(t).readFields(Hl,[])},t.pbf=Sl,t.performSymbolLayout=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=Hs/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const i=e.bucket.layers[0],n=i.layout,o=i._unevaluatedLayout._values,s={layoutIconSize:o["icon-size"].possiblyEvaluate(new eo(e.bucket.zoom+1),e.canonical),layoutTextSize:o["text-size"].possiblyEvaluate(new eo(e.bucket.zoom+1),e.canonical),textMaxSize:o["text-size"].possiblyEvaluate(new eo(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.textSizeData;s.compositeTextSizes=[o["text-size"].possiblyEvaluate(new eo(t),e.canonical),o["text-size"].possiblyEvaluate(new eo(i),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.iconSizeData;s.compositeIconSizes=[o["icon-size"].possiblyEvaluate(new eo(t),e.canonical),o["icon-size"].possiblyEvaluate(new eo(i),e.canonical)]}const r=n.get("text-line-height")*zl,a="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement"),l=n.get("text-keep-upright"),h=n.get("text-size");for(const o of e.bucket.features){const c=n.get("text-font").evaluate(o,{},e.canonical).join(","),u=h.evaluate(o,{},e.canonical),d=s.layoutTextSize.evaluate(o,{},e.canonical),f=s.layoutIconSize.evaluate(o,{},e.canonical),p={horizontal:{},vertical:void 0},m=o.text;let g,b=[0,0];if(m){const s=m.toString(),h=n.get("text-letter-spacing").evaluate(o,{},e.canonical)*zl,f=Dn(s)?h:0,g=n.get("text-anchor").evaluate(o,{},e.canonical),v=Rc(i,o,e.canonical);if(!v){const t=n.get("text-radial-offset").evaluate(o,{},e.canonical);b=t?Lc(g,[t*zl,jc]):n.get("text-offset").evaluate(o,{},e.canonical).map((t=>t*zl))}let w=a?"center":n.get("text-justify").evaluate(o,{},e.canonical);const y=n.get("symbol-placement"),x="point"===y?n.get("text-max-width").evaluate(o,{},e.canonical)*zl:0,_=()=>{e.bucket.allowVerticalPlacement&&On(s)&&(p.vertical=lh(m,e.glyphMap,e.glyphPositions,e.imagePositions,c,x,r,g,"left",f,b,t.WritingMode.vertical,!0,y,d,u))};if(!a&&v){const i=new Set;if("auto"===w)for(let t=0;t<v.values.length;t+=2)i.add(Nc(v.values[t]));else i.add(w);let n=!1;for(const o of i)if(!p.horizontal[o])if(n)p.horizontal[o]=p.horizontal[0];else{const i=lh(m,e.glyphMap,e.glyphPositions,e.imagePositions,c,x,r,"center",o,f,b,t.WritingMode.horizontal,!1,y,d,u);i&&(p.horizontal[o]=i,n=1===i.positionedLines.length)}_()}else{"auto"===w&&(w=Nc(g));const i=lh(m,e.glyphMap,e.glyphPositions,e.imagePositions,c,x,r,g,w,f,b,t.WritingMode.horizontal,!1,y,d,u);i&&(p.horizontal[w]=i),_(),On(s)&&a&&l&&(p.vertical=lh(m,e.glyphMap,e.glyphPositions,e.imagePositions,c,x,r,g,w,f,b,t.WritingMode.vertical,!1,y,d,u))}}let w=!1;if(o.icon&&o.icon.name){const t=e.imageMap[o.icon.name];t&&(g=wh(e.imagePositions[o.icon.name],n.get("icon-offset").evaluate(o,{},e.canonical),n.get("icon-anchor").evaluate(o,{},e.canonical)),w=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=w:e.bucket.sdfIcons!==w&&v("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.bucket.pixelRatio||0!==n.get("icon-rotate").constantOr(1))&&(e.bucket.iconsNeedLinear=!0))}const y=qc(p.horizontal)||p.vertical;e.bucket.iconsInText=!!y&&y.iconsInText,(y||g)&&Bc(e.bucket,o,p,g,e.imageMap,s,d,f,b,w,e.canonical)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()},t.perspective=function(t,e,i,n,o){var s,r=1/Math.tan(e/2);return t[0]=r/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(t[10]=(o+n)*(s=1/(n-o)),t[14]=2*o*n*s):(t[10]=-1,t[14]=-2*n),t},t.pick=function(t,e){const i={};for(let n=0;n<e.length;n++){const o=e[n];o in t&&(i[o]=t[o])}return i},t.plugin=to,t.pointGeometry=i,t.polygonIntersectsPolygon=nr,t.potpack=th,t.register=An,t.registerForPluginStateChange=function(t){return t({pluginStatus:Wn,pluginURL:Jn}),Kn.on("pluginStateChange",t),t},t.renderColorRamp=jr,t.rotateX=function(t,e,i){var n=Math.sin(i),o=Math.cos(i),s=e[4],r=e[5],a=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*o+h*n,t[5]=r*o+c*n,t[6]=a*o+u*n,t[7]=l*o+d*n,t[8]=h*o-s*n,t[9]=c*o-r*n,t[10]=u*o-a*n,t[11]=d*o-l*n,t},t.rotateZ=function(t,e,i){var n=Math.sin(i),o=Math.cos(i),s=e[0],r=e[1],a=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*o+h*n,t[1]=r*o+c*n,t[2]=a*o+u*n,t[3]=l*o+d*n,t[4]=h*o-s*n,t[5]=c*o-r*n,t[6]=u*o-a*n,t[7]=d*o-l*n,t},t.sameOrigin=D,t.scale=function(t,e,i){var n=i[0],o=i[1],s=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.setRTLTextPlugin=function(t,e,i=!1){if(Wn===qn||Wn===Vn||Wn===Gn)throw new Error("setRTLTextPlugin cannot be called multiple times.");Jn=E.resolveURL(t),Wn=qn,Zn=e,Hn(),i||Qn()},t.sphericalToCartesian=function([t,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(i),y:t*Math.sin(e)*Math.sin(i),z:t*Math.cos(i)}},t.toEvaluationFeature=tr,t.transformMat4=Sr,t.translate=function(t,e,i){var n,o,s,r,a,l,h,c,u,d,f,p,m=i[0],g=i[1],b=i[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*b+e[12],t[13]=e[1]*m+e[5]*g+e[9]*b+e[13],t[14]=e[2]*m+e[6]*g+e[10]*b+e[14],t[15]=e[3]*m+e[7]*g+e[11]*b+e[15]):(o=e[1],s=e[2],r=e[3],a=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],f=e[10],p=e[11],t[0]=n=e[0],t[1]=o,t[2]=s,t[3]=r,t[4]=a,t[5]=l,t[6]=h,t[7]=c,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=n*m+a*g+u*b+e[12],t[13]=o*m+l*g+d*b+e[13],t[14]=s*m+h*g+f*b+e[14],t[15]=r*m+c*g+p*b+e[15]),t},t.triggerPluginCompletionEvent=Xn,t.unicodeBlockLookup=Fn,t.uniqueId=function(){return f++},t.v8Spec=U,t.validateCustomStyleLayer=function(t){const e=[],i=t.id;return void 0===i&&e.push({message:`layers.${i}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},t.validateLight=kn,t.validateStyle=_n,t.vectorTile=Fa,t.warnOnce=v,t.wrap=u}));n(["./shared"],(function(t){class e{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,i){for(const i of e){this._layerConfigs[i.id]=i;const e=this._layers[i.id]=t.createStyleLayer(i);e._featureFilter=t.createFilter(e.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const t of i)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const n=t.groupByLayout(Object.values(this._layerConfigs),this.keyCache);for(const t of n){const e=t.map((t=>this._layers[t.id])),i=e[0];if("none"===i.visibility)continue;const n=i.source||"";let o=this.familiesBySource[n];o||(o=this.familiesBySource[n]={});const s=i.sourceLayer||"_geojsonTileLayer";let r=o[s];r||(r=o[s]=[]),r.push(e)}}}class i{constructor(e){const i={},n=[];for(const t in e){const o=e[t],s=i[t]={};for(const t in o){const e=o[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const i={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};n.push(i),s[t]={rect:i,metrics:e.metrics}}}const{w:o,h:s}=t.potpack(n),r=new t.AlphaImage({width:o||1,height:s||1});for(const n in e){const o=e[n];for(const e in o){const s=o[+e];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const a=i[n][e].rect;t.AlphaImage.copy(s.bitmap,r,{x:0,y:0},{x:a.x+1,y:a.y+1},s.bitmap)}}this.image=r,this.positions=i}}t.register("GlyphAtlas",i);class n{constructor(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(e,n,s,r,a){this.status="parsing",this.data=e,this.collisionBoxArray=new t.CollisionBoxArray;const l=new t.DictionaryCoder(Object.keys(e.layers).sort()),h=new t.FeatureIndex(this.tileID,this.promoteId);h.bucketLayerIDs=[];const c={},u={featureIndex:h,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:s},d=n.familiesBySource[this.source];for(const i in d){const n=e.layers[i];if(!n)continue;1===n.version&&t.warnOnce(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const r=l.encode(i),a=[];for(let t=0;t<n.length;t++){const e=n.feature(t),o=h.getId(e,i);a.push({feature:e,id:o,index:t,sourceLayerIndex:r})}for(const e of d[i]){const i=e[0];i.source!==this.source&&t.warnOnce(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"!==i.visibility&&(o(e,this.zoom,s),(c[i.id]=i.createBucket({index:h.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:r,sourceID:this.source})).populate(a,u,this.tileID.canonical),h.bucketLayerIDs.push(e.map((t=>t.id))))}}let f,p,m,g;const b=t.mapObject(u.glyphDependencies,(t=>Object.keys(t).map(Number)));this.inFlightDependencies.forEach((t=>null==t?void 0:t.cancel())),this.inFlightDependencies=[];const v=++this.dependencySentinel;Object.keys(b).length?this.inFlightDependencies.push(r.send("getGlyphs",{uid:this.uid,stacks:b,source:this.source,tileID:this.tileID,type:"glyphs"},((t,e)=>{v===this.dependencySentinel&&(f||(f=t,p=e,x.call(this)))}))):p={};const w=Object.keys(u.iconDependencies);w.length?this.inFlightDependencies.push(r.send("getImages",{icons:w,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{v===this.dependencySentinel&&(f||(f=t,m=e,x.call(this)))}))):m={};const y=Object.keys(u.patternDependencies);function x(){if(f)return a(f);if(p&&m&&g){const e=new i(p),n=new t.ImageAtlas(m,g);for(const i in c){const r=c[i];r instanceof t.SymbolBucket?(o(r.layers,this.zoom,s),t.performSymbolLayout({bucket:r,glyphMap:p,glyphPositions:e.positions,imageMap:m,imagePositions:n.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):r.hasPattern&&(r instanceof t.LineBucket||r instanceof t.FillBucket||r instanceof t.FillExtrusionBucket)&&(o(r.layers,this.zoom,s),r.addFeatures(u,this.tileID.canonical,n.patternPositions))}this.status="done",a(null,{buckets:Object.values(c).filter((t=>!t.isEmpty())),featureIndex:h,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:n,glyphMap:this.returnDependencies?p:null,iconMap:this.returnDependencies?m:null,glyphPositions:this.returnDependencies?e.positions:null})}}y.length?this.inFlightDependencies.push(r.send("getImages",{icons:y,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{v===this.dependencySentinel&&(f||(f=t,g=e,x.call(this)))}))):g={},x.call(this)}}function o(e,i,n){const o=new t.EvaluationParameters(i);for(const t of e)t.recalculate(o,n)}function s(e,i){const n=t.getArrayBuffer(e.request,((e,n,o,s)=>{e?i(e):n&&i(null,{vectorTile:new t.vectorTile.VectorTile(new t.Protobuf(n)),rawData:n,cacheControl:o,expires:s})}));return()=>{n.cancel(),i()}}class r{constructor(t,e,i,n){this.actor=t,this.layerIndex=e,this.availableImages=i,this.loadVectorData=n||s,this.fetching={},this.loading={},this.loaded={}}loadTile(e,i){const o=e.uid;this.loading||(this.loading={});const s=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),r=this.loading[o]=new n(e);r.abort=this.loadVectorData(e,((e,n)=>{if(delete this.loading[o],e||!n)return r.status="done",this.loaded[o]=r,i(e);const a=n.rawData,l={};n.expires&&(l.expires=n.expires),n.cacheControl&&(l.cacheControl=n.cacheControl);const h={};if(s){const t=s.finish();t&&(h.resourceTiming=JSON.parse(JSON.stringify(t)))}r.vectorTile=n.vectorTile,r.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,n)=>{if(delete this.fetching[o],e||!n)return i(e);i(null,t.extend({rawTileData:a.slice(0)},n,l,h))})),this.loaded=this.loaded||{},this.loaded[o]=r,this.fetching[o]={rawTileData:a,cacheControl:l,resourceTiming:h}}))}reloadTile(e,i){const n=this.loaded,o=e.uid;if(n&&n[o]){const s=n[o];s.showCollisionBoxes=e.showCollisionBoxes,"parsing"===s.status?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,n)=>{if(e||!n)return i(e,n);let s;if(this.fetching[o]){const{rawTileData:e,cacheControl:i,resourceTiming:r}=this.fetching[o];delete this.fetching[o],s=t.extend({rawTileData:e.slice(0)},n,i,r)}else s=n;i(null,s)})):"done"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,i):i())}}abortTile(t,e){const i=this.loading,n=t.uid;i&&i[n]&&i[n].abort&&(i[n].abort(),delete i[n]),e()}removeTile(t,e){const i=this.loaded,n=t.uid;i&&i[n]&&delete i[n],e()}}class a{constructor(){this.loaded={}}loadTile(e,i){const{uid:n,encoding:o,rawImageData:s}=e,r=t.isImageBitmap(s)?this.getImageData(s):s,a=new t.DEMData(n,r,o);this.loaded=this.loaded||{},this.loaded[n]=a,i(null,a)}getImageData(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const i=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:i.width,height:i.height},i.data)}removeTile(t){const e=this.loaded,i=t.uid;e&&e[i]&&delete e[i]}}function l(t,e){if(0!==t.length){h(t[0],e);for(var i=1;i<t.length;i++)h(t[i],!e)}}function h(t,e){for(var i=0,n=0,o=0,s=t.length,r=s-1;o<s;r=o++){var a=(t[o][0]-t[r][0])*(t[r][1]+t[o][1]),l=i+a;n+=Math.abs(i)>=Math.abs(a)?i-l+a:a-l+i,i=l}i+n>=0!=!!e&&t.reverse()}var c=t.getDefaultExportFromCjs((function t(e,i){var n,o=e&&e.type;if("FeatureCollection"===o)for(n=0;n<e.features.length;n++)t(e.features[n],i);else if("GeometryCollection"===o)for(n=0;n<e.geometries.length;n++)t(e.geometries[n],i);else if("Feature"===o)t(e.geometry,i);else if("Polygon"===o)l(e.coordinates,i);else if("MultiPolygon"===o)for(n=0;n<e.coordinates.length;n++)l(e.coordinates[n],i);return e}));const u=t.vectorTile.VectorTileFeature.prototype.toGeoJSON;var d={exports:{}},f=t.pointGeometry,p=t.vectorTile.VectorTileFeature,m=g;function g(t,e){this.options=e||{},this.features=t,this.length=t.length}function b(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}g.prototype.feature=function(t){return new b(this.features[t],this.options.extent)},b.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var i=t[e],n=[],o=0;o<i.length;o++)n.push(new f(i[o][0],i[o][1]));this.geometry.push(n)}return this.geometry},b.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,i=-1/0,n=1/0,o=-1/0,s=0;s<t.length;s++)for(var r=t[s],a=0;a<r.length;a++){var l=r[a];e=Math.min(e,l.x),i=Math.max(i,l.x),n=Math.min(n,l.y),o=Math.max(o,l.y)}return[e,n,i,o]},b.prototype.toGeoJSON=p.prototype.toGeoJSON;var v=t.pbf,w=m;function y(t){var e=new v;return function(t,e){for(var i in t.layers)e.writeMessage(3,x,t.layers[i])}(t,e),e.finish()}function x(t,e){var i;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<t.length;i++)n.feature=t.feature(i),e.writeMessage(2,_,n);var o=n.keys;for(i=0;i<o.length;i++)e.writeStringField(3,o[i]);var s=n.values;for(i=0;i<s.length;i++)e.writeMessage(4,C,s[i])}function _(t,e){var i=t.feature;void 0!==i.id&&e.writeVarintField(1,i.id),e.writeMessage(2,k,t),e.writeVarintField(3,i.type),e.writeMessage(4,S,i)}function k(t,e){var i=t.feature,n=t.keys,o=t.values,s=t.keycache,r=t.valuecache;for(var a in i.properties){var l=i.properties[a],h=s[a];if(null!==l){void 0===h&&(n.push(a),s[a]=h=n.length-1),e.writeVarint(h);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var u=c+":"+l,d=r[u];void 0===d&&(o.push(l),r[u]=d=o.length-1),e.writeVarint(d)}}}function M(t,e){return(e<<3)+(7&t)}function z(t){return t<<1^t>>31}function S(t,e){for(var i=t.loadGeometry(),n=t.type,o=0,s=0,r=i.length,a=0;a<r;a++){var l=i[a],h=1;1===n&&(h=l.length),e.writeVarint(M(1,h));for(var c=3===n?l.length-1:l.length,u=0;u<c;u++){1===u&&1!==n&&e.writeVarint(M(2,c-1));var d=l[u].x-o,f=l[u].y-s;e.writeVarint(z(d)),e.writeVarint(z(f)),o+=d,s+=f}3===n&&e.writeVarint(M(7,1))}}function C(t,e){var i=typeof t;"string"===i?e.writeStringField(1,t):"boolean"===i?e.writeBooleanField(7,t):"number"===i&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}d.exports=y,d.exports.fromVectorTileJs=y,d.exports.fromGeojsonVt=function(t,e){e=e||{};var i={};for(var n in t)i[n]=new w(t[n].features,e),i[n].name=n,i[n].version=e.version,i[n].extent=e.extent;return y({layers:i})},d.exports.GeoJSONWrapper=w;var E=t.getDefaultExportFromCjs(d.exports);const A={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},I=Math.fround||(T=new Float32Array(1),t=>(T[0]=+t,T[0]));var T;const P=3,$=5,F=6;class O{constructor(t){this.options=Object.assign(Object.create(A),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:i,maxZoom:n}=this.options;e&&console.time("total time");const o=`prepare ${t.length} points`;e&&console.time(o),this.points=t;const s=[];for(let e=0;e<t.length;e++){const i=t[e];if(!i.geometry)continue;const[n,o]=i.geometry.coordinates,r=I(L(n)),a=I(R(o));s.push(r,a,1/0,e,-1,1),this.options.reduce&&s.push(0)}let r=this.trees[n+1]=this._createTree(s);e&&console.timeEnd(o);for(let t=n;t>=i;t--){const i=+Date.now();r=this.trees[t]=this._createTree(this._cluster(r,t)),e&&console.log("z%d: %d clusters in %dms",t,r.numItems,+Date.now()-i)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let i=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let o=180===t[2]?180:((t[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,o=180;else if(i>o){const t=this.getClusters([i,n,180,s],e),r=this.getClusters([-180,n,o,s],e);return t.concat(r)}const r=this.trees[this._limitZoom(e)],a=r.range(L(i),R(s),L(o),R(n)),l=r.data,h=[];for(const t of a){const e=this.stride*t;h.push(l[e+$]>1?D(l,e,this.clusterProps):this.points[l[e+P]])}return h}getChildren(t){const e=this._getOriginId(t),i=this._getOriginZoom(t),n="No cluster with the specified id.",o=this.trees[i];if(!o)throw new Error(n);const s=o.data;if(e*this.stride>=s.length)throw new Error(n);const r=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=o.within(s[e*this.stride],s[e*this.stride+1],r),l=[];for(const e of a){const i=e*this.stride;s[i+4]===t&&l.push(s[i+$]>1?D(s,i,this.clusterProps):this.points[s[i+P]])}if(0===l.length)throw new Error(n);return l}getLeaves(t,e,i){const n=[];return this._appendLeaves(n,t,e=e||10,i=i||0,0),n}getTile(t,e,i){const n=this.trees[this._limitZoom(t)],o=Math.pow(2,t),{extent:s,radius:r}=this.options,a=r/s,l=(i-a)/o,h=(i+1+a)/o,c={features:[]};return this._addTileFeatures(n.range((e-a)/o,l,(e+1+a)/o,h),n.data,e,i,o,c),0===e&&this._addTileFeatures(n.range(1-a/o,l,1,h),n.data,o,i,o,c),e===o-1&&this._addTileFeatures(n.range(0,l,a/o,h),n.data,-1,i,o,c),c.features.length?c:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const i=this.getChildren(t);if(e++,1!==i.length)break;t=i[0].properties.cluster_id}return e}_appendLeaves(t,e,i,n,o){const s=this.getChildren(e);for(const e of s){const s=e.properties;if(s&&s.cluster?o+s.point_count<=n?o+=s.point_count:o=this._appendLeaves(t,s.cluster_id,i,n,o):o<n?o++:t.push(e),t.length===i)break}return o}_createTree(e){const i=new t.KDBush(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let t=0;t<e.length;t+=this.stride)i.add(e[t],e[t+1]);return i.finish(),i.data=e,i}_addTileFeatures(t,e,i,n,o,s){for(const r of t){const t=r*this.stride,a=e[t+$]>1;let l,h,c;if(a)l=j(e,t,this.clusterProps),h=e[t],c=e[t+1];else{const i=this.points[e[t+P]];l=i.properties;const[n,o]=i.geometry.coordinates;h=L(n),c=R(o)}const u={type:1,geometry:[[Math.round(this.options.extent*(h*o-i)),Math.round(this.options.extent*(c*o-n))]],tags:l};let d;d=a||this.options.generateId?e[t+P]:this.points[e[t+P]].id,void 0!==d&&(u.id=d),s.features.push(u)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:i,extent:n,reduce:o,minPoints:s}=this.options,r=i/(n*Math.pow(2,e)),a=t.data,l=[],h=this.stride;for(let i=0;i<a.length;i+=h){if(a[i+2]<=e)continue;a[i+2]=e;const n=a[i],c=a[i+1],u=t.within(a[i],a[i+1],r),d=a[i+$];let f=d;for(const t of u){const i=t*h;a[i+2]>e&&(f+=a[i+$])}if(f>d&&f>=s){let t,s=n*d,r=c*d,p=-1;const m=((i/h|0)<<5)+(e+1)+this.points.length;for(const n of u){const l=n*h;if(a[l+2]<=e)continue;a[l+2]=e;const c=a[l+$];s+=a[l]*c,r+=a[l+1]*c,a[l+4]=m,o&&(t||(t=this._map(a,i,!0),p=this.clusterProps.length,this.clusterProps.push(t)),o(t,this._map(a,l)))}a[i+4]=m,l.push(s/f,r/f,1/0,m,-1,f),o&&l.push(p)}else{for(let t=0;t<h;t++)l.push(a[i+t]);if(f>1)for(const t of u){const i=t*h;if(!(a[i+2]<=e)){a[i+2]=e;for(let t=0;t<h;t++)l.push(a[i+t])}}}}return l}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,i){if(t[e+$]>1){const n=this.clusterProps[t[e+F]];return i?Object.assign({},n):n}const n=this.points[t[e+P]].properties,o=this.options.map(n);return i&&o===n?Object.assign({},o):o}}function D(t,e,i){return{type:"Feature",id:t[e+P],properties:j(t,e,i),geometry:{type:"Point",coordinates:[(n=t[e],360*(n-.5)),N(t[e+1])]}};var n}function j(t,e,i){const n=t[e+$],o=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,s=t[e+F],r=-1===s?{}:Object.assign({},i[s]);return Object.assign(r,{cluster:!0,cluster_id:t[e+P],point_count:n,point_count_abbreviated:o})}function L(t){return t/360+.5}function R(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function N(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function B(t,e,i,n){for(var o,s=n,r=i-e>>1,a=i-e,l=t[e],h=t[e+1],c=t[i],u=t[i+1],d=e+3;d<i;d+=3){var f=U(t[d],t[d+1],l,h,c,u);if(f>s)o=d,s=f;else if(f===s){var p=Math.abs(d-r);p<a&&(o=d,a=p)}}s>n&&(o-e>3&&B(t,e,o,n),t[o+2]=s,i-o>3&&B(t,o,i,n))}function U(t,e,i,n,o,s){var r=o-i,a=s-n;if(0!==r||0!==a){var l=((t-i)*r+(e-n)*a)/(r*r+a*a);l>1?(i=o,n=s):l>0&&(i+=r*l,n+=a*l)}return(r=t-i)*r+(a=e-n)*a}function q(t,e,i,n){var o={id:void 0===t?null:t,type:e,geometry:i,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)V(t,e);else if("Polygon"===i||"MultiLineString"===i)for(var n=0;n<e.length;n++)V(t,e[n]);else if("MultiPolygon"===i)for(n=0;n<e.length;n++)for(var o=0;o<e[n].length;o++)V(t,e[n][o])}(o),o}function V(t,e){for(var i=0;i<e.length;i+=3)t.minX=Math.min(t.minX,e[i]),t.minY=Math.min(t.minY,e[i+1]),t.maxX=Math.max(t.maxX,e[i]),t.maxY=Math.max(t.maxY,e[i+1])}function G(t,e,i,n){if(e.geometry){var o=e.geometry.coordinates,s=e.geometry.type,r=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),a=[],l=e.id;if(i.promoteId?l=e.properties[i.promoteId]:i.generateId&&(l=n||0),"Point"===s)Z(o,a);else if("MultiPoint"===s)for(var h=0;h<o.length;h++)Z(o[h],a);else if("LineString"===s)W(o,a,r,!1);else if("MultiLineString"===s){if(i.lineMetrics){for(h=0;h<o.length;h++)W(o[h],a=[],r,!1),t.push(q(l,"LineString",a,e.properties));return}J(o,a,r,!1)}else if("Polygon"===s)J(o,a,r,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(h=0;h<e.geometry.geometries.length;h++)G(t,{id:l,geometry:e.geometry.geometries[h],properties:e.properties},i,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(h=0;h<o.length;h++){var c=[];J(o[h],c,r,!0),a.push(c)}}t.push(q(l,s,a,e.properties))}}function Z(t,e){e.push(X(t[0])),e.push(H(t[1])),e.push(0)}function W(t,e,i,n){for(var o,s,r=0,a=0;a<t.length;a++){var l=X(t[a][0]),h=H(t[a][1]);e.push(l),e.push(h),e.push(0),a>0&&(r+=n?(o*h-l*s)/2:Math.sqrt(Math.pow(l-o,2)+Math.pow(h-s,2))),o=l,s=h}var c=e.length-3;e[2]=1,B(e,0,c,i),e[c+2]=1,e.size=Math.abs(r),e.start=0,e.end=e.size}function J(t,e,i,n){for(var o=0;o<t.length;o++){var s=[];W(t[o],s,i,n),e.push(s)}}function X(t){return t/360+.5}function H(t){var e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function K(t,e,i,n,o,s,r,a){if(n/=e,s>=(i/=e)&&r<n)return t;if(r<i||s>=n)return null;for(var l=[],h=0;h<t.length;h++){var c=t[h],u=c.geometry,d=c.type,f=0===o?c.minX:c.minY,p=0===o?c.maxX:c.maxY;if(f>=i&&p<n)l.push(c);else if(!(p<i||f>=n)){var m=[];if("Point"===d||"MultiPoint"===d)Y(u,m,i,n,o);else if("LineString"===d)Q(u,m,i,n,o,!1,a.lineMetrics);else if("MultiLineString"===d)et(u,m,i,n,o,!1);else if("Polygon"===d)et(u,m,i,n,o,!0);else if("MultiPolygon"===d)for(var g=0;g<u.length;g++){var b=[];et(u[g],b,i,n,o,!0),b.length&&m.push(b)}if(m.length){if(a.lineMetrics&&"LineString"===d){for(g=0;g<m.length;g++)l.push(q(c.id,d,m[g],c.tags));continue}"LineString"!==d&&"MultiLineString"!==d||(1===m.length?(d="LineString",m=m[0]):d="MultiLineString"),"Point"!==d&&"MultiPoint"!==d||(d=3===m.length?"Point":"MultiPoint"),l.push(q(c.id,d,m,c.tags))}}}return l.length?l:null}function Y(t,e,i,n,o){for(var s=0;s<t.length;s+=3){var r=t[s+o];r>=i&&r<=n&&(e.push(t[s]),e.push(t[s+1]),e.push(t[s+2]))}}function Q(t,e,i,n,o,s,r){for(var a,l,h=tt(t),c=0===o?nt:ot,u=t.start,d=0;d<t.length-3;d+=3){var f=t[d],p=t[d+1],m=t[d+2],g=t[d+3],b=t[d+4],v=0===o?f:p,w=0===o?g:b,y=!1;r&&(a=Math.sqrt(Math.pow(f-g,2)+Math.pow(p-b,2))),v<i?w>i&&(l=c(h,f,p,g,b,i),r&&(h.start=u+a*l)):v>n?w<n&&(l=c(h,f,p,g,b,n),r&&(h.start=u+a*l)):it(h,f,p,m),w<i&&v>=i&&(l=c(h,f,p,g,b,i),y=!0),w>n&&v<=n&&(l=c(h,f,p,g,b,n),y=!0),!s&&y&&(r&&(h.end=u+a*l),e.push(h),h=tt(t)),r&&(u+=a)}var x=t.length-3;f=t[x],p=t[x+1],m=t[x+2],(v=0===o?f:p)>=i&&v<=n&&it(h,f,p,m),x=h.length-3,s&&x>=3&&(h[x]!==h[0]||h[x+1]!==h[1])&&it(h,h[0],h[1],h[2]),h.length&&e.push(h)}function tt(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function et(t,e,i,n,o,s){for(var r=0;r<t.length;r++)Q(t[r],e,i,n,o,s,!1)}function it(t,e,i,n){t.push(e),t.push(i),t.push(n)}function nt(t,e,i,n,o,s){var r=(s-e)/(n-e);return t.push(s),t.push(i+(o-i)*r),t.push(1),r}function ot(t,e,i,n,o,s){var r=(s-i)/(o-i);return t.push(e+(n-e)*r),t.push(s),t.push(1),r}function st(t,e){for(var i=[],n=0;n<t.length;n++){var o,s=t[n],r=s.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)o=rt(s.geometry,e);else if("MultiLineString"===r||"Polygon"===r){o=[];for(var a=0;a<s.geometry.length;a++)o.push(rt(s.geometry[a],e))}else if("MultiPolygon"===r)for(o=[],a=0;a<s.geometry.length;a++){for(var l=[],h=0;h<s.geometry[a].length;h++)l.push(rt(s.geometry[a][h],e));o.push(l)}i.push(q(s.id,r,o,s.tags))}return i}function rt(t,e){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var n=0;n<t.length;n+=3)i.push(t[n]+e,t[n+1],t[n+2]);return i}function at(t,e){if(t.transformed)return t;var i,n,o,s=1<<t.z,r=t.x,a=t.y;for(i=0;i<t.features.length;i++){var l=t.features[i],h=l.geometry,c=l.type;if(l.geometry=[],1===c)for(n=0;n<h.length;n+=2)l.geometry.push(lt(h[n],h[n+1],e,s,r,a));else for(n=0;n<h.length;n++){var u=[];for(o=0;o<h[n].length;o+=2)u.push(lt(h[n][o],h[n][o+1],e,s,r,a));l.geometry.push(u)}}return t.transformed=!0,t}function lt(t,e,i,n,o,s){return[Math.round(i*(t*n-o)),Math.round(i*(e*n-s))]}function ht(t,e,i,n,o){for(var s=e===o.maxZoom?0:o.tolerance/((1<<e)*o.extent),r={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<t.length;a++){r.numFeatures++,ct(r,t[a],s,o);var l=t[a].minX,h=t[a].minY,c=t[a].maxX,u=t[a].maxY;l<r.minX&&(r.minX=l),h<r.minY&&(r.minY=h),c>r.maxX&&(r.maxX=c),u>r.maxY&&(r.maxY=u)}return r}function ct(t,e,i,n){var o=e.geometry,s=e.type,r=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<o.length;a+=3)r.push(o[a]),r.push(o[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)ut(r,o,t,i,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<o.length;a++)ut(r,o[a],t,i,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var l=0;l<o.length;l++){var h=o[l];for(a=0;a<h.length;a++)ut(r,h[a],t,i,!0,0===a)}if(r.length){var c=e.tags||null;if("LineString"===s&&n.lineMetrics){for(var u in c={},e.tags)c[u]=e.tags[u];c.mapbox_clip_start=o.start/o.size,c.mapbox_clip_end=o.end/o.size}var d={geometry:r,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:c};null!==e.id&&(d.id=e.id),t.features.push(d)}}function ut(t,e,i,n,o,s){var r=n*n;if(n>0&&e.size<(o?r:n))i.numPoints+=e.length/3;else{for(var a=[],l=0;l<e.length;l+=3)(0===n||e[l+2]>r)&&(i.numSimplified++,a.push(e[l]),a.push(e[l+1])),i.numPoints++;o&&function(t,e){for(var i=0,n=0,o=t.length,s=o-2;n<o;s=n,n+=2)i+=(t[n]-t[s])*(t[n+1]+t[s+1]);if(i>0===e)for(n=0,o=t.length;n<o/2;n+=2){var r=t[n],a=t[n+1];t[n]=t[o-2-n],t[n+1]=t[o-1-n],t[o-2-n]=r,t[o-1-n]=a}}(a,s),t.push(a)}}function dt(t,e){var i=(e=this.options=function(t,e){for(var i in e)t[i]=e[i];return t}(Object.create(this.options),e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var i=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)G(i,t.features[n],e,n);else G(i,"Feature"===t.type?t:{geometry:t},e);return i}(t,e);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=function(t,e){var i=e.buffer/e.extent,n=t,o=K(t,1,-1-i,i,0,-1,2,e),s=K(t,1,1-i,2+i,0,-1,2,e);return(o||s)&&(n=K(t,1,-i,1+i,0,-1,2,e)||[],o&&(n=st(o,1).concat(n)),s&&(n=n.concat(st(s,-1)))),n}(n,e),n.length&&this.splitTile(n,0,0,0),i&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function ft(t,e,i){return 32*((1<<t)*i+e)+t}function pt(t,e){return e?t.properties[e]:t.id}function mt(t,e){if(null==t)return!0;if("Feature"===t.type)return null!=pt(t,e);if("FeatureCollection"===t.type){const i=new Set;for(const n of t.features){const t=pt(n,e);if(null==t)return!1;if(i.has(t))return!1;i.add(t)}return!0}return!1}function gt(t,e){const i=new Map;if(null==t);else if("Feature"===t.type)i.set(pt(t,e),t);else for(const n of t.features)i.set(pt(n,e),n);return i}function bt(e,i){const n=e.tileID.canonical;if(!this._geoJSONIndex)return i(null,null);const o=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!o)return i(null,null);const s=new class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e}feature(e){return new class{constructor(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const i of this._feature.geometry)e.push([new t.Point(i[0],i[1])]);return e}{const e=[];for(const i of this._feature.geometry){const n=[];for(const e of i)n.push(new t.Point(e[0],e[1]));e.push(n)}return e}}toGeoJSON(t,e,i){return u.call(this,t,e,i)}}(this._features[e])}}(o.features);let r=E(s);0===r.byteOffset&&r.byteLength===r.buffer.byteLength||(r=new Uint8Array(r)),i(null,{vectorTile:s,rawData:r.buffer})}dt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},dt.prototype.splitTile=function(t,e,i,n,o,s,r){for(var a=[t,e,i,n],l=this.options,h=l.debug;a.length;){n=a.pop(),i=a.pop(),e=a.pop(),t=a.pop();var c=1<<e,u=ft(e,i,n),d=this.tiles[u];if(!d&&(h>1&&console.time("creation"),d=this.tiles[u]=ht(t,e,i,n,l),this.tileCoords.push({z:e,x:i,y:n}),h)){h>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,i,n,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(d.source=t,o){if(e===l.maxZoom||e===o)continue;var p=1<<o-e;if(i!==Math.floor(s/p)||n!==Math.floor(r/p))continue}else if(e===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue;if(d.source=null,0!==t.length){h>1&&console.time("clipping");var m,g,b,v,w,y,x=.5*l.buffer/l.extent,_=.5-x,k=.5+x,M=1+x;m=g=b=v=null,w=K(t,c,i-x,i+k,0,d.minX,d.maxX,l),y=K(t,c,i+_,i+M,0,d.minX,d.maxX,l),t=null,w&&(m=K(w,c,n-x,n+k,1,d.minY,d.maxY,l),g=K(w,c,n+_,n+M,1,d.minY,d.maxY,l),w=null),y&&(b=K(y,c,n-x,n+k,1,d.minY,d.maxY,l),v=K(y,c,n+_,n+M,1,d.minY,d.maxY,l),y=null),h>1&&console.timeEnd("clipping"),a.push(m||[],e+1,2*i,2*n),a.push(g||[],e+1,2*i,2*n+1),a.push(b||[],e+1,2*i+1,2*n),a.push(v||[],e+1,2*i+1,2*n+1)}}},dt.prototype.getTile=function(t,e,i){var n=this.options,o=n.extent,s=n.debug;if(t<0||t>24)return null;var r=1<<t,a=ft(t,e=(e%r+r)%r,i);if(this.tiles[a])return at(this.tiles[a],o);s>1&&console.log("drilling down to z%d-%d-%d",t,e,i);for(var l,h=t,c=e,u=i;!l&&h>0;)h--,c=Math.floor(c/2),u=Math.floor(u/2),l=this.tiles[ft(h,c,u)];return l&&l.source?(s>1&&console.log("found parent tile z%d-%d-%d",h,c,u),s>1&&console.time("drilling down"),this.splitTile(l.source,h,c,u,t,e,i),s>1&&console.timeEnd("drilling down"),this.tiles[a]?at(this.tiles[a],o):null):null};class vt extends r{constructor(e,i,n,o){super(e,i,n,bt),this._dataUpdateable=new Map,this.loadGeoJSON=(e,i)=>{const{promoteId:n}=e;if(e.request)return t.getJSON(e.request,((t,e,o,s)=>{this._dataUpdateable=mt(e,n)?gt(e,n):void 0,i(t,e,o,s)}));if("string"==typeof e.data)try{const t=JSON.parse(e.data);this._dataUpdateable=mt(t,n)?gt(t,n):void 0,i(null,t)}catch(t){i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`))}else e.dataDiff?this._dataUpdateable?(function(t,e,i){var n,o,s,r;if(e.removeAll&&t.clear(),e.remove)for(const i of e.remove)t.delete(i);if(e.add)for(const n of e.add){const e=pt(n,i);null!=e&&t.set(e,n)}if(e.update)for(const i of e.update){let e=t.get(i.id);if(null==e)continue;const a=!i.removeAllProperties&&((null===(n=i.removeProperties)||void 0===n?void 0:n.length)>0||(null===(o=i.addOrUpdateProperties)||void 0===o?void 0:o.length)>0);if((i.newGeometry||i.removeAllProperties||a)&&(e={...e},t.set(i.id,e),a&&(e.properties={...e.properties})),i.newGeometry&&(e.geometry=i.newGeometry),i.removeAllProperties)e.properties={};else if((null===(s=i.removeProperties)||void 0===s?void 0:s.length)>0)for(const t of i.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(r=i.addOrUpdateProperties)||void 0===r?void 0:r.length)>0)for(const{key:t,value:n}of i.addOrUpdateProperties)e.properties[t]=n}}(this._dataUpdateable,e.dataDiff,n),i(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):i(new Error(`Cannot update existing geojson data in ${e.source}`)):i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},o&&(this.loadGeoJSON=o)}loadData(e,i){var n;null===(n=this._pendingRequest)||void 0===n||n.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const o=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request);this._pendingCallback=i,this._pendingRequest=this.loadGeoJSON(e,((n,s)=>{if(delete this._pendingCallback,delete this._pendingRequest,n||!s)return i(n);if("object"!=typeof s)return i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));{c(s,!0);try{if(e.filter){const i=t.createExpression(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const n=s.features.filter((t=>i.value.evaluate({zoom:0},t)));s={type:"FeatureCollection",features:n}}this._geoJSONIndex=e.cluster?new O(function({superclusterOptions:e,clusterProperties:i}){if(!i||!e)return e;const n={},o={},s={accumulated:null,zoom:0},r={properties:null},a=Object.keys(i);for(const e of a){const[s,r]=i[e],a=t.createExpression(r),l=t.createExpression("string"==typeof s?[s,["accumulated"],["get",e]]:s);n[e]=a.value,o[e]=l.value}return e.map=t=>{r.properties=t;const e={};for(const t of a)e[t]=n[t].evaluate(s,r);return e},e.reduce=(t,e)=>{r.properties=e;for(const e of a)s.accumulated=t[e],t[e]=o[e].evaluate(s,r)},e}(e)).load(s.features):function(t,e){return new dt(t,e)}(s,e.geojsonVtOptions)}catch(n){return i(n)}this.loaded={};const r={};if(o){const t=o.finish();t&&(r.resourceTiming={},r.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}i(null,r)}}))}reloadTile(t,e){const i=this.loaded;return i&&i[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}removeSource(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class wt{constructor(e){this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:r,geojson:vt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=e=>{if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}}setReferrer(t,e){this.referrer=e}setImages(t,e,i){this.availableImages[t]=e;for(const i in this.workerSources[t]){const n=this.workerSources[t][i];for(const t in n)n[t].availableImages=e}i()}setLayers(t,e,i){this.getLayerIndex(t).replace(e),i()}updateLayers(t,e,i){this.getLayerIndex(t).update(e.layers,e.removedIds),i()}loadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).loadTile(e,i)}loadDEMTile(t,e,i){this.getDEMWorkerSource(t,e.source).loadTile(e,i)}reloadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).reloadTile(e,i)}abortTile(t,e,i){this.getWorkerSource(t,e.type,e.source).abortTile(e,i)}removeTile(t,e,i){this.getWorkerSource(t,e.type,e.source).removeTile(e,i)}removeDEMTile(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)}removeSource(t,e,i){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,i):i()}loadWorkerSource(t,e,i){try{this.self.importScripts(e.url),i()}catch(t){i(t.toString())}}syncRTLPluginState(e,i,n){try{t.plugin.setState(i);const e=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=e){this.self.importScripts(e);const i=t.plugin.isParsed();n(i?void 0:new Error(`RTL Text Plugin failed to import scripts from ${e}`),i)}}catch(t){n(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let i=this.layerIndexes[t];return i||(i=this.layerIndexes[t]=new e),i}getWorkerSource(t,e,i){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][i]){const n={send:(e,i,n)=>{this.actor.send(e,i,n,t)}};this.workerSources[t][e][i]=new this.workerSourceTypes[e](n,this.getLayerIndex(t),this.getAvailableImages(t))}return this.workerSources[t][e][i]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new a),this.demWorkerSources[t][e]}}return t.isWorker()&&(self.worker=new wt(self)),wt}));n(["./shared"],(function(t){var e="3.3.0";class i{static testProp(t){if(!i.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in i.docStyle)return t[e];return t[0]}static create(t,e,i){const n=window.document.createElement(t);return void 0!==e&&(n.className=e),i&&i.appendChild(n),n}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){i.docStyle&&i.selectProp&&(i.userSelect=i.docStyle[i.selectProp],i.docStyle[i.selectProp]="none")}static enableDrag(){i.docStyle&&i.selectProp&&(i.docStyle[i.selectProp]=i.userSelect)}static setTransform(t,e){t.style[i.transformProp]=e}static addEventListener(t,e,i,n={}){t.addEventListener(e,i,"passive"in n?n:n.capture)}static removeEventListener(t,e,i,n={}){t.removeEventListener(e,i,"passive"in n?n:n.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",i.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",i.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",i.suppressClickInternal,!0)}),0)}static mousePos(e,i){const n=e.getBoundingClientRect();return new t.Point(i.clientX-n.left-e.clientLeft,i.clientY-n.top-e.clientTop)}static touchPos(e,i){const n=e.getBoundingClientRect(),o=[];for(let s=0;s<i.length;s++)o.push(new t.Point(i[s].clientX-n.left-e.clientLeft,i[s].clientY-n.top-e.clientTop));return o}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}i.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,i.selectProp=i.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),i.transformProp=i.testProp(["transform","WebkitTransform"]);const n={supported:!1,testSupport:function(t){!r&&s&&(a?l(t):o=t)}};let o,s,r=!1,a=!1;function l(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,s),t.isContextLost())return;n.supported=!0}catch(t){}t.deleteTexture(e),r=!0}var h,c;"undefined"!=typeof document&&(s=document.createElement("img"),s.onload=function(){o&&l(o),o=null,a=!0},s.onerror=function(){r=!0,o=null},s.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(e){let i,o,s,r;e.resetRequestQueue=()=>{i=[],o=0,s=0,r={}},e.addThrottleControl=t=>{const e=s++;return r[e]=t,e},e.removeThrottleControl=t=>{delete r[t],h()},e.getImage=(t,e,s=!0)=>{n.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*");const r={requestParameters:t,supportImageRefresh:s,callback:e,cancelled:!1,completed:!1,cancel:()=>{r.completed||r.cancelled||(r.cancelled=!0,r.innerRequest&&(r.innerRequest.cancel(),o--),h())}};return i.push(r),h(),r};const a=e=>{const{requestParameters:i,supportImageRefresh:n,callback:o}=e;return t.extend(i,{type:"image"}),(!1!==n||t.isWorker()||t.getProtocolAction(i.url)||i.headers&&!Object.keys(i.headers).reduce(((t,e)=>t&&"accept"===e),!0)?t.makeRequest:c)(i,((t,i,n,s)=>{l(e,o,t,i,n,s)}))},l=(e,i,n,s,r,a)=>{n?i(n):s instanceof HTMLImageElement||t.isImageBitmap(s)?i(null,s):s&&((e,i)=>{"function"==typeof createImageBitmap?t.arrayBufferToImageBitmap(e,i):t.arrayBufferToImage(e,i)})(s,((t,e)=>{null!=t?i(t):null!=e&&i(null,e,{cacheControl:r,expires:a})})),e.cancelled||(e.completed=!0,o--,h())},h=()=>{const e=(()=>{const t=Object.keys(r);let e=!1;if(t.length>0)for(const i of t)if(e=r[i](),e)break;return e})()?t.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=o;t<e&&i.length>0;t++){const e=i.shift();if(e.cancelled){t--;continue}const n=a(e);o++,e.innerRequest=n}},c=(e,i)=>{const n=new Image,o=e.url;let s=!1;const r=e.credentials;return r&&"include"===r?n.crossOrigin="use-credentials":(r&&"same-origin"===r||!t.sameOrigin(o))&&(n.crossOrigin="anonymous"),n.fetchPriority="high",n.onload=()=>{i(null,n),n.onerror=n.onload=null},n.onerror=()=>{s||i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),n.onerror=n.onload=null},n.src=o,{cancel:()=>{s=!0,n.src=""}}}}(h||(h={})),h.resetRequestQueue(),function(t){t.Glyphs="Glyphs",t.Image="Image",t.Source="Source",t.SpriteImage="SpriteImage",t.SpriteJSON="SpriteJSON",t.Style="Style",t.Tile="Tile",t.Unknown="Unknown"}(c||(c={}));class u{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeSpriteURL(t,e,i){const n=function(t){const e=t.match(d);if(!e)throw new Error(`Unable to parse URL "${t}"`);return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}(t);return n.path+=`${e}${i}`,function(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}(n)}setTransformRequest(t){this._transformRequestFn=t}}const d=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function f(e){var i=new t.ARRAY_TYPE(3);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i}var p,m=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t};p=new t.ARRAY_TYPE(3),t.ARRAY_TYPE!=Float32Array&&(p[0]=0,p[1]=0,p[2]=0);var g=function(t){var e=t[0],i=t[1];return e*e+i*i};function b(t){const e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){const i=[];for(const{id:n,url:o}of t){const t=`${n}${o}`;-1===i.indexOf(t)&&(i.push(t),e.push({id:n,url:o}))}}return e}function v(e,i,n,o,s){if(o)return void e(o);if(s!==Object.values(i).length||s!==Object.values(n).length)return;const r={};for(const e in i){r[e]={};const o=t.browser.getImageCanvasContext(n[e]),s=i[e];for(const t in s){const{width:i,height:n,x:a,y:l,sdf:h,pixelRatio:c,stretchX:u,stretchY:d,content:f}=s[t];r[e][t]={data:null,pixelRatio:c,sdf:h,stretchX:u,stretchY:d,content:f,spriteData:{width:i,height:n,x:a,y:l,context:o}}}}e(null,r)}!function(){var e=new t.ARRAY_TYPE(2);t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0)}();class w{constructor(t,e,i,n){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,n)}update(e,i,n){const{width:o,height:s}=e,r=!(this.size&&this.size[0]===o&&this.size[1]===s||n),{context:a}=this,{gl:l}=a;if(this.useMipmap=Boolean(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),r)this.size=[o,s],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,o,s,0,this.format,l.UNSIGNED_BYTE,e.data);else{const{x:i,y:r}=n||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texSubImage2D(l.TEXTURE_2D,0,i,r,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,i,r,o,s,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,i){const{context:n}=this,{gl:o}=n;o.bindTexture(o.TEXTURE_2D,this.texture),i!==o.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=o.LINEAR),t!==this.filter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,t),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function y(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class x extends t.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,callback:e}of this.requestors)this._notify(t,e);this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const e=i.spriteData;i.data=new t.RGBAImage({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),i.spriteData=null}return i}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(e,i){let n=!0;const o=i.data||i.spriteData;return this._validateStretch(i.stretchX,o&&o.width)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchX" value`))),n=!1),this._validateStretch(i.stretchY,o&&o.height)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchY" value`))),n=!1),this._validateContent(i.content,i)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "content" value`))),n=!1),n}_validateStretch(t,e){if(!t)return!0;let i=0;for(const n of t){if(n[0]<i||n[1]<n[0]||e<n[1])return!1;i=n[1]}return!0}_validateContent(t,e){if(!t)return!0;if(4!==t.length)return!1;const i=e.spriteData,n=i&&i.width||e.data.width,o=i&&i.height||e.data.height;return!(t[0]<0||n<t[0]||t[1]<0||o<t[1]||t[2]<0||n<t[2]||t[3]<0||o<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,e,i=!0){const n=this.getImage(t);if(i&&(n.data.width!==e.data.width||n.data.height!==e.data.height))throw new Error(`size mismatch between old image (${n.data.width}x${n.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=n.version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,e){let i=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(i=!1);this.isLoaded()||i?this._notify(t,e):this.requestors.push({ids:t,callback:e})}_notify(e,i){const n={};for(const i of e){let e=this.getImage(i);e||(this.fire(new t.Event("styleimagemissing",{id:i})),e=this.getImage(i)),e?n[i]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.warnOnce(`Image "${i}" 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.`)}i(null,n)}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(e){const i=this.patterns[e],n=this.getImage(e);if(!n)return null;if(i&&i.position.version===n.version)return i.position;if(i)i.position.version=n.version;else{const i={w:n.data.width+2,h:n.data.height+2,x:0,y:0},o=new t.ImagePosition(i,n);this.patterns[e]={bin:i,position:o}}return this._updatePatternAtlas(),this.patterns[e].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new w(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:n}=t.potpack(e),o=this.atlasImage;o.resize({width:i||1,height:n||1});for(const e in this.patterns){const{bin:i}=this.patterns[e],n=i.x+1,s=i.y+1,r=this.getImage(e).data,a=r.width,l=r.height;t.RGBAImage.copy(r,o,{x:0,y:0},{x:n,y:s},{width:a,height:l}),t.RGBAImage.copy(r,o,{x:0,y:l-1},{x:n,y:s-1},{width:a,height:1}),t.RGBAImage.copy(r,o,{x:0,y:0},{x:n,y:s+l},{width:a,height:1}),t.RGBAImage.copy(r,o,{x:a-1,y:0},{x:n-1,y:s},{width:1,height:l}),t.RGBAImage.copy(r,o,{x:0,y:0},{x:n+a,y:s},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const e=this.getImage(i);e||t.warnOnce(`Image with ID: "${i}" was not found`),y(e)&&this.updateImage(i,e)}}}const _=1e20;function k(t,e,i,n,o,s,r,a,l){for(let h=e;h<e+n;h++)M(t,i*s+h,s,o,r,a,l);for(let h=i;h<i+o;h++)M(t,h*s+e,1,n,r,a,l)}function M(t,e,i,n,o,s,r){s[0]=0,r[0]=-_,r[1]=_,o[0]=t[e];for(let a=1,l=0,h=0;a<n;a++){o[a]=t[e+a*i];const n=a*a;do{const t=s[l];h=(o[a]-o[t]+n-t*t)/(a-t)/2}while(h<=r[l]&&--l>-1);l++,s[l]=a,r[l]=h,r[l+1]=_}for(let a=0,l=0;a<n;a++){for(;r[l+1]<a;)l++;const n=s[l],h=a-n;t[e+a*i]=o[n]+h*h}}class z{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(e,i){const n=[];for(const t in e)for(const i of e[t])n.push({stack:t,id:i});t.asyncAll(n,(({stack:t,id:e},i)=>{let n=this.entries[t];n||(n=this.entries[t]={glyphs:{},requests:{},ranges:{}});let o=n.glyphs[e];if(void 0!==o)return void i(null,{stack:t,id:e,glyph:o});if(o=this._tinySDF(n,t,e),o)return n.glyphs[e]=o,void i(null,{stack:t,id:e,glyph:o});const s=Math.floor(e/256);if(256*s>65535)return void i(new Error("glyphs > 65535 not supported"));if(n.ranges[s])return void i(null,{stack:t,id:e,glyph:o});if(!this.url)return void i(new Error("glyphsUrl is not set"));let r=n.requests[s];r||(r=n.requests[s]=[],z.loadGlyphRange(t,s,this.url,this.requestManager,((t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(n.glyphs[+t]=e[+t]);n.ranges[s]=!0}for(const i of r)i(t,e);delete n.requests[s]}))),r.push(((n,o)=>{n?i(n):o&&i(null,{stack:t,id:e,glyph:o[e]||null})}))}),((t,e)=>{if(t)i(t);else if(e){const t={};for(const{stack:i,id:n,glyph:o}of e)(t[i]||(t[i]={}))[n]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics};i(null,t)}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(t.unicodeBlockLookup["CJK Unified Ideographs"](e)||t.unicodeBlockLookup["Hangul Syllables"](e)||t.unicodeBlockLookup.Hiragana(e)||t.unicodeBlockLookup.Katakana(e))}_tinySDF(e,i,n){const o=this.localIdeographFontFamily;if(!o)return;if(!this._doesCharSupportLocalGlyph(n))return;let s=e.tinySDF;if(!s){let t="400";/bold/i.test(i)?t="900":/medium/i.test(i)?t="500":/light/i.test(i)&&(t="200"),s=e.tinySDF=new z.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:o,fontWeight:t})}const r=s.draw(String.fromCharCode(n));return{id:n,bitmap:new t.AlphaImage({width:r.width||30,height:r.height||30},r.data),metrics:{width:r.glyphWidth||24,height:r.glyphHeight||24,left:r.glyphLeft||0,top:r.glyphTop-27||-8,advance:r.glyphAdvance||24}}}}z.loadGlyphRange=function(e,i,n,o,s){const r=256*i,a=r+255,l=o.transformRequest(n.replace("{fontstack}",e).replace("{range}",`${r}-${a}`),c.Glyphs);t.getArrayBuffer(l,((e,i)=>{if(e)s(e);else if(i){const e={};for(const n of t.parseGlyphPbf(i))e[n.id]=n;s(null,e)}}))},z.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:o="sans-serif",fontWeight:s="normal",fontStyle:r="normal"}={}){this.buffer=e,this.cutoff=n,this.radius=i;const a=this.size=t+4*e,l=this._createCanvas(a),h=this.ctx=l.getContext("2d",{willReadFrequently:!0});h.font=`${r} ${s} ${t}px ${o}`,h.textBaseline="alphabetic",h.textAlign="left",h.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:o,actualBoundingBoxRight:s}=this.ctx.measureText(t),r=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-o))),l=Math.min(this.size-this.buffer,r+Math.ceil(n)),h=a+2*this.buffer,c=l+2*this.buffer,u=Math.max(h*c,0),d=new Uint8ClampedArray(u),f={data:d,width:h,height:c,glyphWidth:a,glyphHeight:l,glyphTop:r,glyphLeft:0,glyphAdvance:e};if(0===a||0===l)return f;const{ctx:p,buffer:m,gridInner:g,gridOuter:b}=this;p.clearRect(m,m,a,l),p.fillText(t,m,m+r);const v=p.getImageData(m,m,a,l);b.fill(_,0,u),g.fill(0,0,u);for(let t=0;t<l;t++)for(let e=0;e<a;e++){const i=v.data[4*(t*a+e)+3]/255;if(0===i)continue;const n=(t+m)*h+e+m;if(1===i)b[n]=0,g[n]=_;else{const t=.5-i;b[n]=t>0?t*t:0,g[n]=t<0?t*t:0}}k(b,0,0,h,c,h,this.f,this.v,this.z),k(g,m,m,a,l,h,this.f,this.v,this.z);for(let t=0;t<u;t++){const e=Math.sqrt(b[t])-Math.sqrt(g[t]);d[t]=Math.round(255-255*(e/this.radius+this.cutoff))}return f}};class S{constructor(){this.specification=t.v8Spec.light.position}possiblyEvaluate(e,i){return t.sphericalToCartesian(e.expression.evaluate(i))}interpolate(e,i,n){return{x:t.interpolate.number(e.x,i.x,n),y:t.interpolate.number(e.y,i.y,n),z:t.interpolate.number(e.z,i.z,n)}}}let C,E;class A extends t.Evented{constructor(e){super(),C=C||new t.Properties({anchor:new t.DataConstantProperty(t.v8Spec.light.anchor),position:new S,color:new t.DataConstantProperty(t.v8Spec.light.color),intensity:new t.DataConstantProperty(t.v8Spec.light.intensity)}),this._transitionable=new t.Transitionable(C),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(t.validateLight,e,i))for(const t in e){const i=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),i):this._transitionable.setValue(t,i)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(e,i,n){return(!n||!1!==n.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.v8Spec})))}}class I{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){const i=t.join(",")+String(e);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(t,e)),this.dashEntry[i]}getDashRanges(t,e,i){const n=[];let o=t.length%2==1?-t[t.length-1]*i:0,s=t[0]*i,r=!0;n.push({left:o,right:s,isDash:r,zeroLength:0===t[0]});let a=t[0];for(let e=1;e<t.length;e++){r=!r;const l=t[e];o=a*i,a+=l,s=a*i,n.push({left:o,right:s,isDash:r,zeroLength:0===l})}return n}addRoundDash(t,e,i){const n=e/2;for(let e=-i;e<=i;e++){const o=this.width*(this.nextRow+i+e);let s=0,r=t[s];for(let a=0;a<this.width;a++){a/r.right>1&&(r=t[++s]);const l=Math.abs(a-r.left),h=Math.abs(a-r.right),c=Math.min(l,h);let u;const d=e/i*(n+1);if(r.isDash){const t=n-Math.abs(d);u=Math.sqrt(c*c+t*t)}else u=n-Math.sqrt(c*c+d*d);this.data[o+a]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],n=t[e+1];i.zeroLength?t.splice(e,1):n&&n.isDash===i.isDash&&(n.left=i.left,t.splice(e,1))}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const n=this.width*this.nextRow;let o=0,s=t[o];for(let e=0;e<this.width;e++){e/s.right>1&&(s=t[++o]);const i=Math.abs(e-s.left),r=Math.abs(e-s.right),a=Math.min(i,r);this.data[n+e]=Math.max(0,Math.min(255,(s.isDash?a:-a)+128))}}addDash(e,i){const n=i?7:0,o=2*n+1;if(this.nextRow+o>this.height)return t.warnOnce("LineAtlas out of space"),null;let s=0;for(let t=0;t<e.length;t++)s+=e[t];if(0!==s){const t=this.width/s,o=this.getDashRanges(e,this.width,t);i?this.addRoundDash(o,t,n):this.addRegularDash(o)}const r={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:s};return this.nextRow+=o,this.dirty=!0,r}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}class T{constructor(t,e,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;const n=this.workerPool.acquire(i);for(let t=0;t<n.length;t++){const o=new T.Actor(n[t],e,i);o.name=`Worker ${t}`,this.actors.push(o)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i,n){t.asyncAll(this.actors,((t,n)=>{t.send(e,i,n)}),n=n||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((t=>{t.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}}function P(e,i,n){const o=function(i,o){if(i)return n(i);if(o){const i=t.pick(t.extend(o,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);o.vector_layers&&(i.vectorLayers=o.vector_layers,i.vectorLayerIds=i.vectorLayers.map((t=>t.id))),n(null,i)}};return e.url?t.getJSON(i.transformRequest(e.url,c.Source),o):t.browser.frame((()=>o(null,e)))}T.Actor=t.Actor;class ${constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(e){return this._ne=e instanceof t.LngLat?new t.LngLat(e.lng,e.lat):t.LngLat.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.LngLat?new t.LngLat(e.lng,e.lat):t.LngLat.convert(e),this}extend(e){const i=this._sw,n=this._ne;let o,s;if(e instanceof t.LngLat)o=e,s=e;else{if(!(e instanceof $))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend($.convert(e)):this.extend(t.LngLat.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.LngLat.convert(e)):this;if(o=e._sw,s=e._ne,!o||!s)return this}return i||n?(i.lng=Math.min(o.lng,i.lng),i.lat=Math.min(o.lat,i.lat),n.lng=Math.max(s.lng,n.lng),n.lat=Math.max(s.lat,n.lat)):(this._sw=new t.LngLat(o.lng,o.lat),this._ne=new t.LngLat(s.lng,s.lat)),this}getCenter(){return new t.LngLat((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 t.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new t.LngLat(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(e){const{lng:i,lat:n}=t.LngLat.convert(e);let o=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&o}static convert(t){return t instanceof $?t:t?new $(t):t}static fromLngLat(e,i=0){const n=360*i/40075017,o=n/Math.cos(Math.PI/180*e.lat);return new $(new t.LngLat(e.lng-o,e.lat-n),new t.LngLat(e.lng+o,e.lat+n))}}class F{constructor(t,e,i){this.bounds=$.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),n=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*i),o=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*i),s=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*i),r=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*i);return e.x>=n&&e.x<s&&e.y>=o&&e.y<r}}class O extends t.Evented{constructor(e,i,n,o){if(super(),this.load=()=>{this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=P(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new F(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))},this.serialize=()=>t.extend({},this._options),this.id=e,this.dispatcher=n,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(i,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(t,e){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n={request:this.map._requestManager.transformRequest(i,c.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function o(i,n){return delete t.request,t.aborted?e(null):i&&404!==i.status?e(i):(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),e(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}n.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state?"loading"===t.state?t.reloadCallback=e:t.request=t.actor.send("reloadTile",n,o.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",n,o.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class D extends t.Evented{constructor(e,i,n,o){super(),this.id=e,this.dispatcher=n,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:"raster"},i),t.extend(this,t.pick(i,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=P(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new F(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,e){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=h.getImage(this.map._requestManager.transformRequest(i,c.Tile),((i,n,o)=>{if(delete t.request,t.aborted)t.state="unloaded",e(null);else if(i)t.state="errored",e(i);else if(n){this.map._refreshExpiredTiles&&o&&t.setExpiryData(o);const i=this.map.painter.context,s=i.gl;t.texture=this.map.painter.getTileTexture(n.width),t.texture?t.texture.update(n,{useMipmap:!0}):(t.texture=new w(i,n,s.RGBA,{useMipmap:!0}),t.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST),i.extTextureFilterAnisotropic&&s.texParameterf(s.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax)),t.state="loaded",e(null)}}),this.map._refreshExpiredTiles)}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e()}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()}hasTransition(){return!1}}class j extends D{constructor(e,i,n,o){super(e,i,n,o),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}loadTile(e,i){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function o(t,n){t&&(e.state="errored",i(t)),n&&(e.dem=n,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded",i(null))}e.request=h.getImage(this.map._requestManager.transformRequest(n,c.Tile),function(n,s){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(n)e.state="errored",i(n);else if(s){this.map._refreshExpiredTiles&&e.setExpiryData(s),delete s.cacheControl,delete s.expires;const i=t.isImageBitmap(s)&&(null==E&&(E="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),E)?s:t.browser.getImageData(s,1),n={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:i,encoding:this.encoding};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",n,o.bind(this)))}}.bind(this),this.map._refreshExpiredTiles),e.neighboringTiles=this._getNeighboringTiles(e.tileID)}_getNeighboringTiles(e){const i=e.canonical,n=Math.pow(2,i.z),o=(i.x-1+n)%n,s=0===i.x?e.wrap-1:e.wrap,r=(i.x+1+n)%n,a=i.x+1===n?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,s,i.z,o,i.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,a,i.z,r,i.y).key]={backfilled:!1},i.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,s,i.z,o,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,a,i.z,r,i.y-1).key]={backfilled:!1}),i.y+1<n&&(l[new t.OverscaledTileID(e.overscaledZ,s,i.z,o,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,a,i.z,r,i.y+1).key]={backfilled:!1}),l}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class L extends t.Evented{constructor(e,i,n,o){super(),this.load=()=>{this._updateWorkerData()},this.serialize=()=>t.extend({},this._options,{type:this.type,data:this._data}),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=n.getActor(),this.setEventedParent(o),this._data=i.data,this._options=t.extend({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId;const s=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*s,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*s,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.EXTENT,radius:(i.clusterRadius||50)*s,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(void 0!==t.clusterRadius&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),void 0!==t.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this}getClusterChildren(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this}getClusterLeaves(t,e,i,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:i},n),this}_updateWorkerData(e){const i=t.extend({},this.workerOptions);e?i.dataDiff=e:"string"==typeof this._data?(i.request=this.map._requestManager.transformRequest(t.browser.resolveURL(this._data),c.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new t.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,i,((e,i)=>{if(this._pendingLoads--,this._removed||i&&i.abandoned)return void this.fire(new t.Event("dataabort",{dataType:"source"}));let n=null;if(i&&i.resourceTiming&&i.resourceTiming[this.id]&&(n=i.resourceTiming[this.id].slice(0)),e)return void this.fire(new t.ErrorEvent(e));const o={dataType:"source"};this._collectResourceTiming&&n&&n.length>0&&t.extend(o,{resourceTiming:n}),this.fire(new t.Event("data",{...o,sourceDataType:"metadata"})),this.fire(new t.Event("data",{...o,sourceDataType:"content"}))}))}loaded(){return 0===this._pendingLoads}loadTile(t,e){const i=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const n={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(i,n,((n,o)=>(delete t.request,t.unloadVectorData(),t.aborted?e(null):n?e(n):(t.loadVectorData(o,this.map.painter,"reloadTile"===i),e(null)))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var R=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class N extends t.Evented{constructor(e,i,n,o){super(),this.load=(e,i)=>{this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=h.getImage(this.map._requestManager.transformRequest(this.url,c.Image),((n,o)=>{this._request=null,this._loaded=!0,n?this.fire(new t.ErrorEvent(n)):o&&(this.image=o,e&&(this.coordinates=e),i&&i(),this._finishLoading())}))},this.prepare=()=>{if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,R.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new w(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new t.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=e,this.dispatcher=n,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=i}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,(()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){let i=1/0,n=1/0,o=-1/0,s=-1/0;for(const t of e)i=Math.min(i,t.x),n=Math.min(n,t.y),o=Math.max(o,t.x),s=Math.max(s,t.y);const r=Math.max(o-i,s-n),a=Math.max(0,Math.floor(-Math.log(r)/Math.LN2)),l=Math.pow(2,a);return new t.CanonicalTileID(a,Math.floor((i+o)/2*l),Math.floor((n+s)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const n=i.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new t.RasterBoundsArray,this._boundsArray.emplaceBack(n[0].x,n[0].y,0,0),this._boundsArray.emplaceBack(n[1].x,n[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(n[3].x,n[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(n[2].x,n[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))}hasTransition(){return!1}}class B extends N{constructor(e,i,n,o){super(e,i,n,o),this.load=()=>{this._loaded=!1;const e=this.options;this.urls=[];for(const t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,c.Source).url);t.getVideo(this.urls,((e,i)=>{this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(this.video=i,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))},this.prepare=()=>{if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,R.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new w(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new t.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=i}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class U extends N{constructor(e,i,n,o){super(e,i,n,o),this.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 t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},this.prepare=()=>{let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,n=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,R.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new w(i,this.canvas,n.RGBA,{premultiply:!0});let o=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,o=!0)}o&&this.fire(new t.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const q={},V=t=>{switch(t){case"geojson":return L;case"image":return N;case"raster":return D;case"raster-dem":return j;case"vector":return O;case"video":return B;case"canvas":return U}return q[t]};function G(e,i){const n=t.create();return t.translate(n,n,[1,1,0]),t.scale(n,n,[.5*e.width,.5*e.height,1]),t.multiply(n,n,e.calculatePosMatrix(i.toUnwrapped()))}function Z(t,e,i,n,o,s){const r=function(t,e,i){if(t)for(const n of t){const t=e[n];if(t&&t.source===i&&"fill-extrusion"===t.type)return!0}else for(const t in e){const n=e[t];if(n.source===i&&"fill-extrusion"===n.type)return!0}return!1}(o&&o.layers,e,t.id),a=s.maxPitchScaleFactor(),l=t.tilesIn(n,a,r);l.sort(W);const h=[];for(const n of l)h.push({wrappedTileID:n.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(e,i,t._state,n.queryGeometry,n.cameraQueryGeometry,n.scale,o,s,a,G(t.transform,n.tileID))});const c=function(t){const e={},i={};for(const n of t){const t=n.queryResults,o=n.wrappedTileID,s=i[o]=i[o]||{};for(const i in t){const n=t[i],o=s[i]=s[i]||{},r=e[i]=e[i]||[];for(const t of n)o[t.featureIndex]||(o[t.featureIndex]=!0,r.push(t))}}return e}(h);for(const e in c)c[e].forEach((e=>{const i=e.feature,n=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=n}));return c}function W(t,e){const i=t.tileID,n=e.tileID;return i.overscaledZ-n.overscaledZ||i.canonical.y-n.canonical.y||i.wrap-n.wrap||i.canonical.x-n.canonical.x}class J{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=t.uniqueId(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const e=t+this.timeAdded;e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,n){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(t,e){const i={};if(!e)return i;for(const n of t){const t=n.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){n.layers=t,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=n}}return i}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket){if(this.hasSymbolBuckets=!0,!n)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket&&i.hasRTLText){this.hasRTLText=!0,t.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new w(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new w(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,n,o,s,r,a,l,h){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:o,scale:s,tileSize:this.tileSize,pixelPosMatrix:h,transform:a,params:r,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(e,i){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const o=n.loadVTLayers(),s=i&&i.sourceLayer?i.sourceLayer:"",r=o._geojsonTileLayer||o[s];if(!r)return;const a=t.createFilter(i&&i.filter),{z:l,x:h,y:c}=this.tileID.canonical,u={z:l,x:h,y:c};for(let i=0;i<r.length;i++){const o=r.feature(i);if(a.needGeometry){const e=t.toEvaluationFeature(o,!0);if(!a.filter(new t.EvaluationParameters(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!a.filter(new t.EvaluationParameters(this.tileID.overscaledZ),o))continue;const d=n.getId(o,s),f=new t.GeoJSONFeature(o,l,h,c,d);f.tile=u,e.push(f)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const i=t.parseCacheControl(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(i)if(this.expirationTime<i)e=!0;else{const n=this.expirationTime-i;n?this.expirationTime=t+Math.max(n,3e4):e=!0}else e=!0;e?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const n in this.buckets){if(!e.style.hasLayer(n))continue;const o=this.buckets[n],s=o.layers[0].sourceLayer||"_geojsonTileLayer",r=i[s],a=t[s];if(!r||!a||0===Object.keys(a).length)continue;o.update(a,r,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(n);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(o)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<t.browser.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=t.browser.now()+e}setDependencies(t,e){const i={};for(const t of e)i[t]=!0;this.dependencies[t]=i}hasDependency(t,e){for(const i of t){const t=this.dependencies[i];if(t)for(const i of e)if(t[i])return!0}return!1}}class X{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){const n=t.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);const o={value:e,timeout:void 0};if(void 0!==i&&(o.timeout=setTimeout((()=>{this.remove(t,o)}),i)),this.data[n].push(o),this.order.push(n),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,n=void 0===e?0:this.data[i].indexOf(e),o=this.data[i][n];return this.data[i].splice(n,1),o.timeout&&clearTimeout(o.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(o.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const i in this.data)for(const n of this.data[i])t(n.value)||e.push(n);for(const t of e)this.remove(t.value.tileID,t)}}class H{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,n){const o=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},t.extend(this.stateChanges[e][o],n),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==o&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][o]){this.deletedStates[e][o]={};for(const t in this.state[e][o])n[t]||(this.deletedStates[e][o][t]=null)}else for(const t in n)this.deletedStates[e]&&this.deletedStates[e][o]&&null===this.deletedStates[e][o][t]&&delete this.deletedStates[e][o][t]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const n=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][n]&&(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][n])for(i in this.deletedStates[t][n]={},this.stateChanges[t][n])this.deletedStates[t][n][i]=null;else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}getState(e,i){const n=String(i),o=t.extend({},(this.state[e]||{})[n],(this.stateChanges[e]||{})[n]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const t=this.deletedStates[e][i];if(null===t)return{};for(const e in t)delete o[e]}return o}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(e,i){const n={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const n in this.stateChanges[e])this.state[e][n]||(this.state[e][n]={}),t.extend(this.state[e][n],this.stateChanges[e][n]),i[n]=this.state[e][n];n[e]=i}for(const e in this.deletedStates){this.state[e]=this.state[e]||{};const i={};if(null===this.deletedStates[e])for(const t in this.state[e])i[t]={},this.state[e][t]={};else for(const t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(const i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[t]=this.state[e][t]}n[e]=n[e]||{},t.extend(n[e],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(n).length)for(const t in e)e[t].setFeatureState(n,i)}}class K extends t.Evented{constructor(t,e,i){super(),this.id=t,this.dispatcher=i,this.on("data",(t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((t,e,i,n)=>{const o=new(V(e.type))(t,e,i,n);if(o.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${o.id}`);return o})(t,e,i,this),this._tiles={},this._cache=new X(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new H,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,e){return this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,(()=>{})),this._source.fire(new t.Event("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(Y).map((t=>t.key))}getRenderableIds(e){const i=[];for(const t in this._tiles)this._isIdRenderable(t,e)&&i.push(this._tiles[t]);return e?i.sort(((e,i)=>{const n=e.tileID,o=i.tileID,s=new t.Point(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),r=new t.Point(o.canonical.x,o.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-o.overscaledZ||r.y-s.y||r.x-s.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(Y).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")}}_reloadTile(t,e){const i=this._tiles[t];i&&("loading"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)))}_tileLoaded(e,i,n,o){if(o)return e.state="errored",void(404!==o.status?this._source.fire(new t.ErrorEvent(o,{tile:e})):this.update(this.transform,this.terrain));e.timeAdded=t.browser.now(),"expired"===n&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.Event("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let n=0;n<e.length;n++){const o=e[n];if(t.neighboringTiles&&t.neighboringTiles[o]){const e=this.getTileByID(o);i(t,e),i(e,t)}}function i(t,e){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let i=e.tileID.canonical.x-t.tileID.canonical.x;const n=e.tileID.canonical.y-t.tileID.canonical.y,o=Math.pow(2,t.tileID.canonical.z),s=e.tileID.key;0===i&&0===n||Math.abs(n)>1||(Math.abs(i)>1&&(1===Math.abs(i+o)?i+=o:1===Math.abs(i-o)&&(i-=o)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,n),t.neighboringTiles&&t.neighboringTiles[s]&&(t.neighboringTiles[s].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,n){for(const o in this._tiles){let s=this._tiles[o];if(n[o]||!s.hasData()||s.tileID.overscaledZ<=e||s.tileID.overscaledZ>i)continue;let r=s.tileID;for(;s&&s.tileID.overscaledZ>e+1;){const t=s.tileID.scaledTo(s.tileID.overscaledZ-1);s=this._tiles[t.key],s&&s.hasData()&&(r=t)}let a=r;for(;a.overscaledZ>e;)if(a=a.scaledTo(a.overscaledZ-1),t[a.key]){n[r.key]=r;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),n=this._getLoadedTile(e);if(n)return n}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,n=Math.ceil(e.height/this._source.tileSize)+1,o=Math.floor(i*n*(null===this._maxTileCacheZoomLevels?t.config.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),s="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(s)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),t[n.tileID.key]=n}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t])}}update(e,i){if(this.transform=e,this.terrain=i,!this._sourceLoaded||this._paused)return;let n;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(n=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i}),this._source.hasTile&&(n=n.filter((t=>this._source.hasTile(t))))):n=[];const o=e.coveringZoomLevel(this._source),s=Math.max(o-K.maxOverzooming,this._source.minzoom),r=Math.max(o+K.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of n)if(e.canonical.z>this._source.minzoom){const i=e.scaledTo(e.canonical.z-1);t[i.key]=i;const n=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[n.key]=n}n=n.concat(Object.values(t))}const a=0===n.length&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new t.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(n,o);if(Q(this._source.type)){const e={},a={},h=Object.keys(l),c=t.browser.now();for(const t of h){const i=l[t],n=this._tiles[t];if(!n||0!==n.fadeEndTime&&n.fadeEndTime<=c)continue;const o=this.findLoadedParent(i,s);o&&(this._addTile(o.tileID),e[o.tileID.key]=o.tileID),a[t]=i}this._retainLoadedChildren(a,o,r,l);for(const t in e)l[t]||(this._coveredTiles[t]=!0,l[t]=e[t]);if(i){const t={},e={};for(const i of n)this._tiles[i.key].hasData()?t[i.key]=i:e[i.key]=i;for(const i in e){const n=e[i].children(this._source.maxzoom);this._tiles[n[0].key]&&this._tiles[n[1].key]&&this._tiles[n[2].key]&&this._tiles[n[3].key]&&(t[n[0].key]=l[n[0].key]=n[0],t[n[1].key]=l[n[1].key]=n[1],t[n[2].key]=l[n[2].key]=n[2],t[n[3].key]=l[n[3].key]=n[3],delete e[i])}for(const i in e){const n=this.findLoadedParent(e[i],this._source.minzoom);if(n){t[n.tileID.key]=l[n.tileID.key]=n.tileID;for(const e in t)t[e].isChildOf(n.tileID)&&delete t[e]}}for(const e in this._tiles)t[e]||(this._coveredTiles[e]=!0)}}for(const t in l)this._tiles[t].clearFadeHold();const h=t.keysDifference(this._tiles,l);for(const t of h){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){const i={},n={},o=Math.max(e-K.maxOverzooming,this._source.minzoom),s=Math.max(e+K.maxUnderzooming,this._source.minzoom),r={};for(const n of t){const t=this._addTile(n);i[n.key]=n,t.hasData()||e<this._source.maxzoom&&(r[n.key]=n)}this._retainLoadedChildren(r,e,s,i);for(const s of t){let t=this._tiles[s.key];if(t.hasData())continue;if(e+1>this._source.maxzoom){const t=s.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){i[t.key]=t;continue}}else{const t=s.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let r=t.wasRequested();for(let e=s.overscaledZ-1;e>=o;--e){const o=s.scaledTo(e);if(n[o.key])break;if(n[o.key]=!0,t=this.getTile(o),!t&&r&&(t=this._addTile(o)),t){const e=t.hasData();if((r||e)&&(i[o.key]=o),r=t.wasRequested(),e)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,n=this._tiles[t].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){i=this._loadedParentTiles[n.key];break}e.push(n.key);const t=n.scaledTo(n.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;n=t}for(const t of e)this._loadedParentTiles[t]=i}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const n=i;return i||(i=new J(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))),i.uses++,this._tiles[e.key]=i,n||this._source.fire(new t.Event("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),i))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(e,i,n){const o=[],s=this.transform;if(!s)return o;const r=n?s.getCameraQueryGeometry(e):e,a=e.map((t=>s.pointCoordinate(t,this.terrain))),l=r.map((t=>s.pointCoordinate(t,this.terrain))),h=this.getIds();let c=1/0,u=1/0,d=-1/0,f=-1/0;for(const t of l)c=Math.min(c,t.x),u=Math.min(u,t.y),d=Math.max(d,t.x),f=Math.max(f,t.y);for(let e=0;e<h.length;e++){const n=this._tiles[h[e]];if(n.holdingForFade())continue;const r=n.tileID,p=Math.pow(2,s.zoom-n.tileID.overscaledZ),m=i*n.queryPadding*t.EXTENT/n.tileSize/p,g=[r.getTilePoint(new t.MercatorCoordinate(c,u)),r.getTilePoint(new t.MercatorCoordinate(d,f))];if(g[0].x-m<t.EXTENT&&g[0].y-m<t.EXTENT&&g[1].x+m>=0&&g[1].y+m>=0){const t=a.map((t=>r.getTilePoint(t))),e=l.map((t=>r.getTilePoint(t)));o.push({tile:n,tileID:r,queryGeometry:t,cameraQueryGeometry:e,scale:p})}}return o}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(Q(this._source.type)){const e=t.browser.now();for(const t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const n=this._tiles[t];n&&n.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter((i=>!i.hasDependency(t,e)))}}function Y(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function Q(t){return"raster"===t||"image"===t||"video"===t}K.maxOverzooming=10,K.maxUnderzooming=3;const tt="mapboxgl_preloaded_worker_pool";class et{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<et.workerCount;)this.workers.push(new Worker(t.config.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((t=>{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[tt]}numActive(){return Object.keys(this.active).length}}const it=Math.floor(t.browser.hardwareConcurrency/2);let nt;function ot(){return nt||(nt=new et),nt}et.workerCount=t.isSafari(globalThis)?Math.max(Math.min(it,3),1):1;class st{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);let i=1,n=this._distances[i];const o=e*this.paddedLength+this.padding;for(;n<o&&i<this._distances.length;)n=this._distances[++i];const s=i-1,r=this._distances[s],a=n-r,l=a>0?(o-r)/a:0;return this.points[s].mult(1-l).add(this.points[i].mult(l))}}function rt(t,e){let i=!0;return"always"===t||"never"!==t&&"never"!==e||(i=!1),i}class at{constructor(t,e,i){const n=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;t<this.xCellCount*this.yCellCount;t++)n.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,n,o){this._forEachCell(e,i,n,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(o)}insertCircle(t,e,i,n){this._forEachCell(e-n,i-n,e+n,i+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(n)}_insertBoxCell(t,e,i,n,o,s){this.boxCells[o].push(s)}_insertCircleCell(t,e,i,n,o,s){this.circleCells[o].push(s)}_query(t,e,i,n,o,s,r){if(i<0||t>this.width||n<0||e>this.height)return[];const a=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=n){if(o)return[{key:null,x1:t,y1:e,x2:i,y2:n}];for(let t=0;t<this.boxKeys.length;t++)a.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){const e=this.circles[3*t],i=this.circles[3*t+1],n=this.circles[3*t+2];a.push({key:this.circleKeys[t],x1:e-n,y1:i-n,x2:e+n,y2:i+n})}}else this._forEachCell(t,e,i,n,this._queryCell,a,{hitTest:o,overlapMode:s,seenUids:{box:{},circle:{}}},r);return a}query(t,e,i,n){return this._query(t,e,i,n,!1,null)}hitTest(t,e,i,n,o,s){return this._query(t,e,i,n,!0,o,s).length>0}hitTestCircle(t,e,i,n,o){const s=t-i,r=t+i,a=e-i,l=e+i;if(r<0||s>this.width||l<0||a>this.height)return!1;const h=[];return this._forEachCell(s,a,r,l,this._queryCellCircle,h,{hitTest:!0,overlapMode:n,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},o),h.length>0}_queryCell(t,e,i,n,o,s,r,a){const{seenUids:l,hitTest:h,overlapMode:c}=r,u=this.boxCells[o];if(null!==u){const o=this.bboxes;for(const r of u)if(!l.box[r]){l.box[r]=!0;const u=4*r,d=this.boxKeys[r];if(t<=o[u+2]&&e<=o[u+3]&&i>=o[u+0]&&n>=o[u+1]&&(!a||a(d))&&(!h||!rt(c,d.overlapMode))&&(s.push({key:d,x1:o[u],y1:o[u+1],x2:o[u+2],y2:o[u+3]}),h))return!0}}const d=this.circleCells[o];if(null!==d){const o=this.circles;for(const r of d)if(!l.circle[r]){l.circle[r]=!0;const u=3*r,d=this.circleKeys[r];if(this._circleAndRectCollide(o[u],o[u+1],o[u+2],t,e,i,n)&&(!a||a(d))&&(!h||!rt(c,d.overlapMode))){const t=o[u],e=o[u+1],i=o[u+2];if(s.push({key:d,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),h)return!0}}}return!1}_queryCellCircle(t,e,i,n,o,s,r,a){const{circle:l,seenUids:h,overlapMode:c}=r,u=this.boxCells[o];if(null!==u){const t=this.bboxes;for(const e of u)if(!h.box[e]){h.box[e]=!0;const i=4*e,n=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!a||a(n))&&!rt(c,n.overlapMode))return s.push(!0),!0}}const d=this.circleCells[o];if(null!==d){const t=this.circles;for(const e of d)if(!h.circle[e]){h.circle[e]=!0;const i=3*e,n=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!a||a(n))&&!rt(c,n.overlapMode))return s.push(!0),!0}}}_forEachCell(t,e,i,n,o,s,r,a){const l=this._convertToXCellCoord(t),h=this._convertToYCellCoord(e),c=this._convertToXCellCoord(i),u=this._convertToYCellCoord(n);for(let d=l;d<=c;d++)for(let l=h;l<=u;l++)if(o.call(this,t,e,i,n,this.xCellCount*l+d,s,r,a))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,n,o,s){const r=n-t,a=o-e,l=i+s;return l*l>r*r+a*a}_circleAndRectCollide(t,e,i,n,o,s,r){const a=(s-n)/2,l=Math.abs(t-(n+a));if(l>a+i)return!1;const h=(r-o)/2,c=Math.abs(e-(o+h));if(c>h+i)return!1;if(l<=a||c<=h)return!0;const u=l-a,d=c-h;return u*u+d*d<=i*i}}function lt(e,i,n,o,s){const r=t.create();return i?(t.scale(r,r,[1/s,1/s,1]),n||t.rotateZ(r,r,o.angle)):t.multiply(r,o.labelPlaneMatrix,e),r}function ht(e,i,n,o,s){if(i){const i=t.clone(e);return t.scale(i,i,[s,s,1]),n||t.rotateZ(i,i,-o.angle),i}return o.glCoordMatrix}function ct(e,i,n){let o;n?(o=[e.x,e.y,n(e.x,e.y),1],t.transformMat4(o,o,i)):(o=[e.x,e.y,0,1],Mt(o,o,i));const s=o[3];return{point:new t.Point(o[0]/s,o[1]/s),signedDistanceFromCamera:s}}function ut(t,e){return.5+t/e*.5}function dt(t,e){const i=t[0]/t[3],n=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&n>=-e[1]&&n<=e[1]}function ft(e,i,n,o,s,r,a,l,h,c){const u=o?e.textSizeData:e.iconSizeData,d=t.evaluateSizeForZoom(u,n.transform.zoom),f=[256/n.width*2+1,256/n.height*2+1],p=o?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;p.clear();const m=e.lineVertexArray,g=o?e.text.placedSymbolArray:e.icon.placedSymbolArray,b=n.transform.width/n.transform.height;let v=!1;for(let o=0;o<g.length;o++){const w=g.get(o);if(w.hidden||w.writingMode===t.WritingMode.vertical&&!v){kt(w.numGlyphs,p);continue}let y;if(v=!1,c?(y=[w.anchorX,w.anchorY,c(w.anchorX,w.anchorY),1],t.transformMat4(y,y,i)):(y=[w.anchorX,w.anchorY,0,1],Mt(y,y,i)),!dt(y,f)){kt(w.numGlyphs,p);continue}const x=ut(n.transform.cameraToCenterDistance,y[3]),_=t.evaluateSizeForFeature(u,d,w),k=a?_/x:_*x,M=new t.Point(w.anchorX,w.anchorY),z=ct(M,s,c).point,S={projections:{},offsets:{}},C=gt(w,k,!1,l,i,s,r,e.glyphOffsetArray,m,p,z,M,S,b,h,c);v=C.useVertical,(C.notEnoughRoom||v||C.needsFlipping&>(w,k,!0,l,i,s,r,e.glyphOffsetArray,m,p,z,M,S,b,h,c).notEnoughRoom)&&kt(w.numGlyphs,p)}o?e.text.dynamicLayoutVertexBuffer.updateData(p):e.icon.dynamicLayoutVertexBuffer.updateData(p)}function pt(t,e,i,n,o,s,r,a,l,h,c,u,d){const f=a.glyphStartIndex+a.numGlyphs,p=a.lineStartIndex,m=a.lineStartIndex+a.lineLength,g=e.getoffsetX(a.glyphStartIndex),b=e.getoffsetX(f-1),v=xt(t*g,i,n,o,s,r,a.segment,p,m,l,h,c,u,d);if(!v)return null;const w=xt(t*b,i,n,o,s,r,a.segment,p,m,l,h,c,u,d);return w?{first:v,last:w}:null}function mt(e,i,n,o){return e===t.WritingMode.horizontal&&Math.abs(n.y-i.y)>Math.abs(n.x-i.x)*o?{useVertical:!0}:(e===t.WritingMode.vertical?i.y<n.y:i.x>n.x)?{needsFlipping:!0}:null}function gt(e,i,n,o,s,r,a,l,h,c,u,d,f,p,m,g){const b=i/24,v=e.lineOffsetX*b,w=e.lineOffsetY*b;let y;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,i=e.lineStartIndex,s=e.lineStartIndex+e.lineLength,c=pt(b,l,v,w,n,u,d,e,h,r,f,m,g);if(!c)return{notEnoughRoom:!0};const x=ct(c.first.point,a,g).point,_=ct(c.last.point,a,g).point;if(o&&!n){const t=mt(e.writingMode,x,_,p);if(t)return t}y=[c.first];for(let o=e.glyphStartIndex+1;o<t-1;o++)y.push(xt(b*l.getoffsetX(o),v,w,n,u,d,e.segment,i,s,h,r,f,m,g));y.push(c.last)}else{if(o&&!n){const i=ct(d,s,g).point,n=e.lineStartIndex+e.segment+1,o=new t.Point(h.getx(n),h.gety(n)),r=ct(o,s,g),a=r.signedDistanceFromCamera>0?r.point:bt(d,o,i,1,s,g),l=mt(e.writingMode,i,a,p);if(l)return l}const i=xt(b*l.getoffsetX(e.glyphStartIndex),v,w,n,u,d,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,h,r,f,m,g);if(!i)return{notEnoughRoom:!0};y=[i]}for(const e of y)t.addDynamicAttributes(c,e.point,e.angle);return{}}function bt(t,e,i,n,o,s){const r=ct(t.add(t.sub(e)._unit()),o,s).point,a=i.sub(r);return i.add(a._mult(n/a.mag()))}function vt(e,i){const{projectionCache:n,lineVertexArray:o,labelPlaneMatrix:s,tileAnchorPoint:r,distanceFromAnchor:a,getElevation:l,previousVertex:h,direction:c,absOffsetX:u}=i;if(n.projections[e])return n.projections[e];const d=new t.Point(o.getx(e),o.gety(e)),f=ct(d,s,l);if(f.signedDistanceFromCamera>0)return n.projections[e]=f.point,f.point;const p=e-c;return bt(0===a?r:new t.Point(o.getx(p),o.gety(p)),d,h,u-a+1,s,l)}function wt(t,e,i){return t._unit()._perp()._mult(e*i)}function yt(e,i,n,o,s,r,a,l){const{projectionCache:h,direction:c}=l;if(h.offsets[e])return h.offsets[e];const u=n.add(i);if(e+c<o||e+c>=s)return h.offsets[e]=u,u;const d=vt(e+c,l),f=wt(d.sub(n),a,c),p=n.add(f),m=d.add(f);return h.offsets[e]=t.findLineIntersection(r,u,p,m)||u,h.offsets[e]}function xt(t,e,i,n,o,s,r,a,l,h,c,u,d,f){const p=n?t-e:t+e;let m=p>0?1:-1,g=0;n&&(m*=-1,g=Math.PI),m<0&&(g+=Math.PI);let b,v,w=m>0?a+r:a+r+1,y=o,x=o,_=0,k=0;const M=Math.abs(p),z=[];let S;for(;_+k<=M;){if(w+=m,w<a||w>=l)return null;_+=k,x=y,v=b;const t={projectionCache:u,lineVertexArray:h,labelPlaneMatrix:c,tileAnchorPoint:s,distanceFromAnchor:_,getElevation:f,previousVertex:x,direction:m,absOffsetX:M};if(y=vt(w,t),0===i)z.push(x),S=y.sub(x);else{let e;const n=y.sub(x);e=0===n.mag()?wt(vt(w+m,t).sub(y),i,m):wt(n,i,m),v||(v=x.add(e)),b=yt(w,e,y,a,l,v,i,t),z.push(v),S=b.sub(v)}k=S.mag()}const C=S._mult((M-_)/k)._add(v||x),E=g+Math.atan2(y.y-x.y,y.x-x.x);return z.push(C),{point:C,angle:d?E:0,path:z}}const _t=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function kt(t,e){for(let i=0;i<t;i++){const t=e.length;e.resize(t+4),e.float32.set(_t,3*t)}}function Mt(t,e,i){const n=e[0],o=e[1];return t[0]=i[0]*n+i[4]*o+i[12],t[1]=i[1]*n+i[5]*o+i[13],t[3]=i[3]*n+i[7]*o+i[15],t}const zt=100;class St{constructor(t,e=new at(t.width+200,t.height+200,25),i=new at(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+zt,this.screenBottomBoundary=t.height+zt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,i,n,o,s){const r=this.projectAndGetPerspectiveRatio(n,t.anchorPointX,t.anchorPointY,s),a=i*r.perspectiveRatio,l=t.x1*a+r.point.x,h=t.y1*a+r.point.y,c=t.x2*a+r.point.x,u=t.y2*a+r.point.y;return!this.isInsideGrid(l,h,c,u)||"always"!==e&&this.grid.hitTest(l,h,c,u,e,o)||r.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[l,h,c,u],offscreen:this.isOffscreen(l,h,c,u)}}placeCollisionCircles(e,i,n,o,s,r,a,l,h,c,u,d,f,p){const m=[],g=new t.Point(i.anchorX,i.anchorY),b=ct(g,r,p),v=ut(this.transform.cameraToCenterDistance,b.signedDistanceFromCamera),w=(c?s/v:s*v)/t.ONE_EM,y=ct(g,a,p).point,x=pt(w,o,i.lineOffsetX*w,i.lineOffsetY*w,!1,y,g,i,n,a,{projections:{},offsets:{}},!1,p);let _=!1,k=!1,M=!0;if(x){const i=.5*d*v+f,n=new t.Point(-100,-100),o=new t.Point(this.screenRightBoundary,this.screenBottomBoundary),s=new st,r=x.first,a=x.last;let c=[];for(let t=r.path.length-1;t>=1;t--)c.push(r.path[t]);for(let t=1;t<a.path.length;t++)c.push(a.path[t]);const g=2.5*i;if(l){const t=c.map((t=>ct(t,l,p)));c=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let b=[];if(c.length>0){const e=c[0].clone(),i=c[0].clone();for(let t=1;t<c.length;t++)e.x=Math.min(e.x,c[t].x),e.y=Math.min(e.y,c[t].y),i.x=Math.max(i.x,c[t].x),i.y=Math.max(i.y,c[t].y);b=e.x>=n.x&&i.x<=o.x&&e.y>=n.y&&i.y<=o.y?[c]:i.x<n.x||e.x>o.x||i.y<n.y||e.y>o.y?[]:t.clipLine([c],n.x,n.y,o.x,o.y)}for(const t of b){s.reset(t,.25*i);let n=0;n=s.length<=.5*i?1:Math.ceil(s.paddedLength/g)+1;for(let t=0;t<n;t++){const o=t/Math.max(n-1,1),r=s.lerp(o),a=r.x+zt,l=r.y+zt;m.push(a,l,i,0);const c=a-i,d=l-i,f=a+i,p=l+i;if(M=M&&this.isOffscreen(c,d,f,p),k=k||this.isInsideGrid(c,d,f,p),"always"!==e&&this.grid.hitTestCircle(a,l,i,e,u)&&(_=!0,!h))return{circles:[],offscreen:!1,collisionDetected:_}}}}return{circles:!h&&_||!k||v<this.perspectiveRatioCutoff?[]:m,offscreen:M,collisionDetected:_}}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let n=1/0,o=1/0,s=-1/0,r=-1/0;for(const a of e){const e=new t.Point(a.x+zt,a.y+zt);n=Math.min(n,e.x),o=Math.min(o,e.y),s=Math.max(s,e.x),r=Math.max(r,e.y),i.push(e)}const a=this.grid.query(n,o,s,r).concat(this.ignoredGrid.query(n,o,s,r)),l={},h={};for(const e of a){const n=e.key;if(void 0===l[n.bucketInstanceId]&&(l[n.bucketInstanceId]={}),l[n.bucketInstanceId][n.featureIndex])continue;const o=[new t.Point(e.x1,e.y1),new t.Point(e.x2,e.y1),new t.Point(e.x2,e.y2),new t.Point(e.x1,e.y2)];t.polygonIntersectsPolygon(i,o)&&(l[n.bucketInstanceId][n.featureIndex]=!0,void 0===h[n.bucketInstanceId]&&(h[n.bucketInstanceId]=[]),h[n.bucketInstanceId].push(n.featureIndex))}return h}insertCollisionBox(t,e,i,n,o,s){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:n,featureIndex:o,collisionGroupID:s,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,n,o,s){const r=i?this.ignoredGrid:this.grid,a={bucketInstanceId:n,featureIndex:o,collisionGroupID:s,overlapMode:e};for(let e=0;e<t.length;e+=4)r.insertCircle(a,t[e],t[e+1],t[e+2])}projectAndGetPerspectiveRatio(e,i,n,o){let s;return o?(s=[i,n,o(i,n),1],t.transformMat4(s,s,e)):(s=[i,n,0,1],Mt(s,s,e)),{point:new t.Point((s[0]/s[3]+1)/2*this.transform.width+zt,(-s[1]/s[3]+1)/2*this.transform.height+zt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/s[3]*.5}}isOffscreen(t,e,i,n){return i<zt||t>=this.screenRightBoundary||n<zt||e>this.screenBottomBoundary}isInsideGrid(t,e,i,n){return i>=0&&t<this.gridRightBoundary&&n>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e}}function Ct(e,i,n){return i*(t.EXTENT/(e.tileSize*Math.pow(2,n-e.tileID.overscaledZ)))}class Et{constructor(t,e,i,n){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):n&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class At{constructor(t,e,i,n,o){this.text=new Et(t?t.text:null,e,i,o),this.icon=new Et(t?t.icon:null,e,n,o)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class It{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}}class Tt{constructor(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]}}class Pt{constructor(t,e,i,n,o){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=o}}class $t{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function Ft(e,i,n,o,s){const{horizontalAlign:r,verticalAlign:a}=t.getAnchorAlignment(e);return new t.Point(-(r-.5)*i+o[0]*s,-(a-.5)*n+o[1]*s)}function Ot(e,i,n,o,s,r){const{x1:a,x2:l,y1:h,y2:c,anchorPointX:u,anchorPointY:d}=e,f=new t.Point(i,n);return o&&f._rotate(s?r:-r),{x1:a+f.x,y1:h+f.y,x2:l+f.x,y2:c+f.y,anchorPointX:u,anchorPointY:d}}class Dt{constructor(t,e,i,n,o){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new St(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new $t(n),this.collisionCircleArrays={},this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,i,n,o){const s=n.getBucket(i),r=n.latestFeatureIndex;if(!s||!r||i.id!==s.layerIds[0])return;const a=n.collisionBoxArray,l=s.layers[0].layout,h=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),c=n.tileSize/t.EXTENT,u=this.transform.calculatePosMatrix(n.tileID.toUnwrapped()),d="map"===l.get("text-pitch-alignment"),f="map"===l.get("text-rotation-alignment"),p=Ct(n,1,this.transform.zoom),m=lt(u,d,f,this.transform,p);let g=null;if(d){const e=ht(u,d,f,this.transform,p);g=t.multiply([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[s.bucketInstanceId]=new Pt(s.bucketInstanceId,r,s.sourceLayerIndex,s.index,n.tileID);const b={bucket:s,layout:l,posMatrix:u,textLabelPlaneMatrix:m,labelToScreenMatrix:g,scale:h,textPixelRatio:c,holdingForFade:n.holdingForFade(),collisionBoxArray:a,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(s.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(s.sourceID)};if(o)for(const t of s.sortKeyRanges){const{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:o}=t;e.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:o,parameters:b})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:s.symbolInstances.length,parameters:b})}attemptAnchorPlacement(e,i,n,o,s,r,a,l,h,c,u,d,f,p,m,g){const b=t.TextAnchorEnum[e.textAnchor],v=[e.textOffset0,e.textOffset1],w=Ft(b,n,o,v,s),y=this.collisionIndex.placeCollisionBox(Ot(i,w.x,w.y,r,a,this.transform.angle),u,l,h,c.predicate,g);if((!m||0!==this.collisionIndex.placeCollisionBox(Ot(m,w.x,w.y,r,a,this.transform.angle),u,l,h,c.predicate,g).box.length)&&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),0===d.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:v,width:n,height:o,anchor:b,textBoxScale:s,prevAnchor:t},this.markUsedJustification(f,b,d,p),f.allowVerticalPlacement&&(this.markUsedOrientation(f,p,d),this.placedOrientations[d.crossTileID]=p),{shift:w,placedGlyphBoxes:y}}}placeLayerBucketPart(e,i,n){const{bucket:o,layout:s,posMatrix:r,textLabelPlaneMatrix:a,labelToScreenMatrix:l,textPixelRatio:h,holdingForFade:c,collisionBoxArray:u,partiallyEvaluatedTextSize:d,collisionGroup:f}=e.parameters,p=s.get("text-optional"),m=s.get("icon-optional"),g=t.getOverlapMode(s,"text-overlap","text-allow-overlap"),b="always"===g,v=t.getOverlapMode(s,"icon-overlap","icon-allow-overlap"),w="always"===v,y="map"===s.get("text-rotation-alignment"),x="map"===s.get("text-pitch-alignment"),_="none"!==s.get("icon-text-fit"),k="viewport-y"===s.get("symbol-z-order"),M=b&&(w||!o.hasIconData()||m),z=w&&(b||!o.hasTextData()||p);!o.collisionArrays&&u&&o.deserializeCollisionBoxes(u);const S=this.retainedQueryData[o.bucketInstanceId].tileID,C=this.terrain?(t,e)=>this.terrain.getElevation(S,t,e):null,E=(e,u)=>{var w,k;if(i[e.crossTileID])return;if(c)return void(this.placements[e.crossTileID]=new It(!1,!1,!1));let S=!1,E=!1,A=!0,I=null,T={box:null,offscreen:null},P={box:null,offscreen:null},$=null,F=null,O=null,D=0,j=0,L=0;u.textFeatureIndex?D=u.textFeatureIndex:e.useRuntimeCollisionCircles&&(D=e.featureIndex),u.verticalTextFeatureIndex&&(j=u.verticalTextFeatureIndex);const R=u.textBox;if(R){const i=i=>{let n=t.WritingMode.horizontal;if(o.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,n=t,this.markUsedOrientation(o,n,e))}return n},n=(i,n)=>{if(o.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&u.verticalTextBox){for(const e of o.writingModes)if(e===t.WritingMode.vertical?(T=n(),P=T):T=i(),T&&T.box&&T.box.length)break}else T=i()},s=e.textAnchorOffsetStartIndex,a=e.textAnchorOffsetEndIndex;if(a===s){const s=(t,i)=>{const n=this.collisionIndex.placeCollisionBox(t,g,h,r,f.predicate,C);return n&&n.box&&n.box.length&&(this.markUsedOrientation(o,i,e),this.placedOrientations[e.crossTileID]=i),n};n((()=>s(R,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return o.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?s(i,t.WritingMode.vertical):{box:null,offscreen:null}})),i(T&&T.box&&T.box.length)}else{let l=t.TextAnchorEnum[null===(k=null===(w=this.prevPlacement)||void 0===w?void 0:w.variableOffsets[e.crossTileID])||void 0===k?void 0:k.anchor];const c=(t,i,n)=>{const c=t.x2-t.x1,u=t.y2-t.y1,d=e.textBoxScale,p=_&&"never"===v?i:null;let m={box:[],offscreen:!1},b="never"===g?1:2,w="never";l&&b++;for(let i=0;i<b;i++){for(let i=s;i<a;i++){const s=o.textAnchorOffsets.get(i);if(l&&s.textAnchor!==l)continue;const a=this.attemptAnchorPlacement(s,t,c,u,d,y,x,h,r,f,w,e,o,n,p,C);if(a&&(m=a.placedGlyphBoxes,m&&m.box&&m.box.length))return S=!0,I=a.shift,m}l?l=null:w=g}return m};n((()=>c(R,u.iconBox,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return o.allowVerticalPlacement&&!(T&&T.box&&T.box.length)&&e.numVerticalGlyphVertices>0&&i?c(i,u.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),T&&(S=T.box,A=T.offscreen);const d=i(T&&T.box);if(!S&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(o,t.anchor,e,d))}}}if($=T,S=$&&$.box&&$.box.length>0,A=$&&$.offscreen,e.useRuntimeCollisionCircles){const i=o.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),h=t.evaluateSizeForFeature(o.textSizeData,d,i),c=s.get("text-padding");F=this.collisionIndex.placeCollisionCircles(g,i,o.lineVertexArray,o.glyphOffsetArray,h,r,a,l,n,x,f.predicate,e.collisionCircleDiameter,c,C),F.circles.length&&F.collisionDetected&&!n&&t.warnOnce("Collisions detected, but collision boxes are not shown"),S=b||F.circles.length>0&&!F.collisionDetected,A=A&&F.offscreen}if(u.iconFeatureIndex&&(L=u.iconFeatureIndex),u.iconBox){const t=t=>{const e=_&&I?Ot(t,I.x,I.y,y,x,this.transform.angle):t;return this.collisionIndex.placeCollisionBox(e,v,h,r,f.predicate,C)};P&&P.box&&P.box.length&&u.verticalIconBox?(O=t(u.verticalIconBox),E=O.box.length>0):(O=t(u.iconBox),E=O.box.length>0),A=A&&O.offscreen}const N=p||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,B=m||0===e.numIconVertices;if(N||B?B?N||(E=E&&S):S=E&&S:E=S=E&&S,S&&$&&$.box&&this.collisionIndex.insertCollisionBox($.box,g,s.get("text-ignore-placement"),o.bucketInstanceId,P&&P.box&&j?j:D,f.ID),E&&O&&this.collisionIndex.insertCollisionBox(O.box,v,s.get("icon-ignore-placement"),o.bucketInstanceId,L,f.ID),F&&(S&&this.collisionIndex.insertCollisionCircles(F.circles,g,s.get("text-ignore-placement"),o.bucketInstanceId,D,f.ID),n)){const t=o.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new Tt);for(let t=0;t<F.circles.length;t+=4)e.circles.push(F.circles[t+0]),e.circles.push(F.circles[t+1]),e.circles.push(F.circles[t+2]),e.circles.push(F.collisionDetected?1:0)}if(0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===o.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new It(S||M,E||z,A||o.justReloaded),i[e.crossTileID]=!0};if(k){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const t=o.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const i=t[e];E(o.symbolInstances.get(i),o.collisionArrays[i])}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)E(o.symbolInstances.get(t),o.collisionArrays[t]);if(n&&o.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[o.bucketInstanceId];t.invert(e.invProjMatrix,r),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}o.justReloaded=!1}markUsedJustification(e,i,n,o){let s;s=o===t.WritingMode.vertical?n.verticalPlacedTextSymbolIndex:{left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(i)];const r=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];for(const t of r)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=s>=0&&t!==s?0:n.crossTileID)}markUsedOrientation(e,i,n){const o=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,s=i===t.WritingMode.vertical?i:0,r=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];for(const t of r)e.text.placedSymbolArray.get(t).placedOrientation=o;n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=s)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const n=e?e.symbolFadeChange(t):1,o=e?e.opacities:{},s=e?e.variableOffsets:{},r=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],s=o[t];s?(this.opacities[t]=new At(s,n,e.text,e.icon),i=i||e.text!==s.text.placed||e.icon!==s.icon.placed):(this.opacities[t]=new At(null,n,e.text,e.icon,e.skipFade),i=i||e.text||e.icon)}for(const t in o){const e=o[t];if(!this.opacities[t]){const o=new At(e,n,!1,!1);o.isHidden()||(this.opacities[t]=o,i=i||e.text.placed||e.icon.placed)}}for(const t in s)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=s[t]);for(const t in r)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=r[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const i={};for(const n of e){const e=n.getBucket(t);e&&n.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i,n.collisionBoxArray)}}updateBucketOpacities(e,i,n){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const o=e.layers[0],s=o.layout,r=new At(null,0,!1,!1,!0),a=s.get("text-allow-overlap"),l=s.get("icon-allow-overlap"),h=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),c="map"===s.get("text-rotation-alignment"),u="map"===s.get("text-pitch-alignment"),d="none"!==s.get("icon-text-fit"),f=new At(null,0,a&&(l||!e.hasIconData()||s.get("icon-optional")),l&&(a||!e.hasTextData()||s.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);const p=(t,e,i)=>{for(let n=0;n<e/4;n++)t.opacityVertexArray.emplaceBack(i);t.hasVisibleVertices=t.hasVisibleVertices||i!==Zt};for(let n=0;n<e.symbolInstances.length;n++){const o=e.symbolInstances.get(n),{numHorizontalGlyphVertices:s,numVerticalGlyphVertices:a,crossTileID:l}=o;let m=this.opacities[l];i[l]?m=r:m||(m=f,this.opacities[l]=m),i[l]=!0;const g=o.numIconVertices>0,b=this.placedOrientations[o.crossTileID],v=b===t.WritingMode.vertical,w=b===t.WritingMode.horizontal||b===t.WritingMode.horizontalOnly;if(s>0||a>0){const t=Gt(m.text);p(e.text,s,v?Zt:t),p(e.text,a,w?Zt:t);const i=m.text.isHidden();[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||v?1:0)})),o.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).hidden=i||w?1:0);const n=this.variableOffsets[o.crossTileID];n&&this.markUsedJustification(e,n.anchor,o,b);const r=this.placedOrientations[o.crossTileID];r&&(this.markUsedJustification(e,"left",o,r),this.markUsedOrientation(e,r,o))}if(g){const t=Gt(m.icon),i=!(d&&o.verticalPlacedIconSymbolIndex&&v);o.placedIconSymbolIndex>=0&&(p(e.icon,o.numIconVertices,i?t:Zt),e.icon.placedSymbolArray.get(o.placedIconSymbolIndex).hidden=m.icon.isHidden()),o.verticalPlacedIconSymbolIndex>=0&&(p(e.icon,o.numVerticalIconVertices,i?Zt:t),e.icon.placedSymbolArray.get(o.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const i=e.collisionArrays[n];if(i){let n=new t.Point(0,0);if(i.textBox||i.verticalTextBox){let t=!0;if(h){const e=this.variableOffsets[l];e?(n=Ft(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),c&&n._rotate(u?this.transform.angle:-this.transform.angle)):t=!1}i.textBox&&jt(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||v,n.x,n.y),i.verticalTextBox&&jt(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||w,n.x,n.y)}const o=Boolean(!w&&i.verticalIconBox);i.iconBox&&jt(e.iconCollisionBox.collisionVertexArray,m.icon.placed,o,d?n.x:0,d?n.y:0),i.verticalIconBox&&jt(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!o,d?n.x:0,d?n.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}}function jt(t,e,i,n,o){t.emplaceBack(e?1:0,i?1:0,n||0,o||0),t.emplaceBack(e?1:0,i?1:0,n||0,o||0),t.emplaceBack(e?1:0,i?1:0,n||0,o||0),t.emplaceBack(e?1:0,i?1:0,n||0,o||0)}const Lt=Math.pow(2,25),Rt=Math.pow(2,24),Nt=Math.pow(2,17),Bt=Math.pow(2,16),Ut=Math.pow(2,9),qt=Math.pow(2,8),Vt=Math.pow(2,1);function Gt(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Lt+e*Rt+i*Nt+e*Bt+i*Ut+e*qt+i*Vt+e}const Zt=0;class Wt{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,i,n,o){const s=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(s,n,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,o())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort(((t,e)=>t.sortKey-e.sortKey)));this._currentPartIndex<s.length;)if(e.placeLayerBucketPart(s[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,o())return!0;return!1}}class Jt{constructor(t,e,i,n,o,s,r,a){this.placement=new Dt(t,e,s,r,a),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=o,this._done=!1}isDone(){return this._done}continuePlacement(e,i,n){const o=t.browser.now(),s=()=>!this._forceFullPlacement&&t.browser.now()-o>2;for(;this._currentPlacementIndex>=0;){const t=i[e[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=o)&&(!t.maxzoom||t.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new Wt(t)),this._inProgressLayer.continuePlacement(n[t.source],this.placement,this._showCollisionBoxes,t,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Xt=512/t.EXTENT/2;class Ht{constructor(e,i,n){this.tileID=e,this.bucketInstanceId=n,this._symbolsByKey={};const o=new Map;for(let t=0;t<i.length;t++){const e=i.get(t),n=e.key,s=o.get(n);s?s.push(e):o.set(n,[e])}for(const[e,i]of o){const n={positions:i.map((t=>({x:Math.floor(t.anchorX*Xt),y:Math.floor(t.anchorY*Xt)}))),crossTileIDs:i.map((t=>t.crossTileID))};if(n.positions.length>128){const e=new t.KDBush(n.positions.length,16,Uint16Array);for(const{x:t,y:i}of n.positions)e.add(t,i);e.finish(),delete n.positions,n.index=e}this._symbolsByKey[e]=n}}getScaledCoordinates(e,i){const{x:n,y:o,z:s}=this.tileID.canonical,{x:r,y:a,z:l}=i.canonical,h=Xt/Math.pow(2,l-s),c=(a*t.EXTENT+e.anchorY)*h,u=o*t.EXTENT*Xt;return{x:Math.floor((r*t.EXTENT+e.anchorX)*h-n*t.EXTENT*Xt),y:Math.floor(c-u)}}findMatches(t,e,i){const n=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let o=0;o<t.length;o++){const s=t.get(o);if(s.crossTileID)continue;const r=this._symbolsByKey[s.key];if(!r)continue;const a=this.getScaledCoordinates(s,e);if(r.index){const t=r.index.range(a.x-n,a.y-n,a.x+n,a.y+n).sort();for(const e of t){const t=r.crossTileIDs[e];if(!i[t]){i[t]=!0,s.crossTileID=t;break}}}else if(r.positions)for(let t=0;t<r.positions.length;t++){const e=r.positions[t],o=r.crossTileIDs[t];if(Math.abs(e.x-a.x)<=n&&Math.abs(e.y-a.y)<=n&&!i[o]){i[o]=!0,s.crossTileID=o;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class Kt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Yt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const i=this.indexes[t],n={};for(const t in i){const o=i[t];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+e),n[o.tileID.key]=o}this.indexes[t]=n}this.lng=t}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<e.symbolInstances.length;t++)e.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const n=this.usedCrossTileIDs[t.overscaledZ];for(const i in this.indexes){const o=this.indexes[i];if(Number(i)>t.overscaledZ)for(const i in o){const s=o[i];s.tileID.isChildOf(t)&&s.findMatches(e.symbolInstances,t,n)}else{const s=o[t.scaledTo(Number(i)).key];s&&s.findMatches(e.symbolInstances,t,n)}}for(let t=0;t<e.symbolInstances.length;t++){const o=e.symbolInstances.get(t);o.crossTileID||(o.crossTileID=i.generate(),n[o.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Ht(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const i of e.getCrossTileIDsLists())for(const e of i)delete this.usedCrossTileIDs[t][e]}removeStaleBuckets(t){let e=!1;for(const i in this.indexes){const n=this.indexes[i];for(const o in n)t[n[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,n[o]),delete n[o],e=!0)}return e}}class Qt{constructor(){this.layerIndexes={},this.crossTileIDs=new Kt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i){let n=this.layerIndexes[t.id];void 0===n&&(n=this.layerIndexes[t.id]=new Yt);let o=!1;const s={};n.handleWrapJump(i);for(const i of e){const e=i.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(i.tileID,e,this.crossTileIDs)&&(o=!0),s[e.bucketInstanceId]=!0)}return n.removeStaleBuckets(s)&&(o=!0),o}pruneUnusedLayers(t){const e={};t.forEach((t=>{e[t]=!0}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}const te=(e,i)=>t.emitValidationErrors(e,i&&i.filter((t=>"source.canvas"!==t.identifier))),ee=t.pick(t.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),ie=t.pick(t.operations,["setCenter","setZoom","setBearing","setPitch"]),ne=t.emptyStyle();class oe extends t.Evented{constructor(e,i={}){super(),this.map=e,this.dispatcher=new T(ot(),this,e._getMapId()),this.imageManager=new x,this.imageManager.setEventedParent(this),this.glyphManager=new z(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new I(256,512),this.crossTileSymbolIndex=new Qt,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());const n=this;this._rtlTextPluginCallback=oe.registerForPluginStateChange((e=>{n.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},((e,i)=>{if(t.triggerPluginCompletionEvent(e),i&&i.every((t=>t)))for(const t in n.sourceCaches){const e=n.sourceCaches[t].getSource().type;"vector"!==e&&"geojson"!==e||n.sourceCaches[t].reload()}}))})),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e)}}))}loadURL(e,i={},n){this.fire(new t.Event("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const o=this.map._requestManager.transformRequest(e,c.Style);this._request=t.getJSON(o,((e,o)=>{this._request=null,e?this.fire(new t.ErrorEvent(e)):o&&this._load(o,i,n)}))}loadJSON(e,i={},n){this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.browser.frame((()=>{this._request=null,i.validate=!1!==i.validate,this._load(e,i,n)}))}loadEmpty(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(ne,{validate:!1})}_load(e,i,n){const o=i.transformStyle?i.transformStyle(n,e):e;if(!i.validate||!te(this,t.validateStyle(o))){this._loaded=!0,this.stylesheet=o;for(const t in o.sources)this.addSource(t,o.sources[t],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new A(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}}_createLayers(){const e=t.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",e),this._order=e.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(const i of e){const e=t.createStyleLayer(i);e.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=e}}_loadSprite(e,i=!1,n=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(e,i,n,o){const s=b(e),r=s.length,a=n>1?"@2x":"",l={},u={},d={};for(const{id:e,url:n}of s){const s=i.transformRequest(i.normalizeSpriteURL(n,a,".json"),c.SpriteJSON),f=`${e}_${s.url}`;l[f]=t.getJSON(s,((t,i)=>{delete l[f],u[e]=i,v(o,u,d,t,r)}));const p=i.transformRequest(i.normalizeSpriteURL(n,a,".png"),c.SpriteImage),m=`${e}_${p.url}`;l[m]=h.getImage(p,((t,i)=>{delete l[m],d[e]=i,v(o,u,d,t,r)}))}return{cancel(){for(const t of Object.values(l))t.cancel()}}}(e,this.map._requestManager,this.map.getPixelRatio(),((e,o)=>{if(this._spriteRequest=null,e)this.fire(new t.ErrorEvent(e));else if(o)for(const t in o){this._spritesImagesIds[t]=[];const e=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in o))):[];for(const t of e)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const e in o[t]){const n="default"===t?e:`${t}:${e}`;this._spritesImagesIds[t].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,o[t][e],!1):this.imageManager.addImage(n,o[t][e]),i&&(this._changedImages[n]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"})),n&&n(e)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const n=e.sourceLayer;if(!n)return;const o=i.getSource();("geojson"===o.type||o.vectorLayerIds&&-1===o.vectorLayerIds.indexOf(n))&&this.fire(new t.ErrorEvent(new Error(`Source layer "${n}" does not exist on source "${o.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const e=this._serializedAllLayers();if(!t||0===t.length)return Object.values(e);const i=[];for(const n of t)e[n]&&i.push(e[n]);return i}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const i of e){const e=this._layers[i];"custom"!==e.type&&(t[i]=e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}const n={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];n[t]=e.used,e.used=!1}for(const t of this._order){const i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(const e in n){const i=this.sourceCaches[e];n[e]!==i.used&&i.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.z=e.zoom,i&&this.fire(new t.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){this._checkLoaded();const n=this.serialize();if(e=i.transformStyle?i.transformStyle(n,e):e,te(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=t.derefLayers(e.layers);const o=t.diffStyles(n,e).filter((t=>!(t.command in ie)));if(0===o.length)return!1;const s=o.filter((t=>!(t.command in ee)));if(s.length>0)throw new Error(`Unimplemented: ${s.map((t=>t.command)).join(", ")}.`);for(const t of o)"setTransition"!==t.command&&this[t.command].apply(this,t.args);return this.stylesheet=e,!0}addImage(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,n={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.validateStyle.source,`sources.${e}`,i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const o=this.sourceCaches[e]=new K(e,i,this.dispatcher);o.style=this,o.setEventedParent(this,(()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:e}))),o.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.ErrorEvent(new Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const i=this.sourceCaches[t].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(e,i,n={}){this._checkLoaded();const o=e.id;if(this.getLayer(o))return void this.fire(new t.ErrorEvent(new Error(`Layer "${o}" already exists on this map.`)));let s;if("custom"===e.type){if(te(this,t.validateCustomStyleLayer(e)))return;s=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(o,e.source),e=t.clone$1(e),e=t.extend(e,{source:o})),this._validate(t.validateStyle.layer,`layers.${o}`,e,{arrayIndex:-1},n))return;s=t.createStyleLayer(e),this._validateLayer(s),s.setEventedParent(this,{layer:{id:o}})}const r=i?this._order.indexOf(i):this._order.length;if(i&&-1===r)this.fire(new t.ErrorEvent(new Error(`Cannot add layer "${o}" before non-existing layer "${i}".`)));else{if(this._order.splice(r,0,o),this._layerOrderChanged=!0,this._layers[o]=s,this._removedLayers[o]&&s.source&&"custom"!==s.type){const t=this._removedLayers[o];delete this._removedLayers[o],t.type!==s.type?this._updatedSources[s.source]="clear":(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause())}this._updateLayer(s),s.onAdd&&s.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const n=this._order.indexOf(e);this._order.splice(n,1);const o=i?this._order.indexOf(i):this._order.length;i&&-1===o?this.fire(new t.ErrorEvent(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(o,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.ErrorEvent(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(e,i,n){this._checkLoaded();const o=this.getLayer(e);o?o.minzoom===i&&o.maxzoom===n||(null!=i&&(o.minzoom=i),null!=n&&(o.maxzoom=n),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,n={}){this._checkLoaded();const o=this.getLayer(e);if(o){if(!t.deepEqual(o.filter,i))return null==i?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(t.validateStyle.filter,`layers.${o.id}.filter`,i,null,n)||(o.filter=t.clone$1(i),this._updateLayer(o)))}else this.fire(new t.ErrorEvent(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,i,n,o={}){this._checkLoaded();const s=this.getLayer(e);s?t.deepEqual(s.getLayoutProperty(i),n)||(s.setLayoutProperty(i,n,o),this._updateLayer(s)):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const n=this.getLayer(e);if(n)return n.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,n,o={}){this._checkLoaded();const s=this.getLayer(e);s?t.deepEqual(s.getPaintProperty(i),n)||(s.setPaintProperty(i,n,o)&&this._updateLayer(s),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,i){this._checkLoaded();const n=e.source,o=e.sourceLayer,s=this.sourceCaches[n];if(void 0===s)return void this.fire(new t.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const r=s.getSource().type;"geojson"===r&&o?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==r||o?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),s.setFeatureState(o,e.id,i)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const n=e.source,o=this.sourceCaches[n];if(void 0===o)return void this.fire(new t.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const s=o.getSource().type,r="vector"===s?e.sourceLayer:void 0;"vector"!==s||r?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(r,e.id,i):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,n=e.sourceLayer,o=this.sourceCaches[i];if(void 0!==o)return"vector"!==o.getSource().type||n?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),o.getFeatureState(n,e.id)):void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=t.mapObject(this.sourceCaches,(t=>t.serialize())),i=this._serializeByIds(this._order),n=this.stylesheet;return t.filterObject({version:n.version,name:n.name,metadata:n.metadata,light:n.light,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,sources:e,layers:i},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},n=[];for(let o=this._order.length-1;o>=0;o--){const s=this._order[o];if(e(s)){i[s]=o;for(const e of t){const t=e[s];if(t)for(const e of t)n.push(e)}}}n.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const o=[];for(let s=this._order.length-1;s>=0;s--){const r=this._order[s];if(e(r))for(let t=n.length-1;t>=0;t--){const e=n[t].feature;if(i[e.layer.id]<s)break;o.push(e),n.pop()}else for(const e of t){const t=e[r];if(t)for(const e of t)o.push(e.feature)}}return o}queryRenderedFeatures(e,i,n){i&&i.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",i.filter,null,i);const o={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const e of i.layers){const i=this._layers[e];if(!i)return this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];o[i.source]=!0}}const s=[];i.availableImages=this._availableImages;const r=this._serializedAllLayers();for(const t in this.sourceCaches)i.layers&&!o[t]||s.push(Z(this.sourceCaches[t],this._layers,r,e,i,n));return this.placement&&s.push(function(t,e,i,n,o,s,r){const a={},l=s.queryRenderedSymbols(n),h=[];for(const t of Object.keys(l).map(Number))h.push(r[t]);h.sort(W);for(const i of h){const n=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],e,i.bucketIndex,i.sourceLayerIndex,o.filter,o.layers,o.availableImages,t);for(const t in n){const e=a[t]=a[t]||[],o=n[t];o.sort(((t,e)=>{const n=i.featureSortOrder;if(n){const i=n.indexOf(t.featureIndex);return n.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(const t of o)e.push(t)}}for(const e in a)a[e].forEach((n=>{const o=n.feature,s=i[t[e].source].getFeatureState(o.layer["source-layer"],o.id);o.source=o.layer.source,o.layer["source-layer"]&&(o.sourceLayer=o.layer["source-layer"]),o.state=s}));return a}(this._layers,r,this.sourceCaches,e,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(s)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",i.filter,null,i);const n=this.sourceCaches[e];return n?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),n=[],o={};for(let t=0;t<i.length;t++){const s=i[t],r=s.tileID.canonical.key;o[r]||(o[r]=!0,s.querySourceFeatures(n,e))}return n}(n,i):[]}addSourceType(t,e,i){return V(t)?i(new Error(`A source type called "${t}" already exists.`)):(((t,e)=>{q[t]=e})(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},i):i(null,null))}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const n=this.light.getLight();let o=!1;for(const i in e)if(!t.deepEqual(e[i],n[i])){o=!0;break}if(!o)return;const s={now:t.browser.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(s)}_validate(e,i,n,o,s={}){return(!s||!1!==s.validate)&&te(this,e.call(t.validateStyle,t.extend({key:i,style:this.serialize(),value:n,styleSpec:t.v8Spec},o)))}_remove(e=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const e=this.sourceCaches[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(e)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const e in this.sourceCaches)this.sourceCaches[e].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(e,i,n,o,s=!1){let r=!1,a=!1;const l={};for(const t of this._order){const i=this._layers[t];if("symbol"!==i.type)continue;if(!l[i.source]){const t=this.sourceCaches[i.source];l[i.source]=t.getRenderableIds(!0).map((e=>t.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)))}const n=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);r=r||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((s=s||this._layerOrderChanged||0===n)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.browser.now(),e.zoom))&&(this.pauseablePlacement=new Jt(e,this.map.terrain,this._order,s,i,n,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.browser.now()),a=!0),r&&this.pauseablePlacement.placement.setStale()),a||r)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.browser.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();const n=this.sourceCaches[e.source];n&&n.setDependencies(e.tileID.key,e.type,e.icons)}getGlyphs(t,e,i){this.glyphManager.getGlyphs(e.stacks,i);const n=this.sourceCaches[e.source];n&&n.setDependencies(e.tileID.key,e.type,[""])}getResource(e,i,n){return t.makeRequest(i,n)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(t.validateStyle.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,n={},o){this._checkLoaded();const s=[{id:e,url:i}],r=[...b(this.stylesheet.sprite),...s];this._validate(t.validateStyle.sprite,"sprite",r,null,n)||(this.stylesheet.sprite=r,this._loadSprite(s,!0,o))}removeSprite(e){this._checkLoaded();const i=b(this.stylesheet.sprite);if(i.find((t=>t.id===e))){if(this._spritesImagesIds[e])for(const t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;i.splice(i.findIndex((t=>t.id===e)),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}else this.fire(new t.ErrorEvent(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return b(this.stylesheet.sprite)}setSprite(e,i={},n){this._checkLoaded(),e&&this._validate(t.validateStyle.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,n):(this._unloadSprite(),n&&n(null)))}}oe.registerForPluginStateChange=t.registerForPluginStateChange;var se=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),re="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const ae={prelude:le("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}"),background:le("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:le("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;varying vec2 v_pos_a;varying 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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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;attribute vec2 a_pos;varying vec2 v_pos_a;varying 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);}"),circle:le("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);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));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 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);}"),clippingMask:le("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:le("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 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,0,1);gl_Position=u_matrix*pos;}"),heatmapTexture:le("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:le("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying 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;}"),collisionCircle:le("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying 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);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying 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);}"),debug:le("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying 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);}"),fill:le("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:le("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:le("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(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=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=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;}"),fillPattern:le("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=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);}"),fillExtrusion:le("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);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;}"),fillExtrusionPattern:le("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(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=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float 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\n? a_pos\n: 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;}"),hillshadePrepare:le("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(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));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:le("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(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);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:le("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute 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;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:le("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute 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;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:le("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute 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;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:le("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(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);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute 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;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:le("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying 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=texture2D(u_image0,v_pos0);vec4 color1=texture2D(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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying 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;}"),symbolIcon:le("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute 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;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:le("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute 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;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:le("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute 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;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:le("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",re),terrainDepth:le("varying 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() {gl_FragColor=pack(v_depth);}",re),terrainCoords:le("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",re)};function le(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=e.match(/attribute ([\w]+) ([\w]+)/g),o=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),r=s?s.concat(o):o,a={};return{fragmentSource:t=t.replace(i,((t,e,i,n,o)=>(a[o]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${o}\nvarying ${i} ${n} ${o};\n#else\nuniform ${i} ${n} u_${o};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${o}\n ${i} ${n} ${o} = u_${o};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,i,n,o)=>{const s="float"===n?"vec2":"vec4",r=o.match(/color/)?"color":s;return a[o]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${o}\nuniform lowp float u_${o}_t;\nattribute ${i} ${s} a_${o};\nvarying ${i} ${n} ${o};\n#else\nuniform ${i} ${n} u_${o};\n#endif\n`:"vec4"===r?`\n#ifndef HAS_UNIFORM_u_${o}\n ${o} = a_${o};\n#else\n ${i} ${n} ${o} = u_${o};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${o}\n ${o} = unpack_mix_${r}(a_${o}, u_${o}_t);\n#else\n ${i} ${n} ${o} = u_${o};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${o}\nuniform lowp float u_${o}_t;\nattribute ${i} ${s} a_${o};\n#else\nuniform ${i} ${n} u_${o};\n#endif\n`:"vec4"===r?`\n#ifndef HAS_UNIFORM_u_${o}\n ${i} ${n} ${o} = a_${o};\n#else\n ${i} ${n} ${o} = u_${o};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${o}\n ${i} ${n} ${o} = unpack_mix_${r}(a_${o}, u_${o}_t);\n#else\n ${i} ${n} ${o} = u_${o};\n#endif\n`})),staticAttributes:n,staticUniforms:r}}class he{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,i,n,o,s,r,a,l){this.context=t;let h=this.boundPaintVertexBuffers.length!==n.length;for(let t=0;!h&&t<n.length;t++)this.boundPaintVertexBuffers[t]!==n[t]&&(h=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==i||h||this.boundIndexBuffer!==o||this.boundVertexOffset!==s||this.boundDynamicVertexBuffer!==r||this.boundDynamicVertexBuffer2!==a||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,i,n,o,s,r,a,l):(t.bindVertexArray.set(this.vao),r&&r.bind(),o&&o.dynamicDraw&&o.bind(),a&&a.bind(),l&&l.bind())}freshBind(t,e,i,n,o,s,r,a){const l=t.numAttributes,h=this.context,c=h.gl;this.vao&&this.destroy(),this.vao=h.createVertexArray(),h.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=n,this.boundVertexOffset=o,this.boundDynamicVertexBuffer=s,this.boundDynamicVertexBuffer2=r,this.boundDynamicVertexBuffer3=a,e.enableAttributes(c,t);for(const e of i)e.enableAttributes(c,t);s&&s.enableAttributes(c,t),r&&r.enableAttributes(c,t),a&&a.enableAttributes(c,t),e.bind(),e.setVertexAttribPointers(c,t,o);for(const e of i)e.bind(),e.setVertexAttribPointers(c,t,o);s&&(s.bind(),s.setVertexAttribPointers(c,t,o)),n&&n.bind(),r&&(r.bind(),r.setVertexAttribPointers(c,t,o)),a&&(a.bind(),a.setVertexAttribPointers(c,t,o)),h.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}function ce(t){const e=[];for(let i=0;i<t.length;i++){if(null===t[i])continue;const n=t[i].split(" ");e.push(n.pop())}return e}class ue{constructor(e,i,n,o,s,r){const a=e.gl;this.program=a.createProgram();const l=ce(i.staticAttributes),h=n?n.getBinderAttributes():[],c=l.concat(h),u=ae.prelude.staticUniforms?ce(ae.prelude.staticUniforms):[],d=i.staticUniforms?ce(i.staticUniforms):[],f=n?n.getBinderUniforms():[],p=u.concat(d).concat(f),m=[];for(const t of p)m.indexOf(t)<0&&m.push(t);const g=n?n.defines():[];s&&g.push("#define OVERDRAW_INSPECTOR;"),r&&g.push("#define TERRAIN3D;");const b=g.concat(ae.prelude.fragmentSource,i.fragmentSource).join("\n"),v=g.concat(ae.prelude.vertexSource,i.vertexSource).join("\n"),w=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(w,b),a.compileShader(w),a.attachShader(this.program,w);const y=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(y,v),a.compileShader(y),a.attachShader(this.program,y),this.attributes={};const x={};this.numAttributes=c.length;for(let t=0;t<this.numAttributes;t++)c[t]&&(a.bindAttribLocation(this.program,t,c[t]),this.attributes[c[t]]=t);a.linkProgram(this.program),a.deleteShader(y),a.deleteShader(w);for(let t=0;t<m.length;t++){const e=m[t];if(e&&!x[e]){const t=a.getUniformLocation(this.program,e);t&&(x[e]=t)}}this.fixedUniforms=o(e,x),this.terrainUniforms=((e,i)=>({u_depth:new t.Uniform1i(e,i.u_depth),u_terrain:new t.Uniform1i(e,i.u_terrain),u_terrain_dim:new t.Uniform1f(e,i.u_terrain_dim),u_terrain_matrix:new t.UniformMatrix4f(e,i.u_terrain_matrix),u_terrain_unpack:new t.Uniform4f(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.Uniform1f(e,i.u_terrain_exaggeration)}))(e,x),this.binderUniforms=n?n.getUniforms(e,x):[]}draw(t,e,i,n,o,s,r,a,l,h,c,u,d,f,p,m,g,b){const v=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(n),t.setColorMode(o),t.setCullFace(s),a){t.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,a.depthTexture),t.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,a.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(a[t])}for(const t in this.fixedUniforms)this.fixedUniforms[t].set(r[t]);p&&p.setUniforms(t,this.binderUniforms,d,{zoom:f});let w=0;switch(e){case v.LINES:w=2;break;case v.TRIANGLES:w=3;break;case v.LINE_STRIP:w=1}for(const i of u.get()){const n=i.vaos||(i.vaos={});(n[l]||(n[l]=new he)).bind(t,this,h,p?p.getPaintVertexBuffers():[],c,i.vertexOffset,m,g,b),v.drawElements(e,i.primitiveLength*w,v.UNSIGNED_SHORT,i.primitiveOffset*w*2)}}}function de(t,e,i){const n=1/Ct(i,1,e.transform.tileZoom),o=Math.pow(2,i.tileID.overscaledZ),s=i.tileSize*Math.pow(2,e.transform.tileZoom)/o,r=s*(i.tileID.canonical.x+i.tileID.wrap*o),a=s*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[r>>16,a>>16],u_pixel_coord_lower:[65535&r,65535&a]}}const fe=(e,i,n,o)=>{const s=i.style.light,r=s.properties.get("position"),a=[r.x,r.y,r.z],l=function(){var e=new t.ARRAY_TYPE(9);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}();"viewport"===s.properties.get("anchor")&&function(t,e){var i=Math.sin(e),n=Math.cos(e);t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1}(l,-i.transform.angle),function(t,e,i){var n=e[0],o=e[1],s=e[2];t[0]=n*i[0]+o*i[3]+s*i[6],t[1]=n*i[1]+o*i[4]+s*i[7],t[2]=n*i[2]+o*i[5]+s*i[8]}(a,a,l);const h=s.properties.get("color");return{u_matrix:e,u_lightpos:a,u_lightintensity:s.properties.get("intensity"),u_lightcolor:[h.r,h.g,h.b],u_vertical_gradient:+n,u_opacity:o}},pe=(e,i,n,o,s,r,a)=>t.extend(fe(e,i,n,o),de(r,i,a),{u_height_factor:-Math.pow(2,s.overscaledZ)/a.tileSize/8}),me=t=>({u_matrix:t}),ge=(e,i,n,o)=>t.extend(me(e),de(n,i,o)),be=(t,e)=>({u_matrix:t,u_world:e}),ve=(e,i,n,o,s)=>t.extend(ge(e,i,n,o),{u_world:s}),we=(t,e,i,n)=>{const o=t.transform;let s,r;if("map"===n.paint.get("circle-pitch-alignment")){const t=Ct(i,1,o.zoom);s=!0,r=[t,t]}else s=!1,r=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+("map"===n.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,i,n.paint.get("circle-translate"),n.paint.get("circle-translate-anchor")),u_pitch_with_map:+s,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:r}},ye=(t,e,i)=>{const n=Ct(i,1,e.zoom),o=Math.pow(2,e.zoom-i.tileID.overscaledZ),s=i.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:n,u_extrude_scale:[e.pixelsToGLUnits[0]/(n*o),e.pixelsToGLUnits[1]/(n*o)],u_overscale_factor:s}},xe=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),_e=t=>({u_matrix:t}),ke=(t,e,i,n)=>({u_matrix:t,u_extrude_scale:Ct(e,1,i),u_intensity:n});function Me(e,i){const n=Math.pow(2,i.canonical.z),o=i.canonical.y;return[new t.MercatorCoordinate(0,o/n).toLngLat().lat,new t.MercatorCoordinate(0,(o+1)/n).toLngLat().lat]}const ze=(t,e,i,n)=>{const o=t.transform;return{u_matrix:Ie(t,e,i,n),u_ratio:1/Ct(e,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Se=(e,i,n,o,s)=>t.extend(ze(e,i,n,s),{u_image:0,u_image_height:o}),Ce=(t,e,i,n,o)=>{const s=t.transform,r=Ae(e,s);return{u_matrix:Ie(t,e,i,o),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Ct(e,1,s.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[r,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},Ee=(e,i,n,o,s,r)=>{const a=e.lineAtlas,l=Ae(i,e.transform),h="round"===n.layout.get("line-cap"),c=a.getDash(o.from,h),u=a.getDash(o.to,h),d=c.width*s.fromScale,f=u.width*s.toScale;return t.extend(ze(e,i,n,r),{u_patternscale_a:[l/d,-c.height/2],u_patternscale_b:[l/f,-u.height/2],u_sdfgamma:a.width/(256*Math.min(d,f)*e.pixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:u.y,u_mix:s.t})};function Ae(t,e){return 1/Ct(t,1,e.tileZoom)}function Ie(t,e,i,n){return t.translatePosMatrix(n?n.posMatrix:e.tileID.posMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Te=(t,e,i,n,o)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(r=o.paint.get("raster-saturation"),r>0?1-1/(1.001-r):-r),u_contrast_factor:(s=o.paint.get("raster-contrast"),s>0?1/(1-s):1+s),u_spin_weights:Pe(o.paint.get("raster-hue-rotate"))};var s,r};function Pe(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const $e=(t,e,i,n,o,s,r,a,l,h)=>{const c=o.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:c.width/c.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:r,u_coord_matrix:a,u_is_text:+l,u_pitch_with_map:+n,u_texsize:h,u_texture:0}},Fe=(e,i,n,o,s,r,a,l,h,c,u)=>{const d=s.transform;return t.extend($e(e,i,n,o,s,r,a,l,h,c),{u_gamma_scale:o?Math.cos(d._pitch)*d.cameraToCenterDistance:1,u_device_pixel_ratio:s.pixelRatio,u_is_halo:+u})},Oe=(e,i,n,o,s,r,a,l,h,c)=>t.extend(Fe(e,i,n,o,s,r,a,l,!0,h,!0),{u_texsize_icon:c,u_texture_icon:1}),De=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),je=(e,i,n,o,s,r)=>t.extend(function(t,e,i,n){const o=i.imageManager.getPattern(t.from.toString()),s=i.imageManager.getPattern(t.to.toString()),{width:r,height:a}=i.imageManager.getPixelSize(),l=Math.pow(2,n.tileID.overscaledZ),h=n.tileSize*Math.pow(2,i.transform.tileZoom)/l,c=h*(n.tileID.canonical.x+n.tileID.wrap*l),u=h*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:s.tl,u_pattern_br_b:s.br,u_texsize:[r,a],u_mix:e.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:s.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/Ct(n,1,i.transform.tileZoom),u_pixel_coord_upper:[c>>16,u>>16],u_pixel_coord_lower:[65535&c,65535&u]}}(o,r,n,s),{u_matrix:e,u_opacity:i}),Le={fillExtrusion:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fillExtrusionPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fill:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),fillPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),fillOutline:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}),fillOutlinePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),circle:(e,i)=>({u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,i.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),collisionBox:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,i.u_overscale_factor)}),collisionCircle:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}),clippingMask:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmap:(e,i)=>({u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmapTexture:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}),hillshade:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}),line:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}),linePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),lineSDF:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,i.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,i.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,i.u_sdfgamma),u_image:new t.Uniform1i(e,i.u_image),u_tex_y_a:new t.Uniform1f(e,i.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,i.u_tex_y_b),u_mix:new t.Uniform1f(e,i.u_mix)}),raster:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),background:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}),backgroundPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)}),terrainDepth:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture),u_terrain_coords_id:new t.Uniform1f(e,i.u_terrain_coords_id),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)})};class Re{constructor(t,e,i){this.context=t;const n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ne={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Be{constructor(t,e,i,n){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;const o=t.gl;this.buffer=o.createBuffer(),t.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i=0;i<this.attributes.length;i++){const n=e.attributes[this.attributes[i].name];void 0!==n&&t.enableVertexAttribArray(n)}}setVertexAttribPointers(t,e,i){for(let n=0;n<this.attributes.length;n++){const o=this.attributes[n],s=e.attributes[o.name];void 0!==s&&t.vertexAttribPointer(s,o.components,t[Ne[o.type]],!1,this.itemSize,o.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ue=new WeakMap;function qe(t){if(Ue.has(t))return Ue.get(t);{const e=t.getParameter(t.VERSION).startsWith("WebGL 2.0");return Ue.set(t,e),e}}class Ve{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Ge extends Ve{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ze extends Ve{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class We extends Ve{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Je extends Ve{getDefault(){return[!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Xe extends Ve{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class He extends Ve{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Ke extends Ve{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Ye extends Ve{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Qe extends Ve{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class ti extends Ve{getDefault(){return[0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class ei extends Ve{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class ii extends Ve{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class ni extends Ve{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class oi extends Ve{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class si extends Ve{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class ri extends Ve{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class ai extends Ve{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class li extends Ve{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class hi extends Ve{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ci extends Ve{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class ui extends Ve{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class di extends Ve{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class fi extends Ve{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class pi extends Ve{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class mi extends Ve{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class gi extends Ve{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class bi extends Ve{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class vi extends Ve{getDefault(){return null}set(t){var e;if(t===this.current&&!this.dirty)return;const i=this.gl;qe(i)?i.bindVertexArray(t):null===(e=i.getExtension("OES_vertex_array_object"))||void 0===e||e.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class wi extends Ve{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class yi extends Ve{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class xi extends Ve{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class _i extends Ve{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class ki extends _i{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Mi extends _i{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class zi extends _i{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Si{constructor(t,e,i,n,o){this.context=t,this.width=e,this.height=i;const s=t.gl,r=this.framebuffer=s.createFramebuffer();if(this.colorAttachment=new ki(t,r),n)this.depthAttachment=o?new zi(t,r):new Mi(t,r);else if(o)throw new Error("Stencil cannot be setted without depth");if(s.checkFramebufferStatus(s.FRAMEBUFFER)!==s.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class Ci{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i}}Ci.Replace=[1,0],Ci.disabled=new Ci(Ci.Replace,t.Color.transparent,[!1,!1,!1,!1]),Ci.unblended=new Ci(Ci.Replace,t.Color.transparent,[!0,!0,!0,!0]),Ci.alphaBlended=new Ci([1,771],t.Color.transparent,[!0,!0,!0,!0]);class Ei{constructor(t){var e,i;if(this.gl=t,this.clearColor=new Ge(this),this.clearDepth=new Ze(this),this.clearStencil=new We(this),this.colorMask=new Je(this),this.depthMask=new Xe(this),this.stencilMask=new He(this),this.stencilFunc=new Ke(this),this.stencilOp=new Ye(this),this.stencilTest=new Qe(this),this.depthRange=new ti(this),this.depthTest=new ei(this),this.depthFunc=new ii(this),this.blend=new ni(this),this.blendFunc=new oi(this),this.blendColor=new si(this),this.blendEquation=new ri(this),this.cullFace=new ai(this),this.cullFaceSide=new li(this),this.frontFace=new hi(this),this.program=new ci(this),this.activeTexture=new ui(this),this.viewport=new di(this),this.bindFramebuffer=new fi(this),this.bindRenderbuffer=new pi(this),this.bindTexture=new mi(this),this.bindVertexBuffer=new gi(this),this.bindElementBuffer=new bi(this),this.bindVertexArray=new vi(this),this.pixelStoreUnpack=new wi(this),this.pixelStoreUnpackPremultiplyAlpha=new yi(this),this.pixelStoreUnpackFlipY=new xi(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),qe(t)){this.HALF_FLOAT=t.HALF_FLOAT;const n=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(e=t.RGBA16F)&&void 0!==e?e:null==n?void 0:n.RGBA16F_EXT,this.RGB16F=null!==(i=t.RGB16F)&&void 0!==i?i:null==n?void 0:n.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const e=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==e?void 0:e.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new Re(this,t,e)}createVertexBuffer(t,e,i){return new Be(this,t,e,i)}createRenderbuffer(t,e,i){const n=this.gl,o=n.createRenderbuffer();return this.bindRenderbuffer.set(o),n.renderbufferStorage(n.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),o}createFramebuffer(t,e,i,n){return new Si(this,t,e,i,n)}clear({color:t,depth:e,stencil:i}){const n=this.gl;let o=0;t&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(o|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==i&&(o|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(o)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(e){t.deepEqual(e.blendFunction,Ci.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var t;return qe(this.gl)?this.gl.createVertexArray():null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return qe(this.gl)?this.gl.deleteVertexArray(t):null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class Ai{constructor(t,e,i){this.func=t,this.mask=e,this.range=i}}Ai.ReadOnly=!1,Ai.ReadWrite=!0,Ai.disabled=new Ai(519,Ai.ReadOnly,[0,1]);const Ii=7680;class Ti{constructor(t,e,i,n,o,s){this.test=t,this.ref=e,this.mask=i,this.fail=n,this.depthFail=o,this.pass=s}}Ti.disabled=new Ti({func:519,mask:0},0,0,Ii,Ii,Ii);class Pi{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i}}let $i;function Fi(e,i,n,o,s,r,a){const l=e.context,h=l.gl,c=e.useProgram("collisionBox"),u=[];let d=0,f=0;for(let p=0;p<o.length;p++){const m=o[p],g=i.getTile(m),b=g.getBucket(n);if(!b)continue;let v=m.posMatrix;0===s[0]&&0===s[1]||(v=e.translatePosMatrix(m.posMatrix,g,s,r));const w=a?b.textCollisionBox:b.iconCollisionBox,y=b.collisionCircleArray;if(y.length>0){const i=t.create(),n=v;t.mul(i,b.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(i,i,b.placementViewportMatrix),u.push({circleArray:y,circleOffset:f,transform:n,invTransform:i,coord:m}),d+=y.length/4,f=d}w&&c.draw(l,h.LINES,Ai.disabled,Ti.disabled,e.colorModeForRenderPass(),Pi.disabled,ye(v,e.transform,g),e.style.map.terrain&&e.style.map.terrain.getTerrainData(m),n.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,null,e.transform.zoom,null,null,w.collisionVertexBuffer)}if(!a||!u.length)return;const p=e.useProgram("collisionCircle"),m=new t.CollisionCircleLayoutArray;m.resize(4*d),m._trim();let g=0;for(const t of u)for(let e=0;e<t.circleArray.length/4;e++){const i=4*e,n=t.circleArray[i+0],o=t.circleArray[i+1],s=t.circleArray[i+2],r=t.circleArray[i+3];m.emplace(g++,n,o,s,r,0),m.emplace(g++,n,o,s,r,1),m.emplace(g++,n,o,s,r,2),m.emplace(g++,n,o,s,r,3)}(!$i||$i.length<2*d)&&($i=function(e){const i=2*e,n=new t.QuadTriangleArray;n.resize(i),n._trim();for(let t=0;t<i;t++){const e=6*t;n.uint16[e+0]=4*t+0,n.uint16[e+1]=4*t+1,n.uint16[e+2]=4*t+2,n.uint16[e+3]=4*t+2,n.uint16[e+4]=4*t+3,n.uint16[e+5]=4*t+0}return n}(d));const b=l.createIndexBuffer($i,!0),v=l.createVertexBuffer(m,t.collisionCircleLayout.members,!0);for(const i of u){const o={u_matrix:i.transform,u_inv_matrix:i.invTransform,u_camera_to_center_distance:(w=e.transform).cameraToCenterDistance,u_viewport_size:[w.width,w.height]};p.draw(l,h.TRIANGLES,Ai.disabled,Ti.disabled,e.colorModeForRenderPass(),Pi.disabled,o,e.style.map.terrain&&e.style.map.terrain.getTerrainData(i.coord),n.id,v,b,t.SegmentVector.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,e.transform.zoom,null,null,null)}var w;v.destroy(),b.destroy()}Pi.disabled=new Pi(!1,1029,2305),Pi.backCCW=new Pi(!0,1029,2305);const Oi=t.identity(new Float32Array(16));function Di(e,i,n,o,s,r){const{horizontalAlign:a,verticalAlign:l}=t.getAnchorAlignment(e);return new t.Point((-(a-.5)*i/s+o[0])*r,(-(l-.5)*n/s+o[1])*r)}function ji(e,i,n,o,s,r,a,l,h,c,u){const d=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,p=e.icon.dynamicLayoutVertexArray,m={};f.clear();for(let p=0;p<d.length;p++){const g=d.get(p),b=g.hidden||!g.crossTileID||e.allowVerticalPlacement&&!g.placedOrientation?null:o[g.crossTileID];if(b){const o=new t.Point(g.anchorX,g.anchorY),d=ct(o,n?a:r,u),p=ut(s.cameraToCenterDistance,d.signedDistanceFromCamera);let v=t.evaluateSizeForFeature(e.textSizeData,h,g)*p/t.ONE_EM;n&&(v*=e.tilePixelRatio/l);const{width:w,height:y,anchor:x,textOffset:_,textBoxScale:k}=b,M=Di(x,w,y,_,k,v),z=n?ct(o.add(M),r,u).point:d.point.add(i?M.rotate(-s.angle):M),S=e.allowVerticalPlacement&&g.placedOrientation===t.WritingMode.vertical?Math.PI/2:0;for(let e=0;e<g.numGlyphs;e++)t.addDynamicAttributes(f,z,S);c&&g.associatedIconIndex>=0&&(m[g.associatedIconIndex]={shiftedAnchor:z,angle:S})}else kt(g.numGlyphs,f)}if(c){p.clear();const i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){const n=i.get(e);if(n.hidden)kt(n.numGlyphs,p);else{const i=m[e];if(i)for(let e=0;e<n.numGlyphs;e++)t.addDynamicAttributes(p,i.shiftedAnchor,i.angle);else kt(n.numGlyphs,p)}}e.icon.dynamicLayoutVertexBuffer.updateData(p)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function Li(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function Ri(e,i,n,o,s,r,a,l,h,c,u,d){const f=e.context,p=f.gl,m=e.transform,g="map"===l,b="map"===h,v="viewport"!==l&&"point"!==n.layout.get("symbol-placement"),w=g&&!b&&!v,y=!n.layout.get("symbol-sort-key").isConstant();let x=!1;const _=e.depthModeForSublayer(0,Ai.ReadOnly),k=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),M=[];for(const l of o){const o=i.getTile(l),h=o.getBucket(n);if(!h)continue;const u=s?h.text:h.icon;if(!u||!u.segments.get().length||!u.hasVisibleVertices)continue;const d=u.programConfigurations.get(n.id),f=s||h.sdfIcons,_=s?h.textSizeData:h.iconSizeData,z=b||0!==m.pitch,S=e.useProgram(Li(f,s,h),d),C=t.evaluateSizeForZoom(_,m.zoom),E=e.style.map.terrain&&e.style.map.terrain.getTerrainData(l);let A,I,T,P,$=[0,0],F=null;if(s)I=o.glyphAtlasTexture,T=p.LINEAR,A=o.glyphAtlasTexture.size,h.iconsInText&&($=o.imageAtlasTexture.size,F=o.imageAtlasTexture,P=z||e.options.rotating||e.options.zooming||"composite"===_.kind||"camera"===_.kind?p.LINEAR:p.NEAREST);else{const t=1!==n.layout.get("icon-size").constantOr(0)||h.iconsNeedLinear;I=o.imageAtlasTexture,T=f||e.options.rotating||e.options.zooming||t||z?p.LINEAR:p.NEAREST,A=o.imageAtlasTexture.size}const O=Ct(o,1,e.transform.zoom),D=lt(l.posMatrix,b,g,e.transform,O),j=ht(l.posMatrix,b,g,e.transform,O),L=k&&h.hasTextData(),R="none"!==n.layout.get("icon-text-fit")&&L&&h.hasIconData();if(v){const t=e.style.map.terrain?(t,i)=>e.style.map.terrain.getElevation(l,t,i):null,i="map"===n.layout.get("text-rotation-alignment");ft(h,l.posMatrix,e,s,D,j,b,c,i,t)}const N=e.translatePosMatrix(l.posMatrix,o,r,a),B=v||s&&k||R?Oi:D,U=e.translatePosMatrix(j,o,r,a,!0),q=f&&0!==n.paint.get(s?"text-halo-width":"icon-halo-width").constantOr(1);let V;V=f?h.iconsInText?Oe(_.kind,C,w,b,e,N,B,U,A,$):Fe(_.kind,C,w,b,e,N,B,U,s,A,!0):$e(_.kind,C,w,b,e,N,B,U,s,A);const G={program:S,buffers:u,uniformValues:V,atlasTexture:I,atlasTextureIcon:F,atlasInterpolation:T,atlasInterpolationIcon:P,isSDF:f,hasHalo:q};if(y&&h.canOverlap){x=!0;const e=u.segments.get();for(const i of e)M.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:G,terrainData:E})}else M.push({segments:u.segments,sortKey:0,state:G,terrainData:E})}x&&M.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of M){const i=t.state;if(f.activeTexture.set(p.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,p.CLAMP_TO_EDGE),i.atlasTextureIcon&&(f.activeTexture.set(p.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,p.CLAMP_TO_EDGE)),i.isSDF){const o=i.uniformValues;i.hasHalo&&(o.u_is_halo=1,Ni(i.buffers,t.segments,n,e,i.program,_,u,d,o,t.terrainData)),o.u_is_halo=0}Ni(i.buffers,t.segments,n,e,i.program,_,u,d,i.uniformValues,t.terrainData)}}function Ni(t,e,i,n,o,s,r,a,l,h){const c=n.context;o.draw(c,c.gl.TRIANGLES,s,r,a,Pi.disabled,l,h,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,n.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Bi(t,e,i,n,o){if(!i||!n||!n.imageAtlas)return;const s=n.imageAtlas.patternPositions;let r=s[i.to.toString()],a=s[i.from.toString()];if(!r||!a){const t=o.getPaintProperty(e);r=s[t],a=s[t]}r&&a&&t.setConstantPatternPositions(r,a)}function Ui(t,e,i,n,o,s,r){const a=t.context.gl,l="fill-pattern",h=i.paint.get(l),c=h&&h.constantOr(1),u=i.getCrossfadeParameters();let d,f,p,m,g;r?(f=c&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",d=a.LINES):(f=c?"fillPattern":"fill",d=a.TRIANGLES);const b=h.constantOr(null);for(const h of n){const n=e.getTile(h);if(c&&!n.patternsLoaded())continue;const v=n.getBucket(i);if(!v)continue;const w=v.programConfigurations.get(i.id),y=t.useProgram(f,w),x=t.style.map.terrain&&t.style.map.terrain.getTerrainData(h);c&&(t.context.activeTexture.set(a.TEXTURE0),n.imageAtlasTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),w.updatePaintBuffers(u)),Bi(w,l,b,n,i);const _=x?h:null,k=t.translatePosMatrix(_?_.posMatrix:h.posMatrix,n,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(r){m=v.indexBuffer2,g=v.segments2;const e=[a.drawingBufferWidth,a.drawingBufferHeight];p="fillOutlinePattern"===f&&c?ve(k,t,u,n,e):be(k,e)}else m=v.indexBuffer,g=v.segments,p=c?ge(k,t,u,n):me(k);y.draw(t.context,d,o,t.stencilModeForClipping(h),s,Pi.disabled,p,x,i.id,v.layoutVertexBuffer,m,g,i.paint,t.transform.zoom,w)}}function qi(t,e,i,n,o,s,r){const a=t.context,l=a.gl,h="fill-extrusion-pattern",c=i.paint.get(h),u=c.constantOr(1),d=i.getCrossfadeParameters(),f=i.paint.get("fill-extrusion-opacity"),p=c.constantOr(null);for(const c of n){const n=e.getTile(c),m=n.getBucket(i);if(!m)continue;const g=t.style.map.terrain&&t.style.map.terrain.getTerrainData(c),b=m.programConfigurations.get(i.id),v=t.useProgram(u?"fillExtrusionPattern":"fillExtrusion",b);u&&(t.context.activeTexture.set(l.TEXTURE0),n.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),b.updatePaintBuffers(d)),Bi(b,h,p,n,i);const w=t.translatePosMatrix(c.posMatrix,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),y=i.paint.get("fill-extrusion-vertical-gradient"),x=u?pe(w,t,y,f,c,d,n):fe(w,t,y,f);v.draw(a,a.gl.TRIANGLES,o,s,r,Pi.backCCW,x,g,i.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,i.paint,t.transform.zoom,b,t.style.map.terrain&&m.centroidVertexBuffer)}}function Vi(t,e,i,n,o,s,r){const a=t.context,l=a.gl,h=i.fbo;if(!h)return;const c=t.useProgram("hillshade"),u=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);a.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,h.colorAttachment.get()),c.draw(a,l.TRIANGLES,o,s,r,Pi.disabled,((t,e,i,n)=>{const o=i.paint.get("hillshade-shadow-color"),s=i.paint.get("hillshade-highlight-color"),r=i.paint.get("hillshade-accent-color");let a=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(a-=t.transform.angle);const l=!t.options.moving;return{u_matrix:n?n.posMatrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:Me(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),a],u_shadow:o,u_highlight:s,u_accent:r}})(t,i,n,u?e:null),u,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}function Gi(e,i,n,o,s,r){const a=e.context,l=a.gl,h=i.dem;if(h&&h.data){const c=h.dim,u=h.stride,d=h.getPixels();if(a.activeTexture.set(l.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(u),i.demTexture){const t=i.demTexture;t.update(d,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new w(a,d,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);a.activeTexture.set(l.TEXTURE0);let f=i.fbo;if(!f){const t=new w(a,{width:c,height:c,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),f=i.fbo=a.createFramebuffer(c,c,!0,!1),f.colorAttachment.set(t.texture)}a.bindFramebuffer.set(f.framebuffer),a.viewport.set([0,0,c,c]),e.useProgram("hillshadePrepare").draw(a,l.TRIANGLES,o,s,r,Pi.disabled,((e,i)=>{const n=i.stride,o=t.create();return t.ortho(o,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(o,o,[0,-t.EXTENT,0]),{u_matrix:o,u_image:1,u_dimension:[n,n],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,h),null,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function Zi(e,i,n,o,s,r){const a=o.paint.get("raster-fade-duration");if(!r&&a>0){const o=t.browser.now(),r=(o-e.timeAdded)/a,l=i?(o-i.timeAdded)/a:-1,h=n.getSource(),c=s.coveringZoomLevel({tileSize:h.tileSize,roundZoom:h.roundZoom}),u=!i||Math.abs(i.tileID.overscaledZ-c)>Math.abs(e.tileID.overscaledZ-c),d=u&&e.refreshedUponExpiration?1:t.clamp(u?r:1-l,0,1);return e.refreshedUponExpiration&&r>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}const Wi=new t.Color(1,0,0,1),Ji=new t.Color(0,1,0,1),Xi=new t.Color(0,0,1,1),Hi=new t.Color(1,0,1,1),Ki=new t.Color(0,1,1,1);function Yi(t,e,i,n){tn(t,0,e+i/2,t.transform.width,i,n)}function Qi(t,e,i,n){tn(t,e-i/2,0,i,t.transform.height,n)}function tn(t,e,i,n,o,s){const r=t.context,a=r.gl;a.enable(a.SCISSOR_TEST),a.scissor(e*t.pixelRatio,i*t.pixelRatio,n*t.pixelRatio,o*t.pixelRatio),r.clear({color:s}),a.disable(a.SCISSOR_TEST)}function en(e,i,n){const o=e.context,s=o.gl,r=n.posMatrix,a=e.useProgram("debug"),l=Ai.disabled,h=Ti.disabled,c=e.colorModeForRenderPass(),u="$debug",d=e.style.map.terrain&&e.style.map.terrain.getTerrainData(n);o.activeTexture.set(s.TEXTURE0);const f=i.getTileByID(n.key).latestRawTileData,p=Math.floor((f&&f.byteLength||0)/1024),m=i.getTile(n).tileSize,g=512/Math.min(m,512)*(n.overscaledZ/e.transform.zoom)*.5;let b=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(b+=` => ${n.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,n=t.context.gl,o=t.debugOverlayCanvas.getContext("2d");o.clearRect(0,0,i.width,i.height),o.shadowColor="white",o.shadowBlur=2,o.lineWidth=1.5,o.strokeStyle="white",o.textBaseline="top",o.font="bold 36px Open Sans, sans-serif",o.fillText(e,5,5),o.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,`${b} ${p}kB`),a.draw(o,s.TRIANGLES,l,h,Ci.alphaBlended,Pi.disabled,xe(r,t.Color.transparent,g),null,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(o,s.LINE_STRIP,l,h,c,Pi.disabled,xe(r,t.Color.red),d,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function nn(t,e,i){const n=t.context,o=n.gl,s=t.colorModeForRenderPass(),r=new Ai(o.LEQUAL,Ai.ReadWrite,t.depthRangeFor3D),a=t.useProgram("terrain"),l=e.getTerrainMesh();n.bindFramebuffer.set(null),n.viewport.set([0,0,t.width,t.height]);for(const h of i){const i=t.renderToTexture.getTexture(h),c=e.getTerrainData(h.tileID);n.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,i.texture);const u={u_matrix:t.transform.calculatePosMatrix(h.tileID.toUnwrapped()),u_texture:0,u_ele_delta:e.getMeshFrameDelta(t.transform.zoom)};a.draw(n,o.TRIANGLES,r,Ti.disabled,s,Pi.backCCW,u,c,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}class on{constructor(e,i){this.context=new Ei(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.create(),renderTime:0},this.setup(),this.numSublayers=K.maxUnderzooming+K.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Qt}resize(t,e,i){if(this.width=Math.floor(t*i),this.height=Math.floor(e*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize()}setup(){const e=this.context,i=new t.PosArray;i.emplaceBack(0,0),i.emplaceBack(t.EXTENT,0),i.emplaceBack(0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(i,se.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);const n=new t.PosArray;n.emplaceBack(0,0),n.emplaceBack(t.EXTENT,0),n.emplaceBack(0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(n,se.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);const o=new t.RasterBoundsArray;o.emplaceBack(0,0,0,0),o.emplaceBack(t.EXTENT,0,t.EXTENT,0),o.emplaceBack(0,t.EXTENT,0,t.EXTENT),o.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(o,R.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);const s=new t.PosArray;s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(s,se.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);const r=new t.LineStripIndexArray;r.emplaceBack(0),r.emplaceBack(1),r.emplaceBack(3),r.emplaceBack(2),r.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(r);const a=new t.TriangleIndexArray;a.emplaceBack(0,1,2),a.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(a);const l=this.context.gl;this.stencilClearMode=new Ti({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const n=t.create();t.ortho(n,0,this.width,this.height,0,0,1),t.scale(n,n,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,i.TRIANGLES,Ai.disabled,this.stencilClearMode,Ci.disabled,Pi.disabled,_e(n),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;const i=this.context,n=i.gl;this.nextStencilID+e.length>256&&this.clearStencil(),i.setColorMode(Ci.disabled),i.setDepthMode(Ai.disabled);const o=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,s=this.style.map.terrain&&this.style.map.terrain.getTerrainData(t);o.draw(i,n.TRIANGLES,Ai.disabled,new Ti({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),Ci.disabled,Pi.disabled,_e(t.posMatrix),s,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new Ti({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Ti({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),n=i[i.length-1].overscaledZ,o=i[0].overscaledZ-n+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();const t={};for(let i=0;i<o;i++)t[i+n]=new Ti({func:e.GEQUAL,mask:255},i+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=o,[t,i]}return[{[n]:Ti.disabled},i]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new Ci([e.CONSTANT_COLOR,e.ONE],new t.Color(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Ci.unblended:Ci.alphaBlended}depthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return Ai.disabled;const n=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Ai(i||this.context.gl.LEQUAL,e,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.browser.now()),this.imageManager.beginFrame();const n=this.style._order,o=this.style.sourceCaches,s={},r={},a={};for(const t in o){const e=o[t];e.used&&e.prepare(this.context),s[t]=e.getVisibleCoordinates(),r[t]=s[t].slice().reverse(),a[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<n.length;t++)if(this.style._layers[n[t]].is3D()){this.opaquePassCutoff=t;break}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const e=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!t.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||e.length)&&(t.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(e,i){const n=e.context,o=n.gl,s=Ci.unblended,r=new Ai(o.LEQUAL,Ai.ReadWrite,[0,1]),a=i.getTerrainMesh(),l=i.sourceCache.getRenderableTiles(),h=e.useProgram("terrainDepth");n.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),n.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),n.clear({color:t.Color.transparent,depth:1});for(const t of l){const l=i.getTerrainData(t.tileID),c={u_matrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped()),u_ele_delta:i.getMeshFrameDelta(e.transform.zoom)};h.draw(n,o.TRIANGLES,r,Ti.disabled,s,Pi.backCCW,c,l,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain),function(e,i){const n=e.context,o=n.gl,s=Ci.unblended,r=new Ai(o.LEQUAL,Ai.ReadWrite,[0,1]),a=i.getTerrainMesh(),l=i.getCoordsTexture(),h=i.sourceCache.getRenderableTiles(),c=e.useProgram("terrainCoords");n.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),n.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),n.clear({color:t.Color.transparent,depth:1}),i.coordsIndex=[];for(const t of h){const h=i.getTerrainData(t.tileID);n.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,l.texture);const u={u_matrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped()),u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(e.transform.zoom)};c.draw(n,o.TRIANGLES,r,Ti.disabled,s,Pi.backCCW,u,h,"terrain",a.vertexBuffer,a.indexBuffer,a.segments),i.coordsIndex.push(t.tileID.key)}n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain))}this.renderPass="offscreen";for(const t of n){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const i=r[e.source];("custom"===e.type||i.length)&&this.renderLayer(this,o[e.source],e,i)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=n.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[n[this.currentLayer]],e=o[t.source],i=s[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){const t=this.style._layers[n[this.currentLayer]],e=o[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t))continue;const i=("symbol"===t.type?a:r)[t.source];this._renderTileClippingMasks(t,s[t.source]),this.renderLayer(this,e,t,i)}if(this.options.showTileBoundaries){const t=function(t,e){let i=null;const n=Object.values(t._layers).flatMap((i=>i.source&&!i.isHidden(e)?[t.sourceCaches[i.source]]:[])),o=n.filter((t=>"vector"===t.getSource().type)),s=n.filter((t=>"vector"!==t.getSource().type)),r=t=>{(!i||i.getSource().maxzoom<t.getSource().maxzoom)&&(i=t)};return o.forEach((t=>r(t))),i||s.forEach((t=>r(t))),i}(this.style,this.transform.zoom);t&&function(t,e,i){for(let n=0;n<i.length;n++)en(t,e,i[n])}(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;Yi(t,t.transform.height-(e.top||0),3,Wi),Yi(t,e.bottom||0,3,Ji),Qi(t,e.left||0,3,Xi),Qi(t,t.transform.width-(e.right||0),3,Hi);const i=t.transform.centerPoint;!function(t,e,i,n){tn(t,e-1,i-10,2,20,n),tn(t,e-10,i-1,20,2,n)}(t,i.x,t.transform.height-i.y,Ki)}(this),this.context.setDefault()}renderLayer(e,i,n,o){if(!n.isHidden(this.transform.zoom)&&("background"===n.type||"custom"===n.type||(o||[]).length))switch(this.id=n.id,n.type){case"symbol":!function(e,i,n,o,s){if("translucent"!==e.renderPass)return;const r=Ti.disabled,a=e.colorModeForRenderPass();(n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,i,n,o,s,r,a){const l=i.transform,h="map"===s,c="map"===r;for(const s of e){const e=o.getTile(s),r=e.getBucket(n);if(!r||!r.text||!r.text.segments.get().length)continue;const u=t.evaluateSizeForZoom(r.textSizeData,l.zoom),d=Ct(e,1,i.transform.zoom),f=lt(s.posMatrix,c,h,i.transform,d),p="none"!==n.layout.get("icon-text-fit")&&r.hasIconData();if(u){const t=Math.pow(2,l.zoom-e.tileID.overscaledZ);ji(r,h,c,a,l,f,s.posMatrix,t,u,p,i.style.map.terrain?(t,e)=>i.style.map.terrain.getElevation(s,t,e):null)}}}(o,e,n,i,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),s),0!==n.paint.get("icon-opacity").constantOr(1)&&Ri(e,i,n,o,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),r,a),0!==n.paint.get("text-opacity").constantOr(1)&&Ri(e,i,n,o,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),r,a),i.map.showCollisionBoxes&&(Fi(e,i,n,o,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Fi(e,i,n,o,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))}(e,i,n,o,this.style.placement.variableOffsets);break;case"circle":!function(e,i,n,o){if("translucent"!==e.renderPass)return;const s=n.paint.get("circle-opacity"),r=n.paint.get("circle-stroke-width"),a=n.paint.get("circle-stroke-opacity"),l=!n.layout.get("circle-sort-key").isConstant();if(0===s.constantOr(1)&&(0===r.constantOr(1)||0===a.constantOr(1)))return;const h=e.context,c=h.gl,u=e.depthModeForSublayer(0,Ai.ReadOnly),d=Ti.disabled,f=e.colorModeForRenderPass(),p=[];for(let s=0;s<o.length;s++){const r=o[s],a=i.getTile(r),h=a.getBucket(n);if(!h)continue;const c=h.programConfigurations.get(n.id),u=e.useProgram("circle",c),d=h.layoutVertexBuffer,f=h.indexBuffer,m=e.style.map.terrain&&e.style.map.terrain.getTerrainData(r),g={programConfiguration:c,program:u,layoutVertexBuffer:d,indexBuffer:f,uniformValues:we(e,r,a,n),terrainData:m};if(l){const e=h.segments.get();for(const i of e)p.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:g})}else p.push({segments:h.segments,sortKey:0,state:g})}l&&p.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of p){const{programConfiguration:i,program:o,layoutVertexBuffer:s,indexBuffer:r,uniformValues:a,terrainData:l}=t.state;o.draw(h,c.TRIANGLES,u,d,f,Pi.disabled,a,l,n.id,s,r,t.segments,n.paint,e.transform.zoom,i)}}(e,i,n,o);break;case"heatmap":!function(e,i,n,o){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const s=e.context,r=s.gl,a=Ti.disabled,l=new Ci([r.ONE,r.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,i){const n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let o=i.heatmapFbo;if(o)n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),t.bindFramebuffer.set(o.framebuffer);else{const s=n.createTexture();n.bindTexture(n.TEXTURE_2D,s),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),o=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1,!1),function(t,e,i,n){var o,s;const r=t.gl,a=null!==(o=t.HALF_FLOAT)&&void 0!==o?o:r.UNSIGNED_BYTE,l=null!==(s=t.RGBA16F)&&void 0!==s?s:r.RGBA;r.texImage2D(r.TEXTURE_2D,0,l,e.width/4,e.height/4,0,r.RGBA,a,null),n.colorAttachment.set(i)}(t,e,s,o)}}(s,e,n),s.clear({color:t.Color.transparent});for(let t=0;t<o.length;t++){const h=o[t];if(i.hasRenderableParent(h))continue;const c=i.getTile(h),u=c.getBucket(n);if(!u)continue;const d=u.programConfigurations.get(n.id),f=e.useProgram("heatmap",d),{zoom:p}=e.transform;f.draw(s,r.TRIANGLES,Ai.disabled,a,l,Pi.disabled,ke(h.posMatrix,c,p,n.paint.get("heatmap-intensity")),null,n.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,n.paint,e.transform.zoom,d)}s.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,i){const n=e.context,o=n.gl,s=i.heatmapFbo;if(!s)return;n.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,s.colorAttachment.get()),n.activeTexture.set(o.TEXTURE1);let r=i.colorRampTexture;r||(r=i.colorRampTexture=new w(n,i.colorRamp,o.RGBA)),r.bind(o.LINEAR,o.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(n,o.TRIANGLES,Ai.disabled,Ti.disabled,e.colorModeForRenderPass(),Pi.disabled,((e,i,n,o)=>{const s=t.create();t.ortho(s,0,e.width,e.height,0,0,1);const r=e.context.gl;return{u_matrix:s,u_world:[r.drawingBufferWidth,r.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:i.paint.get("heatmap-opacity")}})(e,i),null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom)}(e,n))}(e,i,n,o);break;case"line":!function(e,i,n,o){if("translucent"!==e.renderPass)return;const s=n.paint.get("line-opacity"),r=n.paint.get("line-width");if(0===s.constantOr(1)||0===r.constantOr(1))return;const a=e.depthModeForSublayer(0,Ai.ReadOnly),l=e.colorModeForRenderPass(),h=n.paint.get("line-dasharray"),c=n.paint.get("line-pattern"),u=c.constantOr(1),d=n.paint.get("line-gradient"),f=n.getCrossfadeParameters(),p=u?"linePattern":h?"lineSDF":d?"lineGradient":"line",m=e.context,g=m.gl;let b=!0;for(const s of o){const o=i.getTile(s);if(u&&!o.patternsLoaded())continue;const r=o.getBucket(n);if(!r)continue;const v=r.programConfigurations.get(n.id),y=e.context.program.get(),x=e.useProgram(p,v),_=b||x.program!==y,k=e.style.map.terrain&&e.style.map.terrain.getTerrainData(s),M=c.constantOr(null);if(M&&o.imageAtlas){const t=o.imageAtlas,e=t.patternPositions[M.to.toString()],i=t.patternPositions[M.from.toString()];e&&i&&v.setConstantPatternPositions(e,i)}const z=k?s:null,S=u?Ce(e,o,n,f,z):h?Ee(e,o,n,h,f,z):d?Se(e,o,n,r.lineClipsArray.length,z):ze(e,o,n,z);if(u)m.activeTexture.set(g.TEXTURE0),o.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),v.updatePaintBuffers(f);else if(h&&(_||e.lineAtlas.dirty))m.activeTexture.set(g.TEXTURE0),e.lineAtlas.bind(m);else if(d){const o=r.gradients[n.id];let a=o.texture;if(n.gradientVersion!==o.version){let l=256;if(n.stepInterpolant){const n=i.getSource().maxzoom,o=s.canonical.z===n?Math.ceil(1<<e.transform.maxZoom-s.canonical.z):1;l=t.clamp(t.nextPowerOfTwo(r.maxLineLength/t.EXTENT*1024*o),256,m.maxTextureSize)}o.gradient=t.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:o.gradient||void 0,clips:r.lineClipsArray}),o.texture?o.texture.update(o.gradient):o.texture=new w(m,o.gradient,g.RGBA),o.version=n.gradientVersion,a=o.texture}m.activeTexture.set(g.TEXTURE0),a.bind(n.stepInterpolant?g.NEAREST:g.LINEAR,g.CLAMP_TO_EDGE)}x.draw(m,g.TRIANGLES,a,e.stencilModeForClipping(s),l,Pi.disabled,S,k,n.id,r.layoutVertexBuffer,r.indexBuffer,r.segments,n.paint,e.transform.zoom,v,r.layoutVertexBuffer2),b=!1}}(e,i,n,o);break;case"fill":!function(e,i,n,o){const s=n.paint.get("fill-color"),r=n.paint.get("fill-opacity");if(0===r.constantOr(1))return;const a=e.colorModeForRenderPass(),l=n.paint.get("fill-pattern"),h=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===s.constantOr(t.Color.transparent).a&&1===r.constantOr(0)?"opaque":"translucent";if(e.renderPass===h){const t=e.depthModeForSublayer(1,"opaque"===e.renderPass?Ai.ReadWrite:Ai.ReadOnly);Ui(e,i,n,o,t,a,!1)}if("translucent"===e.renderPass&&n.paint.get("fill-antialias")){const t=e.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,Ai.ReadOnly);Ui(e,i,n,o,t,a,!0)}}(e,i,n,o);break;case"fill-extrusion":!function(t,e,i,n){const o=i.paint.get("fill-extrusion-opacity");if(0!==o&&"translucent"===t.renderPass){const s=new Ai(t.context.gl.LEQUAL,Ai.ReadWrite,t.depthRangeFor3D);if(1!==o||i.paint.get("fill-extrusion-pattern").constantOr(1))qi(t,e,i,n,s,Ti.disabled,Ci.disabled),qi(t,e,i,n,s,t.stencilModeFor3D(),t.colorModeForRenderPass());else{const o=t.colorModeForRenderPass();qi(t,e,i,n,s,Ti.disabled,o)}}}(e,i,n,o);break;case"hillshade":!function(t,e,i,n){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const o=t.context,s=t.depthModeForSublayer(0,Ai.ReadOnly),r=t.colorModeForRenderPass(),[a,l]="translucent"===t.renderPass?t.stencilConfigForOverlap(n):[{},n];for(const n of l){const o=e.getTile(n);void 0!==o.needsHillshadePrepare&&o.needsHillshadePrepare&&"offscreen"===t.renderPass?Gi(t,o,i,s,Ti.disabled,r):"translucent"===t.renderPass&&Vi(t,n,o,i,s,a[n.overscaledZ],r)}o.viewport.set([0,0,t.width,t.height])}(e,i,n,o);break;case"raster":!function(t,e,i,n){if("translucent"!==t.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!n.length)return;const o=t.context,s=o.gl,r=e.getSource(),a=t.useProgram("raster"),l=t.colorModeForRenderPass(),[h,c]=r instanceof N?[{},n]:t.stencilConfigForOverlap(n),u=c[c.length-1].overscaledZ,d=!t.options.moving;for(const n of c){const c=t.depthModeForSublayer(n.overscaledZ-u,1===i.paint.get("raster-opacity")?Ai.ReadWrite:Ai.ReadOnly,s.LESS),f=e.getTile(n);f.registerFadeDuration(i.paint.get("raster-fade-duration"));const p=e.findLoadedParent(n,0),m=Zi(f,p,e,i,t.transform,t.style.map.terrain);let g,b;const v="nearest"===i.paint.get("raster-resampling")?s.NEAREST:s.LINEAR;o.activeTexture.set(s.TEXTURE0),f.texture.bind(v,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST),o.activeTexture.set(s.TEXTURE1),p?(p.texture.bind(v,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST),g=Math.pow(2,p.tileID.overscaledZ-f.tileID.overscaledZ),b=[f.tileID.canonical.x*g%1,f.tileID.canonical.y*g%1]):f.texture.bind(v,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST);const w=t.style.map.terrain&&t.style.map.terrain.getTerrainData(n),y=w?n:null,x=y?y.posMatrix:t.transform.calculatePosMatrix(n.toUnwrapped(),d),_=Te(x,b||[0,0],g||1,m,i);r instanceof N?a.draw(o,s.TRIANGLES,c,Ti.disabled,l,Pi.disabled,_,w,i.id,r.boundsBuffer,t.quadTriangleIndexBuffer,r.boundsSegments):a.draw(o,s.TRIANGLES,c,h[n.overscaledZ],l,Pi.disabled,_,w,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}}(e,i,n,o);break;case"background":!function(t,e,i,n){const o=i.paint.get("background-color"),s=i.paint.get("background-opacity");if(0===s)return;const r=t.context,a=r.gl,l=t.transform,h=l.tileSize,c=i.paint.get("background-pattern");if(t.isPatternMissing(c))return;const u=!c&&1===o.a&&1===s&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==u)return;const d=Ti.disabled,f=t.depthModeForSublayer(0,"opaque"===u?Ai.ReadWrite:Ai.ReadOnly),p=t.colorModeForRenderPass(),m=t.useProgram(c?"backgroundPattern":"background"),g=n||l.coveringTiles({tileSize:h,terrain:t.style.map.terrain});c&&(r.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));const b=i.getCrossfadeParameters();for(const e of g){const l=n?e.posMatrix:t.transform.calculatePosMatrix(e.toUnwrapped()),u=c?je(l,s,t,c,{tileID:e,tileSize:h},b):De(l,s,o),g=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);m.draw(r,a.TRIANGLES,f,d,p,Pi.disabled,u,g,i.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}}(e,0,n,o);break;case"custom":!function(t,e,i){const n=t.context,o=i.implementation;if("offscreen"===t.renderPass){const e=o.prerender;e&&(t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),e.call(o,n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),n.setStencilMode(Ti.disabled);const e="3d"===o.renderingMode?new Ai(t.context.gl.LEQUAL,Ai.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Ai.ReadOnly);n.setDepthMode(e),o.render(n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState(),n.bindFramebuffer.set(null)}}(e,0,n)}}translatePosMatrix(e,i,n,o,s){if(!n[0]&&!n[1])return e;const r=s?"map"===o?this.transform.angle:0:"viewport"===o?-this.transform.angle:0;if(r){const t=Math.sin(r),e=Math.cos(r);n=[n[0]*e-n[1]*t,n[0]*t+n[1]*e]}const a=[s?n[0]:Ct(i,n[0],this.transform.zoom),s?n[1]:Ct(i,n[1],this.transform.zoom),0],l=new Float32Array(16);return t.translate(l,e,a),l}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i}useProgram(t,e){this.cache=this.cache||{};const i=t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[i]||(this.cache[i]=new ue(this.context,ae[t],e,Le[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[i]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new w(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}class sn{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(e,i,n){const o=Math.pow(2,n),s=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((n=>{const s=1/(n=t.transformMat4([],n,e))[3]/i*o;return t.mul$1(n,n,[s,s,1/n[3],s])})),r=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const e=function(t,e){var i=e[0],n=e[1],o=e[2],s=i*i+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}([],function(t,e,i){var n=e[0],o=e[1],s=e[2],r=i[0],a=i[1],l=i[2];return t[0]=o*l-s*a,t[1]=s*r-n*l,t[2]=n*a-o*r,t}([],m([],s[t[0]],s[t[1]]),m([],s[t[2]],s[t[1]]))),i=-((n=e)[0]*(o=s[t[1]])[0]+n[1]*o[1]+n[2]*o[2]);var n,o;return e.concat(i)}));return new sn(s,r)}}class rn{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,i){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}([],this.min,this.max))}quadrant(t){const e=[t%2==0,t<2],i=f(this.min),n=f(this.max);for(let t=0;t<e.length;t++)i[t]=e[t]?this.min[t]:this.center[t],n[t]=e[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new rn(i,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(e){const i=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let n=!0;for(let o=0;o<e.planes.length;o++){const s=e.planes[o];let r=0;for(let e=0;e<i.length;e++)t.dot(s,i[e])>=0&&r++;if(0===r)return 0;r!==i.length&&(n=!1)}if(n)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let o=0;o<e.points.length;o++){const s=e.points[o][t]-this.min[t];i=Math.min(i,s),n=Math.max(n,s)}if(n<0||i>this.max[t]-this.min[t])return 0}return 1}}class an{constructor(t=0,e=0,i=0,n=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=n}interpolate(e,i,n){return null!=i.top&&null!=e.top&&(this.top=t.interpolate.number(e.top,i.top,n)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.interpolate.number(e.bottom,i.bottom,n)),null!=i.left&&null!=e.left&&(this.left=t.interpolate.number(e.left,i.left,n)),null!=i.right&&null!=e.right&&(this.right=t.interpolate.number(e.right,i.right,n)),this}getCenter(e,i){const n=t.clamp((this.left+e-this.right)/2,0,e),o=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.Point(n,o)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new an(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ln{constructor(e,i,n,o,s){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===s||!!s,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==n?0:n,this._maxPitch=null==o?60:o,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new an,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new ln(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this._minEleveationForCurrentTile=t._minEleveationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const i=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=function(){var e=new t.ARRAY_TYPE(4);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}(),function(t,e,i){var n=e[0],o=e[1],s=e[2],r=e[3],a=Math.sin(i),l=Math.cos(i);t[0]=n*l+s*a,t[1]=o*l+r*a,t[2]=n*-a+s*l,t[3]=o*-a+r*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const i=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.tileZoom=Math.max(0,Math.floor(e)),this.scale=this.zoomScale(e),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(e){const i=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies){const n=this.pointCoordinate(new t.Point(0,0)),o=this.pointCoordinate(new t.Point(this.width,0)),s=this.pointCoordinate(new t.Point(this.width,this.height)),r=this.pointCoordinate(new t.Point(0,this.height)),a=Math.floor(Math.min(n.x,o.x,s.x,r.x)),l=Math.floor(Math.max(n.x,o.x,s.x,r.x)),h=1;for(let n=a-h;n<=l+h;n++)0!==n&&i.push(new t.UnwrappedTileID(n,e))}return i}coveringTiles(e){var i,n;let o=this.coveringZoomLevel(e);const s=o;if(void 0!==e.minzoom&&o<e.minzoom)return[];void 0!==e.maxzoom&&o>e.maxzoom&&(o=e.maxzoom);const r=this.pointCoordinate(this.getCameraPoint()),a=t.MercatorCoordinate.fromLngLat(this.center),l=Math.pow(2,o),h=[l*r.x,l*r.y,0],c=[l*a.x,l*a.y,0],u=sn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,o);let d=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(d=o);const f=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,p=t=>({aabb:new rn([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),m=[],b=[],v=o,w=e.reparseOverscaled?s:o;if(this._renderWorldCopies)for(let t=1;t<=3;t++)m.push(p(-t)),m.push(p(t));for(m.push(p(0));m.length>0;){const o=m.pop(),s=o.x,r=o.y;let a=o.fullyVisible;if(!a){const t=o.aabb.intersects(u);if(0===t)continue;a=2===t}const l=e.terrain?h:c,p=o.aabb.distanceX(l),y=o.aabb.distanceY(l),x=Math.max(Math.abs(p),Math.abs(y));if(o.zoom===v||x>f+(1<<v-o.zoom)-2&&o.zoom>=d){const e=v-o.zoom,i=h[0]-.5-(s<<e),n=h[1]-.5-(r<<e);b.push({tileID:new t.OverscaledTileID(o.zoom===v?w:o.zoom,o.wrap,o.zoom,s,r),distanceSq:g([c[0]-.5-s,c[1]-.5-r]),tileDistanceToCamera:Math.sqrt(i*i+n*n)})}else for(let l=0;l<4;l++){const h=(s<<1)+l%2,c=(r<<1)+(l>>1),u=o.zoom+1;let d=o.aabb.quadrant(l);if(e.terrain){const s=new t.OverscaledTileID(u,o.wrap,u,h,c),r=e.terrain.getMinMaxElevation(s),a=null!==(i=r.minElevation)&&void 0!==i?i:this.elevation,l=null!==(n=r.maxElevation)&&void 0!==n?n:this.elevation;d=new rn([d.min[0],d.min[1],a],[d.max[0],d.max[1],l])}m.push({aabb:d,zoom:u,x:h,y:c,wrap:o.wrap,fullyVisible:a})}}return b.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(e){const i=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)}unproject(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.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}}recalculateZoom(e){const i=this.pointLocation(this.centerPoint,e),n=e.getElevationForLngLatZoom(i,this.tileZoom);if(!(this.elevation-n))return;const o=this.getCameraPosition(),s=t.MercatorCoordinate.fromLngLat(o.lngLat,o.altitude),r=t.MercatorCoordinate.fromLngLat(i,n),a=s.x-r.x,l=s.y-r.y,h=s.z-r.z,c=Math.sqrt(a*a+l*l+h*h),u=this.scaleZoom(this.cameraToCenterDistance/c/this.tileSize);this._elevation=n,this._center=i,this.zoom=u}setLocationAtPoint(e,i){const n=this.pointCoordinate(i),o=this.pointCoordinate(this.centerPoint),s=this.locationCoordinate(e),r=new t.MercatorCoordinate(s.x-(n.x-o.x),s.y-(n.y-o.y));this.center=this.coordinateLocation(r),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,e){return e?this.coordinatePoint(this.locationCoordinate(t),e.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,e){return this.coordinateLocation(this.pointCoordinate(t,e))}locationCoordinate(e){return t.MercatorCoordinate.fromLngLat(e)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(e,i){if(i){const t=i.pointCoordinate(e);if(null!=t)return t}const n=[e.x,e.y,0,1],o=[e.x,e.y,1,1];t.transformMat4(n,n,this.pixelMatrixInverse),t.transformMat4(o,o,this.pixelMatrixInverse);const s=n[3],r=o[3],a=n[1]/s,l=o[1]/r,h=n[2]/s,c=o[2]/r,u=h===c?0:(0-h)/(c-h);return new t.MercatorCoordinate(t.interpolate.number(n[0]/s,o[0]/r,u)/this.worldSize,t.interpolate.number(a,l,u)/this.worldSize)}coordinatePoint(e,i=0,n=this.pixelMatrix){const o=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.transformMat4(o,o,n),new t.Point(o[0]/o[3],o[1]/o[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return(new $).extend(this.pointLocation(new t.Point(0,e))).extend(this.pointLocation(new t.Point(this.width,e))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new $([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}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,i=!1){const n=e.key,o=i?this._alignedPosMatrixCache:this._posMatrixCache;if(o[n])return o[n];const s=e.canonical,r=this.worldSize/this.zoomScale(s.z),a=s.x+Math.pow(2,s.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[a*r,s.y*r,0]),t.scale(l,l,[r/t.EXTENT,r/t.EXTENT,1]),t.multiply(l,i?this.alignedProjMatrix:this.projMatrix,l),o[n]=new Float32Array(l),o[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,i,n,o,s=-90,r=90,a=-180,l=180;const h=this.size,c=this._unmodified;if(this.latRange){const i=this.latRange;s=t.mercatorYfromLat(i[1])*this.worldSize,r=t.mercatorYfromLat(i[0])*this.worldSize,e=r-s<h.y?h.y/(r-s):0}if(this.lngRange){const e=this.lngRange;a=t.wrap(t.mercatorXfromLng(e[0])*this.worldSize,0,this.worldSize),l=t.wrap(t.mercatorXfromLng(e[1])*this.worldSize,0,this.worldSize),l<a&&(l+=this.worldSize),i=l-a<h.x?h.x/(l-a):0}const u=this.point,d=Math.max(i||0,e||0);if(d)return this.center=this.unproject(new t.Point(i?(l+a)/2:u.x,e?(r+s)/2:u.y)),this.zoom+=this.scaleZoom(d),this._unmodified=c,void(this._constraining=!1);if(this.latRange){const t=u.y,e=h.y/2;t-e<s&&(o=s+e),t+e>r&&(o=r-e)}if(this.lngRange){const e=(a+l)/2,i=t.wrap(u.x,e-this.worldSize/2,e+this.worldSize/2),o=h.x/2;i-o<a&&(n=a+o),i+o>l&&(n=l-o)}void 0===n&&void 0===o||(this.center=this.unproject(new t.Point(void 0!==n?n:u.x,void 0!==o?o:u.y)).wrap()),this._unmodified=c,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,i=this.point.x,n=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let o=t.identity(new Float64Array(16));t.scale(o,o,[this.width/2,-this.height/2,1]),t.translate(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=t.identity(new Float64Array(16)),t.scale(o,o,[1,-1,1]),t.translate(o,o,[-1,-1,0]),t.scale(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o;const s=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),r=Math.min(this.elevation,this._minEleveationForCurrentTile),a=s-r*this._pixelPerMeter/Math.cos(this._pitch),l=r<0?a:s,h=Math.PI/2+this._pitch,c=this._fov*(.5+e.y/this.height),u=Math.sin(c)*l/Math.sin(t.clamp(Math.PI-h-c,.01,Math.PI-.01)),d=this.getHorizon(),f=2*Math.atan(d/this.cameraToCenterDistance)*(.5+e.y/(2*d)),p=Math.sin(f)*l/Math.sin(t.clamp(Math.PI-h-f,.01,Math.PI-.01)),m=Math.min(u,p),g=1.01*(Math.cos(Math.PI/2-this._pitch)*m+l),b=this.height/50;o=new Float64Array(16),t.perspective(o,this._fov,this.width/this.height,b,g),o[8]=2*-e.x/this.width,o[9]=2*e.y/this.height,t.scale(o,o,[1,-1,1]),t.translate(o,o,[0,0,-this.cameraToCenterDistance]),t.rotateX(o,o,this._pitch),t.rotateZ(o,o,this.angle),t.translate(o,o,[-i,-n,0]),this.mercatorMatrix=t.scale([],o,[this.worldSize,this.worldSize,this.worldSize]),t.scale(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,o),t.translate(o,o,[0,0,-this.elevation]),this.projMatrix=o,this.invProjMatrix=t.invert([],o),this.pixelMatrix3D=t.multiply(new Float64Array(16),this.labelPlaneMatrix,o);const v=this.width%2/2,w=this.height%2/2,y=Math.cos(this.angle),x=Math.sin(this.angle),_=i-Math.round(i)+y*v+x*w,k=n-Math.round(n)+y*w+x*v,M=new Float64Array(o);if(t.translate(M,M,[_>.5?_-1:_,k>.5?k-1:k,0]),this.alignedProjMatrix=M,o=t.invert(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new t.Point(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))}getCameraQueryGeometry(e){const i=this.getCameraPoint();if(1===e.length)return[e[0],i];{let n=i.x,o=i.y,s=i.x,r=i.y;for(const t of e)n=Math.min(n,t.x),o=Math.min(o,t.y),s=Math.max(s,t.x),r=Math.max(r,t.y);return[new t.Point(n,o),new t.Point(s,o),new t.Point(s,r),new t.Point(n,r),new t.Point(n,o)]}}}class hn{constructor(t){this._getCurrentHash=()=>{const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((t=>t.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{const t=this._getCurrentHash();if(t.length>=3&&!t.some((t=>isNaN(t)))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch(t){}},this._updateHash=function(t,e){let i=!1,n=null;const o=()=>{n=null,i&&(t(),n=setTimeout(o,300),i=!1)};return()=>(i=!0,n||o(),n)}(this._updateHashUnthrottled),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),s=Math.round(e.lng*o)/o,r=Math.round(e.lat*o)/o,a=this._map.getBearing(),l=this._map.getPitch();let h="";if(h+=t?`/${s}/${r}/${i}`:`${i}/${r}/${s}`,(a||l)&&(h+="/"+Math.round(10*a)/10),l&&(h+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const n=i.split("=")[0];return n===t?(e=!0,`${n}=${h}`):i})).filter((t=>t));return e||i.push(`${t}=${h}`),`#${i.join("&")}`}return`#${h}`}}const cn={linearity:.3,easing:t.bezier(0,0,.3,1)},un=t.extend({deceleration:2500,maxSpeed:1400},cn),dn=t.extend({deceleration:20,maxSpeed:1400},cn),fn=t.extend({deceleration:1e3,maxSpeed:360},cn),pn=t.extend({deceleration:1e3,maxSpeed:90},cn);class mn{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.browser.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=t.browser.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(i.pan.mag()){const s=bn(i.pan.mag(),n,t.extend({},un,e||{}));o.offset=i.pan.mult(s.amount/i.pan.mag()),o.center=this._map.transform.center,gn(o,s)}if(i.zoom){const t=bn(i.zoom,n,dn);o.zoom=this._map.transform.zoom+t.amount,gn(o,t)}if(i.bearing){const e=bn(i.bearing,n,fn);o.bearing=this._map.transform.bearing+t.clamp(e.amount,-179,179),gn(o,e)}if(i.pitch){const t=bn(i.pitch,n,pn);o.pitch=this._map.transform.pitch+t.amount,gn(o,t)}if(o.zoom||o.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;o.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),t.extend(o,{noMoveStart:!0})}}function gn(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function bn(e,i,n){const{maxSpeed:o,linearity:s,deceleration:r}=n,a=t.clamp(e*s/(i/1e3),-o,o),l=Math.abs(a)/(r*s);return{easing:n.easing,duration:1e3*l,amount:a*(l/2)}}class vn extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,o,s={}){const r=i.mousePos(n.getCanvasContainer(),o),a=n.unproject(r);super(e,t.extend({point:r,lngLat:a,originalEvent:o},s)),this._defaultPrevented=!1,this.target=n}}class wn extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,o){const s="touchend"===e?o.changedTouches:o.touches,r=i.touchPos(n.getCanvasContainer(),s),a=r.map((t=>n.unproject(t))),l=r.reduce(((t,e,i,n)=>t.add(e.div(n.length))),new t.Point(0,0));super(e,{points:r,point:l,lngLats:a,lngLat:n.unproject(l),originalEvent:o}),this._defaultPrevented=!1}}class yn extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}}class xn{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new yn(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new vn(t.type,this._map,t))}mouseup(t){this._map.fire(new vn(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new vn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new vn(t.type,this._map,t))}mouseover(t){this._map.fire(new vn(t.type,this._map,t))}mouseout(t){this._map.fire(new vn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new wn(t.type,this._map,t))}touchmove(t){this._map.fire(new wn(t.type,this._map,t))}touchend(t){this._map.fire(new wn(t.type,this._map,t))}touchcancel(t){this._map.fire(new wn(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class _n{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new vn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new vn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new vn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class kn{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.pointLocation(t.Point.convert(e),this._map.terrain)}}class Mn{constructor(t,e){this._map=t,this._tr=new kn(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(i.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const n=e;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)<this._clickTolerance)return;const o=this._startPos;this._lastPos=n,this._box||(this._box=i.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const s=Math.min(o.x,n.x),r=Math.max(o.x,n.x),a=Math.min(o.y,n.y),l=Math.max(o.y,n.y);i.setTransform(this._box,`translate(${s}px,${a}px)`),this._box.style.width=r-s+"px",this._box.style.height=l-a+"px"}mouseupWindow(e,n){if(!this._active)return;if(0!==e.button)return;const o=this._startPos,s=n;if(this.reset(),i.suppressClick(),o.x!==s.x||o.y!==s.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:t=>t.fitScreenCoordinates(o,s,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(i.remove(this._box),this._box=null),i.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))}}function zn(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const i={};for(let n=0;n<t.length;n++)i[t[n].identifier]=e[n];return i}class Sn{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(e){const i=new t.Point(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=zn(n,i)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const n=zn(i,e);for(const t in this.touches){const e=n[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class Cn{constructor(t){this.singleTap=new Sn(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){const n=this.singleTap.touchend(t,e,i);if(n){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(n)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class En{constructor(t){this._tr=new kn(t),this._zoomIn=new Cn({numTouches:1,numTaps:2}),this._zoomOut=new Cn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){const n=this._zoomIn.touchend(t,e,i),o=this._zoomOut.touchend(t,e,i),s=this._tr;return n?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:s.zoom+1,around:s.unproject(n)},{originalEvent:t})}):o?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:s.zoom-1,around:s.unproject(o)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class An{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=e.length?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const n=e.length?e[0]:e;return!this._moved&&n.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=n,this._move(i,n))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&i.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const In={0:1,2:2};class Tn{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const e=i.mouseButton(t);this._eventButton=e}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(t,e){const i=In[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton)}isValidEndEvent(t){return i.mouseButton(t)===this._eventButton}}class Pn{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const $n=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=function(t){t.preventDefault()}},Fn=({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:n=.8})=>{const o=new Tn({checkCorrectEvent:t=>0===i.mouseButton(t)&&t.ctrlKey||2===i.mouseButton(t)});return new An({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*n}),moveStateManager:o,enable:t,assignEvents:$n})},On=({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:n=-.5})=>{const o=new Tn({checkCorrectEvent:t=>0===i.mouseButton(t)&&t.ctrlKey||2===i.mouseButton(t)});return new An({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*n}),moveStateManager:o,enable:t,assignEvents:$n})};class Dn{constructor(t,e){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.Point(0,0),setTimeout((()=>{this._cancelCooperativeMessage=!1}),200)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._map._cooperativeGestures&&(2===this._minTouches&&i.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,i.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(i.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,i)}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&i.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,n){n.length>0&&(this._active=!0);const o=zn(n,i),s=new t.Point(0,0),r=new t.Point(0,0);let a=0;for(const t in o){const e=o[t],i=this._touches[t];i&&(s._add(e),r._add(e.sub(i)),a++,o[t]=e)}if(this._touches=o,a<this._minTouches||!r.mag())return;const l=r.div(a);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:s.div(a),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class jn{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,i){if(!this._firstTwoTouches)return;t.preventDefault();const[n,o]=this._firstTwoTouches,s=Ln(i,e,n),r=Ln(i,e,o);if(!s||!r)return;const a=this._aroundCenter?null:s.add(r).div(2);return this._move([s,r],a,t)}touchend(t,e,n){if(!this._firstTwoTouches)return;const[o,s]=this._firstTwoTouches,r=Ln(n,e,o),a=Ln(n,e,s);r&&a||(this._active&&i.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Ln(t,e,i){for(let n=0;n<t.length;n++)if(t[n].identifier===i)return e[n]}function Rn(t,e){return Math.log(t/e)/Math.LN2}class Nn extends jn{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Rn(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Rn(this._distance,i),pinchAround:e}}}function Bn(t,e){return 180*t.angleWith(e)/Math.PI}class Un extends jn{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e){const i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Bn(this._vector,i),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,i=Bn(t,this._startVector);return Math.abs(i)<e}}function qn(t){return Math.abs(t.y)>Math.abs(t.x)}class Vn extends jn{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,qn(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const n=t[0].sub(this._lastPoints[0]),o=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(n,o,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+o.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const n=t.mag()>=2,o=e.mag()>=2;if(!n&&!o)return;if(!n||!o)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const s=t.y>0==e.y>0;return qn(t)&&qn(e)&&s}}const Gn={panStep:100,bearingStep:15,pitchStep:10};class Zn{constructor(t){this._tr=new kn(t);const e=Gn;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,n=0,o=0,s=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),o=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),o=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),s=-1);break;case 40:t.shiftKey?n=-1:(t.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:r=>{const a=this._tr;r.easeTo({duration:300,easeId:"keyboardHandler",easing:Wn,zoom:e?Math.round(a.zoom)+e*(t.shiftKey?2:1):a.zoom,bearing:a.bearing+i*this._bearingStep,pitch:a.pitch+n*this._pitchStep,offset:[-o*this._panStep,-s*this._panStep],center:a.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Wn(t){return t*(2-t)}const Jn=4.000244140625;class Xn{constructor(t,e){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new kn(t),this._el=t.getCanvasContainer(),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!e[this._map._metaKey])return;e.preventDefault()}let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const n=t.browser.now(),o=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==i&&i%Jn==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=i.mousePos(this._el,e),o=this._tr;this._around=t.LngLat.convert(this._aroundCenter?o.center:o.unproject(n)),this._aroundPoint=o.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._tr.transform;if(0!==this._delta){const t="wheel"===this._type&&Math.abs(this._delta)>Jn?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);const n="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(n*i))),"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"==typeof this._targetZoom?this._targetZoom:e.zoom,n=this._startZoom,o=this._easing;let s,r=!1;if("wheel"===this._type&&n&&o){const e=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),a=o(e);s=t.interpolate.number(n,i,a),e<1?this._frameId||(this._frameId=!0):r=!0}else s=i,r=!0;return this._active=!0,r&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!r,zoomDelta:s-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.defaultEasing;if(this._prevEase){const e=this._prevEase,n=(t.browser.now()-e.start)/e.duration,o=e.easing(n+.01)-e.easing(n),s=.27/Math.sqrt(o*o+1e-4)*.01,r=Math.sqrt(.0729-s*s);i=t.bezier(s,r,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:i},i}reset(){this._active=!1}}class Hn{constructor(t,e){this._clickZoom=t,this._tapZoom=e}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Kn{constructor(t){this._tr=new kn(t),this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Yn{constructor(){this._tap=new Cn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,e,i){if(!this._swipePoint)if(this._tapTime){const n=e[0],o=t.timeStamp-this._tapTime<500,s=this._tapPoint.dist(n)<30;o&&s?i.length>0&&(this._swipePoint=n,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(t,e,i)}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const n=e[0],o=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:o/128}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{const n=this._tap.touchend(t,e,i);n&&(this._tapTime=t.timeStamp,this._tapPoint=n)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Qn{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class to{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i}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 eo{constructor(t,e,i,n){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const io=t=>t.zoom||t.drag||t.pitch||t.rotate;class no extends t.Event{}function oo(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class so{constructor(t,e){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,e)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const n="renderFrame"===t.type?void 0:t,o={needsRenderFrame:!1},s={},r={},a=t.touches,l=a?this._getMapTouches(a):void 0,h=l?i.touchPos(this._el,l):i.mousePos(this._el,t);for(const{handlerName:i,handler:a,allowed:c}of this._handlers){if(!a.isEnabled())continue;let u;this._blockedByActive(r,c,i)?a.reset():a[e||t.type]&&(u=a[e||t.type](t,h,l),this.mergeHandlerResult(o,s,u,i,n),u&&u.needsRenderFrame&&this._triggerRenderFrame()),(u||a.isActive())&&(r[i]=a)}const c={};for(const t in this._previousActiveHandlers)r[t]||(c[t]=n);this._previousActiveHandlers=r,(Object.keys(c).length||oo(o))&&(this._changes.push([o,s,c]),this._triggerRenderFrame()),(Object.keys(r).length||oo(o))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=o;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new mn(t),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(e);const n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,n]of this._listeners)i.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,n)}destroy(){for(const[t,e,n]of this._listeners)i.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(t){const e=this._map,n=e.getCanvasContainer();this._add("mapEvent",new xn(e,t));const o=e.boxZoom=new Mn(e,t);this._add("boxZoom",o),t.interactive&&t.boxZoom&&o.enable();const s=new En(e),r=new Kn(e);e.doubleClickZoom=new Hn(r,s),this._add("tapZoom",s),this._add("clickZoom",r),t.interactive&&t.doubleClickZoom&&e.doubleClickZoom.enable();const a=new Yn;this._add("tapDragZoom",a);const l=e.touchPitch=new Vn(e);this._add("touchPitch",l),t.interactive&&t.touchPitch&&e.touchPitch.enable(t.touchPitch);const h=Fn(t),c=On(t);e.dragRotate=new to(t,h,c),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]),t.interactive&&t.dragRotate&&e.dragRotate.enable();const u=(({enable:t,clickTolerance:e})=>{const n=new Tn({checkCorrectEvent:t=>0===i.mouseButton(t)&&!t.ctrlKey});return new An({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:n,enable:t,assignEvents:$n})})(t),d=new Dn(t,e);e.dragPan=new Qn(n,u,d),this._add("mousePan",u),this._add("touchPan",d,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&e.dragPan.enable(t.dragPan);const f=new Un,p=new Nn;e.touchZoomRotate=new eo(n,p,f,a),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&e.touchZoomRotate.enable(t.touchZoomRotate);const m=e.scrollZoom=new Xn(e,(()=>this._triggerRenderFrame()));this._add("scrollZoom",m,["mousePan"]),t.interactive&&t.scrollZoom&&e.scrollZoom.enable(t.scrollZoom);const g=e.keyboard=new Zn(e);this._add("keyboard",g),t.interactive&&t.keyboard&&e.keyboard.enable(),this._add("blockableMapEvent",new _n(e))}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(io(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const n in t)if(n!==i&&(!e||e.indexOf(n)<0))return!0;return!1}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}mergeHandlerResult(e,i,n,o,s){if(!n)return;t.extend(e,n);const r={handlerName:o,originalEvent:n.originalEvent||s};void 0!==n.zoomDelta&&(i.zoom=r),void 0!==n.panDelta&&(i.drag=r),void 0!==n.pitchDelta&&(i.pitch=r),void 0!==n.bearingDelta&&(i.rotate=r)}_applyChanges(){const e={},i={},n={};for(const[o,s,r]of this._changes)o.panDelta&&(e.panDelta=(e.panDelta||new t.Point(0,0))._add(o.panDelta)),o.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+o.pitchDelta),void 0!==o.around&&(e.around=o.around),void 0!==o.pinchAround&&(e.pinchAround=o.pinchAround),o.noInertia&&(e.noInertia=o.noInertia),t.extend(i,s),t.extend(n,r);this._updateMapTransform(e,i,n),this._changes=[]}_updateMapTransform(t,e,i){const n=this._map,o=n._getTransformForUpdate(),s=n.terrain;if(!(oo(t)||s&&this._terrainMovement))return this._fireEvents(e,i,!0);let{panDelta:r,zoomDelta:a,bearingDelta:l,pitchDelta:h,around:c,pinchAround:u}=t;void 0!==u&&(c=u),n._stop(!0),c=c||n.transform.centerPoint;const d=o.pointLocation(r?c.sub(r):c);l&&(o.bearing+=l),h&&(o.pitch+=h),a&&(o.zoom+=a),s?this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?o.center=o.pointLocation(o.centerPoint.sub(r)):o.setLocationAtPoint(d,c):(this._terrainMovement=!0,this._map._elevationFreeze=!0,o.setLocationAtPoint(d,c),this._map.once("moveend",(()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,o.recalculateZoom(n.terrain)}))):o.setLocationAtPoint(d,c),n._applyUpdatedTransform(o),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_fireEvents(e,i,n){const o=io(this._eventsInProgress),s=io(e),r={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(r[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!o&&s&&this._fireEvent("movestart",s.originalEvent);for(const t in r)this._fireEvent(t,r[t]);s&&this._fireEvent("move",s.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i)}const a={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:n}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=i[e]||n,a[`${t}end`]=l)}for(const t in a)this._fireEvent(t,a[t]);const h=io(this._eventsInProgress);if(n&&(o||s)&&!h){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;e?(i(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:l})):(this._map.fire(new t.Event("moveend",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.Event(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new no("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class ro extends t.Evented{constructor(e,i){super(),this._renderFrameCallback=()=>{const e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,this.on("moveend",(()=>{delete this._requestedCameraState}))}getCenter(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,i,n){return e=t.Point.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),n)}panTo(e,i,n){return this.easeTo(t.extend({center:e},i),n)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,i,n){return this.easeTo(t.extend({zoom:e},i),n)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(e,i,n){return this.easeTo(t.extend({bearing:e},i),n)}resetNorth(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),i),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}cameraForBounds(t,e){t=$.convert(t);const i=e&&e.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,e)}_cameraForBoxAndBearing(e,i,n,o){const s={top:0,bottom:0,right:0,left:0};if("number"==typeof(o=t.extend({padding:s,offset:[0,0],maxZoom:this.transform.maxZoom},o)).padding){const t=o.padding;o.padding={top:t,bottom:t,right:t,left:t}}o.padding=t.extend(s,o.padding);const r=this.transform,a=r.padding,l=r.project(t.LngLat.convert(e)),h=r.project(t.LngLat.convert(i)),c=l.rotate(-n*Math.PI/180),u=h.rotate(-n*Math.PI/180),d=new t.Point(Math.max(c.x,u.x),Math.max(c.y,u.y)),f=new t.Point(Math.min(c.x,u.x),Math.min(c.y,u.y)),p=d.sub(f),m=(r.width-(a.left+a.right+o.padding.left+o.padding.right))/p.x,g=(r.height-(a.top+a.bottom+o.padding.top+o.padding.bottom))/p.y;if(g<0||m<0)return void t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const b=Math.min(r.scaleZoom(r.scale*Math.min(m,g)),o.maxZoom),v=t.Point.convert(o.offset),w=new t.Point((o.padding.left-o.padding.right)/2,(o.padding.top-o.padding.bottom)/2).rotate(n*Math.PI/180),y=v.add(w).mult(r.scale/r.zoomScale(b));return{center:r.unproject(l.add(h).div(2).sub(y)),zoom:b,bearing:n}}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(e,i,n,o,s){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.Point.convert(e)),this.transform.pointLocation(t.Point.convert(i)),n,o),o,s)}_fitInternal(e,i,n){return e?(delete(i=t.extend(e,i)).padding,i.linear?this.easeTo(i,n):this.flyTo(i,n)):this}jumpTo(e,i){this.stop();const n=this._getTransformForUpdate();let o=!1,s=!1,r=!1;return"zoom"in e&&n.zoom!==+e.zoom&&(o=!0,n.zoom=+e.zoom),void 0!==e.center&&(n.center=t.LngLat.convert(e.center)),"bearing"in e&&n.bearing!==+e.bearing&&(s=!0,n.bearing=+e.bearing),"pitch"in e&&n.pitch!==+e.pitch&&(r=!0,n.pitch=+e.pitch),null==e.padding||n.isPaddingEqual(e.padding)||(n.padding=e.padding),this._applyUpdatedTransform(n),this.fire(new t.Event("movestart",i)).fire(new t.Event("move",i)),o&&this.fire(new t.Event("zoomstart",i)).fire(new t.Event("zoom",i)).fire(new t.Event("zoomend",i)),s&&this.fire(new t.Event("rotatestart",i)).fire(new t.Event("rotate",i)).fire(new t.Event("rotateend",i)),r&&this.fire(new t.Event("pitchstart",i)).fire(new t.Event("pitch",i)).fire(new t.Event("pitchend",i)),this.fire(new t.Event("moveend",i))}calculateCameraOptionsFromTo(e,i,n,o=0){const s=t.MercatorCoordinate.fromLngLat(e,i),r=t.MercatorCoordinate.fromLngLat(n,o),a=r.x-s.x,l=r.y-s.y,h=r.z-s.z,c=Math.hypot(a,l,h);if(0===c)throw new Error("Can't calculate camera options with same From and To");const u=Math.hypot(a,l),d=this.transform.scaleZoom(this.transform.cameraToCenterDistance/c/this.transform.tileSize),f=180*Math.atan2(a,-l)/Math.PI;let p=180*Math.acos(u/c)/Math.PI;return p=h<0?90-p:90+p,{center:r.toLngLat(),zoom:d,pitch:p,bearing:f}}easeTo(e,i){this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.defaultEasing},e)).animate||!e.essential&&t.browser.prefersReducedMotion)&&(e.duration=0);const n=this._getTransformForUpdate(),o=this.getZoom(),s=this.getBearing(),r=this.getPitch(),a=this.getPadding(),l="zoom"in e?+e.zoom:o,h="bearing"in e?this._normalizeBearing(e.bearing,s):s,c="pitch"in e?+e.pitch:r,u="padding"in e?e.padding:n.padding,d=t.Point.convert(e.offset);let f=n.centerPoint.add(d);const p=n.pointLocation(f),m=t.LngLat.convert(e.center||p);this._normalizeCenter(m);const g=n.project(p),b=n.project(m).sub(g),v=n.zoomScale(l-o);let w,y;e.around&&(w=t.LngLat.convert(e.around),y=n.locationPoint(w));const x={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==o,this._rotating=this._rotating||s!==h,this._pitching=this._pitching||c!==r,this._padding=!n.isPaddingEqual(u),this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,x),this.terrain&&this._prepareElevation(m),this._ease((p=>{if(this._zooming&&(n.zoom=t.interpolate.number(o,l,p)),this._rotating&&(n.bearing=t.interpolate.number(s,h,p)),this._pitching&&(n.pitch=t.interpolate.number(r,c,p)),this._padding&&(n.interpolatePadding(a,u,p),f=n.centerPoint.add(d)),this.terrain&&!e.freezeElevation&&this._updateElevation(p),w)n.setLocationAtPoint(w,y);else{const t=n.zoomScale(n.zoom-o),e=l>o?Math.min(2,v):Math.max(.5,v),i=Math.pow(e,1-p),s=n.unproject(g.add(b.mult(p*i)).mult(t));n.setLocationAtPoint(n.renderWorldCopies?s.wrap():s,f)}this._applyUpdatedTransform(n),this._fireMoveEvents(i)}),(t=>{this.terrain&&this._finalizeElevation(),this._afterEase(i,t)}),e),this}_prepareEase(e,i,n={}){this._moving=!0,i||n.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!n.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new t.Event("pitchstart",e))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(i-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.elevation=t.interpolate.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const e=t.clone(),{center:i,zoom:n,pitch:o,bearing:s,elevation:r}=this.transformCameraUpdate(e);i&&(e.center=i),void 0!==n&&(e.zoom=n),void 0!==o&&(e.pitch=o),void 0!==s&&(e.bearing=s),void 0!==r&&(e.elevation=r),this.transform.apply(e)}_fireMoveEvents(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const n=this._zooming,o=this._rotating,s=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new t.Event("zoomend",e)),o&&this.fire(new t.Event("rotateend",e)),s&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}flyTo(e,i){if(!e.essential&&t.browser.prefersReducedMotion){const n=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.defaultEasing},e);const n=this._getTransformForUpdate(),o=this.getZoom(),s=this.getBearing(),r=this.getPitch(),a=this.getPadding(),l="zoom"in e?t.clamp(+e.zoom,n.minZoom,n.maxZoom):o,h="bearing"in e?this._normalizeBearing(e.bearing,s):s,c="pitch"in e?+e.pitch:r,u="padding"in e?e.padding:n.padding,d=n.zoomScale(l-o),f=t.Point.convert(e.offset);let p=n.centerPoint.add(f);const m=n.pointLocation(p),g=t.LngLat.convert(e.center||m);this._normalizeCenter(g);const b=n.project(m),v=n.project(g).sub(b);let w=e.curve;const y=Math.max(n.width,n.height),x=y/d,_=v.mag();if("minZoom"in e){const i=t.clamp(Math.min(e.minZoom,o,l),n.minZoom,n.maxZoom),s=y/n.zoomScale(i-o);w=Math.sqrt(s/_*2)}const k=w*w;function M(t){const e=(x*x-y*y+(t?-1:1)*k*k*_*_)/(2*(t?x:y)*k*_);return Math.log(Math.sqrt(e*e+1)-e)}function z(t){return(Math.exp(t)-Math.exp(-t))/2}function S(t){return(Math.exp(t)+Math.exp(-t))/2}const C=M(!1);let E=function(t){return S(C)/S(C+w*t)},A=function(t){return y*((S(C)*(z(e=C+w*t)/S(e))-z(C))/k)/_;var e},I=(M(!0)-C)/w;if(Math.abs(_)<1e-6||!isFinite(I)){if(Math.abs(y-x)<1e-6)return this.easeTo(e,i);const t=x<y?-1:1;I=Math.abs(Math.log(x/y))/w,A=function(){return 0},E=function(e){return Math.exp(t*w*e)}}return e.duration="duration"in e?+e.duration:1e3*I/("screenSpeed"in e?+e.screenSpeed/w:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==h,this._pitching=c!==r,this._padding=!n.isPaddingEqual(u),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(g),this._ease((d=>{const m=d*I,w=1/E(m);n.zoom=1===d?l:o+n.scaleZoom(w),this._rotating&&(n.bearing=t.interpolate.number(s,h,d)),this._pitching&&(n.pitch=t.interpolate.number(r,c,d)),this._padding&&(n.interpolatePadding(a,u,d),p=n.centerPoint.add(f)),this.terrain&&!e.freezeElevation&&this._updateElevation(d);const y=1===d?g:n.unproject(b.add(v.mult(A(m))).mult(w));n.setLocationAtPoint(n.renderWorldCopies?y.wrap():y,p),this._applyUpdatedTransform(n),this._fireMoveEvents(i)}),(()=>{this.terrain&&this._finalizeElevation(),this._afterEase(i)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}if(!t){const t=this.handlers;t&&t.stop(!1)}return this}_ease(e,i,n){!1===n.animate||0===n.duration?(e(1),i()):(this._easeStart=t.browser.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=t.wrap(e,-180,180);const n=Math.abs(e-i);return Math.abs(e-360-i)<n&&(e-=360),Math.abs(e+360-i)<n&&(e+=360),e}_normalizeCenter(t){const e=this.transform;if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(t.LngLat.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}class ao{constructor(t={}){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=i.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=i.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=i.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){i.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const i in e){const n=e[i];if(n.used||n.usedForTerrain){const e=n.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let n=i+1;n<t.length;n++)if(t[n].indexOf(e)>=0)return!1;return!0}));const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class lo{constructor(t={}){this._updateCompact=()=>{const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=i.create("div","maplibregl-ctrl");const e=i.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){i.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ho{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const co={"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","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var uo=t.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class fo extends t.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const n={};for(const o of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i}))n[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.posMatrix=new Float64Array(16),t.ortho(o.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),this._tiles[o.key]=new J(o,this.tileSize));for(const t in this._tiles)n[t]||delete this._tiles[t]}freeRtt(t){for(const e in this._tiles){const i=this._tiles[e];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(e){const i={};for(const n of this._renderableTilesKeys){const o=this._tiles[n].tileID;if(o.canonical.equals(e.canonical)){const o=e.clone();o.posMatrix=new Float64Array(16),t.ortho(o.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),i[n]=o}else if(o.canonical.isChildOf(e.canonical)){const s=e.clone();s.posMatrix=new Float64Array(16);const r=o.canonical.z-e.canonical.z,a=o.canonical.x-(o.canonical.x>>r<<r),l=o.canonical.y-(o.canonical.y>>r<<r),h=t.EXTENT>>r;t.ortho(s.posMatrix,0,h,0,h,0,1),t.translate(s.posMatrix,s.posMatrix,[-a*h,-l*h,0]),i[n]=s}else if(e.canonical.isChildOf(o.canonical)){const s=e.clone();s.posMatrix=new Float64Array(16);const r=e.canonical.z-o.canonical.z,a=e.canonical.x-(e.canonical.x>>r<<r),l=e.canonical.y-(e.canonical.y>>r<<r),h=t.EXTENT>>r;t.ortho(s.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),t.translate(s.posMatrix,s.posMatrix,[a*h,l*h,0]),t.scale(s.posMatrix,s.posMatrix,[1/2**r,1/2**r,0]),i[n]=s}}return i}getSourceTile(t,e){const i=this.sourceCache._source;let n=t.overscaledZ-this.deltaZoom;if(n>i.maxzoom&&(n=i.maxzoom),n<i.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(n).key);let o=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!o||!o.dem)&&e)for(;n>=i.minzoom&&(!o||!o.dem);)o=this.sourceCache.getTileByID(t.scaledTo(n--).key);return o}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter((e=>e.timeAdded>=t))}}class po{constructor(t,e,i){this.painter=t,this.sourceCache=new fo(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,n,o=t.EXTENT){var s;if(!(i>=0&&i<o&&n>=0&&n<o))return 0;const r=this.getTerrainData(e),a=null===(s=r.tile)||void 0===s?void 0:s.dem;if(!a)return 0;const l=function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[4]*o+i[12],t[1]=i[1]*n+i[5]*o+i[13],t}([],[i/o*t.EXTENT,n/o*t.EXTENT],r.u_terrain_matrix),h=[l[0]*a.dim,l[1]*a.dim],c=Math.floor(h[0]),u=Math.floor(h[1]),d=h[0]-c,f=h[1]-u;return a.get(c,u)*(1-d)*(1-f)+a.get(c+1,u)*d*(1-f)+a.get(c,u+1)*(1-d)*f+a.get(c+1,u+1)*d*f}getElevationForLngLatZoom(e,i){const{tileID:n,mercatorX:o,mercatorY:s}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(n,o%t.EXTENT,s%t.EXTENT,t.EXTENT)}getElevation(e,i,n,o=t.EXTENT){return this.getDEMElevation(e,i,n,o)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const e=this.painter.context,i=new t.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new w(e,i,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new w(e,new t.RGBAImage({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.identity([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const t=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new w(t,i.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),i.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const n=i&&i+i.tileID.key+e.key;if(n&&!this._demMatrixCache[n]){const n=this.sourceCache.sourceCache._source.maxzoom;let o=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=n?o=e.canonical.z-n:t.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const s=e.canonical.x-(e.canonical.x>>o<<o),r=e.canonical.y-(e.canonical.y>>o<<o),a=t.fromScaling(new Float64Array(16),[1/(t.EXTENT<<o),1/(t.EXTENT<<o),0]);t.translate(a,a,[s*t.EXTENT,r*t.EXTENT,0]),this._demMatrixCache[e.key]={matrix:a,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:n?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(t){const e=this.painter,i=e.width/devicePixelRatio,n=e.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===n||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new w(e.context,{width:i,height:n,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new w(e.context,{width:i,height:n,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(i,n,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,i,n))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,e=0;t<this._coordsTextureSize;t++)for(let n=0;n<this._coordsTextureSize;n++,e+=4)i[e+0]=255&n,i[e+1]=255&t,i[e+2]=n>>8<<4|t>>8,i[e+3]=0;const n=new t.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),o=new w(e,n,e.gl.RGBA,{premultiply:!1});return o.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=o,o}pointCoordinate(e){const i=new Uint8Array(4),n=this.painter.context,o=n.gl;n.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),o.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,o.RGBA,o.UNSIGNED_BYTE,i),n.bindFramebuffer.set(null);const s=i[0]+(i[2]>>4<<8),r=i[1]+((15&i[2])<<8),a=this.coordsIndex[255-i[3]],l=a&&this.sourceCache.getTileByID(a);if(!l)return null;const h=this._coordsTextureSize,c=(1<<l.tileID.canonical.z)*h;return new t.MercatorCoordinate((l.tileID.canonical.x*h+s)/c,(l.tileID.canonical.y*h+r)/c,this.getElevation(l.tileID,s,r,h))}getTerrainMesh(){if(this._mesh)return this._mesh;const e=this.painter.context,i=new t.Pos3dArray,n=new t.TriangleIndexArray,o=this.meshSize,s=t.EXTENT/o,r=o*o;for(let t=0;t<=o;t++)for(let e=0;e<=o;e++)i.emplaceBack(e*s,t*s,0);for(let t=0;t<r;t+=o+1)for(let e=0;e<o;e++)n.emplaceBack(e+t,o+e+t+1,o+e+t+2),n.emplaceBack(e+t,o+e+t+2,e+t+1);const a=i.length,l=a+2*(o+1);for(const e of[0,1])for(let n=0;n<=o;n++)for(const o of[0,1])i.emplaceBack(n*s,e*t.EXTENT,o);for(let t=0;t<2*o;t+=2)n.emplaceBack(l+t,l+t+1,l+t+3),n.emplaceBack(l+t,l+t+3,l+t+2),n.emplaceBack(a+t,a+t+3,a+t+1),n.emplaceBack(a+t,a+t+2,a+t+3);const h=i.length,c=h+2*(o+1);for(const e of[0,1])for(let n=0;n<=o;n++)for(const o of[0,1])i.emplaceBack(e*t.EXTENT,n*s,o);for(let t=0;t<2*o;t+=2)n.emplaceBack(h+t,h+t+1,h+t+3),n.emplaceBack(h+t,h+t+3,h+t+2),n.emplaceBack(c+t,c+t+3,c+t+1),n.emplaceBack(c+t,c+t+2,c+t+3);return this._mesh={indexBuffer:e.createIndexBuffer(n),vertexBuffer:e.createVertexBuffer(i,uo.members),segments:t.SegmentVector.simpleSegment(0,0,i.length,n.length)},this._mesh}getMeshFrameDelta(e){return 2*Math.PI*t.earthRadius/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(t,e){var i;const{tileID:n}=this._getOverscaledTileIDFromLngLatZoom(t,e);return null!==(i=this.getMinMaxElevation(n).minElevation)&&void 0!==i?i:0}getMinMaxElevation(t){const e=this.getTerrainData(t).tile,i={minElevation:null,maxElevation:null};return e&&e.dem&&(i.minElevation=e.dem.min*this.exaggeration,i.maxElevation=e.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,i){const n=t.MercatorCoordinate.fromLngLat(e.wrap()),o=(1<<i)*t.EXTENT,s=n.x*o,r=n.y*o,a=Math.floor(s/t.EXTENT),l=Math.floor(r/t.EXTENT);return{tileID:new t.OverscaledTileID(i,0,i,a,l),mercatorX:s,mercatorY:r}}}class mo{constructor(t,e,i){this._context=t,this._size=e,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const e=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new w(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),e.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),e.colorAttachment.set(i.texture),{id:t,fbo:e,texture:i,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((e=>t.id!==e)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some((t=>!t.inUse))}}const go={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class bo{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new mo(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter((i=>!t._layers[i].isHidden(e))),this._coordsDescendingInv={};for(const e in t.sourceCaches){this._coordsDescendingInv[e]={};const i=t.sourceCaches[e].getVisibleCoordinates();for(const t of i){const i=this.terrain.sourceCache.getTerrainCoords(t);for(const t in i)this._coordsDescendingInv[e][t]||(this._coordsDescendingInv[e][t]=[]),this._coordsDescendingInv[e][t].push(i[t])}}this._coordsDescendingInvStr={};for(const e of t._order){const i=t._layers[e],n=i.source;if(go[i.type]&&!this._coordsDescendingInvStr[n]){this._coordsDescendingInvStr[n]={};for(const t in this._coordsDescendingInv[n])this._coordsDescendingInvStr[n][t]=this._coordsDescendingInv[n][t].map((t=>t.key)).sort().join()}}for(const t of this._renderableTiles)for(const e in this._coordsDescendingInvStr){const i=this._coordsDescendingInvStr[e][t.tileID.key];i&&i!==t.rttCoords[e]&&(t.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;const i=e.type,n=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(go[i]&&(this._prevType&&go[this._prevType]||this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!o))return!0;if(go[this._prevType]||go[i]&&o){this._prevType=i;const e=this._stacks.length-1,o=this._stacks[e]||[];for(const i of this._renderableTiles){if(this.pool.isFull()&&(nn(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(i),i.rtt[e]){const t=this.pool.getObjectForId(i.rtt[e].id);if(t.stamp===i.rtt[e].stamp){this.pool.useObject(t);continue}}const s=this.pool.getOrCreateFreeObject();this.pool.useObject(s),this.pool.stampObject(s),i.rtt[e]={id:s.id,stamp:s.stamp},n.context.bindFramebuffer.set(s.fbo.framebuffer),n.context.clear({color:t.Color.transparent,stencil:0}),n.currentStencilSource=void 0;for(let t=0;t<o.length;t++){const e=n.style._layers[o[t]],r=e.source?this._coordsDescendingInv[e.source][i.tileID.key]:[i.tileID];n.context.viewport.set([0,0,s.fbo.width,s.fbo.height]),n._renderTileClippingMasks(e,r),n.renderLayer(n,n.style.sourceCaches[e.source],e,r),e.source&&(i.rttCoords[e.source]=this._coordsDescendingInvStr[e.source][i.tileID.key])}}return nn(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),go[i]}return!1}}const vo=e,wo={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:t.config.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},yo=t=>{t.touchstart=t.dragStart,t.touchmoveWindow=t.dragMove,t.touchend=t.dragEnd},xo={showCompass:!0,showZoom:!0,visualizePitch:!1};class _o{constructor(e,n,o=!1){this.mousedown=e=>{this.startMouse(t.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),i.mousePos(this.element,e)),i.addEventListener(window,"mousemove",this.mousemove),i.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=t=>{this.moveMouse(t,i.mousePos(this.element,t))},this.mouseup=t=>{this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),i.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),i.addEventListener(window,"touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const s=e.dragRotate._mouseRotate.getClickTolerance(),r=e.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=Fn({clickTolerance:s,enable:!0}),this.touchRotate=(({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const n=new Pn;return new An({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:n,enable:t,assignEvents:yo})})({clickTolerance:s,enable:!0}),this.map=e,o&&(this.mousePitch=On({clickTolerance:r,enable:!0}),this.touchPitch=(({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const n=new Pn;return new An({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:n,enable:t,assignEvents:yo})})({clickTolerance:r,enable:!0})),i.addEventListener(n,"mousedown",this.mousedown),i.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),i.addEventListener(n,"touchcancel",this.reset)}startMouse(t,e){this.mouseRotate.dragStart(t,e),this.mousePitch&&this.mousePitch.dragStart(t,e),i.disableDrag()}startTouch(t,e){this.touchRotate.dragStart(t,e),this.touchPitch&&this.touchPitch.dragStart(t,e),i.disableDrag()}moveMouse(t,e){const i=this.map,{bearingDelta:n}=this.mouseRotate.dragMove(t,e)||{};if(n&&i.setBearing(i.getBearing()+n),this.mousePitch){const{pitchDelta:n}=this.mousePitch.dragMove(t,e)||{};n&&i.setPitch(i.getPitch()+n)}}moveTouch(t,e){const i=this.map,{bearingDelta:n}=this.touchRotate.dragMove(t,e)||{};if(n&&i.setBearing(i.getBearing()+n),this.touchPitch){const{pitchDelta:n}=this.touchPitch.dragMove(t,e)||{};n&&i.setPitch(i.getPitch()+n)}}off(){const t=this.element;i.removeEventListener(t,"mousedown",this.mousedown),i.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),i.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),i.removeEventListener(window,"touchend",this.touchend),i.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){i.enableDrag(),i.removeEventListener(window,"mousemove",this.mousemove),i.removeEventListener(window,"mouseup",this.mouseup),i.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),i.removeEventListener(window,"touchend",this.touchend)}}let ko;function Mo(e,i,n){if(e=new t.LngLat(e.lng,e.lat),i){const o=new t.LngLat(e.lng-360,e.lat),s=new t.LngLat(e.lng+360,e.lat),r=n.locationPoint(e).distSqr(i);n.locationPoint(o).distSqr(i)<r?e=o:n.locationPoint(s).distSqr(i)<r&&(e=s)}for(;Math.abs(e.lng-n.center.lng)>180;){const t=n.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=n.width&&t.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e}const zo={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 So(t,e,i){const n=t.classList;for(const t in zo)n.remove(`maplibregl-${i}-anchor-${t}`);n.add(`maplibregl-${i}-anchor-${e}`)}class Co extends t.Evented{constructor(e){if(super(),this._onKeyPress=t=>{const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()},this._onMapClick=t=>{const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()},this._update=t=>{if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Mo(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let e="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?e=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(e=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n=`rotateX(${this._map.getPitch()}deg)`),t&&"moveend"!==t.type||(this._pos=this._pos.round()),i.setTransform(this._element,`${zo[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${e}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout((()=>{const t=this._map.unproject(this._pos),e=40075016.686*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=t.distanceTo(this._lngLat)>20*e?"0.2":"1.0",this._opacityTimeout=null}),100))},this._onMove=e=>{if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=t.Point.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=i.create("div"),this._element.setAttribute("aria-label","Map marker");const n=i.createNS("http://www.w3.org/2000/svg","svg"),o=41,s=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${o}px`),n.setAttributeNS(null,"width",`${s}px`),n.setAttributeNS(null,"viewBox",`0 0 ${s} ${o}`);const r=i.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");const a=i.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const l=i.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const h=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const t of h){const e=i.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const c=i.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"fill",this._color);const u=i.createNS("http://www.w3.org/2000/svg","path");u.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),c.appendChild(u);const d=i.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"fill","#000000");const f=i.createNS("http://www.w3.org/2000/svg","path");f.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),d.appendChild(f);const p=i.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"transform","translate(6.0, 7.0)"),p.setAttributeNS(null,"fill","#FFFFFF");const m=i.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=i.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const b=i.createNS("http://www.w3.org/2000/svg","circle");b.setAttributeNS(null,"fill","#FFFFFF"),b.setAttributeNS(null,"cx","5.5"),b.setAttributeNS(null,"cy","5.5"),b.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(b),a.appendChild(l),a.appendChild(c),a.appendChild(d),a.appendChild(p),a.appendChild(m),n.appendChild(a),n.setAttributeNS(null,"height",o*this._scale+"px"),n.setAttributeNS(null,"width",s*this._scale+"px"),this._element.appendChild(n),this._offset=t.Point.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault()})),this._element.addEventListener("mousedown",(t=>{t.preventDefault()})),So(this._element,this._anchor,"marker"),e&&e.className)for(const t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",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("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),i.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,n=Math.sqrt(Math.pow(i,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[n,-1*(e-i+n)],"bottom-right":[-n,-1*(e-i+n)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset}this._popup=t,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}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(e){return this._offset=t.Point.convert(e),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Eo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ao=0,Io=!1;const To={maxWidth:100,unit:"metric"};function Po(t,e,i){const n=i&&i.maxWidth||100,o=t._container.clientHeight/2,s=t.unproject([0,o]),r=t.unproject([n,o]),a=s.distanceTo(r);if(i&&"imperial"===i.unit){const i=3.2808*a;i>5280?$o(e,n,i/5280,t._getUIString("ScaleControl.Miles")):$o(e,n,i,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?$o(e,n,a/1852,t._getUIString("ScaleControl.NauticalMiles")):a>=1e3?$o(e,n,a/1e3,t._getUIString("ScaleControl.Kilometers")):$o(e,n,a,t._getUIString("ScaleControl.Meters"))}function $o(t,e,i,n){const o=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(o/i)+"px",t.innerHTML=`${o} ${n}`}const Fo={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Oo=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Do(e){if(e){if("number"==typeof e){const i=Math.round(Math.sqrt(.5*Math.pow(e,2)));return{center:new t.Point(0,0),top:new t.Point(0,e),"top-left":new t.Point(i,i),"top-right":new t.Point(-i,i),bottom:new t.Point(0,-e),"bottom-left":new t.Point(i,-i),"bottom-right":new t.Point(-i,-i),left:new t.Point(e,0),right:new t.Point(-e,0)}}if(e instanceof t.Point||Array.isArray(e)){const i=t.Point.convert(e);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.Point.convert(e.center||[0,0]),top:t.Point.convert(e.top||[0,0]),"top-left":t.Point.convert(e["top-left"]||[0,0]),"top-right":t.Point.convert(e["top-right"]||[0,0]),bottom:t.Point.convert(e.bottom||[0,0]),"bottom-left":t.Point.convert(e["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(e["bottom-right"]||[0,0]),left:t.Point.convert(e.left||[0,0]),right:t.Point.convert(e.right||[0,0])}}return Do(new t.Point(0,0))}const jo={extend:(e,...i)=>t.extend(e,...i),run(t){t()},logToElement(t,e=!1,i="log"){const n=window.document.getElementById(i);n&&(e&&(n.innerHTML=""),n.innerHTML+=`<br>${t}`)}},Lo=e;class Ro{static get version(){return Lo}static get workerCount(){return et.workerCount}static set workerCount(t){et.workerCount=t}static get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e}static get workerUrl(){return t.config.WORKER_URL}static set workerUrl(e){t.config.WORKER_URL=e}static addProtocol(e,i){t.config.REGISTERED_PROTOCOLS[e]=i}static removeProtocol(e){delete t.config.REGISTERED_PROTOCOLS[e]}}return Ro.Map=class extends ro{constructor(e){if(t.PerformanceUtils.mark(t.PerformanceMarkers.create),null!=(e=t.extend({},wo,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ln(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._cooperativeGesturesOnWheel=t=>{this._onCooperativeGesture(t,t[this._metaKey],1)},this._contextLost=e=>{e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=e.interactive,this._cooperativeGestures=e.cooperativeGestures,this._metaKey=0===navigator.platform.indexOf("Mac")?"metaKey":"ctrlKey",this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new ho,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},co,e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this._imageQueueHandle=h.addThrottleControl((()=>this.isMoving())),this._requestManager=new u(e.transformRequest),"string"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let t=!1;this._resizeObserver=new ResizeObserver((e=>{t?this._trackResize&&this.resize(e)._update():t=!0})),this._resizeObserver.observe(this._container)}this.handlers=new so(this,e),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=e.hash&&new hn("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new ao({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new lo,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.Event(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new t.Event(`${e.dataType}dataloading`,e))})),this.on("dataabort",(e=>{this.fire(new t.Event("sourcedataabort",e))}))}_getMapId(){return this._mapId}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=e.onAdd(this);this._controls.push(e);const o=this._controlPositions[i];return-1!==i.indexOf("bottom")?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,i,n){return null==n&&this.terrain&&(n=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,e,i,n)}resize(e){var i;const n=this._containerDimensions(),o=n[0],s=n[1],r=this._getClampedPixelRatio(o,s);if(this._resizeCanvas(o,s,r),this.painter.resize(o,s,r),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const e=this._getClampedPixelRatio(o,s);this._resizeCanvas(o,s,e),this.painter.resize(o,s,e)}this.transform.resize(o,s),null===(i=this._requestedCameraState)||void 0===i||i.resize(o,s);const a=!this._moving;return a&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),a&&this.fire(new t.Event("moveend",e)),this}_getClampedPixelRatio(t,e){const{0:i,1:n}=this._maxCanvasSize,o=this.getPixelRatio(),s=t*o,r=e*o;return Math.min(s>i?i/s:1,r>n?n/r:1)*o}getPixelRatio(){var t;return null!==(t=this._overridePixelRatio)&&void 0!==t?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds($.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(t){return this._cooperativeGestures=t,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(e){return this.transform.locationPoint(t.LngLat.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.pointLocation(t.Point.convert(e),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let n=!1;const o=o=>{const s=this.getLayer(e)?this.queryRenderedFeatures(o.point,{layers:[e]}):[];s.length?n||(n=!0,i.call(this,new vn(t,this,o.originalEvent,{features:s}))):n=!1};return{layer:e,listener:i,delegates:{mousemove:o,mouseout:()=>{n=!1}}}}if("mouseleave"===t||"mouseout"===t){let n=!1;const o=o=>{(this.getLayer(e)?this.queryRenderedFeatures(o.point,{layers:[e]}):[]).length?n=!0:n&&(n=!1,i.call(this,new vn(t,this,o.originalEvent)))},s=e=>{n&&(n=!1,i.call(this,new vn(t,this,e.originalEvent)))};return{layer:e,listener:i,delegates:{mousemove:o,mouseout:s}}}{const n=t=>{const n=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,i.call(this,t),delete t.features)};return{layer:e,listener:i,delegates:{[t]:n}}}}on(t,e,i){if(void 0===i)return super.on(t,e);const n=this._createDelegatedListener(t,e,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(n);for(const t in n.delegates)this.on(t,n.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const n=this._createDelegatedListener(t,e,i);for(const t in n.delegates)this.once(t,n.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(n=>{const o=this._delegatedListeners[t];for(let t=0;t<o.length;t++){const n=o[t];if(n.layer===e&&n.listener===i){for(const t in n.delegates)this.off(t,n.delegates[t]);return o.splice(t,1),this}}})(),this)}queryRenderedFeatures(e,i){if(!this.style)return[];let n;const o=e instanceof t.Point||Array.isArray(e),s=o?e:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(o?{}:e)||{},s instanceof t.Point||"number"==typeof s[0])n=[t.Point.convert(s)];else{const e=t.Point.convert(s[0]),i=t.Point.convert(s[1]);n=[e,new t.Point(i.x,e.y),i,new t.Point(e.x,i.y),e]}return this.style.queryRenderedFeatures(n,i,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(e,i){return!1!==(i=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(t,e)));const i=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new oe(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,i):this.style.loadJSON(t,e,i),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new oe(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){const n=this._requestManager.transformRequest(e,c.Style);t.getJSON(n,((e,n)=>{e?this.fire(new t.ErrorEvent(e)):n&&this._updateDiff(n,i)}))}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e,i)&&this._update(!0)}catch(n){t.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.ErrorEvent(new Error(`There is no source with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){const i=this.style.sourceCaches[e.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);for(const i in this.style._layers){const n=this.style._layers[i];"hillshade"===n.type&&n.source===e.source&&t.warnOnce("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 po(this.painter,i,e),this.painter.renderToTexture=new bo(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=t=>{"style"===t.dataType?this.terrain.sourceCache.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId!==e.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=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(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new t.Event("terrain",{terrain:e})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}addSourceType(t,e,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,i,n={}){const{pixelRatio:o=1,sdf:s=!1,stretchX:r,stretchY:a,content:l}=n;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||t.isImageBitmap(i))){if(void 0===i.width||void 0===i.height)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:n,height:h,data:c}=i,u=i;return this.style.addImage(e,{data:new t.RGBAImage({width:n,height:h},new Uint8Array(c)),pixelRatio:o,stretchX:r,stretchY:a,content:l,sdf:s,version:0,userImage:u}),u.onAdd&&u.onAdd(this,e),this}}{const{width:n,height:h,data:c}=t.browser.getImageData(i);this.style.addImage(e,{data:new t.RGBAImage({width:n,height:h},c),pixelRatio:o,stretchX:r,stretchY:a,content:l,sdf:s,version:0})}}updateImage(e,i){const n=this.style.getImage(e);if(!n)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=i instanceof HTMLImageElement||t.isImageBitmap(i)?t.browser.getImageData(i):i,{width:s,height:r,data:a}=o;if(void 0===s||void 0===r)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(s!==n.data.width||r!==n.data.height)return this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const l=!(i instanceof HTMLImageElement||t.isImageBitmap(i));return n.data.replace(a,l),this.style.updateImage(e,n),this}getImage(t){return this.style.getImage(t)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t,e){h.getImage(this._requestManager.transformRequest(t,c.Image),e)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,n={}){return this.style.setPaintProperty(t,e,i,n),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,n={}){return this.style.setLayoutProperty(t,e,i,n),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,(t=>{t||this._update(!0)})),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0)})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=i.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=i.create("canvas","maplibregl-canvas",e),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");const n=this._containerDimensions(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);const s=this._controlContainer=i.create("div","maplibregl-control-container",t),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{r[t]=i.create("div",`maplibregl-ctrl-${t} `,s)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=i.create("div","maplibregl-cooperative-gesture-screen",this._container);let t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";0===navigator.platform.indexOf("Mac")&&(t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`\n <div class="maplibregl-desktop-message">${t}</div>\n <div class="maplibregl-mobile-message">${"boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>\n `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){i.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(t,e,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const t={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",(i=>{e={requestedAttributes:t},i&&(e.statusMessage=i.statusMessage,e.type=i.type)}),{once:!0});const i=this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t);if(!i){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new on(i,this.transform),n.testSupport(i)}_onCooperativeGesture(t,e,i){return!e&&i<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout((()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")}),100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(e){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,o=t.browser.now();this.style.zoomHistory.update(e,o);const s=new t.EvaluationParameters(e,{now:o,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),r=s.crossFadingFactor();1===r&&r===this._crossFadingFactor||(n=!0,this._crossFadingFactor=r),this.style.update(s)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=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._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.load),this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||o||(this._fullyLoaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),h.removeThrottleControl(this._imageQueueHandle),null===(e=this._resizeObserver)||void 0===e||e.disconnect();const n=this.painter.context.gl.getExtension("WEBGL_lose_context");n&&n.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),i.remove(this._canvasContainer),i.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),t.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new t.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=t.browser.frame((e=>{t.PerformanceUtils.frame(e),this._frame=null,this._render(e)})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return vo}getCameraTargetElevation(){return this.transform.elevation}},Ro.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(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=t},this._setButtonTitle=(t,e)=>{const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute("aria-label",i)},this.options=t.extend({},xo,e),this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),i.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),i.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=i.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new _o(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){i.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(t,e){const n=i.create("button",t,this._container);return n.type="button",n.addEventListener("click",e),n}},Ro.GeolocateControl=class extends t.Evented{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new t.LngLat(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,o=this._map.getBearing(),s=t.extend({bearing:o},this.options.fitBoundsOptions),r=$.fromLngLat(i,n);this._map.fitBounds(r,s,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Io)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=e=>{if(this._map){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=i.create("button","maplibregl-ctrl-geolocate",this._container),i.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=i.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Co({element:this._dotElement}),this._circleElement=i.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Co({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",(e=>{e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new t.Event("trackuserlocationend")))}))}},this.options=t.extend({},Eo,e)}onAdd(t){return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,e=!1){void 0===ko||e?void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then((e=>{ko="denied"!==e.state,t(ko)})).catch((()=>{ko=!!window.navigator.geolocation,t(ko)})):(ko=!!window.navigator.geolocation,t(ko)):t(ko)}(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),i.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ao=0,Io=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const t=this._map.getBounds(),e=t.getSouthEast(),i=t.getNorthEast(),n=e.distanceTo(i),o=Math.ceil(this._accuracy/(n/this._map._container.clientHeight)*2);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}trigger(){if(!this._setup)return t.warnOnce("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 t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ao--,Io=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ao++,Ao>1?(t={maximumAge:6e5,timeout:0},Io=!0):(t=this.options.positionOptions,Io=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},Ro.AttributionControl=ao,Ro.LogoControl=lo,Ro.ScaleControl=class{constructor(e){this._onMove=()=>{Po(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Po(this._map,this._container,this.options)},this.options=t.extend({},To,e)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){i.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},Ro.FullscreenControl=class extends t.Evented{constructor(e={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){i.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=i.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);i.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new t.Event("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new t.Event("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},Ro.TerrainControl=class{constructor(t){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=t}onAdd(t){return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=i.create("button","maplibregl-ctrl-terrain",this._container),i.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){i.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},Ro.Popup=class extends t.Evented{constructor(e){super(),this.remove=()=>(this._content&&i.remove(this._content),this._container&&(i.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 t.Event("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=i.create("div","maplibregl-popup",this._map.getContainer()),this._tip=i.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const t of this.options.className.split(" "))this._container.classList.add(t);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Mo(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const e=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let n=this.options.anchor;const o=Do(this.options.offset);if(!n){const t=this._container.offsetWidth,i=this._container.offsetHeight;let s;s=e.y+o.bottom.y<i?["top"]:e.y>this._map.transform.height-i?["bottom"]:[],e.x<t/2?s.push("left"):e.x>this._map.transform.width-t/2&&s.push("right"),n=0===s.length?"bottom":s.join("-")}const s=e.add(o[n]).round();i.setTransform(this._container,`${zo[n]} translate(${s.x}px,${s.y}px)`),So(this._container,n,"popup")},this._onClose=()=>{this.remove()},this.options=t.extend(Object.create(Fo),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement("body");let n;for(i.innerHTML=t;n=i.firstChild,n;)e.appendChild(n);return this.setDOMContent(e)}getMaxWidth(){var t;return null===(t=this._container)||void 0===t?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=i.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=i.create("button","maplibregl-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))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(Oo);t&&t.focus()}},Ro.Marker=Co,Ro.Style=oe,Ro.LngLat=t.LngLat,Ro.LngLatBounds=$,Ro.Point=t.Point,Ro.MercatorCoordinate=t.MercatorCoordinate,Ro.Evented=t.Evented,Ro.AJAXError=t.AJAXError,Ro.config=t.config,Ro.CanvasSource=U,Ro.GeoJSONSource=L,Ro.ImageSource=N,Ro.RasterDEMTileSource=j,Ro.RasterTileSource=D,Ro.VectorTileSource=O,Ro.VideoSource=B,Ro.setRTLTextPlugin=t.setRTLTextPlugin,Ro.getRTLTextPluginStatus=t.getRTLTextPluginStatus,Ro.prewarm=function(){ot().acquire(tt)},Ro.clearPrewarmedResources=function(){const t=nt;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(tt),nt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},jo.extend(Ro,{isSafari:t.isSafari,getPerformanceMetrics:t.PerformanceUtils.getPerformanceMetrics}),Ro}));var o=i;return o}))}));const Ut=w(Bt);var qt=b((function(t,e){!function(e,i){t.exports=i()}(v,(function(){var t=function(t,e){var i={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},n={on:function(t,e,n){if(void 0===i[t])throw new Error("Invalid event type: "+t);i[t].push({selector:e,fn:n})},render:function(t){e.store.featureChanged(t)}},o=function(t,o){for(var s=i[t],r=s.length;r--;){var a=s[r];if(a.selector(o)){a.fn.call(n,o)||e.store.render(),e.ui.updateMapClasses();break}}};return t.start.call(n),{render:t.render,stop:function(){t.stop&&t.stop()},trash:function(){t.trash&&(t.trash(),e.store.render())},combineFeatures:function(){t.combineFeatures&&t.combineFeatures()},uncombineFeatures:function(){t.uncombineFeatures&&t.uncombineFeatures()},drag:function(t){o("drag",t)},click:function(t){o("click",t)},mousemove:function(t){o("mousemove",t)},mousedown:function(t){o("mousedown",t)},mouseup:function(t){o("mouseup",t)},mouseout:function(t){o("mouseout",t)},keydown:function(t){o("keydown",t)},keyup:function(t){o("keyup",t)},touchstart:function(t){o("touchstart",t)},touchmove:function(t){o("touchmove",t)},touchend:function(t){o("touchend",t)},tap:function(t){o("tap",t)}}};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function i(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];i.push.apply(i,arguments);var n=Function.bind.apply(e,i);return new n}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var n={},o={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:6356752.3142},s=o;function r(t){var e=0;if(t&&t.length>0){e+=Math.abs(a(t[0]));for(var i=1;i<t.length;i++)e-=Math.abs(a(t[i]))}return e}function a(t){var e,i,n,o,r,a,h=0,c=t.length;if(c>2){for(a=0;a<c;a++)a===c-2?(n=c-2,o=c-1,r=0):a===c-1?(n=c-1,o=0,r=1):(n=a,o=a+1,r=a+2),e=t[n],i=t[o],h+=(l(t[r][0])-l(e[0]))*Math.sin(l(i[1]));h=h*s.RADIUS*s.RADIUS/2}return h}function l(t){return t*Math.PI/180}n.geometry=function t(e){var i,n=0;switch(e.type){case"Polygon":return r(e.coordinates);case"MultiPolygon":for(i=0;i<e.coordinates.length;i++)n+=r(e.coordinates[i]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(i=0;i<e.geometries.length;i++)n+=t(e.geometries[i]);return n}},n.ring=a;var h={CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},c={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},u={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},d={POLYGON:"polygon",LINE:"line_string",POINT:"point"},f={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},p={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select",STATIC:"static"},m={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},g={MOVE:"move",CHANGE_COORDINATES:"change_coordinates"},b={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},w={ACTIVE:"true",INACTIVE:"false"},y=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],x=-85,_=Object.freeze({__proto__:null,classes:h,sources:c,cursors:u,types:d,geojsonTypes:f,modes:p,events:m,updateActions:g,meta:b,activeStates:w,interactions:y,LAT_MIN:-90,LAT_RENDERED_MIN:x,LAT_MAX:90,LAT_RENDERED_MAX:85,LNG_MIN:-270,LNG_MAX:270}),k={Point:0,LineString:1,MultiLineString:1,Polygon:2};function M(t,e){var i=k[t.geometry.type]-k[e.geometry.type];return 0===i&&t.geometry.type===f.POLYGON?t.area-e.area:i}function z(t){return t.map((function(t){return t.geometry.type===f.POLYGON&&(t.area=n.geometry({type:f.FEATURE,property:{},geometry:t.geometry})),t})).sort(M).map((function(t){return delete t.area,t}))}function S(t,e){return void 0===e&&(e=0),[[t.point.x-e,t.point.y-e],[t.point.x+e,t.point.y+e]]}function C(t){if(this._items={},this._nums={},this._length=t?t.length:0,t)for(var e=0,i=t.length;e<i;e++)this.add(t[e]),void 0!==t[e]&&("string"==typeof t[e]?this._items[t[e]]=e:this._nums[t[e]]=e)}C.prototype.add=function(t){return this.has(t)||(this._length++,"string"==typeof t?this._items[t]=this._length:this._nums[t]=this._length),this},C.prototype.delete=function(t){return!1===this.has(t)||(this._length--,delete this._items[t],delete this._nums[t]),this},C.prototype.has=function(t){return("string"==typeof t||"number"==typeof t)&&(void 0!==this._items[t]||void 0!==this._nums[t])},C.prototype.values=function(){var t=this,e=[];return Object.keys(this._items).forEach((function(i){e.push({k:i,v:t._items[i]})})),Object.keys(this._nums).forEach((function(i){e.push({k:JSON.parse(i),v:t._nums[i]})})),e.sort((function(t,e){return t.v-e.v})).map((function(t){return t.k}))},C.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};var E=[b.FEATURE,b.MIDPOINT,b.VERTEX],A={click:function(t,e,i){return I(t,e,i,i.options.clickBuffer)},touch:function(t,e,i){return I(t,e,i,i.options.touchBuffer)}};function I(t,e,i,n){if(null===i.map)return[];var o=t?S(t,n):e,s={};i.options.styles&&(s.layers=i.options.styles.map((function(t){return t.id})));var r=i.map.queryRenderedFeatures(o,s).filter((function(t){return-1!==E.indexOf(t.properties.meta)})),a=new C,l=[];return r.forEach((function(t){var e=t.properties.id;a.has(e)||(a.add(e),l.push(t))})),z(l)}function T(t,e){var i=A.click(t,null,e),n={mouse:u.NONE};return i[0]&&(n.mouse=i[0].properties.active===w.ACTIVE?u.MOVE:u.POINTER,n.feature=i[0].properties.meta),-1!==e.events.currentModeName().indexOf("draw")&&(n.mouse=u.ADD),e.ui.queueMapClasses(n),e.ui.updateMapClasses(),i[0]}function P(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)}function $(t,e,i){void 0===i&&(i={});var n=null!=i.fineTolerance?i.fineTolerance:4,o=null!=i.grossTolerance?i.grossTolerance:12,s=null!=i.interval?i.interval:500;t.point=t.point||e.point,t.time=t.time||e.time;var r=P(t.point,e.point);return r<n||r<o&&e.time-t.time<s}function F(t,e,i){void 0===i&&(i={});var n=null!=i.tolerance?i.tolerance:25,o=null!=i.interval?i.interval:250;return t.point=t.point||e.point,t.time=t.time||e.time,P(t.point,e.point)<n&&e.time-t.time<o}var O={exports:{}},D=O.exports=function(t,e){if(e||(e=16),void 0===t&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(e),n=2;i===1/0;n*=2)i=Math.log(Math.pow(2,t/n))/Math.log(e)*n;var o=i-Math.floor(i),s="";for(n=0;n<Math.floor(i);n++){s=Math.floor(Math.random()*e).toString(e)+s}if(o){var r=Math.pow(e,o);s=Math.floor(Math.random()*r).toString(e)+s}var a=parseInt(s,e);return a!==1/0&&a>=Math.pow(2,t)?D(t,e):s};D.rack=function(t,e,i){var n=function(n){var s=0;do{if(s++>10){if(!i)throw new Error("too many ID collisions, use more bits");t+=i}var r=D(t,e)}while(Object.hasOwnProperty.call(o,r));return o[r]=n,r},o=n.hats={};return n.get=function(t){return n.hats[t]},n.set=function(t,e){return n.hats[t]=e,n},n.bits=t||128,n.base=e||16,n};var j=e(O.exports),L=function(t,e){this.ctx=t,this.properties=e.properties||{},this.coordinates=e.geometry.coordinates,this.id=e.id||j(),this.type=e.geometry.type};L.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},L.prototype.incomingCoords=function(t){this.setCoordinates(t)},L.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},L.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},L.prototype.setProperty=function(t,e){this.properties[t]=e},L.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:f.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},L.prototype.internal=function(t){var e={id:this.id,meta:b.FEATURE,"meta:type":this.type,active:w.INACTIVE,mode:t};if(this.ctx.options.userProperties)for(var i in this.properties)e["user_"+i]=this.properties[i];return{type:f.FEATURE,properties:e,geometry:{coordinates:this.getCoordinates(),type:this.type}}};var R=function(t,e){L.call(this,t,e)};(R.prototype=Object.create(L.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},R.prototype.updateCoordinate=function(t,e,i){this.coordinates=3===arguments.length?[e,i]:[t,e],this.changed()},R.prototype.getCoordinate=function(){return this.getCoordinates()};var N=function(t,e){L.call(this,t,e)};(N.prototype=Object.create(L.prototype)).isValid=function(){return this.coordinates.length>1},N.prototype.addCoordinate=function(t,e,i){this.changed();var n=parseInt(t,10);this.coordinates.splice(n,0,[e,i])},N.prototype.getCoordinate=function(t){var e=parseInt(t,10);return JSON.parse(JSON.stringify(this.coordinates[e]))},N.prototype.removeCoordinate=function(t){this.changed(),this.coordinates.splice(parseInt(t,10),1)},N.prototype.updateCoordinate=function(t,e,i){var n=parseInt(t,10);this.coordinates[n]=[e,i],this.changed()};var B=function(t,e){L.call(this,t,e),this.coordinates=this.coordinates.map((function(t){return t.slice(0,-1)}))};(B.prototype=Object.create(L.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every((function(t){return t.length>2}))},B.prototype.incomingCoords=function(t){this.coordinates=t.map((function(t){return t.slice(0,-1)})),this.changed()},B.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},B.prototype.addCoordinate=function(t,e,i){this.changed();var n=t.split(".").map((function(t){return parseInt(t,10)}));this.coordinates[n[0]].splice(n[1],0,[e,i])},B.prototype.removeCoordinate=function(t){this.changed();var e=t.split(".").map((function(t){return parseInt(t,10)})),i=this.coordinates[e[0]];i&&(i.splice(e[1],1),i.length<3&&this.coordinates.splice(e[0],1))},B.prototype.getCoordinate=function(t){var e=t.split(".").map((function(t){return parseInt(t,10)})),i=this.coordinates[e[0]];return JSON.parse(JSON.stringify(i[e[1]]))},B.prototype.getCoordinates=function(){return this.coordinates.map((function(t){return t.concat([t[0]])}))},B.prototype.updateCoordinate=function(t,e,i){this.changed();var n=t.split("."),o=parseInt(n[0],10),s=parseInt(n[1],10);void 0===this.coordinates[o]&&(this.coordinates[o]=[]),this.coordinates[o][s]=[e,i]};var U={MultiPoint:R,MultiLineString:N,MultiPolygon:B},q=function(t,e,i,n,o){var s=i.split("."),r=parseInt(s[0],10),a=s[1]?s.slice(1).join("."):null;return t[r][e](a,n,o)},V=function(t,e){if(L.call(this,t,e),delete this.coordinates,this.model=U[e.geometry.type],void 0===this.model)throw new TypeError(e.geometry.type+" is not a valid type");this.features=this._coordinatesToFeatures(e.geometry.coordinates)};function G(t){this.map=t.map,this.drawConfig=JSON.parse(JSON.stringify(t.options||{})),this._ctx=t}(V.prototype=Object.create(L.prototype))._coordinatesToFeatures=function(t){var e=this,i=this.model.bind(this);return t.map((function(t){return new i(e.ctx,{id:j(),type:f.FEATURE,properties:{},geometry:{coordinates:t,type:e.type.replace("Multi","")}})}))},V.prototype.isValid=function(){return this.features.every((function(t){return t.isValid()}))},V.prototype.setCoordinates=function(t){this.features=this._coordinatesToFeatures(t),this.changed()},V.prototype.getCoordinate=function(t){return q(this.features,"getCoordinate",t)},V.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map((function(t){return t.type===f.POLYGON?t.getCoordinates():t.coordinates}))))},V.prototype.updateCoordinate=function(t,e,i){q(this.features,"updateCoordinate",t,e,i),this.changed()},V.prototype.addCoordinate=function(t,e,i){q(this.features,"addCoordinate",t,e,i),this.changed()},V.prototype.removeCoordinate=function(t){q(this.features,"removeCoordinate",t),this.changed()},V.prototype.getFeatures=function(){return this.features},G.prototype.setSelected=function(t){return this._ctx.store.setSelected(t)},G.prototype.setSelectedCoordinates=function(t){var e=this;this._ctx.store.setSelectedCoordinates(t),t.reduce((function(t,i){return void 0===t[i.feature_id]&&(t[i.feature_id]=!0,e._ctx.store.get(i.feature_id).changed()),t}),{})},G.prototype.getSelected=function(){return this._ctx.store.getSelected()},G.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},G.prototype.isSelected=function(t){return this._ctx.store.isSelected(t)},G.prototype.getFeature=function(t){return this._ctx.store.get(t)},G.prototype.select=function(t){return this._ctx.store.select(t)},G.prototype.deselect=function(t){return this._ctx.store.deselect(t)},G.prototype.deleteFeature=function(t,e){return void 0===e&&(e={}),this._ctx.store.delete(t,e)},G.prototype.addFeature=function(t){return this._ctx.store.add(t)},G.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},G.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},G.prototype.setActionableState=function(t){void 0===t&&(t={});var e={trash:t.trash||!1,combineFeatures:t.combineFeatures||!1,uncombineFeatures:t.uncombineFeatures||!1};return this._ctx.events.actionable(e)},G.prototype.changeMode=function(t,e,i){return void 0===e&&(e={}),void 0===i&&(i={}),this._ctx.events.changeMode(t,e,i)},G.prototype.updateUIClasses=function(t){return this._ctx.ui.queueMapClasses(t)},G.prototype.activateUIButton=function(t){return this._ctx.ui.setActiveButton(t)},G.prototype.featuresAt=function(t,e,i){if(void 0===i&&(i="click"),"click"!==i&&"touch"!==i)throw new Error("invalid buffer type");return A[i](t,e,this._ctx)},G.prototype.newFeature=function(t){var e=t.geometry.type;return e===f.POINT?new R(this._ctx,t):e===f.LINE_STRING?new N(this._ctx,t):e===f.POLYGON?new B(this._ctx,t):new V(this._ctx,t)},G.prototype.isInstanceOf=function(t,e){if(t===f.POINT)return e instanceof R;if(t===f.LINE_STRING)return e instanceof N;if(t===f.POLYGON)return e instanceof B;if("MultiFeature"===t)return e instanceof V;throw new Error("Unknown feature class: "+t)},G.prototype.doRender=function(t){return this._ctx.store.featureChanged(t)},G.prototype.onSetup=function(){},G.prototype.onDrag=function(){},G.prototype.onClick=function(){},G.prototype.onMouseMove=function(){},G.prototype.onMouseDown=function(){},G.prototype.onMouseUp=function(){},G.prototype.onMouseOut=function(){},G.prototype.onKeyUp=function(){},G.prototype.onKeyDown=function(){},G.prototype.onTouchStart=function(){},G.prototype.onTouchMove=function(){},G.prototype.onTouchEnd=function(){},G.prototype.onTap=function(){},G.prototype.onStop=function(){},G.prototype.onTrash=function(){},G.prototype.onCombineFeature=function(){},G.prototype.onUncombineFeature=function(){},G.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};var Z={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},W=Object.keys(Z);function J(t){var e=Object.keys(t);return function(i,n){void 0===n&&(n={});var o={},s=e.reduce((function(e,i){return e[i]=t[i],e}),new G(i));return{start:function(){var e=this;o=s.onSetup(n),W.forEach((function(i){var n,r=Z[i],a=function(){return!1};t[r]&&(a=function(){return!0}),e.on(i,a,(n=r,function(t){return s[n](o,t)}))}))},stop:function(){s.onStop(o)},trash:function(){s.onTrash(o)},combineFeatures:function(){s.onCombineFeatures(o)},uncombineFeatures:function(){s.onUncombineFeatures(o)},render:function(t,e){s.toDisplayFeatures(o,t,e)}}}}function X(t){return[].concat(t).filter((function(t){return void 0!==t}))}function H(){var t=this;if(!(t.ctx.map&&void 0!==t.ctx.map.getSource(c.HOT)))return l();var e=t.ctx.events.currentModeName();t.ctx.ui.queueMapClasses({mode:e});var i=[],n=[];t.isDirty?n=t.getAllIds():(i=t.getChangedIds().filter((function(e){return void 0!==t.get(e)})),n=t.sources.hot.filter((function(e){return e.properties.id&&-1===i.indexOf(e.properties.id)&&void 0!==t.get(e.properties.id)})).map((function(t){return t.properties.id}))),t.sources.hot=[];var o=t.sources.cold.length;t.sources.cold=t.isDirty?[]:t.sources.cold.filter((function(t){var e=t.properties.id||t.properties.parent;return-1===i.indexOf(e)}));var s=o!==t.sources.cold.length||n.length>0;function r(i,n){var o=t.get(i).internal(e);t.ctx.events.currentModeRender(o,(function(e){t.sources[n].push(e)}))}if(i.forEach((function(t){return r(t,"hot")})),n.forEach((function(t){return r(t,"cold")})),s&&t.ctx.map.getSource(c.COLD).setData({type:f.FEATURE_COLLECTION,features:t.sources.cold}),t.ctx.map.getSource(c.HOT).setData({type:f.FEATURE_COLLECTION,features:t.sources.hot}),t._emitSelectionChange&&(t.ctx.map.fire(m.SELECTION_CHANGE,{features:t.getSelected().map((function(t){return t.toGeoJSON()})),points:t.getSelectedCoordinates().map((function(t){return{type:f.FEATURE,properties:{},geometry:{type:f.POINT,coordinates:t.coordinates}}}))}),t._emitSelectionChange=!1),t._deletedFeaturesToEmit.length){var a=t._deletedFeaturesToEmit.map((function(t){return t.toGeoJSON()}));t._deletedFeaturesToEmit=[],t.ctx.map.fire(m.DELETE,{features:a})}function l(){t.isDirty=!1,t.clearChangedIds()}l(),t.ctx.map.fire(m.RENDER,{})}function K(t){var e,i=this;this._features={},this._featureIds=new C,this._selectedFeatureIds=new C,this._selectedCoordinates=[],this._changedFeatureIds=new C,this._deletedFeaturesToEmit=[],this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=t,this.sources={hot:[],cold:[]},this.render=function(){e||(e=requestAnimationFrame((function(){e=null,H.call(i)})))},this.isDirty=!1}function Y(t,e){var i=t._selectedCoordinates.filter((function(e){return t._selectedFeatureIds.has(e.feature_id)}));t._selectedCoordinates.length===i.length||e.silent||(t._emitSelectionChange=!0),t._selectedCoordinates=i}K.prototype.createRenderBatch=function(){var t=this,e=this.render,i=0;return this.render=function(){i++},function(){t.render=e,i>0&&t.render()}},K.prototype.setDirty=function(){return this.isDirty=!0,this},K.prototype.featureChanged=function(t){return this._changedFeatureIds.add(t),this},K.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},K.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},K.prototype.getAllIds=function(){return this._featureIds.values()},K.prototype.add=function(t){return this.featureChanged(t.id),this._features[t.id]=t,this._featureIds.add(t.id),this},K.prototype.delete=function(t,e){var i=this;return void 0===e&&(e={}),X(t).forEach((function(t){i._featureIds.has(t)&&(i._featureIds.delete(t),i._selectedFeatureIds.delete(t),e.silent||-1===i._deletedFeaturesToEmit.indexOf(i._features[t])&&i._deletedFeaturesToEmit.push(i._features[t]),delete i._features[t],i.isDirty=!0)})),Y(this,e),this},K.prototype.get=function(t){return this._features[t]},K.prototype.getAll=function(){var t=this;return Object.keys(this._features).map((function(e){return t._features[e]}))},K.prototype.select=function(t,e){var i=this;return void 0===e&&(e={}),X(t).forEach((function(t){i._selectedFeatureIds.has(t)||(i._selectedFeatureIds.add(t),i._changedFeatureIds.add(t),e.silent||(i._emitSelectionChange=!0))})),this},K.prototype.deselect=function(t,e){var i=this;return void 0===e&&(e={}),X(t).forEach((function(t){i._selectedFeatureIds.has(t)&&(i._selectedFeatureIds.delete(t),i._changedFeatureIds.add(t),e.silent||(i._emitSelectionChange=!0))})),Y(this,e),this},K.prototype.clearSelected=function(t){return void 0===t&&(t={}),this.deselect(this._selectedFeatureIds.values(),{silent:t.silent}),this},K.prototype.setSelected=function(t,e){var i=this;return void 0===e&&(e={}),t=X(t),this.deselect(this._selectedFeatureIds.values().filter((function(e){return-1===t.indexOf(e)})),{silent:e.silent}),this.select(t.filter((function(t){return!i._selectedFeatureIds.has(t)})),{silent:e.silent}),this},K.prototype.setSelectedCoordinates=function(t){return this._selectedCoordinates=t,this._emitSelectionChange=!0,this},K.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},K.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},K.prototype.getSelected=function(){var t=this;return this._selectedFeatureIds.values().map((function(e){return t.get(e)}))},K.prototype.getSelectedCoordinates=function(){var t=this;return this._selectedCoordinates.map((function(e){return{coordinates:t.get(e.feature_id).getCoordinate(e.coord_path)}}))},K.prototype.isSelected=function(t){return this._selectedFeatureIds.has(t)},K.prototype.setFeatureProperty=function(t,e,i){this.get(t).setProperty(e,i),this.featureChanged(t)},K.prototype.storeMapConfig=function(){var t=this;y.forEach((function(e){t.ctx.map[e]&&(t._mapInitialConfig[e]=t.ctx.map[e].isEnabled())}))},K.prototype.restoreMapConfig=function(){var t=this;Object.keys(this._mapInitialConfig).forEach((function(e){t._mapInitialConfig[e]?t.ctx.map[e].enable():t.ctx.map[e].disable()}))},K.prototype.getInitialConfigValue=function(t){return void 0===this._mapInitialConfig[t]||this._mapInitialConfig[t]};var Q=function(){for(var t=arguments,e={},i=0;i<arguments.length;i++){var n=t[i];for(var o in n)tt.call(n,o)&&(e[o]=n[o])}return e},tt=Object.prototype.hasOwnProperty;var et=e(Q),it=["mode","feature","mouse"];function nt(e){var i=null,n=null,o={onRemove:function(){return e.map.off("load",o.connect),clearInterval(n),o.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,i&&i.parentNode&&i.parentNode.removeChild(i),i=null,this},connect:function(){e.map.off("load",o.connect),clearInterval(n),o.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd:function(s){var r=s.fire;return s.fire=function(t,e){var i=arguments;return 1===r.length&&1!==arguments.length&&(i=[et({},{type:t},e)]),r.apply(s,i)},e.map=s,e.events=function(e){var i=Object.keys(e.options.modes).reduce((function(t,i){return t[i]=J(e.options.modes[i]),t}),{}),n={},o={},s={},r=null,a=null;s.drag=function(t,i){i({point:t.point,time:(new Date).getTime()})?(e.ui.queueMapClasses({mouse:u.DRAG}),a.drag(t)):t.originalEvent.stopPropagation()},s.mousedrag=function(t){s.drag(t,(function(t){return!$(n,t)}))},s.touchdrag=function(t){s.drag(t,(function(t){return!F(o,t)}))},s.mousemove=function(t){if(1===(void 0!==t.originalEvent.buttons?t.originalEvent.buttons:t.originalEvent.which))return s.mousedrag(t);var i=T(t,e);t.featureTarget=i,a.mousemove(t)},s.mousedown=function(t){n={time:(new Date).getTime(),point:t.point};var i=T(t,e);t.featureTarget=i,a.mousedown(t)},s.mouseup=function(t){var i=T(t,e);t.featureTarget=i,$(n,{point:t.point,time:(new Date).getTime()})?a.click(t):a.mouseup(t)},s.mouseout=function(t){a.mouseout(t)},s.touchstart=function(t){if(t.originalEvent.preventDefault(),e.options.touchEnabled){o={time:(new Date).getTime(),point:t.point};var i=A.touch(t,null,e)[0];t.featureTarget=i,a.touchstart(t)}},s.touchmove=function(t){if(t.originalEvent.preventDefault(),e.options.touchEnabled)return a.touchmove(t),s.touchdrag(t)},s.touchend=function(t){if(t.originalEvent.preventDefault(),e.options.touchEnabled){var i=A.touch(t,null,e)[0];t.featureTarget=i,F(o,{time:(new Date).getTime(),point:t.point})?a.tap(t):a.touchend(t)}};var l=function(t){return!(8===t||46===t||t>=48&&t<=57)};function h(n,o,s){void 0===s&&(s={}),a.stop();var l=i[n];if(void 0===l)throw new Error(n+" is not valid");r=n;var h=l(e,o);a=t(h,e),s.silent||e.map.fire(m.MODE_CHANGE,{mode:n}),e.store.setDirty(),e.store.render()}s.keydown=function(t){(t.srcElement||t.target).classList.contains("mapboxgl-canvas")&&(8!==t.keyCode&&46!==t.keyCode||!e.options.controls.trash?l(t.keyCode)?a.keydown(t):49===t.keyCode&&e.options.controls.point?h(p.DRAW_POINT):50===t.keyCode&&e.options.controls.line_string?h(p.DRAW_LINE_STRING):51===t.keyCode&&e.options.controls.polygon&&h(p.DRAW_POLYGON):(t.preventDefault(),a.trash()))},s.keyup=function(t){l(t.keyCode)&&a.keyup(t)},s.zoomend=function(){e.store.changeZoom()},s.data=function(t){if("style"===t.dataType){var i=e.setup,n=e.map,o=e.options,s=e.store;o.styles.some((function(t){return n.getLayer(t.id)}))||(i.addLayers(),s.setDirty(),s.render())}};var c={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start:function(){r=e.options.defaultMode,a=t(i[r](e),e)},changeMode:h,actionable:function(t){var i=!1;Object.keys(t).forEach((function(e){if(void 0===c[e])throw new Error("Invalid action type");c[e]!==t[e]&&(i=!0),c[e]=t[e]})),i&&e.map.fire(m.ACTIONABLE,{actions:c})},currentModeName:function(){return r},currentModeRender:function(t,e){return a.render(t,e)},fire:function(t,e){s[t]&&s[t](e)},addEventListeners:function(){e.map.on("mousemove",s.mousemove),e.map.on("mousedown",s.mousedown),e.map.on("mouseup",s.mouseup),e.map.on("data",s.data),e.map.on("touchmove",s.touchmove),e.map.on("touchstart",s.touchstart),e.map.on("touchend",s.touchend),e.container.addEventListener("mouseout",s.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",s.keydown),e.container.addEventListener("keyup",s.keyup))},removeEventListeners:function(){e.map.off("mousemove",s.mousemove),e.map.off("mousedown",s.mousedown),e.map.off("mouseup",s.mouseup),e.map.off("data",s.data),e.map.off("touchmove",s.touchmove),e.map.off("touchstart",s.touchstart),e.map.off("touchend",s.touchend),e.container.removeEventListener("mouseout",s.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",s.keydown),e.container.removeEventListener("keyup",s.keyup))},trash:function(t){a.trash(t)},combineFeatures:function(){a.combineFeatures()},uncombineFeatures:function(){a.uncombineFeatures()},getMode:function(){return r}}}(e),e.ui=function(t){var e={},i=null,n={mode:null,feature:null,mouse:null},o={mode:null,feature:null,mouse:null};function s(t){o=et(o,t)}function r(){var e,i;if(t.container){var s=[],r=[];it.forEach((function(t){o[t]!==n[t]&&(s.push(t+"-"+n[t]),null!==o[t]&&r.push(t+"-"+o[t]))})),s.length>0&&(e=t.container.classList).remove.apply(e,s),r.length>0&&(i=t.container.classList).add.apply(i,r),n=et(n,o)}}function a(t,e){void 0===e&&(e={});var n=document.createElement("button");return n.className=h.CONTROL_BUTTON+" "+e.className,n.setAttribute("title",e.title),e.container.appendChild(n),n.addEventListener("click",(function(n){if(n.preventDefault(),n.stopPropagation(),n.target===i)return l(),void e.onDeactivate();c(t),e.onActivate()}),!0),n}function l(){i&&(i.classList.remove(h.ACTIVE_BUTTON),i=null)}function c(t){l();var n=e[t];n&&n&&"trash"!==t&&(n.classList.add(h.ACTIVE_BUTTON),i=n)}return{setActiveButton:c,queueMapClasses:s,updateMapClasses:r,clearMapClasses:function(){s({mode:null,feature:null,mouse:null}),r()},addButtons:function(){var i=t.options.controls,n=document.createElement("div");return n.className=h.CONTROL_GROUP+" "+h.CONTROL_BASE,i?(i[d.LINE]&&(e[d.LINE]=a(d.LINE,{container:n,className:h.CONTROL_BUTTON_LINE,title:"LineString tool "+(t.options.keybindings?"(l)":""),onActivate:function(){return t.events.changeMode(p.DRAW_LINE_STRING)},onDeactivate:function(){return t.events.trash()}})),i[d.POLYGON]&&(e[d.POLYGON]=a(d.POLYGON,{container:n,className:h.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(t.options.keybindings?"(p)":""),onActivate:function(){return t.events.changeMode(p.DRAW_POLYGON)},onDeactivate:function(){return t.events.trash()}})),i[d.POINT]&&(e[d.POINT]=a(d.POINT,{container:n,className:h.CONTROL_BUTTON_POINT,title:"Marker tool "+(t.options.keybindings?"(m)":""),onActivate:function(){return t.events.changeMode(p.DRAW_POINT)},onDeactivate:function(){return t.events.trash()}})),i.trash&&(e.trash=a("trash",{container:n,className:h.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:function(){t.events.trash()}})),i.combine_features&&(e.combine_features=a("combineFeatures",{container:n,className:h.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:function(){t.events.combineFeatures()}})),i.uncombine_features&&(e.uncombine_features=a("uncombineFeatures",{container:n,className:h.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:function(){t.events.uncombineFeatures()}})),n):n},removeButtons:function(){Object.keys(e).forEach((function(t){var i=e[t];i.parentNode&&i.parentNode.removeChild(i),delete e[t]}))}}}(e),e.container=s.getContainer(),e.store=new K(e),i=e.ui.addButtons(),e.options.boxSelect&&(e.boxZoomInitial=s.boxZoom.isEnabled(),s.boxZoom.disable(),s.dragPan.disable(),s.dragPan.enable()),s.loaded()?o.connect():(s.on("load",o.connect),n=setInterval((function(){s.loaded()&&o.connect()}),16)),e.events.start(),i},addLayers:function(){e.map.addSource(c.COLD,{data:{type:f.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(c.HOT,{data:{type:f.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach((function(t){e.map.addLayer(t)})),e.store.setDirty(!0),e.store.render()},removeLayers:function(){e.options.styles.forEach((function(t){e.map.getLayer(t.id)&&e.map.removeLayer(t.id)})),e.map.getSource(c.COLD)&&e.map.removeSource(c.COLD),e.map.getSource(c.HOT)&&e.map.removeSource(c.HOT)}};return e.setup=o,o}var ot=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"circle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}];function st(t){return function(e){var i=e.featureTarget;return!!i&&(!!i.properties&&i.properties.meta===t)}}function rt(t){return!!t.originalEvent&&(!!t.originalEvent.shiftKey&&0===t.originalEvent.button)}function at(t){return!!t.featureTarget&&(!!t.featureTarget.properties&&(t.featureTarget.properties.active===w.ACTIVE&&t.featureTarget.properties.meta===b.FEATURE))}function lt(t){return!!t.featureTarget&&(!!t.featureTarget.properties&&(t.featureTarget.properties.active===w.INACTIVE&&t.featureTarget.properties.meta===b.FEATURE))}function ht(t){return void 0===t.featureTarget}function ct(t){return!!t.featureTarget&&(!!t.featureTarget.properties&&t.featureTarget.properties.meta===b.FEATURE)}function ut(t){var e=t.featureTarget;return!!e&&(!!e.properties&&e.properties.meta===b.VERTEX)}function dt(t){return!!t.originalEvent&&!0===t.originalEvent.shiftKey}function ft(t){return 27===t.keyCode}function pt(t){return 13===t.keyCode}var mt=Object.freeze({__proto__:null,isOfMetaType:st,isShiftMousedown:rt,isActiveFeature:at,isInactiveFeature:lt,noTarget:ht,isFeature:ct,isVertex:ut,isShiftDown:dt,isEscapeKey:ft,isEnterKey:pt,isTrue:function(){return!0}}),gt=bt;function bt(t,e){this.x=t,this.y=e}bt.prototype={clone:function(){return new bt(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=i,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=e*this.x-i*this.y,o=i*this.x+e*this.y;return this.x=n,this.y=o,this},_rotateAround:function(t,e){var i=Math.cos(t),n=Math.sin(t),o=e.x+i*(this.x-e.x)-n*(this.y-e.y),s=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=o,this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},bt.convert=function(t){return t instanceof bt?t:Array.isArray(t)?new bt(t[0],t[1]):t};var vt=e(gt);function wt(t,e){var i=e.getBoundingClientRect();return new vt(t.clientX-i.left-(e.clientLeft||0),t.clientY-i.top-(e.clientTop||0))}function yt(t,e,i,n){return{type:f.FEATURE,properties:{meta:b.VERTEX,parent:t,coord_path:i,active:n?w.ACTIVE:w.INACTIVE},geometry:{type:f.POINT,coordinates:e}}}function xt(t,e,i){var n=e.geometry.coordinates,o=i.geometry.coordinates;if(n[1]>85||n[1]<x||o[1]>85||o[1]<x)return null;var s={lng:(n[0]+o[0])/2,lat:(n[1]+o[1])/2};return{type:f.FEATURE,properties:{meta:b.MIDPOINT,parent:t,lng:s.lng,lat:s.lat,coord_path:i.properties.coord_path},geometry:{type:f.POINT,coordinates:[s.lng,s.lat]}}}function _t(t,e,i){void 0===e&&(e={}),void 0===i&&(i=null);var n,o=t.geometry,s=o.type,r=o.coordinates,a=t.properties&&t.properties.id,l=[];function h(t,i){var n="",o=null;t.forEach((function(t,s){var r=null!=i?i+"."+s:String(s),h=yt(a,t,r,c(r));if(e.midpoints&&o){var u=xt(a,o,h);u&&l.push(u)}o=h;var d=JSON.stringify(t);n!==d&&l.push(h),0===s&&(n=d)}))}function c(t){return!!e.selectedPaths&&-1!==e.selectedPaths.indexOf(t)}return s===f.POINT?l.push(yt(a,r,i,c(i))):s===f.POLYGON?r.forEach((function(t,e){h(t,null!==i?i+"."+e:String(e))})):s===f.LINE_STRING?h(r,i):0===s.indexOf(f.MULTI_PREFIX)&&(n=s.replace(f.MULTI_PREFIX,""),r.forEach((function(i,o){var s={type:f.FEATURE,properties:t.properties,geometry:{type:n,coordinates:i}};l=l.concat(_t(s,e,o))}))),l}var kt={enable:function(t){setTimeout((function(){t.map&&t.map.doubleClickZoom&&t._ctx&&t._ctx.store&&t._ctx.store.getInitialConfigValue&&t._ctx.store.getInitialConfigValue("doubleClickZoom")&&t.map.doubleClickZoom.enable()}),0)},disable:function(t){setTimeout((function(){t.map&&t.map.doubleClickZoom&&t.map.doubleClickZoom.disable()}),0)}},Mt={exports:{}},zt=function(t){if(!t||!t.type)return null;var e=St[t.type];if(!e)return null;if("geometry"===e)return{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:t}]};if("feature"===e)return{type:"FeatureCollection",features:[t]};if("featurecollection"===e)return t},St={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"};var Ct=e(zt);var Et=Object.freeze({__proto__:null,default:function t(e){switch(e&&e.type||null){case"FeatureCollection":return e.features=e.features.reduce((function(e,i){return e.concat(t(i))}),[]),e;case"Feature":return e.geometry?t(e.geometry).map((function(t){var i={type:"Feature",properties:JSON.parse(JSON.stringify(e.properties)),geometry:t};return void 0!==e.id&&(i.id=e.id),i})):[e];case"MultiPoint":return e.coordinates.map((function(t){return{type:"Point",coordinates:t}}));case"MultiPolygon":return e.coordinates.map((function(t){return{type:"Polygon",coordinates:t}}));case"MultiLineString":return e.coordinates.map((function(t){return{type:"LineString",coordinates:t}}));case"GeometryCollection":return e.geometries.map(t).reduce((function(t,e){return t.concat(e)}),[]);case"Point":case"Polygon":case"LineString":return[e]}}}),At=zt,It=i(Et),Tt=function(t){return function t(e){if(Array.isArray(e)&&e.length&&"number"==typeof e[0])return[e];return e.reduce((function(e,i){return Array.isArray(i)&&Array.isArray(i[0])?e.concat(t(i)):(e.push(i),e)}),[])}(t)};It instanceof Function||(It=It.default);var Pt={exports:{}},$t=Pt.exports=function(t){return new Ft(t)};function Ft(t){this.value=t}function Ot(t,e,i){var n=[],o=[],s=!0;return function t(r){var a=i?Dt(r):r,l={},h=!0,c={node:a,node_:r,path:[].concat(n),parent:o[o.length-1],parents:o,key:n.slice(-1)[0],isRoot:0===n.length,level:n.length,circular:null,update:function(t,e){c.isRoot||(c.parent.node[c.key]=t),c.node=t,e&&(h=!1)},delete:function(t){delete c.parent.node[c.key],t&&(h=!1)},remove:function(t){Rt(c.parent.node)?c.parent.node.splice(c.key,1):delete c.parent.node[c.key],t&&(h=!1)},keys:null,before:function(t){l.before=t},after:function(t){l.after=t},pre:function(t){l.pre=t},post:function(t){l.post=t},stop:function(){s=!1},block:function(){h=!1}};if(!s)return c;function u(){if("object"==typeof c.node&&null!==c.node){c.keys&&c.node_===c.node||(c.keys=jt(c.node)),c.isLeaf=0==c.keys.length;for(var t=0;t<o.length;t++)if(o[t].node_===r){c.circular=o[t];break}}else c.isLeaf=!0,c.keys=null;c.notLeaf=!c.isLeaf,c.notRoot=!c.isRoot}u();var d=e.call(c,c.node);return void 0!==d&&c.update&&c.update(d),l.before&&l.before.call(c,c.node),h?("object"!=typeof c.node||null===c.node||c.circular||(o.push(c),u(),Nt(c.keys,(function(e,o){n.push(e),l.pre&&l.pre.call(c,c.node[e],e);var s=t(c.node[e]);i&&Bt.call(c.node,e)&&(c.node[e]=s.node),s.isLast=o==c.keys.length-1,s.isFirst=0==o,l.post&&l.post.call(c,s),n.pop()})),o.pop()),l.after&&l.after.call(c,c.node),c):c}(t).node}function Dt(t){if("object"==typeof t&&null!==t){var e;if(Rt(t))e=[];else if("[object Date]"===Lt(t))e=new Date(t.getTime?t.getTime():t);else if(function(t){return"[object RegExp]"===Lt(t)}(t))e=new RegExp(t);else if(function(t){return"[object Error]"===Lt(t)}(t))e={message:t.message};else if(function(t){return"[object Boolean]"===Lt(t)}(t))e=new Boolean(t);else if(function(t){return"[object Number]"===Lt(t)}(t))e=new Number(t);else if(function(t){return"[object String]"===Lt(t)}(t))e=new String(t);else if(Object.create&&Object.getPrototypeOf)e=Object.create(Object.getPrototypeOf(t));else if(t.constructor===Object)e={};else{var i=t.constructor&&t.constructor.prototype||t.__proto__||{},n=function(){};n.prototype=i,e=new n}return Nt(jt(t),(function(i){e[i]=t[i]})),e}return t}Ft.prototype.get=function(t){for(var e=this.value,i=0;i<t.length;i++){var n=t[i];if(!e||!Bt.call(e,n)){e=void 0;break}e=e[n]}return e},Ft.prototype.has=function(t){for(var e=this.value,i=0;i<t.length;i++){var n=t[i];if(!e||!Bt.call(e,n))return!1;e=e[n]}return!0},Ft.prototype.set=function(t,e){for(var i=this.value,n=0;n<t.length-1;n++){var o=t[n];Bt.call(i,o)||(i[o]={}),i=i[o]}return i[t[n]]=e,e},Ft.prototype.map=function(t){return Ot(this.value,t,!0)},Ft.prototype.forEach=function(t){return this.value=Ot(this.value,t,!1),this.value},Ft.prototype.reduce=function(t,e){var i=1===arguments.length,n=i?this.value:e;return this.forEach((function(e){this.isRoot&&i||(n=t.call(this,n,e))})),n},Ft.prototype.paths=function(){var t=[];return this.forEach((function(e){t.push(this.path)})),t},Ft.prototype.nodes=function(){var t=[];return this.forEach((function(e){t.push(this.node)})),t},Ft.prototype.clone=function(){var t=[],e=[];return function i(n){for(var o=0;o<t.length;o++)if(t[o]===n)return e[o];if("object"==typeof n&&null!==n){var s=Dt(n);return t.push(n),e.push(s),Nt(jt(n),(function(t){s[t]=i(n[t])})),t.pop(),e.pop(),s}return n}(this.value)};var jt=Object.keys||function(t){var e=[];for(var i in t)e.push(i);return e};function Lt(t){return Object.prototype.toString.call(t)}var Rt=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},Nt=function(t,e){if(t.forEach)return t.forEach(e);for(var i=0;i<t.length;i++)e(t[i],i,t)};Nt(jt(Ft.prototype),(function(t){$t[t]=function(e){var i=[].slice.call(arguments,1),n=new Ft(e);return n[t].apply(n,i)}}));var Bt=Object.hasOwnProperty||function(t,e){return e in t},Ut=Pt.exports,qt=Vt;function Vt(t){if(!(this instanceof Vt))return new Vt(t);this._bbox=t||[1/0,1/0,-1/0,-1/0],this._valid=!!t}Vt.prototype.include=function(t){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[0]),this._bbox[3]=Math.max(this._bbox[3],t[1]),this},Vt.prototype.equals=function(t){var e;return e=t instanceof Vt?t.bbox():t,this._bbox[0]==e[0]&&this._bbox[1]==e[1]&&this._bbox[2]==e[2]&&this._bbox[3]==e[3]},Vt.prototype.center=function(t){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},Vt.prototype.union=function(t){var e;return this._valid=!0,e=t instanceof Vt?t.bbox():t,this._bbox[0]=Math.min(this._bbox[0],e[0]),this._bbox[1]=Math.min(this._bbox[1],e[1]),this._bbox[2]=Math.max(this._bbox[2],e[2]),this._bbox[3]=Math.max(this._bbox[3],e[3]),this},Vt.prototype.bbox=function(){return this._valid?this._bbox:null},Vt.prototype.contains=function(t){if(!t)return this._fastContains();if(!this._valid)return null;var e=t[0],i=t[1];return this._bbox[0]<=e&&this._bbox[1]<=i&&this._bbox[2]>=e&&this._bbox[3]>=i},Vt.prototype.intersect=function(t){return this._valid?(e=t instanceof Vt?t.bbox():t,!(this._bbox[0]>e[2]||this._bbox[2]<e[0]||this._bbox[3]<e[1]||this._bbox[1]>e[3])):null;var e},Vt.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var t="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",t)},Vt.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null};var Gt=function(t){if(!t)return[];var e=It(At(t)),i=[];return e.features.forEach((function(t){t.geometry&&(i=i.concat(Tt(t.geometry.coordinates)))})),i},Zt=Ut,Wt=qt,Jt={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},Xt=Object.keys(Jt);function Ht(t){for(var e=Wt(),i=Gt(t),n=0;n<i.length;n++)e.include(i[n]);return e}Mt.exports=function(t){return Ht(t).bbox()},Mt.exports.polygon=function(t){return Ht(t).polygon()},Mt.exports.bboxify=function(t){return Zt(t).map((function(t){t&&(Xt.some((function(e){return!!t[e]&&-1!==Jt[e].indexOf(t.type)}))&&(t.bbox=Ht(t).bbox(),this.update(t)))}))};var Kt=e(Mt.exports),Yt=-90;function Qt(t,e){var i=Yt,n=90,o=Yt,s=90,r=270,a=-270;t.forEach((function(t){var e=Kt(t),l=e[1],h=e[3],c=e[0],u=e[2];l>i&&(i=l),h<n&&(n=h),h>o&&(o=h),l<s&&(s=l),c<r&&(r=c),u>a&&(a=u)}));var l=e;return i+l.lat>85&&(l.lat=85-i),o+l.lat>90&&(l.lat=90-o),n+l.lat<-85&&(l.lat=-85-n),s+l.lat<Yt&&(l.lat=Yt-s),r+l.lng<=-270&&(l.lng+=360*Math.ceil(Math.abs(l.lng)/360)),a+l.lng>=270&&(l.lng-=360*Math.ceil(Math.abs(l.lng)/360)),l}function te(t,e){var i=Qt(t.map((function(t){return t.toGeoJSON()})),e);t.forEach((function(t){var e,n=t.getCoordinates(),o=function(t){var e={lng:t[0]+i.lng,lat:t[1]+i.lat};return[e.lng,e.lat]},s=function(t){return t.map((function(t){return o(t)}))};t.type===f.POINT?e=o(n):t.type===f.LINE_STRING||t.type===f.MULTI_POINT?e=n.map(o):t.type===f.POLYGON||t.type===f.MULTI_LINE_STRING?e=n.map(s):t.type===f.MULTI_POLYGON&&(e=n.map((function(t){return t.map((function(t){return s(t)}))}))),t.incomingCoords(e)}))}var ee={onSetup:function(t){var e=this,i={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initiallySelectedFeatureIds:t.featureIds||[]};return this.setSelected(i.initiallySelectedFeatureIds.filter((function(t){return void 0!==e.getFeature(t)}))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),i},fireUpdate:function(){this.map.fire(m.UPDATE,{action:g.MOVE,features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(){var t=this,e=this.getSelected(),i=e.filter((function(e){return t.isInstanceOf("MultiFeature",e)})),n=!1;if(e.length>1){n=!0;var o=e[0].type.replace("Multi","");e.forEach((function(t){t.type.replace("Multi","")!==o&&(n=!1)}))}var s=i.length>0,r=e.length>0;this.setActionableState({combineFeatures:n,uncombineFeatures:s,trash:r})},getUniqueIds:function(t){return t.length?t.map((function(t){return t.properties.id})).filter((function(t){return void 0!==t})).reduce((function(t,e){return t.add(e),t}),new C).values():[]},stopExtendedInteractions:function(t){t.boxSelectElement&&(t.boxSelectElement.parentNode&&t.boxSelectElement.parentNode.removeChild(t.boxSelectElement),t.boxSelectElement=null),this.map.dragPan.enable(),t.boxSelecting=!1,t.canBoxSelect=!1,t.dragMoving=!1,t.canDragMove=!1},onStop:function(){kt.enable(this)},onMouseMove:function(t,e){return ct(e)&&t.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(t),!0},onMouseOut:function(t){return!t.dragMoving||this.fireUpdate()}};ee.onTap=ee.onClick=function(t,e){return ht(e)?this.clickAnywhere(t,e):st(b.VERTEX)(e)?this.clickOnVertex(t,e):ct(e)?this.clickOnFeature(t,e):void 0},ee.clickAnywhere=function(t){var e=this,i=this.getSelectedIds();i.length&&(this.clearSelectedFeatures(),i.forEach((function(t){return e.doRender(t)}))),kt.enable(this),this.stopExtendedInteractions(t)},ee.clickOnVertex=function(t,e){this.changeMode(p.DIRECT_SELECT,{featureId:e.featureTarget.properties.parent,coordPath:e.featureTarget.properties.coord_path,startPos:e.lngLat}),this.updateUIClasses({mouse:u.MOVE})},ee.startOnActiveFeature=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),this.doRender(e.featureTarget.properties.id),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},ee.clickOnFeature=function(t,e){var i=this;kt.disable(this),this.stopExtendedInteractions(t);var n=dt(e),o=this.getSelectedIds(),s=e.featureTarget.properties.id,r=this.isSelected(s);if(!n&&r&&this.getFeature(s).type!==f.POINT)return this.changeMode(p.DIRECT_SELECT,{featureId:s});r&&n?(this.deselect(s),this.updateUIClasses({mouse:u.POINTER}),1===o.length&&kt.enable(this)):!r&&n?(this.select(s),this.updateUIClasses({mouse:u.MOVE})):r||n||(o.forEach((function(t){return i.doRender(t)})),this.setSelected(s),this.updateUIClasses({mouse:u.MOVE})),this.doRender(s)},ee.onMouseDown=function(t,e){return at(e)?this.startOnActiveFeature(t,e):this.drawConfig.boxSelect&&rt(e)?this.startBoxSelect(t,e):void 0},ee.startBoxSelect=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),t.boxSelectStartLocation=wt(e.originalEvent,this.map.getContainer()),t.canBoxSelect=!0},ee.onTouchStart=function(t,e){if(at(e))return this.startOnActiveFeature(t,e)},ee.onDrag=function(t,e){return t.canDragMove?this.dragMove(t,e):this.drawConfig.boxSelect&&t.canBoxSelect?this.whileBoxSelect(t,e):void 0},ee.whileBoxSelect=function(t,e){t.boxSelecting=!0,this.updateUIClasses({mouse:u.ADD}),t.boxSelectElement||(t.boxSelectElement=document.createElement("div"),t.boxSelectElement.classList.add(h.BOX_SELECT),this.map.getContainer().appendChild(t.boxSelectElement));var i=wt(e.originalEvent,this.map.getContainer()),n=Math.min(t.boxSelectStartLocation.x,i.x),o=Math.max(t.boxSelectStartLocation.x,i.x),s=Math.min(t.boxSelectStartLocation.y,i.y),r=Math.max(t.boxSelectStartLocation.y,i.y),a="translate("+n+"px, "+s+"px)";t.boxSelectElement.style.transform=a,t.boxSelectElement.style.WebkitTransform=a,t.boxSelectElement.style.width=o-n+"px",t.boxSelectElement.style.height=r-s+"px"},ee.dragMove=function(t,e){t.dragMoving=!0,e.originalEvent.stopPropagation();var i={lng:e.lngLat.lng-t.dragMoveLocation.lng,lat:e.lngLat.lat-t.dragMoveLocation.lat};te(this.getSelected(),i),t.dragMoveLocation=e.lngLat},ee.onTouchEnd=ee.onMouseUp=function(t,e){var i=this;if(t.dragMoving)this.fireUpdate();else if(t.boxSelecting){var n=[t.boxSelectStartLocation,wt(e.originalEvent,this.map.getContainer())],o=this.featuresAt(null,n,"click"),s=this.getUniqueIds(o).filter((function(t){return!i.isSelected(t)}));s.length&&(this.select(s),s.forEach((function(t){return i.doRender(t)})),this.updateUIClasses({mouse:u.MOVE}))}this.stopExtendedInteractions(t)},ee.toDisplayFeatures=function(t,e,i){e.properties.active=this.isSelected(e.properties.id)?w.ACTIVE:w.INACTIVE,i(e),this.fireActionable(),e.properties.active===w.ACTIVE&&e.geometry.type!==f.POINT&&_t(e).forEach(i)},ee.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},ee.onCombineFeatures=function(){var t=this.getSelected();if(!(0===t.length||t.length<2)){for(var e=[],i=[],n=t[0].type.replace("Multi",""),o=0;o<t.length;o++){var s=t[o];if(s.type.replace("Multi","")!==n)return;s.type.includes("Multi")?s.getCoordinates().forEach((function(t){e.push(t)})):e.push(s.getCoordinates()),i.push(s.toGeoJSON())}if(i.length>1){var r=this.newFeature({type:f.FEATURE,properties:i[0].properties,geometry:{type:"Multi"+n,coordinates:e}});this.addFeature(r),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([r.id]),this.map.fire(m.COMBINE_FEATURES,{createdFeatures:[r.toGeoJSON()],deletedFeatures:i})}this.fireActionable()}},ee.onUncombineFeatures=function(){var t=this,e=this.getSelected();if(0!==e.length){for(var i=[],n=[],o=function(o){var s=e[o];t.isInstanceOf("MultiFeature",s)&&(s.getFeatures().forEach((function(e){t.addFeature(e),e.properties=s.properties,i.push(e.toGeoJSON()),t.select([e.id])})),t.deleteFeature(s.id,{silent:!0}),n.push(s.toGeoJSON()))},s=0;s<e.length;s++)o(s);i.length>1&&this.map.fire(m.UNCOMBINE_FEATURES,{createdFeatures:i,deletedFeatures:n}),this.fireActionable()}};var ie=st(b.VERTEX),ne=st(b.MIDPOINT),oe={fireUpdate:function(){this.map.fire(m.UPDATE,{action:g.CHANGE_COORDINATES,features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(t){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:t.selectedCoordPaths.length>0})},startDragging:function(t,e){this.map.dragPan.disable(),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},stopDragging:function(t){this.map.dragPan.enable(),t.dragMoving=!1,t.canDragMove=!1,t.dragMoveLocation=null},onVertex:function(t,e){this.startDragging(t,e);var i=e.featureTarget.properties,n=t.selectedCoordPaths.indexOf(i.coord_path);dt(e)||-1!==n?dt(e)&&-1===n&&t.selectedCoordPaths.push(i.coord_path):t.selectedCoordPaths=[i.coord_path];var o=this.pathsToCoordinates(t.featureId,t.selectedCoordPaths);this.setSelectedCoordinates(o)},onMidpoint:function(t,e){this.startDragging(t,e);var i=e.featureTarget.properties;t.feature.addCoordinate(i.coord_path,i.lng,i.lat),this.fireUpdate(),t.selectedCoordPaths=[i.coord_path]},pathsToCoordinates:function(t,e){return e.map((function(e){return{feature_id:t,coord_path:e}}))},onFeature:function(t,e){0===t.selectedCoordPaths.length?this.startDragging(t,e):this.stopDragging(t)},dragFeature:function(t,e,i){te(this.getSelected(),i),t.dragMoveLocation=e.lngLat},dragVertex:function(t,e,i){for(var n=t.selectedCoordPaths.map((function(e){return t.feature.getCoordinate(e)})),o=Qt(n.map((function(t){return{type:f.FEATURE,properties:{},geometry:{type:f.POINT,coordinates:t}}})),i),s=0;s<n.length;s++){var r=n[s];t.feature.updateCoordinate(t.selectedCoordPaths[s],r[0]+o.lng,r[1]+o.lat)}},clickNoTarget:function(){this.changeMode(p.SIMPLE_SELECT)},clickInactive:function(){this.changeMode(p.SIMPLE_SELECT)},clickActiveFeature:function(t){t.selectedCoordPaths=[],this.clearSelectedCoordinates(),t.feature.changed()},onSetup:function(t){var e=t.featureId,i=this.getFeature(e);if(!i)throw new Error("You must provide a featureId to enter direct_select mode");if(i.type===f.POINT)throw new TypeError("direct_select mode doesn't handle point features");var n={featureId:e,feature:i,dragMoveLocation:t.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:t.coordPath?[t.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(e,n.selectedCoordPaths)),this.setSelected(e),kt.disable(this),this.setActionableState({trash:!0}),n},onStop:function(){kt.enable(this),this.clearSelectedCoordinates()},toDisplayFeatures:function(t,e,i){t.featureId===e.properties.id?(e.properties.active=w.ACTIVE,i(e),_t(e,{map:this.map,midpoints:!0,selectedPaths:t.selectedCoordPaths}).forEach(i)):(e.properties.active=w.INACTIVE,i(e)),this.fireActionable(t)},onTrash:function(t){t.selectedCoordPaths.sort((function(t,e){return e.localeCompare(t,"en",{numeric:!0})})).forEach((function(e){return t.feature.removeCoordinate(e)})),this.fireUpdate(),t.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(t),!1===t.feature.isValid()&&(this.deleteFeature([t.featureId]),this.changeMode(p.SIMPLE_SELECT,{}))},onMouseMove:function(t,e){var i=at(e),n=ie(e),o=ne(e),s=0===t.selectedCoordPaths.length;return i&&s||n&&!s?this.updateUIClasses({mouse:u.MOVE}):this.updateUIClasses({mouse:u.NONE}),(n||i||o)&&t.dragMoving&&this.fireUpdate(),this.stopDragging(t),!0},onMouseOut:function(t){return t.dragMoving&&this.fireUpdate(),!0}};oe.onTouchStart=oe.onMouseDown=function(t,e){return ie(e)?this.onVertex(t,e):at(e)?this.onFeature(t,e):ne(e)?this.onMidpoint(t,e):void 0},oe.onDrag=function(t,e){if(!0===t.canDragMove){t.dragMoving=!0,e.originalEvent.stopPropagation();var i={lng:e.lngLat.lng-t.dragMoveLocation.lng,lat:e.lngLat.lat-t.dragMoveLocation.lat};t.selectedCoordPaths.length>0?this.dragVertex(t,e,i):this.dragFeature(t,e,i),t.dragMoveLocation=e.lngLat}},oe.onClick=function(t,e){return ht(e)?this.clickNoTarget(t,e):at(e)?this.clickActiveFeature(t,e):lt(e)?this.clickInactive(t,e):void this.stopDragging(t)},oe.onTap=function(t,e){return ht(e)?this.clickNoTarget(t,e):at(e)?this.clickActiveFeature(t,e):lt(e)?this.clickInactive(t,e):void 0},oe.onTouchEnd=oe.onMouseUp=function(t){t.dragMoving&&this.fireUpdate(),this.stopDragging(t)};var se={};function re(t,e){return!!t.lngLat&&(t.lngLat.lng===e[0]&&t.lngLat.lat===e[1])}se.onSetup=function(){var t=this.newFeature({type:f.FEATURE,properties:{},geometry:{type:f.POINT,coordinates:[]}});return this.addFeature(t),this.clearSelectedFeatures(),this.updateUIClasses({mouse:u.ADD}),this.activateUIButton(d.POINT),this.setActionableState({trash:!0}),{point:t}},se.stopDrawingAndRemove=function(t){this.deleteFeature([t.point.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT)},se.onTap=se.onClick=function(t,e){this.updateUIClasses({mouse:u.MOVE}),t.point.updateCoordinate("",e.lngLat.lng,e.lngLat.lat),this.map.fire(m.CREATE,{features:[t.point.toGeoJSON()]}),this.changeMode(p.SIMPLE_SELECT,{featureIds:[t.point.id]})},se.onStop=function(t){this.activateUIButton(),t.point.getCoordinate().length||this.deleteFeature([t.point.id],{silent:!0})},se.toDisplayFeatures=function(t,e,i){var n=e.properties.id===t.point.id;if(e.properties.active=n?w.ACTIVE:w.INACTIVE,!n)return i(e)},se.onTrash=se.stopDrawingAndRemove,se.onKeyUp=function(t,e){if(ft(e)||pt(e))return this.stopDrawingAndRemove(t,e)};var ae={onSetup:function(){var t=this.newFeature({type:f.FEATURE,properties:{},geometry:{type:f.POLYGON,coordinates:[[]]}});return this.addFeature(t),this.clearSelectedFeatures(),kt.disable(this),this.updateUIClasses({mouse:u.ADD}),this.activateUIButton(d.POLYGON),this.setActionableState({trash:!0}),{polygon:t,currentVertexPosition:0}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&re(e,t.polygon.coordinates[0][t.currentVertexPosition-1]))return this.changeMode(p.SIMPLE_SELECT,{featureIds:[t.polygon.id]});this.updateUIClasses({mouse:u.ADD}),t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),t.currentVertexPosition++,t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(p.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},onMouseMove:function(t,e){t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),ut(e)&&this.updateUIClasses({mouse:u.POINTER})}};ae.onTap=ae.onClick=function(t,e){return ut(e)?this.clickOnVertex(t,e):this.clickAnywhere(t,e)},ae.onKeyUp=function(t,e){ft(e)?(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT)):pt(e)&&this.changeMode(p.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},ae.onStop=function(t){this.updateUIClasses({mouse:u.NONE}),kt.enable(this),this.activateUIButton(),void 0!==this.getFeature(t.polygon.id)&&(t.polygon.removeCoordinate("0."+t.currentVertexPosition),t.polygon.isValid()?this.map.fire(m.CREATE,{features:[t.polygon.toGeoJSON()]}):(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT,{},{silent:!0})))},ae.toDisplayFeatures=function(t,e,i){var n=e.properties.id===t.polygon.id;if(e.properties.active=n?w.ACTIVE:w.INACTIVE,!n)return i(e);if(0!==e.geometry.coordinates.length){var o=e.geometry.coordinates[0].length;if(!(o<3)){if(e.properties.meta=b.FEATURE,i(yt(t.polygon.id,e.geometry.coordinates[0][0],"0.0",!1)),o>3){var s=e.geometry.coordinates[0].length-3;i(yt(t.polygon.id,e.geometry.coordinates[0][s],"0."+s,!1))}if(o<=4){var r=[[e.geometry.coordinates[0][0][0],e.geometry.coordinates[0][0][1]],[e.geometry.coordinates[0][1][0],e.geometry.coordinates[0][1][1]]];if(i({type:f.FEATURE,properties:e.properties,geometry:{coordinates:r,type:f.LINE_STRING}}),3===o)return}return i(e)}}},ae.onTrash=function(t){this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT)};var le={onSetup:function(t){var e,i,n=(t=t||{}).featureId,o="forward";if(n){if(!(e=this.getFeature(n)))throw new Error("Could not find a feature with the provided featureId");var s=t.from;if(s&&"Feature"===s.type&&s.geometry&&"Point"===s.geometry.type&&(s=s.geometry),s&&"Point"===s.type&&s.coordinates&&2===s.coordinates.length&&(s=s.coordinates),!s||!Array.isArray(s))throw new Error("Please use the `from` property to indicate which point to continue the line from");var r=e.coordinates.length-1;if(e.coordinates[r][0]===s[0]&&e.coordinates[r][1]===s[1])i=r+1,e.addCoordinate.apply(e,[i].concat(e.coordinates[r]));else{if(e.coordinates[0][0]!==s[0]||e.coordinates[0][1]!==s[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");o="backwards",i=0,e.addCoordinate.apply(e,[i].concat(e.coordinates[0]))}}else e=this.newFeature({type:f.FEATURE,properties:{},geometry:{type:f.LINE_STRING,coordinates:[]}}),i=0,this.addFeature(e);return this.clearSelectedFeatures(),kt.disable(this),this.updateUIClasses({mouse:u.ADD}),this.activateUIButton(d.LINE),this.setActionableState({trash:!0}),{line:e,currentVertexPosition:i,direction:o}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&re(e,t.line.coordinates[t.currentVertexPosition-1])||"backwards"===t.direction&&re(e,t.line.coordinates[t.currentVertexPosition+1]))return this.changeMode(p.SIMPLE_SELECT,{featureIds:[t.line.id]});this.updateUIClasses({mouse:u.ADD}),t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),"forward"===t.direction?(t.currentVertexPosition++,t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)):t.line.addCoordinate(0,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(p.SIMPLE_SELECT,{featureIds:[t.line.id]})},onMouseMove:function(t,e){t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),ut(e)&&this.updateUIClasses({mouse:u.POINTER})}};le.onTap=le.onClick=function(t,e){if(ut(e))return this.clickOnVertex(t,e);this.clickAnywhere(t,e)},le.onKeyUp=function(t,e){pt(e)?this.changeMode(p.SIMPLE_SELECT,{featureIds:[t.line.id]}):ft(e)&&(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT))},le.onStop=function(t){kt.enable(this),this.activateUIButton(),void 0!==this.getFeature(t.line.id)&&(t.line.removeCoordinate(""+t.currentVertexPosition),t.line.isValid()?this.map.fire(m.CREATE,{features:[t.line.toGeoJSON()]}):(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT,{},{silent:!0})))},le.onTrash=function(t){this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT)},le.toDisplayFeatures=function(t,e,i){var n=e.properties.id===t.line.id;if(e.properties.active=n?w.ACTIVE:w.INACTIVE,!n)return i(e);e.geometry.coordinates.length<2||(e.properties.meta=b.FEATURE,i(yt(t.line.id,e.geometry.coordinates["forward"===t.direction?e.geometry.coordinates.length-2:1],""+("forward"===t.direction?e.geometry.coordinates.length-2:1),!1)),i(e))};var he={simple_select:ee,direct_select:oe,draw_point:se,draw_polygon:ae,draw_line_string:le},ce={defaultMode:p.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:ot,modes:he,controls:{},userProperties:!1},ue={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},de={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function fe(t,e){return t.map((function(t){return t.source?t:et(t,{id:t.id+"."+e,source:"hot"===e?c.HOT:c.COLD})}))}var pe={exports:{}};!function(t,e){var i="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",s="[object Array]",r="[object Boolean]",a="[object Date]",l="[object Error]",h="[object Function]",c="[object Map]",u="[object Number]",d="[object Object]",f="[object Promise]",p="[object RegExp]",m="[object Set]",g="[object String]",b="[object Symbol]",w="[object WeakMap]",y="[object ArrayBuffer]",x="[object DataView]",_=/^\[object .+?Constructor\]$/,k=/^(?:0|[1-9]\d*)$/,M={};M["[object Float32Array]"]=M["[object Float64Array]"]=M["[object Int8Array]"]=M["[object Int16Array]"]=M["[object Int32Array]"]=M["[object Uint8Array]"]=M["[object Uint8ClampedArray]"]=M["[object Uint16Array]"]=M["[object Uint32Array]"]=!0,M[o]=M[s]=M[y]=M[r]=M[x]=M[a]=M[l]=M[h]=M[c]=M[u]=M[d]=M[p]=M[m]=M[g]=M[w]=!1;var z="object"==typeof v&&v&&v.Object===Object&&v,S="object"==typeof self&&self&&self.Object===Object&&self,C=z||S||Function("return this")(),E=e&&!e.nodeType&&e,A=E&&t&&!t.nodeType&&t,I=A&&A.exports===E,T=I&&z.process,P=function(){try{return T&&T.binding&&T.binding("util")}catch(t){}}(),$=P&&P.isTypedArray;function F(t,e){for(var i=-1,n=null==t?0:t.length;++i<n;)if(e(t[i],i,t))return!0;return!1}function O(t){var e=-1,i=Array(t.size);return t.forEach((function(t,n){i[++e]=[n,t]})),i}function D(t){var e=-1,i=Array(t.size);return t.forEach((function(t){i[++e]=t})),i}var j,L,R,N=Array.prototype,B=Function.prototype,U=Object.prototype,q=C["__core-js_shared__"],V=B.toString,G=U.hasOwnProperty,Z=(j=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+j:"",W=U.toString,J=RegExp("^"+V.call(G).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),X=I?C.Buffer:void 0,H=C.Symbol,K=C.Uint8Array,Y=U.propertyIsEnumerable,Q=N.splice,tt=H?H.toStringTag:void 0,et=Object.getOwnPropertySymbols,it=X?X.isBuffer:void 0,nt=(L=Object.keys,R=Object,function(t){return L(R(t))}),ot=Pt(C,"DataView"),st=Pt(C,"Map"),rt=Pt(C,"Promise"),at=Pt(C,"Set"),lt=Pt(C,"WeakMap"),ht=Pt(Object,"create"),ct=Dt(ot),ut=Dt(st),dt=Dt(rt),ft=Dt(at),pt=Dt(lt),mt=H?H.prototype:void 0,gt=mt?mt.valueOf:void 0;function bt(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function vt(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function wt(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}function yt(t){var e=-1,i=null==t?0:t.length;for(this.__data__=new wt;++e<i;)this.add(t[e])}function xt(t){var e=this.__data__=new vt(t);this.size=e.size}function _t(t,e){var i=Rt(t),n=!i&&Lt(t),o=!i&&!n&&Nt(t),s=!i&&!n&&!o&&Gt(t),r=i||n||o||s,a=r?function(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n}(t.length,String):[],l=a.length;for(var h in t)!e&&!G.call(t,h)||r&&("length"==h||o&&("offset"==h||"parent"==h)||s&&("buffer"==h||"byteLength"==h||"byteOffset"==h)||Ot(h,l))||a.push(h);return a}function kt(t,e){for(var i=t.length;i--;)if(jt(t[i][0],e))return i;return-1}function Mt(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":tt&&tt in Object(t)?function(t){var e=G.call(t,tt),i=t[tt];try{t[tt]=void 0;var n=!0}catch(t){}var o=W.call(t);n&&(e?t[tt]=i:delete t[tt]);return o}(t):function(t){return W.call(t)}(t)}function zt(t){return Vt(t)&&Mt(t)==o}function St(t,e,i,n,h){return t===e||(null==t||null==e||!Vt(t)&&!Vt(e)?t!=t&&e!=e:function(t,e,i,n,h,f){var v=Rt(t),w=Rt(e),_=v?s:Ft(t),k=w?s:Ft(e),M=(_=_==o?d:_)==d,z=(k=k==o?d:k)==d,S=_==k;if(S&&Nt(t)){if(!Nt(e))return!1;v=!0,M=!1}if(S&&!M)return f||(f=new xt),v||Gt(t)?At(t,e,i,n,h,f):function(t,e,i,n,o,s,h){switch(i){case x:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case y:return!(t.byteLength!=e.byteLength||!s(new K(t),new K(e)));case r:case a:case u:return jt(+t,+e);case l:return t.name==e.name&&t.message==e.message;case p:case g:return t==e+"";case c:var d=O;case m:var f=1&n;if(d||(d=D),t.size!=e.size&&!f)return!1;var v=h.get(t);if(v)return v==e;n|=2,h.set(t,e);var w=At(d(t),d(e),n,o,s,h);return h.delete(t),w;case b:if(gt)return gt.call(t)==gt.call(e)}return!1}(t,e,_,i,n,h,f);if(!(1&i)){var C=M&&G.call(t,"__wrapped__"),E=z&&G.call(e,"__wrapped__");if(C||E){var A=C?t.value():t,I=E?e.value():e;return f||(f=new xt),h(A,I,i,n,f)}}if(!S)return!1;return f||(f=new xt),function(t,e,i,n,o,s){var r=1&i,a=It(t),l=a.length,h=It(e).length;if(l!=h&&!r)return!1;var c=l;for(;c--;){var u=a[c];if(!(r?u in e:G.call(e,u)))return!1}var d=s.get(t);if(d&&s.get(e))return d==e;var f=!0;s.set(t,e),s.set(e,t);var p=r;for(;++c<l;){var m=t[u=a[c]],g=e[u];if(n)var b=r?n(g,m,u,e,t,s):n(m,g,u,t,e,s);if(!(void 0===b?m===g||o(m,g,i,n,s):b)){f=!1;break}p||(p="constructor"==u)}if(f&&!p){var v=t.constructor,w=e.constructor;v==w||!("constructor"in t)||!("constructor"in e)||"function"==typeof v&&v instanceof v&&"function"==typeof w&&w instanceof w||(f=!1)}return s.delete(t),s.delete(e),f}(t,e,i,n,h,f)}(t,e,i,n,St,h))}function Ct(t){return!(!qt(t)||function(t){return!!Z&&Z in t}(t))&&(Bt(t)?J:_).test(Dt(t))}function Et(t){if(i=(e=t)&&e.constructor,n="function"==typeof i&&i.prototype||U,e!==n)return nt(t);var e,i,n,o=[];for(var s in Object(t))G.call(t,s)&&"constructor"!=s&&o.push(s);return o}function At(t,e,i,n,o,s){var r=1&i,a=t.length,l=e.length;if(a!=l&&!(r&&l>a))return!1;var h=s.get(t);if(h&&s.get(e))return h==e;var c=-1,u=!0,d=2&i?new yt:void 0;for(s.set(t,e),s.set(e,t);++c<a;){var f=t[c],p=e[c];if(n)var m=r?n(p,f,c,e,t,s):n(f,p,c,t,e,s);if(void 0!==m){if(m)continue;u=!1;break}if(d){if(!F(e,(function(t,e){if(r=e,!d.has(r)&&(f===t||o(f,t,i,n,s)))return d.push(e);var r}))){u=!1;break}}else if(f!==p&&!o(f,p,i,n,s)){u=!1;break}}return s.delete(t),s.delete(e),u}function It(t){return function(t,e,i){var n=e(t);return Rt(t)?n:function(t,e){for(var i=-1,n=e.length,o=t.length;++i<n;)t[o+i]=e[i];return t}(n,i(t))}(t,Zt,$t)}function Tt(t,e){var i,n,o=t.__data__;return("string"==(n=typeof(i=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==i:null===i)?o["string"==typeof e?"string":"hash"]:o.map}function Pt(t,e){var i=function(t,e){return null==t?void 0:t[e]}(t,e);return Ct(i)?i:void 0}bt.prototype.clear=function(){this.__data__=ht?ht(null):{},this.size=0},bt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},bt.prototype.get=function(t){var e=this.__data__;if(ht){var n=e[t];return n===i?void 0:n}return G.call(e,t)?e[t]:void 0},bt.prototype.has=function(t){var e=this.__data__;return ht?void 0!==e[t]:G.call(e,t)},bt.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ht&&void 0===e?i:e,this},vt.prototype.clear=function(){this.__data__=[],this.size=0},vt.prototype.delete=function(t){var e=this.__data__,i=kt(e,t);return!(i<0)&&(i==e.length-1?e.pop():Q.call(e,i,1),--this.size,!0)},vt.prototype.get=function(t){var e=this.__data__,i=kt(e,t);return i<0?void 0:e[i][1]},vt.prototype.has=function(t){return kt(this.__data__,t)>-1},vt.prototype.set=function(t,e){var i=this.__data__,n=kt(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this},wt.prototype.clear=function(){this.size=0,this.__data__={hash:new bt,map:new(st||vt),string:new bt}},wt.prototype.delete=function(t){var e=Tt(this,t).delete(t);return this.size-=e?1:0,e},wt.prototype.get=function(t){return Tt(this,t).get(t)},wt.prototype.has=function(t){return Tt(this,t).has(t)},wt.prototype.set=function(t,e){var i=Tt(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this},yt.prototype.add=yt.prototype.push=function(t){return this.__data__.set(t,i),this},yt.prototype.has=function(t){return this.__data__.has(t)},xt.prototype.clear=function(){this.__data__=new vt,this.size=0},xt.prototype.delete=function(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i},xt.prototype.get=function(t){return this.__data__.get(t)},xt.prototype.has=function(t){return this.__data__.has(t)},xt.prototype.set=function(t,e){var i=this.__data__;if(i instanceof vt){var n=i.__data__;if(!st||n.length<199)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new wt(n)}return i.set(t,e),this.size=i.size,this};var $t=et?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var i=-1,n=null==t?0:t.length,o=0,s=[];++i<n;){var r=t[i];e(r,i,t)&&(s[o++]=r)}return s}(et(t),(function(e){return Y.call(t,e)})))}:function(){return[]},Ft=Mt;function Ot(t,e){return!!(e=null==e?n:e)&&("number"==typeof t||k.test(t))&&t>-1&&t%1==0&&t<e}function Dt(t){if(null!=t){try{return V.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function jt(t,e){return t===e||t!=t&&e!=e}(ot&&Ft(new ot(new ArrayBuffer(1)))!=x||st&&Ft(new st)!=c||rt&&Ft(rt.resolve())!=f||at&&Ft(new at)!=m||lt&&Ft(new lt)!=w)&&(Ft=function(t){var e=Mt(t),i=e==d?t.constructor:void 0,n=i?Dt(i):"";if(n)switch(n){case ct:return x;case ut:return c;case dt:return f;case ft:return m;case pt:return w}return e});var Lt=zt(function(){return arguments}())?zt:function(t){return Vt(t)&&G.call(t,"callee")&&!Y.call(t,"callee")},Rt=Array.isArray;var Nt=it||function(){return!1};function Bt(t){if(!qt(t))return!1;var e=Mt(t);return e==h||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ut(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}function qt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Vt(t){return null!=t&&"object"==typeof t}var Gt=$?function(t){return function(e){return t(e)}}($):function(t){return Vt(t)&&Ut(t.length)&&!!M[Mt(t)]};function Zt(t){return null!=(e=t)&&Ut(e.length)&&!Bt(e)?_t(t):Et(t);var e}t.exports=function(t,e){return St(t,e)}}(pe,pe.exports);var me=e(pe.exports);function ge(t,e){return t.length===e.length&&JSON.stringify(t.map((function(t){return t})).sort())===JSON.stringify(e.map((function(t){return t})).sort())}var be={Polygon:B,LineString:N,Point:R,MultiPolygon:V,MultiLineString:V,MultiPoint:V};var ve=Object.freeze({__proto__:null,CommonSelectors:mt,constrainFeatureMovement:Qt,createMidPoint:xt,createSupplementaryPoints:_t,createVertex:yt,doubleClickZoom:kt,euclideanDistance:P,featuresAt:A,getFeatureAtAndSetCursors:T,isClick:$,isEventAtCoordinates:re,isTap:F,mapEventToBoundingBox:S,ModeHandler:t,moveFeatures:te,sortFeatures:z,stringSetsAreEqual:ge,StringSet:C,theme:ot,toDenseArray:X}),we=function(t,e){var i={options:t=function(t){void 0===t&&(t={});var e=et(t);return t.controls||(e.controls={}),!1===t.displayControlsDefault?e.controls=et(de,t.controls):e.controls=et(ue,t.controls),(e=et(ce,e)).styles=fe(e.styles,"cold").concat(fe(e.styles,"hot")),e}(t)};e=function(t,e){return e.modes=p,e.getFeatureIdsAt=function(e){return A.click({point:e},null,t).map((function(t){return t.properties.id}))},e.getSelectedIds=function(){return t.store.getSelectedIds()},e.getSelected=function(){return{type:f.FEATURE_COLLECTION,features:t.store.getSelectedIds().map((function(e){return t.store.get(e)})).map((function(t){return t.toGeoJSON()}))}},e.getSelectedPoints=function(){return{type:f.FEATURE_COLLECTION,features:t.store.getSelectedCoordinates().map((function(t){return{type:f.FEATURE,properties:{},geometry:{type:f.POINT,coordinates:t.coordinates}}}))}},e.set=function(i){if(void 0===i.type||i.type!==f.FEATURE_COLLECTION||!Array.isArray(i.features))throw new Error("Invalid FeatureCollection");var n=t.store.createRenderBatch(),o=t.store.getAllIds().slice(),s=e.add(i),r=new C(s);return(o=o.filter((function(t){return!r.has(t)}))).length&&e.delete(o),n(),s},e.add=function(e){var i=JSON.parse(JSON.stringify(Ct(e))).features.map((function(e){if(e.id=e.id||j(),null===e.geometry)throw new Error("Invalid geometry: null");if(void 0===t.store.get(e.id)||t.store.get(e.id).type!==e.geometry.type){var i=be[e.geometry.type];if(void 0===i)throw new Error("Invalid geometry type: "+e.geometry.type+".");var n=new i(t,e);t.store.add(n)}else{var o=t.store.get(e.id);o.properties=e.properties,me(o.getCoordinates(),e.geometry.coordinates)||o.incomingCoords(e.geometry.coordinates)}return e.id}));return t.store.render(),i},e.get=function(e){var i=t.store.get(e);if(i)return i.toGeoJSON()},e.getAll=function(){return{type:f.FEATURE_COLLECTION,features:t.store.getAll().map((function(t){return t.toGeoJSON()}))}},e.delete=function(i){return t.store.delete(i,{silent:!0}),e.getMode()!==p.DIRECT_SELECT||t.store.getSelectedIds().length?t.store.render():t.events.changeMode(p.SIMPLE_SELECT,void 0,{silent:!0}),e},e.deleteAll=function(){return t.store.delete(t.store.getAllIds(),{silent:!0}),e.getMode()===p.DIRECT_SELECT?t.events.changeMode(p.SIMPLE_SELECT,void 0,{silent:!0}):t.store.render(),e},e.changeMode=function(i,n){return void 0===n&&(n={}),i===p.SIMPLE_SELECT&&e.getMode()===p.SIMPLE_SELECT?(ge(n.featureIds||[],t.store.getSelectedIds())||(t.store.setSelected(n.featureIds,{silent:!0}),t.store.render()),e):(i===p.DIRECT_SELECT&&e.getMode()===p.DIRECT_SELECT&&n.featureId===t.store.getSelectedIds()[0]||t.events.changeMode(i,n,{silent:!0}),e)},e.getMode=function(){return t.events.getMode()},e.trash=function(){return t.events.trash({silent:!0}),e},e.combineFeatures=function(){return t.events.combineFeatures({silent:!0}),e},e.uncombineFeatures=function(){return t.events.uncombineFeatures({silent:!0}),e},e.setFeatureProperty=function(i,n,o){return t.store.setFeatureProperty(i,n,o),e},e}(i,e),i.api=e;var n=nt(i);return e.onAdd=n.onAdd,e.onRemove=n.onRemove,e.types=d,e.options=t,e};function ye(t){we(t,this)}return ye.modes=he,ye.constants=_,ye.lib=ve,ye}))}));const Vt=w(qt);const Gt="gl-map{display:block;height:100%;width:100%}";Vt.constants.classes.CONTROL_BASE="maplibregl-ctrl";Vt.constants.classes.CONTROL_PREFIX="maplibregl-ctrl-";Vt.constants.classes.CONTROL_GROUP="maplibregl-ctrl-group";Vt.constants.classes.ATTRIBUTION="maplibregl-ctrl-attrib";const Zt=class{constructor(e){t(this,e);this.glDrawCreate=s(this,"glDrawCreate",7);this.glDrawDelete=s(this,"glDrawDelete",7);this.glDrawEnter=s(this,"glDrawEnter",7);this.glDrawExit=s(this,"glDrawExit",7);this.glStyleUpdated=s(this,"glStyleUpdated",7);this.glClickedFeaturesGathered=s(this,"glClickedFeaturesGathered",7);this._features=[];this.draw=undefined;this.drawOptions=undefined;this.drawing=false;this.glyphs=undefined;this.hash=false;this.latitude=undefined;this.longitude=undefined;this.zoom=10;this.minzoom=0;this.maxzoom=22;this.sprite=undefined;this.map=undefined;this.clickMode="top-layer";this.clickEventDelay=100}componentWillLoad(){this._style=this.loadStyle();this.map=new Ut.Map({container:this.el,center:[this.longitude,this.latitude],hash:this.hash==="true"?true:this.hash,zoom:this.zoom,minZoom:this.minzoom,maxZoom:this.maxzoom,style:this._style});window.addEventListener("resize",this.resizeMap.bind(this));this.map.on("draw.create",(t=>this.glDrawCreate.emit({mapId:this.el.id,features:t.features})));this.map.on("draw.delete",(t=>this.glDrawDelete.emit({mapId:this.el.id,features:t.features})))}componentDidUpdate(){this.resizeMap()}async updateStyle(){if(this._updateStyleTimeout==undefined){this._updateStyleTimeout=window.setTimeout((async()=>{this._updateStyleTimeout=null;this._style=await this.loadStyle();this.map.setStyle(this._style);this.glStyleUpdated.emit(this._style)}),66)}}handleFeatureClick(t){let e=t.detail.features;if(e.length===0)return;Array.prototype.push.apply(this._features,e);if(this.clickEventDelay!=undefined&&this.clickEventDelay!==0){if(this._clickEventTimeout==undefined){this._clickEventTimeout=window.setTimeout((async()=>{this._clickEventTimeout=null;if(this._features.length!==0){this.glClickedFeaturesGathered.emit({features:this.filterFeatureClicks(this._features)})}this._features=[]}),this.clickEventDelay)}}else{this.glClickedFeaturesGathered.emit({features:this.filterFeatureClicks(this._features)})}}async handleStyleAdded(){this.updateStyle()}async handleStyleModified(){this.updateStyle()}async handleStyleRemoved(){this.updateStyle()}async updateDrawing(){if(this.drawing){this.draw=new Vt(this.drawOptions);this.map.addControl(this.draw);this.glDrawEnter.emit({mapId:this.el.id})}else{this.map.removeControl(this.draw);this.draw=null;this.glDrawExit.emit({mapId:this.el.id})}}async resizeMap(){if(this._resizeMapTimeout==undefined){this._resizeMapTimeout=window.setTimeout((async()=>{this._resizeMapTimeout=null;if(this.map!=undefined)this.map.resize()}),66)}}getStyleLayers(t,e){if(e.layers==undefined)return[];let i=[];for(let n of e.layers){let e=Object.assign(Object.assign({},n),{id:this.prefix(t,n.id)});if("source"in n&&n.source!=undefined&&typeof n.source==="string")e["source"]=this.prefix(t,n.source);i.push(e)}return i}getStyleSources(t,e){if(e.sources==undefined)return[];let i={};for(let n in e.sources)i[this.prefix(t,n)]=e.sources[n];return i}loadStyle(){let t={version:8,metadata:{},sources:{},layers:[]};if(this.glyphs!=undefined)t.glyphs=this.glyphs;if(this.sprite!=undefined)t.sprite=this.sprite;Array.from(this.el.querySelectorAll("gl-style")).forEach((e=>{if(!e.enabled)return;let i=e.id;let n=e.json;if(n==undefined)return;let o=this.getStyleLayers(i,n);if(e.insertIntoStyle!=undefined&&e.insertBeneathLayer!=undefined){const i=t.layers.map((t=>t.id)).indexOf(`${e.insertIntoStyle}:${e.insertBeneathLayer}`);t.layers.splice(i,0,...o)}else{t.layers=o.concat(t.layers)}t.sources=Object.assign(Object.assign({},t.sources),this.getStyleSources(i,n));if(n.glyphs&&t.glyphs==undefined)t.glyphs=n.glyphs;if(n.sprite&&t.sprite==undefined)t.sprite=n.sprite}));if(t.glyphs!=undefined)t.glyphs=f(t.glyphs).replace("%7Bfontstack%7D","{fontstack}").replace("%7Brange%7D","{range}");if(t.sprite!=undefined){if(typeof t.sprite==="string"){t.sprite=f(t.sprite)}else if(t.sprite.length!==0){t.sprite.forEach((t=>{t.url=f(t.url)}))}}return t}prefix(t,e){return`${t}:${e}`}filterTopLayer(t){let e=t[t.length-1].layer.id;return t.filter((t=>t.layer.id===e))}filterTopFeature(t){return[t[t.length-1]]}filterFeatureClicks(t){switch(this.clickMode){case"all":return t;case"top-feature":return this.filterTopFeature(t);case"top-layer":return this.filterTopLayer(t);default:throw new Error("Popup filtering error")}}get el(){return n(this)}static get watchers(){return{drawing:["updateDrawing"]}}};Zt.style=Gt;var Wt=6371008.8;var Jt={centimeters:Wt*100,centimetres:Wt*100,degrees:Wt/111325,feet:Wt*3.28084,inches:Wt*39.37,kilometers:Wt/1e3,kilometres:Wt/1e3,meters:Wt,metres:Wt,miles:Wt/1609.344,millimeters:Wt*1e3,millimetres:Wt*1e3,nauticalmiles:Wt/1852,radians:1,yards:Wt*1.0936};function Xt(t,e,i){if(i===void 0){i={}}var n={type:"Feature"};if(i.id===0||i.id){n.id=i.id}if(i.bbox){n.bbox=i.bbox}n.properties=e||{};n.geometry=t;return n}function Ht(t,e,i){if(i===void 0){i={}}if(!t){throw new Error("coordinates is required")}if(!Array.isArray(t)){throw new Error("coordinates must be an Array")}if(t.length<2){throw new Error("coordinates must be at least 2 numbers long")}if(!te(t[0])||!te(t[1])){throw new Error("coordinates must contain numbers")}var n={type:"Point",coordinates:t};return Xt(n,e,i)}function Kt(t,e){if(e===void 0){e={}}var i={type:"FeatureCollection"};if(e.id){i.id=e.id}if(e.bbox){i.bbox=e.bbox}i.features=t;return i}function Yt(t,e){if(e===void 0){e="kilometers"}var i=Jt[e];if(!i){throw new Error(e+" units is invalid")}return t*i}function Qt(t){var e=t%360;return e*Math.PI/180}function te(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function ee(t,e,i){if(t===null)return;var n,o,s,r,a,l,h,c=0,u=0,d,f=t.type,p=f==="FeatureCollection",m=f==="Feature",g=p?t.features.length:1;for(var b=0;b<g;b++){h=p?t.features[b].geometry:m?t.geometry:t;d=h?h.type==="GeometryCollection":false;a=d?h.geometries.length:1;for(var v=0;v<a;v++){var w=0;var y=0;r=d?h.geometries[v]:h;if(r===null)continue;l=r.coordinates;var x=r.type;c=i&&(x==="Polygon"||x==="MultiPolygon")?1:0;switch(x){case null:break;case"Point":if(e(l,u,b,w,y)===false)return false;u++;w++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(e(l[n],u,b,w,y)===false)return false;u++;if(x==="MultiPoint")w++}if(x==="LineString")w++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(o=0;o<l[n].length-c;o++){if(e(l[n][o],u,b,w,y)===false)return false;u++}if(x==="MultiLineString")w++;if(x==="Polygon")y++}if(x==="Polygon")w++;break;case"MultiPolygon":for(n=0;n<l.length;n++){y=0;for(o=0;o<l[n].length;o++){for(s=0;s<l[n][o].length-c;s++){if(e(l[n][o][s],u,b,w,y)===false)return false;u++}y++}w++}break;case"GeometryCollection":for(n=0;n<r.geometries.length;n++)if(ee(r.geometries[n],e,i)===false)return false;break;default:throw new Error("Unknown Geometry Type")}}}}function ie(t,e){if(t.type==="Feature"){e(t,0)}else if(t.type==="FeatureCollection"){for(var i=0;i<t.features.length;i++){if(e(t.features[i],i)===false)break}}}function ne(t){var e=[];if(t.type==="FeatureCollection"){ie(t,(function(t){ee(t,(function(i){e.push(Ht(i,t.properties))}))}))}else{ee(t,(function(i){e.push(Ht(i,t.properties))}))}return Kt(e)}function oe(t){var e=[Infinity,Infinity,-Infinity,-Infinity];ee(t,(function(t){if(e[0]>t[0]){e[0]=t[0]}if(e[1]>t[1]){e[1]=t[1]}if(e[2]<t[0]){e[2]=t[0]}if(e[3]<t[1]){e[3]=t[1]}}));return e}oe["default"]=oe;function se(t,e){if(e===void 0){e={}}var i=oe(t);var n=(i[0]+i[2])/2;var o=(i[1]+i[3])/2;return Ht([n,o],e.properties,e)}function re(t){if(!t){throw new Error("geojson is required")}switch(t.type){case"Feature":return ae(t);case"FeatureCollection":return he(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return ce(t);default:throw new Error("unknown GeoJSON type")}}function ae(t){var e={type:"Feature"};Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}}));e.properties=le(t.properties);e.geometry=ce(t.geometry);return e}function le(t){var e={};if(!t){return e}Object.keys(t).forEach((function(i){var n=t[i];if(typeof n==="object"){if(n===null){e[i]=null}else if(Array.isArray(n)){e[i]=n.map((function(t){return t}))}else{e[i]=le(n)}}else{e[i]=n}}));return e}function he(t){var e={type:"FeatureCollection"};Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}}));e.features=t.features.map((function(t){return ae(t)}));return e}function ce(t){var e={type:t.type};if(t.bbox){e.bbox=t.bbox}if(t.type==="GeometryCollection"){e.geometries=t.geometries.map((function(t){return ce(t)}));return e}e.coordinates=ue(t.coordinates);return e}function ue(t){var e=t;if(typeof e[0]!=="object"){return e.slice()}return e.map((function(t){return ue(t)}))}function de(t){if(!t){throw new Error("coord is required")}if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point"){return t.geometry.coordinates}if(t.type==="Point"){return t.coordinates}}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1])){return t}throw new Error("coord must be GeoJSON Point or an Array of numbers")}function fe(t){if(t.type==="Feature"){return t.geometry}return t}function pe(t,e,i){if(i===void 0){i={}}var n=de(t);var o=de(e);var s=Qt(o[1]-n[1]);var r=Qt(o[0]-n[0]);var a=Qt(n[1]);var l=Qt(o[1]);var h=Math.pow(Math.sin(s/2),2)+Math.pow(Math.sin(r/2),2)*Math.cos(a)*Math.cos(l);return Yt(2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)),i.units)}function me(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var i;var n=Infinity;var o=0;ie(e,(function(e,i){var s=pe(t,e);if(s<n){o=i;n=s}}));i=re(e.features[o]);i.properties.featureIndex=o;i.properties.distanceToPoint=n;return i}function ge(t,e,i){if(i===void 0){i={}}if(!t){throw new Error("point is required")}if(!e){throw new Error("polygon is required")}var n=de(t);var o=fe(e);var s=o.type;var r=e.bbox;var a=o.coordinates;if(r&&ve(n,r)===false){return false}if(s==="Polygon"){a=[a]}var l=false;for(var h=0;h<a.length&&!l;h++){if(be(n,a[h][0],i.ignoreBoundary)){var c=false;var u=1;while(u<a[h].length&&!c){if(be(n,a[h][u],!i.ignoreBoundary)){c=true}u++}if(!c){l=true}}}return l}function be(t,e,i){var n=false;if(e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]){e=e.slice(0,e.length-1)}for(var o=0,s=e.length-1;o<e.length;s=o++){var r=e[o][0];var a=e[o][1];var l=e[s][0];var h=e[s][1];var c=t[1]*(r-l)+a*(l-t[0])+h*(t[0]-r)===0&&(r-t[0])*(l-t[0])<=0&&(a-t[1])*(h-t[1])<=0;if(c){return!i}var u=a>t[1]!==h>t[1]&&t[0]<(l-r)*(t[1]-a)/(h-a)+r;if(u){n=!n}}return n}function ve(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}function we(t){var e=ye(t);var i=se(e);var n=false;var o=0;while(!n&&o<e.features.length){var s=e.features[o].geometry;var r,a,l,h,c,u,d;var f=false;if(s.type==="Point"){if(i.geometry.coordinates[0]===s.coordinates[0]&&i.geometry.coordinates[1]===s.coordinates[1]){n=true}}else if(s.type==="MultiPoint"){var p=false;d=0;while(!p&&d<s.coordinates.length){if(i.geometry.coordinates[0]===s.coordinates[d][0]&&i.geometry.coordinates[1]===s.coordinates[d][1]){n=true;p=true}d++}}else if(s.type==="LineString"){d=0;while(!f&&d<s.coordinates.length-1){r=i.geometry.coordinates[0];a=i.geometry.coordinates[1];l=s.coordinates[d][0];h=s.coordinates[d][1];c=s.coordinates[d+1][0];u=s.coordinates[d+1][1];if(xe(r,a,l,h,c,u)){f=true;n=true}d++}}else if(s.type==="MultiLineString"){var m=0;while(m<s.coordinates.length){f=false;d=0;var g=s.coordinates[m];while(!f&&d<g.length-1){r=i.geometry.coordinates[0];a=i.geometry.coordinates[1];l=g[d][0];h=g[d][1];c=g[d+1][0];u=g[d+1][1];if(xe(r,a,l,h,c,u)){f=true;n=true}d++}m++}}else if(s.type==="Polygon"||s.type==="MultiPolygon"){if(ge(i,s)){n=true}}o++}if(n){return i}else{var b=Kt([]);for(o=0;o<e.features.length;o++){b.features=b.features.concat(ne(e.features[o]).features)}return Ht(me(i,b).geometry.coordinates)}}function ye(t){if(t.type!=="FeatureCollection"){if(t.type!=="Feature"){return Kt([Xt(t)])}return Kt([t])}return t}function xe(t,e,i,n,o,s){var r=Math.sqrt((o-i)*(o-i)+(s-n)*(s-n));var a=Math.sqrt((t-i)*(t-i)+(e-n)*(e-n));var l=Math.sqrt((o-t)*(o-t)+(s-e)*(s-e));return r===a+l}const _e="gl-popup{display:none}gl-map .mapboxgl-popup-content h2{font-size:1.3em}";const ke=[];const Me=class{constructor(e){t(this,e);this.clickEventDelay=50;this.closeKey="Escape";this.closeMode="self";this.component=undefined;this.componentOptions=undefined;this.layers=undefined;this.maxWidth="none"}componentWillLoad(){this.parseLayersString()}getOptions(){if(typeof this.componentOptions==="string"){return JSON.parse(this.componentOptions)}return this.componentOptions||{}}doOpenPopup(t){let e=t.detail.features.filter((t=>{let[e,i]=t.layer.id.split(":");return this._layers.indexOf(i)!=-1&&this.el.closest("gl-style").id===e}));if(e.length)this.openPopup(e)}handleKeyup(t){if(t.key===this.closeKey)this.removePopup()}async isOpen(){return this.popup!=undefined?this.popup.isOpen():false}async removePopup(){if(this.popup!=undefined){this.popup.remove();let t=ke.indexOf(this.popup);if(t>-1)ke.splice(t,1);this.popup=null}}removeAll(){while(ke.length>0)ke.pop().remove();this.popup=null}async openPopup(t){let e=Kt(t);let i=we(e);let n=document.createElement(this.component);n["features"]=t;let o=this.getOptions();for(let t in this.getOptions())n[t]=o[t];if(this.closeMode==="self")await this.removePopup();if(this.closeMode==="all")this.removeAll();this.popup=new Bt.Popup({maxWidth:this.maxWidth}).setLngLat(i.geometry.coordinates).setDOMContent(n).addTo(this.el.closest("gl-map").map);ke.push(this.popup)}parseLayersString(){if(typeof this.layers==="string"){this._layers=d(this.layers)}else{this._layers=this.layers}}get el(){return n(this)}static get watchers(){return{layers:["parseLayersString"]}}};Me.style=_e;const ze=class{constructor(e){t(this,e);this.popupHeight=480;this.popupWidth=640;this.shareTitle=undefined;this.shareUser=undefined;this.shareHashtags=undefined;this.shareUrl=undefined}constructShareUrl(t,e){let i=t;let n=Object.keys(e||{}).filter((t=>e[t]!=undefined)).map((t=>`${t}=${encodeURIComponent(e[t])}`)).join("&");if(n!=null)i+=`?${n}`;return i}share(t){let e=this.shareUrl||window.location.href;let i=this.shareTitle;if(i==undefined){let t=this.el.closest("gl-app");if(t!=undefined)i=t.label}let n;if(t==="twitter"){n=this.constructShareUrl("https://twitter.com/intent/tweet",{url:e,title:i,via:this.shareUser,hashtags:this.shareHashtags})}else{n=this.constructShareUrl("https://www.facebook.com/sharer.php",{u:e})}this.openUrl(n);this.closePopover()}openUrl(t){window.open(t,"gl-share",`width=${this.popupWidth},height=${this.popupHeight},`+`resizable,scrollbars=yes`)}closePopover(){let t=this.el.closest("ion-popover");if(t!=undefined)t.dismiss()}clickShare(t){return()=>this.share(t.toLocaleLowerCase())}render(){let t=["Facebook","Twitter"].map((t=>e("ion-item",{button:true,onClick:this.clickShare(t),"aria-label":"Share Button"},e("ion-icon",{slot:"start",name:`logo-${t.toLowerCase()}`,"aria-hidden":"true"}),e("ion-label",null,t))));return e("ion-list",null,e("ion-list-header",null,h("webmapgl.share.title")),t)}get el(){return n(this)}};const Se=class{constructor(e){t(this,e);this.clickOpen=async t=>await this.openPopover(t);this.icon="share-social"}async openPopover(t){const e={component:document.createElement("gl-share"),ev:t};const i=await p.create(e);await i.present();return i}render(){return e("ion-button",{title:h("webmapgl.share-button.title"),"aria-label":h("webmapgl.share-button.title"),onClick:this.clickOpen},e("ion-icon",{slot:"icon-only",name:this.icon,"aria-hidden":"true"}))}};const Ce=class{constructor(e){t(this,e);this.glStoryChange=s(this,"glStoryChange",7);this.step=undefined;this.steps=undefined}componentWillLoad(){this.updateSteps()}updateSteps(){const t=this.el.querySelectorAll("gl-story-step");this.steps=t.length;Array.from(t).forEach(((e,i)=>{e.active=i===this.step;e.first=i===0;e.last=i===t.length-1}));this.glStoryChange.emit(this)}render(){return e("slot",null)}get el(){return n(this)}static get watchers(){return{step:["updateSteps"]}}};const Ee=class{constructor(e){t(this,e);this.clickAction=()=>this.doAction();this.story=undefined;this.disabled=false;this.action="next";this.icon=undefined;this.label=undefined;this.storyId=undefined}async componentWillLoad(){await this.updateStory()}async updateStory(){this.story=document.querySelector(this.storyId!=undefined?`gl-story#${this.storyId}`:"gl-story");await this.story.componentOnReady();this.updateDisabled()}updateDisabled(){const t=this.story;if(t==undefined)return;this.disabled={first:t.step===0,last:t.step===t.steps-1,next:t.step==undefined||t.step===t.steps-1,previous:t.step==undefined||t.step===0,exit:false}[this.action]}doAction(){const t=this.story;if(t==undefined)return;t.step={first:0,last:t.steps-1,next:t.step+1,previous:t.step-1,exit:undefined}[this.action]}render(){let t=h(`webmapgl.story-button.${this.action}`);let i=this.icon||{first:"play-skip-back-outline",last:"play-skip-forward-outline",next:"play-forward-outline",previous:"play-back-outline",exit:"close-outline"}[this.action];return e("ion-button",{onClick:this.clickAction,title:t,disabled:this.disabled,"aria-label":t},e("ion-icon",{slot:"icon-only",name:i,"aria-hidden":"true"}))}static get watchers(){return{storyId:["updateStory"]}}};const Ae=class{constructor(e){t(this,e);this.glFeatureClick=s(this,"glFeatureClick",7);this._didClick=false;this.active=false;this.first=false;this.last=false;this.hash=undefined;this.clickBeforeHash=false;this.clickAfterIdle=true;this.clickDelay=0;this.clickLayer=undefined;this.clickProperty=undefined;this.clickValue=undefined;this.mapId=undefined}activeChanged(){if(this.active)this.activate()}activate(){let t=document.querySelector(this.mapId!=undefined?`gl-map#${this.mapId}`:"gl-map");if(t==undefined||t.map==undefined)return;this._didClick=false;let e=()=>this.scheduleClick(t.map);if(this.clickBeforeHash)e();if(this.hash!=undefined){if(this.clickAfterIdle)t.map.once("idle",e);window.location.hash=this.hash[0]==="#"?this.hash:`#${this.hash}`}}scheduleClick(t){if(this._didClick||this.clickLayer==undefined||this.clickValue==undefined)return;setTimeout((()=>this.fireClickEvent(t)),this.clickDelay)}fireClickEvent(t){if(this._didClick)return;let e=this.clickProperty!=undefined?["get",this.clickProperty]:["id"];let i=t.queryRenderedFeatures(undefined,{layers:[this.clickLayer],filter:["==",e,this.clickValue]});if(i.length!==0){this.glFeatureClick.emit({features:i});this._didClick=true}}render(){return e(i,{style:{display:this.active?"block":"none"}},e("slot",null))}get el(){return n(this)}static get watchers(){return{active:["activeChanged"]}}};let Ie=0;const Te=class{constructor(e){t(this,e);this.glFeatureClick=s(this,"glFeatureClick",7);this.glStyleElementAdded=s(this,"glStyleElementAdded",7);this.glStyleElementModified=s(this,"glStyleElementModified",7);this.glStyleElementRemoved=s(this,"glStyleElementRemoved",7);this.handlers={click:t=>this.handleClick(t),mouseenter:()=>this.handleMouseenter(),mouseleave:()=>this.handleMouseleave()};this.basemap=false;this.clickableLayers=[];this.enabled=true;this.name=undefined;this.thumbnail=undefined;this.token=undefined;this.url=undefined;this.json={version:8,sources:undefined,layers:undefined};this.insertIntoStyle=undefined;this.insertBeneathLayer=undefined}componentWillLoad(){if(this.el.id==undefined){this.el.id="style-"+Ie.toString();Ie+=1}if(this.url!=undefined)this.fetchJSON()}componentDidLoad(){if(this.clickableLayers!=undefined&&this.clickableLayers.length!==0)this.updateClickable(this.clickableLayers);this.glStyleElementAdded.emit(this.eventDetail())}componentDidUpdate(){this.glStyleElementModified.emit(this.eventDetail())}disconnectedCallback(){this.glStyleElementRemoved.emit(this.eventDetail())}eventDetail(){return{id:this.el.id,style:this}}getMap(){return this.el.closest("gl-map").map}async fetchJSON(){let t=await fetch(this.url);this.json=await t.json();if(this.token&&this.json.sources!=undefined){for(let t in this.json.sources){let e=this.json.sources[t];if(e.data!=undefined)e.data=e.data.replace(/\$\{TOKEN\}/g,this.token)}}}updateClickable(t,e){const i=this.getMap();t=d(t);e=d(e);for(let n of t){const t=e.indexOf(n);if(t===-1){let t=`${this.el.id}:${n}`;i.on("click",t,this.handlers.click);i.on("mouseenter",t,this.handlers.mouseenter);i.on("mouseleave",t,this.handlers.mouseleave)}else{e.splice(t,1)}}for(let t of e){let e=`${this.el.id}:${t}`;i.off("click",e,this.handlers.click);i.off("mouseenter",e,this.handlers.mouseenter);i.off("mouseleave",e,this.handlers.mouseleave)}}handleClick(t){this.glFeatureClick.emit({features:t.features})}handleMouseenter(){this.getMap().getCanvas().style.cursor="pointer"}handleMouseleave(){this.getMap().getCanvas().style.cursor=""}get el(){return n(this)}static get watchers(){return{clickableLayers:["updateClickable"]}}};const Pe="gl-table table{border-collapse:collapse;border-spacing:0;margin:0 0 10px 0;width:100%}gl-table thead{background-color:#eeeeee}gl-table th,gl-table td{border:1px solid #dddddd;line-height:1.3;padding:8px 10px}gl-table th:first-child,gl-table td:first-child{border-left:0 none transparent}gl-table th:last-child,gl-table td:last-child{border-right:0 none transparent}gl-table thead th{font-weight:bold}gl-table thead th.sortable{cursor:pointer;padding-right:27px;position:relative}gl-table thead th.sortable::before,gl-table thead th.sortable::after{color:#cccccc;content:'\\25B2';font-size:0.7em;margin-top:-1.1em;position:absolute;right:10px;top:50%}gl-table thead th.sortable::after{bottom:50%;content:'\\25BC';margin-bottom:-1.1em;margin-top:0;top:auto}gl-table thead th.sorted-asc::before{color:var(--ion-color-primary, #3880ff)}gl-table thead th.sorted-asc::after{content:''}gl-table thead th.sorted-desc::before{content:''}gl-table thead th.sorted-desc::after{color:var(--ion-color-primary, #3880ff)}";let $e=0;const Fe=class{constructor(e){t(this,e);this.glTableSort=s(this,"glTableSort",7);this.columns=[];this.disableDefaultSort=false;this.features=[];this.rowClassAttribute=undefined;this.sortAttribute=undefined;this.sortOrder="asc"}componentWillLoad(){if(this.el.id==undefined){this.el.id="table-"+$e.toString();$e+=1}this.updateColumns()}updateColumns(){this.columns=Array.from(this.el.querySelectorAll("gl-table-column"))}setSort(t){if(t.attribute===this.sortAttribute){this.sortOrder=this.sortOrder==="asc"?"desc":"asc"}else{this.sortAttribute=t.attribute;this.sortOrder="asc"}this.glTableSort.emit({tableId:this.el.id,attribute:this.sortAttribute,order:this.sortOrder})}async getSortedFeatures(){return this.sortedFeatures()}sortedFeatures(){if(this.disableDefaultSort)return this.features;let t=[...this.features];t.sort(((t,e)=>{let i=t.properties[this.sortAttribute];let n=e.properties[this.sortAttribute];if(typeof i==="string")i=i.toUpperCase();if(typeof n==="string")n=n.toUpperCase();let o=0;if(i>n)o=1;else if(i<n)o=-1;return this.sortOrder==="desc"?o*-1:o}));return t}renderHeader(t){let i={};if(t.sortable){i={class:"sortable sorted-none",tabindex:0,"aria-controls":this.el.id,"aria-label":`${t.label}: `+h(`webmapgl.table.header.sort-action.desc`),onClick:()=>this.setSort(t)};if(t.attribute===this.sortAttribute){i["class"]=`sortable sorted-${this.sortOrder}`;i["aria-sort"]=this.sortOrder==="asc"?"ascending":"descending";i["aria-label"]=`${t.label}: `+h(`webmapgl.table.header.sort-action.${this.sortOrder}`)}}return e("th",Object.assign({},i),t.label)}async getCellContents(t,e,i){let n=t.properties[e.attribute];if(e.component==undefined)return this.renderValue(e,n);return await this.renderComponentAsText(t,e,n,i)}renderValue(t,e){if(e==undefined)return null;if(t.format)e=e.toLocaleString({},t.format);return e.toString()}renderComponentJSX(t,i,n){let o=i.component;let s=i.componentProps||{};return e(o,Object.assign({feature:t,column:i,value:n},s))}async renderComponentAsText(t,e,i,n){let o=document.createElement(e.component);let s=e.componentProps||{};for(let t in s)o[t]=s[t];o.feature=t;o.column=e;o.value=i;o.style.display="none";this.el.appendChild(o);await o.componentOnReady();let r=typeof o.formatValue==="function"?o.formatValue(n):o.textContent;this.el.removeChild(o);return r}renderCell(t,i){let n=t.properties[i.attribute];let o=i.cellClassAttribute!=undefined?t.properties[i.cellClassAttribute]:"cell";return e("td",{class:o},i.component!=undefined?this.renderComponentJSX(t,i,n):this.renderValue(i,n))}renderRow(t,i){let n=this.rowClassAttribute!=undefined?t.properties[this.rowClassAttribute]:"row";return e("tr",{class:n},i.map((e=>this.renderCell(t,e))))}render(){if(this.columns.length===0)return null;let t=this.sortedFeatures();let i=this.columns.filter((t=>t.visible));let n=i.map((t=>this.renderHeader(t)));let o=t.map((t=>this.renderRow(t,i)));return e("table",{id:this.el.id},e("thead",null,e("tr",null,n)),e("tbody",null,o))}get el(){return n(this)}};Fe.style=Pe;const Oe=class{constructor(e){t(this,e);this.glTableColumnChanged=s(this,"glTableColumnChanged",7);this.attribute=undefined;this.cellClassAttribute=undefined;this.component=undefined;this.componentProps=undefined;this.csv=true;this.format=undefined;this.label=undefined;this.pdf=true;this.sortable=true;this.visible=true}componentWillLoad(){this.updateFormat()}componentDidLoad(){this.change()}componentDidUpdate(){this.change()}disconnectedCallback(){this.change()}updateFormat(){if(typeof this.format==="string"){let t;try{t=JSON.parse(this.format)}catch(e){if(/SyntaxError/.test(e)){if(["currency","decimal","percent"].indexOf(this.format)!==-1){t={style:this.format};if(this.format==="currency")t["currency"]="USD"}}else{throw e}}this.format=t}}change(){this.glTableColumnChanged.emit(this)}static get watchers(){return{format:["updateFormat"]}}};const De=class{constructor(e){t(this,e);this.closeClick=()=>this.closePopover();this.label=h("webmapgl.table-column-visibility.label");this.tableId=undefined}closePopover(){this.el.closest("ion-modal").dismiss()}createToggles(){let t=this.tableId!=undefined?`#${this.tableId}`:"";let i=`gl-table${t} gl-table-column`;return Array.from(document.querySelectorAll(i)).map((t=>e("gl-table-column-visibility-toggle",{column:t,enabled:t.visible})))}render(){return e(i,null,e("ion-header",null,e("ion-toolbar",null,e("ion-title",null,this.label),e("ion-buttons",{slot:"end"},e("ion-button",{title:h("webmapgl.table-column-visibility.close"),"aria-label":h("webmapgl.table-column-visibility.close"),onClick:this.closeClick},e("ion-icon",{slot:"icon-only",name:"close","aria-hidden":"true"}))))),e("ion-content",null,e("ion-list",null,this.createToggles())))}get el(){return n(this)}};const je=class{constructor(e){t(this,e);this.openClick=t=>this.openModal(t);this.label=h("webmapgl.table-column-visibility.label");this.tableId=undefined}async openModal(t){const e={component:document.createElement("gl-table-column-visibility"),componentOptions:{tableId:this.tableId},event:t};const i=await m.create(e);await i.present();return i}render(){return e("ion-button",{onClick:this.openClick,"aria-label":this.label},this.label)}};const Le=class{constructor(e){t(this,e);this.toggleChanged=t=>this.changeHandler(t);this.column=undefined;this.enabled=true}changeHandler(t){this.enabled=t.detail.checked;this.column.visible=this.enabled}render(){return e("ion-item",null,e("ion-label",null,this.column.label),e("ion-toggle",{value:"toggle",checked:this.enabled,onIonChange:this.toggleChanged}))}};const Re=class{constructor(e){t(this,e);this.buttonClicked=()=>this.clickHandler();this.author=undefined;this.filename=undefined;this.format="csv";this.pageOrientation=undefined;this.pageSubtitle=undefined;this.pageTitle=undefined;this.tableId=undefined;this.url=undefined;this.customButton=false;this.exportCtrl=undefined}async clickHandler(){if(this.exportCtrl==undefined){this.exportCtrl=await c("gl-table-export-controller")}this.exportCtrl.create(this)}render(){return e("ion-button",{onClick:this.buttonClicked,"aria-label":"Download File"},this.customButton?e("slot",null):this.format.toUpperCase())}};const Ne="html.plt-mobile ion-app{user-select:none}html.plt-mobile ion-app [contenteditable]{user-select:text}ion-app.force-statusbar-padding{--ion-safe-area-top:20px}";const Be=class{constructor(e){t(this,e)}componentDidLoad(){{qe((async()=>{const t=_(window,"hybrid");if(!x.getBoolean("_testing")){import("./p-d58d2b53.js").then((t=>t.startTapClick(x)))}if(x.getBoolean("statusTap",t)){import("./p-1f29729c.js").then((t=>t.startStatusTap()))}if(x.getBoolean("inputShims",Ue())){const t=_(window,"ios")?"ios":"android";import("./p-8704fc2c.js").then((e=>e.startInputShims(x,t)))}const e=await import("./p-94c84e79.js");if(x.getBoolean("hardwareBackButton",t)){e.startHardwareBackButton()}else{e.blockHardwareBackButton()}if(typeof window!=="undefined"){import("./p-5424a32a.js").then((t=>t.startKeyboardAssist(window)))}import("./p-38cdc9e5.js").then((t=>this.focusVisible=t.startFocusVisible()))}))}}async setFocus(t){if(this.focusVisible){this.focusVisible.setFocus(t)}}render(){const t=y(this);return e(i,{class:{[t]:true,"ion-page":true,"force-statusbar-padding":x.getBoolean("_forceStatusbarPadding")}})}get el(){return n(this)}};const Ue=()=>{const t=_(window,"ios")&&_(window,"mobile");if(t){return true}const e=_(window,"android")&&_(window,"mobileweb");if(e){return true}return false};const qe=t=>{if("requestIdleCallback"in window){window.requestIdleCallback(t)}else{setTimeout(t,32)}};Be.style=Ne;const Ve=":host{left:0;right:0;top:0;bottom:0;display:block;position:absolute;transform:translateZ(0);contain:strict;cursor:pointer;opacity:0.01;touch-action:none;z-index:2}:host(.backdrop-hide){background:transparent}:host(.backdrop-no-tappable){cursor:auto}:host{background-color:var(--ion-backdrop-color, #000)}";const Ge=":host{left:0;right:0;top:0;bottom:0;display:block;position:absolute;transform:translateZ(0);contain:strict;cursor:pointer;opacity:0.01;touch-action:none;z-index:2}:host(.backdrop-hide){background:transparent}:host(.backdrop-no-tappable){cursor:auto}:host{background-color:var(--ion-backdrop-color, #000)}";const Ze=class{constructor(e){t(this,e);this.ionBackdropTap=s(this,"ionBackdropTap",7);this.blocker=k.createBlocker({disableScroll:true});this.visible=true;this.tappable=true;this.stopPropagation=true}connectedCallback(){if(this.stopPropagation){this.blocker.block()}}disconnectedCallback(){this.blocker.unblock()}onMouseDown(t){this.emitTap(t)}emitTap(t){if(this.stopPropagation){t.preventDefault();t.stopPropagation()}if(this.tappable){this.ionBackdropTap.emit()}}render(){const t=y(this);return e(i,{tabindex:"-1","aria-hidden":"true",class:{[t]:true,"backdrop-hide":!this.visible,"backdrop-no-tappable":!this.tappable}})}};Ze.style={ios:Ve,md:Ge};const We=':host{--overflow:hidden;--ripple-color:currentColor;--border-width:initial;--border-color:initial;--border-style:initial;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--box-shadow:none;display:inline-block;width:auto;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;white-space:nowrap;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;font-kerning:none}:host(.button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.button-solid){--background:var(--ion-color-primary, #3880ff);--color:var(--ion-color-primary-contrast, #fff)}:host(.button-outline){--border-color:var(--ion-color-primary, #3880ff);--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-clear){--border-width:0;--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;width:100%;contain:content}:host(.button-full:not(.button-round)) .button-native{border-radius:0;border-right-width:0;border-left-width:0}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:flex;position:relative;align-items:center;width:100%;height:100%;min-height:inherit;transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);line-height:1;box-shadow:var(--box-shadow);contain:layout style;cursor:pointer;opacity:var(--opacity);overflow:var(--overflow);z-index:0;box-sizing:border-box;appearance:none}.button-native::-moz-focus-inner{border:0}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}::slotted([slot=start]),::slotted([slot=end]){flex-shrink:0}::slotted(ion-icon){font-size:1.35em;pointer-events:none}::slotted(ion-icon[slot=start]){-webkit-margin-start:-0.3em;margin-inline-start:-0.3em;-webkit-margin-end:0.3em;margin-inline-end:0.3em;margin-top:0;margin-bottom:0}::slotted(ion-icon[slot=end]){-webkit-margin-start:0.3em;margin-inline-start:0.3em;-webkit-margin-end:-0.2em;margin-inline-end:-0.2em;margin-top:0;margin-bottom:0}::slotted(ion-icon[slot=icon-only]){font-size:1.8em}ion-ripple-effect{color:var(--ripple-color)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:"";opacity:0}:host(.ion-focused){color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}@media (any-hover: hover){:host(:hover){color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.ion-activated){color:var(--color-activated)}:host(.ion-activated) .button-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.button-solid.ion-color) .button-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.button-outline.ion-color) .button-native{border-color:var(--ion-color-base);background:transparent;color:var(--ion-color-base)}:host(.button-clear.ion-color) .button-native{background:transparent;color:var(--ion-color-base)}:host(.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{color:var(--ion-toolbar-color, var(--color))}:host(.button-outline.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{border-color:var(--ion-toolbar-color, var(--color, var(--border-color)))}:host(.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-color, var(--background));color:var(--ion-toolbar-background, var(--color))}:host(.button-outline.ion-activated.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-color, var(--color));color:var(--ion-toolbar-background, var(--background), var(--ion-color-primary-contrast, #fff))}:host{--border-radius:14px;--padding-top:13px;--padding-bottom:13px;--padding-start:1em;--padding-end:1em;--transition:background-color, opacity 100ms linear;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:4px;margin-bottom:4px;min-height:3.1em;font-size:16px;font-weight:500;letter-spacing:0}:host(.in-buttons){font-size:17px;font-weight:400}:host(.button-solid){--background-activated:var(--ion-color-primary-shade, #3171e0);--background-focused:var(--ion-color-primary-shade, #3171e0);--background-hover:var(--ion-color-primary-tint, #4c8dff);--background-activated-opacity:1;--background-focused-opacity:1;--background-hover-opacity:1}:host(.button-outline){--border-radius:14px;--border-width:1px;--border-style:solid;--background-activated:var(--ion-color-primary, #3880ff);--background-focused:var(--ion-color-primary, #3880ff);--background-hover:transparent;--background-focused-opacity:.1;--color-activated:var(--ion-color-primary-contrast, #fff)}:host(.button-clear){--background-activated:transparent;--background-activated-opacity:0;--background-focused:var(--ion-color-primary, #3880ff);--background-hover:transparent;--background-focused-opacity:.1;font-size:17px;font-weight:normal}:host(.button-large){--border-radius:16px;--padding-top:17px;--padding-start:1em;--padding-end:1em;--padding-bottom:17px;min-height:3.1em;font-size:20px}:host(.button-small){--border-radius:6px;--padding-top:4px;--padding-start:0.9em;--padding-end:0.9em;--padding-bottom:4px;min-height:2.1em;font-size:13px}:host(.button-has-icon-only){--padding-top:0;--padding-bottom:0}:host(.button-round){--border-radius:64px;--padding-top:0;--padding-start:26px;--padding-end:26px;--padding-bottom:0}:host(.button-strong){font-weight:600}:host(.button-outline.ion-focused.ion-color) .button-native,:host(.button-clear.ion-focused.ion-color) .button-native{color:var(--ion-color-base)}:host(.button-outline.ion-focused.ion-color) .button-native::after,:host(.button-clear.ion-focused.ion-color) .button-native::after{background:var(--ion-color-base)}:host(.button-solid.ion-color.ion-focused) .button-native::after{background:var(--ion-color-shade)}@media (any-hover: hover){:host(.button-clear:not(.ion-activated):hover),:host(.button-outline:not(.ion-activated):hover){opacity:0.6}:host(.button-clear.ion-color:hover) .button-native,:host(.button-outline.ion-color:hover) .button-native{color:var(--ion-color-base)}:host(.button-clear.ion-color:hover) .button-native::after,:host(.button-outline.ion-color:hover) .button-native::after{background:transparent}:host(.button-solid.ion-color:hover) .button-native::after{background:var(--ion-color-tint)}:host(:hover.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color):not(.ion-activated)) .button-native::after{background:#fff;opacity:0.1}}:host(.button-clear.ion-activated){opacity:0.4}:host(.button-outline.ion-activated.ion-color) .button-native{color:var(--ion-color-contrast)}:host(.button-outline.ion-activated.ion-color) .button-native::after{background:var(--ion-color-base)}:host(.button-solid.ion-color.ion-activated) .button-native::after{background:var(--ion-color-shade)}';const Je=':host{--overflow:hidden;--ripple-color:currentColor;--border-width:initial;--border-color:initial;--border-style:initial;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--box-shadow:none;display:inline-block;width:auto;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;white-space:nowrap;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;font-kerning:none}:host(.button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.button-solid){--background:var(--ion-color-primary, #3880ff);--color:var(--ion-color-primary-contrast, #fff)}:host(.button-outline){--border-color:var(--ion-color-primary, #3880ff);--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-clear){--border-width:0;--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;width:100%;contain:content}:host(.button-full:not(.button-round)) .button-native{border-radius:0;border-right-width:0;border-left-width:0}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:flex;position:relative;align-items:center;width:100%;height:100%;min-height:inherit;transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);line-height:1;box-shadow:var(--box-shadow);contain:layout style;cursor:pointer;opacity:var(--opacity);overflow:var(--overflow);z-index:0;box-sizing:border-box;appearance:none}.button-native::-moz-focus-inner{border:0}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}::slotted([slot=start]),::slotted([slot=end]){flex-shrink:0}::slotted(ion-icon){font-size:1.35em;pointer-events:none}::slotted(ion-icon[slot=start]){-webkit-margin-start:-0.3em;margin-inline-start:-0.3em;-webkit-margin-end:0.3em;margin-inline-end:0.3em;margin-top:0;margin-bottom:0}::slotted(ion-icon[slot=end]){-webkit-margin-start:0.3em;margin-inline-start:0.3em;-webkit-margin-end:-0.2em;margin-inline-end:-0.2em;margin-top:0;margin-bottom:0}::slotted(ion-icon[slot=icon-only]){font-size:1.8em}ion-ripple-effect{color:var(--ripple-color)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:"";opacity:0}:host(.ion-focused){color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}@media (any-hover: hover){:host(:hover){color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.ion-activated){color:var(--color-activated)}:host(.ion-activated) .button-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.button-solid.ion-color) .button-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.button-outline.ion-color) .button-native{border-color:var(--ion-color-base);background:transparent;color:var(--ion-color-base)}:host(.button-clear.ion-color) .button-native{background:transparent;color:var(--ion-color-base)}:host(.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{color:var(--ion-toolbar-color, var(--color))}:host(.button-outline.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{border-color:var(--ion-toolbar-color, var(--color, var(--border-color)))}:host(.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-color, var(--background));color:var(--ion-toolbar-background, var(--color))}:host(.button-outline.ion-activated.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-color, var(--color));color:var(--ion-toolbar-background, var(--background), var(--ion-color-primary-contrast, #fff))}:host{--border-radius:4px;--padding-top:8px;--padding-bottom:8px;--padding-start:1.1em;--padding-end:1.1em;--transition:box-shadow 280ms cubic-bezier(.4, 0, .2, 1),\n background-color 15ms linear,\n color 15ms linear;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:4px;margin-bottom:4px;min-height:36px;font-size:14px;font-weight:500;letter-spacing:0.06em;text-transform:uppercase}:host(.button-solid){--background-activated:transparent;--background-hover:var(--ion-color-primary-contrast, #fff);--background-focused:var(--ion-color-primary-contrast, #fff);--background-activated-opacity:0;--background-focused-opacity:.24;--background-hover-opacity:.08;--box-shadow:0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)}:host(.button-solid.ion-activated){--box-shadow:0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12)}:host(.button-outline){--border-width:2px;--border-style:solid;--box-shadow:none;--background-activated:transparent;--background-focused:var(--ion-color-primary, #3880ff);--background-hover:var(--ion-color-primary, #3880ff);--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04}:host(.button-outline.ion-activated.ion-color) .button-native{background:transparent}:host(.button-clear){--background-activated:transparent;--background-focused:var(--ion-color-primary, #3880ff);--background-hover:var(--ion-color-primary, #3880ff);--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04}:host(.button-round){--border-radius:64px;--padding-top:0;--padding-start:26px;--padding-end:26px;--padding-bottom:0}:host(.button-large){--padding-top:14px;--padding-start:1em;--padding-end:1em;--padding-bottom:14px;min-height:2.8em;font-size:20px}:host(.button-small){--padding-top:4px;--padding-start:0.9em;--padding-end:0.9em;--padding-bottom:4px;min-height:2.1em;font-size:13px}:host(.button-has-icon-only){--padding-top:0;--padding-bottom:0}:host(.button-strong){font-weight:bold}::slotted(ion-icon[slot=icon-only]){padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host(.button-solid.ion-color.ion-focused) .button-native::after{background:var(--ion-color-contrast)}:host(.button-clear.ion-color.ion-focused) .button-native::after,:host(.button-outline.ion-color.ion-focused) .button-native::after{background:var(--ion-color-base)}@media (any-hover: hover){:host(.button-solid.ion-color:hover) .button-native::after{background:var(--ion-color-contrast)}:host(.button-clear.ion-color:hover) .button-native::after,:host(.button-outline.ion-color:hover) .button-native::after{background:var(--ion-color-base)}}';const Xe=class{constructor(e){t(this,e);this.ionFocus=s(this,"ionFocus",7);this.ionBlur=s(this,"ionBlur",7);this.inItem=false;this.inListHeader=false;this.inToolbar=false;this.formButtonEl=null;this.formEl=null;this.inheritedAttributes={};this.handleClick=t=>{const{el:e}=this;if(this.type==="button"){R(this.href,t,this.routerDirection,this.routerAnimation)}else if(M(e)){this.submitForm(t)}};this.onFocus=()=>{this.ionFocus.emit()};this.onBlur=()=>{this.ionBlur.emit()};this.color=undefined;this.buttonType="button";this.disabled=false;this.expand=undefined;this.fill=undefined;this.routerDirection="forward";this.routerAnimation=undefined;this.download=undefined;this.href=undefined;this.rel=undefined;this.shape=undefined;this.size=undefined;this.strong=false;this.target=undefined;this.type="button";this.form=undefined}disabledChanged(){const{disabled:t}=this;if(this.formButtonEl){this.formButtonEl.disabled=t}}connectedCallback(){if(this.type!=="button"&&M(this.el)){this.formEl=this.findForm();if(this.formEl){this.formButtonEl=document.createElement("button");this.formButtonEl.type=this.type;this.formButtonEl.style.display="none";this.formButtonEl.disabled=this.disabled;this.formEl.appendChild(this.formButtonEl)}}}componentWillLoad(){this.inToolbar=!!this.el.closest("ion-buttons");this.inListHeader=!!this.el.closest("ion-list-header");this.inItem=!!this.el.closest("ion-item")||!!this.el.closest("ion-item-divider");this.inheritedAttributes=z(this.el)}get hasIconOnly(){return!!this.el.querySelector('[slot="icon-only"]')}get rippleType(){const t=this.fill===undefined||this.fill==="clear";if(t&&this.hasIconOnly&&this.inToolbar){return"unbounded"}return"bounded"}findForm(){const{form:t}=this;if(t instanceof HTMLFormElement){return t}if(typeof t==="string"){const e=document.getElementById(t);if(e){if(e instanceof HTMLFormElement){return e}else{j(`Form with selector: "#${t}" could not be found. Verify that the id is attached to a <form> element.`,this.el);return null}}else{j(`Form with selector: "#${t}" could not be found. Verify that the id is correct and the form is rendered in the DOM.`,this.el);return null}}if(t!==undefined){j(`The provided "form" element is invalid. Verify that the form is a HTMLFormElement and rendered in the DOM.`,this.el);return null}return this.el.closest("form")}submitForm(t){if(this.formEl&&this.formButtonEl){t.preventDefault();this.formButtonEl.click()}}render(){const t=y(this);const{buttonType:n,type:o,disabled:s,rel:r,target:a,size:l,href:h,color:c,expand:u,hasIconOnly:d,shape:f,strong:p,inheritedAttributes:m}=this;const g=l===undefined&&this.inItem?"small":l;const b=h===undefined?"button":"a";const v=b==="button"?{type:o}:{download:this.download,href:h,rel:r,target:a};let w=this.fill;if(w==null){w=this.inToolbar||this.inListHeader?"clear":"solid"}return e(i,{onClick:this.handleClick,"aria-disabled":s?"true":null,class:N(c,{[t]:true,[n]:true,[`${n}-${u}`]:u!==undefined,[`${n}-${g}`]:g!==undefined,[`${n}-${f}`]:f!==undefined,[`${n}-${w}`]:true,[`${n}-strong`]:p,"in-toolbar":B("ion-toolbar",this.el),"in-toolbar-color":B("ion-toolbar[color]",this.el),"in-buttons":B("ion-buttons",this.el),"button-has-icon-only":d,"button-disabled":s,"ion-activatable":true,"ion-focusable":true})},e(b,Object.assign({},v,{class:"button-native",part:"native",disabled:s,onFocus:this.onFocus,onBlur:this.onBlur},m),e("span",{class:"button-inner"},e("slot",{name:"icon-only"}),e("slot",{name:"start"}),e("slot",null),e("slot",{name:"end"})),t==="md"&&e("ion-ripple-effect",{type:this.rippleType})))}get el(){return n(this)}static get watchers(){return{disabled:["disabledChanged"]}}};Xe.style={ios:We,md:Je};const He=".sc-ion-buttons-ios-h{display:flex;align-items:center;transform:translateZ(0);z-index:99}.sc-ion-buttons-ios-s ion-button{--padding-top:0;--padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.sc-ion-buttons-ios-s ion-button{--padding-top:3px;--padding-bottom:3px;--padding-start:5px;--padding-end:5px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;min-height:32px}.sc-ion-buttons-ios-s .button-has-icon-only{--padding-top:0;--padding-bottom:0}.sc-ion-buttons-ios-s ion-button:not(.button-round){--border-radius:4px}.sc-ion-buttons-ios-h.ion-color.sc-ion-buttons-ios-s .button,.ion-color .sc-ion-buttons-ios-h.sc-ion-buttons-ios-s .button{--color:initial;--border-color:initial;--background-focused:var(--ion-color-contrast)}.sc-ion-buttons-ios-h.ion-color.sc-ion-buttons-ios-s .button-solid,.ion-color .sc-ion-buttons-ios-h.sc-ion-buttons-ios-s .button-solid{--background:var(--ion-color-contrast);--background-focused:#000;--background-focused-opacity:.12;--background-activated:#000;--background-activated-opacity:.12;--background-hover:var(--ion-color-base);--background-hover-opacity:0.45;--color:var(--ion-color-base);--color-focused:var(--ion-color-base)}.sc-ion-buttons-ios-h.ion-color.sc-ion-buttons-ios-s .button-clear,.ion-color .sc-ion-buttons-ios-h.sc-ion-buttons-ios-s .button-clear{--color-activated:var(--ion-color-contrast);--color-focused:var(--ion-color-contrast)}.sc-ion-buttons-ios-h.ion-color.sc-ion-buttons-ios-s .button-outline,.ion-color .sc-ion-buttons-ios-h.sc-ion-buttons-ios-s .button-outline{--color-activated:var(--ion-color-base);--color-focused:var(--ion-color-contrast);--background-activated:var(--ion-color-contrast)}.sc-ion-buttons-ios-s .button-clear,.sc-ion-buttons-ios-s .button-outline{--background-activated:transparent;--background-focused:currentColor;--background-hover:transparent}.sc-ion-buttons-ios-s .button-solid:not(.ion-color){--background-focused:#000;--background-focused-opacity:.12;--background-activated:#000;--background-activated-opacity:.12}.sc-ion-buttons-ios-s ion-icon[slot=start]{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-margin-end:0.3em;margin-inline-end:0.3em;font-size:24px;line-height:0.67}.sc-ion-buttons-ios-s ion-icon[slot=end]{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-margin-start:0.4em;margin-inline-start:0.4em;font-size:24px;line-height:0.67}.sc-ion-buttons-ios-s ion-icon[slot=icon-only]{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;font-size:28px;line-height:0.67}";const Ke=".sc-ion-buttons-md-h{display:flex;align-items:center;transform:translateZ(0);z-index:99}.sc-ion-buttons-md-s ion-button{--padding-top:0;--padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.sc-ion-buttons-md-s ion-button{--padding-top:3px;--padding-bottom:3px;--padding-start:8px;--padding-end:8px;--box-shadow:none;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;min-height:32px}.sc-ion-buttons-md-s .button-has-icon-only{--padding-top:0;--padding-bottom:0}.sc-ion-buttons-md-s ion-button:not(.button-round){--border-radius:2px}.sc-ion-buttons-md-h.ion-color.sc-ion-buttons-md-s .button,.ion-color .sc-ion-buttons-md-h.sc-ion-buttons-md-s .button{--color:initial;--color-focused:var(--ion-color-contrast);--color-hover:var(--ion-color-contrast);--background-activated:transparent;--background-focused:var(--ion-color-contrast);--background-hover:var(--ion-color-contrast)}.sc-ion-buttons-md-h.ion-color.sc-ion-buttons-md-s .button-solid,.ion-color .sc-ion-buttons-md-h.sc-ion-buttons-md-s .button-solid{--background:var(--ion-color-contrast);--background-activated:transparent;--background-focused:var(--ion-color-shade);--background-hover:var(--ion-color-base);--color:var(--ion-color-base);--color-focused:var(--ion-color-base);--color-hover:var(--ion-color-base)}.sc-ion-buttons-md-h.ion-color.sc-ion-buttons-md-s .button-outline,.ion-color .sc-ion-buttons-md-h.sc-ion-buttons-md-s .button-outline{--border-color:var(--ion-color-contrast)}.sc-ion-buttons-md-s .button-has-icon-only.button-clear{--padding-top:12px;--padding-end:12px;--padding-bottom:12px;--padding-start:12px;--border-radius:50%;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;width:48px;height:48px}.sc-ion-buttons-md-s .button{--background-hover:currentColor}.sc-ion-buttons-md-s .button-solid{--color:var(--ion-toolbar-background, var(--ion-background-color, #fff));--background:var(--ion-toolbar-color, var(--ion-text-color, #424242));--background-activated:transparent;--background-focused:currentColor}.sc-ion-buttons-md-s .button-outline{--color:initial;--background:transparent;--background-activated:transparent;--background-focused:currentColor;--background-hover:currentColor;--border-color:currentColor}.sc-ion-buttons-md-s .button-clear{--color:initial;--background:transparent;--background-activated:transparent;--background-focused:currentColor;--background-hover:currentColor}.sc-ion-buttons-md-s ion-icon[slot=start]{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-margin-end:0.3em;margin-inline-end:0.3em;font-size:1.4em}.sc-ion-buttons-md-s ion-icon[slot=end]{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-margin-start:0.4em;margin-inline-start:0.4em;font-size:1.4em}.sc-ion-buttons-md-s ion-icon[slot=icon-only]{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;font-size:1.8em}";const Ye=class{constructor(e){t(this,e);this.collapse=false}render(){const t=y(this);return e(i,{class:{[t]:true,["buttons-collapse"]:this.collapse}})}};Ye.style={ios:He,md:Ke};const Qe=':host{--background:var(--ion-background-color, #fff);--color:var(--ion-text-color, #000);--padding-top:0px;--padding-bottom:0px;--padding-start:0px;--padding-end:0px;--keyboard-offset:0px;--offset-top:0px;--offset-bottom:0px;--overflow:auto;display:block;position:relative;flex:1;width:100%;height:100%;margin:0 !important;padding:0 !important;font-family:var(--ion-font-family, inherit);contain:size style}:host(.ion-color) .inner-scroll{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.outer-content){--background:var(--ion-color-step-50, #f2f2f2)}#background-content{left:0px;right:0px;top:calc(var(--offset-top) * -1);bottom:calc(var(--offset-bottom) * -1);position:absolute;background:var(--background)}.inner-scroll{left:0px;right:0px;top:calc(var(--offset-top) * -1);bottom:calc(var(--offset-bottom) * -1);-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:calc(var(--padding-top) + var(--offset-top));padding-bottom:calc(var(--padding-bottom) + var(--keyboard-offset) + var(--offset-bottom));position:absolute;color:var(--color);box-sizing:border-box;overflow:hidden;touch-action:pan-x pan-y pinch-zoom}.scroll-y,.scroll-x{-webkit-overflow-scrolling:touch;z-index:0;will-change:scroll-position}.scroll-y{overflow-y:var(--overflow);overscroll-behavior-y:contain}.scroll-x{overflow-x:var(--overflow);overscroll-behavior-x:contain}.overscroll::before,.overscroll::after{position:absolute;width:1px;height:1px;content:""}.overscroll::before{bottom:-1px}.overscroll::after{top:-1px}:host(.content-sizing){display:flex;flex-direction:column;min-height:0;contain:none}:host(.content-sizing) .inner-scroll{position:relative;top:0;bottom:0;margin-top:calc(var(--offset-top) * -1);margin-bottom:calc(var(--offset-bottom) * -1)}.transition-effect{display:none;position:absolute;width:100%;height:100vh;opacity:0;pointer-events:none}:host(.content-ltr) .transition-effect{left:-100%;}:host(.content-rtl) .transition-effect{right:-100%;}.transition-cover{position:absolute;right:0;width:100%;height:100%;background:black;opacity:0.1}.transition-shadow{display:block;position:absolute;width:100%;height:100%;box-shadow:inset -9px 0 9px 0 rgba(0, 0, 100, 0.03)}:host(.content-ltr) .transition-shadow{right:0;}:host(.content-rtl) .transition-shadow{left:0;transform:scaleX(-1)}::slotted([slot=fixed]){position:absolute;transform:translateZ(0)}';const ti=class{constructor(e){t(this,e);this.ionScrollStart=s(this,"ionScrollStart",7);this.ionScroll=s(this,"ionScroll",7);this.ionScrollEnd=s(this,"ionScrollEnd",7);this.watchDog=null;this.isScrolling=false;this.lastScroll=0;this.queued=false;this.cTop=-1;this.cBottom=-1;this.isMainContent=true;this.resizeTimeout=null;this.detail={scrollTop:0,scrollLeft:0,type:"scroll",event:undefined,startX:0,startY:0,startTime:0,currentX:0,currentY:0,velocityX:0,velocityY:0,deltaX:0,deltaY:0,currentTime:0,data:undefined,isScrolling:true};this.color=undefined;this.fullscreen=false;this.forceOverscroll=undefined;this.scrollX=false;this.scrollY=true;this.scrollEvents=false}connectedCallback(){this.isMainContent=this.el.closest("ion-menu, ion-popover, ion-modal")===null}disconnectedCallback(){this.onScrollEnd()}onAppLoad(){this.resize()}onResize(){if(this.resizeTimeout){clearTimeout(this.resizeTimeout);this.resizeTimeout=null}this.resizeTimeout=setTimeout((()=>{if(this.el.offsetParent===null){return}this.resize()}),100)}shouldForceOverscroll(){const{forceOverscroll:t}=this;const e=y(this);return t===undefined?e==="ios"&&_("ios"):t}resize(){{if(this.fullscreen){r((()=>this.readDimensions()))}else if(this.cTop!==0||this.cBottom!==0){this.cTop=this.cBottom=0;a(this)}}}readDimensions(){const t=ii(this.el);const e=Math.max(this.el.offsetTop,0);const i=Math.max(t.offsetHeight-e-this.el.offsetHeight,0);const n=e!==this.cTop||i!==this.cBottom;if(n){this.cTop=e;this.cBottom=i;a(this)}}onScroll(t){const e=Date.now();const i=!this.isScrolling;this.lastScroll=e;if(i){this.onScrollStart()}if(!this.queued&&this.scrollEvents){this.queued=true;r((e=>{this.queued=false;this.detail.event=t;ni(this.detail,this.scrollEl,e,i);this.ionScroll.emit(this.detail)}))}}async getScrollElement(){if(!this.scrollEl){await new Promise((t=>S(this.el,t)))}return Promise.resolve(this.scrollEl)}async getBackgroundElement(){if(!this.backgroundContentEl){await new Promise((t=>S(this.el,t)))}return Promise.resolve(this.backgroundContentEl)}scrollToTop(t=0){return this.scrollToPoint(undefined,0,t)}async scrollToBottom(t=0){const e=await this.getScrollElement();const i=e.scrollHeight-e.clientHeight;return this.scrollToPoint(undefined,i,t)}async scrollByPoint(t,e,i){const n=await this.getScrollElement();return this.scrollToPoint(t+n.scrollLeft,e+n.scrollTop,i)}async scrollToPoint(t,e,i=0){const n=await this.getScrollElement();if(i<32){if(e!=null){n.scrollTop=e}if(t!=null){n.scrollLeft=t}return}let o;let s=0;const r=new Promise((t=>o=t));const a=n.scrollTop;const l=n.scrollLeft;const h=e!=null?e-a:0;const c=t!=null?t-l:0;const u=t=>{const e=Math.min(1,(t-s)/i)-1;const r=Math.pow(e,3)+1;if(h!==0){n.scrollTop=Math.floor(r*h+a)}if(c!==0){n.scrollLeft=Math.floor(r*c+l)}if(r<1){requestAnimationFrame(u)}else{o()}};requestAnimationFrame((t=>{s=t;u(t)}));return r}onScrollStart(){this.isScrolling=true;this.ionScrollStart.emit({isScrolling:true});if(this.watchDog){clearInterval(this.watchDog)}this.watchDog=setInterval((()=>{if(this.lastScroll<Date.now()-120){this.onScrollEnd()}}),100)}onScrollEnd(){if(this.watchDog)clearInterval(this.watchDog);this.watchDog=null;if(this.isScrolling){this.isScrolling=false;this.ionScrollEnd.emit({isScrolling:false})}}render(){const{isMainContent:t,scrollX:n,scrollY:o,el:s}=this;const r=U(s)?"rtl":"ltr";const a=y(this);const l=this.shouldForceOverscroll();const h=a==="ios";const c=t?"main":"div";this.resize();return e(i,{class:N(this.color,{[a]:true,"content-sizing":B("ion-popover",this.el),overscroll:l,[`content-${r}`]:true}),style:{"--offset-top":`${this.cTop}px`,"--offset-bottom":`${this.cBottom}px`}},e("div",{ref:t=>this.backgroundContentEl=t,id:"background-content",part:"background"}),e(c,{class:{"inner-scroll":true,"scroll-x":n,"scroll-y":o,overscroll:(n||o)&&l},ref:t=>this.scrollEl=t,onScroll:this.scrollEvents?t=>this.onScroll(t):undefined,part:"scroll"},e("slot",null)),h?e("div",{class:"transition-effect"},e("div",{class:"transition-cover"}),e("div",{class:"transition-shadow"})):null,e("slot",{name:"fixed"}))}get el(){return n(this)}};const ei=t=>{var e;if(t.parentElement){return t.parentElement}if((e=t.parentNode)===null||e===void 0?void 0:e.host){return t.parentNode.host}return null};const ii=t=>{const e=t.closest("ion-tabs");if(e){return e}const i=t.closest("ion-app, ion-page, .ion-page, page-inner, .popover-content");if(i){return i}return ei(t)};const ni=(t,e,i,n)=>{const o=t.currentX;const s=t.currentY;const r=t.currentTime;const a=e.scrollLeft;const l=e.scrollTop;const h=i-r;if(n){t.startTime=i;t.startX=a;t.startY=l;t.velocityX=t.velocityY=0}t.currentTime=i;t.currentX=t.scrollLeft=a;t.currentY=t.scrollTop=l;t.deltaX=a-t.startX;t.deltaY=l-t.startY;if(h>0&&h<100){const e=(a-o)/h;const i=(l-s)/h;t.velocityX=e*.7+t.velocityX*.3;t.velocityY=i*.7+t.velocityY*.3}};ti.style=Qe;
|
|
2
|
+
/*!
|
|
3
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
4
|
+
*/const oi=(t,e)=>{r((()=>{const i=t.scrollTop;const n=t.scrollHeight-t.clientHeight;const o=10;const s=n-o;const r=i-s;const a=C(0,1-r/o,1);l((()=>{e.style.setProperty("--opacity-scale",a.toString())}))}))};const si="ion-footer{display:block;position:relative;order:1;width:100%;z-index:10}ion-footer.footer-toolbar-padding ion-toolbar:last-of-type{padding-bottom:var(--ion-safe-area-bottom, 0)}.footer-ios ion-toolbar:first-of-type{--border-width:0.55px 0 0}@supports (backdrop-filter: blur(0)){.footer-background{left:0;right:0;top:0;bottom:0;position:absolute;backdrop-filter:saturate(180%) blur(20px)}.footer-translucent-ios ion-toolbar{--opacity:.8}}.footer-ios.ion-no-border ion-toolbar:first-of-type{--border-width:0}.footer-collapse-fade ion-toolbar{--opacity-scale:inherit}";const ri="ion-footer{display:block;position:relative;order:1;width:100%;z-index:10}ion-footer.footer-toolbar-padding ion-toolbar:last-of-type{padding-bottom:var(--ion-safe-area-bottom, 0)}.footer-md{box-shadow:0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12)}.footer-md.ion-no-border{box-shadow:none}";const ai=class{constructor(e){t(this,e);this.keyboardCtrl=null;this.checkCollapsibleFooter=()=>{const t=y(this);if(t!=="ios"){return}const{collapse:e}=this;const i=e==="fade";this.destroyCollapsibleFooter();if(i){const t=this.el.closest("ion-app,ion-page,.ion-page,page-inner");const e=t?q(t):null;if(!e){V(this.el);return}this.setupFadeFooter(e)}};this.setupFadeFooter=async t=>{const e=this.scrollEl=await G(t);this.contentScrollCallback=()=>{oi(e,this.el)};e.addEventListener("scroll",this.contentScrollCallback);oi(e,this.el)};this.keyboardVisible=false;this.collapse=undefined;this.translucent=false}componentDidLoad(){this.checkCollapsibleFooter()}componentDidUpdate(){this.checkCollapsibleFooter()}async connectedCallback(){this.keyboardCtrl=await Z((async(t,e)=>{if(t===false&&e!==undefined){await e}this.keyboardVisible=t}))}disconnectedCallback(){if(this.keyboardCtrl){this.keyboardCtrl.destroy()}}destroyCollapsibleFooter(){if(this.scrollEl&&this.contentScrollCallback){this.scrollEl.removeEventListener("scroll",this.contentScrollCallback);this.contentScrollCallback=undefined}}render(){const{translucent:t,collapse:n}=this;const o=y(this);const s=this.el.closest("ion-tabs");const r=s===null||s===void 0?void 0:s.querySelector(":scope > ion-tab-bar");return e(i,{role:"contentinfo",class:{[o]:true,[`footer-${o}`]:true,[`footer-translucent`]:t,[`footer-translucent-${o}`]:t,["footer-toolbar-padding"]:!this.keyboardVisible&&(!r||r.slot!=="bottom"),[`footer-collapse-${n}`]:n!==undefined}},o==="ios"&&t&&e("div",{class:"footer-background"}),e("slot",null))}get el(){return n(this)}};ai.style={ios:si,md:ri};
|
|
5
|
+
/*!
|
|
6
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
7
|
+
*/const li="all 0.2s ease-in-out";const hi=t=>{const e=document.querySelector(`${t}.ion-cloned-element`);if(e!==null){return e}const i=document.createElement(t);i.classList.add("ion-cloned-element");i.style.setProperty("display","none");document.body.appendChild(i);return i};const ci=t=>{if(!t){return}const e=t.querySelectorAll("ion-toolbar");return{el:t,toolbars:Array.from(e).map((t=>{const e=t.querySelector("ion-title");return{el:t,background:t.shadowRoot.querySelector(".toolbar-background"),ionTitleEl:e,innerTitleEl:e?e.shadowRoot.querySelector(".toolbar-title"):null,ionButtonsEl:Array.from(t.querySelectorAll("ion-buttons"))}}))}};const ui=(t,e,i)=>{r((()=>{const n=t.scrollTop;const o=C(1,1+-n/500,1.1);const s=i.querySelector("ion-refresher.refresher-native");if(s===null){l((()=>{gi(e.toolbars,o)}))}}))};const di=(t,e)=>{if(t.collapse==="fade"){return}if(e===undefined){t.style.removeProperty("--opacity-scale")}else{t.style.setProperty("--opacity-scale",e.toString())}};const fi=(t,e,i)=>{if(!t[0].isIntersecting){return}const n=t[0].intersectionRatio>.9||i<=0?0:(1-t[0].intersectionRatio)*100/75;di(e.el,n===1?undefined:n)};const pi=(t,e,i,n)=>{l((()=>{const o=n.scrollTop;fi(t,e,o);const s=t[0];const r=s.intersectionRect;const a=r.width*r.height;const l=s.rootBounds.width*s.rootBounds.height;const h=a===0&&l===0;const c=Math.abs(r.left-s.boundingClientRect.left);const u=Math.abs(r.right-s.boundingClientRect.right);const d=a>0&&(c>=5||u>=5);if(h||d){return}if(s.isIntersecting){mi(e,false);mi(i)}else{const t=r.x===0&&r.y===0||r.width!==0&&r.height!==0;if(t&&o>0){mi(e);mi(i,false);di(e.el)}}}))};const mi=(t,e=true)=>{const i=t.el;if(e){i.classList.remove("header-collapse-condense-inactive");i.removeAttribute("aria-hidden")}else{i.classList.add("header-collapse-condense-inactive");i.setAttribute("aria-hidden","true")}};const gi=(t=[],e=1,i=false)=>{t.forEach((t=>{const n=t.ionTitleEl;const o=t.innerTitleEl;if(!n||n.size!=="large"){return}o.style.transition=i?li:"";o.style.transform=`scale3d(${e}, ${e}, 1)`}))};const bi=(t,e,i)=>{r((()=>{const n=t.scrollTop;const o=e.clientHeight;const s=i?i.clientHeight:0;if(i!==null&&n<s){e.style.setProperty("--opacity-scale","0");t.style.setProperty("clip-path",`inset(${o}px 0px 0px 0px)`);return}const r=n-s;const a=10;const h=C(0,r/a,1);l((()=>{t.style.removeProperty("clip-path");e.style.setProperty("--opacity-scale",h.toString())}))}))};const vi="ion-header{display:block;position:relative;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-ios ion-toolbar:last-of-type{--border-width:0 0 0.55px}@supports (backdrop-filter: blur(0)){.header-background{left:0;right:0;top:0;bottom:0;position:absolute;backdrop-filter:saturate(180%) blur(20px)}.header-translucent-ios ion-toolbar{--opacity:.8}.header-collapse-condense-inactive .header-background{backdrop-filter:blur(20px)}}.header-ios.ion-no-border ion-toolbar:last-of-type{--border-width:0}.header-collapse-fade ion-toolbar{--opacity-scale:inherit}.header-collapse-condense{z-index:9}.header-collapse-condense ion-toolbar{position:sticky;top:0}.header-collapse-condense ion-toolbar:first-of-type{padding-top:7px;z-index:1}.header-collapse-condense ion-toolbar{--background:var(--ion-background-color, #fff);z-index:0}.header-collapse-condense ion-toolbar:last-of-type{--border-width:0px}.header-collapse-condense ion-toolbar ion-searchbar{height:48px;padding-top:0px;padding-bottom:13px}.header-collapse-main{--opacity-scale:1}.header-collapse-main ion-toolbar{--opacity-scale:inherit}.header-collapse-main ion-toolbar.in-toolbar ion-title,.header-collapse-main ion-toolbar.in-toolbar ion-buttons{transition:all 0.2s ease-in-out}.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-buttons.buttons-collapse{opacity:0;pointer-events:none}.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-buttons.buttons-collapse{visibility:hidden}";const wi="ion-header{display:block;position:relative;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-md{box-shadow:0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12)}.header-collapse-condense{display:none}.header-md.ion-no-border{box-shadow:none}";const yi=class{constructor(e){t(this,e);this.inheritedAttributes={};this.setupFadeHeader=async(t,e)=>{const i=this.scrollEl=await G(t);this.contentScrollCallback=()=>{bi(this.scrollEl,this.el,e)};i.addEventListener("scroll",this.contentScrollCallback);bi(this.scrollEl,this.el,e)};this.collapse=undefined;this.translucent=false}componentWillLoad(){this.inheritedAttributes=z(this.el)}componentDidLoad(){this.checkCollapsibleHeader()}componentDidUpdate(){this.checkCollapsibleHeader()}disconnectedCallback(){this.destroyCollapsibleHeader()}async checkCollapsibleHeader(){const t=y(this);if(t!=="ios"){return}const{collapse:e}=this;const i=e==="condense";const n=e==="fade";this.destroyCollapsibleHeader();if(i){const t=this.el.closest("ion-app,ion-page,.ion-page,page-inner");const e=t?q(t):null;l((()=>{const t=hi("ion-title");t.size="large";hi("ion-back-button")}));await this.setupCondenseHeader(e,t)}else if(n){const t=this.el.closest("ion-app,ion-page,.ion-page,page-inner");const e=t?q(t):null;if(!e){V(this.el);return}const i=e.querySelector('ion-header[collapse="condense"]');await this.setupFadeHeader(e,i)}}destroyCollapsibleHeader(){if(this.intersectionObserver){this.intersectionObserver.disconnect();this.intersectionObserver=undefined}if(this.scrollEl&&this.contentScrollCallback){this.scrollEl.removeEventListener("scroll",this.contentScrollCallback);this.contentScrollCallback=undefined}if(this.collapsibleMainHeader){this.collapsibleMainHeader.classList.remove("header-collapse-main");this.collapsibleMainHeader=undefined}}async setupCondenseHeader(t,e){if(!t||!e){V(this.el);return}if(typeof IntersectionObserver==="undefined"){return}this.scrollEl=await G(t);const i=e.querySelectorAll("ion-header");this.collapsibleMainHeader=Array.from(i).find((t=>t.collapse!=="condense"));if(!this.collapsibleMainHeader){return}const n=ci(this.collapsibleMainHeader);const o=ci(this.el);if(!n||!o){return}mi(n,false);di(n.el,0);const s=t=>{pi(t,n,o,this.scrollEl)};this.intersectionObserver=new IntersectionObserver(s,{root:t,threshold:[.25,.3,.4,.5,.6,.7,.8,.9,1]});this.intersectionObserver.observe(o.toolbars[o.toolbars.length-1].el);this.contentScrollCallback=()=>{ui(this.scrollEl,o,t)};this.scrollEl.addEventListener("scroll",this.contentScrollCallback);l((()=>{if(this.collapsibleMainHeader!==undefined){this.collapsibleMainHeader.classList.add("header-collapse-main")}}))}render(){const{translucent:t,inheritedAttributes:n}=this;const o=y(this);const s=this.collapse||"none";const r=B("ion-menu",this.el)?"none":"banner";return e(i,Object.assign({role:r,class:{[o]:true,[`header-${o}`]:true,[`header-translucent`]:this.translucent,[`header-collapse-${s}`]:true,[`header-translucent-${o}`]:this.translucent}},n),o==="ios"&&t&&e("div",{class:"header-background"}),e("slot",null))}get el(){return n(this)}};yi.style={ios:vi,md:wi};const xi=t=>{const e=document.createElement("div");e.innerHTML=t;for(let t=e.childNodes.length-1;t>=0;t--){if(e.childNodes[t].nodeName.toLowerCase()!=="svg"){e.removeChild(e.childNodes[t])}}const i=e.firstElementChild;if(i&&i.nodeName.toLowerCase()==="svg"){const t=i.getAttribute("class")||"";i.setAttribute("class",(t+" s-ion-icon").trim());if(_i(i)){return e.innerHTML}}return""};const _i=t=>{if(t.nodeType===1){if(t.nodeName.toLowerCase()==="script"){return false}for(let e=0;e<t.attributes.length;e++){const i=t.attributes[e].name;if(xt(i)&&i.toLowerCase().indexOf("on")===0){return false}}for(let e=0;e<t.childNodes.length;e++){if(!_i(t.childNodes[e])){return false}}}return true};const ki=t=>t.startsWith("data:image/svg+xml");const Mi=t=>t.indexOf(";utf8,")!==-1;const zi=new Map;const Si=new Map;let Ci;const Ei=(t,e)=>{let i=Si.get(t);if(!i){if(typeof fetch!=="undefined"&&typeof document!=="undefined"){if(ki(t)&&Mi(t)){if(!Ci){Ci=new DOMParser}const e=Ci.parseFromString(t,"text/html");const i=e.querySelector("svg");if(i){zi.set(t,i.outerHTML)}return Promise.resolve()}else{i=fetch(t).then((i=>{if(i.ok){return i.text().then((i=>{if(i&&e!==false){i=xi(i)}zi.set(t,i||"")}))}zi.set(t,"")}));Si.set(t,i)}}else{zi.set(t,"");return Promise.resolve()}}return i};const Ai=":host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;box-sizing:content-box !important}:host .ionicon{stroke:currentColor}.ionicon-fill-none{fill:none}.ionicon-stroke-width{stroke-width:32px;stroke-width:var(--ionicon-stroke-width, 32px)}.icon-inner,.ionicon,svg{display:block;height:100%;width:100%}:host(.flip-rtl) .icon-inner{transform:scaleX(-1)}:host(.icon-small){font-size:18px !important}:host(.icon-large){font-size:32px !important}:host(.ion-color){color:var(--ion-color-base) !important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary, #3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary, #0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary, #f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success, #10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning, #ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger, #f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light, #f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium, #989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark, #222428)}";const Ii=class{constructor(e){t(this,e);this.iconName=null;this.inheritedAttributes={};this.isVisible=false;this.mode=Ti();this.lazy=false;this.sanitize=true}componentWillLoad(){this.inheritedAttributes=kt(this.el,["aria-label"])}connectedCallback(){this.waitUntilVisible(this.el,"50px",(()=>{this.isVisible=true;this.loadIcon()}))}disconnectedCallback(){if(this.io){this.io.disconnect();this.io=undefined}}waitUntilVisible(t,e,i){if(this.lazy&&typeof window!=="undefined"&&window.IntersectionObserver){const n=this.io=new window.IntersectionObserver((t=>{if(t[0].isIntersecting){n.disconnect();this.io=undefined;i()}}),{rootMargin:e});n.observe(t)}else{i()}}loadIcon(){if(this.isVisible){const t=gt(this);if(t){if(zi.has(t)){this.svgContent=zi.get(t)}else{Ei(t,this.sanitize).then((()=>this.svgContent=zi.get(t)))}}}this.iconName=vt(this.name,this.icon,this.mode,this.ios,this.md)}render(){const{iconName:t,el:n,inheritedAttributes:o}=this;const s=this.mode||"md";const r=this.flipRtl||t&&(t.indexOf("arrow")>-1||t.indexOf("chevron")>-1)&&this.flipRtl!==false;return e(i,Object.assign({role:"img",class:Object.assign(Object.assign({[s]:true},Pi(this.color)),{[`icon-${this.size}`]:!!this.size,"flip-rtl":!!r&&Mt(n)})},o),this.svgContent?e("div",{class:"icon-inner",innerHTML:this.svgContent}):e("div",{class:"icon-inner"}))}static get assetsDirs(){return["svg"]}get el(){return n(this)}static get watchers(){return{name:["loadIcon"],src:["loadIcon"],icon:["loadIcon"],ios:["loadIcon"],md:["loadIcon"]}}};const Ti=()=>typeof document!=="undefined"&&document.documentElement.getAttribute("mode")||"md";const Pi=t=>t?{"ion-color":true,[`ion-color-${t}`]:true}:null;Ii.style=Ai;const $i=':host{--border-radius:0px;--border-width:0px;--border-style:solid;--padding-top:0px;--padding-bottom:0px;--padding-end:0px;--padding-start:0px;--inner-border-width:0px;--inner-padding-top:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;--inner-padding-end:0px;--inner-box-shadow:none;--show-full-highlight:0;--show-inset-highlight:0;--detail-icon-color:initial;--detail-icon-font-size:20px;--detail-icon-opacity:0.25;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;align-items:center;justify-content:space-between;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:initial;text-decoration:none;overflow:hidden;box-sizing:border-box}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-native,:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-inner{border-color:var(--ion-color-shade)}:host(.ion-activated) .item-native{color:var(--color-activated)}:host(.ion-activated) .item-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-color.ion-activated) .item-native{color:var(--ion-color-contrast)}:host(.ion-focused) .item-native{color:var(--color-focused)}:host(.ion-focused) .item-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-color.ion-focused) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .item-native::after{background:var(--ion-color-contrast)}@media (any-hover: hover){:host(.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--color-hover)}:host(.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--ion-color-contrast)}}:host(.item-interactive-disabled:not(.item-multiple-inputs)){cursor:default;pointer-events:none}:host(.item-disabled){cursor:default;opacity:0.3;pointer-events:none}.item-native{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:flex;position:relative;align-items:inherit;justify-content:inherit;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);overflow:inherit;box-sizing:border-box;z-index:1}.item-native::-moz-focus-inner{border:0}.item-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:"";opacity:0;transition:var(--transition);z-index:-1}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}.item-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;position:relative;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);box-shadow:var(--inner-box-shadow);overflow:inherit;box-sizing:border-box}.item-bottom{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--inner-padding-end);padding-inline-end:var(--inner-padding-end);padding-top:0;padding-bottom:0;display:flex;justify-content:space-between}.item-detail-icon{-webkit-margin-start:calc(var(--inner-padding-end) / 2);margin-inline-start:calc(var(--inner-padding-end) / 2);-webkit-margin-end:-6px;margin-inline-end:-6px;color:var(--detail-icon-color);font-size:var(--detail-icon-font-size);opacity:var(--detail-icon-opacity)}::slotted(ion-icon){font-size:1.6em}::slotted(ion-button){--margin-top:0;--margin-bottom:0;--margin-start:0;--margin-end:0;z-index:1}::slotted(ion-label:not([slot=end])){flex:1}:host(.item-input){align-items:center}.input-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:inherit;box-sizing:border-box}:host(.item-label-stacked),:host(.item-label-floating){align-items:start}:host(.item-label-stacked) .input-wrapper,:host(.item-label-floating) .input-wrapper{flex:1;flex-direction:column}.item-highlight,.item-inner-highlight{left:0;right:0;top:0;bottom:0;border-radius:inherit;position:absolute;width:100%;height:100%;transform:scaleX(0);transition:transform 200ms, border-bottom-width 200ms;z-index:2;box-sizing:border-box;pointer-events:none}:host(.item-interactive.ion-focused),:host(.item-interactive.item-has-focus),:host(.item-interactive.ion-touched.ion-invalid){--full-highlight-height:calc(var(--highlight-height) * var(--show-full-highlight));--inset-highlight-height:calc(var(--highlight-height) * var(--show-inset-highlight))}:host(.ion-focused) .item-highlight,:host(.ion-focused) .item-inner-highlight,:host(.item-has-focus) .item-highlight,:host(.item-has-focus) .item-inner-highlight{transform:scaleX(1);border-style:var(--border-style);border-color:var(--highlight-background)}:host(.ion-focused) .item-highlight,:host(.item-has-focus) .item-highlight{border-width:var(--full-highlight-height);opacity:var(--show-full-highlight)}:host(.ion-focused) .item-inner-highlight,:host(.item-has-focus) .item-inner-highlight{border-bottom-width:var(--inset-highlight-height);opacity:var(--show-inset-highlight)}:host(.ion-focused.item-fill-solid) .item-highlight,:host(.item-has-focus.item-fill-solid) .item-highlight{border-width:calc(var(--full-highlight-height) - 1px)}:host(.ion-focused) .item-inner-highlight,:host(.ion-focused:not(.item-fill-outline)) .item-highlight,:host(.item-has-focus) .item-inner-highlight,:host(.item-has-focus:not(.item-fill-outline)) .item-highlight{border-top:none;border-right:none;border-left:none}:host(.item-interactive.ion-focused),:host(.item-interactive.item-has-focus){--highlight-background:var(--highlight-color-focused)}:host(.item-interactive.ion-valid){--highlight-background:var(--highlight-color-valid)}:host(.item-interactive.ion-invalid){--highlight-background:var(--highlight-color-invalid)}:host(.item-interactive.ion-invalid) ::slotted([slot=helper]){display:none}::slotted([slot=error]){display:none;color:var(--highlight-color-invalid)}:host(.item-interactive.ion-invalid) ::slotted([slot=error]){display:block}:host(:not(.item-label)) ::slotted(ion-select.legacy-select){--padding-start:0;max-width:none}:host(.item-label-stacked) ::slotted(ion-select.legacy-select),:host(.item-label-floating) ::slotted(ion-select.legacy-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0;align-self:stretch;width:100%;max-width:100%}:host(:not(.item-label)) ::slotted(ion-datetime){--padding-start:0}:host(.item-label-stacked) ::slotted(ion-datetime),:host(.item-label-floating) ::slotted(ion-datetime){--padding-start:0;width:100%}:host(.item-multiple-inputs) ::slotted(ion-checkbox),:host(.item-multiple-inputs) ::slotted(ion-datetime),:host(.item-multiple-inputs) ::slotted(ion-radio),:host(.item-multiple-inputs) ::slotted(ion-select.legacy-select){position:relative}:host(.item-textarea){align-items:stretch}::slotted(ion-reorder[slot]){margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}:host(.item-fill-solid) ::slotted([slot=start]),:host(.item-fill-solid) ::slotted([slot=end]),:host(.item-fill-outline) ::slotted([slot=start]),:host(.item-fill-outline) ::slotted([slot=end]){align-self:center}::slotted([slot=helper]),::slotted([slot=error]),.item-counter{padding-top:5px;font-size:12px;z-index:1}.item-counter{-webkit-margin-start:auto;margin-inline-start:auto;color:var(--ion-color-step-550, #737373);white-space:nowrap;padding-inline-start:16px}@media (prefers-reduced-motion: reduce){.item-highlight,.item-inner-highlight{transition:none}}:host{--min-height:44px;--transition:background-color 200ms linear, opacity 200ms linear;--padding-start:16px;--inner-padding-end:16px;--inner-border-width:0px 0px 0.55px 0px;--background:var(--ion-item-background, var(--ion-background-color, #fff));--background-activated:var(--ion-text-color, #000);--background-focused:var(--ion-text-color, #000);--background-hover:currentColor;--background-activated-opacity:.12;--background-focused-opacity:.15;--background-hover-opacity:.04;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, #c8c7cc)));--color:var(--ion-item-color, var(--ion-text-color, #000));--highlight-height:0px;--highlight-color-focused:var(--ion-color-primary, #3880ff);--highlight-color-valid:var(--ion-color-success, #2dd36f);--highlight-color-invalid:var(--ion-color-danger, #eb445a);--bottom-padding-start:0px;font-size:16px}:host(.ion-activated){--transition:none}:host(.ion-color.ion-focused) .item-native::after{background:#000;opacity:0.15}:host(.ion-color.ion-activated) .item-native::after{background:#000;opacity:0.12}:host(.item-interactive){--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-full){--border-width:0px 0px 0.55px 0px;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-inset){--inner-border-width:0px 0px 0.55px 0px;--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-inset),:host(.item-lines-none){--border-width:0px;--show-full-highlight:0}:host(.item-lines-full),:host(.item-lines-none){--inner-border-width:0px;--show-inset-highlight:0}.item-highlight,.item-inner-highlight{transition:none}:host(.item-has-focus) .item-inner-highlight,:host(.item-has-focus) .item-highlight{border-top:none;border-right:none;border-left:none}::slotted([slot=start]){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:2px;margin-bottom:2px}::slotted(ion-icon[slot=start]),::slotted(ion-icon[slot=end]){margin-top:7px;margin-bottom:7px}::slotted(ion-toggle[slot=start]),::slotted(ion-toggle[slot=end]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host(.item-label-stacked) ::slotted([slot=end]),:host(.item-label-floating) ::slotted([slot=end]){margin-top:7px;margin-bottom:7px}::slotted(.button-small){--padding-top:1px;--padding-bottom:1px;--padding-start:.5em;--padding-end:.5em;min-height:24px;font-size:13px}::slotted(ion-avatar){width:36px;height:36px}::slotted(ion-thumbnail){--size:56px}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){-webkit-margin-start:8px;margin-inline-start:8px;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:8px;margin-bottom:8px}:host(.item-radio) ::slotted(ion-label),:host(.item-toggle) ::slotted(ion-label){-webkit-margin-start:0px;margin-inline-start:0px}::slotted(ion-label){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:10px;margin-bottom:10px}:host(.item-label-floating),:host(.item-label-stacked){--min-height:68px}:host(.item-label-stacked) ::slotted(ion-select.legacy-select),:host(.item-label-floating) ::slotted(ion-select.legacy-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0px}:host(.item-label-fixed) ::slotted(ion-select.legacy-select),:host(.item-label-fixed) ::slotted(ion-datetime){--padding-start:0}';const Fi=':host{--border-radius:0px;--border-width:0px;--border-style:solid;--padding-top:0px;--padding-bottom:0px;--padding-end:0px;--padding-start:0px;--inner-border-width:0px;--inner-padding-top:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;--inner-padding-end:0px;--inner-box-shadow:none;--show-full-highlight:0;--show-inset-highlight:0;--detail-icon-color:initial;--detail-icon-font-size:20px;--detail-icon-opacity:0.25;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;align-items:center;justify-content:space-between;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:initial;text-decoration:none;overflow:hidden;box-sizing:border-box}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-native,:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) .item-inner{border-color:var(--ion-color-shade)}:host(.ion-activated) .item-native{color:var(--color-activated)}:host(.ion-activated) .item-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-color.ion-activated) .item-native{color:var(--ion-color-contrast)}:host(.ion-focused) .item-native{color:var(--color-focused)}:host(.ion-focused) .item-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-color.ion-focused) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .item-native::after{background:var(--ion-color-contrast)}@media (any-hover: hover){:host(.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--color-hover)}:host(.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-activatable:not(.ion-focused):hover) .item-native::after{background:var(--ion-color-contrast)}}:host(.item-interactive-disabled:not(.item-multiple-inputs)){cursor:default;pointer-events:none}:host(.item-disabled){cursor:default;opacity:0.3;pointer-events:none}.item-native{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:flex;position:relative;align-items:inherit;justify-content:inherit;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);overflow:inherit;box-sizing:border-box;z-index:1}.item-native::-moz-focus-inner{border:0}.item-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:"";opacity:0;transition:var(--transition);z-index:-1}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}.item-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;position:relative;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);box-shadow:var(--inner-box-shadow);overflow:inherit;box-sizing:border-box}.item-bottom{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--inner-padding-end);padding-inline-end:var(--inner-padding-end);padding-top:0;padding-bottom:0;display:flex;justify-content:space-between}.item-detail-icon{-webkit-margin-start:calc(var(--inner-padding-end) / 2);margin-inline-start:calc(var(--inner-padding-end) / 2);-webkit-margin-end:-6px;margin-inline-end:-6px;color:var(--detail-icon-color);font-size:var(--detail-icon-font-size);opacity:var(--detail-icon-opacity)}::slotted(ion-icon){font-size:1.6em}::slotted(ion-button){--margin-top:0;--margin-bottom:0;--margin-start:0;--margin-end:0;z-index:1}::slotted(ion-label:not([slot=end])){flex:1}:host(.item-input){align-items:center}.input-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:inherit;box-sizing:border-box}:host(.item-label-stacked),:host(.item-label-floating){align-items:start}:host(.item-label-stacked) .input-wrapper,:host(.item-label-floating) .input-wrapper{flex:1;flex-direction:column}.item-highlight,.item-inner-highlight{left:0;right:0;top:0;bottom:0;border-radius:inherit;position:absolute;width:100%;height:100%;transform:scaleX(0);transition:transform 200ms, border-bottom-width 200ms;z-index:2;box-sizing:border-box;pointer-events:none}:host(.item-interactive.ion-focused),:host(.item-interactive.item-has-focus),:host(.item-interactive.ion-touched.ion-invalid){--full-highlight-height:calc(var(--highlight-height) * var(--show-full-highlight));--inset-highlight-height:calc(var(--highlight-height) * var(--show-inset-highlight))}:host(.ion-focused) .item-highlight,:host(.ion-focused) .item-inner-highlight,:host(.item-has-focus) .item-highlight,:host(.item-has-focus) .item-inner-highlight{transform:scaleX(1);border-style:var(--border-style);border-color:var(--highlight-background)}:host(.ion-focused) .item-highlight,:host(.item-has-focus) .item-highlight{border-width:var(--full-highlight-height);opacity:var(--show-full-highlight)}:host(.ion-focused) .item-inner-highlight,:host(.item-has-focus) .item-inner-highlight{border-bottom-width:var(--inset-highlight-height);opacity:var(--show-inset-highlight)}:host(.ion-focused.item-fill-solid) .item-highlight,:host(.item-has-focus.item-fill-solid) .item-highlight{border-width:calc(var(--full-highlight-height) - 1px)}:host(.ion-focused) .item-inner-highlight,:host(.ion-focused:not(.item-fill-outline)) .item-highlight,:host(.item-has-focus) .item-inner-highlight,:host(.item-has-focus:not(.item-fill-outline)) .item-highlight{border-top:none;border-right:none;border-left:none}:host(.item-interactive.ion-focused),:host(.item-interactive.item-has-focus){--highlight-background:var(--highlight-color-focused)}:host(.item-interactive.ion-valid){--highlight-background:var(--highlight-color-valid)}:host(.item-interactive.ion-invalid){--highlight-background:var(--highlight-color-invalid)}:host(.item-interactive.ion-invalid) ::slotted([slot=helper]){display:none}::slotted([slot=error]){display:none;color:var(--highlight-color-invalid)}:host(.item-interactive.ion-invalid) ::slotted([slot=error]){display:block}:host(:not(.item-label)) ::slotted(ion-select.legacy-select){--padding-start:0;max-width:none}:host(.item-label-stacked) ::slotted(ion-select.legacy-select),:host(.item-label-floating) ::slotted(ion-select.legacy-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0;align-self:stretch;width:100%;max-width:100%}:host(:not(.item-label)) ::slotted(ion-datetime){--padding-start:0}:host(.item-label-stacked) ::slotted(ion-datetime),:host(.item-label-floating) ::slotted(ion-datetime){--padding-start:0;width:100%}:host(.item-multiple-inputs) ::slotted(ion-checkbox),:host(.item-multiple-inputs) ::slotted(ion-datetime),:host(.item-multiple-inputs) ::slotted(ion-radio),:host(.item-multiple-inputs) ::slotted(ion-select.legacy-select){position:relative}:host(.item-textarea){align-items:stretch}::slotted(ion-reorder[slot]){margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}:host(.item-fill-solid) ::slotted([slot=start]),:host(.item-fill-solid) ::slotted([slot=end]),:host(.item-fill-outline) ::slotted([slot=start]),:host(.item-fill-outline) ::slotted([slot=end]){align-self:center}::slotted([slot=helper]),::slotted([slot=error]),.item-counter{padding-top:5px;font-size:12px;z-index:1}.item-counter{-webkit-margin-start:auto;margin-inline-start:auto;color:var(--ion-color-step-550, #737373);white-space:nowrap;padding-inline-start:16px}@media (prefers-reduced-motion: reduce){.item-highlight,.item-inner-highlight{transition:none}}:host{--min-height:48px;--background:var(--ion-item-background, var(--ion-background-color, #fff));--background-activated:transparent;--background-focused:currentColor;--background-hover:currentColor;--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13))));--color:var(--ion-item-color, var(--ion-text-color, #000));--transition:opacity 15ms linear, background-color 15ms linear;--padding-start:16px;--inner-padding-end:16px;--inner-border-width:0 0 1px 0;--highlight-height:1px;--highlight-color-focused:var(--ion-color-primary, #3880ff);--highlight-color-valid:var(--ion-color-success, #2dd36f);--highlight-color-invalid:var(--ion-color-danger, #eb445a);font-size:16px;font-weight:normal;text-transform:none}:host(.item-fill-outline){--highlight-height:2px}:host(.item-fill-none.item-interactive.ion-focus) .item-highlight,:host(.item-fill-none.item-interactive.item-has-focus) .item-highlight,:host(.item-fill-none.item-interactive.ion-touched.ion-invalid) .item-highlight{transform:scaleX(1);border-width:0 0 var(--full-highlight-height) 0;border-style:var(--border-style);border-color:var(--highlight-background)}:host(.item-fill-none.item-interactive.ion-focus) .item-native,:host(.item-fill-none.item-interactive.item-has-focus) .item-native,:host(.item-fill-none.item-interactive.ion-touched.ion-invalid) .item-native{border-bottom-color:var(--highlight-background)}:host(.item-fill-outline.item-interactive.ion-focus) .item-highlight,:host(.item-fill-outline.item-interactive.item-has-focus) .item-highlight{transform:scaleX(1)}:host(.item-fill-outline.item-interactive.ion-focus) .item-highlight,:host(.item-fill-outline.item-interactive.item-has-focus) .item-highlight,:host(.item-fill-outline.item-interactive.ion-touched.ion-invalid) .item-highlight{border-width:var(--full-highlight-height);border-style:var(--border-style);border-color:var(--highlight-background)}:host(.item-fill-outline.item-interactive.ion-touched.ion-invalid) .item-native{border-color:var(--highlight-background)}:host(.item-fill-solid.item-interactive.ion-focus) .item-highlight,:host(.item-fill-solid.item-interactive.item-has-focus) .item-highlight,:host(.item-fill-solid.item-interactive.ion-touched.ion-invalid) .item-highlight{transform:scaleX(1);border-width:0 0 var(--full-highlight-height) 0;border-style:var(--border-style);border-color:var(--highlight-background)}:host(.item-fill-solid.item-interactive.ion-focus) .item-native,:host(.item-fill-solid.item-interactive.item-has-focus) .item-native,:host(.item-fill-solid.item-interactive.ion-touched.ion-invalid) .item-native{border-bottom-color:var(--highlight-background)}:host(.ion-color.ion-activated) .item-native::after{background:transparent}:host(.item-has-focus) .item-native{caret-color:var(--highlight-background)}:host(.item-interactive){--border-width:0 0 1px 0;--inner-border-width:0;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-full){--border-width:0 0 1px 0;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-inset){--inner-border-width:0 0 1px 0;--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-inset),:host(.item-lines-none){--border-width:0;--show-full-highlight:0}:host(.item-lines-full),:host(.item-lines-none){--inner-border-width:0;--show-inset-highlight:0}:host(.item-fill-outline) .item-highlight{--position-offset:calc(-1 * var(--border-width));top:var(--position-offset);width:calc(100% + 2 * var(--border-width));height:calc(100% + 2 * var(--border-width));transition:none}@supports (inset-inline-start: 0){:host(.item-fill-outline) .item-highlight{inset-inline-start:var(--position-offset)}}@supports not (inset-inline-start: 0){:host(.item-fill-outline) .item-highlight{left:var(--position-offset)}:host-context([dir=rtl]):host(.item-fill-outline) .item-highlight,:host-context([dir=rtl]).item-fill-outline .item-highlight{left:unset;right:unset;right:var(--position-offset)}@supports selector(:dir(rtl)){:host(.item-fill-outline) .item-highlight:dir(rtl){left:unset;right:unset;right:var(--position-offset)}}}:host(.item-fill-outline.ion-focused) .item-native,:host(.item-fill-outline.item-has-focus) .item-native{border-color:transparent}:host(.item-multi-line) ::slotted([slot=start]),:host(.item-multi-line) ::slotted([slot=end]){margin-top:16px;margin-bottom:16px;align-self:flex-start}::slotted([slot=start]){-webkit-margin-end:32px;margin-inline-end:32px}::slotted([slot=end]){-webkit-margin-start:32px;margin-inline-start:32px}:host(.item-fill-solid) ::slotted([slot=start]),:host(.item-fill-solid) ::slotted([slot=end]),:host(.item-fill-outline) ::slotted([slot=start]),:host(.item-fill-outline) ::slotted([slot=end]){align-self:center}::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);font-size:24px}:host(.ion-color:not(.item-fill-solid):not(.item-fill-outline)) ::slotted(ion-icon){color:var(--ion-color-contrast)}::slotted(ion-icon[slot]){margin-top:12px;margin-bottom:12px}::slotted(ion-icon[slot=start]){-webkit-margin-end:32px;margin-inline-end:32px}::slotted(ion-icon[slot=end]){-webkit-margin-start:16px;margin-inline-start:16px}:host(.item-fill-solid) ::slotted(ion-icon[slot=start]),:host(.item-fill-outline) ::slotted(ion-icon[slot=start]){-webkit-margin-end:8px;margin-inline-end:8px}::slotted(ion-toggle[slot=start]),::slotted(ion-toggle[slot=end]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}::slotted(ion-note){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;align-self:flex-start;font-size:11px}::slotted(ion-note[slot]:not([slot=helper]):not([slot=error])){padding-left:0;padding-right:0;padding-top:18px;padding-bottom:10px}::slotted(ion-note[slot=start]){-webkit-padding-end:16px;padding-inline-end:16px}::slotted(ion-note[slot=end]){-webkit-padding-start:16px;padding-inline-start:16px}::slotted(ion-avatar){width:40px;height:40px}::slotted(ion-thumbnail){--size:56px}::slotted(ion-avatar),::slotted(ion-thumbnail){margin-top:8px;margin-bottom:8px}::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){-webkit-margin-end:16px;margin-inline-end:16px}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){-webkit-margin-start:16px;margin-inline-start:16px}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:10px;margin-bottom:10px}:host(.item-label-stacked) ::slotted([slot=end]),:host(.item-label-floating) ::slotted([slot=end]){margin-top:7px;margin-bottom:7px}:host(.item-label-fixed) ::slotted(ion-select.legacy-select),:host(.item-label-fixed) ::slotted(ion-datetime){--padding-start:8px}:host(.item-toggle) ::slotted(ion-label),:host(.item-radio) ::slotted(ion-label){-webkit-margin-start:0;margin-inline-start:0}::slotted(.button-small){--padding-top:2px;--padding-bottom:2px;--padding-start:.6em;--padding-end:.6em;min-height:25px;font-size:12px}:host(.item-label-floating),:host(.item-label-stacked){--min-height:55px}:host(.item-label-stacked) ::slotted(ion-select.legacy-select),:host(.item-label-floating) ::slotted(ion-select.legacy-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0}:host(.ion-focused:not(.ion-color)) ::slotted(.label-stacked),:host(.ion-focused:not(.ion-color)) ::slotted(.label-floating),:host(.item-has-focus:not(.ion-color)) ::slotted(.label-stacked),:host(.item-has-focus:not(.ion-color)) ::slotted(.label-floating){color:var(--ion-color-primary, #3880ff)}:host(.ion-color){--highlight-color-focused:var(--ion-color-contrast)}:host(.item-label-color){--highlight-color-focused:var(--ion-color-base)}:host(.item-fill-solid.ion-color),:host(.item-fill-outline.ion-color){--highlight-color-focused:var(--ion-color-base)}:host(.item-fill-solid){--background:var(--ion-color-step-50, #f2f2f2);--background-hover:var(--ion-color-step-100, #e6e6e6);--background-focused:var(--ion-color-step-150, #d9d9d9);--border-width:0 0 1px 0;--inner-border-width:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl]):host(.item-fill-solid),:host-context([dir=rtl]).item-fill-solid{border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}@supports selector(:dir(rtl)){:host(.item-fill-solid):dir(rtl){border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}}:host(.item-fill-solid) .item-native{--border-color:var(--ion-color-step-500, gray)}:host(.item-fill-solid.ion-focused) .item-native,:host(.item-fill-solid.item-has-focus) .item-native{--background:var(--background-focused)}:host(.item-fill-solid.item-shape-round){border-top-left-radius:16px;border-top-right-radius:16px;border-bottom-right-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl]):host(.item-fill-solid.item-shape-round),:host-context([dir=rtl]).item-fill-solid.item-shape-round{border-top-left-radius:16px;border-top-right-radius:16px;border-bottom-right-radius:0;border-bottom-left-radius:0}@supports selector(:dir(rtl)){:host(.item-fill-solid.item-shape-round):dir(rtl){border-top-left-radius:16px;border-top-right-radius:16px;border-bottom-right-radius:0;border-bottom-left-radius:0}}@media (any-hover: hover){:host(.item-fill-solid:hover) .item-native{--background:var(--background-hover);--border-color:var(--ion-color-step-750, #404040)}}:host(.item-fill-outline){--ripple-color:transparent;--background-focused:transparent;--background-hover:transparent;--border-color:var(--ion-color-step-500, gray);--border-width:1px;border:none;overflow:visible}:host(.item-fill-outline) .item-native{--native-padding-left:16px;border-radius:4px}:host(.item-fill-outline.item-shape-round) .item-native{--inner-padding-start:16px;border-radius:28px}:host(.item-fill-outline.item-shape-round) .item-bottom{-webkit-padding-start:32px;padding-inline-start:32px}:host(.item-fill-outline.item-label-floating.ion-focused) .item-native ::slotted(ion-input:not(:first-child)),:host(.item-fill-outline.item-label-floating.ion-focused) .item-native ::slotted(ion-textarea:not(:first-child)),:host(.item-fill-outline.item-label-floating.item-has-focus) .item-native ::slotted(ion-input:not(:first-child)),:host(.item-fill-outline.item-label-floating.item-has-focus) .item-native ::slotted(ion-textarea:not(:first-child)),:host(.item-fill-outline.item-label-floating.item-has-value) .item-native ::slotted(ion-input:not(:first-child)),:host(.item-fill-outline.item-label-floating.item-has-value) .item-native ::slotted(ion-textarea:not(:first-child)){transform:translateY(-14px)}@media (any-hover: hover){:host(.item-fill-outline:hover) .item-native{--border-color:var(--ion-color-step-750, #404040)}}.item-counter{letter-spacing:0.0333333333em}';const Oi=class{constructor(e){t(this,e);this.labelColorStyles={};this.itemStyles=new Map;this.inheritedAriaAttributes={};this.multipleInputs=false;this.focusable=true;this.color=undefined;this.button=false;this.detail=undefined;this.detailIcon=W;this.disabled=false;this.download=undefined;this.fill=undefined;this.shape=undefined;this.href=undefined;this.rel=undefined;this.lines=undefined;this.counter=false;this.routerAnimation=undefined;this.routerDirection="forward";this.target=undefined;this.type="button";this.counterFormatter=undefined;this.counterString=undefined}counterFormatterChanged(){this.updateCounterOutput(this.getFirstInput())}handleIonInput(t){if(this.counter&&t.target===this.getFirstInput()){this.updateCounterOutput(t.target)}}labelColorChanged(t){const{color:e}=this;if(e===undefined){this.labelColorStyles=t.detail}}itemStyle(t){t.stopPropagation();const e=t.target.tagName;const i=t.detail;const n={};const o=this.itemStyles.get(e)||{};let s=false;Object.keys(i).forEach((t=>{if(i[t]){const e=`item-${t}`;if(!o[e]){s=true}n[e]=true}}));if(!s&&Object.keys(n).length!==Object.keys(o).length){s=true}if(s){this.itemStyles.set(e,n);a(this)}}connectedCallback(){if(this.counter){this.updateCounterOutput(this.getFirstInput())}this.hasStartEl()}componentWillLoad(){this.inheritedAriaAttributes=E(this.el,["aria-label"])}componentDidLoad(){const{el:t,counter:e,counterFormatter:i,fill:n,shape:o}=this;const s=t.querySelector('[slot="helper"]')!==null;if(s){j('The "helper" slot has been deprecated in favor of using the "helperText" property on ion-input or ion-textarea.',t)}const r=t.querySelector('[slot="error"]')!==null;if(r){j('The "error" slot has been deprecated in favor of using the "errorText" property on ion-input or ion-textarea.',t)}if(e===true){j('The "counter" property has been deprecated in favor of using the "counter" property on ion-input or ion-textarea.',t)}if(i!==undefined){j('The "counterFormatter" property has been deprecated in favor of using the "counterFormatter" property on ion-input or ion-textarea.',t)}if(n!==undefined){j('The "fill" property has been deprecated in favor of using the "fill" property on ion-input or ion-textarea.',t)}if(o!==undefined){j('The "shape" property has been deprecated in favor of using the "shape" property on ion-input or ion-textarea.',t)}A((()=>{this.setMultipleInputs();this.focusable=this.isFocusable()}))}setMultipleInputs(){const t=this.el.querySelectorAll("ion-checkbox, ion-datetime, ion-select, ion-radio");const e=this.el.querySelectorAll("ion-input, ion-range, ion-searchbar, ion-segment, ion-textarea, ion-toggle");const i=this.el.querySelectorAll("ion-anchor, ion-button, a, button");this.multipleInputs=t.length+e.length>1||t.length+i.length>1||t.length>0&&this.isClickable()}hasCover(){const t=this.el.querySelectorAll("ion-checkbox, ion-datetime, ion-select, ion-radio");return t.length===1&&!this.multipleInputs}isClickable(){return this.href!==undefined||this.button}canActivate(){return this.isClickable()||this.hasCover()}isFocusable(){const t=this.el.querySelector(".ion-focusable");return this.canActivate()||t!==null}getFirstInput(){const t=this.el.querySelectorAll("ion-input, ion-textarea");return t[0]}updateCounterOutput(t){var e,i;const{counter:n,counterFormatter:o,defaultCounterFormatter:s}=this;if(n&&!this.multipleInputs&&(t===null||t===void 0?void 0:t.maxlength)!==undefined){const n=(i=(e=t===null||t===void 0?void 0:t.value)===null||e===void 0?void 0:e.toString().length)!==null&&i!==void 0?i:0;if(o===undefined){this.counterString=s(n,t.maxlength)}else{try{this.counterString=o(n,t.maxlength)}catch(e){L("Exception in provided `counterFormatter`.",e);this.counterString=s(n,t.maxlength)}}}}defaultCounterFormatter(t,e){return`${t} / ${e}`}hasStartEl(){const t=this.el.querySelector('[slot="start"]');if(t!==null){this.el.classList.add("item-has-start-slot")}}render(){const{counterString:t,detail:n,detailIcon:o,download:s,fill:r,labelColorStyles:a,lines:l,disabled:h,href:c,rel:u,shape:d,target:f,routerAnimation:p,routerDirection:m,inheritedAriaAttributes:g}=this;const b={};const v=y(this);const w=this.isClickable();const x=this.canActivate();const _=w?c===undefined?"button":"a":"div";const k=_==="button"?{type:this.type}:{download:s,href:c,rel:u,target:f};const M=w?{onClick:t=>{R(c,t,m,p)}}:{};const z=n!==undefined?n:v==="ios"&&w;this.itemStyles.forEach((t=>{Object.assign(b,t)}));const S=h||b["item-interactive-disabled"]?"true":null;const C=r||"none";const E=B("ion-list",this.el);return e(i,{"aria-disabled":S,class:Object.assign(Object.assign(Object.assign({},b),a),N(this.color,{item:true,[v]:true,"item-lines-default":l===undefined,[`item-lines-${l}`]:l!==undefined,[`item-fill-${C}`]:true,[`item-shape-${d}`]:d!==undefined,"item-disabled":h,"in-list":E,"item-multiple-inputs":this.multipleInputs,"ion-activatable":x,"ion-focusable":this.focusable,"item-rtl":document.dir==="rtl"})),role:E?"listitem":null},e(_,Object.assign({},k,g,{class:"item-native",part:"native",disabled:h},M),e("slot",{name:"start"}),e("div",{class:"item-inner"},e("div",{class:"input-wrapper"},e("slot",null)),e("slot",{name:"end"}),z&&e("ion-icon",{icon:o,lazy:false,class:"item-detail-icon",part:"detail-icon","aria-hidden":"true","flip-rtl":o===W}),e("div",{class:"item-inner-highlight"})),x&&v==="md"&&e("ion-ripple-effect",null),e("div",{class:"item-highlight"})),e("div",{class:"item-bottom"},e("slot",{name:"error"}),e("slot",{name:"helper"}),t&&e("ion-note",{class:"item-counter"},t)))}static get delegatesFocus(){return true}get el(){return n(this)}static get watchers(){return{counterFormatter:["counterFormatterChanged"]}}};Oi.style={ios:$i,md:Fi};const Di=":host{--padding-top:0px;--padding-end:0px;--padding-bottom:0px;--padding-start:0px;--inner-padding-top:0px;--inner-padding-end:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;align-items:center;justify-content:space-between;width:100%;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:100;box-sizing:border-box}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.item-divider-sticky){position:sticky;top:0}.item-divider-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border:0;overflow:hidden}.item-divider-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:hidden}:host{--background:var(--ion-color-step-100, #e6e6e6);--color:var(--ion-color-step-850, #262626);--padding-start:16px;--inner-padding-end:8px;border-radius:0;position:relative;min-height:28px;font-size:17px;font-weight:600}:host([slot=start]){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:2px;margin-bottom:2px}::slotted(ion-icon[slot=start]),::slotted(ion-icon[slot=end]){margin-top:7px;margin-bottom:7px}::slotted(h1){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}::slotted(h2){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:17px;font-weight:normal}::slotted(h3),::slotted(h4),::slotted(h5),::slotted(h6){margin-left:0;margin-right:0;margin-top:0;margin-bottom:3px;font-size:14px;font-weight:normal;line-height:normal}::slotted(p){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.4);font-size:14px;line-height:normal;text-overflow:inherit;overflow:inherit}::slotted(h2:last-child) ::slotted(h3:last-child),::slotted(h4:last-child),::slotted(h5:last-child),::slotted(h6:last-child),::slotted(p:last-child){margin-bottom:0}";const ji=":host{--padding-top:0px;--padding-end:0px;--padding-bottom:0px;--padding-start:0px;--inner-padding-top:0px;--inner-padding-end:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;align-items:center;justify-content:space-between;width:100%;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:100;box-sizing:border-box}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.item-divider-sticky){position:sticky;top:0}.item-divider-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border:0;overflow:hidden}.item-divider-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:hidden}:host{--background:var(--ion-background-color, #fff);--color:var(--ion-color-step-400, #999999);--padding-start:16px;--inner-padding-end:16px;min-height:30px;border-bottom:1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13))));font-size:14px}::slotted([slot=start]){-webkit-margin-end:32px;margin-inline-end:32px}::slotted([slot=end]){-webkit-margin-start:32px;margin-inline-start:32px}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:13px;margin-bottom:10px}::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);font-size:24px}:host(.ion-color) ::slotted(ion-icon){color:var(--ion-color-contrast)}::slotted(ion-icon[slot]){margin-top:12px;margin-bottom:12px}::slotted(ion-icon[slot=start]){-webkit-margin-end:32px;margin-inline-end:32px}::slotted(ion-icon[slot=end]){-webkit-margin-start:16px;margin-inline-start:16px}::slotted(ion-note){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;align-self:flex-start;font-size:11px}::slotted(ion-note[slot]){padding-left:0;padding-right:0;padding-top:18px;padding-bottom:10px}::slotted(ion-note[slot=start]){-webkit-padding-end:16px;padding-inline-end:16px}::slotted(ion-note[slot=end]){-webkit-padding-start:16px;padding-inline-start:16px}::slotted(ion-avatar){width:40px;height:40px}::slotted(ion-thumbnail){--size:56px}::slotted(ion-avatar),::slotted(ion-thumbnail){margin-top:8px;margin-bottom:8px}::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){-webkit-margin-end:16px;margin-inline-end:16px}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){-webkit-margin-start:16px;margin-inline-start:16px}::slotted(h1){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}::slotted(h2){margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:16px;font-weight:normal}::slotted(h3,h4,h5,h6){margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:14px;font-weight:normal;line-height:normal}::slotted(p){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;color:var(--ion-color-step-600, #666666);font-size:14px;line-height:normal;text-overflow:inherit;overflow:inherit}";const Li=class{constructor(e){t(this,e);this.color=undefined;this.sticky=false}render(){const t=y(this);return e(i,{class:N(this.color,{[t]:true,"item-divider-sticky":this.sticky,item:true})},e("slot",{name:"start"}),e("div",{class:"item-divider-inner"},e("div",{class:"item-divider-wrapper"},e("slot",null)),e("slot",{name:"end"})))}get el(){return n(this)}};Li.style={ios:Di,md:ji};const Ri="ion-item-group{display:block}";const Ni="ion-item-group{display:block}";const Bi=class{constructor(e){t(this,e)}render(){const t=y(this);return e(i,{role:"group",class:{[t]:true,[`item-group-${t}`]:true,item:true}})}};Bi.style={ios:Ri,md:Ni};const Ui=".item.sc-ion-label-ios-h,.item .sc-ion-label-ios-h{--color:initial;display:block;color:var(--color);font-family:var(--ion-font-family, inherit);font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;box-sizing:border-box}.ion-color.sc-ion-label-ios-h{color:var(--ion-color-base)}.ion-text-wrap.sc-ion-label-ios-h,[text-wrap].sc-ion-label-ios-h{white-space:normal}.item-interactive-disabled.sc-ion-label-ios-h:not(.item-multiple-inputs),.item-interactive-disabled:not(.item-multiple-inputs) .sc-ion-label-ios-h{cursor:default;opacity:0.3;pointer-events:none}.item-input.sc-ion-label-ios-h,.item-input .sc-ion-label-ios-h{flex:initial;max-width:200px;pointer-events:none}.item-textarea.sc-ion-label-ios-h,.item-textarea .sc-ion-label-ios-h{align-self:baseline}.label-fixed.sc-ion-label-ios-h{flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.label-stacked.sc-ion-label-ios-h,.label-floating.sc-ion-label-ios-h{margin-bottom:0;align-self:stretch;width:auto;max-width:100%}.label-no-animate.label-floating.sc-ion-label-ios-h{transition:none}.sc-ion-label-ios-s h1,.sc-ion-label-ios-s h2,.sc-ion-label-ios-s h3,.sc-ion-label-ios-s h4,.sc-ion-label-ios-s h5,.sc-ion-label-ios-s h6{text-overflow:inherit;overflow:inherit}.ion-text-wrap.sc-ion-label-ios-h,[text-wrap].sc-ion-label-ios-h{font-size:14px;line-height:1.5}.label-stacked.sc-ion-label-ios-h{margin-bottom:4px;font-size:14px}.label-floating.sc-ion-label-ios-h{margin-bottom:0;transform:translate(0, 29px);transform-origin:left top;transition:transform 150ms ease-in-out}[dir=rtl].sc-ion-label-ios-h -no-combinator.label-floating.sc-ion-label-ios-h,[dir=rtl] .sc-ion-label-ios-h -no-combinator.label-floating.sc-ion-label-ios-h,[dir=rtl].label-floating.sc-ion-label-ios-h,[dir=rtl] .label-floating.sc-ion-label-ios-h{transform-origin:right top}@supports selector(:dir(rtl)){.label-floating.sc-ion-label-ios-h:dir(rtl){transform-origin:right top}}.item-textarea.label-floating.sc-ion-label-ios-h,.item-textarea .label-floating.sc-ion-label-ios-h{transform:translate(0, 28px)}.item-has-focus.label-floating.sc-ion-label-ios-h,.item-has-focus .label-floating.sc-ion-label-ios-h,.item-has-placeholder.sc-ion-label-ios-h:not(.item-input).label-floating,.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-ios-h,.item-has-value.label-floating.sc-ion-label-ios-h,.item-has-value .label-floating.sc-ion-label-ios-h{transform:scale(0.82)}.sc-ion-label-ios-s h1{margin-left:0;margin-right:0;margin-top:3px;margin-bottom:2px;font-size:22px;font-weight:normal}.sc-ion-label-ios-s h2{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:17px;font-weight:normal}.sc-ion-label-ios-s h3,.sc-ion-label-ios-s h4,.sc-ion-label-ios-s h5,.sc-ion-label-ios-s h6{margin-left:0;margin-right:0;margin-top:0;margin-bottom:3px;font-size:14px;font-weight:normal;line-height:normal}.sc-ion-label-ios-s p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:14px;line-height:normal;text-overflow:inherit;overflow:inherit}.sc-ion-label-ios-s>p{color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.4)}.sc-ion-label-ios-h.in-item-color.sc-ion-label-ios-s>p{color:inherit}.sc-ion-label-ios-s h2:last-child,.sc-ion-label-ios-s h3:last-child,.sc-ion-label-ios-s h4:last-child,.sc-ion-label-ios-s h5:last-child,.sc-ion-label-ios-s h6:last-child,.sc-ion-label-ios-s p:last-child{margin-bottom:0}";const qi='.item.sc-ion-label-md-h,.item .sc-ion-label-md-h{--color:initial;display:block;color:var(--color);font-family:var(--ion-font-family, inherit);font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;box-sizing:border-box}.ion-color.sc-ion-label-md-h{color:var(--ion-color-base)}.ion-text-wrap.sc-ion-label-md-h,[text-wrap].sc-ion-label-md-h{white-space:normal}.item-interactive-disabled.sc-ion-label-md-h:not(.item-multiple-inputs),.item-interactive-disabled:not(.item-multiple-inputs) .sc-ion-label-md-h{cursor:default;opacity:0.3;pointer-events:none}.item-input.sc-ion-label-md-h,.item-input .sc-ion-label-md-h{flex:initial;max-width:200px;pointer-events:none}.item-textarea.sc-ion-label-md-h,.item-textarea .sc-ion-label-md-h{align-self:baseline}.label-fixed.sc-ion-label-md-h{flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.label-stacked.sc-ion-label-md-h,.label-floating.sc-ion-label-md-h{margin-bottom:0;align-self:stretch;width:auto;max-width:100%}.label-no-animate.label-floating.sc-ion-label-md-h{transition:none}.sc-ion-label-md-s h1,.sc-ion-label-md-s h2,.sc-ion-label-md-s h3,.sc-ion-label-md-s h4,.sc-ion-label-md-s h5,.sc-ion-label-md-s h6{text-overflow:inherit;overflow:inherit}.ion-text-wrap.sc-ion-label-md-h,[text-wrap].sc-ion-label-md-h{line-height:1.5}.label-stacked.sc-ion-label-md-h,.label-floating.sc-ion-label-md-h{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;transform-origin:top left}.label-stacked.label-rtl.sc-ion-label-md-h,.label-floating.label-rtl.sc-ion-label-md-h{transform-origin:top right}.label-stacked.sc-ion-label-md-h{transform:translateY(50%) scale(0.75);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1)}.label-floating.sc-ion-label-md-h{transform:translateY(96%);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1)}.ion-focused.label-floating.sc-ion-label-md-h,.ion-focused .label-floating.sc-ion-label-md-h,.item-has-focus.label-floating.sc-ion-label-md-h,.item-has-focus .label-floating.sc-ion-label-md-h,.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating,.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h,.item-has-value.label-floating.sc-ion-label-md-h,.item-has-value .label-floating.sc-ion-label-md-h{transform:translateY(50%) scale(0.75)}.item-fill-outline.ion-focused.label-floating.sc-ion-label-md-h,.item-fill-outline.ion-focused .label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-focus.label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-focus .label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating,.item-fill-outline.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-value.label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-value .label-floating.sc-ion-label-md-h{transform:translateY(-6px) scale(0.75);position:relative;max-width:min-content;background-color:var(--ion-item-background, var(--ion-background-color, #fff));overflow:visible;z-index:3}.item-fill-outline.ion-focused.label-floating.sc-ion-label-md-h::before,.item-fill-outline.ion-focused .label-floating.sc-ion-label-md-h::before,.item-fill-outline.ion-focused.label-floating.sc-ion-label-md-h::after,.item-fill-outline.ion-focused .label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-focus.label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-focus .label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-focus.label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-focus .label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating::before,.item-fill-outline.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating::after,.item-fill-outline.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-value.label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-value .label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-value.label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-value .label-floating.sc-ion-label-md-h::after{position:absolute;width:4px;height:100%;background-color:var(--ion-item-background, var(--ion-background-color, #fff));content:""}.item-fill-outline.ion-focused.label-floating.sc-ion-label-md-h::before,.item-fill-outline.ion-focused .label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-focus.label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-focus .label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating::before,.item-fill-outline.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-value.label-floating.sc-ion-label-md-h::before,.item-fill-outline.item-has-value .label-floating.sc-ion-label-md-h::before{left:calc(-1 * 4px)}.item-fill-outline.ion-focused.label-floating.sc-ion-label-md-h::after,.item-fill-outline.ion-focused .label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-focus.label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-focus .label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating::after,.item-fill-outline.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-value.label-floating.sc-ion-label-md-h::after,.item-fill-outline.item-has-value .label-floating.sc-ion-label-md-h::after{right:calc(-1 * 4px)}.item-fill-outline.ion-focused.item-has-start-slot.label-floating.sc-ion-label-md-h,.item-fill-outline.ion-focused.item-has-start-slot .label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-focus.item-has-start-slot.label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-focus.item-has-start-slot .label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).item-has-start-slot.label-floating,.item-fill-outline.item-has-placeholder:not(.item-input).item-has-start-slot .label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-value.item-has-start-slot.label-floating.sc-ion-label-md-h,.item-fill-outline.item-has-value.item-has-start-slot .label-floating.sc-ion-label-md-h{transform:translateX(-32px) translateY(-6px) scale(0.75)}.item-fill-outline.ion-focused.item-has-start-slot.label-floating.label-rtl.sc-ion-label-md-h,.item-fill-outline.ion-focused.item-has-start-slot .label-floating.label-rtl.sc-ion-label-md-h,.item-fill-outline.item-has-focus.item-has-start-slot.label-floating.label-rtl.sc-ion-label-md-h,.item-fill-outline.item-has-focus.item-has-start-slot .label-floating.label-rtl.sc-ion-label-md-h,.item-fill-outline.item-has-placeholder.sc-ion-label-md-h:not(.item-input).item-has-start-slot.label-floating.label-rtl,.item-fill-outline.item-has-placeholder:not(.item-input).item-has-start-slot .label-floating.label-rtl.sc-ion-label-md-h,.item-fill-outline.item-has-value.item-has-start-slot.label-floating.label-rtl.sc-ion-label-md-h,.item-fill-outline.item-has-value.item-has-start-slot .label-floating.label-rtl.sc-ion-label-md-h{transform:translateX(calc(-1 * -32px)) translateY(-6px) scale(0.75)}.ion-focused.label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-focused .label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-focused.label-floating.sc-ion-label-md-h:not(.ion-color),.ion-focused .label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus.label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus .label-floating.sc-ion-label-md-h:not(.ion-color){color:var(--ion-color-primary, #3880ff)}.ion-focused.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-focused.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-focused.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.ion-focused.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color){color:var(--ion-color-contrast)}.item-fill-solid.ion-focused.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.ion-focused.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.ion-focused.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.ion-focused.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.ion-focused.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.ion-focused.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.ion-focused.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.ion-focused.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.item-has-focus.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.item-has-focus.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.item-has-focus.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-solid.item-has-focus.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.item-has-focus.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.item-has-focus.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.item-has-focus.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.item-fill-outline.item-has-focus.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color){color:var(--ion-color-base)}.ion-invalid.ion-touched.label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-invalid.ion-touched .label-stacked.sc-ion-label-md-h:not(.ion-color),.ion-invalid.ion-touched.label-floating.sc-ion-label-md-h:not(.ion-color),.ion-invalid.ion-touched .label-floating.sc-ion-label-md-h:not(.ion-color){color:var(--highlight-color-invalid)}.sc-ion-label-md-s h1{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}.sc-ion-label-md-s h2{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:16px;font-weight:normal}.sc-ion-label-md-s h3,.sc-ion-label-md-s h4,.sc-ion-label-md-s h5,.sc-ion-label-md-s h6{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:14px;font-weight:normal;line-height:normal}.sc-ion-label-md-s p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:14px;line-height:20px;text-overflow:inherit;overflow:inherit}.sc-ion-label-md-s>p{color:var(--ion-color-step-600, #666666)}.sc-ion-label-md-h.in-item-color.sc-ion-label-md-s>p{color:inherit}';const Vi=class{constructor(e){t(this,e);this.ionColor=s(this,"ionColor",7);this.ionStyle=s(this,"ionStyle",7);this.inRange=false;this.color=undefined;this.position=undefined;this.noAnimate=false}componentWillLoad(){this.inRange=!!this.el.closest("ion-range");this.noAnimate=this.position==="floating";this.emitStyle();this.emitColor()}componentDidLoad(){if(this.noAnimate){setTimeout((()=>{this.noAnimate=false}),1e3)}}colorChanged(){this.emitColor()}positionChanged(){this.emitStyle()}emitColor(){const{color:t}=this;this.ionColor.emit({"item-label-color":t!==undefined,[`ion-color-${t}`]:t!==undefined})}emitStyle(){const{inRange:t,position:e}=this;if(!t){this.ionStyle.emit({label:true,[`label-${e}`]:e!==undefined})}}render(){const t=this.position;const n=y(this);return e(i,{class:N(this.color,{[n]:true,"in-item-color":B("ion-item.ion-color",this.el),[`label-${t}`]:t!==undefined,[`label-no-animate`]:this.noAnimate,"label-rtl":document.dir==="rtl"})})}get el(){return n(this)}static get watchers(){return{color:["colorChanged"],position:["positionChanged"]}}};Vi.style={ios:Ui,md:qi};const Gi="ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}ion-list.list-inset{transform:translateZ(0);overflow:hidden}.list-ios{background:var(--ion-item-background, var(--ion-background-color, #fff))}.list-ios.list-inset{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px;border-radius:10px}.list-ios.list-inset ion-item:last-child{--border-width:0;--inner-border-width:0}.list-ios.list-inset+ion-list.list-inset{margin-top:0}.list-ios-lines-none .item-lines-default{--inner-border-width:0px;--border-width:0px}.list-ios-lines-full .item-lines-default{--inner-border-width:0px;--border-width:0 0 0.55px 0}.list-ios-lines-inset .item-lines-default{--inner-border-width:0 0 0.55px 0;--border-width:0px}ion-card .list-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";const Zi="ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}ion-list.list-inset{transform:translateZ(0);overflow:hidden}.list-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:8px;padding-bottom:8px;background:var(--ion-item-background, var(--ion-background-color, #fff))}@supports (inset-inline-start: 0){.list-md>.input:last-child::after{inset-inline-start:0}}@supports not (inset-inline-start: 0){.list-md>.input:last-child::after{left:0}:host-context([dir=rtl]) .list-md>.input:last-child::after{left:unset;right:unset;right:0}[dir=rtl] .list-md>.input:last-child::after{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){.list-md>.input:last-child::after:dir(rtl){left:unset;right:unset;right:0}}}.list-md.list-inset{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px;border-radius:2px}.list-md.list-inset ion-item:first-child{--border-radius:2px 2px 0 0}.list-md.list-inset ion-item:last-child{--border-radius:0 0 2px, 2px;--border-width:0;--inner-border-width:0}.list-md.list-inset+ion-list.list-inset{margin-top:0}.list-md-lines-none .item-lines-default{--inner-border-width:0px;--border-width:0px}.list-md-lines-full .item-lines-default{--inner-border-width:0px;--border-width:0 0 1px 0}.list-md-lines-inset .item-lines-default{--inner-border-width:0 0 1px 0;--border-width:0px}ion-card .list-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";const Wi=class{constructor(e){t(this,e);this.lines=undefined;this.inset=false}async closeSlidingItems(){const t=this.el.querySelector("ion-item-sliding");if(t===null||t===void 0?void 0:t.closeOpened){return t.closeOpened()}return false}render(){const t=y(this);const{lines:n,inset:o}=this;return e(i,{role:"list",class:{[t]:true,[`list-${t}`]:true,"list-inset":o,[`list-lines-${n}`]:n!==undefined,[`list-${t}-lines-${n}`]:n!==undefined}})}get el(){return n(this)}};Wi.style={ios:Gi,md:Zi};const Ji=":host{--border-style:solid;--border-width:0;--inner-border-width:0;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:flex;align-items:center;justify-content:space-between;width:100%;min-height:40px;border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);overflow:hidden}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}.list-header-inner{display:flex;position:relative;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);overflow:inherit;box-sizing:border-box}::slotted(ion-label){flex:1 1 auto}:host(.list-header-lines-inset),:host(.list-header-lines-none){--border-width:0}:host(.list-header-lines-full),:host(.list-header-lines-none){--inner-border-width:0}:host{--background:transparent;--color:var(--ion-color-step-850, #262626);--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, #c8c7cc)));-webkit-padding-start:calc(var(--ion-safe-area-left, 0px) + 16px);padding-inline-start:calc(var(--ion-safe-area-left, 0px) + 16px);position:relative;align-items:flex-end;font-size:22px;font-weight:700;letter-spacing:0}::slotted(ion-button),::slotted(ion-label){margin-top:29px;margin-bottom:6px}::slotted(ion-button){--padding-top:0;--padding-bottom:0;-webkit-margin-start:3px;margin-inline-start:3px;-webkit-margin-end:3px;margin-inline-end:3px;min-height:1.4em}:host(.list-header-lines-full){--border-width:0 0 0.55px 0}:host(.list-header-lines-inset){--inner-border-width:0 0 0.55px 0}";const Xi=":host{--border-style:solid;--border-width:0;--inner-border-width:0;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:flex;align-items:center;justify-content:space-between;width:100%;min-height:40px;border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);overflow:hidden}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}.list-header-inner{display:flex;position:relative;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);overflow:inherit;box-sizing:border-box}::slotted(ion-label){flex:1 1 auto}:host(.list-header-lines-inset),:host(.list-header-lines-none){--border-width:0}:host(.list-header-lines-full),:host(.list-header-lines-none){--inner-border-width:0}:host{--background:transparent;--color:var(--ion-text-color, #000);--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13))));-webkit-padding-start:calc(var(--ion-safe-area-left, 0) + 16px);padding-inline-start:calc(var(--ion-safe-area-left, 0) + 16px);min-height:45px;font-size:14px}:host(.list-header-lines-full){--border-width:0 0 1px 0}:host(.list-header-lines-inset){--inner-border-width:0 0 1px 0}";const Hi=class{constructor(e){t(this,e);this.color=undefined;this.lines=undefined}render(){const{lines:t}=this;const n=y(this);return e(i,{class:N(this.color,{[n]:true,[`list-header-lines-${t}`]:t!==undefined})},e("div",{class:"list-header-inner"},e("slot",null)))}};Hi.style={ios:Ji,md:Xi};const Ki=":host{--width:304px;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--background:var(--ion-background-color, #fff);left:0;right:0;top:0;bottom:0;display:none;position:absolute;contain:strict}:host(.show-menu){display:block}.menu-inner{transform:translateX(-9999px);display:flex;position:absolute;flex-direction:column;justify-content:space-between;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);contain:strict}:host(.menu-side-start) .menu-inner{--ion-safe-area-right:0px;top:0;bottom:0}@supports (inset-inline-start: 0){:host(.menu-side-start) .menu-inner{inset-inline-start:0;inset-inline-end:auto}}@supports not (inset-inline-start: 0){:host(.menu-side-start) .menu-inner{left:0;right:auto}:host-context([dir=rtl]):host(.menu-side-start) .menu-inner,:host-context([dir=rtl]).menu-side-start .menu-inner{left:unset;right:unset;left:auto;right:0}@supports selector(:dir(rtl)){:host(.menu-side-start) .menu-inner:dir(rtl){left:unset;right:unset;left:auto;right:0}}}:host(.menu-side-end) .menu-inner{--ion-safe-area-left:0px;top:0;bottom:0}@supports (inset-inline-start: 0){:host(.menu-side-end) .menu-inner{inset-inline-start:auto;inset-inline-end:0}}@supports not (inset-inline-start: 0){:host(.menu-side-end) .menu-inner{left:auto;right:0}:host-context([dir=rtl]):host(.menu-side-end) .menu-inner,:host-context([dir=rtl]).menu-side-end .menu-inner{left:unset;right:unset;left:0;right:auto}@supports selector(:dir(rtl)){:host(.menu-side-end) .menu-inner:dir(rtl){left:unset;right:unset;left:0;right:auto}}}ion-backdrop{display:none;opacity:0.01;z-index:-1}@media (max-width: 340px){.menu-inner{--width:264px}}:host(.menu-type-reveal){z-index:0}:host(.menu-type-reveal.show-menu) .menu-inner{transform:translate3d(0, 0, 0)}:host(.menu-type-overlay){z-index:1000}:host(.menu-type-overlay) .show-backdrop{display:block;cursor:pointer}:host(.menu-pane-visible){width:var(--width);min-width:var(--min-width);max-width:var(--max-width)}:host(.menu-pane-visible) .menu-inner{left:0;right:0;width:auto;transform:none !important;box-shadow:none !important}:host(.menu-pane-visible) ion-backdrop{display:hidden !important;}:host(.menu-type-push){z-index:1000}:host(.menu-type-push) .show-backdrop{display:block}";const Yi=":host{--width:304px;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--background:var(--ion-background-color, #fff);left:0;right:0;top:0;bottom:0;display:none;position:absolute;contain:strict}:host(.show-menu){display:block}.menu-inner{transform:translateX(-9999px);display:flex;position:absolute;flex-direction:column;justify-content:space-between;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);contain:strict}:host(.menu-side-start) .menu-inner{--ion-safe-area-right:0px;top:0;bottom:0}@supports (inset-inline-start: 0){:host(.menu-side-start) .menu-inner{inset-inline-start:0;inset-inline-end:auto}}@supports not (inset-inline-start: 0){:host(.menu-side-start) .menu-inner{left:0;right:auto}:host-context([dir=rtl]):host(.menu-side-start) .menu-inner,:host-context([dir=rtl]).menu-side-start .menu-inner{left:unset;right:unset;left:auto;right:0}@supports selector(:dir(rtl)){:host(.menu-side-start) .menu-inner:dir(rtl){left:unset;right:unset;left:auto;right:0}}}:host(.menu-side-end) .menu-inner{--ion-safe-area-left:0px;top:0;bottom:0}@supports (inset-inline-start: 0){:host(.menu-side-end) .menu-inner{inset-inline-start:auto;inset-inline-end:0}}@supports not (inset-inline-start: 0){:host(.menu-side-end) .menu-inner{left:auto;right:0}:host-context([dir=rtl]):host(.menu-side-end) .menu-inner,:host-context([dir=rtl]).menu-side-end .menu-inner{left:unset;right:unset;left:0;right:auto}@supports selector(:dir(rtl)){:host(.menu-side-end) .menu-inner:dir(rtl){left:unset;right:unset;left:0;right:auto}}}ion-backdrop{display:none;opacity:0.01;z-index:-1}@media (max-width: 340px){.menu-inner{--width:264px}}:host(.menu-type-reveal){z-index:0}:host(.menu-type-reveal.show-menu) .menu-inner{transform:translate3d(0, 0, 0)}:host(.menu-type-overlay){z-index:1000}:host(.menu-type-overlay) .show-backdrop{display:block;cursor:pointer}:host(.menu-pane-visible){width:var(--width);min-width:var(--min-width);max-width:var(--max-width)}:host(.menu-pane-visible) .menu-inner{left:0;right:0;width:auto;transform:none !important;box-shadow:none !important}:host(.menu-pane-visible) ion-backdrop{display:hidden !important;}:host(.menu-type-overlay) .menu-inner{box-shadow:4px 0px 16px rgba(0, 0, 0, 0.18)}";const Qi="cubic-bezier(0.32,0.72,0,1)";const tn="cubic-bezier(0.0,0.0,0.2,1)";const en="cubic-bezier(1, 0, 0.68, 0.28)";const nn="cubic-bezier(0.4, 0, 0.6, 1)";const on='[tabindex]:not([tabindex^="-"]), input:not([type=hidden]):not([tabindex^="-"]), textarea:not([tabindex^="-"]), button:not([tabindex^="-"]), select:not([tabindex^="-"]), .ion-focusable:not([tabindex^="-"])';const sn=class{constructor(e){t(this,e);this.ionWillOpen=s(this,"ionWillOpen",7);this.ionWillClose=s(this,"ionWillClose",7);this.ionDidOpen=s(this,"ionDidOpen",7);this.ionDidClose=s(this,"ionDidClose",7);this.ionMenuChange=s(this,"ionMenuChange",7);this.lastOnEnd=0;this.blocker=k.createBlocker({disableScroll:true});this.isAnimating=false;this._isOpen=false;this.inheritedAttributes={};this.handleFocus=t=>{const e=g(document);if(e&&!e.contains(this.el)){return}this.trapKeyboardFocus(t,document)};this.isPaneVisible=false;this.isEndSide=false;this.contentId=undefined;this.menuId=undefined;this.type=undefined;this.disabled=false;this.side="start";this.swipeGesture=true;this.maxEdgeStart=50}typeChanged(t,e){const i=this.contentEl;if(i){if(e!==undefined){i.classList.remove(`menu-content-${e}`)}i.classList.add(`menu-content-${t}`);i.removeAttribute("style")}if(this.menuInnerEl){this.menuInnerEl.removeAttribute("style")}this.animation=undefined}disabledChanged(){this.updateState();this.ionMenuChange.emit({disabled:this.disabled,open:this._isOpen})}sideChanged(){this.isEndSide=I(this.side);this.animation=undefined}swipeGestureChanged(){this.updateState()}async connectedCallback(){if(typeof customElements!=="undefined"&&customElements!=null){await customElements.whenDefined("ion-menu")}if(this.type===undefined){this.type=x.get("menuType","overlay")}const t=this.contentId!==undefined?document.getElementById(this.contentId):null;if(t===null){console.error('Menu: must have a "content" element to listen for drag events on.');return}if(this.el.contains(t)){console.error(`Menu: "contentId" should refer to the main view's ion-content, not the ion-content inside of the ion-menu.`)}this.contentEl=t;t.classList.add("menu-content");this.typeChanged(this.type,undefined);this.sideChanged();ot._register(this);this.gesture=(await import("./p-f2599c25.js")).createGesture({el:document,gestureName:"menu-swipe",gesturePriority:30,threshold:10,blurOnStart:true,canStart:t=>this.canStart(t),onWillStart:()=>this.onWillStart(),onStart:()=>this.onStart(),onMove:t=>this.onMove(t),onEnd:t=>this.onEnd(t)});this.updateState()}componentWillLoad(){this.inheritedAttributes=z(this.el)}async componentDidLoad(){this.ionMenuChange.emit({disabled:this.disabled,open:this._isOpen});this.updateState()}async disconnectedCallback(){await this.close(false);this.blocker.destroy();ot._unregister(this);if(this.animation){this.animation.destroy()}if(this.gesture){this.gesture.destroy();this.gesture=undefined}this.animation=undefined;this.contentEl=undefined}onSplitPaneChanged(t){this.isPaneVisible=t.detail.isPane(this.el);this.updateState()}onBackdropClick(t){if(this._isOpen&&this.lastOnEnd<t.timeStamp-100){const e=t.composedPath?!t.composedPath().includes(this.menuInnerEl):false;if(e){t.preventDefault();t.stopPropagation();this.close()}}}onKeydown(t){if(t.key==="Escape"){this.close()}}isOpen(){return Promise.resolve(this._isOpen)}isActive(){return Promise.resolve(this._isActive())}open(t=true){return this.setOpen(true,t)}close(t=true){return this.setOpen(false,t)}toggle(t=true){return this.setOpen(!this._isOpen,t)}setOpen(t,e=true){return ot._setOpen(this,t,e)}focusFirstDescendant(){const{el:t}=this;const e=t.querySelector(on);if(e){e.focus()}else{t.focus()}}focusLastDescendant(){const{el:t}=this;const e=Array.from(t.querySelectorAll(on));const i=e.length>0?e[e.length-1]:null;if(i){i.focus()}else{t.focus()}}trapKeyboardFocus(t,e){const i=t.target;if(!i){return}if(this.el.contains(i)){this.lastFocus=i}else{this.focusFirstDescendant();if(this.lastFocus===e.activeElement){this.focusLastDescendant()}}}async _setOpen(t,e=true){if(!this._isActive()||this.isAnimating||t===this._isOpen){return false}this.beforeAnimation(t);await this.loadAnimation();await this.startAnimation(t,e);this.afterAnimation(t);return true}async loadAnimation(){const t=this.menuInnerEl.offsetWidth;const e=I(this.side);if(t===this.width&&this.animation!==undefined&&e===this.isEndSide){return}this.width=t;this.isEndSide=e;if(this.animation){this.animation.destroy();this.animation=undefined}this.animation=await ot._createAnimation(this.type,this);if(!x.getBoolean("animated",true)){this.animation.duration(0)}this.animation.fill("both")}async startAnimation(t,e){const i=!t;const n=y(this);const o=n==="ios"?Qi:tn;const s=n==="ios"?en:nn;const r=this.animation.direction(i?"reverse":"normal").easing(i?s:o).onFinish((()=>{if(r.getDirection()==="reverse"){r.direction("normal")}}));if(e){await r.play()}else{r.play({sync:true})}}_isActive(){return!this.disabled&&!this.isPaneVisible}canSwipe(){return this.swipeGesture&&!this.isAnimating&&this._isActive()}canStart(t){const e=!!document.querySelector("ion-modal.show-modal");if(e||!this.canSwipe()){return false}if(this._isOpen){return true}else if(ot._getOpenSync()){return false}return an(window,t.currentX,this.isEndSide,this.maxEdgeStart)}onWillStart(){this.beforeAnimation(!this._isOpen);return this.loadAnimation()}onStart(){if(!this.isAnimating||!this.animation){T(false,"isAnimating has to be true");return}this.animation.progressStart(true,this._isOpen?1:0)}onMove(t){if(!this.isAnimating||!this.animation){T(false,"isAnimating has to be true");return}const e=rn(t.deltaX,this._isOpen,this.isEndSide);const i=e/this.width;this.animation.progressStep(this._isOpen?1-i:i)}onEnd(t){if(!this.isAnimating||!this.animation){T(false,"isAnimating has to be true");return}const e=this._isOpen;const i=this.isEndSide;const n=rn(t.deltaX,e,i);const o=this.width;const s=n/o;const r=t.velocityX;const a=o/2;const l=r>=0&&(r>.2||t.deltaX>a);const h=r<=0&&(r<-.2||t.deltaX<-a);const c=e?i?l:h:i?h:l;let u=!e&&c;if(e&&!c){u=true}this.lastOnEnd=t.currentTime;let d=c?.001:-.001;const f=s<0?.01:s;d+=it([0,0],[.4,0],[.6,1],[1,1],C(0,f,.9999))[0]||0;const p=this._isOpen?!c:c;this.animation.easing("cubic-bezier(0.4, 0.0, 0.6, 1)").onFinish((()=>this.afterAnimation(u)),{oneTimeCallback:true}).progressEnd(p?1:0,this._isOpen?1-d:d,300)}beforeAnimation(t){T(!this.isAnimating,"_before() should not be called while animating");this.el.classList.add(ln);this.el.setAttribute("tabindex","0");if(this.backdropEl){this.backdropEl.classList.add(hn)}if(this.contentEl){this.contentEl.classList.add(cn);this.contentEl.setAttribute("aria-hidden","true")}this.blocker.block();this.isAnimating=true;if(t){this.ionWillOpen.emit()}else{this.ionWillClose.emit()}}afterAnimation(t){var e;T(this.isAnimating,"_before() should be called while animating");this._isOpen=t;this.isAnimating=false;if(!this._isOpen){this.blocker.unblock()}if(t){this.ionDidOpen.emit();const t=(e=document.activeElement)===null||e===void 0?void 0:e.closest("ion-menu");if(t!==this.el){this.el.focus()}document.addEventListener("focus",this.handleFocus,true)}else{this.el.classList.remove(ln);this.el.removeAttribute("tabindex");if(this.contentEl){this.contentEl.classList.remove(cn);this.contentEl.removeAttribute("aria-hidden")}if(this.backdropEl){this.backdropEl.classList.remove(hn)}if(this.animation){this.animation.stop()}this.ionDidClose.emit();document.removeEventListener("focus",this.handleFocus,true)}}updateState(){const t=this._isActive();if(this.gesture){this.gesture.enable(t&&this.swipeGesture)}if(!t&&this._isOpen){this.forceClosing()}if(nt===null||nt===void 0?void 0:nt.contains(this.el)){if(!this.disabled){ot._setActiveMenu(this)}}T(!this.isAnimating,"can not be animating")}forceClosing(){T(this._isOpen,"menu cannot be closed");this.isAnimating=true;const t=this.animation.direction("reverse");t.play({sync:true});this.afterAnimation(false)}render(){const{type:t,disabled:n,isPaneVisible:o,inheritedAttributes:s,side:r}=this;const a=y(this);return e(i,{role:"navigation","aria-label":s["aria-label"]||"menu",class:{[a]:true,[`menu-type-${t}`]:true,"menu-enabled":!n,[`menu-side-${r}`]:true,"menu-pane-visible":o}},e("div",{class:"menu-inner",part:"container",ref:t=>this.menuInnerEl=t},e("slot",null)),e("ion-backdrop",{ref:t=>this.backdropEl=t,class:"menu-backdrop",tappable:false,stopPropagation:false,part:"backdrop"}))}get el(){return n(this)}static get watchers(){return{type:["typeChanged"],disabled:["disabledChanged"],side:["sideChanged"],swipeGesture:["swipeGestureChanged"]}}};const rn=(t,e,i)=>Math.max(0,e!==i?-t:t);const an=(t,e,i,n)=>{if(i){return e>=t.innerWidth-n}else{return e<=n}};const ln="show-menu";const hn="show-backdrop";const cn="menu-content-open";sn.style={ios:Ki,md:Yi};const un=":host(.menu-toggle-hidden){display:none}";const dn=class{constructor(e){t(this,e);this.onClick=()=>ot.toggle(this.menu);this.visible=false;this.menu=undefined;this.autoHide=true}connectedCallback(){this.visibilityChanged()}async visibilityChanged(){this.visible=await st(this.menu)}render(){const t=y(this);const n=this.autoHide&&!this.visible;return e(i,{onClick:this.onClick,"aria-hidden":n?"true":null,class:{[t]:true,"menu-toggle-hidden":n}},e("slot",null))}};dn.style=un;const fn=":host{color:var(--color);font-family:var(--ion-font-family, inherit);box-sizing:border-box}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-color-step-350, #a6a6a6)}";const pn=":host{color:var(--color);font-family:var(--ion-font-family, inherit);box-sizing:border-box}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-color-step-600, #666666);font-size:14px}";const mn=class{constructor(e){t(this,e);this.color=undefined}render(){const t=y(this);return e(i,{class:N(this.color,{[t]:true})},e("slot",null))}};mn.style={ios:fn,md:pn};const gn=':host{--inner-border-radius:50%;display:inline-block;position:relative;box-sizing:border-box;max-width:100%;min-height:inherit;user-select:none;z-index:2}:host(:not(.legacy-radio)){cursor:pointer}:host(.radio-disabled){pointer-events:none}.radio-icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%;contain:layout size style}.radio-icon,.radio-inner{box-sizing:border-box}:host(.legacy-radio) label{top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;appearance:none;outline:none;display:flex;align-items:center;opacity:0}@supports (inset-inline-start: 0){:host(.legacy-radio) label{inset-inline-start:0}}@supports not (inset-inline-start: 0){:host(.legacy-radio) label{left:0}:host-context([dir=rtl]):host(.legacy-radio) label,:host-context([dir=rtl]).legacy-radio label{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){:host(.legacy-radio) label:dir(rtl){left:unset;right:unset;right:0}}}:host(.legacy-radio) label::-moz-focus-inner{border:0}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}:host(:focus){outline:none}:host(.in-item:not(.legacy-radio)){width:100%;height:100%}:host([slot=start]:not(.legacy-radio)),:host([slot=end]:not(.legacy-radio)){width:auto}.radio-wrapper{display:flex;position:relative;flex-grow:1;align-items:center;height:inherit;min-height:inherit;cursor:inherit}.label-text-wrapper{pointer-events:none;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item:not(.legacy-radio)) .label-text-wrapper{margin-top:10px;margin-bottom:10px}.label-text-wrapper-hidden{display:none}.native-wrapper{display:flex;align-items:center}:host(.radio-justify-space-between) .radio-wrapper{justify-content:space-between}:host(.radio-justify-start) .radio-wrapper{justify-content:start}:host(.radio-justify-end) .radio-wrapper{justify-content:end}:host(.radio-label-placement-start) .radio-wrapper{flex-direction:row}:host(.radio-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.radio-label-placement-end) .radio-wrapper{flex-direction:row-reverse}:host(.radio-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.radio-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.radio-label-placement-fixed) .label-text-wrapper{flex:0 0 100px;width:100px;min-width:100px}:host{--color-checked:var(--ion-color-primary, #3880ff)}:host(.legacy-radio){width:15px;height:24px}:host(.ion-color.radio-checked) .radio-inner{border-color:var(--ion-color-base)}.item-radio.item-ios ion-label{-webkit-margin-start:0;margin-inline-start:0}.radio-inner{width:33%;height:50%}:host(.radio-checked) .radio-inner{transform:rotate(45deg);border-width:2px;border-top-width:0;border-left-width:0;border-style:solid;border-color:var(--color-checked)}:host(.radio-disabled){opacity:0.3}:host(.ion-focused) .radio-icon::after{border-radius:var(--inner-border-radius);top:-8px;display:block;position:absolute;width:36px;height:36px;background:var(--ion-color-primary-tint, #4c8dff);content:"";opacity:0.2}@supports (inset-inline-start: 0){:host(.ion-focused) .radio-icon::after{inset-inline-start:-9px}}@supports not (inset-inline-start: 0){:host(.ion-focused) .radio-icon::after{left:-9px}:host-context([dir=rtl]):host(.ion-focused) .radio-icon::after,:host-context([dir=rtl]).ion-focused .radio-icon::after{left:unset;right:unset;right:-9px}@supports selector(:dir(rtl)){:host(.ion-focused) .radio-icon::after:dir(rtl){left:unset;right:unset;right:-9px}}}:host(.in-item.legacy-radio){-webkit-margin-start:8px;margin-inline-start:8px;-webkit-margin-end:11px;margin-inline-end:11px;margin-top:8px;margin-bottom:8px;display:block;position:static}:host(.in-item.legacy-radio[slot=start]){-webkit-margin-start:3px;margin-inline-start:3px;-webkit-margin-end:21px;margin-inline-end:21px;margin-top:8px;margin-bottom:8px}.native-wrapper .radio-icon{width:15px;height:24px}';const bn=':host{--inner-border-radius:50%;display:inline-block;position:relative;box-sizing:border-box;max-width:100%;min-height:inherit;user-select:none;z-index:2}:host(:not(.legacy-radio)){cursor:pointer}:host(.radio-disabled){pointer-events:none}.radio-icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%;contain:layout size style}.radio-icon,.radio-inner{box-sizing:border-box}:host(.legacy-radio) label{top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;appearance:none;outline:none;display:flex;align-items:center;opacity:0}@supports (inset-inline-start: 0){:host(.legacy-radio) label{inset-inline-start:0}}@supports not (inset-inline-start: 0){:host(.legacy-radio) label{left:0}:host-context([dir=rtl]):host(.legacy-radio) label,:host-context([dir=rtl]).legacy-radio label{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){:host(.legacy-radio) label:dir(rtl){left:unset;right:unset;right:0}}}:host(.legacy-radio) label::-moz-focus-inner{border:0}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}:host(:focus){outline:none}:host(.in-item:not(.legacy-radio)){width:100%;height:100%}:host([slot=start]:not(.legacy-radio)),:host([slot=end]:not(.legacy-radio)){width:auto}.radio-wrapper{display:flex;position:relative;flex-grow:1;align-items:center;height:inherit;min-height:inherit;cursor:inherit}.label-text-wrapper{pointer-events:none;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item:not(.legacy-radio)) .label-text-wrapper{margin-top:10px;margin-bottom:10px}.label-text-wrapper-hidden{display:none}.native-wrapper{display:flex;align-items:center}:host(.radio-justify-space-between) .radio-wrapper{justify-content:space-between}:host(.radio-justify-start) .radio-wrapper{justify-content:start}:host(.radio-justify-end) .radio-wrapper{justify-content:end}:host(.radio-label-placement-start) .radio-wrapper{flex-direction:row}:host(.radio-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.radio-label-placement-end) .radio-wrapper{flex-direction:row-reverse}:host(.radio-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.radio-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.radio-label-placement-fixed) .label-text-wrapper{flex:0 0 100px;width:100px;min-width:100px}:host{--color:rgb(var(--ion-text-color-rgb, 0, 0, 0), 0.6);--color-checked:var(--ion-color-primary, #3880ff);--border-width:2px;--border-style:solid;--border-radius:50%}:host(.legacy-radio){width:20px;height:20px}:host(.ion-color) .radio-inner{background:var(--ion-color-base)}:host(.ion-color.radio-checked) .radio-icon{border-color:var(--ion-color-base)}.radio-icon{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--color)}.radio-inner{border-radius:var(--inner-border-radius);width:calc(50% + var(--border-width));height:calc(50% + var(--border-width));transform:scale3d(0, 0, 0);transition:transform 280ms cubic-bezier(0.4, 0, 0.2, 1);background:var(--color-checked)}:host(.radio-checked) .radio-icon{border-color:var(--color-checked)}:host(.radio-checked) .radio-inner{transform:scale3d(1, 1, 1)}:host(.legacy-radio.radio-disabled),:host(.radio-disabled) .label-text-wrapper{opacity:0.38}:host(.radio-disabled) .native-wrapper{opacity:0.63}:host(.ion-focused.legacy-radio) .radio-icon::after{top:-12px}@supports (inset-inline-start: 0){:host(.ion-focused.legacy-radio) .radio-icon::after{inset-inline-start:-12px}}@supports not (inset-inline-start: 0){:host(.ion-focused.legacy-radio) .radio-icon::after{left:-12px}:host-context([dir=rtl]):host(.ion-focused.legacy-radio) .radio-icon::after,:host-context([dir=rtl]).ion-focused.legacy-radio .radio-icon::after{left:unset;right:unset;right:-12px}@supports selector(:dir(rtl)){:host(.ion-focused.legacy-radio) .radio-icon::after:dir(rtl){left:unset;right:unset;right:-12px}}}:host(.ion-focused) .radio-icon::after{border-radius:var(--inner-border-radius);display:block;position:absolute;width:36px;height:36px;background:var(--ion-color-primary-tint, #4c8dff);content:"";opacity:0.2}:host(.in-item.legacy-radio){margin-left:0;margin-right:0;margin-top:9px;margin-bottom:9px;display:block;position:static}:host(.in-item.legacy-radio[slot=start]){-webkit-margin-start:4px;margin-inline-start:4px;-webkit-margin-end:36px;margin-inline-end:36px;margin-top:11px;margin-bottom:10px}.native-wrapper .radio-icon{width:20px;height:20px}';const vn=class{constructor(e){t(this,e);this.ionStyle=s(this,"ionStyle",7);this.ionFocus=s(this,"ionFocus",7);this.ionBlur=s(this,"ionBlur",7);this.inputId=`ion-rb-${wn++}`;this.radioGroup=null;this.inheritedAttributes={};this.hasLoggedDeprecationWarning=false;this.updateState=()=>{if(this.radioGroup){this.checked=this.radioGroup.value===this.value}};this.onClick=()=>{this.checked=this.nativeInput.checked};this.onFocus=()=>{this.ionFocus.emit()};this.onBlur=()=>{this.ionBlur.emit()};this.checked=false;this.buttonTabindex=-1;this.color=undefined;this.name=this.inputId;this.disabled=false;this.value=undefined;this.labelPlacement="start";this.legacy=undefined;this.justify="space-between"}valueChanged(){this.updateState()}async setFocus(t){t.stopPropagation();t.preventDefault();const e=this.legacyFormController.hasLegacyControl()?this.el:this.nativeInput;e.focus()}async setButtonTabindex(t){this.buttonTabindex=t}connectedCallback(){this.legacyFormController=rt(this.el);if(this.value===undefined){this.value=this.inputId}const t=this.radioGroup=this.el.closest("ion-radio-group");if(t){this.updateState();P(t,"ionValueChange",this.updateState)}}disconnectedCallback(){const t=this.radioGroup;if(t){$(t,"ionValueChange",this.updateState);this.radioGroup=null}}componentWillLoad(){this.emitStyle();if(!this.legacyFormController.hasLegacyControl()){this.inheritedAttributes=Object.assign({},z(this.el))}}styleChanged(){this.emitStyle()}emitStyle(){const t={"interactive-disabled":this.disabled};if(this.legacyFormController.hasLegacyControl()){t["radio-checked"]=this.checked}this.ionStyle.emit(t)}get hasLabel(){return this.el.textContent!==""}renderRadioControl(){return e("div",{class:"radio-icon",part:"container"},e("div",{class:"radio-inner",part:"mark"}),e("div",{class:"radio-ripple"}))}render(){const{legacyFormController:t}=this;return t.hasLegacyControl()?this.renderLegacyRadio():this.renderRadio()}renderRadio(){const{checked:t,disabled:n,inputId:o,color:s,el:r,justify:a,labelPlacement:l,inheritedAttributes:h,hasLabel:c,buttonTabindex:u}=this;const d=y(this);const f=B("ion-item",r);return e(i,{onClick:this.onClick,class:N(s,{[d]:true,"in-item":f,"radio-checked":t,"radio-disabled":n,[`radio-justify-${a}`]:true,[`radio-label-placement-${l}`]:true,"ion-activatable":!f,"ion-focusable":!f})},e("label",{class:"radio-wrapper"},e("input",Object.assign({type:"radio",checked:t,disabled:n,id:o,tabindex:u,ref:t=>this.nativeInput=t},h)),e("div",{class:{"label-text-wrapper":true,"label-text-wrapper-hidden":!c}},e("slot",null)),e("div",{class:"native-wrapper"},this.renderRadioControl())))}renderLegacyRadio(){if(!this.hasLoggedDeprecationWarning){j(`ion-radio now requires providing a label with either the default slot or the "aria-label" attribute. To migrate, remove any usage of "ion-label" and pass the label text to either the component or the "aria-label" attribute.\n\nExample: <ion-radio>Option Label</ion-radio>\nExample with aria-label: <ion-radio aria-label="Option Label"></ion-radio>\n\nDevelopers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.`,this.el);if(this.legacy){j(`ion-radio is being used with the "legacy" property enabled which will forcibly enable the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.\n\nDevelopers can dismiss this warning by removing their usage of the "legacy" property and using the new radio syntax.`,this.el)}this.hasLoggedDeprecationWarning=true}const{inputId:t,disabled:n,checked:o,color:s,el:r,buttonTabindex:a}=this;const l=y(this);const{label:h,labelId:c,labelText:u}=F(r,t);return e(i,{"aria-checked":`${o}`,"aria-hidden":n?"true":null,"aria-labelledby":h?c:null,role:"radio",tabindex:a,onFocus:this.onFocus,onBlur:this.onBlur,onClick:this.onClick,class:N(s,{[l]:true,"in-item":B("ion-item",r),interactive:true,"radio-checked":o,"radio-disabled":n,"legacy-radio":true})},this.renderRadioControl(),e("label",{htmlFor:t},u),e("input",{type:"radio",checked:o,disabled:n,tabindex:"-1",id:t,ref:t=>this.nativeInput=t}))}get el(){return n(this)}static get watchers(){return{value:["valueChanged"],checked:["styleChanged"],color:["styleChanged"],disabled:["styleChanged"]}}};let wn=0;vn.style={ios:gn,md:bn};const yn=class{constructor(e){t(this,e);this.ionChange=s(this,"ionChange",7);this.ionValueChange=s(this,"ionValueChange",7);this.inputId=`ion-rg-${xn++}`;this.labelId=`${this.inputId}-lbl`;this.setRadioTabindex=t=>{const e=this.getRadios();const i=e.find((t=>!t.disabled));const n=e.find((e=>e.value===t&&!e.disabled));if(!i&&!n){return}const o=n||i;for(const t of e){const e=t===o?0:-1;t.setButtonTabindex(e)}};this.onClick=t=>{t.preventDefault();const e=t.target&&t.target.closest("ion-radio");if(e){const i=this.value;const n=e.value;if(n!==i){this.value=n;this.emitValueChange(t)}else if(this.allowEmptySelection){this.value=undefined;this.emitValueChange(t)}}};this.allowEmptySelection=false;this.name=this.inputId;this.value=undefined}valueChanged(t){this.setRadioTabindex(t);this.ionValueChange.emit({value:t})}componentDidLoad(){this.setRadioTabindex(this.value)}async connectedCallback(){const t=this.el.querySelector("ion-list-header")||this.el.querySelector("ion-item-divider");if(t){const e=this.label=t.querySelector("ion-label");if(e){this.labelId=e.id=this.name+"-lbl"}}}getRadios(){return Array.from(this.el.querySelectorAll("ion-radio"))}emitValueChange(t){const{value:e}=this;this.ionChange.emit({value:e,event:t})}onKeydown(t){const e=!!this.el.closest("ion-select-popover");if(t.target&&!this.el.contains(t.target)){return}const i=this.getRadios().filter((t=>!t.disabled));if(t.target&&i.includes(t.target)){const n=i.findIndex((e=>e===t.target));const o=i[n];let s;if(["ArrowDown","ArrowRight"].includes(t.key)){s=n===i.length-1?i[0]:i[n+1]}if(["ArrowUp","ArrowLeft"].includes(t.key)){s=n===0?i[i.length-1]:i[n-1]}if(s&&i.includes(s)){s.setFocus(t);if(!e){this.value=s.value;this.emitValueChange(t)}}if([" "].includes(t.key)){const e=this.value;this.value=this.allowEmptySelection&&this.value!==undefined?undefined:o.value;if(e!==this.value||this.allowEmptySelection){this.emitValueChange(t)}t.preventDefault()}}}render(){const{label:t,labelId:n,el:o,name:s,value:r}=this;const a=y(this);O(true,o,s,r,false);return e(i,{role:"radiogroup","aria-labelledby":t?n:null,onClick:this.onClick,class:a})}get el(){return n(this)}static get watchers(){return{value:["valueChanged"]}}};let xn=0;const _n=":host{left:0;right:0;top:0;bottom:0;position:absolute;contain:strict;pointer-events:none}:host(.unbounded){contain:layout size style}.ripple-effect{border-radius:50%;position:absolute;background-color:currentColor;color:inherit;contain:strict;opacity:0;animation:225ms rippleAnimation forwards, 75ms fadeInAnimation forwards;will-change:transform, opacity;pointer-events:none}.fade-out{transform:translate(var(--translate-end)) scale(var(--final-scale, 1));animation:150ms fadeOutAnimation forwards}@keyframes rippleAnimation{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:scale(1)}to{transform:translate(var(--translate-end)) scale(var(--final-scale, 1))}}@keyframes fadeInAnimation{from{animation-timing-function:linear;opacity:0}to{opacity:0.16}}@keyframes fadeOutAnimation{from{animation-timing-function:linear;opacity:0.16}to{opacity:0}}";const kn=class{constructor(e){t(this,e);this.type="bounded"}async addRipple(t,e){return new Promise((i=>{r((()=>{const n=this.el.getBoundingClientRect();const o=n.width;const s=n.height;const r=Math.sqrt(o*o+s*s);const a=Math.max(s,o);const h=this.unbounded?a:r+zn;const c=Math.floor(a*Sn);const u=h/c;let d=t-n.left;let f=e-n.top;if(this.unbounded){d=o*.5;f=s*.5}const p=d-c*.5;const m=f-c*.5;const g=o*.5-d;const b=s*.5-f;l((()=>{const t=document.createElement("div");t.classList.add("ripple-effect");const e=t.style;e.top=m+"px";e.left=p+"px";e.width=e.height=c+"px";e.setProperty("--final-scale",`${u}`);e.setProperty("--translate-end",`${g}px, ${b}px`);const n=this.el.shadowRoot||this.el;n.appendChild(t);setTimeout((()=>{i((()=>{Mn(t)}))}),225+100)}))}))}))}get unbounded(){return this.type==="unbounded"}render(){const t=y(this);return e(i,{role:"presentation",class:{[t]:true,unbounded:this.unbounded}})}get el(){return n(this)}};const Mn=t=>{t.classList.add("fade-out");setTimeout((()=>{t.remove()}),200)};const zn=10;const Sn=.5;kn.style=_n;const Cn=".sc-ion-searchbar-ios-h{--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:0.6;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:flex;position:relative;align-items:center;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);box-sizing:border-box}.ion-color.sc-ion-searchbar-ios-h{color:var(--ion-color-contrast)}.ion-color.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{background:var(--ion-color-base)}.ion-color.sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios,.ion-color.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.ion-color.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{color:inherit}.searchbar-search-icon.sc-ion-searchbar-ios{color:var(--icon-color);pointer-events:none}.searchbar-input-container.sc-ion-searchbar-ios{display:block;position:relative;flex-shrink:1;width:100%}.searchbar-input.sc-ion-searchbar-ios{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;border-radius:var(--border-radius);display:block;width:100%;border:0;outline:none;background:var(--background);font-family:inherit;box-shadow:var(--box-shadow);box-sizing:border-box;appearance:none}.searchbar-input.sc-ion-searchbar-ios::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-ios::-webkit-search-cancel-button,.searchbar-input.sc-ion-searchbar-ios::-ms-clear{display:none}.searchbar-cancel-button.sc-ion-searchbar-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:none;height:100%;border:0;outline:none;color:var(--cancel-button-color);cursor:pointer;appearance:none}.searchbar-cancel-button.sc-ion-searchbar-ios>div.sc-ion-searchbar-ios{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.searchbar-clear-button.sc-ion-searchbar-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:none;min-height:0;outline:none;color:var(--clear-button-color);appearance:none}.searchbar-clear-button.sc-ion-searchbar-ios:focus{opacity:0.5}.searchbar-has-value.searchbar-should-show-clear.sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios{display:block}.searchbar-disabled.sc-ion-searchbar-ios-h{cursor:default;opacity:0.4;pointer-events:none}.sc-ion-searchbar-ios-h{--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.07);--border-radius:10px;--box-shadow:none;--cancel-button-color:var(--ion-color-primary, #3880ff);--clear-button-color:var(--ion-color-step-600, #666666);--color:var(--ion-text-color, #000);--icon-color:var(--ion-color-step-600, #666666);-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:12px;padding-bottom:12px;height:60px;contain:strict}.searchbar-input-container.sc-ion-searchbar-ios{height:36px}.searchbar-search-icon.sc-ion-searchbar-ios{-webkit-margin-start:calc(50% - 60px);margin-inline-start:calc(50% - 60px);top:0;position:absolute;width:22px;height:100%;contain:strict}@supports (inset-inline-start: 0){.searchbar-search-icon.sc-ion-searchbar-ios{inset-inline-start:5px}}@supports not (inset-inline-start: 0){.searchbar-search-icon.sc-ion-searchbar-ios{left:5px}[dir=rtl].sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,[dir=rtl] .sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{left:unset;right:unset;right:5px}[dir=rtl].sc-ion-searchbar-ios .searchbar-search-icon.sc-ion-searchbar-ios{left:unset;right:unset;right:5px}@supports selector(:dir(rtl)){.searchbar-search-icon.sc-ion-searchbar-ios:dir(rtl){left:unset;right:unset;right:5px}}}.searchbar-input.sc-ion-searchbar-ios{-webkit-padding-start:28px;padding-inline-start:28px;-webkit-padding-end:28px;padding-inline-end:28px;padding-top:0;padding-bottom:0;height:100%;font-size:17px;font-weight:400;contain:strict}.searchbar-clear-button.sc-ion-searchbar-ios{top:0;background-position:center;position:absolute;width:30px;height:100%;border:0;background-color:transparent}@supports (inset-inline-start: 0){.searchbar-clear-button.sc-ion-searchbar-ios{inset-inline-end:0}}@supports not (inset-inline-start: 0){.searchbar-clear-button.sc-ion-searchbar-ios{right:0}[dir=rtl].sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios,[dir=rtl] .sc-ion-searchbar-ios-h .searchbar-clear-button.sc-ion-searchbar-ios{left:unset;right:unset;left:0}[dir=rtl].sc-ion-searchbar-ios .searchbar-clear-button.sc-ion-searchbar-ios{left:unset;right:unset;left:0}@supports selector(:dir(rtl)){.searchbar-clear-button.sc-ion-searchbar-ios:dir(rtl){left:unset;right:unset;left:0}}}.searchbar-clear-icon.sc-ion-searchbar-ios{width:18px;height:100%}.searchbar-cancel-button.sc-ion-searchbar-ios{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0;flex-shrink:0;background-color:transparent;font-size:16px}.searchbar-left-aligned.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{-webkit-margin-start:0;margin-inline-start:0}.searchbar-left-aligned.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{-webkit-padding-start:30px;padding-inline-start:30px}.searchbar-has-focus.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.searchbar-should-show-cancel.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{display:block}.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios{transition:all 300ms ease}.searchbar-animated.searchbar-has-focus.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios,.searchbar-animated.searchbar-should-show-cancel.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{opacity:1;pointer-events:auto}.searchbar-animated.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{-webkit-margin-end:-100%;margin-inline-end:-100%;transform:translate3d(0, 0, 0);transition:all 300ms ease;opacity:0;pointer-events:none}.searchbar-no-animate.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,.searchbar-no-animate.sc-ion-searchbar-ios-h .searchbar-input.sc-ion-searchbar-ios,.searchbar-no-animate.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{transition-duration:0ms}.ion-color.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios{color:var(--ion-color-base)}@media (any-hover: hover){.ion-color.sc-ion-searchbar-ios-h .searchbar-cancel-button.sc-ion-searchbar-ios:hover{color:var(--ion-color-tint)}}ion-toolbar.sc-ion-searchbar-ios-h,ion-toolbar .sc-ion-searchbar-ios-h{padding-top:1px;padding-bottom:15px;height:52px}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color),ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color){color:inherit}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-cancel-button.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-cancel-button.sc-ion-searchbar-ios{color:currentColor}ion-toolbar.ion-color.sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h .searchbar-search-icon.sc-ion-searchbar-ios{color:currentColor;opacity:0.5}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-input.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-input.sc-ion-searchbar-ios{background:rgba(var(--ion-color-contrast-rgb), 0.07);color:currentColor}ion-toolbar.ion-color.sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-clear-button.sc-ion-searchbar-ios,ion-toolbar.ion-color .sc-ion-searchbar-ios-h:not(.ion-color) .searchbar-clear-button.sc-ion-searchbar-ios{color:currentColor;opacity:0.5}";const En=".sc-ion-searchbar-md-h{--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:0.6;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:flex;position:relative;align-items:center;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);box-sizing:border-box}.ion-color.sc-ion-searchbar-md-h{color:var(--ion-color-contrast)}.ion-color.sc-ion-searchbar-md-h .searchbar-input.sc-ion-searchbar-md{background:var(--ion-color-base)}.ion-color.sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md,.ion-color.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md,.ion-color.sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md{color:inherit}.searchbar-search-icon.sc-ion-searchbar-md{color:var(--icon-color);pointer-events:none}.searchbar-input-container.sc-ion-searchbar-md{display:block;position:relative;flex-shrink:1;width:100%}.searchbar-input.sc-ion-searchbar-md{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;border-radius:var(--border-radius);display:block;width:100%;border:0;outline:none;background:var(--background);font-family:inherit;box-shadow:var(--box-shadow);box-sizing:border-box;appearance:none}.searchbar-input.sc-ion-searchbar-md::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.searchbar-input.sc-ion-searchbar-md::-webkit-search-cancel-button,.searchbar-input.sc-ion-searchbar-md::-ms-clear{display:none}.searchbar-cancel-button.sc-ion-searchbar-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:none;height:100%;border:0;outline:none;color:var(--cancel-button-color);cursor:pointer;appearance:none}.searchbar-cancel-button.sc-ion-searchbar-md>div.sc-ion-searchbar-md{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.searchbar-clear-button.sc-ion-searchbar-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:none;min-height:0;outline:none;color:var(--clear-button-color);appearance:none}.searchbar-clear-button.sc-ion-searchbar-md:focus{opacity:0.5}.searchbar-has-value.searchbar-should-show-clear.sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md{display:block}.searchbar-disabled.sc-ion-searchbar-md-h{cursor:default;opacity:0.4;pointer-events:none}.sc-ion-searchbar-md-h{--background:var(--ion-background-color, #fff);--border-radius:2px;--box-shadow:0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);--cancel-button-color:var(--ion-color-step-900, #1a1a1a);--clear-button-color:initial;--color:var(--ion-color-step-850, #262626);--icon-color:var(--ion-color-step-600, #666666);-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;background:inherit}.searchbar-search-icon.sc-ion-searchbar-md{top:11px;width:21px;height:21px}@supports (inset-inline-start: 0){.searchbar-search-icon.sc-ion-searchbar-md{inset-inline-start:16px}}@supports not (inset-inline-start: 0){.searchbar-search-icon.sc-ion-searchbar-md{left:16px}[dir=rtl].sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md,[dir=rtl] .sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md{left:unset;right:unset;right:16px}[dir=rtl].sc-ion-searchbar-md .searchbar-search-icon.sc-ion-searchbar-md{left:unset;right:unset;right:16px}@supports selector(:dir(rtl)){.searchbar-search-icon.sc-ion-searchbar-md:dir(rtl){left:unset;right:unset;right:16px}}}.searchbar-cancel-button.sc-ion-searchbar-md{top:0;background-color:transparent;font-size:1.6em}@supports (inset-inline-start: 0){.searchbar-cancel-button.sc-ion-searchbar-md{inset-inline-start:5px}}@supports not (inset-inline-start: 0){.searchbar-cancel-button.sc-ion-searchbar-md{left:5px}[dir=rtl].sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md,[dir=rtl] .sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md{left:unset;right:unset;right:5px}[dir=rtl].sc-ion-searchbar-md .searchbar-cancel-button.sc-ion-searchbar-md{left:unset;right:unset;right:5px}@supports selector(:dir(rtl)){.searchbar-cancel-button.sc-ion-searchbar-md:dir(rtl){left:unset;right:unset;right:5px}}}.searchbar-search-icon.sc-ion-searchbar-md,.searchbar-cancel-button.sc-ion-searchbar-md{position:absolute}.searchbar-search-icon.ion-activated.sc-ion-searchbar-md,.searchbar-cancel-button.ion-activated.sc-ion-searchbar-md{background-color:transparent}.searchbar-input.sc-ion-searchbar-md{-webkit-padding-start:55px;padding-inline-start:55px;-webkit-padding-end:55px;padding-inline-end:55px;padding-top:6px;padding-bottom:6px;background-position:left 8px center;height:auto;font-size:16px;font-weight:400;line-height:30px}[dir=rtl].sc-ion-searchbar-md-h .searchbar-input.sc-ion-searchbar-md,[dir=rtl] .sc-ion-searchbar-md-h .searchbar-input.sc-ion-searchbar-md{background-position:right 8px center}[dir=rtl].sc-ion-searchbar-md .searchbar-input.sc-ion-searchbar-md{background-position:right 8px center}@supports selector(:dir(rtl)){.searchbar-input.sc-ion-searchbar-md:dir(rtl){background-position:right 8px center}}.searchbar-clear-button.sc-ion-searchbar-md{top:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;position:absolute;height:100%;border:0;background-color:transparent}@supports (inset-inline-start: 0){.searchbar-clear-button.sc-ion-searchbar-md{inset-inline-end:13px}}@supports not (inset-inline-start: 0){.searchbar-clear-button.sc-ion-searchbar-md{right:13px}[dir=rtl].sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md,[dir=rtl] .sc-ion-searchbar-md-h .searchbar-clear-button.sc-ion-searchbar-md{left:unset;right:unset;left:13px}[dir=rtl].sc-ion-searchbar-md .searchbar-clear-button.sc-ion-searchbar-md{left:unset;right:unset;left:13px}@supports selector(:dir(rtl)){.searchbar-clear-button.sc-ion-searchbar-md:dir(rtl){left:unset;right:unset;left:13px}}}.searchbar-clear-button.ion-activated.sc-ion-searchbar-md{background-color:transparent}.searchbar-clear-icon.sc-ion-searchbar-md{width:22px;height:100%}.searchbar-has-focus.sc-ion-searchbar-md-h .searchbar-search-icon.sc-ion-searchbar-md{display:block}.searchbar-has-focus.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md,.searchbar-should-show-cancel.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md{display:block}.searchbar-has-focus.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md+.searchbar-search-icon.sc-ion-searchbar-md,.searchbar-should-show-cancel.sc-ion-searchbar-md-h .searchbar-cancel-button.sc-ion-searchbar-md+.searchbar-search-icon.sc-ion-searchbar-md{display:none}ion-toolbar.sc-ion-searchbar-md-h,ion-toolbar .sc-ion-searchbar-md-h{-webkit-padding-start:7px;padding-inline-start:7px;-webkit-padding-end:7px;padding-inline-end:7px;padding-top:3px;padding-bottom:3px}";const An=class{constructor(e){t(this,e);this.ionInput=s(this,"ionInput",7);this.ionChange=s(this,"ionChange",7);this.ionCancel=s(this,"ionCancel",7);this.ionClear=s(this,"ionClear",7);this.ionBlur=s(this,"ionBlur",7);this.ionFocus=s(this,"ionFocus",7);this.ionStyle=s(this,"ionStyle",7);this.isCancelVisible=false;this.shouldAlignLeft=true;this.inputId=`ion-searchbar-${In++}`;this.onClearInput=async t=>{this.ionClear.emit();return new Promise((e=>{setTimeout((()=>{const i=this.getValue();if(i!==""){this.value="";this.emitInputChange();if(t&&!this.focused){this.setFocus();this.focusedValue=i}}e()}),16*4)}))};this.onCancelSearchbar=async t=>{if(t){t.preventDefault();t.stopPropagation()}this.ionCancel.emit();const e=this.getValue();const i=this.focused;await this.onClearInput();if(e&&!i){this.emitValueChange(t)}if(this.nativeInput){this.nativeInput.blur()}};this.onInput=t=>{const e=t.target;if(e){this.value=e.value}this.emitInputChange(t)};this.onChange=t=>{this.emitValueChange(t)};this.onBlur=t=>{this.focused=false;this.ionBlur.emit();this.positionElements();if(this.focusedValue!==this.value){this.emitValueChange(t)}this.focusedValue=undefined};this.onFocus=()=>{this.focused=true;this.focusedValue=this.value;this.ionFocus.emit();this.positionElements()};this.focused=false;this.noAnimate=true;this.color=undefined;this.animated=false;this.autocomplete="off";this.autocorrect="off";this.cancelButtonIcon=x.get("backButtonIcon",J);this.cancelButtonText="Cancel";this.clearIcon=undefined;this.debounce=undefined;this.disabled=false;this.inputmode=undefined;this.enterkeyhint=undefined;this.name=this.inputId;this.placeholder="Search";this.searchIcon=undefined;this.showCancelButton="never";this.showClearButton="always";this.spellcheck=false;this.type="search";this.value=""}debounceChanged(){const{ionInput:t,debounce:e,originalIonInput:i}=this;this.ionInput=e===undefined?i!==null&&i!==void 0?i:t:D(t,e)}valueChanged(){const t=this.nativeInput;const e=this.getValue();if(t&&t.value!==e){t.value=e}}showCancelButtonChanged(){requestAnimationFrame((()=>{this.positionElements();a(this)}))}connectedCallback(){this.emitStyle()}componentDidLoad(){this.originalIonInput=this.ionInput;this.positionElements();this.debounceChanged();setTimeout((()=>{this.noAnimate=false}),300)}emitStyle(){this.ionStyle.emit({searchbar:true})}async setFocus(){if(this.nativeInput){this.nativeInput.focus()}}getInputElement(){return Promise.resolve(this.nativeInput)}emitValueChange(t){const{value:e}=this;const i=e==null?e:e.toString();this.focusedValue=i;this.ionChange.emit({value:i,event:t})}emitInputChange(t){const{value:e}=this;this.ionInput.emit({value:e,event:t})}positionElements(){const t=this.getValue();const e=this.shouldAlignLeft;const i=y(this);const n=!this.animated||t.trim()!==""||!!this.focused;this.shouldAlignLeft=n;if(i!=="ios"){return}if(e!==n){this.positionPlaceholder()}if(this.animated){this.positionCancelButton()}}positionPlaceholder(){const t=this.nativeInput;if(!t){return}const e=U(this.el);const i=(this.el.shadowRoot||this.el).querySelector(".searchbar-search-icon");if(this.shouldAlignLeft){t.removeAttribute("style");i.removeAttribute("style")}else{const n=document;const o=n.createElement("span");o.innerText=this.placeholder||"";n.body.appendChild(o);A((()=>{const n=o.offsetWidth;o.remove();const s="calc(50% - "+n/2+"px)";const r="calc(50% - "+(n/2+30)+"px)";if(e){t.style.paddingRight=s;i.style.marginRight=r}else{t.style.paddingLeft=s;i.style.marginLeft=r}}))}}positionCancelButton(){const t=U(this.el);const e=(this.el.shadowRoot||this.el).querySelector(".searchbar-cancel-button");const i=this.shouldShowCancelButton();if(e!==null&&i!==this.isCancelVisible){const n=e.style;this.isCancelVisible=i;if(i){if(t){n.marginLeft="0"}else{n.marginRight="0"}}else{const i=e.offsetWidth;if(i>0){if(t){n.marginLeft=-i+"px"}else{n.marginRight=-i+"px"}}}}}getValue(){return this.value||""}hasValue(){return this.getValue()!==""}shouldShowCancelButton(){if(this.showCancelButton==="never"||this.showCancelButton==="focus"&&!this.focused){return false}return true}shouldShowClearButton(){if(this.showClearButton==="never"||this.showClearButton==="focus"&&!this.focused){return false}return true}render(){const{cancelButtonText:t}=this;const n=this.animated&&x.getBoolean("animated",true);const o=y(this);const s=this.clearIcon||(o==="ios"?X:H);const r=this.searchIcon||(o==="ios"?K:Y);const a=this.shouldShowCancelButton();const l=this.showCancelButton!=="never"&&e("button",{"aria-label":t,"aria-hidden":a?undefined:"true",type:"button",tabIndex:o==="ios"&&!a?-1:undefined,onMouseDown:this.onCancelSearchbar,onTouchStart:this.onCancelSearchbar,class:"searchbar-cancel-button"},e("div",{"aria-hidden":"true"},o==="md"?e("ion-icon",{"aria-hidden":"true",mode:o,icon:this.cancelButtonIcon,lazy:false}):t));return e(i,{role:"search","aria-disabled":this.disabled?"true":null,class:N(this.color,{[o]:true,"searchbar-animated":n,"searchbar-disabled":this.disabled,"searchbar-no-animate":n&&this.noAnimate,"searchbar-has-value":this.hasValue(),"searchbar-left-aligned":this.shouldAlignLeft,"searchbar-has-focus":this.focused,"searchbar-should-show-clear":this.shouldShowClearButton(),"searchbar-should-show-cancel":this.shouldShowCancelButton()})},e("div",{class:"searchbar-input-container"},e("input",{"aria-label":"search text",disabled:this.disabled,ref:t=>this.nativeInput=t,class:"searchbar-input",inputMode:this.inputmode,enterKeyHint:this.enterkeyhint,name:this.name,onInput:this.onInput,onChange:this.onChange,onBlur:this.onBlur,onFocus:this.onFocus,placeholder:this.placeholder,type:this.type,value:this.getValue(),autoComplete:this.autocomplete,autoCorrect:this.autocorrect,spellcheck:this.spellcheck}),o==="md"&&l,e("ion-icon",{"aria-hidden":"true",mode:o,icon:r,lazy:false,class:"searchbar-search-icon"}),e("button",{"aria-label":"reset",type:"button","no-blur":true,class:"searchbar-clear-button",onPointerDown:t=>{t.preventDefault()},onClick:()=>this.onClearInput(true)},e("ion-icon",{"aria-hidden":"true",mode:o,icon:s,lazy:false,class:"searchbar-clear-icon"}))),o==="ios"&&l)}get el(){return n(this)}static get watchers(){return{debounce:["debounceChanged"],value:["valueChanged"],showCancelButton:["showCancelButtonChanged"]}}};let In=0;An.style={ios:Cn,md:En};const Tn=":host{--side-width:100%;left:0;right:0;top:0;bottom:0;display:flex;position:absolute;flex-direction:row;flex-wrap:nowrap;contain:strict}::slotted(ion-menu.menu-pane-visible){flex:0 1 auto;width:var(--side-width);min-width:var(--side-min-width);max-width:var(--side-max-width)}:host(.split-pane-visible) ::slotted(.split-pane-side),:host(.split-pane-visible) ::slotted(.split-pane-main){left:0;right:0;top:0;bottom:0;position:relative;box-shadow:none !important;z-index:0}:host(.split-pane-visible) ::slotted(.split-pane-main){flex:1}:host(.split-pane-visible) ::slotted(.split-pane-side:not(ion-menu)),:host(.split-pane-visible) ::slotted(ion-menu.split-pane-side.menu-enabled){display:flex;flex-shrink:0}::slotted(.split-pane-side:not(ion-menu)){display:none}:host(.split-pane-visible) ::slotted(.split-pane-side){order:-1}:host(.split-pane-visible) ::slotted(.split-pane-side[side=end]){order:1}:host{--border:0.55px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, #c8c7cc)));--side-min-width:270px;--side-max-width:28%}:host(.split-pane-visible) ::slotted(.split-pane-side){-webkit-border-start:0;border-inline-start:0;-webkit-border-end:var(--border);border-inline-end:var(--border);border-top:0;border-bottom:0;min-width:var(--side-min-width);max-width:var(--side-max-width)}:host(.split-pane-visible) ::slotted(.split-pane-side[side=end]){-webkit-border-start:var(--border);border-inline-start:var(--border);-webkit-border-end:0;border-inline-end:0;border-top:0;border-bottom:0;min-width:var(--side-min-width);max-width:var(--side-max-width)}";const Pn=":host{--side-width:100%;left:0;right:0;top:0;bottom:0;display:flex;position:absolute;flex-direction:row;flex-wrap:nowrap;contain:strict}::slotted(ion-menu.menu-pane-visible){flex:0 1 auto;width:var(--side-width);min-width:var(--side-min-width);max-width:var(--side-max-width)}:host(.split-pane-visible) ::slotted(.split-pane-side),:host(.split-pane-visible) ::slotted(.split-pane-main){left:0;right:0;top:0;bottom:0;position:relative;box-shadow:none !important;z-index:0}:host(.split-pane-visible) ::slotted(.split-pane-main){flex:1}:host(.split-pane-visible) ::slotted(.split-pane-side:not(ion-menu)),:host(.split-pane-visible) ::slotted(ion-menu.split-pane-side.menu-enabled){display:flex;flex-shrink:0}::slotted(.split-pane-side:not(ion-menu)){display:none}:host(.split-pane-visible) ::slotted(.split-pane-side){order:-1}:host(.split-pane-visible) ::slotted(.split-pane-side[side=end]){order:1}:host{--border:1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13))));--side-min-width:270px;--side-max-width:28%}:host(.split-pane-visible) ::slotted(.split-pane-side){-webkit-border-start:0;border-inline-start:0;-webkit-border-end:var(--border);border-inline-end:var(--border);border-top:0;border-bottom:0;min-width:var(--side-min-width);max-width:var(--side-max-width)}:host(.split-pane-visible) ::slotted(.split-pane-side[side=end]){-webkit-border-start:var(--border);border-inline-start:var(--border);-webkit-border-end:0;border-inline-end:0;border-top:0;border-bottom:0;min-width:var(--side-min-width);max-width:var(--side-max-width)}";const $n="split-pane-main";const Fn="split-pane-side";const On={xs:"(min-width: 0px)",sm:"(min-width: 576px)",md:"(min-width: 768px)",lg:"(min-width: 992px)",xl:"(min-width: 1200px)",never:""};const Dn=class{constructor(e){t(this,e);this.ionSplitPaneVisible=s(this,"ionSplitPaneVisible",7);this.visible=false;this.contentId=undefined;this.disabled=false;this.when=On["lg"]}visibleChanged(t){const e={visible:t,isPane:this.isPane.bind(this)};this.ionSplitPaneVisible.emit(e)}async connectedCallback(){if(typeof customElements!=="undefined"&&customElements!=null){await customElements.whenDefined("ion-split-pane")}this.styleChildren();this.updateState()}disconnectedCallback(){if(this.rmL){this.rmL();this.rmL=undefined}}updateState(){if(this.rmL){this.rmL();this.rmL=undefined}if(this.disabled){this.visible=false;return}const t=this.when;if(typeof t==="boolean"){this.visible=t;return}const e=On[t]||t;if(e.length===0){this.visible=false;return}if(window.matchMedia){const t=t=>{this.visible=t.matches};const i=window.matchMedia(e);i.addListener(t);this.rmL=()=>i.removeListener(t);this.visible=i.matches}}isPane(t){if(!this.visible){return false}return t.parentElement===this.el&&t.classList.contains(Fn)}styleChildren(){const t=this.contentId;const e=this.el.children;const i=this.el.childElementCount;let n=false;for(let o=0;o<i;o++){const i=e[o];const s=t!==undefined&&i.id===t;if(s){if(n){console.warn("split pane cannot have more than one main node");return}n=true}jn(i,s)}if(!n){console.warn("split pane does not have a specified main node")}}render(){const t=y(this);return e(i,{class:{[t]:true,[`split-pane-${t}`]:true,"split-pane-visible":this.visible}},e("slot",null))}get el(){return n(this)}static get watchers(){return{visible:["visibleChanged"],disabled:["updateState"],when:["updateState"]}}};const jn=(t,e)=>{let i;let n;if(e){i=$n;n=Fn}else{i=Fn;n=$n}const o=t.classList;o.add(i);o.remove(n)};Dn.style={ios:Tn,md:Pn};const Ln=":host{--size:48px;--border-radius:0;border-radius:var(--border-radius);display:block;width:var(--size);height:var(--size)}::slotted(ion-img),::slotted(img){border-radius:var(--border-radius);width:100%;height:100%;object-fit:cover;overflow:hidden}";const Rn=class{constructor(e){t(this,e)}render(){return e(i,{class:y(this)},e("slot",null))}};Rn.style=Ln;const Nn=":host{--color:initial;display:flex;flex:1;align-items:center;transform:translateZ(0);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}.toolbar-title{display:block;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;pointer-events:auto}:host(.title-small) .toolbar-title{white-space:normal}:host{top:0;-webkit-padding-start:90px;padding-inline-start:90px;-webkit-padding-end:90px;padding-inline-end:90px;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);position:absolute;width:100%;height:100%;transform:translateZ(0);font-size:17px;font-weight:600;text-align:center;box-sizing:border-box;pointer-events:none}@supports (inset-inline-start: 0){:host{inset-inline-start:0}}@supports not (inset-inline-start: 0){:host{left:0}:host-context([dir=rtl]){left:unset;right:unset;right:0}@supports selector(:dir(rtl)){:host:dir(rtl){left:unset;right:unset;right:0}}}:host(.title-small){-webkit-padding-start:9px;padding-inline-start:9px;-webkit-padding-end:9px;padding-inline-end:9px;padding-top:6px;padding-bottom:16px;position:relative;font-size:13px;font-weight:normal}:host(.title-large){-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0;padding-bottom:0;transform-origin:left center;bottom:0;align-items:flex-end;min-width:100%;padding-bottom:6px;font-size:34px;font-weight:700;text-align:start}:host(.title-large.title-rtl){transform-origin:right center}:host(.title-large.ion-cloned-element){--color:var(--ion-text-color, #000)}:host(.title-large) .toolbar-title{transform-origin:inherit}:host-context([dir=rtl]):host(.title-large) .toolbar-title,:host-context([dir=rtl]).title-large .toolbar-title{transform-origin:calc(100% - inherit)}@supports selector(:dir(rtl)){:host(.title-large) .toolbar-title:dir(rtl){transform-origin:calc(100% - inherit)}}";const Bn=":host{--color:initial;display:flex;flex:1;align-items:center;transform:translateZ(0);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}.toolbar-title{display:block;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;pointer-events:auto}:host(.title-small) .toolbar-title{white-space:normal}:host{-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px;padding-top:0;padding-bottom:0;font-size:20px;font-weight:500;letter-spacing:0.0125em}:host(.title-small){width:100%;height:100%;font-size:15px;font-weight:normal}";const Un=class{constructor(e){t(this,e);this.ionStyle=s(this,"ionStyle",7);this.color=undefined;this.size=undefined}sizeChanged(){this.emitStyle()}connectedCallback(){this.emitStyle()}emitStyle(){const t=this.getSize();this.ionStyle.emit({[`title-${t}`]:true})}getSize(){return this.size!==undefined?this.size:"default"}render(){const t=y(this);const n=this.getSize();return e(i,{class:N(this.color,{[t]:true,[`title-${n}`]:true,"title-rtl":document.dir==="rtl"})},e("div",{class:"toolbar-title"},e("slot",null)))}get el(){return n(this)}static get watchers(){return{size:["sizeChanged"]}}};Un.style={ios:Nn,md:Bn};const qn=":host{box-sizing:content-box !important;display:inline-block;position:relative;max-width:100%;outline:none;cursor:pointer;user-select:none;z-index:2}:host(.in-item:not(.legacy-toggle)){width:100%;height:100%}:host([slot=start]:not(.legacy-toggle)),:host([slot=end]:not(.legacy-toggle)){width:auto}:host(.legacy-toggle){contain:content;touch-action:none}:host(.ion-focused) input{border:2px solid #5e9ed6}:host(.toggle-disabled){pointer-events:none}:host(.legacy-toggle) label{top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;appearance:none;outline:none;display:flex;align-items:center;opacity:0;pointer-events:none}@supports (inset-inline-start: 0){:host(.legacy-toggle) label{inset-inline-start:0}}@supports not (inset-inline-start: 0){:host(.legacy-toggle) label{left:0}:host-context([dir=rtl]):host(.legacy-toggle) label,:host-context([dir=rtl]).legacy-toggle label{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){:host(.legacy-toggle) label:dir(rtl){left:unset;right:unset;right:0}}}:host(.legacy-toggle) label::-moz-focus-inner{border:0}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.toggle-wrapper{display:flex;position:relative;flex-grow:1;align-items:center;height:inherit;transition:background-color 15ms linear;cursor:inherit}.label-text-wrapper{pointer-events:none;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item:not(.legacy-toggle)) .label-text-wrapper{margin-top:10px;margin-bottom:10px}.label-text-wrapper-hidden{display:none}.native-wrapper{display:flex;align-items:center}:host(.toggle-justify-space-between) .toggle-wrapper{justify-content:space-between}:host(.toggle-justify-start) .toggle-wrapper{justify-content:start}:host(.toggle-justify-end) .toggle-wrapper{justify-content:end}:host(.toggle-label-placement-start) .toggle-wrapper{flex-direction:row}:host(.toggle-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.toggle-label-placement-end) .toggle-wrapper{flex-direction:row-reverse}:host(.toggle-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.toggle-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.toggle-label-placement-fixed) .label-text-wrapper{flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.toggle-icon-wrapper{display:flex;position:relative;align-items:center;width:100%;height:100%;transition:var(--handle-transition);will-change:transform}.toggle-icon{border-radius:var(--border-radius);display:block;position:relative;width:100%;height:100%;background:var(--track-background);overflow:inherit}:host(.toggle-checked) .toggle-icon{background:var(--track-background-checked)}.toggle-inner{border-radius:var(--handle-border-radius);position:absolute;left:var(--handle-spacing);width:var(--handle-width);height:var(--handle-height);max-height:var(--handle-max-height);transition:var(--handle-transition);background:var(--handle-background);box-shadow:var(--handle-box-shadow);contain:strict}:host(.toggle-ltr) .toggle-inner{left:var(--handle-spacing)}:host(.toggle-rtl) .toggle-inner{right:var(--handle-spacing)}:host(.toggle-ltr.toggle-checked) .toggle-icon-wrapper{transform:translate3d(calc(100% - var(--handle-width)), 0, 0)}:host(.toggle-rtl.toggle-checked) .toggle-icon-wrapper{transform:translate3d(calc(-100% + var(--handle-width)), 0, 0)}:host(.toggle-checked) .toggle-inner{background:var(--handle-background-checked)}:host(.toggle-ltr.toggle-checked) .toggle-inner{transform:translate3d(calc(var(--handle-spacing) * -2), 0, 0)}:host(.toggle-rtl.toggle-checked) .toggle-inner{transform:translate3d(calc(var(--handle-spacing) * 2), 0, 0)}:host{--track-background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.088);--track-background-checked:var(--ion-color-primary, #3880ff);--border-radius:16px;--handle-background:#ffffff;--handle-background-checked:#ffffff;--handle-border-radius:25.5px;--handle-box-shadow:0 3px 12px rgba(0, 0, 0, 0.16), 0 3px 1px rgba(0, 0, 0, 0.1);--handle-height:calc(32px - (2px * 2));--handle-max-height:calc(100% - var(--handle-spacing) * 2);--handle-width:calc(32px - (2px * 2));--handle-spacing:2px;--handle-transition:transform 300ms, width 120ms ease-in-out 80ms, left 110ms ease-in-out 80ms, right 110ms ease-in-out 80ms}:host(.legacy-toggle){width:51px;height:32px;contain:strict;overflow:hidden}.native-wrapper .toggle-icon{width:51px;height:32px;overflow:hidden}:host(.ion-color.toggle-checked) .toggle-icon{background:var(--ion-color-base)}:host(.toggle-activated) .toggle-switch-icon{opacity:0}.toggle-icon{transform:translate3d(0, 0, 0);transition:background-color 300ms}.toggle-inner{will-change:transform}.toggle-switch-icon{position:absolute;top:50%;width:11px;height:11px;transform:translateY(-50%);transition:opacity 300ms, color 300ms}.toggle-switch-icon{position:absolute;color:var(--ion-color-dark)}:host(.toggle-ltr) .toggle-switch-icon{right:6px}:host(.toggle-rtl) .toggle-switch-icon{right:initial;left:6px;}:host(.toggle-checked) .toggle-switch-icon.toggle-switch-icon-checked{color:var(--ion-color-contrast, #fff)}:host(.toggle-checked) .toggle-switch-icon:not(.toggle-switch-icon-checked){opacity:0}.toggle-switch-icon-checked{position:absolute;width:15px;height:15px;transform:translateY(-50%) rotate(90deg)}:host(.toggle-ltr) .toggle-switch-icon-checked{right:initial;left:4px;}:host(.toggle-rtl) .toggle-switch-icon-checked{right:4px}:host(.toggle-activated) .toggle-icon::before,:host(.toggle-checked) .toggle-icon::before{transform:scale3d(0, 0, 0)}:host(.toggle-activated.toggle-checked) .toggle-inner::before{transform:scale3d(0, 0, 0)}:host(.toggle-activated) .toggle-inner{width:calc(var(--handle-width) + 6px)}:host(.toggle-ltr.toggle-activated.toggle-checked) .toggle-icon-wrapper{transform:translate3d(calc(100% - var(--handle-width) - 6px), 0, 0)}:host(.toggle-rtl.toggle-activated.toggle-checked) .toggle-icon-wrapper{transform:translate3d(calc(-100% + var(--handle-width) + 6px), 0, 0)}:host(.toggle-disabled){opacity:0.3}:host(.in-item.legacy-toggle){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:0;padding-inline-end:0;padding-top:6px;padding-bottom:5px}:host(.in-item.legacy-toggle[slot=start]){-webkit-padding-start:0;padding-inline-start:0;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:6px;padding-bottom:5px}";const Vn=":host{box-sizing:content-box !important;display:inline-block;position:relative;max-width:100%;outline:none;cursor:pointer;user-select:none;z-index:2}:host(.in-item:not(.legacy-toggle)){width:100%;height:100%}:host([slot=start]:not(.legacy-toggle)),:host([slot=end]:not(.legacy-toggle)){width:auto}:host(.legacy-toggle){contain:content;touch-action:none}:host(.ion-focused) input{border:2px solid #5e9ed6}:host(.toggle-disabled){pointer-events:none}:host(.legacy-toggle) label{top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;appearance:none;outline:none;display:flex;align-items:center;opacity:0;pointer-events:none}@supports (inset-inline-start: 0){:host(.legacy-toggle) label{inset-inline-start:0}}@supports not (inset-inline-start: 0){:host(.legacy-toggle) label{left:0}:host-context([dir=rtl]):host(.legacy-toggle) label,:host-context([dir=rtl]).legacy-toggle label{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){:host(.legacy-toggle) label:dir(rtl){left:unset;right:unset;right:0}}}:host(.legacy-toggle) label::-moz-focus-inner{border:0}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.toggle-wrapper{display:flex;position:relative;flex-grow:1;align-items:center;height:inherit;transition:background-color 15ms linear;cursor:inherit}.label-text-wrapper{pointer-events:none;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item:not(.legacy-toggle)) .label-text-wrapper{margin-top:10px;margin-bottom:10px}.label-text-wrapper-hidden{display:none}.native-wrapper{display:flex;align-items:center}:host(.toggle-justify-space-between) .toggle-wrapper{justify-content:space-between}:host(.toggle-justify-start) .toggle-wrapper{justify-content:start}:host(.toggle-justify-end) .toggle-wrapper{justify-content:end}:host(.toggle-label-placement-start) .toggle-wrapper{flex-direction:row}:host(.toggle-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.toggle-label-placement-end) .toggle-wrapper{flex-direction:row-reverse}:host(.toggle-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.toggle-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.toggle-label-placement-fixed) .label-text-wrapper{flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.toggle-icon-wrapper{display:flex;position:relative;align-items:center;width:100%;height:100%;transition:var(--handle-transition);will-change:transform}.toggle-icon{border-radius:var(--border-radius);display:block;position:relative;width:100%;height:100%;background:var(--track-background);overflow:inherit}:host(.toggle-checked) .toggle-icon{background:var(--track-background-checked)}.toggle-inner{border-radius:var(--handle-border-radius);position:absolute;left:var(--handle-spacing);width:var(--handle-width);height:var(--handle-height);max-height:var(--handle-max-height);transition:var(--handle-transition);background:var(--handle-background);box-shadow:var(--handle-box-shadow);contain:strict}:host(.toggle-ltr) .toggle-inner{left:var(--handle-spacing)}:host(.toggle-rtl) .toggle-inner{right:var(--handle-spacing)}:host(.toggle-ltr.toggle-checked) .toggle-icon-wrapper{transform:translate3d(calc(100% - var(--handle-width)), 0, 0)}:host(.toggle-rtl.toggle-checked) .toggle-icon-wrapper{transform:translate3d(calc(-100% + var(--handle-width)), 0, 0)}:host(.toggle-checked) .toggle-inner{background:var(--handle-background-checked)}:host(.toggle-ltr.toggle-checked) .toggle-inner{transform:translate3d(calc(var(--handle-spacing) * -2), 0, 0)}:host(.toggle-rtl.toggle-checked) .toggle-inner{transform:translate3d(calc(var(--handle-spacing) * 2), 0, 0)}:host{--track-background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.39);--track-background-checked:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.5);--border-radius:14px;--handle-background:#ffffff;--handle-background-checked:var(--ion-color-primary, #3880ff);--handle-border-radius:50%;--handle-box-shadow:0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);--handle-width:20px;--handle-height:20px;--handle-max-height:calc(100% + 6px);--handle-spacing:0;--handle-transition:transform 160ms cubic-bezier(0.4, 0, 0.2, 1), background-color 160ms cubic-bezier(0.4, 0, 0.2, 1)}:host(.legacy-toggle){-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:12px;padding-bottom:12px;width:36px;height:14px;contain:strict}.native-wrapper .toggle-icon{width:36px;height:14px}:host(.ion-color.toggle-checked) .toggle-icon{background:rgba(var(--ion-color-base-rgb), 0.5)}:host(.ion-color.toggle-checked) .toggle-inner{background:var(--ion-color-base)}:host(.toggle-checked) .toggle-inner{color:var(--ion-color-contrast, #fff)}.toggle-icon{transition:background-color 160ms}.toggle-inner{will-change:background-color, transform;display:flex;align-items:center;justify-content:center;color:#000}.toggle-inner .toggle-switch-icon{-webkit-padding-start:1px;padding-inline-start:1px;-webkit-padding-end:1px;padding-inline-end:1px;padding-top:1px;padding-bottom:1px;width:100%;height:100%}:host(.toggle-disabled){opacity:0.38}:host(.in-item.legacy-toggle){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:0;padding-inline-end:0;padding-top:12px;padding-bottom:12px;cursor:pointer}:host(.in-item.legacy-toggle[slot=start]){-webkit-padding-start:2px;padding-inline-start:2px;-webkit-padding-end:18px;padding-inline-end:18px;padding-top:12px;padding-bottom:12px}";const Gn=class{constructor(e){t(this,e);this.ionChange=s(this,"ionChange",7);this.ionFocus=s(this,"ionFocus",7);this.ionBlur=s(this,"ionBlur",7);this.ionStyle=s(this,"ionStyle",7);this.inputId=`ion-tg-${Wn++}`;this.lastDrag=0;this.inheritedAttributes={};this.didLoad=false;this.hasLoggedDeprecationWarning=false;this.setupGesture=async()=>{const{toggleTrack:t}=this;if(t){this.gesture=(await import("./p-f2599c25.js")).createGesture({el:t,gestureName:"toggle",gesturePriority:100,threshold:5,passive:false,onStart:()=>this.onStart(),onMove:t=>this.onMove(t),onEnd:t=>this.onEnd(t)});this.disabledChanged()}};this.onClick=t=>{t.preventDefault();if(this.lastDrag+300<Date.now()){this.toggleChecked()}};this.onFocus=()=>{this.ionFocus.emit()};this.onBlur=()=>{this.ionBlur.emit()};this.getSwitchLabelIcon=(t,e)=>{if(t==="md"){return e?Q:tt}return e?tt:et};this.activated=false;this.color=undefined;this.name=this.inputId;this.checked=false;this.disabled=false;this.value="on";this.enableOnOffLabels=x.get("toggleOnOffLabels");this.labelPlacement="start";this.legacy=undefined;this.justify="space-between"}disabledChanged(){this.emitStyle();if(this.gesture){this.gesture.enable(!this.disabled)}}toggleChecked(){const{checked:t,value:e}=this;const i=!t;this.checked=i;this.ionChange.emit({checked:i,value:e})}async connectedCallback(){this.legacyFormController=rt(this.el);if(this.didLoad){this.setupGesture()}}componentDidLoad(){this.setupGesture();this.didLoad=true}disconnectedCallback(){if(this.gesture){this.gesture.destroy();this.gesture=undefined}}componentWillLoad(){this.emitStyle();if(!this.legacyFormController.hasLegacyControl()){this.inheritedAttributes=Object.assign({},z(this.el))}}emitStyle(){if(this.legacyFormController.hasLegacyControl()){this.ionStyle.emit({"interactive-disabled":this.disabled})}}onStart(){this.activated=true;this.setFocus()}onMove(t){if(Zn(U(this.el),this.checked,t.deltaX,-10)){this.toggleChecked();at()}}onEnd(t){this.activated=false;this.lastDrag=Date.now();t.event.preventDefault();t.event.stopImmediatePropagation()}getValue(){return this.value||""}setFocus(){if(this.focusEl){this.focusEl.focus()}}renderOnOffSwitchLabels(t,i){const n=this.getSwitchLabelIcon(t,i);return e("ion-icon",{class:{"toggle-switch-icon":true,"toggle-switch-icon-checked":i},icon:n,"aria-hidden":"true"})}renderToggleControl(){const t=y(this);const{enableOnOffLabels:i,checked:n}=this;return e("div",{class:"toggle-icon",part:"track",ref:t=>this.toggleTrack=t},i&&t==="ios"&&[this.renderOnOffSwitchLabels(t,true),this.renderOnOffSwitchLabels(t,false)],e("div",{class:"toggle-icon-wrapper"},e("div",{class:"toggle-inner",part:"handle"},i&&t==="md"&&this.renderOnOffSwitchLabels(t,n))))}get hasLabel(){return this.el.textContent!==""}render(){const{legacyFormController:t}=this;return t.hasLegacyControl()?this.renderLegacyToggle():this.renderToggle()}renderToggle(){const{activated:t,color:n,checked:o,disabled:s,el:r,justify:a,labelPlacement:l,inputId:h,name:c}=this;const u=y(this);const d=this.getValue();const f=U(r)?"rtl":"ltr";O(true,r,c,o?d:"",s);return e(i,{onClick:this.onClick,class:N(n,{[u]:true,"in-item":B("ion-item",r),"toggle-activated":t,"toggle-checked":o,"toggle-disabled":s,[`toggle-justify-${a}`]:true,[`toggle-label-placement-${l}`]:true,[`toggle-${f}`]:true})},e("label",{class:"toggle-wrapper"},e("input",Object.assign({type:"checkbox",role:"switch","aria-checked":`${o}`,checked:o,disabled:s,id:h,onFocus:()=>this.onFocus(),onBlur:()=>this.onBlur(),ref:t=>this.focusEl=t},this.inheritedAttributes)),e("div",{class:{"label-text-wrapper":true,"label-text-wrapper-hidden":!this.hasLabel}},e("slot",null)),e("div",{class:"native-wrapper"},this.renderToggleControl())))}renderLegacyToggle(){if(!this.hasLoggedDeprecationWarning){j(`ion-toggle now requires providing a label with either the default slot or the "aria-label" attribute. To migrate, remove any usage of "ion-label" and pass the label text to either the component or the "aria-label" attribute.\n\nExample: <ion-toggle>Email</ion-toggle>\nExample with aria-label: <ion-toggle aria-label="Email"></ion-toggle>\n\nDevelopers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.`,this.el);if(this.legacy){j(`ion-toggle is being used with the "legacy" property enabled which will forcibly enable the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.\n\nDevelopers can dismiss this warning by removing their usage of the "legacy" property and using the new toggle syntax.`,this.el)}this.hasLoggedDeprecationWarning=true}const{activated:t,color:n,checked:o,disabled:s,el:r,inputId:a,name:l}=this;const h=y(this);const{label:c,labelId:u,labelText:d}=F(r,a);const f=this.getValue();const p=U(r)?"rtl":"ltr";O(true,r,l,o?f:"",s);return e(i,{onClick:this.onClick,"aria-labelledby":c?u:null,"aria-checked":`${o}`,"aria-hidden":s?"true":null,role:"switch",class:N(n,{[h]:true,"in-item":B("ion-item",r),"toggle-activated":t,"toggle-checked":o,"toggle-disabled":s,"legacy-toggle":true,interactive:true,[`toggle-${p}`]:true})},this.renderToggleControl(),e("label",{htmlFor:a},d),e("input",{type:"checkbox",role:"switch","aria-checked":`${o}`,disabled:s,id:a,onFocus:()=>this.onFocus(),onBlur:()=>this.onBlur(),ref:t=>this.focusEl=t}))}get el(){return n(this)}static get watchers(){return{disabled:["disabledChanged"]}}};const Zn=(t,e,i,n)=>{if(e){return!t&&n>i||t&&-n<i}else{return!t&&-n<i||t&&n>i}};let Wn=0;Gn.style={ios:qn,md:Vn};const Jn=":host{--border-width:0;--border-style:solid;--opacity:1;--opacity-scale:1;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-padding-start:var(--ion-safe-area-left);padding-inline-start:var(--ion-safe-area-left);-webkit-padding-end:var(--ion-safe-area-right);padding-inline-end:var(--ion-safe-area-right);display:block;position:relative;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);contain:content;z-index:10;box-sizing:border-box}:host(.ion-color){color:var(--ion-color-contrast)}:host(.ion-color) .toolbar-background{background:var(--ion-color-base)}.toolbar-container{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;flex-direction:row;align-items:center;justify-content:space-between;width:100%;min-height:var(--min-height);contain:content;overflow:hidden;z-index:10;box-sizing:border-box}.toolbar-background{left:0;right:0;top:0;bottom:0;position:absolute;transform:translateZ(0);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;opacity:calc(var(--opacity) * var(--opacity-scale));z-index:-1;pointer-events:none}::slotted(ion-progress-bar){left:0;right:0;bottom:0;position:absolute}:host{--background:var(--ion-toolbar-background, var(--ion-color-step-50, #f7f7f7));--color:var(--ion-toolbar-color, var(--ion-text-color, #000));--border-color:var(--ion-toolbar-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.2))));--padding-top:3px;--padding-bottom:3px;--padding-start:4px;--padding-end:4px;--min-height:44px}.toolbar-content{flex:1;order:4;min-width:0}:host(.toolbar-segment) .toolbar-content{display:inline-flex}:host(.toolbar-searchbar) .toolbar-container{padding-top:0;padding-bottom:0}:host(.toolbar-searchbar) ::slotted(*){align-self:start}:host(.toolbar-searchbar) ::slotted(ion-chip){margin-top:3px}:host(.toolbar-searchbar) ::slotted(ion-back-button){height:38px}::slotted(ion-buttons){min-height:38px}::slotted([slot=start]){order:2}::slotted([slot=secondary]){order:3}::slotted([slot=primary]){order:5;text-align:end}::slotted([slot=end]){order:6;text-align:end}:host(.toolbar-title-large) .toolbar-container{flex-wrap:wrap;align-items:flex-start}:host(.toolbar-title-large) .toolbar-content ion-title{flex:1;order:8;min-width:100%}";const Xn=":host{--border-width:0;--border-style:solid;--opacity:1;--opacity-scale:1;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-padding-start:var(--ion-safe-area-left);padding-inline-start:var(--ion-safe-area-left);-webkit-padding-end:var(--ion-safe-area-right);padding-inline-end:var(--ion-safe-area-right);display:block;position:relative;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);contain:content;z-index:10;box-sizing:border-box}:host(.ion-color){color:var(--ion-color-contrast)}:host(.ion-color) .toolbar-background{background:var(--ion-color-base)}.toolbar-container{-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;flex-direction:row;align-items:center;justify-content:space-between;width:100%;min-height:var(--min-height);contain:content;overflow:hidden;z-index:10;box-sizing:border-box}.toolbar-background{left:0;right:0;top:0;bottom:0;position:absolute;transform:translateZ(0);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;opacity:calc(var(--opacity) * var(--opacity-scale));z-index:-1;pointer-events:none}::slotted(ion-progress-bar){left:0;right:0;bottom:0;position:absolute}:host{--background:var(--ion-toolbar-background, var(--ion-background-color, #fff));--color:var(--ion-toolbar-color, var(--ion-text-color, #424242));--border-color:var(--ion-toolbar-border-color, var(--ion-border-color, var(--ion-color-step-150, #c1c4cd)));--padding-top:0;--padding-bottom:0;--padding-start:0;--padding-end:0;--min-height:56px}.toolbar-content{flex:1;order:3;min-width:0;max-width:100%}::slotted(.buttons-first-slot){-webkit-margin-start:4px;margin-inline-start:4px}::slotted(.buttons-last-slot){-webkit-margin-end:4px;margin-inline-end:4px}::slotted([slot=start]){order:2}::slotted([slot=secondary]){order:4}::slotted([slot=primary]){order:5;text-align:end}::slotted([slot=end]){order:6;text-align:end}";const Hn=class{constructor(e){t(this,e);this.childrenStyles=new Map;this.color=undefined}componentWillLoad(){const t=Array.from(this.el.querySelectorAll("ion-buttons"));const e=t.find((t=>t.slot==="start"));if(e){e.classList.add("buttons-first-slot")}const i=t.reverse();const n=i.find((t=>t.slot==="end"))||i.find((t=>t.slot==="primary"))||i.find((t=>t.slot==="secondary"));if(n){n.classList.add("buttons-last-slot")}}childrenStyle(t){t.stopPropagation();const e=t.target.tagName;const i=t.detail;const n={};const o=this.childrenStyles.get(e)||{};let s=false;Object.keys(i).forEach((t=>{const e=`toolbar-${t}`;const r=i[t];if(r!==o[e]){s=true}if(r){n[e]=true}}));if(s){this.childrenStyles.set(e,n);a(this)}}render(){const t=y(this);const n={};this.childrenStyles.forEach((t=>{Object.assign(n,t)}));return e(i,{class:Object.assign(Object.assign({},n),N(this.color,{[t]:true,"in-toolbar":B("ion-toolbar",this.el)}))},e("div",{class:"toolbar-background"}),e("div",{class:"toolbar-container"},e("slot",{name:"start"}),e("slot",{name:"secondary"}),e("div",{class:"toolbar-content"},e("slot",null)),e("slot",{name:"primary"}),e("slot",{name:"end"})))}get el(){return n(this)}};Hn.style={ios:Jn,md:Xn};export{ct as gl_address_search,dt as gl_app,ft as gl_basemap_switcher,zt as gl_basemaps,St as gl_download_button,Ct as gl_download_file,Et as gl_download_list,It as gl_drawer,Tt as gl_drawer_toggle,jt as gl_fullscreen,Lt as gl_legend,Nt as gl_legend_item,Zt as gl_map,Me as gl_popup,ze as gl_share,Se as gl_share_button,Ce as gl_story,Ee as gl_story_button,Ae as gl_story_step,Te as gl_style,Fe as gl_table,Oe as gl_table_column,De as gl_table_column_visibility,je as gl_table_column_visibility_button,Le as gl_table_column_visibility_toggle,Re as gl_table_export_button,Be as ion_app,Ze as ion_backdrop,Xe as ion_button,Ye as ion_buttons,ti as ion_content,ai as ion_footer,yi as ion_header,Ii as ion_icon,Oi as ion_item,Li as ion_item_divider,Bi as ion_item_group,Vi as ion_label,Wi as ion_list,Hi as ion_list_header,sn as ion_menu,dn as ion_menu_toggle,mn as ion_note,vn as ion_radio,yn as ion_radio_group,kn as ion_ripple_effect,An as ion_searchbar,Dn as ion_split_pane,Rn as ion_thumbnail,Un as ion_title,Gn as ion_toggle,Hn as ion_toolbar};
|
|
8
|
+
//# sourceMappingURL=p-1bffb772.entry.js.map
|