@maptiler/sdk 1.1.2 → 1.2.0
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/.eslintrc.cjs +15 -5
- package/.github/pull_request_template.md +11 -0
- package/.github/workflows/format-lint.yml +24 -0
- package/CHANGELOG.md +94 -51
- package/colorramp.md +93 -0
- package/dist/maptiler-sdk.d.ts +1207 -123
- package/dist/maptiler-sdk.min.mjs +3 -1
- package/dist/maptiler-sdk.mjs +3561 -485
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/maptiler-sdk.umd.js +3825 -869
- package/dist/maptiler-sdk.umd.js.map +1 -1
- package/dist/maptiler-sdk.umd.min.js +51 -49
- package/package.json +27 -13
- package/readme.md +298 -0
- package/rollup.config.js +2 -16
- package/src/Map.ts +489 -357
- package/src/MaptilerGeolocateControl.ts +23 -20
- package/src/MaptilerLogoControl.ts +3 -3
- package/src/MaptilerNavigationControl.ts +9 -6
- package/src/MaptilerTerrainControl.ts +15 -14
- package/src/Minimap.ts +373 -0
- package/src/Point.ts +3 -5
- package/src/colorramp.ts +1216 -0
- package/src/config.ts +4 -3
- package/src/converters/index.ts +1 -0
- package/src/converters/xml.ts +681 -0
- package/src/defaults.ts +1 -1
- package/src/helpers/index.ts +27 -0
- package/src/helpers/stylehelper.ts +395 -0
- package/src/helpers/vectorlayerhelpers.ts +1511 -0
- package/src/index.ts +10 -0
- package/src/language.ts +116 -79
- package/src/mapstyle.ts +4 -2
- package/src/tools.ts +68 -16
- package/tsconfig.json +8 -5
- package/vite.config.ts +10 -0
- package/demos/maptiler-sdk.css +0 -147
- package/demos/maptiler-sdk.umd.js +0 -4041
- package/demos/mountain.html +0 -67
- package/demos/simple.html +0 -67
- package/demos/transform-request.html +0 -81
|
@@ -1 +1,3 @@
|
|
|
1
|
-
import a from"maplibre-gl";export*from"maplibre-gl";import{Base64 as Q}from"js-base64";import tt from"events";import{config as C,expandMapStyle as et,MapStyleVariant as rt,ReferenceMapStyle as nt,MapStyle as it,mapStylePresetList as at,geolocation as w}from"@maptiler/client";import{LanguageGeocoding as Te,MapStyle as Ce,MapStyleVariant as be,ReferenceMapStyle as ve,ServiceError as we,coordinates as Ee,data as Ie,geocoding as Re,geolocation as Ne,staticMaps as Pe}from"@maptiler/client";import{v4 as ot}from"uuid";const f={AUTO:"auto",STYLE_LOCK:"style_lock",LATIN:"latin",NON_LATIN:"nonlatin",LOCAL:"",ALBANIAN:"sq",AMHARIC:"am",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BASQUE:"eu",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CORSICAN:"co",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HINDI:"hi",HUNGARIAN:"hu",ICELANDIC:"is",INDONESIAN:"id",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",JAPANESE_HIRAGANA:"ja-Hira",JAPANESE_KANA:"ja_kana",JAPANESE_LATIN:"ja_rm",JAPANESE_2018:"ja-Latn",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",KOREAN_LATIN:"ko-Latn",KURDISH:"ku",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALAYALAM:"ml",MALTESE:"mt",NORWEGIAN:"no",OCCITAN:"oc",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SERBIAN_LATIN:"sr-Latn",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",TAMIL:"ta",TELUGU:"te",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},st=new Set(Object.values(f));function E(r){return st.has(r)}const lt=new Set(Object.values(f));function b(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const r=Array.from(new Set(navigator.languages.map(t=>t.split("-")[0]))).filter(t=>lt.has(t));return r.length?r[0]:f.LATIN}const I=ot();let R=class extends tt{constructor(){super(),this.primaryLanguage=f.AUTO,this.secondaryLanguage=null,this.session=!0,this._unit="metric",this._apiKey=""}set unit(t){this._unit=t,this.emit("unit",t)}get unit(){return this._unit}set apiKey(t){this._apiKey=t,C.apiKey=t,this.emit("apiKey",t)}get apiKey(){return this._apiKey}set fetch(t){C.fetch=t}get fetch(){return C.fetch}};const L=new R,y={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:f.AUTO,secondaryLanguage:f.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(y);class N extends a.LogoControl{onAdd(t){return super.onAdd(t)}}class v extends N{constructor(t={}){var e,i;super(t),this.logoURL="",this.linkURL="",this.logoURL=(e=t.logoURL)!=null?e:y.maptilerLogoURL,this.linkURL=(i=t.linkURL)!=null?i:y.maptilerURL}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const e=window.document.createElement("a");return e.style.backgroundRepeat="no-repeat",e.style.cursor="pointer",e.style.display="block",e.style.height="23px",e.style.margin="0 0 -4px -4px",e.style.overflow="hidden",e.style.width="88px",e.style.backgroundImage=`url(${this.logoURL})`,e.style.backgroundSize="100px 30px",e.style.width="100px",e.style.height="30px",e.target="_blank",e.rel="noopener",e.href=this.linkURL,e.setAttribute("aria-label","MapTiler logo"),e.setAttribute("rel","noopener"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}var ct=Object.defineProperty,P=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable,O=(r,t,e)=>t in r?ct(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,M=(r,t)=>{for(var e in t||(t={}))ht.call(t,e)&&O(r,e,t[e]);if(P)for(var e of P(t))ut.call(t,e)&&O(r,e,t[e]);return r};function gt(){a.getRTLTextPluginStatus()==="unavailable"&&a.setRTLTextPlugin(y.rtlPluginURL,null,!0)}function dt(r,t){r.forEach(e=>{t[e]&&(t[e]=t[e].bind(t))})}function _(r,t,e){const i=window.document.createElement(r);return t!==void 0&&(i.className=t),e&&e.appendChild(i),i}function pt(r){r.parentNode&&r.parentNode.removeChild(r)}function U(r,t){let e=null;try{e=new URL(r)}catch{return{url:r}}return e.host===y.maptilerApiHost&&(e.searchParams.has("key")||e.searchParams.append("key",L.apiKey),L.session&&e.searchParams.append("mtsid",I)),{url:e.href}}function k(r=null){return function(t,e){if(r){const i=r(t,e),s=U(i.url);return M(M({},i),s)}else return U(t)}}function B(r){return r?typeof r=="string"||r instanceof String?!r.startsWith("http")&&r.toLowerCase().includes(".json")?r:et(r):r instanceof rt?r.getExpandedStyleURL():r instanceof nt?r.getDefaultVariant().getExpandedStyleURL():r:it[at[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class ${constructor(){dt(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(t){return this._map=t,this._container=_("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=_("button","maplibregl-ctrl-terrain",this._container),_("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(){pt(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(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"))}}class G extends a.NavigationControl{onAdd(t){return super.onAdd(t)}}class K extends G{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",t=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})}_createButton(t,e){const i=super._createButton(t,e);return i.clickFunction=e,i}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,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}}class j extends a.GeolocateControl{onAdd(t){return super.onAdd(t)}}var mt=Object.defineProperty,yt=Object.defineProperties,ft=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,Lt=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable,D=(r,t,e)=>t in r?mt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,St=(r,t)=>{for(var e in t||(t={}))Lt.call(t,e)&&D(r,e,t[e]);if(H)for(var e of H(t))At.call(t,e)&&D(r,e,t[e]);return r},_t=(r,t)=>yt(r,ft(t));const F=a.Marker,q=a.LngLat,xt=a.LngLatBounds;class V extends j{constructor(){super(...arguments),this.lastUpdatedCenter=new q(0,0)}_updateCamera(t){const e=new q(t.coords.longitude,t.coords.latitude),i=t.coords.accuracy,s=this._map.getBearing(),g=_t(St({bearing:s},this.options.fitBoundsOptions),{linear:!0}),h=this._map.getZoom();h>this.options.fitBoundsOptions.maxZoom&&(g.zoom=h),this._map.fitBounds(xt.fromLngLat(e,i),g,{geolocateSource:!0});let c=!1;const o=()=>{c=!0};this._map.once("click",o),this._map.once("dblclick",o),this._map.once("dragstart",o),this._map.once("mousedown",o),this._map.once("touchstart",o),this._map.once("wheel",o),this._map.once("moveend",()=>{this._map.off("click",o),this._map.off("dblclick",o),this._map.off("dragstart",o),this._map.off("mousedown",o),this._map.off("touchstart",o),this._map.off("wheel",o),!c&&(this.lastUpdatedCenter=this._map.getCenter())})}_setupUI(t){if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=_("button","maplibregl-ctrl-geolocate",this._container),_("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=_("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new F(this._dotElement),this._circleElement=_("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new F({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",e=>{const i=e.originalEvent&&e.originalEvent.type==="resize",s=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!e.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!i&&s>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const t=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],e=this._map.project(t),i=this._map.unproject([e.x,e.y]),s=this._map.unproject([e.x+20,e.y]),g=i.distanceTo(s)/20,h=Math.ceil(2*this._accuracy/g);this._circleElement.style.width=`${h}px`,this._circleElement.style.height=`${h}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}class z extends a.AttributionControl{onAdd(t){return super.onAdd(t)}}class W extends a.ScaleControl{onAdd(t){return super.onAdd(t)}}class J extends a.FullscreenControl{onAdd(t){return super.onAdd(t)}}var Tt=Object.defineProperty,Ct=Object.defineProperties,bt=Object.getOwnPropertyDescriptors,Z=Object.getOwnPropertySymbols,vt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable,Y=(r,t,e)=>t in r?Tt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Et=(r,t)=>{for(var e in t||(t={}))vt.call(t,e)&&Y(r,e,t[e]);if(Z)for(var e of Z(t))wt.call(t,e)&&Y(r,e,t[e]);return r},It=(r,t)=>Ct(r,bt(t)),S=(r,t,e)=>new Promise((i,s)=>{var g=o=>{try{c(e.next(o))}catch(m){s(m)}},h=o=>{try{c(e.throw(o))}catch(m){s(m)}},c=o=>o.done?i(o.value):Promise.resolve(o.value).then(g,h);c((e=e.apply(r,t)).next())});const X={POINT:"POINT",COUNTRY:"COUNTRY"};class Rt extends a.Map{constructor(t){var e,i,s;t.apiKey&&(L.apiKey=t.apiKey);const g=B(t.style),h=location.hash;L.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(It(Et({},t),{style:g,maplibreLogo:!1,transformRequest:k(t.transformRequest)})),this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.primaryLanguage=null,this.secondaryLanguage=null,this.terrainGrowing=!1,this.terrainFlattening=!1,this.primaryLanguage=(e=t.language)!=null?e:L.primaryLanguage,this.secondaryLanguage=L.secondaryLanguage,this.terrainExaggeration=(i=t.terrainExaggeration)!=null?i:this.terrainExaggeration,this.once("styledata",()=>S(this,null,function*(){if(!t.geolocate||t.center||t.hash&&h)return;try{if(t.geolocate===X.COUNTRY){yield this.fitToIpBounds();return}}catch(n){console.warn(n.message)}let u=null;try{yield this.centerOnIpPoint(t.zoom),u=this.getCameraHash()}catch(n){console.warn(n.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(n=>{u===this.getCameraHash()&&(this.terrain?this.easeTo({center:[n.coords.longitude,n.coords.latitude],zoom:t.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[n.coords.longitude,n.coords.latitude],zoom:t.zoom||12,duration:2e3})}))},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage),this.setSecondaryLanguage(this.secondaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>S(this,null,function*(){gt()})),this.once("load",()=>S(this,null,function*(){let u={logo:null};try{const n=Object.keys(this.style.sourceCaches).map(l=>this.getSource(l)).filter(l=>typeof l.url=="string"&&l.url.includes("tiles.json")),p=new URL(n[0].url);p.searchParams.has("key")||p.searchParams.append("key",L.apiKey),u=yield(yield fetch(p.href)).json()}catch{}if("logo"in u&&u.logo){const n=u.logo;this.addControl(new v({logoURL:n}),t.logoPosition),t.attributionControl===!1&&this.addControl(new z({customAttribution:t.customAttribution}))}else t.maptilerLogo&&this.addControl(new v,t.logoPosition);if(t.scaleControl){const n=t.scaleControl===!0||t.scaleControl===void 0?"bottom-right":t.scaleControl,p=new W({unit:L.unit});this.addControl(p,n),L.on("unit",l=>{p.setUnit(l)})}if(t.navigationControl!==!1){const n=t.navigationControl===!0||t.navigationControl===void 0?"top-right":t.navigationControl;this.addControl(new K,n)}if(t.geolocateControl!==!1){const n=t.geolocateControl===!0||t.geolocateControl===void 0?"top-right":t.geolocateControl;this.addControl(new V({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),n)}if(t.terrainControl){const n=t.terrainControl===!0||t.terrainControl===void 0?"top-right":t.terrainControl;this.addControl(new $,n)}if(t.fullscreenControl){const n=t.fullscreenControl===!0||t.fullscreenControl===void 0?"top-right":t.fullscreenControl;this.addControl(new J({}),n)}}));let c=!1,o=!1,m=null;this.once("load",u=>{c=!0,o&&this.fire("loadWithTerrain",m)});const d=u=>{u.terrain&&(o=!0,m={type:"loadWithTerrain",target:this,terrain:u.terrain},this.off("terrain",d),c&&this.fire("loadWithTerrain",m))};this.on("terrain",d),t.terrain&&this.enableTerrain((s=t.terrainExaggeration)!=null?s:this.terrainExaggeration)}onLoadAsync(){return S(this,null,function*(){return new Promise((t,e)=>{if(this.loaded())return t(this);this.once("load",i=>{t(this)})})})}onLoadWithTerrainAsync(){return S(this,null,function*(){return new Promise((t,e)=>{if(this.loaded()&&this.terrain)return t(this);this.once("loadWithTerrain",i=>{t(this)})})})}setStyle(t,e){return super.setStyle(B(t),e)}setLanguage(t=y.primaryLanguage){if(t===f.AUTO)return this.setLanguage(b());this.setPrimaryLanguage(t)}setPrimaryLanguage(t=y.primaryLanguage){if(this.primaryLanguage===f.STYLE_LOCK){console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");return}E(t)&&(this.primaryLanguage=t,this.onStyleReady(()=>{if(t===f.AUTO)return this.setPrimaryLanguage(b());const e=this.getStyle().layers,i=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,s=/^\s*name\s*(:\s*(\S*))?\s*$/,g=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/,h=/^(.*)({\s*name\s*(:\s*(\S*))?\s*})(.*)$/,c=t?`name:${t}`:"name",o=["case",["has",c],["get",c],["get","name"]];for(let m=0;m<e.length;m+=1){const d=e[m],u=d.layout;if(!u||!u["text-field"])continue;const n=this.getLayoutProperty(d.id,"text-field");let p;if(Array.isArray(n)&&n.length>=2&&n[0].trim().toLowerCase()==="concat"){const l=n.slice();for(let x=0;x<n.length;x+=1){const A=n[x];if((typeof A=="string"||A instanceof String)&&i.exec(A.toString())){l[x]=o;break}else if(Array.isArray(A)&&A.length>=2&&A[0].trim().toLowerCase()==="get"&&s.exec(A[1].toString())){l[x]=o;break}else if(Array.isArray(A)&&A.length===4&&A[0].trim().toLowerCase()==="case"){l[x]=o;break}}this.setLayoutProperty(d.id,"text-field",l)}else if(Array.isArray(n)&&n.length>=2&&n[0].trim().toLowerCase()==="get"&&s.exec(n[1].toString())){const l=o;this.setLayoutProperty(d.id,"text-field",l)}else if((typeof n=="string"||n instanceof String)&&i.exec(n.toString())){const l=o;this.setLayoutProperty(d.id,"text-field",l)}else if(Array.isArray(n)&&n.length===4&&n[0].trim().toLowerCase()==="case"){const l=o;this.setLayoutProperty(d.id,"text-field",l)}else if((typeof n=="string"||n instanceof String)&&(p=g.exec(n.toString()))!==null){const l=`{${c}}${p[3]}{name${p[4]||""}}`;this.setLayoutProperty(d.id,"text-field",l)}else if((typeof n=="string"||n instanceof String)&&(p=h.exec(n.toString()))!==null){const l=`${p[1]}{${c}}${p[5]}`;this.setLayoutProperty(d.id,"text-field",l)}}}))}setSecondaryLanguage(t=y.secondaryLanguage){if(this.primaryLanguage===f.STYLE_LOCK){console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");return}E(t)&&(this.secondaryLanguage=t,this.onStyleReady(()=>{if(t===f.AUTO)return this.setSecondaryLanguage(b());const e=this.getStyle().layers,i=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,s=/^\s*name\s*(:\s*(\S*))?\s*$/,g=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/;let h;for(let c=0;c<e.length;c+=1){const o=e[c],m=o.layout;if(!m||!m["text-field"])continue;const d=this.getLayoutProperty(o.id,"text-field");let u;if(Array.isArray(d)&&d.length>=2&&d[0].trim().toLowerCase()==="concat"){u=d.slice();let n=0;for(let p=0;p<d.length;p+=1){const l=d[p];if((typeof l=="string"||l instanceof String)&&i.exec(l.toString())){if(n===1){u[p]=`{name:${t}}`;break}n+=1}else if(Array.isArray(l)&&l.length>=2&&l[0].trim().toLowerCase()==="get"&&s.exec(l[1].toString())){if(n===1){u[p][1]=`name:${t}`;break}n+=1}else if(Array.isArray(l)&&l.length===4&&l[0].trim().toLowerCase()==="case"){if(n===1){u[p]=["get",`name:${t}`];break}n+=1}}this.setLayoutProperty(o.id,"text-field",u)}else if((typeof d=="string"||d instanceof String)&&(h=g.exec(d.toString()))!==null){const n=t?`name:${t}`:"name";u=`{name${h[1]||""}}${h[3]}{${n}}`,this.setLayoutProperty(o.id,"text-field",u)}}}))}getPrimaryLanguage(){return this.primaryLanguage}getSecondaryLanguage(){return this.secondaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(t,e=1e3){if(!this.terrain)return;const i=performance.now(),s=this.terrain.exaggeration,g=t-s,h=()=>{if(!this.terrain||this.terrainFlattening)return;const c=(performance.now()-i)/e;if(c<.99){const o=1-Math.pow(1-c,4),m=s+o*g;this.terrain.exaggeration=m,requestAnimationFrame(h)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=t;this.triggerRepaint()};this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(h)}enableTerrain(t=this.terrainExaggeration){if(t<0){console.warn("Terrain exaggeration cannot be negative.");return}const e=s=>S(this,null,function*(){!this.terrain||s.type!=="data"||s.dataType!=="source"||!("source"in s)||s.sourceId!=="maptiler-terrain"||s.source.type!=="raster-dem"||s.isSourceLoaded&&(this.off("data",e),this.growTerrain(t))}),i=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=t,this.on("data",e),this.addSource(y.terrainSourceId,{type:"raster-dem",url:y.terrainSourceURL}),this.setTerrain({source:y.terrainSourceId,exaggeration:0})};if(this.getTerrain()){this.isTerrainEnabled=!0,this.growTerrain(t);return}this.loaded()||this.isTerrainEnabled?i():this.once("load",()=>{this.getTerrain()&&this.getSource(y.terrainSourceId)||i()})}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const t=1*1e3,e=performance.now(),i=this.terrain.exaggeration,s=()=>{if(!this.terrain||this.terrainGrowing)return;const g=(performance.now()-e)/t;if(g<.99){const h=Math.pow(1-g,4),c=i*h;this.terrain.exaggeration=c,requestAnimationFrame(s)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(null),this.getSource(y.terrainSourceId)&&this.removeSource(y.terrainSourceId);this.triggerRepaint()};this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(s)}setTerrainExaggeration(t,e=!0){!e&&this.terrain?(this.terrainExaggeration=t,this.terrain.exaggeration=t,this.triggerRepaint()):this.enableTerrain(t)}onStyleReady(t){this.isStyleLoaded()?t():this.once("styledata",()=>{t()})}fitToIpBounds(){return S(this,null,function*(){const t=yield w.info();this.fitBounds(t.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(t){return S(this,null,function*(){const e=yield w.info();this.jumpTo({center:[e.longitude,e.latitude],zoom:t||11})})}getCameraHash(){const t=new Float32Array(5),e=this.getCenter();return t[0]=e.lng,t[1]=e.lat,t[2]=this.getZoom(),t[3]=this.getPitch(),t[4]=this.getBearing(),Q.fromUint8Array(new Uint8Array(t.buffer))}getSdkConfig(){return L}getMaptilerSessionId(){return I}setTransformRequest(t){return super.setTransformRequest(k(t)),this}}class Nt extends a.Marker{addTo(t){return super.addTo(t)}}class Pt extends a.Popup{addTo(t){return super.addTo(t)}}class Ot extends a.Style{constructor(t,e={}){super(t,e)}}class Mt extends a.CanvasSource{onAdd(t){super.onAdd(t)}}class Ut extends a.GeoJSONSource{onAdd(t){super.onAdd(t)}}class kt extends a.ImageSource{onAdd(t){super.onAdd(t)}}class Bt extends a.RasterTileSource{onAdd(t){super.onAdd(t)}}class $t extends a.RasterDEMTileSource{onAdd(t){super.onAdd(t)}}class Gt extends a.VectorTileSource{onAdd(t){super.onAdd(t)}}class Kt extends a.VideoSource{onAdd(t){super.onAdd(t)}}class jt extends a.TerrainControl{onAdd(t){return super.onAdd(t)}}class T{constructor(t,e){this.x=t,this.y=e}_matMult(t){const 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(t){return this.x+=t.x,this.y+=t.y,this}_sub(t){return this.x-=t.x,this.y-=t.y,this}_mult(t){return this.x*=t,this.y*=t,this}_div(t){return this.x/=t,this.y/=t,this}_multByPoint(t){return this.x*=t.x,this.y*=t.y,this}_divByPoint(t){return this.x/=t.x,this.y/=t.y,this}_unit(){return this._div(this.mag()),this}_perp(){const t=this.y;return this.y=this.x,this.x=-t,this}_rotate(t){const e=Math.cos(t),i=Math.sin(t),s=e*this.x-i*this.y,g=i*this.x+e*this.y;return this.x=s,this.y=g,this}_rotateAround(t,e){const i=Math.cos(t),s=Math.sin(t),g=e.x+i*(this.x-e.x)-s*(this.y-e.y),h=e.y+s*(this.x-e.x)+i*(this.y-e.y);return this.x=g,this.y=h,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new T(this.x,this.y)}add(t){return this.clone()._add(t)}sub(t){return this.clone()._sub(t)}multByPoint(t){return this.clone()._multByPoint(t)}divByPoint(t){return this.clone()._divByPoint(t)}mult(t){return this.clone()._mult(t)}div(t){return this.clone()._div(t)}rotate(t){return this.clone()._rotate(t)}rotateAround(t,e){return this.clone()._rotateAround(t,e)}matMult(t){return this.clone()._matMult(t)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}round(){return this.clone()._round()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}equals(t){return this.x===t.x&&this.y===t.y}dist(t){return Math.sqrt(this.distSqr(t))}distSqr(t){const e=t.x-this.x,i=t.y-this.y;return e*e+i*i}angle(){return Math.atan2(this.y,this.x)}angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)}angleWith(t){return this.angleWithSep(t.x,t.y)}angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)}static convert(t){return t instanceof T?t:Array.isArray(t)?new T(t[0],t[1]):t}}const{setRTLTextPlugin:Ht,getRTLTextPluginStatus:Dt,LngLat:Ft,LngLatBounds:qt,MercatorCoordinate:Vt,Evented:zt,AJAXError:Wt,prewarm:Jt,clearPrewarmedResources:Zt,version:Yt,workerCount:Xt,maxParallelImageRequests:Qt,workerUrl:te,addProtocol:ee,removeProtocol:re}=a,ne=a.Map,ie=a.Marker,ae=a.Popup,oe=a.Style,se=a.CanvasSource,le=a.GeoJSONSource,ce=a.ImageSource,he=a.RasterTileSource,ue=a.RasterDEMTileSource,ge=a.VectorTileSource,de=a.VideoSource;a.NavigationControl,a.GeolocateControl,a.AttributionControl,a.LogoControl,a.ScaleControl,a.FullscreenControl,a.TerrainControl;export{Wt as AJAXError,z as AttributionControl,Mt as CanvasSource,se as CanvasSourceMLGL,zt as Evented,J as FullscreenControl,Ut as GeoJSONSource,le as GeoJSONSourceMLGL,j as GeolocateControl,X as GeolocationType,kt as ImageSource,ce as ImageSourceMLGL,f as Language,Te as LanguageGeocoding,Ft as LngLat,qt as LngLatBounds,N as LogoControl,Rt as Map,ne as MapMLGL,Ce as MapStyle,be as MapStyleVariant,V as MaptilerGeolocateControl,v as MaptilerLogoControl,K as MaptilerNavigationControl,$ as MaptilerTerrainControl,Nt as Marker,ie as MarkerMLGL,Vt as MercatorCoordinate,G as NavigationControl,T as Point,Pt as Popup,ae as PopupMLGL,$t as RasterDEMTileSource,ue as RasterDEMTileSourceMLGL,Bt as RasterTileSource,he as RasterTileSourceMLGL,ve as ReferenceMapStyle,W as ScaleControl,R as SdkConfig,we as ServiceError,Ot as Style,oe as StyleMLGL,jt as TerrainControl,Gt as VectorTileSource,ge as VectorTileSourceMLGL,Kt as VideoSource,de as VideoSourceMLGL,ee as addProtocol,Zt as clearPrewarmedResources,L as config,Ee as coordinates,Ie as data,Re as geocoding,Ne as geolocation,Dt as getRTLTextPluginStatus,Qt as maxParallelImageRequests,Jt as prewarm,re as removeProtocol,Ht as setRTLTextPlugin,Pe as staticMaps,Yt as version,Xt as workerCount,te as workerUrl};
|
|
1
|
+
import y from"maplibre-gl";export*from"maplibre-gl";import{Base64 as Wt}from"js-base64";import Zt from"events";import{config as Ie,expandMapStyle as Yt,MapStyleVariant as qt,ReferenceMapStyle as Jt,MapStyle as Xt,mapStylePresetList as Qt,geolocation as Ve}from"@maptiler/client";import{LanguageGeocoding as pa,MapStyle as ha,MapStyleVariant as ma,ReferenceMapStyle as da,ServiceError as ya,coordinates as va,data as ga,geocoding as fa,geolocation as Aa,staticMaps as La}from"@maptiler/client";import{v4 as eo}from"uuid";const S={VISITOR:"visitor",VISITOR_ENGLISH:"visitor_en",STYLE:"style",AUTO:"auto",STYLE_LOCK:"style_lock",LATIN:"name:latin",NON_LATIN:"name:nonlatin",LOCAL:"name",INTERNATIONAL:"name_int",ALBANIAN:"name:sq",AMHARIC:"name:am",ARABIC:"name:ar",ARMENIAN:"name:hy",AZERBAIJANI:"name:az",BASQUE:"name:eu",BELORUSSIAN:"name:be",BENGALI:"name:bn",BOSNIAN:"name:bs",BRETON:"name:br",BULGARIAN:"name:bg",CATALAN:"name:ca",CHINESE:"name:zh",TRADITIONAL_CHINESE:"name:zh-Hant",SIMPLIFIED_CHINESE:"name:zh-Hans",CORSICAN:"name:co",CROATIAN:"name:hr",CZECH:"name:cs",DANISH:"name:da",DUTCH:"name:nl",ENGLISH:"name:en",ESPERANTO:"name:eo",ESTONIAN:"name:et",FINNISH:"name:fi",FRENCH:"name:fr",FRISIAN:"name:fy",GEORGIAN:"name:ka",GERMAN:"name:de",GREEK:"name:el",HEBREW:"name:he",HINDI:"name:hi",HUNGARIAN:"name:hu",ICELANDIC:"name:is",INDONESIAN:"name:id",IRISH:"name:ga",ITALIAN:"name:it",JAPANESE:"name:ja",JAPANESE_HIRAGANA:"name:ja-Hira",JAPANESE_KANA:"name:ja_kana",JAPANESE_LATIN:"name:ja_rm",JAPANESE_2018:"name:ja-Latn",KANNADA:"name:kn",KAZAKH:"name:kk",KOREAN:"name:ko",KOREAN_LATIN:"name:ko-Latn",KURDISH:"name:ku",ROMAN_LATIN:"name:la",LATVIAN:"name:lv",LITHUANIAN:"name:lt",LUXEMBOURGISH:"name:lb",MACEDONIAN:"name:mk",MALAYALAM:"name:ml",MALTESE:"name:mt",NORWEGIAN:"name:no",OCCITAN:"name:oc",PERSIAN:"name:fa",POLISH:"name:pl",PORTUGUESE:"name:pt",PUNJABI:"name:pa",WESTERN_PUNJABI:"name:pnb",ROMANIAN:"name:ro",ROMANSH:"name:rm",RUSSIAN:"name:ru",SCOTTISH_GAELIC:"name:gd",SERBIAN_CYRILLIC:"name:sr",SERBIAN_LATIN:"name:sr-Latn",SLOVAK:"name:sk",SLOVENE:"name:sl",SPANISH:"name:es",SWEDISH:"name:sv",TAMIL:"name:ta",TELUGU:"name:te",THAI:"name:th",TURKISH:"name:tr",UKRAINIAN:"name:uk",URDU:"name:ur",VIETNAMIAN_LATIN:"name:vi",WELSH:"name:cy"},to=new Set(Object.values(S));function Ke(o){return to.has(o)}const oo=new Set(Object.values(S));function We(){if(typeof navigator>"u")return`name:${Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0]}`;const o=Array.from(new Set(navigator.languages.map(e=>`name:${e.split("-")[0]}`))).filter(e=>oo.has(e));return o.length?o[0]:S.LOCAL}const Z={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:S.STYLE,secondaryLanguage:S.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(Z);var ro=Object.defineProperty,ao=(o,e,t)=>e in o?ro(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,de=(o,e,t)=>(ao(o,typeof e!="symbol"?e+"":e,t),t);const Ze=eo();let Ye=class extends Zt{constructor(){super(),de(this,"primaryLanguage",Z.primaryLanguage),de(this,"secondaryLanguage"),de(this,"session",!0),de(this,"_unit","metric"),de(this,"_apiKey","")}set unit(e){this._unit=e,this.emit("unit",e)}get unit(){return this._unit}set apiKey(e){this._apiKey=e,Ie.apiKey=e,this.emit("apiKey",e)}get apiKey(){return this._apiKey}set fetch(e){Ie.fetch=e}get fetch(){return Ie.fetch}};const H=new Ye;class qe extends y.LogoControl{onAdd(e){return super.onAdd(e)}}var no=Object.defineProperty,lo=(o,e,t)=>e in o?no(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Je=(o,e,t)=>(lo(o,typeof e!="symbol"?e+"":e,t),t);class Te extends qe{constructor(e={}){var t,r;super(e),Je(this,"logoURL",""),Je(this,"linkURL",""),this.logoURL=(t=e.logoURL)!=null?t:Z.maptilerLogoURL,this.linkURL=(r=e.linkURL)!=null?r:Z.maptilerURL}onAdd(e){var t;this._map=e,this._compact=(t=this.options.compact)!=null?t:!1,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const r=window.document.createElement("a");return r.style.backgroundRepeat="no-repeat",r.style.cursor="pointer",r.style.display="block",r.style.height="23px",r.style.margin="0 0 -4px -4px",r.style.overflow="hidden",r.style.width="88px",r.style.backgroundImage=`url(${this.logoURL})`,r.style.backgroundSize="100px 30px",r.style.width="100px",r.style.height="30px",r.target="_blank",r.rel="noopener",r.href=this.linkURL,r.setAttribute("aria-label","MapTiler logo"),r.setAttribute("rel","noopener"),this._container.appendChild(r),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}var io=Object.defineProperty,Xe=Object.getOwnPropertySymbols,so=Object.prototype.hasOwnProperty,uo=Object.prototype.propertyIsEnumerable,Qe=(o,e,t)=>e in o?io(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,et=(o,e)=>{for(var t in e||(e={}))so.call(e,t)&&Qe(o,t,e[t]);if(Xe)for(var t of Xe(e))uo.call(e,t)&&Qe(o,t,e[t]);return o};function co(){y.getRTLTextPluginStatus()==="unavailable"&&y.setRTLTextPlugin(Z.rtlPluginURL,o=>{o&&console.error(o)},!0)}function po(o,e){o.forEach(t=>{typeof e[t]=="function"&&(e[t]=e[t].bind(e))})}function te(o,e,t){const r=window.document.createElement(o);return e!==void 0&&(r.className=e),t&&t.appendChild(r),r}function tt(o){o.parentNode&&o.parentNode.removeChild(o)}function ot(o,e){let t=null;try{t=new URL(o)}catch{return{url:o}}return t.host===Z.maptilerApiHost&&(t.searchParams.has("key")||t.searchParams.append("key",H.apiKey),H.session&&t.searchParams.append("mtsid",Ze)),{url:t.href}}function rt(o){return function(e,t){var r;if(o!==void 0){const a=o(e,t),n=ot((r=a?.url)!=null?r:"");return et(et({},a),n)}else return ot(e)}}function at(){return Math.random().toString(36).substring(2)}function ve(o){return/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi.test(o)}function ho(o){try{return JSON.parse(o)}catch{}return null}function nt(o){return o?typeof o=="string"||o instanceof String?!o.startsWith("http")&&o.toLowerCase().includes(".json")?o:Yt(o):o instanceof qt?o.getExpandedStyleURL():o instanceof Jt?o.getDefaultVariant().getExpandedStyleURL():o:Xt[Qt[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}var mo=Object.defineProperty,yo=(o,e,t)=>e in o?mo(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,xe=(o,e,t)=>(yo(o,typeof e!="symbol"?e+"":e,t),t);class lt{constructor(){xe(this,"_map"),xe(this,"_container"),xe(this,"_terrainButton"),po(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(e){return this._map=e,this._container=te("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=te("button","maplibregl-ctrl-terrain",this._container),te("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(){tt(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(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"))}}class it extends y.NavigationControl{onAdd(e){return super.onAdd(e)}}var vo=Object.defineProperty,go=(o,e,t)=>e in o?vo(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,fo=(o,e,t)=>(go(o,typeof e!="symbol"?e+"":e,t),t);class st extends it{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),fo(this,"_rotateCompassArrow",()=>{const e=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,this._map.transform.pitch)}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",e=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})}_createButton(e,t){const r=super._createButton(e,t);return r.clickFunction=t,r}}class ut extends y.GeolocateControl{onAdd(e){return super.onAdd(e)}}var Ao=Object.defineProperty,Lo=Object.defineProperties,wo=Object.getOwnPropertyDescriptors,ct=Object.getOwnPropertySymbols,bo=Object.prototype.hasOwnProperty,So=Object.prototype.propertyIsEnumerable,Re=(o,e,t)=>e in o?Ao(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Co=(o,e)=>{for(var t in e||(e={}))bo.call(e,t)&&Re(o,t,e[t]);if(ct)for(var t of ct(e))So.call(e,t)&&Re(o,t,e[t]);return o},Io=(o,e)=>Lo(o,wo(e)),ge=(o,e,t)=>(Re(o,typeof e!="symbol"?e+"":e,t),t);const pt=y.Marker,ht=y.LngLat,To=y.LngLatBounds;class mt extends ut{constructor(){super(...arguments),ge(this,"lastUpdatedCenter",new ht(0,0)),ge(this,"_updateCamera",e=>{var t,r,a;const n=new ht(e.coords.longitude,e.coords.latitude),l=e.coords.accuracy,s=this._map.getBearing(),i=Io(Co({bearing:s},this.options.fitBoundsOptions),{linear:!0}),u=this._map.getZoom();u>((a=(r=(t=this.options)==null?void 0:t.fitBoundsOptions)==null?void 0:r.maxZoom)!=null?a:30)&&(i.zoom=u),this._map.fitBounds(To.fromLngLat(n,l),i,{geolocateSource:!0});let c=!1;const p=()=>{c=!0};this._map.once("click",p),this._map.once("dblclick",p),this._map.once("dragstart",p),this._map.once("mousedown",p),this._map.once("touchstart",p),this._map.once("wheel",p),this._map.once("moveend",()=>{this._map.off("click",p),this._map.off("dblclick",p),this._map.off("dragstart",p),this._map.off("mousedown",p),this._map.off("touchstart",p),this._map.off("wheel",p),!c&&(this.lastUpdatedCenter=this._map.getCenter())})}),ge(this,"_setupUI",e=>{if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=te("button","maplibregl-ctrl-geolocate",this._container),te("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",e===!1){const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.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=te("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new pt({element:this._dotElement}),this._circleElement=te("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new pt({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",t=>{const r=t.originalEvent&&t.originalEvent.type==="resize",a=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!t.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!r&&a>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}),ge(this,"_onZoom",()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const e=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],t=this._map.project(e),r=this._map.unproject([t.x,t.y]),a=this._map.unproject([t.x+20,t.y]),n=r.distanceTo(a)/20,l=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}}class dt extends y.AttributionControl{onAdd(e){return super.onAdd(e)}}class yt extends y.ScaleControl{onAdd(e){return super.onAdd(e)}}class vt extends y.FullscreenControl{onAdd(e){return super.onAdd(e)}}var xo=Object.defineProperty,Ro=Object.defineProperties,_o=Object.getOwnPropertyDescriptors,gt=Object.getOwnPropertySymbols,Eo=Object.prototype.hasOwnProperty,Oo=Object.prototype.propertyIsEnumerable,_e=(o,e,t)=>e in o?xo(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,ce=(o,e)=>{for(var t in e||(e={}))Eo.call(e,t)&&_e(o,t,e[t]);if(gt)for(var t of gt(e))Oo.call(e,t)&&_e(o,t,e[t]);return o},ft=(o,e)=>Ro(o,_o(e)),Po=(o,e,t)=>(_e(o,typeof e!="symbol"?e+"":e,t),t),Ee=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)},A=(o,e,t)=>(Ee(o,e,"read from private field"),t?t.call(o):e.get(o)),X=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)},pe=(o,e,t,r)=>(Ee(o,e,"write to private field"),r?r.call(o,t):e.set(o,t),t),V=(o,e,t)=>(Ee(o,e,"access private method"),t),K,Q,ae,At,ne,Y,fe,Oe,Lt,W,q,Pe,wt;let Ne=class{constructor(e,t){X(this,Oe),X(this,W),X(this,Pe),X(this,K,void 0),Po(this,"map"),X(this,Q,void 0),X(this,ae,void 0),X(this,At,void 0),X(this,ne,void 0),X(this,Y,!1),X(this,fe,void 0);var r;e.style!==void 0&&pe(this,Y,!0),pe(this,K,ft(ce(ft(ce({zoomAdjust:-4,position:"top-right"},t),{forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1}),e),{containerStyle:ce({border:"1px solid #000",width:"400px",height:"300px"},(r=e.containerStyle)!=null?r:{})})),e.lockZoom!==void 0&&(A(this,K).minZoom=e.lockZoom,A(this,K).maxZoom=e.lockZoom)}setStyle(e,t){A(this,Y)||this.map.setStyle(e,t),V(this,W,q).call(this)}addLayer(e,t){return A(this,Y)||this.map.addLayer(e,t),V(this,W,q).call(this),this.map}moveLayer(e,t){return A(this,Y)||this.map.moveLayer(e,t),V(this,W,q).call(this),this.map}removeLayer(e){return A(this,Y)||this.map.removeLayer(e),V(this,W,q).call(this),this}setLayerZoomRange(e,t,r){return A(this,Y)||this.map.setLayerZoomRange(e,t,r),V(this,W,q).call(this),this}setFilter(e,t,r){return A(this,Y)||this.map.setFilter(e,t,r),V(this,W,q).call(this),this}setPaintProperty(e,t,r,a){return A(this,Y)||this.map.setPaintProperty(e,t,r,a),V(this,W,q).call(this),this}setLayoutProperty(e,t,r,a){return A(this,Y)||this.map.setLayoutProperty(e,t,r,a),V(this,W,q).call(this),this}setGlyphs(e,t){return A(this,Y)||this.map.setGlyphs(e,t),V(this,W,q).call(this),this}onAdd(e){pe(this,Q,e),pe(this,ae,te("div","maplibregl-ctrl maplibregl-ctrl-group"));for(const[t,r]of Object.entries(A(this,K).containerStyle))A(this,ae).style.setProperty(t,r);return A(this,K).container=A(this,ae),A(this,K).zoom=e.getZoom()+A(this,K).zoomAdjust,this.map=new Ct(A(this,K)),this.map.once("style.load",()=>{this.map.resize()}),this.map.once("load",()=>{V(this,Oe,Lt).call(this,A(this,K).parentRect),pe(this,fe,V(this,Pe,wt).call(this))}),A(this,ae)}onRemove(){var e;(e=A(this,fe))==null||e.call(this),tt(A(this,ae))}};K=new WeakMap,Q=new WeakMap,ae=new WeakMap,At=new WeakMap,ne=new WeakMap,Y=new WeakMap,fe=new WeakMap,Oe=new WeakSet,Lt=function(o){o===void 0||o.linePaint===void 0&&o.fillPaint===void 0||(pe(this,ne,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:A(this,ne)}),(o.lineLayout!==void 0||o.linePaint!==void 0)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:ce({},o.lineLayout),paint:ce({"line-color":"#FFF","line-width":1,"line-opacity":.85},o.linePaint)}),o.fillPaint!==void 0&&this.map.addLayer({id:"parentRectFill",type:"fill",source:"parentRect",layout:{},paint:ce({"fill-color":"#08F","fill-opacity":.135},o.fillPaint)}),V(this,W,q).call(this))},W=new WeakSet,q=function(){if(A(this,ne)===void 0)return;const{devicePixelRatio:o}=window,e=A(this,Q).getCanvas(),t=e.width/o,r=e.height/o,a=A(this,Q).unproject.bind(A(this,Q)),n=a([0,0]),l=a([t,0]),s=a([0,r]),i=a([t,r]);A(this,ne).geometry.coordinates=[[s.toArray(),i.toArray(),l.toArray(),n.toArray(),s.toArray()]],this.map.getSource("parentRect").setData(A(this,ne))},Pe=new WeakSet,wt=function(){const{pitchAdjust:o}=A(this,K),e=()=>{n("parent")},t=()=>{n("minimap")},r=()=>{A(this,Q).on("move",e),this.map.on("move",t)},a=()=>{A(this,Q).off("move",e),this.map.off("move",t)},n=l=>{var s;a();const i=l==="parent"?A(this,Q):this.map,u=l==="parent"?this.map:A(this,Q),c=i.getCenter(),p=i.getZoom()+((s=A(this,K).zoomAdjust)!=null?s:-4)*(l==="parent"?1:-1),h=i.getBearing(),L=i.getPitch();u.jumpTo({center:c,zoom:p,bearing:h,pitch:o?L:0}),V(this,W,q).call(this),r()};return r(),()=>{a()}};var No=Object.defineProperty,Mo=Object.defineProperties,zo=Object.getOwnPropertyDescriptors,bt=Object.getOwnPropertySymbols,Fo=Object.prototype.hasOwnProperty,$o=Object.prototype.propertyIsEnumerable,Me=(o,e,t)=>e in o?No(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,ko=(o,e)=>{for(var t in e||(e={}))Fo.call(e,t)&&Me(o,t,e[t]);if(bt)for(var t of bt(e))$o.call(e,t)&&Me(o,t,e[t]);return o},Bo=(o,e)=>Mo(o,zo(e)),oe=(o,e,t)=>(Me(o,typeof e!="symbol"?e+"":e,t),t),ee=(o,e,t)=>new Promise((r,a)=>{var n=i=>{try{s(t.next(i))}catch(u){a(u)}},l=i=>{try{s(t.throw(i))}catch(u){a(u)}},s=i=>i.done?r(i.value):Promise.resolve(i.value).then(n,l);s((t=t.apply(o,e)).next())});const St={POINT:"POINT",COUNTRY:"COUNTRY"};class Ct extends y.Map{constructor(e){var t,r,a;e.apiKey&&(H.apiKey=e.apiKey);const n=nt(e.style),l=location.hash;H.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(Bo(ko({},e),{style:n,maplibreLogo:!1,transformRequest:rt(e.transformRequest)})),oe(this,"isTerrainEnabled",!1),oe(this,"terrainExaggeration",1),oe(this,"primaryLanguage"),oe(this,"terrainGrowing",!1),oe(this,"terrainFlattening",!1),oe(this,"minimap"),oe(this,"forceLanguageUpdate"),oe(this,"languageAlwaysBeenStyle"),this.primaryLanguage=(t=e.language)!=null?t:H.primaryLanguage,this.forceLanguageUpdate=!(this.primaryLanguage===S.STYLE||this.primaryLanguage===S.STYLE_LOCK),this.languageAlwaysBeenStyle=this.primaryLanguage===S.STYLE,this.terrainExaggeration=(r=e.terrainExaggeration)!=null?r:this.terrainExaggeration,this.once("styledata",()=>ee(this,null,function*(){if(!e.geolocate||e.center||e.hash&&l)return;try{if(e.geolocate===St.COUNTRY){yield this.fitToIpBounds();return}}catch(h){console.warn(h.message)}let p;try{yield this.centerOnIpPoint(e.zoom),p=this.getCameraHash()}catch(h){console.warn(h.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(h=>{p===this.getCameraHash()&&(this.terrain?this.easeTo({center:[h.coords.longitude,h.coords.latitude],zoom:e.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[h.coords.longitude,h.coords.latitude],zoom:e.zoom||12,duration:2e3})}))},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>ee(this,null,function*(){co()})),this.once("load",()=>ee(this,null,function*(){let p={logo:null};try{const h=Object.keys(this.style.sourceCaches).map(w=>this.getSource(w)).filter(w=>w&&"url"in w&&typeof w.url=="string"&&w?.url.includes("tiles.json")),L=new URL(h[0].url);L.searchParams.has("key")||L.searchParams.append("key",H.apiKey),p=yield(yield fetch(L.href)).json()}catch{}if(e.forceNoAttributionControl!==!0)if("logo"in p&&p.logo){const h=p.logo;this.addControl(new Te({logoURL:h}),e.logoPosition),e.attributionControl===!1&&this.addControl(new dt({customAttribution:e.customAttribution}))}else e.maptilerLogo&&this.addControl(new Te,e.logoPosition);if(e.scaleControl){const h=e.scaleControl===!0||e.scaleControl===void 0?"bottom-right":e.scaleControl,L=new yt({unit:H.unit});this.addControl(L,h),H.on("unit",w=>{L.setUnit(w)})}if(e.navigationControl!==!1){const h=e.navigationControl===!0||e.navigationControl===void 0?"top-right":e.navigationControl;this.addControl(new st,h)}if(e.geolocateControl!==!1){const h=e.geolocateControl===!0||e.geolocateControl===void 0?"top-right":e.geolocateControl;this.addControl(new mt({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),h)}if(e.terrainControl){const h=e.terrainControl===!0||e.terrainControl===void 0?"top-right":e.terrainControl;this.addControl(new lt,h)}if(e.fullscreenControl){const h=e.fullscreenControl===!0||e.fullscreenControl===void 0?"top-right":e.fullscreenControl;this.addControl(new vt({}),h)}}));let s=!1,i=!1,u;this.once("load",()=>{s=!0,i&&this.fire("loadWithTerrain",u)}),this.once("style.load",()=>{var p;const{minimap:h}=e;if(typeof h=="object"){const{zoom:L,center:w,style:v,language:$,apiKey:M,maptilerLogo:x,antialias:B,refreshExpiredTiles:k,maxBounds:P,scrollZoom:R,minZoom:T,maxZoom:f,boxZoom:C,locale:I,fadeDuration:z,crossSourceCollisions:g,clickTolerance:b,bounds:O,fitBoundsOptions:N,pixelRatio:F,validateStyle:j}=e;this.minimap=new Ne(h,{zoom:L,center:w,style:v,language:$,apiKey:M,container:"null",maptilerLogo:x,antialias:B,refreshExpiredTiles:k,maxBounds:P,scrollZoom:R,minZoom:T,maxZoom:f,boxZoom:C,locale:I,fadeDuration:z,crossSourceCollisions:g,clickTolerance:b,bounds:O,fitBoundsOptions:N,pixelRatio:F,validateStyle:j}),this.addControl(this.minimap,(p=h.position)!=null?p:"bottom-left")}else h===!0?(this.minimap=new Ne({},e),this.addControl(this.minimap,"bottom-left")):h!==void 0&&h!==!1&&(this.minimap=new Ne({},e),this.addControl(this.minimap,h))});const c=p=>{p.terrain&&(i=!0,u={type:"loadWithTerrain",target:this,terrain:p.terrain},this.off("terrain",c),s&&this.fire("loadWithTerrain",u))};this.on("terrain",c),e.terrain&&this.enableTerrain((a=e.terrainExaggeration)!=null?a:this.terrainExaggeration)}onLoadAsync(){return ee(this,null,function*(){return new Promise(e=>{if(this.loaded())return e(this);this.once("load",()=>{e(this)})})})}onLoadWithTerrainAsync(){return ee(this,null,function*(){return new Promise(e=>{if(this.loaded()&&this.terrain)return e(this);this.once("loadWithTerrain",()=>{e(this)})})})}setStyle(e,t){var r;return(r=this.minimap)==null||r.setStyle(e),this.forceLanguageUpdate=!0,this.once("idle",()=>{this.forceLanguageUpdate=!1}),super.setStyle(nt(e),t)}addLayer(e,t){var r;return(r=this.minimap)==null||r.addLayer(e,t),super.addLayer(e,t)}moveLayer(e,t){var r;return(r=this.minimap)==null||r.moveLayer(e,t),super.moveLayer(e,t)}removeLayer(e){var t;return(t=this.minimap)==null||t.removeLayer(e),super.removeLayer(e)}setLayerZoomRange(e,t,r){var a;return(a=this.minimap)==null||a.setLayerZoomRange(e,t,r),super.setLayerZoomRange(e,t,r)}setFilter(e,t,r){var a;return(a=this.minimap)==null||a.setFilter(e,t,r),super.setFilter(e,t,r)}setPaintProperty(e,t,r,a){var n;return(n=this.minimap)==null||n.setPaintProperty(e,t,r,a),super.setPaintProperty(e,t,r,a)}setLayoutProperty(e,t,r,a){var n;return(n=this.minimap)==null||n.setLayoutProperty(e,t,r,a),super.setLayoutProperty(e,t,r,a)}setGlyphs(e,t){var r;return(r=this.minimap)==null||r.setGlyphs(e,t),super.setGlyphs(e,t)}getStyleLanguage(){return!this.style.stylesheet.metadata||typeof this.style.stylesheet.metadata!="object"?null:"maptiler:language"in this.style.stylesheet.metadata&&typeof this.style.stylesheet.metadata["maptiler:language"]=="string"?this.style.stylesheet.metadata["maptiler:language"]:null}setLanguage(e){var t,r;(r=(t=this.minimap)==null?void 0:t.map)==null||r.setLanguage(e),this.onStyleReady(()=>{this.setPrimaryLanguage(e)})}setPrimaryLanguage(e){const t=this.getStyleLanguage();if(!(e===S.STYLE&&(t===S.AUTO||t===S.VISITOR))&&(e!==S.STYLE&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===e&&!this.forceLanguageUpdate))return;if(!Ke(e)){console.warn(`The language "${e}" is not supported.`);return}if(this.primaryLanguage===S.STYLE_LOCK){console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");return}this.primaryLanguage=e;let r=e;if(e===S.STYLE){if(!t){console.warn("The style has no default languages.");return}if(!Ke(t)){console.warn("The language defined in the style is not valid.");return}r=t}let a=S.LOCAL,n=`{${a}}`;r==S.VISITOR?(a=We(),n=["case",["all",["has",a],["has",S.LOCAL]],["case",["==",["get",a],["get",S.LOCAL]],["get",S.LOCAL],["format",["get",a],{"font-scale":.8},`
|
|
2
|
+
`,["get",S.LOCAL],{"font-scale":1.1}]],["get",S.LOCAL]]):r==S.VISITOR_ENGLISH?(a=S.ENGLISH,n=["case",["all",["has",a],["has",S.LOCAL]],["case",["==",["get",a],["get",S.LOCAL]],["get",S.LOCAL],["format",["get",a],{"font-scale":.8},`
|
|
3
|
+
`,["get",S.LOCAL],{"font-scale":1.1}]],["get",S.LOCAL]]):r===S.AUTO?(a=We(),n=["case",["has",a],["get",a],["get",S.LOCAL]]):r===S.LOCAL?(a=S.LOCAL,n=`{${a}}`):(a=r,n=["case",["has",a],["get",a],["get",S.LOCAL]]);const{layers:l}=this.getStyle();for(const{id:s,layout:i}of l){if(!i||!("text-field"in i))continue;const u=this.getLayoutProperty(s,"text-field");typeof u=="string"&&(u.toLowerCase().includes("ref")||u.toLowerCase().includes("housenumber"))||this.setLayoutProperty(s,"text-field",n)}}getPrimaryLanguage(){return this.primaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(e,t=1e3){if(!this.terrain)return;const r=performance.now(),a=this.terrain.exaggeration,n=e-a,l=()=>{if(!this.terrain||this.terrainFlattening)return;const s=(performance.now()-r)/t;if(s<.99){const i=1-Math.pow(1-s,4),u=a+i*n;this.terrain.exaggeration=u,requestAnimationFrame(l)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=e;this.triggerRepaint()};this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(l)}enableTerrain(e=this.terrainExaggeration){if(e<0){console.warn("Terrain exaggeration cannot be negative.");return}const t=a=>ee(this,null,function*(){!this.terrain||a.type!=="data"||a.dataType!=="source"||!("source"in a)||a.sourceId!=="maptiler-terrain"||a.source.type!=="raster-dem"||a.isSourceLoaded&&(this.off("data",t),this.growTerrain(e))}),r=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=e,this.on("data",t),this.addSource(Z.terrainSourceId,{type:"raster-dem",url:Z.terrainSourceURL}),this.setTerrain({source:Z.terrainSourceId,exaggeration:0})};if(this.getTerrain()){this.isTerrainEnabled=!0,this.growTerrain(e);return}this.loaded()||this.isTerrainEnabled?r():this.once("load",()=>{this.getTerrain()&&this.getSource(Z.terrainSourceId)||r()})}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const e=1*1e3,t=performance.now(),r=this.terrain.exaggeration,a=()=>{if(!this.terrain||this.terrainGrowing)return;const n=(performance.now()-t)/e;if(n<.99){const l=Math.pow(1-n,4),s=r*l;this.terrain.exaggeration=s,requestAnimationFrame(a)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(Z.terrainSourceId)&&this.removeSource(Z.terrainSourceId);this.triggerRepaint()};this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(a)}setTerrainExaggeration(e,t=!0){!t&&this.terrain?(this.terrainExaggeration=e,this.terrain.exaggeration=e,this.triggerRepaint()):this.enableTerrain(e)}onStyleReady(e){this.isStyleLoaded()?e():this.once("styledata",()=>{e()})}fitToIpBounds(){return ee(this,null,function*(){const e=yield Ve.info();this.fitBounds(e.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(e){return ee(this,null,function*(){var t,r;const a=yield Ve.info();this.jumpTo({center:[(t=a?.longitude)!=null?t:0,(r=a?.latitude)!=null?r:0],zoom:e||11})})}getCameraHash(){const e=new Float32Array(5),t=this.getCenter();return e[0]=t.lng,e[1]=t.lat,e[2]=this.getZoom(),e[3]=this.getPitch(),e[4]=this.getBearing(),Wt.fromUint8Array(new Uint8Array(e.buffer))}getSdkConfig(){return H}getMaptilerSessionId(){return Ze}setTransformRequest(e){return super.setTransformRequest(rt(e)),this}loadImageAsync(e){return ee(this,null,function*(){return new Promise((t,r)=>{this.loadImage(e,(a,n)=>{if(a){r(a);return}t(n)})})})}}class Uo extends y.Marker{addTo(e){return super.addTo(e)}}class jo extends y.Popup{addTo(e){return super.addTo(e)}}class Do extends y.Style{constructor(e,t={}){super(e,t)}}class Go extends y.CanvasSource{onAdd(e){super.onAdd(e)}}class Ho extends y.GeoJSONSource{onAdd(e){super.onAdd(e)}}class Vo extends y.ImageSource{onAdd(e){super.onAdd(e)}}class Ko extends y.RasterTileSource{onAdd(e){super.onAdd(e)}}class Wo extends y.RasterDEMTileSource{onAdd(e){super.onAdd(e)}}class Zo extends y.VectorTileSource{onAdd(e){super.onAdd(e)}}class Yo extends y.VideoSource{onAdd(e){super.onAdd(e)}}class qo extends y.TerrainControl{onAdd(e){return super.onAdd(e)}}var Jo=Object.defineProperty,Xo=(o,e,t)=>e in o?Jo(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,It=(o,e,t)=>(Xo(o,typeof e!="symbol"?e+"":e,t),t);class ye{constructor(e,t){It(this,"x"),It(this,"y"),this.x=e,this.y=t}_matMult(e){const t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this}_add(e){return this.x+=e.x,this.y+=e.y,this}_sub(e){return this.x-=e.x,this.y-=e.y,this}_mult(e){return this.x*=e,this.y*=e,this}_div(e){return this.x/=e,this.y/=e,this}_multByPoint(e){return this.x*=e.x,this.y*=e.y,this}_divByPoint(e){return this.x/=e.x,this.y/=e.y,this}_unit(){return this._div(this.mag()),this}_perp(){const e=this.y;return this.y=this.x,this.x=-e,this}_rotate(e){const t=Math.cos(e),r=Math.sin(e),a=t*this.x-r*this.y,n=r*this.x+t*this.y;return this.x=a,this.y=n,this}_rotateAround(e,t){const r=Math.cos(e),a=Math.sin(e),n=t.x+r*(this.x-t.x)-a*(this.y-t.y),l=t.y+a*(this.x-t.x)+r*(this.y-t.y);return this.x=n,this.y=l,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new ye(this.x,this.y)}add(e){return this.clone()._add(e)}sub(e){return this.clone()._sub(e)}multByPoint(e){return this.clone()._multByPoint(e)}divByPoint(e){return this.clone()._divByPoint(e)}mult(e){return this.clone()._mult(e)}div(e){return this.clone()._div(e)}rotate(e){return this.clone()._rotate(e)}rotateAround(e,t){return this.clone()._rotateAround(e,t)}matMult(e){return this.clone()._matMult(e)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}round(){return this.clone()._round()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}equals(e){return this.x===e.x&&this.y===e.y}dist(e){return Math.sqrt(this.distSqr(e))}distSqr(e){const t=e.x-this.x,r=e.y-this.y;return t*t+r*r}angle(){return Math.atan2(this.y,this.x)}angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)}angleWith(e){return this.angleWithSep(e.x,e.y)}angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)}static convert(e){return e instanceof ye?e:Array.isArray(e)?new ye(e[0],e[1]):e}}var Qo=Object.defineProperty,Tt=Object.getOwnPropertySymbols,er=Object.prototype.hasOwnProperty,tr=Object.prototype.propertyIsEnumerable,xt=(o,e,t)=>e in o?Qo(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,le=(o,e)=>{for(var t in e||(e={}))er.call(e,t)&&xt(o,t,e[t]);if(Tt)for(var t of Tt(e))tr.call(e,t)&&xt(o,t,e[t]);return o};function Ae(o){if(typeof DOMParser<"u"){const e=new DOMParser().parseFromString(o,"application/xml");if(e.querySelector("parsererror"))throw new Error("The provided string is not valid XML");return e}else throw new Error("No XML parser found")}function ze(o,e){if(!o.hasChildNodes())return!1;for(const t of Array.from(o.childNodes)){const r=t.nodeName;if(typeof r=="string"&&r.trim().toLowerCase()===e.toLowerCase())return!0}return!1}function Fe(o){if(typeof XMLSerializer<"u")return new XMLSerializer().serializeToString(o);throw new Error("No XML serializer found")}function $e(o){if(typeof o=="string"&&(o=Ae(o)),!ze(o,"gpx"))throw new Error("The XML document is not valid GPX");const e=U(o,"trk"),t=U(o,"rte"),r=U(o,"wpt"),a={type:"FeatureCollection",features:[]};for(const n of Array.from(e)){const l=nr(n);l&&a.features.push(l)}for(const n of Array.from(t)){const l=lr(n);l&&a.features.push(l)}for(const n of Array.from(r))a.features.push(ir(n));return a}function ke(o,e){var t;if(typeof o=="string"&&(o=Ae(o)),!ze(o,"kml"))throw new Error("The XML document is not valid KML");const r={type:"FeatureCollection",features:[]},a={},n={},l={},s=U(o,"Placemark"),i=U(o,"Style"),u=U(o,"StyleMap");for(const c of Array.from(i)){const p=Ot(e!==void 0?e(c):Fe(c)).toString(16);a["#"+ie(c,"id")]=p,n[p]=c}for(const c of Array.from(u)){a["#"+ie(c,"id")]=Ot(e!==void 0?e(c):Fe(c)).toString(16);const p=U(c,"Pair"),h={};for(const L of Array.from(p))h[(t=_(d(L,"key")))!=null?t:""]=_(d(L,"styleUrl"));l["#"+ie(c,"id")]=h}for(const c of Array.from(s))r.features=r.features.concat(ar(c,a,n,l));return r}function Rt(o){if(o===null)return["#000000",1];let e="",t=1;return o.substring(0,1)==="#"&&(o=o.substring(1)),(o.length===6||o.length===3)&&(e=o),o.length===8&&(t=parseInt(o.substring(0,2),16)/255,e="#"+o.substring(6,8)+o.substring(4,6)+o.substring(2,4)),[e??"#000000",t??1]}function or(o){return Nt(o.split(" "))}function rr(o){var e;let t=U(o,"coord");const r=[],a=[];t.length===0&&(t=U(o,"gx:coord"));for(const l of Array.from(t))r.push(or((e=_(l))!=null?e:""));const n=U(o,"when");for(const l of Array.from(n))a.push(_(l));return{coords:r,times:a}}function Le(o){var e,t,r;const a=["Polygon","LineString","Point","Track","gx:Track"];let n,l,s,i,u;const c=[],p=[];if(d(o,"MultiGeometry")!==null)return Le(d(o,"MultiGeometry"));if(d(o,"MultiTrack")!==null)return Le(d(o,"MultiTrack"));if(d(o,"gx:MultiTrack")!==null)return Le(d(o,"gx:MultiTrack"));for(s=0;s<a.length;s++)if(l=U(o,a[s]),l){for(i=0;i<l.length;i++)if(n=l[i],a[s]==="Point")c.push({type:"Point",coordinates:Mt((e=_(d(n,"coordinates")))!=null?e:"")});else if(a[s]==="LineString")c.push({type:"LineString",coordinates:zt((t=_(d(n,"coordinates")))!=null?t:"")});else if(a[s]==="Polygon"){const h=U(n,"LinearRing"),L=[];for(u=0;u<h.length;u++)L.push(zt((r=_(d(h[u],"coordinates")))!=null?r:""));c.push({type:"Polygon",coordinates:L})}else if(a[s]==="Track"||a[s]==="gx:Track"){const h=rr(n);c.push({type:"LineString",coordinates:h.coords}),h.times.length&&p.push(h.times)}}return{geoms:c,coordTimes:p}}function ar(o,e,t,r){var a,n,l,s,i,u,c,p,h,L;const w=Le(o),v={},$=_(d(o,"name")),M=_(d(o,"address")),x=_(d(o,"description")),B=d(o,"TimeSpan"),k=d(o,"TimeStamp"),P=d(o,"ExtendedData"),R=d(o,"visibility");let T,f=_(d(o,"styleUrl")),C=d(o,"LineStyle"),I=d(o,"PolyStyle");if(!w.geoms.length)return[];if($&&(v.name=$),M&&(v.address=M),f){f[0]!=="#"&&(f="#"+f),v.styleUrl=f,e[f]&&(v.styleHash=e[f]),r[f]&&(v.styleMapHash=r[f],v.styleHash=e[(a=r[f].normal)!=null?a:""]);const g=t[(n=v.styleHash)!=null?n:""];if(g){C||(C=d(g,"LineStyle")),I||(I=d(g,"PolyStyle"));const b=d(g,"IconStyle");if(b){const O=d(b,"Icon");if(O){const N=_(d(O,"href"));N&&(v.icon=N)}}}}if(x&&(v.description=x),B){const g=_(d(B,"begin")),b=_(d(B,"end"));g&&b&&(v.timespan={begin:g,end:b})}if(k!==null&&(v.timestamp=(l=_(d(k,"when")))!=null?l:new Date().toISOString()),C!==null){const g=Rt(_(d(C,"color"))),b=g[0],O=g[1],N=parseFloat((s=_(d(C,"width")))!=null?s:"");b&&(v.stroke=b),isNaN(O)||(v["stroke-opacity"]=O),isNaN(N)||(v["stroke-width"]=N)}if(I){const g=Rt(_(d(I,"color"))),b=g[0],O=g[1],N=_(d(I,"fill")),F=_(d(I,"outline"));b&&(v.fill=b),isNaN(O)||(v["fill-opacity"]=O),N&&(v["fill-opacity"]=N==="1"?v["fill-opacity"]||1:0),F&&(v["stroke-opacity"]=F==="1"?v["stroke-opacity"]||1:0)}if(P){const g=U(P,"Data"),b=U(P,"SimpleData");for(T=0;T<g.length;T++)v[(i=g[T].getAttribute("name"))!=null?i:""]=(u=_(d(g[T],"value")))!=null?u:"";for(T=0;T<b.length;T++)v[(c=b[T].getAttribute("name"))!=null?c:""]=(p=_(b[T]))!=null?p:""}R!==null&&(v.visibility=(h=_(R))!=null?h:""),w.coordTimes.length!==0&&(v.coordTimes=w.coordTimes.length===1?w.coordTimes[0]:w.coordTimes);const z={type:"Feature",geometry:w.geoms.length===1?w.geoms[0]:{type:"GeometryCollection",geometries:w.geoms},properties:v};return ie(o,"id")&&(z.id=(L=ie(o,"id"))!=null?L:void 0),[z]}function _t(o,e){const t=U(o,e),r=[],a=[];let n=[];const l=t.length;if(!(l<2)){for(let s=0;s<l;s++){const i=Ft(t[s]);r.push(i.coordinates),i.time&&a.push(i.time),(i.heartRate||n.length)&&(n.length===0&&(n=new Array(s).fill(null)),n.push(i.heartRate))}return{line:r,times:a,heartRates:n}}}function nr(o){const e=U(o,"trkseg"),t=[],r=[],a=[];let n;for(let s=0;s<e.length;s++)if(n=_t(e[s],"trkpt"),n!==void 0&&(n.line&&t.push(n.line),n.times&&n.times.length&&r.push(n.times),a.length||n.heartRates&&n.heartRates.length)){if(!a.length)for(let i=0;i<s;i++)a.push(new Array(t[i].length).fill(null));n.heartRates&&n.heartRates.length?a.push(n.heartRates):a.push(new Array(n.line.length).fill(null))}if(t.length===0)return;const l=le(le({},Be(o)),Et(d(o,"extensions")));return r.length!==0&&(l.coordTimes=t.length===1?r[0]:r),a.length!==0&&(l.heartRates=t.length===1?a[0]:a),t.length===1?{type:"Feature",properties:l,geometry:{type:"LineString",coordinates:t[0]}}:{type:"Feature",properties:l,geometry:{type:"MultiLineString",coordinates:t}}}function lr(o){const e=_t(o,"rtept");return e===void 0?void 0:{type:"Feature",properties:le(le({},Be(o)),Et(d(o,"extensions"))),geometry:{type:"LineString",coordinates:e.line}}}function ir(o){return{type:"Feature",properties:le(le({},Be(o)),Ue(o,["sym"])),geometry:{type:"Point",coordinates:Ft(o).coordinates}}}function Et(o){var e,t;const r={};if(o){const a=d(o,"line");if(a){const n=_(d(a,"color")),l=parseFloat((e=_(d(a,"opacity")))!=null?e:"0"),s=parseFloat((t=_(d(a,"width")))!=null?t:"0");n&&(r.stroke=n),isNaN(l)||(r["stroke-opacity"]=l),isNaN(s)||(r["stroke-width"]=s*96/25.4)}}return r}function Be(o){const e=Ue(o,["name","cmt","desc","type","time","keywords"]),t=U(o,"link");if(t.length!==0){e.links=[];for(const r of Array.from(t)){const a=le({href:ie(r,"href")},Ue(r,["text","type"]));e.links.push(a)}}return e}function Ot(o){let e=0;if(!o||!o.length)return e;for(let t=0;t<o.length;t++)e=(e<<5)-e+o.charCodeAt(t)|0;return e}function U(o,e){return o.getElementsByTagName(e)}function ie(o,e){return o.getAttribute(e)}function Pt(o,e){var t;return parseFloat((t=ie(o,e))!=null?t:"0")}function d(o,e){const t=U(o,e);return t.length?t[0]:null}function sr(o){return o.normalize&&o.normalize(),o}function Nt(o){return o.map(parseFloat).map(e=>isNaN(e)?null:e)}function _(o){return o&&sr(o),o&&o.textContent}function Ue(o,e){var t;const r={};let a,n;for(n=0;n<e.length;n++)a=d(o,e[n]),a&&(r[e[n]]=(t=_(a))!=null?t:"");return r}function Mt(o){return Nt(o.replace(/\s*/g,"").split(","))}function zt(o){const e=o.replace(/^\s*|\s*$/g,"").split(/\s+/),t=[];for(const r of e)t.push(Mt(r));return t}function Ft(o){var e,t;const r=[Pt(o,"lon"),Pt(o,"lat")],a=d(o,"ele"),n=d(o,"gpxtpx:hr")||d(o,"hr"),l=d(o,"time");let s;return a&&(s=parseFloat((e=_(a))!=null?e:"0"),isNaN(s)||r.push(s)),{coordinates:r,time:l?_(l):null,heartRate:n!==null?parseFloat((t=_(n))!=null?t:"0"):null}}function $t(o){try{typeof o=="string"&&(o=Ae(o))}catch{return null}try{return $e(o)}catch{}try{return ke(o)}catch{}return null}var ur=Object.defineProperty,cr=(o,e,t)=>e in o?ur(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,kt=(o,e,t)=>(cr(o,typeof e!="symbol"?e+"":e,t),t);function we(o){const e=o.toString(16);return e.length==1?"0"+e:e}function pr(o){return"#"+we(o[0])+we(o[1])+we(o[2])+(o.length===4?we(o[3]):"")}class m extends Array{constructor(e={}){super(),kt(this,"min",0),kt(this,"max",1),"min"in e&&(this.min=e.min),"max"in e&&(this.max=e.max),"stops"in e&&this.setStops(e.stops,{clone:!1})}static fromArrayDefinition(e){return new m({stops:e.map(t=>({value:t[0],color:t[1]}))})}setStops(e,t={clone:!0}){const r=t.clone?this.clone():this;r.length=0;let a=1/0,n=-1/0;for(let l=0;l<e.length;l+=1)a=Math.min(a,e[l].value),n=Math.max(n,e[l].value),r.push({value:e[l].value,color:e[l].color.slice()});return r.sort((l,s)=>l.value<s.value?-1:1),this.min=a,this.max=n,r}scale(e,t,r={clone:!0}){const a=r.clone,n=this[0].value,l=this.at(-1).value-n,s=t-e,i=[];for(let u=0;u<this.length;u+=1){const c=(this[u].value-n)/l*s+e;a?i.push({value:c,color:this[u].color.slice()}):this[u].value=c}return a?new m({stops:i}):this}at(e){return e<0?this[this.length+e]:this[e]}clone(){return new m({stops:this.getRawColorStops()})}getRawColorStops(){const e=[];for(let t=0;t<this.length;t+=1)e.push({value:this[t].value,color:this[t].color});return e}reverse(e={clone:!0}){const t=e.clone?this.clone():this;for(let r=0;r<~~(t.length/2);r+=1){const a=t[r].color;t[r].color=t.at(-(r+1)).color,t.at(-(r+1)).color=a}return t}getBounds(){return{min:this.min,max:this.max}}getColor(e,t={smooth:!0}){if(e<=this[0].value)return this[0].color;if(e>=this.at(-1).value)return this.at(-1).color;for(let r=0;r<this.length-1;r+=1){if(e>this[r+1].value)continue;const a=this[r].color;if(!t.smooth)return a.slice();const n=this[r].value,l=this[r+1].value,s=this[r+1].color,i=(l-e)/(l-n);return a.map((u,c)=>Math.round(u*i+s[c]*(1-i)))}return[0,0,0]}getColorHex(e,t={smooth:!0,withAlpha:!1}){return pr(this.getColor(e,t))}getColorRelative(e,t={smooth:!0}){const r=this.getBounds();return this.getColor(r.min+e*(r.max-r.min),t)}getCanvasStrip(e={horizontal:!0,size:512,smooth:!0}){const t=document.createElement("canvas");t.width=e.horizontal?e.size:1,t.height=e.horizontal?1:e.size;const r=t.getContext("2d");if(!r)throw new Error("Canvs context is missing");const a=r.getImageData(0,0,t.width,t.height),n=a.data,l=e.size,s=this[0].value,i=(this.at(-1).value-s)/l;for(let u=0;u<l;u+=1){const c=this.getColor(s+u*i,{smooth:e.smooth});n[u*4]=c[0],n[u*4+1]=c[1],n[u*4+2]=c[2],n[u*4+3]=c.length>3?c[3]:255}return r.putImageData(a,0,0),t}resample(e,t=15){const r=this.getBounds(),a=this.scale(0,1),n=1/(t-1);let l;if(e==="ease-in-square")l=Array.from({length:t},(s,i)=>{const u=i*n,c=Math.pow(u,2),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-out-square")l=Array.from({length:t},(s,i)=>{const u=i*n,c=1-Math.pow(1-u,2),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-out-sqrt")l=Array.from({length:t},(s,i)=>{const u=i*n,c=Math.pow(u,.5),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-in-sqrt")l=Array.from({length:t},(s,i)=>{const u=i*n,c=1-Math.pow(1-u,.5),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-out-exp")l=Array.from({length:t},(s,i)=>{const u=i*n,c=1-Math.pow(2,-10*u),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-in-exp")l=Array.from({length:t},(s,i)=>{const u=i*n,c=Math.pow(2,10*u-10),p=a.getColor(c);return{value:u,color:p}});else throw new Error("Invalid ressampling method.");return new m({stops:l}).scale(r.min,r.max)}transparentStart(){const e=this.getRawColorStops();return e.unshift({value:e[0].value,color:e[0].color.slice()}),e[1].value+=.001,e.forEach(t=>{t.color.length===3&&t.color.push(255)}),e[0].color[3]=0,new m({stops:e})}hasTransparentStart(){return this[0].color.length===4&&this[0].color[3]===0}}const je={NULL:new m({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),GRAY:new m({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),JET:new m({stops:[{value:0,color:[0,0,131]},{value:.125,color:[0,60,170]},{value:.375,color:[5,255,255]},{value:.625,color:[255,255,0]},{value:.875,color:[250,0,0]},{value:1,color:[128,0,0]}]}),HSV:new m({stops:[{value:0,color:[255,0,0]},{value:.169,color:[253,255,2]},{value:.173,color:[247,255,2]},{value:.337,color:[0,252,4]},{value:.341,color:[0,252,10]},{value:.506,color:[1,249,255]},{value:.671,color:[2,0,253]},{value:.675,color:[8,0,253]},{value:.839,color:[255,0,251]},{value:.843,color:[255,0,245]},{value:1,color:[255,0,6]}]}),HOT:new m({stops:[{value:0,color:[0,0,0]},{value:.3,color:[230,0,0]},{value:.6,color:[255,210,0]},{value:1,color:[255,255,255]}]}),SPRING:new m({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),SUMMER:new m({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),AUTOMN:new m({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),WINTER:new m({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),BONE:new m({stops:[{value:0,color:[0,0,0]},{value:.376,color:[84,84,116]},{value:.753,color:[169,200,200]},{value:1,color:[255,255,255]}]}),COPPER:new m({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),GREYS:new m({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),YIGNBU:new m({stops:[{value:0,color:[8,29,88]},{value:.125,color:[37,52,148]},{value:.25,color:[34,94,168]},{value:.375,color:[29,145,192]},{value:.5,color:[65,182,196]},{value:.625,color:[127,205,187]},{value:.75,color:[199,233,180]},{value:.875,color:[237,248,217]},{value:1,color:[255,255,217]}]}),GREENS:new m({stops:[{value:0,color:[0,68,27]},{value:.125,color:[0,109,44]},{value:.25,color:[35,139,69]},{value:.375,color:[65,171,93]},{value:.5,color:[116,196,118]},{value:.625,color:[161,217,155]},{value:.75,color:[199,233,192]},{value:.875,color:[229,245,224]},{value:1,color:[247,252,245]}]}),YIORRD:new m({stops:[{value:0,color:[128,0,38]},{value:.125,color:[189,0,38]},{value:.25,color:[227,26,28]},{value:.375,color:[252,78,42]},{value:.5,color:[253,141,60]},{value:.625,color:[254,178,76]},{value:.75,color:[254,217,118]},{value:.875,color:[255,237,160]},{value:1,color:[255,255,204]}]}),BLUERED:new m({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),RDBU:new m({stops:[{value:0,color:[5,10,172]},{value:.35,color:[106,137,247]},{value:.5,color:[190,190,190]},{value:.6,color:[220,170,132]},{value:.7,color:[230,145,90]},{value:1,color:[178,10,28]}]}),PICNIC:new m({stops:[{value:0,color:[0,0,255]},{value:.1,color:[51,153,255]},{value:.2,color:[102,204,255]},{value:.3,color:[153,204,255]},{value:.4,color:[204,204,255]},{value:.5,color:[255,255,255]},{value:.6,color:[255,204,255]},{value:.7,color:[255,153,255]},{value:.8,color:[255,102,204]},{value:.9,color:[255,102,102]},{value:1,color:[255,0,0]}]}),RAINBOW:new m({stops:[{value:0,color:[150,0,90]},{value:.125,color:[0,0,200]},{value:.25,color:[0,25,255]},{value:.375,color:[0,152,255]},{value:.5,color:[44,255,150]},{value:.625,color:[151,255,0]},{value:.75,color:[255,234,0]},{value:.875,color:[255,111,0]},{value:1,color:[255,0,0]}]}),PORTLAND:new m({stops:[{value:0,color:[12,51,131]},{value:.25,color:[10,136,186]},{value:.5,color:[242,211,56]},{value:.75,color:[242,143,56]},{value:1,color:[217,30,30]}]}),BLACKBODY:new m({stops:[{value:0,color:[0,0,0]},{value:.2,color:[230,0,0]},{value:.4,color:[230,210,0]},{value:.7,color:[255,255,255]},{value:1,color:[160,200,255]}]}),EARTH:new m({stops:[{value:0,color:[0,0,130]},{value:.1,color:[0,180,180]},{value:.2,color:[40,210,40]},{value:.4,color:[230,230,50]},{value:.6,color:[120,70,20]},{value:1,color:[255,255,255]}]}),ELECTRIC:new m({stops:[{value:0,color:[0,0,0]},{value:.15,color:[30,0,100]},{value:.4,color:[120,0,100]},{value:.6,color:[160,90,0]},{value:.8,color:[230,200,0]},{value:1,color:[255,250,220]}]}),VIRIDIS:new m({stops:[{value:0,color:[68,1,84]},{value:.13,color:[71,44,122]},{value:.25,color:[59,81,139]},{value:.38,color:[44,113,142]},{value:.5,color:[33,144,141]},{value:.63,color:[39,173,129]},{value:.75,color:[92,200,99]},{value:.88,color:[170,220,50]},{value:1,color:[253,231,37]}]}),INFERNO:new m({stops:[{value:0,color:[0,0,4]},{value:.13,color:[31,12,72]},{value:.25,color:[85,15,109]},{value:.38,color:[136,34,106]},{value:.5,color:[186,54,85]},{value:.63,color:[227,89,51]},{value:.75,color:[249,140,10]},{value:.88,color:[249,201,50]},{value:1,color:[252,255,164]}]}),MAGMA:new m({stops:[{value:0,color:[0,0,4]},{value:.13,color:[28,16,68]},{value:.25,color:[79,18,123]},{value:.38,color:[129,37,129]},{value:.5,color:[181,54,122]},{value:.63,color:[229,80,100]},{value:.75,color:[251,135,97]},{value:.88,color:[254,194,135]},{value:1,color:[252,253,191]}]}),PLASMA:new m({stops:[{value:0,color:[13,8,135]},{value:.13,color:[75,3,161]},{value:.25,color:[125,3,168]},{value:.38,color:[168,34,150]},{value:.5,color:[203,70,121]},{value:.63,color:[229,107,93]},{value:.75,color:[248,148,65]},{value:.88,color:[253,195,40]},{value:1,color:[240,249,33]}]}),WARM:new m({stops:[{value:0,color:[125,0,179]},{value:.13,color:[172,0,187]},{value:.25,color:[219,0,170]},{value:.38,color:[255,0,130]},{value:.5,color:[255,63,74]},{value:.63,color:[255,123,0]},{value:.75,color:[234,176,0]},{value:.88,color:[190,228,0]},{value:1,color:[147,255,0]}]}),COOL:new m({stops:[{value:0,color:[125,0,179]},{value:.13,color:[116,0,218]},{value:.25,color:[98,74,237]},{value:.38,color:[68,146,231]},{value:.5,color:[0,204,197]},{value:.63,color:[0,247,146]},{value:.75,color:[0,255,88]},{value:.88,color:[40,255,8]},{value:1,color:[147,255,0]}]}),RAINBOW_SOFT:new m({stops:[{value:0,color:[125,0,179]},{value:.1,color:[199,0,180]},{value:.2,color:[255,0,121]},{value:.3,color:[255,108,0]},{value:.4,color:[222,194,0]},{value:.5,color:[150,255,0]},{value:.6,color:[0,255,55]},{value:.7,color:[0,246,150]},{value:.8,color:[50,167,222]},{value:.9,color:[103,51,235]},{value:1,color:[124,0,186]}]}),BATHYMETRY:new m({stops:[{value:0,color:[40,26,44]},{value:.13,color:[59,49,90]},{value:.25,color:[64,76,139]},{value:.38,color:[63,110,151]},{value:.5,color:[72,142,158]},{value:.63,color:[85,174,163]},{value:.75,color:[120,206,163]},{value:.88,color:[187,230,172]},{value:1,color:[253,254,204]}]}),CDOM:new m({stops:[{value:0,color:[47,15,62]},{value:.13,color:[87,23,86]},{value:.25,color:[130,28,99]},{value:.38,color:[171,41,96]},{value:.5,color:[206,67,86]},{value:.63,color:[230,106,84]},{value:.75,color:[242,149,103]},{value:.88,color:[249,193,135]},{value:1,color:[254,237,176]}]}),CHLOROPHYLL:new m({stops:[{value:0,color:[18,36,20]},{value:.13,color:[25,63,41]},{value:.25,color:[24,91,59]},{value:.38,color:[13,119,72]},{value:.5,color:[18,148,80]},{value:.63,color:[80,173,89]},{value:.75,color:[132,196,122]},{value:.88,color:[175,221,162]},{value:1,color:[215,249,208]}]}),DENSITY:new m({stops:[{value:0,color:[54,14,36]},{value:.13,color:[89,23,80]},{value:.25,color:[110,45,132]},{value:.38,color:[120,77,178]},{value:.5,color:[120,113,213]},{value:.63,color:[115,151,228]},{value:.75,color:[134,185,227]},{value:.88,color:[177,214,227]},{value:1,color:[230,241,241]}]}),FREESURFACE_BLUE:new m({stops:[{value:0,color:[30,4,110]},{value:.13,color:[47,14,176]},{value:.25,color:[41,45,236]},{value:.38,color:[25,99,212]},{value:.5,color:[68,131,200]},{value:.63,color:[114,156,197]},{value:.75,color:[157,181,203]},{value:.88,color:[200,208,216]},{value:1,color:[241,237,236]}]}),FREESURFACE_RED:new m({stops:[{value:0,color:[60,9,18]},{value:.13,color:[100,17,27]},{value:.25,color:[142,20,29]},{value:.38,color:[177,43,27]},{value:.5,color:[192,87,63]},{value:.63,color:[205,125,105]},{value:.75,color:[216,162,148]},{value:.88,color:[227,199,193]},{value:1,color:[241,237,236]}]}),OXYGEN:new m({stops:[{value:0,color:[64,5,5]},{value:.13,color:[106,6,15]},{value:.25,color:[144,26,7]},{value:.38,color:[168,64,3]},{value:.5,color:[188,100,4]},{value:.63,color:[206,136,11]},{value:.75,color:[220,174,25]},{value:.88,color:[231,215,44]},{value:1,color:[248,254,105]}]}),PAR:new m({stops:[{value:0,color:[51,20,24]},{value:.13,color:[90,32,35]},{value:.25,color:[129,44,34]},{value:.38,color:[159,68,25]},{value:.5,color:[182,99,19]},{value:.63,color:[199,134,22]},{value:.75,color:[212,171,35]},{value:.88,color:[221,210,54]},{value:1,color:[225,253,75]}]}),PHASE:new m({stops:[{value:0,color:[145,105,18]},{value:.13,color:[184,71,38]},{value:.25,color:[186,58,115]},{value:.38,color:[160,71,185]},{value:.5,color:[110,97,218]},{value:.63,color:[50,123,164]},{value:.75,color:[31,131,110]},{value:.88,color:[77,129,34]},{value:1,color:[145,105,18]}]}),SALINITY:new m({stops:[{value:0,color:[42,24,108]},{value:.13,color:[33,50,162]},{value:.25,color:[15,90,145]},{value:.38,color:[40,118,137]},{value:.5,color:[59,146,135]},{value:.63,color:[79,175,126]},{value:.75,color:[120,203,104]},{value:.88,color:[193,221,100]},{value:1,color:[253,239,154]}]}),TEMPERATURE:new m({stops:[{value:0,color:[4,35,51]},{value:.13,color:[23,51,122]},{value:.25,color:[85,59,157]},{value:.38,color:[129,79,143]},{value:.5,color:[175,95,130]},{value:.63,color:[222,112,101]},{value:.75,color:[249,146,66]},{value:.88,color:[249,196,65]},{value:1,color:[232,250,91]}]}),TURBIDITY:new m({stops:[{value:0,color:[34,31,27]},{value:.13,color:[65,50,41]},{value:.25,color:[98,69,52]},{value:.38,color:[131,89,57]},{value:.5,color:[161,112,59]},{value:.63,color:[185,140,66]},{value:.75,color:[202,174,88]},{value:.88,color:[216,209,126]},{value:1,color:[233,246,171]}]}),VELOCITY_BLUE:new m({stops:[{value:0,color:[17,32,64]},{value:.13,color:[35,52,116]},{value:.25,color:[29,81,156]},{value:.38,color:[31,113,162]},{value:.5,color:[50,144,169]},{value:.63,color:[87,173,176]},{value:.75,color:[149,196,189]},{value:.88,color:[203,221,211]},{value:1,color:[254,251,230]}]}),VELOCITY_GREEN:new m({stops:[{value:0,color:[23,35,19]},{value:.13,color:[24,64,38]},{value:.25,color:[11,95,45]},{value:.38,color:[39,123,35]},{value:.5,color:[95,146,12]},{value:.63,color:[152,165,18]},{value:.75,color:[201,186,69]},{value:.88,color:[233,216,137]},{value:1,color:[255,253,205]}]}),CUBEHELIX:new m({stops:[{value:0,color:[0,0,0]},{value:.07,color:[22,5,59]},{value:.13,color:[60,4,105]},{value:.2,color:[109,1,135]},{value:.27,color:[161,0,147]},{value:.33,color:[210,2,142]},{value:.4,color:[251,11,123]},{value:.47,color:[255,29,97]},{value:.53,color:[255,54,69]},{value:.6,color:[255,85,46]},{value:.67,color:[255,120,34]},{value:.73,color:[255,157,37]},{value:.8,color:[241,191,57]},{value:.87,color:[224,220,93]},{value:.93,color:[218,241,142]},{value:1,color:[227,253,198]}]}),CIVIDIS:new m({stops:[{value:0,color:[0,32,77,255]},{value:.125,color:[5,54,110,255]},{value:.25,color:[65,77,108,255]},{value:.375,color:[97,100,111,255]},{value:.5,color:[125,124,121,255]},{value:.625,color:[156,149,120,255]},{value:.75,color:[190,175,111,255]},{value:.875,color:[225,204,94,255]},{value:1,color:[255,235,70,255]}]}),TURBO:new m({stops:[{value:0,color:[48,18,59,255]},{value:.125,color:[70,107,227,255]},{value:.25,color:[40,187,236,255]},{value:.375,color:[49,242,153,255]},{value:.5,color:[162,252,60,255]},{value:.625,color:[237,208,58,255]},{value:.75,color:[251,128,34,255]},{value:.875,color:[210,49,5,255]},{value:1,color:[122,4,3,255]}]}),ROCKET:new m({stops:[{value:0,color:[250,235,221,0]},{value:.133,color:[250,235,221,255]},{value:.266,color:[246,170,130,255]},{value:.4,color:[240,96,67,255]},{value:.533,color:[203,27,79,255]},{value:.666,color:[132,30,90,255]},{value:.8,color:[63,27,68,255]},{value:1,color:[3,5,26,255]}]}),MAKO:new m({stops:[{value:0,color:[11,4,5,255]},{value:.125,color:[43,28,53,255]},{value:.25,color:[62,53,107,255]},{value:.375,color:[59,86,152,255]},{value:.5,color:[53,123,162,255]},{value:.625,color:[53,158,170,255]},{value:.75,color:[73,193,173,255]},{value:.875,color:[150,221,181,255]},{value:1,color:[222,245,229,255]}]})},Bt=[["#1D5B79","#468B97","#EF6262","#F3AA60"],["#614BC3","#33BBC5","#85E6C5","#C8FFE0"],["#461959","#7A316F","#CD6688","#AED8CC"],["#0079FF","#00DFA2","#F6FA70","#FF0060"],["#39B5E0","#A31ACB","#FF78F0","#F5EA5A"],["#37E2D5","#590696","#C70A80","#FBCB0A"],["#FFD36E","#FFF56D","#99FFCD","#9FB4FF"],["#00EAD3","#FFF5B7","#FF449F","#005F99"],["#10A19D","#540375","#FF7000","#FFBF00"]];function De(){return Bt[~~(Math.random()*Bt.length)][~~(Math.random()*4)]}function be(){return`maptiler_source_${at()}`}function Se(){return`maptiler_layer_${at()}`}function Ut(o,e){if(e<=o[0].zoom)return o[0].value;if(e>=o[o.length-1].zoom)return o[o.length-1].value;for(let t=0;t<o.length-1;t+=1)if(e>=o[t].zoom&&e<o[t+1].zoom){const r=o[t+1].zoom-o[t].zoom,a=(e-o[t].zoom)/r;return a*o[t+1].value+(1-a)*o[t].value}return 0}function se(o){return["interpolate",["linear"],["zoom"],...o.map(e=>[e.zoom,e.value]).flat()]}function E(o){return["interpolate",["linear"],["zoom"],...o.map(e=>[e.zoom,e.value]).flat()]}function hr(o,e){if(typeof e=="number"&&typeof o=="number")return 2*e+o;if(typeof e=="number"&&Array.isArray(o))return["interpolate",["linear"],["zoom"],...o.map(t=>[t.zoom,2*e+t.value]).flat()];if(typeof o=="number"&&Array.isArray(e))return["interpolate",["linear"],["zoom"],...e.map(t=>[t.zoom,2*t.value+o]).flat()];if(Array.isArray(o)&&Array.isArray(e)){const t=Array.from(new Set([...o.map(r=>r.zoom),...e.map(r=>r.zoom)])).sort((r,a)=>r<a?-1:1);return["interpolate",["linear"],["zoom"],...t.map(r=>[r,2*Ut(e,r)+Ut(o,r)]).flat()]}return 0}function mr(o,e){return["interpolate",["linear"],["get",e],...o.map(t=>[t.propertyValue,t.value]).flat()]}function jt(o){const e=o.trimStart(),t=`${e}${" ".repeat(o.length-e.length)}`,r=Array.from(t);if(!r.every(n=>n===" "||n==="_"))throw new Error("A dash pattern must be composed only of whitespace and underscore characters.");if(!(r.some(n=>n==="_")&&r.some(n=>n===" ")))throw new Error("A dash pattern must contain at least one underscore and one whitespace character");const a=[1];for(let n=1;n<r.length;n+=1){const l=r[n-1],s=r[n];l===s?a[a.length-1]+=1:a.push(1)}return a}function Dt(o,e){return["interpolate",["linear"],["get",e],...o.map(t=>[t.value,t.color]).flat()]}function Gt(o,e,t=!0){return t?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...o.map(r=>[r.value,r.pointRadius*.025]).flat()],2,["interpolate",["linear"],["get",e],...o.map(r=>[r.value,r.pointRadius*.05]).flat()],4,["interpolate",["linear"],["get",e],...o.map(r=>[r.value,r.pointRadius*.1]).flat()],8,["interpolate",["linear"],["get",e],...o.map(r=>[r.value,r.pointRadius*.25]).flat()],16,["interpolate",["linear"],["get",e],...o.map(r=>[r.value,r.pointRadius]).flat()]]:["interpolate",["linear"],["get",e],...o.map(r=>[r.value,r.pointRadius]).flat()]}function dr(o,e,t=!0){return t?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...o.map(r=>[r.propertyValue,r.value*.025]).flat()],2,["interpolate",["linear"],["get",e],...o.map(r=>[r.propertyValue,r.value*.05]).flat()],4,["interpolate",["linear"],["get",e],...o.map(r=>[r.propertyValue,r.value*.1]).flat()],8,["interpolate",["linear"],["get",e],...o.map(r=>[r.propertyValue,r.value*.25]).flat()],16,["interpolate",["linear"],["get",e],...o.map(r=>[r.propertyValue,r.value]).flat()]]:["interpolate",["linear"],["get",e],...o.map(r=>[r.propertyValue,r.value]).flat()]}function Ht(o,e){return o.every(t=>t.color[3]===o[0].color[3])?o[0].color[3]?o[0].color[3]/255:1:["interpolate",["linear"],["get",e],...o.getRawColorStops().map(t=>{const r=t.value,a=t.color;return[r,a.length===4?a[3]/255:1]}).flat()]}function yr(o,e=10){return["interpolate",["linear"],["heatmap-density"],...Array.from({length:e+1},(t,r)=>{const a=r/e;return[a,o.getColorHex(a)]}).flat()]}var vr=Object.defineProperty,gr=Object.defineProperties,fr=Object.getOwnPropertyDescriptors,Vt=Object.getOwnPropertySymbols,Ar=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,Kt=(o,e,t)=>e in o?vr(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,ue=(o,e)=>{for(var t in e||(e={}))Ar.call(e,t)&&Kt(o,t,e[t]);if(Vt)for(var t of Vt(e))Lr.call(e,t)&&Kt(o,t,e[t]);return o},wr=(o,e)=>gr(o,fr(e)),br=(o,e,t)=>new Promise((r,a)=>{var n=i=>{try{s(t.next(i))}catch(u){a(u)}},l=i=>{try{s(t.throw(i))}catch(u){a(u)}},s=i=>i.done?r(i.value):Promise.resolve(i.value).then(n,l);s((t=t.apply(o,e)).next())});function Sr(o,e){return br(this,arguments,function*(t,r,a={}){var n,l,s;if(!r.sourceId&&!r.data)throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");let i=r.data;if(typeof i=="string"){if(ve(i))i=`https://api.maptiler.com/data/${r.data}/features.json?key=${H.apiKey}`;else if(((n=i.split(".").pop())==null?void 0:n.toLowerCase().trim())==="gpx"){const u=yield(yield fetch(i,a)).text();i=$e(u)}else if(((l=i.split(".").pop())==null?void 0:l.toLowerCase().trim())==="kml"){const u=yield(yield fetch(i,a)).text();i=ke(u)}else{const u=(s=ho(i))!=null?s:$t(i);u&&(i=u)}if(!i)throw new Error("Polyline data was provided as string but is incompatible with valid formats.")}return Cr(t,wr(ue({},r),{data:i}))})}function Cr(o,e){var t,r,a,n,l,s,i,u,c,p,h,L,w,v,$,M,x,B,k,P;if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const R=(t=e.sourceId)!=null?t:be(),T=(r=e.layerId)!=null?r:Se(),f={polylineLayerId:T,polylineOutlineLayerId:"",polylineSourceId:R};e.data&&!o.getSource(R)&&o.addSource(R,{type:"geojson",data:e.data});const C=(a=e.lineWidth)!=null?a:3,I=(n=e.lineColor)!=null?n:De(),z=(l=e.lineOpacity)!=null?l:1,g=(s=e.lineBlur)!=null?s:0,b=(i=e.lineGapWidth)!=null?i:0;let O=(u=e.lineDashArray)!=null?u:null;const N=(c=e.outlineWidth)!=null?c:1,F=(p=e.outlineColor)!=null?p:"#FFFFFF",j=(h=e.outlineOpacity)!=null?h:1,D=(L=e.outlineBlur)!=null?L:0;if(typeof O=="string"&&(O=jt(O)),e.outline===!0){const J=`${T}_outline`;f.polylineOutlineLayerId=J,o.addLayer({id:J,type:"line",source:R,layout:{"line-join":(w=e.lineJoin)!=null?w:"round","line-cap":(v=e.lineCap)!=null?v:"round"},minzoom:($=e.minzoom)!=null?$:0,maxzoom:(M=e.maxzoom)!=null?M:23,paint:{"line-opacity":typeof j=="number"?j:E(j),"line-color":typeof F=="string"?F:se(F),"line-width":hr(C,N),"line-blur":typeof D=="number"?D:E(D)}},e.beforeId)}return o.addLayer({id:T,type:"line",source:R,layout:{"line-join":(x=e.lineJoin)!=null?x:"round","line-cap":(B=e.lineCap)!=null?B:"round"},minzoom:(k=e.minzoom)!=null?k:0,maxzoom:(P=e.maxzoom)!=null?P:23,paint:ue({"line-opacity":typeof z=="number"?z:E(z),"line-color":typeof I=="string"?I:se(I),"line-width":typeof C=="number"?C:E(C),"line-blur":typeof g=="number"?g:E(g),"line-gap-width":typeof b=="number"?b:E(b)},O&&{"line-dasharray":O})},e.beforeId),f}function Ir(o,e){var t,r,a,n,l,s,i,u,c,p,h;if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const L=(t=e.sourceId)!=null?t:be(),w=(r=e.layerId)!=null?r:Se(),v={polygonLayerId:w,polygonOutlineLayerId:e.outline?`${w}_outline`:"",polygonSourceId:L};if(e.data&&!o.getSource(L)){let I=e.data;typeof I=="string"&&ve(I)&&(I=`https://api.maptiler.com/data/${I}/features.json?key=${H.apiKey}`),o.addSource(L,{type:"geojson",data:I})}let $=(a=e.outlineDashArray)!=null?a:null;const M=(n=e.outlineWidth)!=null?n:1,x=(l=e.outlineColor)!=null?l:"#FFFFFF",B=(s=e.outlineOpacity)!=null?s:1,k=(i=e.outlineBlur)!=null?i:0,P=(u=e.fillColor)!=null?u:De(),R=(c=e.fillOpacity)!=null?c:1,T=(p=e.outlinePosition)!=null?p:"center",f=(h=e.pattern)!=null?h:null;typeof $=="string"&&($=jt($));const C=(I=null)=>{var z,g,b,O,N,F;if(o.addLayer({id:w,type:"fill",source:L,minzoom:(z=e.minzoom)!=null?z:0,maxzoom:(g=e.maxzoom)!=null?g:23,paint:ue({"fill-color":typeof P=="string"?P:se(P),"fill-opacity":typeof R=="number"?R:E(R)},I&&{"fill-pattern":I})},e.beforeId),e.outline===!0){let j;T==="inside"?typeof M=="number"?j=.5*M:j=E(M.map(({zoom:D,value:J})=>({zoom:D,value:.5*J}))):T==="outside"?typeof M=="number"?j=-.5*M:j=E(M.map(D=>({zoom:D.zoom,value:-.5*D.value}))):j=0,o.addLayer({id:v.polygonOutlineLayerId,type:"line",source:L,layout:{"line-join":(b=e.outlineJoin)!=null?b:"round","line-cap":(O=e.outlineCap)!=null?O:"butt"},minzoom:(N=e.minzoom)!=null?N:0,maxzoom:(F=e.maxzoom)!=null?F:23,paint:ue({"line-opacity":typeof B=="number"?B:E(B),"line-color":typeof x=="string"?x:se(x),"line-width":typeof M=="number"?M:E(M),"line-blur":typeof k=="number"?k:E(k),"line-offset":j},$&&{"line-dasharray":$})},e.beforeId)}};return f?o.hasImage(f)?C(f):o.loadImage(f,(I,z)=>{if(I)return console.error("Could not load the pattern image.",I.message),C();if(!z)return console.error(`An image cannot be created from the pattern URL ${f}.`),C();o.addImage(f,z),C(f)}):C(),v}function Tr(o,e){var t,r,a,n,l,s,i,u,c,p,h,L,w,v,$,M;if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const x=(t=e.minPointRadius)!=null?t:10,B=(r=e.maxPointRadius)!=null?r:50,k=(a=e.cluster)!=null?a:!1,P=20,R=Array.isArray(e.pointColor)?e.pointColor:je.TURBO.scale(10,e.cluster?1e4:1e3).resample("ease-out-square"),T=R.getBounds(),f=(n=e.sourceId)!=null?n:be(),C=(l=e.layerId)!=null?l:Se(),I=(s=e.showLabel)!=null?s:k,z=(i=e.alignOnViewport)!=null?i:!0,g=(u=e.outline)!=null?u:!1,b=(c=e.outlineOpacity)!=null?c:1,O=(p=e.outlineWidth)!=null?p:1,N=(h=e.outlineColor)!=null?h:"#FFFFFF";let F;const j=(L=e.zoomCompensation)!=null?L:!0,D=(w=e.minzoom)!=null?w:0,J=(v=e.maxzoom)!=null?v:23;typeof e.pointOpacity=="number"?F=e.pointOpacity:Array.isArray(e.pointOpacity)?F=E(e.pointOpacity):e.cluster?F=Ht(R,"point_count"):e.property?F=Ht(R,e.property):F=E([{zoom:D,value:0},{zoom:D+.25,value:1},{zoom:J-.25,value:1},{zoom:J,value:0}]);const re={pointLayerId:C,clusterLayerId:"",labelLayerId:"",pointSourceId:f};if(e.data&&!o.getSource(f)){let G=e.data;typeof G=="string"&&ve(G)&&(G=`https://api.maptiler.com/data/${G}/features.json?key=${H.apiKey}`),o.addSource(f,{type:"geojson",data:G,cluster:k})}if(k){re.clusterLayerId=`${C}_cluster`;const G=Array.from({length:P},(he,me)=>{const Ce=T.min+me*(T.max-T.min)/(P-1);return{value:Ce,pointRadius:x+(B-x)*Math.pow(me/(P-1),.5),color:R.getColorHex(Ce)}});o.addLayer({id:re.clusterLayerId,type:"circle",source:f,filter:["has","point_count"],paint:ue({"circle-color":typeof e.pointColor=="string"?e.pointColor:Dt(G,"point_count"),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?E(e.pointRadius):Gt(G,"point_count",!1),"circle-pitch-alignment":z?"viewport":"map","circle-pitch-scale":"map","circle-opacity":F},g&&{"circle-stroke-opacity":typeof b=="number"?b:E(b),"circle-stroke-width":typeof O=="number"?O:E(O),"circle-stroke-color":typeof N=="string"?N:se(N)}),minzoom:D,maxzoom:J},e.beforeId),o.addLayer({id:re.pointLayerId,type:"circle",source:f,filter:["!",["has","point_count"]],paint:ue({"circle-pitch-alignment":z?"viewport":"map","circle-pitch-scale":"map","circle-color":typeof e.pointColor=="string"?e.pointColor:R.getColorHex(R.getBounds().min),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?E(e.pointRadius):G[0].pointRadius*.75,"circle-opacity":F},g&&{"circle-stroke-opacity":typeof b=="number"?b:E(b),"circle-stroke-width":typeof O=="number"?O:E(O),"circle-stroke-color":typeof N=="string"?N:se(N)}),minzoom:D,maxzoom:J},e.beforeId)}else{let G=typeof e.pointColor=="string"?e.pointColor:Array.isArray(e.pointColor)?e.pointColor.getColorHex(e.pointColor.getBounds().min):De(),he=typeof e.pointRadius=="number"?j?E([{zoom:0,value:e.pointRadius*.025},{zoom:2,value:e.pointRadius*.05},{zoom:4,value:e.pointRadius*.1},{zoom:8,value:e.pointRadius*.25},{zoom:16,value:e.pointRadius*1}]):e.pointRadius:Array.isArray(e.pointRadius)?E(e.pointRadius):j?E([{zoom:0,value:x*.05},{zoom:2,value:x*.1},{zoom:4,value:x*.2},{zoom:8,value:x*.5},{zoom:16,value:x*1}]):x;if(e.property&&Array.isArray(e.pointColor)){const me=Array.from({length:P},(Ce,Ge)=>{const He=T.min+Ge*(T.max-T.min)/(P-1);return{value:He,pointRadius:typeof e.pointRadius=="number"?e.pointRadius:x+(B-x)*Math.pow(Ge/(P-1),.5),color:typeof e.pointColor=="string"?e.pointColor:R.getColorHex(He)}});G=Dt(me,e.property),he=Gt(me,e.property,j)}o.addLayer({id:re.pointLayerId,type:"circle",source:f,layout:{"circle-sort-key":e.property?["/",1,["get",e.property]]:0},paint:ue({"circle-pitch-alignment":z?"viewport":"map","circle-pitch-scale":"map","circle-color":G,"circle-opacity":F,"circle-radius":he},g&&{"circle-stroke-opacity":typeof b=="number"?b:E(b),"circle-stroke-width":typeof O=="number"?O:E(O),"circle-stroke-color":typeof N=="string"?N:se(N)}),minzoom:D,maxzoom:J},e.beforeId)}if(I!==!1&&(e.cluster||e.property)){re.labelLayerId=`${C}_label`;const G=($=e.labelColor)!=null?$:"#fff",he=(M=e.labelSize)!=null?M:12;o.addLayer({id:re.labelLayerId,type:"symbol",source:f,filter:["has",e.cluster?"point_count":e.property],layout:{"text-field":e.cluster?"{point_count_abbreviated}":`{${e.property}}`,"text-font":["Noto Sans Regular"],"text-size":he,"text-pitch-alignment":z?"viewport":"map","symbol-sort-key":["/",1,["get",e.cluster?"point_count":e.property]]},paint:{"text-color":G,"text-opacity":F},minzoom:D,maxzoom:J},e.beforeId)}return re}function xr(o,e){var t,r,a,n,l,s,i,u,c,p;if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const h=(t=e.sourceId)!=null?t:be(),L=(r=e.layerId)!=null?r:Se(),w=(a=e.minzoom)!=null?a:0,v=(n=e.maxzoom)!=null?n:23,$=(l=e.zoomCompensation)!=null?l:!0,M=(s=e.opacity)!=null?s:[{zoom:w,value:0},{zoom:w+.25,value:1},{zoom:v-.25,value:1},{zoom:v,value:0}];let x=Array.isArray(e.colorRamp)?e.colorRamp:je.TURBO.transparentStart();const B=x.getBounds();(B.min!==0||B.max!==1)&&(x=x.scale(0,1)),x.hasTransparentStart()||(x=x.transparentStart());const k=(i=e.intensity)!=null?i:[{zoom:0,value:.01},{zoom:4,value:.2},{zoom:16,value:1}],P=(u=e.property)!=null?u:null,R=(c=e.weight)!=null?c:1;let T=1;P?typeof R=="number"?(T=R,typeof e.weight=="number"&&console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`")):Array.isArray(R)?T=mr(R,P):console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"):typeof R=="number"?T=R:Array.isArray(R)&&console.warn("The options `.propertyValueWeights` can only be used when `.property` is provided.");const f=[{zoom:0,value:50*.025},{zoom:2,value:50*.05},{zoom:4,value:50*.1},{zoom:8,value:50*.25},{zoom:16,value:50}],C=(p=e.radius)!=null?p:$?f:10;let I=1;typeof C=="number"?I=C:Array.isArray(C)&&"zoom"in C[0]?I=E(C):P&&Array.isArray(C)&&"propertyValue"in C[0]?I=dr(C,P,$):!P&&Array.isArray(C)&&"propertyValue"in C[0]?(I=E(f),console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.")):I=E(f);const z={heatmapLayerId:L,heatmapSourceId:h};if(e.data&&!o.getSource(h)){let g=e.data;typeof g=="string"&&ve(g)&&(g=`https://api.maptiler.com/data/${g}/features.json?key=${H.apiKey}`),o.addSource(h,{type:"geojson",data:g})}return o.addLayer({id:L,type:"heatmap",source:h,minzoom:w,maxzoom:v,paint:{"heatmap-weight":T,"heatmap-intensity":typeof k=="number"?k:E(k),"heatmap-color":yr(x),"heatmap-radius":I,"heatmap-opacity":typeof M=="number"?M:E(M)}}),z}const Rr={addPolyline:Sr,addPolygon:Ir,addPoint:Tr,addHeatmap:xr},{setRTLTextPlugin:_r,getRTLTextPluginStatus:Er,LngLat:Or,LngLatBounds:Pr,MercatorCoordinate:Nr,Evented:Mr,AJAXError:zr,prewarm:Fr,clearPrewarmedResources:$r,version:kr,workerCount:Br,maxParallelImageRequests:Ur,workerUrl:jr,addProtocol:Dr,removeProtocol:Gr}=y,Hr=y.Map,Vr=y.Marker,Kr=y.Popup,Wr=y.Style,Zr=y.CanvasSource,Yr=y.GeoJSONSource,qr=y.ImageSource,Jr=y.RasterTileSource,Xr=y.RasterDEMTileSource,Qr=y.VectorTileSource,ea=y.VideoSource;y.NavigationControl,y.GeolocateControl,y.AttributionControl,y.LogoControl,y.ScaleControl,y.FullscreenControl,y.TerrainControl;export{zr as AJAXError,dt as AttributionControl,Go as CanvasSource,Zr as CanvasSourceMLGL,m as ColorRamp,je as ColorRampCollection,Mr as Evented,vt as FullscreenControl,Ho as GeoJSONSource,Yr as GeoJSONSourceMLGL,ut as GeolocateControl,St as GeolocationType,Vo as ImageSource,qr as ImageSourceMLGL,S as Language,pa as LanguageGeocoding,Or as LngLat,Pr as LngLatBounds,qe as LogoControl,Ct as Map,Hr as MapMLGL,ha as MapStyle,ma as MapStyleVariant,mt as MaptilerGeolocateControl,Te as MaptilerLogoControl,st as MaptilerNavigationControl,lt as MaptilerTerrainControl,Uo as Marker,Vr as MarkerMLGL,Nr as MercatorCoordinate,it as NavigationControl,ye as Point,jo as Popup,Kr as PopupMLGL,Wo as RasterDEMTileSource,Xr as RasterDEMTileSourceMLGL,Ko as RasterTileSource,Jr as RasterTileSourceMLGL,da as ReferenceMapStyle,yt as ScaleControl,Ye as SdkConfig,ya as ServiceError,Do as Style,Wr as StyleMLGL,qo as TerrainControl,Zo as VectorTileSource,Qr as VectorTileSourceMLGL,Yo as VideoSource,ea as VideoSourceMLGL,Dr as addProtocol,$r as clearPrewarmedResources,H as config,va as coordinates,ga as data,fa as geocoding,Aa as geolocation,Er as getRTLTextPluginStatus,$e as gpx,$t as gpxOrKml,ze as hasChildNodeWithName,Rr as helpers,ke as kml,Ur as maxParallelImageRequests,Fr as prewarm,Gr as removeProtocol,_r as setRTLTextPlugin,La as staticMaps,Ae as str2xml,kr as version,Br as workerCount,jr as workerUrl,Fe as xml2str};
|