@maptiler/sdk 2.1.0 → 2.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.
@@ -17,8 +17,5 @@ jobs:
17
17
  - name: Install Node.js dependencies
18
18
  run: npm ci
19
19
 
20
- - name: Formatting with Prettier
21
- run: npm run format
22
-
23
- - name: Linting with ESLint
24
- run: npm run lint
20
+ - name: Formatting and linting with Biome
21
+ run: npm run biome
package/biome.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "files": {
3
+ "include": ["src/**/*.js", "src/**/*.ts"]
4
+ },
5
+ "organizeImports": {
6
+ "enabled": false
7
+ },
8
+ "formatter": {
9
+ "indentStyle": "space",
10
+ "indentWidth": 2,
11
+ "lineWidth": 120
12
+ },
13
+ "javascript": {
14
+ "formatter": {
15
+ "arrowParentheses": "always",
16
+ "bracketSameLine": false,
17
+ "bracketSpacing": true,
18
+ "jsxQuoteStyle": "double",
19
+ "quoteProperties": "asNeeded",
20
+ "semicolons": "always",
21
+ "trailingCommas": "all"
22
+ }
23
+ },
24
+ "json": {
25
+ "formatter": {
26
+ "trailingCommas": "none"
27
+ }
28
+ },
29
+ "linter": {
30
+ "rules": {
31
+ "suspicious": {
32
+ "noExplicitAny": {
33
+ "level": "off"
34
+ }
35
+ },
36
+ "complexity": {
37
+ "noUselessTernary": {
38
+ "level": "off"
39
+ },
40
+ "useOptionalChain": {
41
+ "level": "off"
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
@@ -144,4 +144,24 @@
144
144
  padding: 0 5px;
145
145
  text-align: right;
146
146
  line-height: 14px;
147
+ }
148
+
149
+ .no-webgl-support-div {
150
+ position: absolute;
151
+ top: 0;
152
+ left: 0;
153
+ bottom: 0;
154
+ right: 0;
155
+ margin: auto;
156
+ width: fit-content;
157
+ height: fit-content;
158
+ padding: 10px;
159
+ background: white;
160
+ border-radius: 3px;
161
+ color: #fb8600;
162
+ text-align: center;
163
+ font-family: sans-serif;
164
+ font-weight: 300;
165
+ font-size: 16px;
166
+ max-width: calc(100% - 80px);
147
167
  }
@@ -184,7 +184,6 @@ declare class SdkConfig extends EventEmitter {
184
184
  * MapTiler Cloud API key
185
185
  */
186
186
  private _apiKey;
187
- constructor();
188
187
  /**
189
188
  * Set the unit system
190
189
  */
@@ -1779,6 +1778,11 @@ declare const helpers: {
1779
1778
 
1780
1779
  declare const setRTLTextPlugin: typeof maplibregl__default.setRTLTextPlugin;
1781
1780
  declare const getRTLTextPluginStatus: typeof maplibregl__default.getRTLTextPluginStatus;
1781
+ declare const LngLat: typeof maplibregl__default.LngLat;
1782
+ declare const LngLatBounds: typeof maplibregl__default.LngLatBounds;
1783
+ declare const MercatorCoordinate: typeof maplibregl__default.MercatorCoordinate;
1784
+ declare const Evented: typeof maplibregl__default.Evented;
1785
+ declare const AJAXError: typeof maplibregl__default.AJAXError;
1782
1786
  declare const prewarm: typeof maplibregl__default.prewarm;
1783
1787
  declare const clearPrewarmedResources: typeof maplibregl__default.clearPrewarmedResources;
1784
1788
  declare const addProtocol: typeof maplibregl__default.addProtocol;
@@ -1809,68 +1813,39 @@ declare function getVersion(): string;
1809
1813
  * Get the version of MapLibre GL JS
1810
1814
  */
1811
1815
  declare function getMapLibreVersion(): string;
1812
-
1813
- declare const NavigationControlMLGL: typeof maplibregl__default.NavigationControl;
1814
- type NavigationControlMLGL = InstanceType<typeof NavigationControlMLGL>;
1815
- declare const GeolocateControlMLGL: typeof maplibregl__default.GeolocateControl;
1816
- type GeolocateControlMLGL = InstanceType<typeof GeolocateControlMLGL>;
1817
- declare const AttributionControlMLGL: typeof maplibregl__default.AttributionControl;
1818
- type AttributionControlMLGL = InstanceType<typeof AttributionControlMLGL>;
1819
- declare const LogoControlMLGL: typeof maplibregl__default.LogoControl;
1820
- type LogoControlMLGL = InstanceType<typeof LogoControlMLGL>;
1821
- declare const ScaleControlMLGL: typeof maplibregl__default.ScaleControl;
1822
- type ScaleControlMLGL = InstanceType<typeof ScaleControlMLGL>;
1823
- declare const FullscreenControlMLGL: typeof maplibregl__default.FullscreenControl;
1824
- type FullscreenControlMLGL = InstanceType<typeof FullscreenControlMLGL>;
1825
- declare const TerrainControlMLGL: typeof maplibregl__default.TerrainControl;
1826
- type TerrainControlMLGL = InstanceType<typeof TerrainControlMLGL>;
1816
+ declare const MapMLGL: typeof maplibregl__default.Map;
1827
1817
  declare const MarkerMLGL: typeof maplibregl__default.Marker;
1828
- type MarkerMLGL = InstanceType<typeof MarkerMLGL>;
1829
1818
  declare const PopupMLGL: typeof maplibregl__default.Popup;
1830
- type PopupMLGL = InstanceType<typeof PopupMLGL>;
1831
1819
  declare const StyleMLGL: typeof maplibregl__default.Style;
1832
- type StyleMLGL = InstanceType<typeof StyleMLGL>;
1833
- declare const LngLat: typeof maplibregl__default.LngLat;
1834
- type LngLat = InstanceType<typeof LngLat>;
1835
- declare const LngLatBounds: typeof maplibregl__default.LngLatBounds;
1836
- type LngLatBounds = InstanceType<typeof LngLatBounds>;
1837
- declare const MercatorCoordinate: typeof maplibregl__default.MercatorCoordinate;
1838
- type MercatorCoordinate = InstanceType<typeof MercatorCoordinate>;
1839
- declare const Evented: typeof maplibregl__default.Evented;
1840
- type Evented = InstanceType<typeof Evented>;
1841
- declare const AJAXError: typeof maplibregl__default.AJAXError;
1842
- type AJAXError = InstanceType<typeof AJAXError>;
1843
1820
  declare const CanvasSourceMLGL: typeof maplibregl__default.CanvasSource;
1844
- type CanvasSourceMLGL = InstanceType<typeof CanvasSourceMLGL>;
1845
1821
  declare const GeoJSONSourceMLGL: typeof maplibregl__default.GeoJSONSource;
1846
- type GeoJSONSourceMLGL = InstanceType<typeof GeoJSONSourceMLGL>;
1847
1822
  declare const ImageSourceMLGL: typeof maplibregl__default.ImageSource;
1848
- type ImageSourceMLGL = InstanceType<typeof ImageSourceMLGL>;
1849
- declare const RasterDEMTileSourceMLGL: typeof maplibregl__default.RasterDEMTileSource;
1850
- type RasterDEMTileSourceMLGL = InstanceType<typeof RasterDEMTileSourceMLGL>;
1851
1823
  declare const RasterTileSourceMLGL: typeof maplibregl__default.RasterTileSource;
1852
- type RasterTileSourceMLGL = InstanceType<typeof RasterTileSourceMLGL>;
1824
+ declare const RasterDEMTileSourceMLGL: typeof maplibregl__default.RasterDEMTileSource;
1853
1825
  declare const VectorTileSourceMLGL: typeof maplibregl__default.VectorTileSource;
1854
- type VectorTileSourceMLGL = InstanceType<typeof VectorTileSourceMLGL>;
1855
1826
  declare const VideoSourceMLGL: typeof maplibregl__default.VideoSource;
1856
- type VideoSourceMLGL = InstanceType<typeof VideoSourceMLGL>;
1857
- declare const MapMLGL: typeof maplibregl__default.Map;
1858
- type MapMLGL = InstanceType<typeof MapMLGL>;
1859
1827
  declare const BoxZoomHandlerMLGL: typeof maplibregl__default.BoxZoomHandler;
1860
- type BoxZoomHandlerMLGL = InstanceType<typeof BoxZoomHandlerMLGL>;
1861
1828
  declare const ScrollZoomHandlerMLGL: typeof maplibregl__default.ScrollZoomHandler;
1862
- type ScrollZoomHandlerMLGL = InstanceType<typeof ScrollZoomHandlerMLGL>;
1863
1829
  declare const CooperativeGesturesHandlerMLGL: typeof maplibregl__default.CooperativeGesturesHandler;
1864
- type CooperativeGesturesHandlerMLGL = InstanceType<typeof CooperativeGesturesHandlerMLGL>;
1865
1830
  declare const KeyboardHandlerMLGL: typeof maplibregl__default.KeyboardHandler;
1866
- type KeyboardHandlerMLGL = InstanceType<typeof KeyboardHandlerMLGL>;
1867
1831
  declare const TwoFingersTouchPitchHandlerMLGL: typeof maplibregl__default.TwoFingersTouchPitchHandler;
1868
- type TwoFingersTouchPitchHandlerMLGL = InstanceType<typeof TwoFingersTouchPitchHandlerMLGL>;
1869
1832
  declare const MapWheelEventMLGL: typeof maplibregl__default.MapWheelEvent;
1870
- type MapWheelEventMLGL = InstanceType<typeof MapWheelEventMLGL>;
1871
1833
  declare const MapTouchEventMLGL: typeof maplibregl__default.MapTouchEvent;
1872
- type MapTouchEventMLGL = InstanceType<typeof MapTouchEventMLGL>;
1873
1834
  declare const MapMouseEventMLGL: typeof maplibregl__default.MapMouseEvent;
1874
- type MapMouseEventMLGL = InstanceType<typeof MapMouseEventMLGL>;
1875
1835
 
1876
- export { AJAXError, ArrayColor, ArrayColorRamp, ArrayColorRampStop, AttributionControl, AttributionControlMLGL, BoxZoomHandler, BoxZoomHandlerMLGL, CanvasSource, CanvasSourceMLGL, ColorRamp, ColorRampCollection, ColorRampOptions, ColorStop, CommonShapeLayerOptions, CooperativeGesturesHandler, CooperativeGesturesHandlerMLGL, DoubleClickZoomHandler, DragPanHandler, DragRotateHandler, EdgeInsets, Evented, FullscreenControl, FullscreenControlMLGL, GeoJSONSource, GeoJSONSourceMLGL, GeolocateControl, GeolocateControlMLGL, GeolocationType, Hash, HeatmapLayerOptions, ImageSource, ImageSourceMLGL, KeyboardHandler, KeyboardHandlerMLGL, Language, LanguageKey, LanguageString, Link, LngLat, LngLatBounds, LoadWithTerrainEvent, LogoControl, LogoControlMLGL, Map, MapMLGL, MapMouseEvent, MapMouseEventMLGL, MapOptions, MapTouchEvent, MapTouchEventMLGL, MapWheelEvent, MapWheelEventMLGL, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerNavigationControl, MaptilerTerrainControl, Marker, MarkerMLGL, MercatorCoordinate, MinimapOptions, MinimapOptionsInput, NavigationControl, NavigationControlMLGL, ParentRect, PlacemarkProperties, Point, PointLayerOptions, PolygonLayerOptions, PolylineLayerOptions, Popup, PopupMLGL, PropertyValues, RasterDEMTileSource, RasterDEMTileSourceMLGL, RasterTileSource, RasterTileSourceMLGL, RgbaColor, ScaleControl, ScaleControlMLGL, ScrollZoomHandler, ScrollZoomHandlerMLGL, SdkConfig, Style, StyleMLGL, TerrainControl, TerrainControlMLGL, TwoFingersTouchPitchHandler, TwoFingersTouchPitchHandlerMLGL, TwoFingersTouchRotateHandler, TwoFingersTouchZoomHandler, TwoFingersTouchZoomRotateHandler, Unit, VectorTileSource, VectorTileSourceMLGL, VideoSource, VideoSourceMLGL, XMLProperties, ZoomNumberValues, ZoomStringValues, addProtocol, addSourceType, clearPrewarmedResources, config$1 as config, config as configMLGL, getBrowserLanguage, getMapLibreVersion, getMaxParallelImageRequests, getRTLTextPluginStatus, getVersion, getWorkerCount, getWorkerUrl, gpx, gpxOrKml, hasChildNodeWithName, helpers, importScriptInWorkers, isLanguageSupported, kml, prewarm, removeProtocol, setMaxParallelImageRequests, setRTLTextPlugin, setWorkerCount, setWorkerUrl, str2xml, xml2str };
1836
+ declare const NavigationControlMLGL: typeof maplibregl__default.NavigationControl;
1837
+ type NavigationControlMLGL = InstanceType<typeof NavigationControlMLGL>;
1838
+ declare const GeolocateControlMLGL: typeof maplibregl__default.GeolocateControl;
1839
+ type GeolocateControlMLGL = InstanceType<typeof GeolocateControlMLGL>;
1840
+ declare const AttributionControlMLGL: typeof maplibregl__default.AttributionControl;
1841
+ type AttributionControlMLGL = InstanceType<typeof AttributionControlMLGL>;
1842
+ declare const LogoControlMLGL: typeof maplibregl__default.LogoControl;
1843
+ type LogoControlMLGL = InstanceType<typeof LogoControlMLGL>;
1844
+ declare const ScaleControlMLGL: typeof maplibregl__default.ScaleControl;
1845
+ type ScaleControlMLGL = InstanceType<typeof ScaleControlMLGL>;
1846
+ declare const FullscreenControlMLGL: typeof maplibregl__default.FullscreenControl;
1847
+ type FullscreenControlMLGL = InstanceType<typeof FullscreenControlMLGL>;
1848
+ declare const TerrainControlMLGL: typeof maplibregl__default.TerrainControl;
1849
+ type TerrainControlMLGL = InstanceType<typeof TerrainControlMLGL>;
1850
+
1851
+ export { AJAXError, type ArrayColor, type ArrayColorRamp, type ArrayColorRampStop, AttributionControl, AttributionControlMLGL, BoxZoomHandler, BoxZoomHandlerMLGL, CanvasSource, CanvasSourceMLGL, ColorRamp, ColorRampCollection, type ColorRampOptions, type ColorStop, type CommonShapeLayerOptions, CooperativeGesturesHandler, CooperativeGesturesHandlerMLGL, DoubleClickZoomHandler, DragPanHandler, DragRotateHandler, EdgeInsets, Evented, FullscreenControl, FullscreenControlMLGL, GeoJSONSource, GeoJSONSourceMLGL, GeolocateControl, GeolocateControlMLGL, GeolocationType, Hash, type HeatmapLayerOptions, ImageSource, ImageSourceMLGL, KeyboardHandler, KeyboardHandlerMLGL, Language, type LanguageKey, type LanguageString, type Link, LngLat, LngLatBounds, type LoadWithTerrainEvent, LogoControl, LogoControlMLGL, Map, MapMLGL, MapMouseEvent, MapMouseEventMLGL, type MapOptions, MapTouchEvent, MapTouchEventMLGL, MapWheelEvent, MapWheelEventMLGL, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerNavigationControl, MaptilerTerrainControl, Marker, MarkerMLGL, MercatorCoordinate, type MinimapOptions, type MinimapOptionsInput, NavigationControl, NavigationControlMLGL, type ParentRect, type PlacemarkProperties, Point, type PointLayerOptions, type PolygonLayerOptions, type PolylineLayerOptions, Popup, PopupMLGL, type PropertyValues, RasterDEMTileSource, RasterDEMTileSourceMLGL, RasterTileSource, RasterTileSourceMLGL, type RgbaColor, ScaleControl, ScaleControlMLGL, ScrollZoomHandler, ScrollZoomHandlerMLGL, SdkConfig, Style, StyleMLGL, TerrainControl, TerrainControlMLGL, TwoFingersTouchPitchHandler, TwoFingersTouchPitchHandlerMLGL, TwoFingersTouchRotateHandler, TwoFingersTouchZoomHandler, TwoFingersTouchZoomRotateHandler, type Unit, VectorTileSource, VectorTileSourceMLGL, VideoSource, VideoSourceMLGL, type XMLProperties, type ZoomNumberValues, type ZoomStringValues, addProtocol, addSourceType, clearPrewarmedResources, config$1 as config, config as configMLGL, getBrowserLanguage, getMapLibreVersion, getMaxParallelImageRequests, getRTLTextPluginStatus, getVersion, getWorkerCount, getWorkerUrl, gpx, gpxOrKml, hasChildNodeWithName, helpers, importScriptInWorkers, isLanguageSupported, kml, prewarm, removeProtocol, setMaxParallelImageRequests, setRTLTextPlugin, setWorkerCount, setWorkerUrl, str2xml, xml2str };
@@ -1,3 +1,3 @@
1
- import h from"maplibre-gl";import{Base64 as Xt}from"js-base64";import Qt from"events";import{config as Te,expandMapStyle as eo,MapStyleVariant as to,ReferenceMapStyle as oo,MapStyle as ro,mapStylePresetList as ao,geolocation as Xe}from"@maptiler/client";import{LanguageGeocoding as ml,MapStyle as dl,MapStyleVariant as gl,ReferenceMapStyle as vl,ServiceError as yl,bufferToPixelDataBrowser as fl,circumferenceAtLatitude as Ll,coordinates as Al,data as wl,elevation as bl,expandMapStyle as Sl,geocoding as Cl,geolocation as Tl,getAutoLanguageGeocoding as Il,getBufferToPixelDataParser as Rl,getTileCache as El,mapStylePresetList as xl,math as Pl,misc as Ol,staticMaps as _l,styleToStyle as Nl}from"@maptiler/client";import{v4 as lo}from"uuid";var no="@maptiler/sdk",io="2.1.0",so="The Javascript & TypeScript map SDK tailored for MapTiler Cloud",uo="dist/maptiler-sdk.mjs",co="dist/maptiler-sdk.d.ts",po="dist/maptiler-sdk.css",ho="module",mo={".":{import:"./dist/maptiler-sdk.mjs",types:"./dist/maptiler-sdk.d.ts"},"./dist/maptiler-sdk.css":{import:"./dist/maptiler-sdk.css"},"./style.css":{import:"./dist/maptiler-sdk.css"}},go=["maptiler","map","sdk","webmap","cloud","webGL","maplibre"],vo="https://docs.maptiler.com/sdk-js/",yo="BSD-3-Clause",fo={type:"git",url:"https://github.com/maptiler/maptiler-sdk-js.git"},Lo={build:"rm -rf dist/* && NODE_ENV=production rollup -c",dev:"rm -rf dist/* && NODE_ENV=development rollup -c -w","format:fix":'prettier --write "src/**/*.{js,ts,tsx}"',format:'prettier -c "src/**/*.{js,ts,tsx}"',"lint:fix":'eslint --fix "src/**/*.{js,ts}"',lint:'eslint "src/**/*.{js,ts}"',doc:"rm -rf docs/* && typedoc --out docs && cp -r images docs/",prepare:"npm run format:fix && npm run lint:fix && npm run build && npm run test","test:dev":"vitest dev",test:"vitest run"},Ao="MapTiler",wo={"@rollup/plugin-commonjs":"^24.1.0","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.0.2","@types/uuid":"^9.0.2","@types/xmldom":"^0.1.31","@typescript-eslint/eslint-plugin":"^6.9.0","@typescript-eslint/parser":"^6.9.0",eslint:"^8.52.0","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.1",prettier:"^3.0.3",rollup:"^3.20.6","rollup-plugin-copy-merge":"^1.0.0","rollup-plugin-dts":"^5.3.0","rollup-plugin-esbuild":"^5.0.0","rollup-plugin-node-globals":"^1.4.0","rollup-plugin-shell":"^1.0.9","rollup-plugin-string":"^3.0.0","rollup-plugin-swc":"^0.2.1",serve:"^14.2.0",terser:"^5.17.1",typedoc:"^0.24.8",typescript:"^5.1.6",vitest:"^0.34.2",xmldom:"^0.6.0"},bo={"@maptiler/client":"^1.8.1",events:"^3.3.0","js-base64":"^3.7.4","maplibre-gl":"4.4.1",uuid:"^9.0.0"},So={name:no,version:io,description:so,module:uo,types:co,style:po,type:ho,exports:mo,keywords:go,homepage:vo,license:yo,repository:fo,scripts:Lo,author:Ao,devDependencies:wo,dependencies:bo};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"},Co=new Set(Object.values(S));function Ie(t){return Co.has(t)}const To=new Set(Object.values(S));function Re(){if(typeof navigator>"u")return`name:${Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0]}`;const t=Array.from(new Set(navigator.languages.map(e=>`name:${e.split("-")[0]}`))).filter(e=>To.has(e));return t.length?t[0]:S.LOCAL}const V={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(V);var Io=Object.defineProperty,Ro=(t,e,o)=>e in t?Io(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ce=(t,e,o)=>(Ro(t,typeof e!="symbol"?e+"":e,o),o);const Qe=lo();let et=class extends Qt{constructor(){super(),ce(this,"primaryLanguage",V.primaryLanguage),ce(this,"secondaryLanguage"),ce(this,"session",!0),ce(this,"caching",!0),ce(this,"_unit","metric"),ce(this,"_apiKey","")}set unit(e){this._unit=e,this.emit("unit",e)}get unit(){return this._unit}set apiKey(e){this._apiKey=e,Te.apiKey=e,this.emit("apiKey",e)}get apiKey(){return this._apiKey}set fetch(e){Te.fetch=e}get fetch(){return Te.fetch}};const j=new et;class tt extends h.LogoControl{onAdd(e){return super.onAdd(e)}}var Eo=Object.defineProperty,xo=(t,e,o)=>e in t?Eo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ot=(t,e,o)=>(xo(t,typeof e!="symbol"?e+"":e,o),o);class Ee extends tt{constructor(e={}){var o,r;super(e),ot(this,"logoURL",""),ot(this,"linkURL",""),this.logoURL=(o=e.logoURL)!=null?o:V.maptilerLogoURL,this.linkURL=(r=e.linkURL)!=null?r:V.maptilerURL}onAdd(e){var o;this._map=e,this._compact=(o=this.options.compact)!=null?o:!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 ge=(t,e,o)=>new Promise((r,a)=>{var l=n=>{try{s(o.next(n))}catch(u){a(u)}},i=n=>{try{s(o.throw(n))}catch(u){a(u)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(l,i);s((o=o.apply(t,e)).next())});const xe="localcache_source",Pe="localcache",Po="maptiler_sdk",Oo=1e3,_o=100;function No(t,e){if(j.caching&&j.session&&t.host===V.maptilerApiHost){if(e=="Source"&&t.href.includes("tiles.json"))return t.href.replace("https://",`${xe}://`);if(e=="Tile"||e=="Glyphs")return t.href.replace("https://",`${Pe}://`)}return t.href}let Oe;function rt(){return ge(this,null,function*(){return Oe||(Oe=yield caches.open(Po)),Oe})}let at=0;function Mo(){return ge(this,null,function*(){const t=yield rt(),e=yield t.keys(),o=e.slice(0,Math.max(e.length-Oo,0));for(const r of o)t.delete(r)})}function $o(){Ye(xe,(t,e)=>ge(this,null,function*(){if(!t.url)throw new Error("");t.url=t.url.replace(`${xe}://`,"https://");const o=t;o.signal=e.signal;const r=yield fetch(t.url,o),a=yield r.json();return a.tiles&&a.tiles.length>0&&(a.tiles[0]+="&last-modified="+r.headers.get("Last-Modified")),{data:a,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}})),Ye(Pe,(t,e)=>ge(this,null,function*(){if(!t.url)throw new Error("");t.url=t.url.replace(`${Pe}://`,"https://");const o=new URL(t.url),r=new URL(o);r.searchParams.delete("mtsid"),r.searchParams.delete("key");const a=r.toString(),l=new URL(o);l.searchParams.delete("last-modified");const i=l.toString(),s=c=>ge(this,null,function*(){return{data:yield c.arrayBuffer(),cacheControl:c.headers.get("Cache-Control"),expires:c.headers.get("Expires")}}),n=yield rt(),u=yield n.match(a);if(u)return s(u);{const c=t;c.signal=e.signal;const p=yield fetch(i,c);return p.status>=200&&p.status<300&&(n.put(a,p.clone()).catch(()=>{}),++at>_o&&(Mo(),at=0)),s(p)}}))}var ko=Object.defineProperty,lt=Object.getOwnPropertySymbols,Fo=Object.prototype.hasOwnProperty,zo=Object.prototype.propertyIsEnumerable,nt=(t,e,o)=>e in t?ko(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,it=(t,e)=>{for(var o in e||(e={}))Fo.call(e,o)&&nt(t,o,e[o]);if(lt)for(var o of lt(e))zo.call(e,o)&&nt(t,o,e[o]);return t};function Bo(){h.getRTLTextPluginStatus()==="unavailable"&&h.setRTLTextPlugin(V.rtlPluginURL,t=>{t&&console.error(t)},!0)}function Uo(t,e){t.forEach(o=>{typeof e[o]=="function"&&(e[o]=e[o].bind(e))})}function oe(t,e,o){const r=window.document.createElement(t);return e!==void 0&&(r.className=e),o&&o.appendChild(r),r}function st(t){t.parentNode&&t.parentNode.removeChild(t)}function ut(t,e){let o=null;try{o=new URL(t)}catch{return{url:t}}return o.host===V.maptilerApiHost&&(o.searchParams.has("key")||o.searchParams.append("key",j.apiKey),j.session&&o.searchParams.append("mtsid",Qe)),{url:No(o,e)}}function ct(t){return function(e,o){var r;if(t!=null){const a=t(e,o),l=ut((r=a?.url)!=null?r:"",o);return it(it({},a),l)}else return ut(e,o)}}function pt(){return Math.random().toString(36).substring(2)}function ve(t){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(t)}function Ho(t){try{return JSON.parse(t)}catch{}return null}function ht(t){return t?typeof t=="string"||t instanceof String?!t.startsWith("http")&&t.toLowerCase().includes(".json")?t:eo(t):t instanceof to?t.getExpandedStyleURL():t instanceof oo?t.getDefaultVariant().getExpandedStyleURL():t:ro[ao[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}var jo=Object.defineProperty,Do=(t,e,o)=>e in t?jo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,_e=(t,e,o)=>(Do(t,typeof e!="symbol"?e+"":e,o),o);class mt{constructor(){_e(this,"_map"),_e(this,"_container"),_e(this,"_terrainButton"),Uo(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(e){return this._map=e,this._container=oe("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=oe("button","maplibregl-ctrl-terrain",this._container),oe("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(){st(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.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))}}class dt extends h.NavigationControl{onAdd(e){return super.onAdd(e)}}var Go=Object.defineProperty,Vo=(t,e,o)=>e in t?Go(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Wo=(t,e,o)=>(Vo(t,typeof e!="symbol"?e+"":e,o),o);class gt extends dt{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),Wo(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,o){const r=super._createButton(e,o);return r.clickFunction=o,r}}class vt extends h.GeolocateControl{onAdd(e){return super.onAdd(e)}}var Zo=Object.defineProperty,Ko=Object.defineProperties,Yo=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,qo=Object.prototype.hasOwnProperty,Jo=Object.prototype.propertyIsEnumerable,Ne=(t,e,o)=>e in t?Zo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Xo=(t,e)=>{for(var o in e||(e={}))qo.call(e,o)&&Ne(t,o,e[o]);if(yt)for(var o of yt(e))Jo.call(e,o)&&Ne(t,o,e[o]);return t},Qo=(t,e)=>Ko(t,Yo(e)),ye=(t,e,o)=>(Ne(t,typeof e!="symbol"?e+"":e,o),o);const ft=h.Marker,Lt=h.LngLat,er=h.LngLatBounds;class At extends vt{constructor(){super(...arguments),ye(this,"lastUpdatedCenter",new Lt(0,0)),ye(this,"_updateCamera",e=>{var o,r,a;const l=new Lt(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,s=this._map.getBearing(),n=Qo(Xo({bearing:s},this.options.fitBoundsOptions),{linear:!0}),u=this._map.getZoom();u>((a=(r=(o=this.options)==null?void 0:o.fitBoundsOptions)==null?void 0:r.maxZoom)!=null?a:30)&&(n.zoom=u),this._map.fitBounds(er.fromLngLat(l,i),n,{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())})}),ye(this,"_setupUI",e=>{if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",o=>o.preventDefault()),this._geolocateButton=oe("button","maplibregl-ctrl-geolocate",this._container),oe("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",e===!1){const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}else{const o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=oe("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ft({element:this._dotElement}),this._circleElement=oe("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ft({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",o=>{const r=o.originalEvent&&o.originalEvent.type==="resize",a=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!o.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")))})}),ye(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],o=this._map.project(e),r=this._map.unproject([o.x,o.y]),a=this._map.unproject([o.x+20,o.y]),l=r.distanceTo(a)/20,i=Math.ceil(2*this._accuracy/l);this._circleElement.style.width=`${i}px`,this._circleElement.style.height=`${i}px`}}class wt extends h.ScaleControl{onAdd(e){return super.onAdd(e)}}class bt extends h.FullscreenControl{onAdd(e){return super.onAdd(e)}}var tr=Object.defineProperty,or=Object.defineProperties,rr=Object.getOwnPropertyDescriptors,St=Object.getOwnPropertySymbols,ar=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,Me=(t,e,o)=>e in t?tr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,pe=(t,e)=>{for(var o in e||(e={}))ar.call(e,o)&&Me(t,o,e[o]);if(St)for(var o of St(e))lr.call(e,o)&&Me(t,o,e[o]);return t},Ct=(t,e)=>or(t,rr(e)),nr=(t,e,o)=>(Me(t,typeof e!="symbol"?e+"":e,o),o),$e=(t,e,o)=>{if(!e.has(t))throw TypeError("Cannot "+o)},L=(t,e,o)=>($e(t,e,"read from private field"),o?o.call(t):e.get(t)),X=(t,e,o)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,o)},he=(t,e,o,r)=>($e(t,e,"write to private field"),r?r.call(t,o):e.set(t,o),o),W=(t,e,o)=>($e(t,e,"access private method"),o),Z,Q,ae,Tt,le,Y,fe,ke,It,K,q,Fe,Rt;let ze=class{constructor(e,o){X(this,ke),X(this,K),X(this,Fe),X(this,Z,void 0),nr(this,"map"),X(this,Q,void 0),X(this,ae,void 0),X(this,Tt,void 0),X(this,le,void 0),X(this,Y,!1),X(this,fe,void 0);var r;e.style!==void 0&&he(this,Y,!0),he(this,Z,Ct(pe(Ct(pe({zoomAdjust:-4,position:"top-right"},o),{forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1}),e),{containerStyle:pe({border:"1px solid #000",width:"400px",height:"300px"},(r=e.containerStyle)!=null?r:{})})),e.lockZoom!==void 0&&(L(this,Z).minZoom=e.lockZoom,L(this,Z).maxZoom=e.lockZoom)}setStyle(e,o){L(this,Y)||this.map.setStyle(e,o),W(this,K,q).call(this)}addLayer(e,o){return L(this,Y)||this.map.addLayer(e,o),W(this,K,q).call(this),this.map}moveLayer(e,o){return L(this,Y)||this.map.moveLayer(e,o),W(this,K,q).call(this),this.map}removeLayer(e){return L(this,Y)||this.map.removeLayer(e),W(this,K,q).call(this),this}setLayerZoomRange(e,o,r){return L(this,Y)||this.map.setLayerZoomRange(e,o,r),W(this,K,q).call(this),this}setFilter(e,o,r){return L(this,Y)||this.map.setFilter(e,o,r),W(this,K,q).call(this),this}setPaintProperty(e,o,r,a){return L(this,Y)||this.map.setPaintProperty(e,o,r,a),W(this,K,q).call(this),this}setLayoutProperty(e,o,r,a){return L(this,Y)||this.map.setLayoutProperty(e,o,r,a),W(this,K,q).call(this),this}setGlyphs(e,o){return L(this,Y)||this.map.setGlyphs(e,o),W(this,K,q).call(this),this}onAdd(e){he(this,Q,e),he(this,ae,oe("div","maplibregl-ctrl maplibregl-ctrl-group"));for(const[o,r]of Object.entries(L(this,Z).containerStyle))L(this,ae).style.setProperty(o,r);return L(this,Z).container=L(this,ae),L(this,Z).zoom=e.getZoom()+L(this,Z).zoomAdjust,this.map=new Pt(L(this,Z)),this.map.once("style.load",()=>{this.map.resize()}),this.map.once("load",()=>{W(this,ke,It).call(this,L(this,Z).parentRect),he(this,fe,W(this,Fe,Rt).call(this))}),L(this,ae)}onRemove(){var e;(e=L(this,fe))==null||e.call(this),st(L(this,ae))}};Z=new WeakMap,Q=new WeakMap,ae=new WeakMap,Tt=new WeakMap,le=new WeakMap,Y=new WeakMap,fe=new WeakMap,ke=new WeakSet,It=function(t){t===void 0||t.linePaint===void 0&&t.fillPaint===void 0||(he(this,le,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:L(this,le)}),(t.lineLayout!==void 0||t.linePaint!==void 0)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:pe({},t.lineLayout),paint:pe({"line-color":"#FFF","line-width":1,"line-opacity":.85},t.linePaint)}),t.fillPaint!==void 0&&this.map.addLayer({id:"parentRectFill",type:"fill",source:"parentRect",layout:{},paint:pe({"fill-color":"#08F","fill-opacity":.135},t.fillPaint)}),W(this,K,q).call(this))},K=new WeakSet,q=function(){if(L(this,le)===void 0)return;const{devicePixelRatio:t}=window,e=L(this,Q).getCanvas(),o=e.width/t,r=e.height/t,a=L(this,Q).unproject.bind(L(this,Q)),l=a([0,0]),i=a([o,0]),s=a([0,r]),n=a([o,r]);L(this,le).geometry.coordinates=[[s.toArray(),n.toArray(),i.toArray(),l.toArray(),s.toArray()]],this.map.getSource("parentRect").setData(L(this,le))},Fe=new WeakSet,Rt=function(){const{pitchAdjust:t}=L(this,Z),e=()=>{l("parent")},o=()=>{l("minimap")},r=()=>{L(this,Q).on("move",e),this.map.on("move",o)},a=()=>{L(this,Q).off("move",e),this.map.off("move",o)},l=i=>{var s;a();const n=i==="parent"?L(this,Q):this.map,u=i==="parent"?this.map:L(this,Q),c=n.getCenter(),p=n.getZoom()+((s=L(this,Z).zoomAdjust)!=null?s:-4)*(i==="parent"?1:-1),v=n.getBearing(),m=n.getPitch();u.jumpTo({center:c,zoom:p,bearing:v,pitch:t?m:0}),W(this,K,q).call(this),r()};return r(),()=>{a()}};var ir=Object.defineProperty,sr=Object.defineProperties,ur=Object.getOwnPropertyDescriptors,Et=Object.getOwnPropertySymbols,cr=Object.prototype.hasOwnProperty,pr=Object.prototype.propertyIsEnumerable,Be=(t,e,o)=>e in t?ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Ue=(t,e)=>{for(var o in e||(e={}))cr.call(e,o)&&Be(t,o,e[o]);if(Et)for(var o of Et(e))pr.call(e,o)&&Be(t,o,e[o]);return t},hr=(t,e)=>sr(t,ur(e)),ee=(t,e,o)=>(Be(t,typeof e!="symbol"?e+"":e,o),o),te=(t,e,o)=>new Promise((r,a)=>{var l=n=>{try{s(o.next(n))}catch(u){a(u)}},i=n=>{try{s(o.throw(n))}catch(u){a(u)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(l,i);s((o=o.apply(t,e)).next())});const xt={POINT:"POINT",COUNTRY:"COUNTRY"};class Pt extends h.Map{constructor(e){var o,r,a;e.apiKey&&(j.apiKey=e.apiKey);const l=ht(e.style),i=location.hash;j.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!");let s={compact:!1};e.customAttribution?s.customAttribution=e.customAttribution:e.attributionControl&&typeof e.attributionControl=="object"&&(s=Ue(Ue({},s),e.attributionControl)),super(hr(Ue({},e),{style:l,maplibreLogo:!1,transformRequest:ct(e.transformRequest),attributionControl:e.forceNoAttributionControl===!0?!1:s})),ee(this,"isTerrainEnabled",!1),ee(this,"terrainExaggeration",1),ee(this,"primaryLanguage"),ee(this,"terrainGrowing",!1),ee(this,"terrainFlattening",!1),ee(this,"minimap"),ee(this,"forceLanguageUpdate"),ee(this,"languageAlwaysBeenStyle"),ee(this,"isReady",!1),j.caching&&$o(),this.primaryLanguage=(o=e.language)!=null?o:j.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",()=>te(this,null,function*(){if(!e.geolocate||e.center||e.hash&&i)return;try{if(e.geolocate===xt.COUNTRY){yield this.fitToIpBounds();return}}catch(m){console.warn(m.message)}let v;try{yield this.centerOnIpPoint(e.zoom),v=this.getCameraHash()}catch(m){console.warn(m.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(m=>{v===this.getCameraHash()&&(this.terrain?this.easeTo({center:[m.coords.longitude,m.coords.latitude],zoom:e.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[m.coords.longitude,m.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",()=>te(this,null,function*(){Bo()})),this.once("load",()=>te(this,null,function*(){let v={logo:null};try{const m=Object.keys(this.style.sourceCaches).map(g=>this.getSource(g)).filter(g=>g&&"url"in g&&typeof g.url=="string"&&g?.url.includes("tiles.json")),T=new URL(m[0].url);T.searchParams.has("key")||T.searchParams.append("key",j.apiKey),v=yield(yield fetch(T.href)).json()}catch{}if(e.forceNoAttributionControl!==!0)if("logo"in v&&v.logo){const m=v.logo;this.addControl(new Ee({logoURL:m}),e.logoPosition)}else e.maptilerLogo&&this.addControl(new Ee,e.logoPosition);if(e.scaleControl){const m=e.scaleControl===!0||e.scaleControl===void 0?"bottom-right":e.scaleControl,T=new wt({unit:j.unit});this.addControl(T,m),j.on("unit",g=>{T.setUnit(g)})}if(e.navigationControl!==!1){const m=e.navigationControl===!0||e.navigationControl===void 0?"top-right":e.navigationControl;this.addControl(new gt,m)}if(e.geolocateControl!==!1){const m=e.geolocateControl===!0||e.geolocateControl===void 0?"top-right":e.geolocateControl;this.addControl(new At({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),m)}if(e.terrainControl){const m=e.terrainControl===!0||e.terrainControl===void 0?"top-right":e.terrainControl;this.addControl(new mt,m)}if(e.fullscreenControl){const m=e.fullscreenControl===!0||e.fullscreenControl===void 0?"top-right":e.fullscreenControl;this.addControl(new bt({}),m)}this.isReady=!0,this.fire("ready",{target:this})}));let n=!1,u=!1,c;this.once("ready",()=>{n=!0,u&&this.fire("loadWithTerrain",c)}),this.once("style.load",()=>{var v;const{minimap:m}=e;if(typeof m=="object"){const{zoom:T,center:g,style:k,language:M,apiKey:R,maptilerLogo:z,antialias:F,refreshExpiredTiles:_,maxBounds:E,scrollZoom:I,minZoom:A,maxZoom:C,boxZoom:w,locale:B,fadeDuration:f,crossSourceCollisions:b,clickTolerance:O,bounds:N,fitBoundsOptions:$,pixelRatio:D,validateStyle:H}=e;this.minimap=new ze(m,{zoom:T,center:g,style:k,language:M,apiKey:R,container:"null",maptilerLogo:z,antialias:F,refreshExpiredTiles:_,maxBounds:E,scrollZoom:I,minZoom:A,maxZoom:C,boxZoom:w,locale:B,fadeDuration:f,crossSourceCollisions:b,clickTolerance:O,bounds:N,fitBoundsOptions:$,pixelRatio:D,validateStyle:H}),this.addControl(this.minimap,(v=m.position)!=null?v:"bottom-left")}else m===!0?(this.minimap=new ze({},e),this.addControl(this.minimap,"bottom-left")):m!==void 0&&m!==!1&&(this.minimap=new ze({},e),this.addControl(this.minimap,m))});const p=v=>{v.terrain&&(u=!0,c={type:"loadWithTerrain",target:this,terrain:v.terrain},this.off("terrain",p),n&&this.fire("loadWithTerrain",c))};this.on("terrain",p),e.terrain&&this.enableTerrain((a=e.terrainExaggeration)!=null?a:this.terrainExaggeration)}onLoadAsync(){return te(this,null,function*(){return new Promise(e=>{if(this.loaded())return e(this);this.once("load",()=>{e(this)})})})}onReadyAsync(){return te(this,null,function*(){return new Promise(e=>{if(this.isReady)return e(this);this.once("ready",()=>{e(this)})})})}onLoadWithTerrainAsync(){return te(this,null,function*(){return new Promise(e=>{if(this.isReady&&this.terrain)return e(this);this.once("loadWithTerrain",()=>{e(this)})})})}setStyle(e,o){var r;return(r=this.minimap)==null||r.setStyle(e),this.forceLanguageUpdate=!0,this.once("idle",()=>{this.forceLanguageUpdate=!1}),super.setStyle(ht(e),o)}addLayer(e,o){var r;return(r=this.minimap)==null||r.addLayer(e,o),super.addLayer(e,o)}moveLayer(e,o){var r;return(r=this.minimap)==null||r.moveLayer(e,o),super.moveLayer(e,o)}removeLayer(e){var o;return(o=this.minimap)==null||o.removeLayer(e),super.removeLayer(e)}setLayerZoomRange(e,o,r){var a;return(a=this.minimap)==null||a.setLayerZoomRange(e,o,r),super.setLayerZoomRange(e,o,r)}setFilter(e,o,r){var a;return(a=this.minimap)==null||a.setFilter(e,o,r),super.setFilter(e,o,r)}setPaintProperty(e,o,r,a){var l;return(l=this.minimap)==null||l.setPaintProperty(e,o,r,a),super.setPaintProperty(e,o,r,a)}setLayoutProperty(e,o,r,a){var l;return(l=this.minimap)==null||l.setLayoutProperty(e,o,r,a),super.setLayoutProperty(e,o,r,a)}setGlyphs(e,o){var r;return(r=this.minimap)==null||r.setGlyphs(e,o),super.setGlyphs(e,o)}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 o,r;(r=(o=this.minimap)==null?void 0:o.map)==null||r.setLanguage(e),this.onStyleReady(()=>{this.setPrimaryLanguage(e)})}setPrimaryLanguage(e){const o=this.getStyleLanguage();if(!(e===S.STYLE&&(o===S.AUTO||o===S.VISITOR))&&(e!==S.STYLE&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===e&&!this.forceLanguageUpdate))return;if(!Ie(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(!o){console.warn("The style has no default languages.");return}if(!Ie(o)){console.warn("The language defined in the style is not valid.");return}r=o}let a=S.LOCAL,l=`{${a}}`;r==S.VISITOR?(a=Re(),l=["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,l=["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=Re(),l=["case",["has",a],["get",a],["get",S.LOCAL]]):r===S.LOCAL?(a=S.LOCAL,l=`{${a}}`):(a=r,l=["case",["has",a],["get",a],["get",S.LOCAL]]);const{layers:i}=this.getStyle();for(const s of i){if(s.type!=="symbol")continue;const n=s,u=this.getSource(n.source);if(!u||!("url"in u&&typeof u.url=="string")||new URL(u.url).host!==V.maptilerApiHost)continue;const{id:c,layout:p}=n;if(!p||!("text-field"in p))continue;const v=this.getLayoutProperty(c,"text-field");typeof v=="string"&&(v.toLowerCase().includes("ref")||v.toLowerCase().includes("housenumber"))||this.setLayoutProperty(c,"text-field",l)}}getPrimaryLanguage(){return this.primaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(e,o=1e3){if(!this.terrain)return;const r=performance.now(),a=this.terrain.exaggeration,l=e-a,i=()=>{if(!this.terrain||this.terrainFlattening)return;const s=(performance.now()-r)/o;if(s<.99){const n=1-Math.pow(1-s,4),u=a+n*l;this.terrain.exaggeration=u,requestAnimationFrame(i)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=e;this.triggerRepaint()};this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(i)}enableTerrain(e=this.terrainExaggeration){if(e<0){console.warn("Terrain exaggeration cannot be negative.");return}const o=a=>te(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",o),this.growTerrain(e))}),r=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=e,this.on("data",o),this.addSource(V.terrainSourceId,{type:"raster-dem",url:V.terrainSourceURL}),this.setTerrain({source:V.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(V.terrainSourceId)||r()})}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const e=1*1e3,o=performance.now(),r=this.terrain.exaggeration,a=()=>{if(!this.terrain||this.terrainGrowing)return;const l=(performance.now()-o)/e;if(l<.99){const i=Math.pow(1-l,4),s=r*i;this.terrain.exaggeration=s,requestAnimationFrame(a)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(V.terrainSourceId)&&this.removeSource(V.terrainSourceId);this.triggerRepaint()};this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(a)}setTerrainExaggeration(e,o=!0){!o&&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 te(this,null,function*(){const e=yield Xe.info();this.fitBounds(e.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(e){return te(this,null,function*(){var o,r;const a=yield Xe.info();this.jumpTo({center:[(o=a?.longitude)!=null?o:0,(r=a?.latitude)!=null?r:0],zoom:e||11})})}getCameraHash(){const e=new Float32Array(5),o=this.getCenter();return e[0]=o.lng,e[1]=o.lat,e[2]=this.getZoom(),e[3]=this.getPitch(),e[4]=this.getBearing(),Xt.fromUint8Array(new Uint8Array(e.buffer))}getSdkConfig(){return j}getMaptilerSessionId(){return Qe}setTransformRequest(e){return super.setTransformRequest(ct(e)),this}}class mr extends h.Marker{addTo(e){return super.addTo(e)}}class dr extends h.Popup{addTo(e){return super.addTo(e)}}class gr extends h.Style{constructor(e,o={}){super(e,o)}}class vr extends h.CanvasSource{onAdd(e){super.onAdd(e)}}class yr extends h.GeoJSONSource{onAdd(e){super.onAdd(e)}}class fr extends h.ImageSource{onAdd(e){super.onAdd(e)}}class Lr extends h.RasterTileSource{onAdd(e){super.onAdd(e)}}class Ar extends h.RasterDEMTileSource{onAdd(e){super.onAdd(e)}}class wr extends h.VectorTileSource{onAdd(e){super.onAdd(e)}}class br extends h.VideoSource{onAdd(e){super.onAdd(e)}}class Sr extends h.AttributionControl{onAdd(e){return super.onAdd(e)}}class Cr extends h.TerrainControl{onAdd(e){return super.onAdd(e)}}class Tr extends h.BoxZoomHandler{constructor(e,o){super(e,o)}}class Ir extends h.ScrollZoomHandler{constructor(e,o){super(e,o)}}class Rr extends h.CooperativeGesturesHandler{constructor(e,o){super(e,o)}}class Er extends h.KeyboardHandler{constructor(e){super(e)}}class xr extends h.TwoFingersTouchPitchHandler{constructor(e){super(e)}}class Pr extends h.MapWheelEvent{constructor(e,o,r){super(e,o,r)}}class Or extends h.MapTouchEvent{constructor(e,o,r){super(e,o,r)}}class _r extends h.MapMouseEvent{constructor(e,o,r,a={}){super(e,o,r,a)}}var Nr=Object.defineProperty,Ot=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,_t=(t,e,o)=>e in t?Nr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ne=(t,e)=>{for(var o in e||(e={}))Mr.call(e,o)&&_t(t,o,e[o]);if(Ot)for(var o of Ot(e))$r.call(e,o)&&_t(t,o,e[o]);return t};function Le(t){if(typeof DOMParser<"u"){const e=new DOMParser().parseFromString(t,"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 He(t,e){if(!t.hasChildNodes())return!1;for(const o of Array.from(t.childNodes)){const r=o.nodeName;if(typeof r=="string"&&r.trim().toLowerCase()===e.toLowerCase())return!0}return!1}function je(t){if(typeof XMLSerializer<"u")return new XMLSerializer().serializeToString(t);throw new Error("No XML serializer found")}function De(t){if(typeof t=="string"&&(t=Le(t)),!He(t,"gpx"))throw new Error("The XML document is not valid GPX");const e=U(t,"trk"),o=U(t,"rte"),r=U(t,"wpt"),a={type:"FeatureCollection",features:[]};for(const l of Array.from(e)){const i=Br(l);i&&a.features.push(i)}for(const l of Array.from(o)){const i=Ur(l);i&&a.features.push(i)}for(const l of Array.from(r))a.features.push(Hr(l));return a}function Ge(t,e){var o;if(typeof t=="string"&&(t=Le(t)),!He(t,"kml"))throw new Error("The XML document is not valid KML");const r={type:"FeatureCollection",features:[]},a={},l={},i={},s=U(t,"Placemark"),n=U(t,"Style"),u=U(t,"StyleMap");for(const c of Array.from(n)){const p=kt(e!==void 0?e(c):je(c)).toString(16);a["#"+ie(c,"id")]=p,l[p]=c}for(const c of Array.from(u)){a["#"+ie(c,"id")]=kt(e!==void 0?e(c):je(c)).toString(16);const p=U(c,"Pair"),v={};for(const m of Array.from(p))v[(o=x(y(m,"key")))!=null?o:""]=x(y(m,"styleUrl"));i["#"+ie(c,"id")]=v}for(const c of Array.from(s))r.features=r.features.concat(zr(c,a,l,i));return r}function Nt(t){if(t===null)return["#000000",1];let e="",o=1;return t.substring(0,1)==="#"&&(t=t.substring(1)),(t.length===6||t.length===3)&&(e=t),t.length===8&&(o=parseInt(t.substring(0,2),16)/255,e="#"+t.substring(6,8)+t.substring(4,6)+t.substring(2,4)),[e??"#000000",o??1]}function kr(t){return zt(t.split(" "))}function Fr(t){var e;let o=U(t,"coord");const r=[],a=[];o.length===0&&(o=U(t,"gx:coord"));for(const i of Array.from(o))r.push(kr((e=x(i))!=null?e:""));const l=U(t,"when");for(const i of Array.from(l))a.push(x(i));return{coords:r,times:a}}function Ae(t){var e,o,r;const a=["Polygon","LineString","Point","Track","gx:Track"];let l,i,s,n,u;const c=[],p=[];if(y(t,"MultiGeometry")!==null)return Ae(y(t,"MultiGeometry"));if(y(t,"MultiTrack")!==null)return Ae(y(t,"MultiTrack"));if(y(t,"gx:MultiTrack")!==null)return Ae(y(t,"gx:MultiTrack"));for(s=0;s<a.length;s++)if(i=U(t,a[s]),i){for(n=0;n<i.length;n++)if(l=i[n],a[s]==="Point")c.push({type:"Point",coordinates:Bt((e=x(y(l,"coordinates")))!=null?e:"")});else if(a[s]==="LineString")c.push({type:"LineString",coordinates:Ut((o=x(y(l,"coordinates")))!=null?o:"")});else if(a[s]==="Polygon"){const v=U(l,"LinearRing"),m=[];for(u=0;u<v.length;u++)m.push(Ut((r=x(y(v[u],"coordinates")))!=null?r:""));c.push({type:"Polygon",coordinates:m})}else if(a[s]==="Track"||a[s]==="gx:Track"){const v=Fr(l);c.push({type:"LineString",coordinates:v.coords}),v.times.length&&p.push(v.times)}}return{geoms:c,coordTimes:p}}function zr(t,e,o,r){var a,l,i,s,n,u,c,p,v,m;const T=Ae(t),g={},k=x(y(t,"name")),M=x(y(t,"address")),R=x(y(t,"description")),z=y(t,"TimeSpan"),F=y(t,"TimeStamp"),_=y(t,"ExtendedData"),E=y(t,"visibility");let I,A=x(y(t,"styleUrl")),C=y(t,"LineStyle"),w=y(t,"PolyStyle");if(!T.geoms.length)return[];if(k&&(g.name=k),M&&(g.address=M),A){A[0]!=="#"&&(A="#"+A),g.styleUrl=A,e[A]&&(g.styleHash=e[A]),r[A]&&(g.styleMapHash=r[A],g.styleHash=e[(a=r[A].normal)!=null?a:""]);const f=o[(l=g.styleHash)!=null?l:""];if(f){C||(C=y(f,"LineStyle")),w||(w=y(f,"PolyStyle"));const b=y(f,"IconStyle");if(b){const O=y(b,"Icon");if(O){const N=x(y(O,"href"));N&&(g.icon=N)}}}}if(R&&(g.description=R),z){const f=x(y(z,"begin")),b=x(y(z,"end"));f&&b&&(g.timespan={begin:f,end:b})}if(F!==null&&(g.timestamp=(i=x(y(F,"when")))!=null?i:new Date().toISOString()),C!==null){const f=Nt(x(y(C,"color"))),b=f[0],O=f[1],N=parseFloat((s=x(y(C,"width")))!=null?s:"");b&&(g.stroke=b),isNaN(O)||(g["stroke-opacity"]=O),isNaN(N)||(g["stroke-width"]=N)}if(w){const f=Nt(x(y(w,"color"))),b=f[0],O=f[1],N=x(y(w,"fill")),$=x(y(w,"outline"));b&&(g.fill=b),isNaN(O)||(g["fill-opacity"]=O),N&&(g["fill-opacity"]=N==="1"?g["fill-opacity"]||1:0),$&&(g["stroke-opacity"]=$==="1"?g["stroke-opacity"]||1:0)}if(_){const f=U(_,"Data"),b=U(_,"SimpleData");for(I=0;I<f.length;I++)g[(n=f[I].getAttribute("name"))!=null?n:""]=(u=x(y(f[I],"value")))!=null?u:"";for(I=0;I<b.length;I++)g[(c=b[I].getAttribute("name"))!=null?c:""]=(p=x(b[I]))!=null?p:""}E!==null&&(g.visibility=(v=x(E))!=null?v:""),T.coordTimes.length!==0&&(g.coordTimes=T.coordTimes.length===1?T.coordTimes[0]:T.coordTimes);const B={type:"Feature",geometry:T.geoms.length===1?T.geoms[0]:{type:"GeometryCollection",geometries:T.geoms},properties:g};return ie(t,"id")&&(B.id=(m=ie(t,"id"))!=null?m:void 0),[B]}function Mt(t,e){const o=U(t,e),r=[],a=[];let l=[];const i=o.length;if(!(i<2)){for(let s=0;s<i;s++){const n=Ht(o[s]);r.push(n.coordinates),n.time&&a.push(n.time),(n.heartRate||l.length)&&(l.length===0&&(l=new Array(s).fill(null)),l.push(n.heartRate))}return{line:r,times:a,heartRates:l}}}function Br(t){const e=U(t,"trkseg"),o=[],r=[],a=[];let l;for(let s=0;s<e.length;s++)if(l=Mt(e[s],"trkpt"),l!==void 0&&(l.line&&o.push(l.line),l.times&&l.times.length&&r.push(l.times),a.length||l.heartRates&&l.heartRates.length)){if(!a.length)for(let n=0;n<s;n++)a.push(new Array(o[n].length).fill(null));l.heartRates&&l.heartRates.length?a.push(l.heartRates):a.push(new Array(l.line.length).fill(null))}if(o.length===0)return;const i=ne(ne({},Ve(t)),$t(y(t,"extensions")));return r.length!==0&&(i.coordTimes=o.length===1?r[0]:r),a.length!==0&&(i.heartRates=o.length===1?a[0]:a),o.length===1?{type:"Feature",properties:i,geometry:{type:"LineString",coordinates:o[0]}}:{type:"Feature",properties:i,geometry:{type:"MultiLineString",coordinates:o}}}function Ur(t){const e=Mt(t,"rtept");return e===void 0?void 0:{type:"Feature",properties:ne(ne({},Ve(t)),$t(y(t,"extensions"))),geometry:{type:"LineString",coordinates:e.line}}}function Hr(t){return{type:"Feature",properties:ne(ne({},Ve(t)),We(t,["sym"])),geometry:{type:"Point",coordinates:Ht(t).coordinates}}}function $t(t){var e,o;const r={};if(t){const a=y(t,"line");if(a){const l=x(y(a,"color")),i=parseFloat((e=x(y(a,"opacity")))!=null?e:"0"),s=parseFloat((o=x(y(a,"width")))!=null?o:"0");l&&(r.stroke=l),isNaN(i)||(r["stroke-opacity"]=i),isNaN(s)||(r["stroke-width"]=s*96/25.4)}}return r}function Ve(t){const e=We(t,["name","cmt","desc","type","time","keywords"]),o=U(t,"link");if(o.length!==0){e.links=[];for(const r of Array.from(o)){const a=ne({href:ie(r,"href")},We(r,["text","type"]));e.links.push(a)}}return e}function kt(t){let e=0;if(!t||!t.length)return e;for(let o=0;o<t.length;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return e}function U(t,e){return t.getElementsByTagName(e)}function ie(t,e){return t.getAttribute(e)}function Ft(t,e){var o;return parseFloat((o=ie(t,e))!=null?o:"0")}function y(t,e){const o=U(t,e);return o.length?o[0]:null}function jr(t){return t.normalize&&t.normalize(),t}function zt(t){return t.map(parseFloat).map(e=>isNaN(e)?null:e)}function x(t){return t&&jr(t),t&&t.textContent}function We(t,e){var o;const r={};let a,l;for(l=0;l<e.length;l++)a=y(t,e[l]),a&&(r[e[l]]=(o=x(a))!=null?o:"");return r}function Bt(t){return zt(t.replace(/\s*/g,"").split(","))}function Ut(t){const e=t.replace(/^\s*|\s*$/g,"").split(/\s+/),o=[];for(const r of e)o.push(Bt(r));return o}function Ht(t){var e,o;const r=[Ft(t,"lon"),Ft(t,"lat")],a=y(t,"ele"),l=y(t,"gpxtpx:hr")||y(t,"hr"),i=y(t,"time");let s;return a&&(s=parseFloat((e=x(a))!=null?e:"0"),isNaN(s)||r.push(s)),{coordinates:r,time:i?x(i):null,heartRate:l!==null?parseFloat((o=x(l))!=null?o:"0"):null}}function jt(t){try{typeof t=="string"&&(t=Le(t))}catch{return null}try{return De(t)}catch{}try{return Ge(t)}catch{}return null}var Dr=Object.defineProperty,Gr=(t,e,o)=>e in t?Dr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Dt=(t,e,o)=>(Gr(t,typeof e!="symbol"?e+"":e,o),o);function we(t){const e=t.toString(16);return e.length==1?"0"+e:e}function Vr(t){return"#"+we(t[0])+we(t[1])+we(t[2])+(t.length===4?we(t[3]):"")}class d extends Array{constructor(e={}){super(),Dt(this,"min",0),Dt(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 d({stops:e.map(o=>({value:o[0],color:o[1]}))})}setStops(e,o={clone:!0}){const r=o.clone?this.clone():this;r.length=0;let a=1/0,l=-1/0;for(let i=0;i<e.length;i+=1)a=Math.min(a,e[i].value),l=Math.max(l,e[i].value),r.push({value:e[i].value,color:e[i].color.slice()});return r.sort((i,s)=>i.value<s.value?-1:1),this.min=a,this.max=l,r}scale(e,o,r={clone:!0}){const a=r.clone,l=this[0].value,i=this.at(-1).value-l,s=o-e,n=[];for(let u=0;u<this.length;u+=1){const c=(this[u].value-l)/i*s+e;a?n.push({value:c,color:this[u].color.slice()}):this[u].value=c}return a?new d({stops:n}):this}at(e){return e<0?this[this.length+e]:this[e]}clone(){return new d({stops:this.getRawColorStops()})}getRawColorStops(){const e=[];for(let o=0;o<this.length;o+=1)e.push({value:this[o].value,color:this[o].color});return e}reverse(e={clone:!0}){const o=e.clone?this.clone():this;for(let r=0;r<~~(o.length/2);r+=1){const a=o[r].color;o[r].color=o.at(-(r+1)).color,o.at(-(r+1)).color=a}return o}getBounds(){return{min:this.min,max:this.max}}getColor(e,o={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(!o.smooth)return a.slice();const l=this[r].value,i=this[r+1].value,s=this[r+1].color,n=(i-e)/(i-l);return a.map((u,c)=>Math.round(u*n+s[c]*(1-n)))}return[0,0,0]}getColorHex(e,o={smooth:!0,withAlpha:!1}){return Vr(this.getColor(e,o))}getColorRelative(e,o={smooth:!0}){const r=this.getBounds();return this.getColor(r.min+e*(r.max-r.min),o)}getCanvasStrip(e={horizontal:!0,size:512,smooth:!0}){const o=document.createElement("canvas");o.width=e.horizontal?e.size:1,o.height=e.horizontal?1:e.size;const r=o.getContext("2d");if(!r)throw new Error("Canvs context is missing");const a=r.getImageData(0,0,o.width,o.height),l=a.data,i=e.size,s=this[0].value,n=(this.at(-1).value-s)/i;for(let u=0;u<i;u+=1){const c=this.getColor(s+u*n,{smooth:e.smooth});l[u*4]=c[0],l[u*4+1]=c[1],l[u*4+2]=c[2],l[u*4+3]=c.length>3?c[3]:255}return r.putImageData(a,0,0),o}resample(e,o=15){const r=this.getBounds(),a=this.scale(0,1),l=1/(o-1);let i;if(e==="ease-in-square")i=Array.from({length:o},(s,n)=>{const u=n*l,c=Math.pow(u,2),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-out-square")i=Array.from({length:o},(s,n)=>{const u=n*l,c=1-Math.pow(1-u,2),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-out-sqrt")i=Array.from({length:o},(s,n)=>{const u=n*l,c=Math.pow(u,.5),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-in-sqrt")i=Array.from({length:o},(s,n)=>{const u=n*l,c=1-Math.pow(1-u,.5),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-out-exp")i=Array.from({length:o},(s,n)=>{const u=n*l,c=1-Math.pow(2,-10*u),p=a.getColor(c);return{value:u,color:p}});else if(e==="ease-in-exp")i=Array.from({length:o},(s,n)=>{const u=n*l,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 d({stops:i}).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(o=>{o.color.length===3&&o.color.push(255)}),e[0].color[3]=0,new d({stops:e})}hasTransparentStart(){return this[0].color.length===4&&this[0].color[3]===0}}const Ze={NULL:new d({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),GRAY:new d({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),JET:new d({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 d({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 d({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 d({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),SUMMER:new d({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),AUTOMN:new d({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),WINTER:new d({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),BONE:new d({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 d({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),GREYS:new d({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),YIGNBU:new d({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 d({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 d({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 d({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),RDBU:new d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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 d({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]}]})},Gt=[["#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 Ke(){return Gt[~~(Math.random()*Gt.length)][~~(Math.random()*4)]}function be(){return`maptiler_source_${pt()}`}function Se(){return`maptiler_layer_${pt()}`}function Vt(t,e){if(e<=t[0].zoom)return t[0].value;if(e>=t[t.length-1].zoom)return t[t.length-1].value;for(let o=0;o<t.length-1;o+=1)if(e>=t[o].zoom&&e<t[o+1].zoom){const r=t[o+1].zoom-t[o].zoom,a=(e-t[o].zoom)/r;return a*t[o+1].value+(1-a)*t[o].value}return 0}function se(t){return["interpolate",["linear"],["zoom"],...t.map(e=>[e.zoom,e.value]).flat()]}function P(t){return["interpolate",["linear"],["zoom"],...t.map(e=>[e.zoom,e.value]).flat()]}function Wr(t,e){if(typeof e=="number"&&typeof t=="number")return 2*e+t;if(typeof e=="number"&&Array.isArray(t))return["interpolate",["linear"],["zoom"],...t.map(o=>[o.zoom,2*e+o.value]).flat()];if(typeof t=="number"&&Array.isArray(e))return["interpolate",["linear"],["zoom"],...e.map(o=>[o.zoom,2*o.value+t]).flat()];if(Array.isArray(t)&&Array.isArray(e)){const o=Array.from(new Set([...t.map(r=>r.zoom),...e.map(r=>r.zoom)])).sort((r,a)=>r<a?-1:1);return["interpolate",["linear"],["zoom"],...o.map(r=>[r,2*Vt(e,r)+Vt(t,r)]).flat()]}return 0}function Zr(t,e){return["interpolate",["linear"],["get",e],...t.map(o=>[o.propertyValue,o.value]).flat()]}function Wt(t){const e=t.trimStart(),o=`${e}${" ".repeat(t.length-e.length)}`,r=Array.from(o);if(!r.every(l=>l===" "||l==="_"))throw new Error("A dash pattern must be composed only of whitespace and underscore characters.");if(!(r.some(l=>l==="_")&&r.some(l=>l===" ")))throw new Error("A dash pattern must contain at least one underscore and one whitespace character");const a=[1];for(let l=1;l<r.length;l+=1){const i=r[l-1],s=r[l];i===s?a[a.length-1]+=1:a.push(1)}return a}function Zt(t,e){return["interpolate",["linear"],["get",e],...t.map(o=>[o.value,o.color]).flat()]}function Kt(t,e,o=!0){return o?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius*.025]).flat()],2,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius*.05]).flat()],4,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius*.1]).flat()],8,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius*.25]).flat()],16,["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius]).flat()]]:["interpolate",["linear"],["get",e],...t.map(r=>[r.value,r.pointRadius]).flat()]}function Kr(t,e,o=!0){return o?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value*.025]).flat()],2,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value*.05]).flat()],4,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value*.1]).flat()],8,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value*.25]).flat()],16,["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value]).flat()]]:["interpolate",["linear"],["get",e],...t.map(r=>[r.propertyValue,r.value]).flat()]}function Yt(t,e){return t.every(o=>o.color[3]===t[0].color[3])?t[0].color[3]?t[0].color[3]/255:1:["interpolate",["linear"],["get",e],...t.getRawColorStops().map(o=>{const r=o.value,a=o.color;return[r,a.length===4?a[3]/255:1]}).flat()]}function Yr(t,e=10){return["interpolate",["linear"],["heatmap-density"],...Array.from({length:e+1},(o,r)=>{const a=r/e;return[a,t.getColorHex(a)]}).flat()]}var qr=Object.defineProperty,Jr=Object.defineProperties,Xr=Object.getOwnPropertyDescriptors,qt=Object.getOwnPropertySymbols,Qr=Object.prototype.hasOwnProperty,ea=Object.prototype.propertyIsEnumerable,Jt=(t,e,o)=>e in t?qr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ue=(t,e)=>{for(var o in e||(e={}))Qr.call(e,o)&&Jt(t,o,e[o]);if(qt)for(var o of qt(e))ea.call(e,o)&&Jt(t,o,e[o]);return t},ta=(t,e)=>Jr(t,Xr(e)),oa=(t,e,o)=>new Promise((r,a)=>{var l=n=>{try{s(o.next(n))}catch(u){a(u)}},i=n=>{try{s(o.throw(n))}catch(u){a(u)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(l,i);s((o=o.apply(t,e)).next())});function ra(t,e){return oa(this,arguments,function*(o,r,a={}){var l,i,s;if(!r.sourceId&&!r.data)throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");let n=r.data;if(typeof n=="string"){if(ve(n))n=`https://api.maptiler.com/data/${r.data}/features.json?key=${j.apiKey}`;else if(((l=n.split(".").pop())==null?void 0:l.toLowerCase().trim())==="gpx"){const u=yield(yield fetch(n,a)).text();n=De(u)}else if(((i=n.split(".").pop())==null?void 0:i.toLowerCase().trim())==="kml"){const u=yield(yield fetch(n,a)).text();n=Ge(u)}else{const u=(s=Ho(n))!=null?s:jt(n);u&&(n=u)}if(!n)throw new Error("Polyline data was provided as string but is incompatible with valid formats.")}return aa(o,ta(ue({},r),{data:n}))})}function aa(t,e){var o,r,a,l,i,s,n,u,c,p,v,m,T,g,k,M,R,z,F,_;if(e.layerId&&t.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const E=(o=e.sourceId)!=null?o:be(),I=(r=e.layerId)!=null?r:Se(),A={polylineLayerId:I,polylineOutlineLayerId:"",polylineSourceId:E};e.data&&!t.getSource(E)&&t.addSource(E,{type:"geojson",data:e.data});const C=(a=e.lineWidth)!=null?a:3,w=(l=e.lineColor)!=null?l:Ke(),B=(i=e.lineOpacity)!=null?i:1,f=(s=e.lineBlur)!=null?s:0,b=(n=e.lineGapWidth)!=null?n:0;let O=(u=e.lineDashArray)!=null?u:null;const N=(c=e.outlineWidth)!=null?c:1,$=(p=e.outlineColor)!=null?p:"#FFFFFF",D=(v=e.outlineOpacity)!=null?v:1,H=(m=e.outlineBlur)!=null?m:0;if(typeof O=="string"&&(O=Wt(O)),e.outline===!0){const J=`${I}_outline`;A.polylineOutlineLayerId=J,t.addLayer({id:J,type:"line",source:E,layout:{"line-join":(T=e.lineJoin)!=null?T:"round","line-cap":(g=e.lineCap)!=null?g:"round"},minzoom:(k=e.minzoom)!=null?k:0,maxzoom:(M=e.maxzoom)!=null?M:23,paint:{"line-opacity":typeof D=="number"?D:P(D),"line-color":typeof $=="string"?$:se($),"line-width":Wr(C,N),"line-blur":typeof H=="number"?H:P(H)}},e.beforeId)}return t.addLayer({id:I,type:"line",source:E,layout:{"line-join":(R=e.lineJoin)!=null?R:"round","line-cap":(z=e.lineCap)!=null?z:"round"},minzoom:(F=e.minzoom)!=null?F:0,maxzoom:(_=e.maxzoom)!=null?_:23,paint:ue({"line-opacity":typeof B=="number"?B:P(B),"line-color":typeof w=="string"?w:se(w),"line-width":typeof C=="number"?C:P(C),"line-blur":typeof f=="number"?f:P(f),"line-gap-width":typeof b=="number"?b:P(b)},O&&{"line-dasharray":O})},e.beforeId),A}function la(t,e){var o,r,a,l,i,s,n,u,c,p,v;if(e.layerId&&t.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const m=(o=e.sourceId)!=null?o:be(),T=(r=e.layerId)!=null?r:Se(),g={polygonLayerId:T,polygonOutlineLayerId:e.outline?`${T}_outline`:"",polygonSourceId:m};if(e.data&&!t.getSource(m)){let w=e.data;typeof w=="string"&&ve(w)&&(w=`https://api.maptiler.com/data/${w}/features.json?key=${j.apiKey}`),t.addSource(m,{type:"geojson",data:w})}let k=(a=e.outlineDashArray)!=null?a:null;const M=(l=e.outlineWidth)!=null?l:1,R=(i=e.outlineColor)!=null?i:"#FFFFFF",z=(s=e.outlineOpacity)!=null?s:1,F=(n=e.outlineBlur)!=null?n:0,_=(u=e.fillColor)!=null?u:Ke(),E=(c=e.fillOpacity)!=null?c:1,I=(p=e.outlinePosition)!=null?p:"center",A=(v=e.pattern)!=null?v:null;typeof k=="string"&&(k=Wt(k));const C=(w=null)=>{var B,f,b,O,N,$;if(t.addLayer({id:T,type:"fill",source:m,minzoom:(B=e.minzoom)!=null?B:0,maxzoom:(f=e.maxzoom)!=null?f:23,paint:ue({"fill-color":typeof _=="string"?_:se(_),"fill-opacity":typeof E=="number"?E:P(E)},w&&{"fill-pattern":w})},e.beforeId),e.outline===!0){let D;I==="inside"?typeof M=="number"?D=.5*M:D=P(M.map(({zoom:H,value:J})=>({zoom:H,value:.5*J}))):I==="outside"?typeof M=="number"?D=-.5*M:D=P(M.map(H=>({zoom:H.zoom,value:-.5*H.value}))):D=0,t.addLayer({id:g.polygonOutlineLayerId,type:"line",source:m,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:($=e.maxzoom)!=null?$:23,paint:ue({"line-opacity":typeof z=="number"?z:P(z),"line-color":typeof R=="string"?R:se(R),"line-width":typeof M=="number"?M:P(M),"line-blur":typeof F=="number"?F:P(F),"line-offset":D},k&&{"line-dasharray":k})},e.beforeId)}};return A?t.hasImage(A)?C(A):t.loadImage(A).then(w=>{t.addImage(A,w.data),C(A)}).catch(w=>(console.error("Could not load the pattern image.",w.message),C())):C(),g}function na(t,e){var o,r,a,l,i,s,n,u,c,p,v,m,T,g,k,M;if(e.layerId&&t.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const R=(o=e.minPointRadius)!=null?o:10,z=(r=e.maxPointRadius)!=null?r:50,F=(a=e.cluster)!=null?a:!1,_=20,E=Array.isArray(e.pointColor)?e.pointColor:Ze.TURBO.scale(10,e.cluster?1e4:1e3).resample("ease-out-square"),I=E.getBounds(),A=(l=e.sourceId)!=null?l:be(),C=(i=e.layerId)!=null?i:Se(),w=(s=e.showLabel)!=null?s:F,B=(n=e.alignOnViewport)!=null?n:!0,f=(u=e.outline)!=null?u:!1,b=(c=e.outlineOpacity)!=null?c:1,O=(p=e.outlineWidth)!=null?p:1,N=(v=e.outlineColor)!=null?v:"#FFFFFF";let $;const D=(m=e.zoomCompensation)!=null?m:!0,H=(T=e.minzoom)!=null?T:0,J=(g=e.maxzoom)!=null?g:23;typeof e.pointOpacity=="number"?$=e.pointOpacity:Array.isArray(e.pointOpacity)?$=P(e.pointOpacity):e.cluster?$=Yt(E,"point_count"):e.property?$=Yt(E,e.property):$=P([{zoom:H,value:0},{zoom:H+.25,value:1},{zoom:J-.25,value:1},{zoom:J,value:0}]);const re={pointLayerId:C,clusterLayerId:"",labelLayerId:"",pointSourceId:A};if(e.data&&!t.getSource(A)){let G=e.data;typeof G=="string"&&ve(G)&&(G=`https://api.maptiler.com/data/${G}/features.json?key=${j.apiKey}`),t.addSource(A,{type:"geojson",data:G,cluster:F})}if(F){re.clusterLayerId=`${C}_cluster`;const G=Array.from({length:_},(me,de)=>{const Ce=I.min+de*(I.max-I.min)/(_-1);return{value:Ce,pointRadius:R+(z-R)*Math.pow(de/(_-1),.5),color:E.getColorHex(Ce)}});t.addLayer({id:re.clusterLayerId,type:"circle",source:A,filter:["has","point_count"],paint:ue({"circle-color":typeof e.pointColor=="string"?e.pointColor:Zt(G,"point_count"),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?P(e.pointRadius):Kt(G,"point_count",!1),"circle-pitch-alignment":B?"viewport":"map","circle-pitch-scale":"map","circle-opacity":$},f&&{"circle-stroke-opacity":typeof b=="number"?b:P(b),"circle-stroke-width":typeof O=="number"?O:P(O),"circle-stroke-color":typeof N=="string"?N:se(N)}),minzoom:H,maxzoom:J},e.beforeId),t.addLayer({id:re.pointLayerId,type:"circle",source:A,filter:["!",["has","point_count"]],paint:ue({"circle-pitch-alignment":B?"viewport":"map","circle-pitch-scale":"map","circle-color":typeof e.pointColor=="string"?e.pointColor:E.getColorHex(E.getBounds().min),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?P(e.pointRadius):G[0].pointRadius*.75,"circle-opacity":$},f&&{"circle-stroke-opacity":typeof b=="number"?b:P(b),"circle-stroke-width":typeof O=="number"?O:P(O),"circle-stroke-color":typeof N=="string"?N:se(N)}),minzoom:H,maxzoom:J},e.beforeId)}else{let G=typeof e.pointColor=="string"?e.pointColor:Array.isArray(e.pointColor)?e.pointColor.getColorHex(e.pointColor.getBounds().min):Ke(),me=typeof e.pointRadius=="number"?D?P([{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)?P(e.pointRadius):D?P([{zoom:0,value:R*.05},{zoom:2,value:R*.1},{zoom:4,value:R*.2},{zoom:8,value:R*.5},{zoom:16,value:R*1}]):R;if(e.property&&Array.isArray(e.pointColor)){const de=Array.from({length:_},(Ce,qe)=>{const Je=I.min+qe*(I.max-I.min)/(_-1);return{value:Je,pointRadius:typeof e.pointRadius=="number"?e.pointRadius:R+(z-R)*Math.pow(qe/(_-1),.5),color:typeof e.pointColor=="string"?e.pointColor:E.getColorHex(Je)}});G=Zt(de,e.property),me=Kt(de,e.property,D)}t.addLayer({id:re.pointLayerId,type:"circle",source:A,layout:{"circle-sort-key":e.property?["/",1,["get",e.property]]:0},paint:ue({"circle-pitch-alignment":B?"viewport":"map","circle-pitch-scale":"map","circle-color":G,"circle-opacity":$,"circle-radius":me},f&&{"circle-stroke-opacity":typeof b=="number"?b:P(b),"circle-stroke-width":typeof O=="number"?O:P(O),"circle-stroke-color":typeof N=="string"?N:se(N)}),minzoom:H,maxzoom:J},e.beforeId)}if(w!==!1&&(e.cluster||e.property)){re.labelLayerId=`${C}_label`;const G=(k=e.labelColor)!=null?k:"#fff",me=(M=e.labelSize)!=null?M:12;t.addLayer({id:re.labelLayerId,type:"symbol",source:A,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":me,"text-pitch-alignment":B?"viewport":"map","symbol-sort-key":["/",1,["get",e.cluster?"point_count":e.property]]},paint:{"text-color":G,"text-opacity":$},minzoom:H,maxzoom:J},e.beforeId)}return re}function ia(t,e){var o,r,a,l,i,s,n,u,c,p;if(e.layerId&&t.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const v=(o=e.sourceId)!=null?o:be(),m=(r=e.layerId)!=null?r:Se(),T=(a=e.minzoom)!=null?a:0,g=(l=e.maxzoom)!=null?l:23,k=(i=e.zoomCompensation)!=null?i:!0,M=(s=e.opacity)!=null?s:[{zoom:T,value:0},{zoom:T+.25,value:1},{zoom:g-.25,value:1},{zoom:g,value:0}];let R=Array.isArray(e.colorRamp)?e.colorRamp:Ze.TURBO.transparentStart();const z=R.getBounds();(z.min!==0||z.max!==1)&&(R=R.scale(0,1)),R.hasTransparentStart()||(R=R.transparentStart());const F=(n=e.intensity)!=null?n:[{zoom:0,value:.01},{zoom:4,value:.2},{zoom:16,value:1}],_=(u=e.property)!=null?u:null,E=(c=e.weight)!=null?c:1;let I=1;_?typeof E=="number"?(I=E,typeof e.weight=="number"&&console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`")):Array.isArray(E)?I=Zr(E,_):console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"):typeof E=="number"?I=E:Array.isArray(E)&&console.warn("The options `.propertyValueWeights` can only be used when `.property` is provided.");const A=[{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:k?A:10;let w=1;typeof C=="number"?w=C:Array.isArray(C)&&"zoom"in C[0]?w=P(C):_&&Array.isArray(C)&&"propertyValue"in C[0]?w=Kr(C,_,k):!_&&Array.isArray(C)&&"propertyValue"in C[0]?(w=P(A),console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.")):w=P(A);const B={heatmapLayerId:m,heatmapSourceId:v};if(e.data&&!t.getSource(v)){let f=e.data;typeof f=="string"&&ve(f)&&(f=`https://api.maptiler.com/data/${f}/features.json?key=${j.apiKey}`),t.addSource(v,{type:"geojson",data:f})}return t.addLayer({id:m,type:"heatmap",source:v,minzoom:T,maxzoom:g,paint:{"heatmap-weight":I,"heatmap-intensity":typeof F=="number"?F:P(F),"heatmap-color":Yr(R),"heatmap-radius":w,"heatmap-opacity":typeof M=="number"?M:P(M)}}),B}const sa={addPolyline:ra,addPolygon:la,addPoint:na,addHeatmap:ia},{setRTLTextPlugin:ua,getRTLTextPluginStatus:ca,LngLat:pa,LngLatBounds:ha,MercatorCoordinate:ma,Evented:da,AJAXError:ga,prewarm:va,clearPrewarmedResources:ya,addProtocol:Ye,removeProtocol:fa,Hash:La,Point:Aa,config:wa,EdgeInsets:ba,DragRotateHandler:Sa,DragPanHandler:Ca,TwoFingersTouchZoomRotateHandler:Ta,DoubleClickZoomHandler:Ia,TwoFingersTouchZoomHandler:Ra,TwoFingersTouchRotateHandler:Ea,getWorkerCount:xa,setWorkerCount:Pa,getMaxParallelImageRequests:Oa,setMaxParallelImageRequests:_a,getWorkerUrl:Na,setWorkerUrl:Ma,addSourceType:$a,importScriptInWorkers:ka}=h;function Fa(){return So.version}function za(){return h.getVersion()}const Ba=h.Map,Ua=h.Marker,Ha=h.Popup,ja=h.Style,Da=h.CanvasSource,Ga=h.GeoJSONSource,Va=h.ImageSource,Wa=h.RasterTileSource,Za=h.RasterDEMTileSource,Ka=h.VectorTileSource,Ya=h.VideoSource;h.NavigationControl,h.GeolocateControl,h.AttributionControl,h.LogoControl,h.ScaleControl,h.FullscreenControl,h.TerrainControl;const qa=h.BoxZoomHandler,Ja=h.ScrollZoomHandler,Xa=h.CooperativeGesturesHandler,Qa=h.KeyboardHandler,el=h.TwoFingersTouchPitchHandler,tl=h.MapWheelEvent,ol=h.MapTouchEvent,rl=h.MapMouseEvent;export{ga as AJAXError,Sr as AttributionControl,Tr as BoxZoomHandler,qa as BoxZoomHandlerMLGL,vr as CanvasSource,Da as CanvasSourceMLGL,d as ColorRamp,Ze as ColorRampCollection,Rr as CooperativeGesturesHandler,Xa as CooperativeGesturesHandlerMLGL,Ia as DoubleClickZoomHandler,Ca as DragPanHandler,Sa as DragRotateHandler,ba as EdgeInsets,da as Evented,bt as FullscreenControl,yr as GeoJSONSource,Ga as GeoJSONSourceMLGL,vt as GeolocateControl,xt as GeolocationType,La as Hash,fr as ImageSource,Va as ImageSourceMLGL,Er as KeyboardHandler,Qa as KeyboardHandlerMLGL,S as Language,ml as LanguageGeocoding,pa as LngLat,ha as LngLatBounds,tt as LogoControl,Pt as Map,Ba as MapMLGL,_r as MapMouseEvent,rl as MapMouseEventMLGL,dl as MapStyle,gl as MapStyleVariant,Or as MapTouchEvent,ol as MapTouchEventMLGL,Pr as MapWheelEvent,tl as MapWheelEventMLGL,At as MaptilerGeolocateControl,Ee as MaptilerLogoControl,gt as MaptilerNavigationControl,mt as MaptilerTerrainControl,mr as Marker,Ua as MarkerMLGL,ma as MercatorCoordinate,dt as NavigationControl,Aa as Point,dr as Popup,Ha as PopupMLGL,Ar as RasterDEMTileSource,Za as RasterDEMTileSourceMLGL,Lr as RasterTileSource,Wa as RasterTileSourceMLGL,vl as ReferenceMapStyle,wt as ScaleControl,Ir as ScrollZoomHandler,Ja as ScrollZoomHandlerMLGL,et as SdkConfig,yl as ServiceError,gr as Style,ja as StyleMLGL,Cr as TerrainControl,xr as TwoFingersTouchPitchHandler,el as TwoFingersTouchPitchHandlerMLGL,Ea as TwoFingersTouchRotateHandler,Ra as TwoFingersTouchZoomHandler,Ta as TwoFingersTouchZoomRotateHandler,wr as VectorTileSource,Ka as VectorTileSourceMLGL,br as VideoSource,Ya as VideoSourceMLGL,Ye as addProtocol,$a as addSourceType,fl as bufferToPixelDataBrowser,Ll as circumferenceAtLatitude,ya as clearPrewarmedResources,j as config,wa as configMLGL,Al as coordinates,wl as data,bl as elevation,Sl as expandMapStyle,Cl as geocoding,Tl as geolocation,Il as getAutoLanguageGeocoding,Re as getBrowserLanguage,Rl as getBufferToPixelDataParser,za as getMapLibreVersion,Oa as getMaxParallelImageRequests,ca as getRTLTextPluginStatus,El as getTileCache,Fa as getVersion,xa as getWorkerCount,Na as getWorkerUrl,De as gpx,jt as gpxOrKml,He as hasChildNodeWithName,sa as helpers,ka as importScriptInWorkers,Ie as isLanguageSupported,Ge as kml,xl as mapStylePresetList,Pl as math,Ol as misc,va as prewarm,fa as removeProtocol,_a as setMaxParallelImageRequests,ua as setRTLTextPlugin,Pa as setWorkerCount,Ma as setWorkerUrl,_l as staticMaps,Le as str2xml,Nl as styleToStyle,je as xml2str};
1
+ import p from"maplibre-gl";import{Base64 as gt}from"js-base64";import yt from"events";import{config as re,expandMapStyle as vt,MapStyleVariant as ft,ReferenceMapStyle as Lt,MapStyle as At,mapStylePresetList as wt,geolocation as be}from"@maptiler/client";import{LanguageGeocoding as Or,MapStyle as Fr,MapStyleVariant as zr,ReferenceMapStyle as Br,ServiceError as $r,bufferToPixelDataBrowser as Ur,circumferenceAtLatitude as Hr,coordinates as Gr,data as Dr,elevation as Wr,expandMapStyle as jr,geocoding as Vr,geolocation as Kr,getAutoLanguageGeocoding as Zr,getBufferToPixelDataParser as Yr,getTileCache as qr,mapStylePresetList as Jr,math as Xr,misc as Qr,staticMaps as ea,styleToStyle as ta}from"@maptiler/client";import{v4 as Ct}from"uuid";var St="@maptiler/sdk",bt="2.2.0",Tt="The Javascript & TypeScript map SDK tailored for MapTiler Cloud",It="dist/maptiler-sdk.mjs",Rt="dist/maptiler-sdk.d.ts",Et="dist/maptiler-sdk.css",xt="module",_t={".":{import:"./dist/maptiler-sdk.mjs",types:"./dist/maptiler-sdk.d.ts"},"./dist/maptiler-sdk.css":{import:"./dist/maptiler-sdk.css"},"./style.css":{import:"./dist/maptiler-sdk.css"}},Nt=["maptiler","map","sdk","webmap","cloud","webGL","maplibre"],Pt="https://docs.maptiler.com/sdk-js/",Mt="BSD-3-Clause",kt={type:"git",url:"https://github.com/maptiler/maptiler-sdk-js.git"},Ot={build:"rm -rf dist/* && NODE_ENV=production rollup -c",dev:"rm -rf dist/* && NODE_ENV=development rollup -c -w",biome:"biome check --max-diagnostics=1000","biome:fix":"npx @biomejs/biome check --max-diagnostics=1000 --write",doc:"rm -rf docs/* && typedoc --out docs && cp -r images docs/",prepare:"npm run biome:fix && npm run build && npm run test","test:dev":"vitest dev",test:"vitest run"},Ft="MapTiler",zt={"@biomejs/biome":"1.8.3","@rollup/plugin-commonjs":"^26.0.1","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@types/uuid":"^9.0.2","@types/xmldom":"^0.1.31",rollup:"^4.18.0","rollup-plugin-copy-merge":"^1.0.2","rollup-plugin-dts":"^6.1.1","rollup-plugin-esbuild":"^6.1.1","rollup-plugin-node-globals":"^1.4.0","rollup-plugin-shell":"^1.0.9","rollup-plugin-string":"^3.0.0","rollup-plugin-swc":"^0.2.1",serve:"^14.2.0",terser:"^5.17.1",typedoc:"^0.24.8",typescript:"^5.1.6",vitest:"^0.34.2",xmldom:"^0.6.0"},Bt={"@maptiler/client":"^1.8.1",events:"^3.3.0","js-base64":"^3.7.4","maplibre-gl":"4.4.1",uuid:"^9.0.0"},$t={name:St,version:bt,description:Tt,module:It,types:Rt,style:Et,type:xt,exports:_t,keywords:Nt,homepage:Pt,license:Mt,repository:kt,scripts:Ot,author:Ft,devDependencies:zt,dependencies:Bt};const w={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"},Ut=new Set(Object.values(w));function ae(o){return Ut.has(o)}const Ht=new Set(Object.values(w));function ne(){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=>Ht.has(e));return o.length?o[0]:w.LOCAL}const N={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:w.STYLE,secondaryLanguage:w.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(N);const Te=Ct();class Ie extends yt{constructor(){super(...arguments),this.primaryLanguage=N.primaryLanguage,this.session=!0,this.caching=!0,this._unit="metric",this._apiKey=""}set unit(e){this._unit=e,this.emit("unit",e)}get unit(){return this._unit}set apiKey(e){this._apiKey=e,re.apiKey=e,this.emit("apiKey",e)}get apiKey(){return this._apiKey}set fetch(e){re.fetch=e}get fetch(){return re.fetch}}const E=new Ie;class Re extends p.LogoControl{onAdd(e){return super.onAdd(e)}}class ie extends Re{constructor(e={}){super(e),this.logoURL="",this.linkURL="",this.logoURL=e.logoURL??N.maptilerLogoURL,this.linkURL=e.linkURL??N.maptilerURL}onAdd(e){this._map=e,this._compact=this.options.compact??!1,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const t=window.document.createElement("a");return t.style.backgroundRepeat="no-repeat",t.style.cursor="pointer",t.style.display="block",t.style.height="23px",t.style.margin="0 0 -4px -4px",t.style.overflow="hidden",t.style.width="88px",t.style.backgroundImage=`url(${this.logoURL})`,t.style.backgroundSize="100px 30px",t.style.width="100px",t.style.height="30px",t.target="_blank",t.rel="noopener",t.href=this.linkURL,t.setAttribute("aria-label","MapTiler logo"),t.setAttribute("rel","noopener"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}const le="localcache_source",se="localcache",Gt="maptiler_sdk",Dt=1e3,Wt=100,ce=typeof caches<"u";function jt(o,e){if(ce&&E.caching&&E.session&&o.host===N.maptilerApiHost){if(e==="Source"&&o.href.includes("tiles.json"))return o.href.replace("https://",`${le}://`);if(e==="Tile"||e==="Glyphs")return o.href.replace("https://",`${se}://`)}return o.href}let ue;async function Ee(){return ue||(ue=await caches.open(Gt)),ue}let xe=0;async function Vt(){const o=await Ee(),e=await o.keys(),t=e.slice(0,Math.max(e.length-Dt,0));for(const r of t)o.delete(r)}function Kt(){Se(le,async(o,e)=>{if(!o.url)throw new Error("");o.url=o.url.replace(`${le}://`,"https://");const t=o;t.signal=e.signal;const r=await fetch(o.url,t),a=await r.json();return a.tiles&&a.tiles.length>0&&(a.tiles[0]+=`&last-modified=${r.headers.get("Last-Modified")}`),{data:a,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}}),Se(se,async(o,e)=>{if(!o.url)throw new Error("");o.url=o.url.replace(`${se}://`,"https://");const t=new URL(o.url),r=new URL(t);r.searchParams.delete("mtsid"),r.searchParams.delete("key");const a=r.toString(),n=new URL(t);n.searchParams.delete("last-modified");const i=n.toString(),l=async g=>({data:await g.arrayBuffer(),cacheControl:g.headers.get("Cache-Control"),expires:g.headers.get("Expires")}),u=await Ee(),s=await u.match(a);if(s)return l(s);const c=o;c.signal=e.signal;const h=await fetch(i,c);return h.status>=200&&h.status<300&&(u.put(a,h.clone()).catch(()=>{}),++xe>Wt&&(Vt(),xe=0)),l(h)})}function Zt(){const o=p.getRTLTextPluginStatus();if(o==="unavailable"||o==="requested")try{p.setRTLTextPlugin(N.rtlPluginURL,!0)}catch{}}function Yt(o,e){for(const t of o)typeof e[t]=="function"&&(e[t]=e[t].bind(e))}function U(o,e,t){const r=window.document.createElement(o);return e!==void 0&&(r.className=e),t&&t.appendChild(r),r}function _e(o){o.parentNode&&o.parentNode.removeChild(o)}function Ne(o,e){let t=null;try{t=new URL(o)}catch{return{url:o}}return t.host===N.maptilerApiHost&&(t.searchParams.has("key")||t.searchParams.append("key",E.apiKey),E.session&&t.searchParams.append("mtsid",Te)),{url:jt(t,e)}}function Pe(o){return(e,t)=>{if(o!=null){const r=o(e,t),a=Ne(r?.url??"",t);return{...r,...a}}return Ne(e,t)}}function Me(){return Math.random().toString(36).substring(2)}function q(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 qt(o){try{return JSON.parse(o)}catch{}return null}function Jt(){return document.createElement("canvas").getContext("webgl2")?null:typeof WebGL2RenderingContext<"u"?"Graphic rendering with WebGL2 has been disabled or is not supported by your graphic card. The map cannot be displayed.":"Your browser does not support graphic rendering with WebGL2. The map cannot be displayed."}function Xt(o){const e=Jt();if(!e)return;let t=null;if(typeof o=="string"?t=document.getElementById(o):o instanceof HTMLElement&&(t=o),!t)throw new Error("The Map container must be provided.");const r=document.createElement("div");throw r.innerHTML=e,r.classList.add("no-webgl-support-div"),t.appendChild(r),new Error(e)}function ke(o){return o?typeof o=="string"||o instanceof String?!o.startsWith("http")&&o.toLowerCase().includes(".json")?o:vt(o):o instanceof ft?o.getExpandedStyleURL():o instanceof Lt?o.getDefaultVariant().getExpandedStyleURL():o:At[wt[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class Oe{constructor(){Yt(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(e){return this._map=e,this._container=U("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=U("button","maplibregl-ctrl-terrain",this._container),U("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(){_e(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.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))}}class Fe extends p.NavigationControl{onAdd(e){return super.onAdd(e)}}class ze extends Fe{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._rotateCompassArrow=()=>{const e=this.options.visualizePitch?`scale(${Math.min(1.5,1/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 Be extends p.GeolocateControl{onAdd(e){return super.onAdd(e)}}const $e=p.Marker,Ue=p.LngLat,Qt=p.LngLatBounds;class He extends Be{constructor(){super(...arguments),this.lastUpdatedCenter=new Ue(0,0),this._updateCamera=e=>{const t=new Ue(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,a={bearing:this._map.getBearing(),...this.options.fitBoundsOptions,linear:!0},n=this._map.getZoom();n>(this.options?.fitBoundsOptions?.maxZoom??30)&&(a.zoom=n),this._map.fitBounds(Qt.fromLngLat(t,r),a,{geolocateSource:!0});let i=!1;const l=()=>{i=!0};this._map.once("click",l),this._map.once("dblclick",l),this._map.once("dragstart",l),this._map.once("mousedown",l),this._map.once("touchstart",l),this._map.once("wheel",l),this._map.once("moveend",()=>{this._map.off("click",l),this._map.off("dblclick",l),this._map.off("dragstart",l),this._map.off("mousedown",l),this._map.off("touchstart",l),this._map.off("wheel",l),!i&&(this.lastUpdatedCenter=this._map.getCenter())})},this._setupUI=e=>{if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=U("button","maplibregl-ctrl-geolocate",this._container),U("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=U("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new $e({element:this._dotElement}),this._circleElement=U("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new $e({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")))})},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,i=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=`${i}px`,this._circleElement.style.height=`${i}px`}}class Ge extends p.ScaleControl{onAdd(e){return super.onAdd(e)}}class De extends p.FullscreenControl{onAdd(e){return super.onAdd(e)}}var pe=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)},L=(o,e,t)=>(pe(o,e,"read from private field"),t?t.call(o):e.get(o)),B=(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)},V=(o,e,t,r)=>(pe(o,e,"write to private field"),e.set(o,t),t),P=(o,e,t)=>(pe(o,e,"access private method"),t),M,$,G,We,D,O,J,he,je,k,F,me,Ve;let de=class{constructor(e,t){B(this,he),B(this,k),B(this,me),B(this,M,void 0),B(this,$,void 0),B(this,G,void 0),B(this,We,void 0),B(this,D,void 0),B(this,O,!1),B(this,J,void 0),e.style!==void 0&&V(this,O,!0),V(this,M,{zoomAdjust:-4,position:"top-right",...t,forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1,...e,containerStyle:{border:"1px solid #000",width:"400px",height:"300px",...e.containerStyle??{}}}),e.lockZoom!==void 0&&(L(this,M).minZoom=e.lockZoom,L(this,M).maxZoom=e.lockZoom)}setStyle(e,t){L(this,O)||this.map.setStyle(e,t),P(this,k,F).call(this)}addLayer(e,t){return L(this,O)||this.map.addLayer(e,t),P(this,k,F).call(this),this.map}moveLayer(e,t){return L(this,O)||this.map.moveLayer(e,t),P(this,k,F).call(this),this.map}removeLayer(e){return L(this,O)||this.map.removeLayer(e),P(this,k,F).call(this),this}setLayerZoomRange(e,t,r){return L(this,O)||this.map.setLayerZoomRange(e,t,r),P(this,k,F).call(this),this}setFilter(e,t,r){return L(this,O)||this.map.setFilter(e,t,r),P(this,k,F).call(this),this}setPaintProperty(e,t,r,a){return L(this,O)||this.map.setPaintProperty(e,t,r,a),P(this,k,F).call(this),this}setLayoutProperty(e,t,r,a){return L(this,O)||this.map.setLayoutProperty(e,t,r,a),P(this,k,F).call(this),this}setGlyphs(e,t){return L(this,O)||this.map.setGlyphs(e,t),P(this,k,F).call(this),this}onAdd(e){V(this,$,e),V(this,G,U("div","maplibregl-ctrl maplibregl-ctrl-group"));for(const[t,r]of Object.entries(L(this,M).containerStyle))L(this,G).style.setProperty(t,r);return L(this,M).container=L(this,G),L(this,M).zoom=e.getZoom()+L(this,M).zoomAdjust,this.map=new Ze(L(this,M)),this.map.once("style.load",()=>{this.map.resize()}),this.map.once("load",()=>{P(this,he,je).call(this,L(this,M).parentRect),V(this,J,P(this,me,Ve).call(this))}),L(this,G)}onRemove(){var e;(e=L(this,J))==null||e.call(this),_e(L(this,G))}};M=new WeakMap,$=new WeakMap,G=new WeakMap,We=new WeakMap,D=new WeakMap,O=new WeakMap,J=new WeakMap,he=new WeakSet,je=function(o){o===void 0||o.linePaint===void 0&&o.fillPaint===void 0||(V(this,D,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:L(this,D)}),(o.lineLayout!==void 0||o.linePaint!==void 0)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:{...o.lineLayout},paint:{"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:{"fill-color":"#08F","fill-opacity":.135,...o.fillPaint}}),P(this,k,F).call(this))},k=new WeakSet,F=function(){if(L(this,D)===void 0)return;const{devicePixelRatio:o}=window,e=L(this,$).getCanvas(),t=e.width/o,r=e.height/o,a=L(this,$).unproject.bind(L(this,$)),n=a([0,0]),i=a([t,0]),l=a([0,r]),u=a([t,r]);L(this,D).geometry.coordinates=[[l.toArray(),u.toArray(),i.toArray(),n.toArray(),l.toArray()]],this.map.getSource("parentRect").setData(L(this,D))},me=new WeakSet,Ve=function(){const{pitchAdjust:o}=L(this,M),e=()=>{n("parent")},t=()=>{n("minimap")},r=()=>{L(this,$).on("move",e),this.map.on("move",t)},a=()=>{L(this,$).off("move",e),this.map.off("move",t)},n=i=>{a();const l=i==="parent"?L(this,$):this.map,u=i==="parent"?this.map:L(this,$),s=l.getCenter(),c=l.getZoom()+(L(this,M).zoomAdjust??-4)*(i==="parent"?1:-1),h=l.getBearing(),g=l.getPitch();u.jumpTo({center:s,zoom:c,bearing:h,pitch:o?g:0}),P(this,k,F).call(this),r()};return r(),()=>{a()}};const Ke={POINT:"POINT",COUNTRY:"COUNTRY"};class Ze extends p.Map{constructor(e){Xt(e.container),e.apiKey&&(E.apiKey=e.apiKey);const t=ke(e.style),r=location.hash;E.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!");let a={compact:!1};e.customAttribution?a.customAttribution=e.customAttribution:e.attributionControl&&typeof e.attributionControl=="object"&&(a={...a,...e.attributionControl}),super({...e,style:t,maplibreLogo:!1,transformRequest:Pe(e.transformRequest),attributionControl:e.forceNoAttributionControl===!0?!1:a}),this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.terrainGrowing=!1,this.terrainFlattening=!1,this.isReady=!1,E.caching&&!ce&&console.warn("The cache API is only available in secure contexts. More info at https://developer.mozilla.org/en-US/docs/Web/API/Cache"),E.caching&&ce&&Kt(),this.primaryLanguage=e.language??E.primaryLanguage,this.forceLanguageUpdate=!(this.primaryLanguage===w.STYLE||this.primaryLanguage===w.STYLE_LOCK),this.languageAlwaysBeenStyle=this.primaryLanguage===w.STYLE,this.terrainExaggeration=e.terrainExaggeration??this.terrainExaggeration,this.once("styledata",async()=>{if(!e.geolocate||e.center||e.hash&&r)return;try{if(e.geolocate===Ke.COUNTRY){await this.fitToIpBounds();return}}catch(c){console.warn(c.message)}let s;try{await this.centerOnIpPoint(e.zoom),s=this.getCameraHash()}catch(c){console.warn(c.message)}(await navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(c=>{s===this.getCameraHash()&&(this.terrain?this.easeTo({center:[c.coords.longitude,c.coords.latitude],zoom:e.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[c.coords.longitude,c.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",()=>{Zt()}),this.once("load",async()=>{let s={logo:null};try{const c=Object.keys(this.style.sourceCaches).map(g=>this.getSource(g)).filter(g=>g&&"url"in g&&typeof g.url=="string"&&g?.url.includes("tiles.json")),h=new URL(c[0].url);h.searchParams.has("key")||h.searchParams.append("key",E.apiKey),s=await(await fetch(h.href)).json()}catch{}if(e.forceNoAttributionControl!==!0)if("logo"in s&&s.logo){const c=s.logo;this.addControl(new ie({logoURL:c}),e.logoPosition)}else e.maptilerLogo&&this.addControl(new ie,e.logoPosition);if(e.scaleControl){const c=e.scaleControl===!0||e.scaleControl===void 0?"bottom-right":e.scaleControl,h=new Ge({unit:E.unit});this.addControl(h,c),E.on("unit",g=>{h.setUnit(g)})}if(e.navigationControl!==!1){const c=e.navigationControl===!0||e.navigationControl===void 0?"top-right":e.navigationControl;this.addControl(new ze,c)}if(e.geolocateControl!==!1){const c=e.geolocateControl===!0||e.geolocateControl===void 0?"top-right":e.geolocateControl;this.addControl(new He({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),c)}if(e.terrainControl){const c=e.terrainControl===!0||e.terrainControl===void 0?"top-right":e.terrainControl;this.addControl(new Oe,c)}if(e.fullscreenControl){const c=e.fullscreenControl===!0||e.fullscreenControl===void 0?"top-right":e.fullscreenControl;this.addControl(new De({}),c)}this.isReady=!0,this.fire("ready",{target:this})});let n=!1,i=!1,l;this.once("ready",()=>{n=!0,i&&this.fire("loadWithTerrain",l)}),this.once("style.load",()=>{const{minimap:s}=e;if(typeof s=="object"){const{zoom:c,center:h,style:g,language:v,apiKey:f,maptilerLogo:y,antialias:C,refreshExpiredTiles:_,maxBounds:A,scrollZoom:I,minZoom:R,maxZoom:T,boxZoom:z,locale:H,fadeDuration:K,crossSourceCollisions:Z,clickTolerance:Y,bounds:pt,fitBoundsOptions:ht,pixelRatio:mt,validateStyle:dt}=e;this.minimap=new de(s,{zoom:c,center:h,style:g,language:v,apiKey:f,container:"null",maptilerLogo:y,antialias:C,refreshExpiredTiles:_,maxBounds:A,scrollZoom:I,minZoom:R,maxZoom:T,boxZoom:z,locale:H,fadeDuration:K,crossSourceCollisions:Z,clickTolerance:Y,bounds:pt,fitBoundsOptions:ht,pixelRatio:mt,validateStyle:dt}),this.addControl(this.minimap,s.position??"bottom-left")}else s===!0?(this.minimap=new de({},e),this.addControl(this.minimap,"bottom-left")):s!==void 0&&s!==!1&&(this.minimap=new de({},e),this.addControl(this.minimap,s))});const u=s=>{s.terrain&&(i=!0,l={type:"loadWithTerrain",target:this,terrain:s.terrain},this.off("terrain",u),n&&this.fire("loadWithTerrain",l))};this.on("terrain",u),e.terrain&&this.enableTerrain(e.terrainExaggeration??this.terrainExaggeration)}async onLoadAsync(){return new Promise(e=>{if(this.loaded())return e(this);this.once("load",()=>{e(this)})})}async onReadyAsync(){return new Promise(e=>{if(this.isReady)return e(this);this.once("ready",()=>{e(this)})})}async onLoadWithTerrainAsync(){return new Promise(e=>{if(this.isReady&&this.terrain)return e(this);this.once("loadWithTerrain",()=>{e(this)})})}setStyle(e,t){return this.minimap?.setStyle(e),this.forceLanguageUpdate=!0,this.once("idle",()=>{this.forceLanguageUpdate=!1}),super.setStyle(ke(e),t)}addLayer(e,t){return this.minimap?.addLayer(e,t),super.addLayer(e,t)}moveLayer(e,t){return this.minimap?.moveLayer(e,t),super.moveLayer(e,t)}removeLayer(e){return this.minimap?.removeLayer(e),super.removeLayer(e)}setLayerZoomRange(e,t,r){return this.minimap?.setLayerZoomRange(e,t,r),super.setLayerZoomRange(e,t,r)}setFilter(e,t,r){return this.minimap?.setFilter(e,t,r),super.setFilter(e,t,r)}setPaintProperty(e,t,r,a){return this.minimap?.setPaintProperty(e,t,r,a),super.setPaintProperty(e,t,r,a)}setLayoutProperty(e,t,r,a){return this.minimap?.setLayoutProperty(e,t,r,a),super.setLayoutProperty(e,t,r,a)}setGlyphs(e,t){return this.minimap?.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){this.minimap?.map?.setLanguage(e),this.onStyleReady(()=>{this.setPrimaryLanguage(e)})}setPrimaryLanguage(e){const t=this.getStyleLanguage();if(!(e===w.STYLE&&(t===w.AUTO||t===w.VISITOR))&&(e!==w.STYLE&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===e&&!this.forceLanguageUpdate))return;if(!ae(e)){console.warn(`The language "${e}" is not supported.`);return}if(this.primaryLanguage===w.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===w.STYLE){if(!t){console.warn("The style has no default languages.");return}if(!ae(t)){console.warn("The language defined in the style is not valid.");return}r=t}let a=w.LOCAL,n=`{${a}}`;r===w.VISITOR?(a=ne(),n=["case",["all",["has",a],["has",w.LOCAL]],["case",["==",["get",a],["get",w.LOCAL]],["get",w.LOCAL],["format",["get",a],{"font-scale":.8},`
2
+ `,["get",w.LOCAL],{"font-scale":1.1}]],["get",w.LOCAL]]):r===w.VISITOR_ENGLISH?(a=w.ENGLISH,n=["case",["all",["has",a],["has",w.LOCAL]],["case",["==",["get",a],["get",w.LOCAL]],["get",w.LOCAL],["format",["get",a],{"font-scale":.8},`
3
+ `,["get",w.LOCAL],{"font-scale":1.1}]],["get",w.LOCAL]]):r===w.AUTO?(a=ne(),n=["case",["has",a],["get",a],["get",w.LOCAL]]):r===w.LOCAL?(a=w.LOCAL,n=`{${a}}`):(a=r,n=["case",["has",a],["get",a],["get",w.LOCAL]]);const{layers:i}=this.getStyle();for(const l of i){if(l.type!=="symbol")continue;const u=l,s=this.getSource(u.source);if(!s||!("url"in s&&typeof s.url=="string")||new URL(s.url).host!==N.maptilerApiHost)continue;const{id:c,layout:h}=u;if(!h||!("text-field"in h))continue;const g=this.getLayoutProperty(c,"text-field");typeof g=="string"&&(g.toLowerCase().includes("ref")||g.toLowerCase().includes("housenumber"))||this.setLayoutProperty(c,"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,i=()=>{if(!this.terrain||this.terrainFlattening)return;const l=(performance.now()-r)/t;if(l<.99){const u=1-(1-l)**4,s=a+u*n;this.terrain.exaggeration=s,requestAnimationFrame(i)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=e;this.triggerRepaint()};this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(i)}enableTerrain(e=this.terrainExaggeration){if(e<0){console.warn("Terrain exaggeration cannot be negative.");return}const t=async a=>{!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(N.terrainSourceId,{type:"raster-dem",url:N.terrainSourceURL}),this.setTerrain({source:N.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(N.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 i=(1-n)**4,l=r*i;this.terrain.exaggeration=l,requestAnimationFrame(a)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(N.terrainSourceId)&&this.removeSource(N.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()})}async fitToIpBounds(){const e=await be.info();this.fitBounds(e.country_bounds,{duration:0,padding:100})}async centerOnIpPoint(e){const t=await be.info();this.jumpTo({center:[t?.longitude??0,t?.latitude??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(),gt.fromUint8Array(new Uint8Array(e.buffer))}getSdkConfig(){return E}getMaptilerSessionId(){return Te}setTransformRequest(e){return super.setTransformRequest(Pe(e)),this}}class eo extends p.Marker{addTo(e){return super.addTo(e)}}class to extends p.Popup{addTo(e){return super.addTo(e)}}class oo extends p.Style{constructor(e,t={}){super(e,t)}}class ro extends p.CanvasSource{onAdd(e){super.onAdd(e)}}class ao extends p.GeoJSONSource{onAdd(e){super.onAdd(e)}}class no extends p.ImageSource{onAdd(e){super.onAdd(e)}}class io extends p.RasterTileSource{onAdd(e){super.onAdd(e)}}class lo extends p.RasterDEMTileSource{onAdd(e){super.onAdd(e)}}class so extends p.VectorTileSource{onAdd(e){super.onAdd(e)}}class co extends p.VideoSource{onAdd(e){super.onAdd(e)}}class uo extends p.AttributionControl{onAdd(e){return super.onAdd(e)}}class po extends p.TerrainControl{onAdd(e){return super.onAdd(e)}}class ho extends p.BoxZoomHandler{constructor(e,t){super(e,t)}}class mo extends p.ScrollZoomHandler{constructor(e,t){super(e,t)}}class go extends p.CooperativeGesturesHandler{constructor(e,t){super(e,t)}}class yo extends p.KeyboardHandler{constructor(e){super(e)}}class vo extends p.TwoFingersTouchPitchHandler{constructor(e){super(e)}}class fo extends p.MapWheelEvent{constructor(e,t,r){super(e,t,r)}}class Lo extends p.MapTouchEvent{constructor(e,t,r){super(e,t,r)}}class Ao extends p.MapMouseEvent{constructor(e,t,r,a={}){super(e,t,r,a)}}function X(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}throw new Error("No XML parser found")}function ge(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 ye(o){if(typeof XMLSerializer<"u")return new XMLSerializer().serializeToString(o);throw new Error("No XML serializer found")}function ve(o){const e=typeof o=="string"?X(o):o;if(!ge(e,"gpx"))throw new Error("The XML document is not valid GPX");const t=x(e,"trk"),r=x(e,"rte"),a=x(e,"wpt"),n={type:"FeatureCollection",features:[]};for(const i of Array.from(t)){const l=bo(i);l&&n.features.push(l)}for(const i of Array.from(r)){const l=To(i);l&&n.features.push(l)}for(const i of Array.from(a))n.features.push(Io(i));return n}function fe(o,e){let t=o;if(typeof t=="string"&&(t=X(t)),!ge(t,"kml"))throw new Error("The XML document is not valid KML");const r={type:"FeatureCollection",features:[]},a={},n={},i={},l=x(t,"Placemark"),u=x(t,"Style"),s=x(t,"StyleMap");for(const c of Array.from(u)){const h=Xe(e!==void 0?e(c):ye(c)).toString(16);a[`#${W(c,"id")}`]=h,n[h]=c}for(const c of Array.from(s)){a[`#${W(c,"id")}`]=Xe(e!==void 0?e(c):ye(c)).toString(16);const h=x(c,"Pair"),g={};for(const v of Array.from(h))g[S(d(v,"key"))??""]=S(d(v,"styleUrl"));i[`#${W(c,"id")}`]=g}for(const c of Array.from(l))r.features=r.features.concat(So(c,a,n,i));return r}function Ye(o){if(o===null)return["#000000",1];let e="",t=1,r=o;return r.substring(0,1)==="#"&&(r=r.substring(1)),(r.length===6||r.length===3)&&(e=r),r.length===8&&(t=Number.parseInt(r.substring(0,2),16)/255,e=`#${r.substring(6,8)}${r.substring(4,6)}${r.substring(2,4)}`),[e??"#000000",t??1]}function wo(o){return et(o.split(" "))}function Co(o){let e=x(o,"coord");const t=[],r=[];e.length===0&&(e=x(o,"gx:coord"));for(const n of Array.from(e))t.push(wo(S(n)??""));const a=x(o,"when");for(const n of Array.from(a))r.push(S(n));return{coords:t,times:r}}function Q(o){const e=["Polygon","LineString","Point","Track","gx:Track"];let t,r,a,n,i;const l=[],u=[];if(d(o,"MultiGeometry")!==null)return Q(d(o,"MultiGeometry"));if(d(o,"MultiTrack")!==null)return Q(d(o,"MultiTrack"));if(d(o,"gx:MultiTrack")!==null)return Q(d(o,"gx:MultiTrack"));for(a=0;a<e.length;a++)if(r=x(o,e[a]),r){for(n=0;n<r.length;n++)if(t=r[n],e[a]==="Point")l.push({type:"Point",coordinates:tt(S(d(t,"coordinates"))??"")});else if(e[a]==="LineString")l.push({type:"LineString",coordinates:ot(S(d(t,"coordinates"))??"")});else if(e[a]==="Polygon"){const s=x(t,"LinearRing"),c=[];for(i=0;i<s.length;i++)c.push(ot(S(d(s[i],"coordinates"))??""));l.push({type:"Polygon",coordinates:c})}else if(e[a]==="Track"||e[a]==="gx:Track"){const s=Co(t);l.push({type:"LineString",coordinates:s.coords}),s.times.length&&u.push(s.times)}}return{geoms:l,coordTimes:u}}function So(o,e,t,r){const a=Q(o),n={},i=S(d(o,"name")),l=S(d(o,"address")),u=S(d(o,"description")),s=d(o,"TimeSpan"),c=d(o,"TimeStamp"),h=d(o,"ExtendedData"),g=d(o,"visibility");let v,f=S(d(o,"styleUrl")),y=d(o,"LineStyle"),C=d(o,"PolyStyle");if(!a.geoms.length)return[];if(i&&(n.name=i),l&&(n.address=l),f){f[0]!=="#"&&(f=`#${f}`),n.styleUrl=f,e[f]&&(n.styleHash=e[f]),r[f]&&(n.styleMapHash=r[f],n.styleHash=e[r[f].normal??""]);const A=t[n.styleHash??""];if(A){y||(y=d(A,"LineStyle")),C||(C=d(A,"PolyStyle"));const I=d(A,"IconStyle");if(I){const R=d(I,"Icon");if(R){const T=S(d(R,"href"));T&&(n.icon=T)}}}}if(u&&(n.description=u),s){const A=S(d(s,"begin")),I=S(d(s,"end"));A&&I&&(n.timespan={begin:A,end:I})}if(c!==null&&(n.timestamp=S(d(c,"when"))??new Date().toISOString()),y!==null){const A=Ye(S(d(y,"color"))),I=A[0],R=A[1],T=Number.parseFloat(S(d(y,"width"))??"");I&&(n.stroke=I),Number.isNaN(R)||(n["stroke-opacity"]=R),Number.isNaN(T)||(n["stroke-width"]=T)}if(C){const A=Ye(S(d(C,"color"))),I=A[0],R=A[1],T=S(d(C,"fill")),z=S(d(C,"outline"));I&&(n.fill=I),Number.isNaN(R)||(n["fill-opacity"]=R),T&&(n["fill-opacity"]=T==="1"?n["fill-opacity"]||1:0),z&&(n["stroke-opacity"]=z==="1"?n["stroke-opacity"]||1:0)}if(h){const A=x(h,"Data"),I=x(h,"SimpleData");for(v=0;v<A.length;v++)n[A[v].getAttribute("name")??""]=S(d(A[v],"value"))??"";for(v=0;v<I.length;v++)n[I[v].getAttribute("name")??""]=S(I[v])??""}g!==null&&(n.visibility=S(g)??""),a.coordTimes.length!==0&&(n.coordTimes=a.coordTimes.length===1?a.coordTimes[0]:a.coordTimes);const _={type:"Feature",geometry:a.geoms.length===1?a.geoms[0]:{type:"GeometryCollection",geometries:a.geoms},properties:n};return W(o,"id")&&(_.id=W(o,"id")??void 0),[_]}function qe(o,e){const t=x(o,e),r=[],a=[];let n=[];const i=t.length;if(!(i<2)){for(let l=0;l<i;l++){const u=rt(t[l]);r.push(u.coordinates),u.time&&a.push(u.time),(u.heartRate||n.length)&&(n.length===0&&(n=new Array(l).fill(null)),n.push(u.heartRate))}return{line:r,times:a,heartRates:n}}}function bo(o){const e=x(o,"trkseg"),t=[],r=[],a=[];let n;for(let l=0;l<e.length;l++)if(n=qe(e[l],"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 u=0;u<l;u++)a.push(new Array(t[u].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 i={...Le(o),...Je(d(o,"extensions"))};return r.length!==0&&(i.coordTimes=t.length===1?r[0]:r),a.length!==0&&(i.heartRates=t.length===1?a[0]:a),t.length===1?{type:"Feature",properties:i,geometry:{type:"LineString",coordinates:t[0]}}:{type:"Feature",properties:i,geometry:{type:"MultiLineString",coordinates:t}}}function To(o){const e=qe(o,"rtept");return e===void 0?void 0:{type:"Feature",properties:{...Le(o),...Je(d(o,"extensions"))},geometry:{type:"LineString",coordinates:e.line}}}function Io(o){return{type:"Feature",properties:{...Le(o),...Ae(o,["sym"])},geometry:{type:"Point",coordinates:rt(o).coordinates}}}function Je(o){const e={};if(o){const t=d(o,"line");if(t){const r=S(d(t,"color")),a=Number.parseFloat(S(d(t,"opacity"))??"0"),n=Number.parseFloat(S(d(t,"width"))??"0");r&&(e.stroke=r),Number.isNaN(a)||(e["stroke-opacity"]=a),Number.isNaN(n)||(e["stroke-width"]=n*96/25.4)}}return e}function Le(o){const e=Ae(o,["name","cmt","desc","type","time","keywords"]),t=x(o,"link");if(t.length!==0){e.links=[];for(const r of Array.from(t)){const a={href:W(r,"href"),...Ae(r,["text","type"])};e.links.push(a)}}return e}function Xe(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 x(o,e){return o.getElementsByTagName(e)}function W(o,e){return o.getAttribute(e)}function Qe(o,e){return Number.parseFloat(W(o,e)??"0")}function d(o,e){const t=x(o,e);return t.length?t[0]:null}function Ro(o){return o.normalize&&o.normalize(),o}function et(o){return o.map(Number.parseFloat).map(e=>Number.isNaN(e)?null:e)}function S(o){return o&&Ro(o),o&&o.textContent}function Ae(o,e){const t={};let r,a;for(a=0;a<e.length;a++)r=d(o,e[a]),r&&(t[e[a]]=S(r)??"");return t}function tt(o){return et(o.replace(/\s*/g,"").split(","))}function ot(o){const e=o.replace(/^\s*|\s*$/g,"").split(/\s+/),t=[];for(const r of e)t.push(tt(r));return t}function rt(o){const e=[Qe(o,"lon"),Qe(o,"lat")],t=d(o,"ele"),r=d(o,"gpxtpx:hr")||d(o,"hr"),a=d(o,"time");let n;return t&&(n=Number.parseFloat(S(t)??"0"),Number.isNaN(n)||e.push(n)),{coordinates:e,time:a?S(a):null,heartRate:r!==null?Number.parseFloat(S(r)??"0"):null}}function at(o){let e=o;try{typeof e=="string"&&(e=X(e))}catch{return null}try{return ve(e)}catch{}try{return fe(e)}catch{}return null}function ee(o){const e=o.toString(16);return e.length===1?`0${e}`:e}function Eo(o){return`#${ee(o[0])}${ee(o[1])}${ee(o[2])}${o.length===4?ee(o[3]):""}`}class m extends Array{constructor(e={}){super(),this.min=0,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=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(let i=0;i<e.length;i+=1)a=Math.min(a,e[i].value),n=Math.max(n,e[i].value),r.push({value:e[i].value,color:e[i].color.slice()});return r.sort((i,l)=>i.value<l.value?-1:1),this.min=a,this.max=n,r}scale(e,t,r={clone:!0}){const a=r.clone,n=this[0].value,i=this.at(-1).value-n,l=t-e,u=[];for(let s=0;s<this.length;s+=1){const c=(this[s].value-n)/i*l+e;a?u.push({value:c,color:this[s].color.slice()}):this[s].value=c}return a?new m({stops:u}):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,i=this[r+1].value,l=this[r+1].color,u=(i-e)/(i-n);return a.map((s,c)=>Math.round(s*u+l[c]*(1-u)))}return[0,0,0]}getColorHex(e,t={smooth:!0,withAlpha:!1}){return Eo(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,i=e.size,l=this[0].value,u=(this.at(-1).value-l)/i;for(let s=0;s<i;s+=1){const c=this.getColor(l+s*u,{smooth:e.smooth});n[s*4]=c[0],n[s*4+1]=c[1],n[s*4+2]=c[2],n[s*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 i;if(e==="ease-in-square")i=Array.from({length:t},(l,u)=>{const s=u*n,c=s**2,h=a.getColor(c);return{value:s,color:h}});else if(e==="ease-out-square")i=Array.from({length:t},(l,u)=>{const s=u*n,c=1-(1-s)**2,h=a.getColor(c);return{value:s,color:h}});else if(e==="ease-out-sqrt")i=Array.from({length:t},(l,u)=>{const s=u*n,c=s**.5,h=a.getColor(c);return{value:s,color:h}});else if(e==="ease-in-sqrt")i=Array.from({length:t},(l,u)=>{const s=u*n,c=1-(1-s)**.5,h=a.getColor(c);return{value:s,color:h}});else if(e==="ease-out-exp")i=Array.from({length:t},(l,u)=>{const s=u*n,c=1-2**(-10*s),h=a.getColor(c);return{value:s,color:h}});else if(e==="ease-in-exp")i=Array.from({length:t},(l,u)=>{const s=u*n,c=2**(10*s-10),h=a.getColor(c);return{value:s,color:h}});else throw new Error("Invalid ressampling method.");return new m({stops:i}).scale(r.min,r.max)}transparentStart(){const e=this.getRawColorStops();e.unshift({value:e[0].value,color:e[0].color.slice()}),e[1].value+=.001;for(const t of e)t.color.length===3&&t.color.push(255);return e[0].color[3]=0,new m({stops:e})}hasTransparentStart(){return this[0].color.length===4&&this[0].color[3]===0}}const we={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]}]})},nt=[["#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 Ce(){return nt[~~(Math.random()*nt.length)][~~(Math.random()*4)]}function te(){return`maptiler_source_${Me()}`}function oe(){return`maptiler_layer_${Me()}`}function it(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 j(o){return["interpolate",["linear"],["zoom"],...o.flatMap(e=>[e.zoom,e.value])]}function b(o){return["interpolate",["linear"],["zoom"],...o.flatMap(e=>[e.zoom,e.value])]}function xo(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.flatMap(t=>[t.zoom,2*e+t.value])];if(typeof o=="number"&&Array.isArray(e))return["interpolate",["linear"],["zoom"],...e.flatMap(t=>[t.zoom,2*t.value+o])];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.flatMap(r=>[r,2*it(e,r)+it(o,r)])]}return 0}function _o(o,e){return["interpolate",["linear"],["get",e],...o.flatMap(t=>[t.propertyValue,t.value])]}function lt(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 i=r[n-1],l=r[n];i===l?a[a.length-1]+=1:a.push(1)}return a}function st(o,e){return["interpolate",["linear"],["get",e],...o.flatMap(t=>[t.value,t.color])]}function ct(o,e,t=!0){return t?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius*.025])],2,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius*.05])],4,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius*.1])],8,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius*.25])],16,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius])]]:["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.value,r.pointRadius])]}function No(o,e,t=!0){return t?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value*.025])],2,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value*.05])],4,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value*.1])],8,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value*.25])],16,["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value])]]:["interpolate",["linear"],["get",e],...o.flatMap(r=>[r.propertyValue,r.value])]}function ut(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().flatMap(t=>{const r=t.value,a=t.color;return[r,a.length===4?a[3]/255:1]})]}function Po(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()]}async function Mo(o,e,t={}){if(!e.sourceId&&!e.data)throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");let r=e.data;if(typeof r=="string"){if(q(r))r=`https://api.maptiler.com/data/${e.data}/features.json?key=${E.apiKey}`;else if(r.split(".").pop()?.toLowerCase().trim()==="gpx"){const a=await(await fetch(r,t)).text();r=ve(a)}else if(r.split(".").pop()?.toLowerCase().trim()==="kml"){const a=await(await fetch(r,t)).text();r=fe(a)}else{const a=qt(r)??at(r);a&&(r=a)}if(!r)throw new Error("Polyline data was provided as string but is incompatible with valid formats.")}return ko(o,{...e,data:r})}function ko(o,e){if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const t=e.sourceId??te(),r=e.layerId??oe(),a={polylineLayerId:r,polylineOutlineLayerId:"",polylineSourceId:t};e.data&&!o.getSource(t)&&o.addSource(t,{type:"geojson",data:e.data});const n=e.lineWidth??3,i=e.lineColor??Ce(),l=e.lineOpacity??1,u=e.lineBlur??0,s=e.lineGapWidth??0;let c=e.lineDashArray??null;const h=e.outlineWidth??1,g=e.outlineColor??"#FFFFFF",v=e.outlineOpacity??1,f=e.outlineBlur??0;if(typeof c=="string"&&(c=lt(c)),e.outline===!0){const y=`${r}_outline`;a.polylineOutlineLayerId=y,o.addLayer({id:y,type:"line",source:t,layout:{"line-join":e.lineJoin??"round","line-cap":e.lineCap??"round"},minzoom:e.minzoom??0,maxzoom:e.maxzoom??23,paint:{"line-opacity":typeof v=="number"?v:b(v),"line-color":typeof g=="string"?g:j(g),"line-width":xo(n,h),"line-blur":typeof f=="number"?f:b(f)}},e.beforeId)}return o.addLayer({id:r,type:"line",source:t,layout:{"line-join":e.lineJoin??"round","line-cap":e.lineCap??"round"},minzoom:e.minzoom??0,maxzoom:e.maxzoom??23,paint:{"line-opacity":typeof l=="number"?l:b(l),"line-color":typeof i=="string"?i:j(i),"line-width":typeof n=="number"?n:b(n),"line-blur":typeof u=="number"?u:b(u),"line-gap-width":typeof s=="number"?s:b(s),...c&&{"line-dasharray":c}}},e.beforeId),a}function Oo(o,e){if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const t=e.sourceId??te(),r=e.layerId??oe(),a={polygonLayerId:r,polygonOutlineLayerId:e.outline?`${r}_outline`:"",polygonSourceId:t};if(e.data&&!o.getSource(t)){let y=e.data;typeof y=="string"&&q(y)&&(y=`https://api.maptiler.com/data/${y}/features.json?key=${E.apiKey}`),o.addSource(t,{type:"geojson",data:y})}let n=e.outlineDashArray??null;const i=e.outlineWidth??1,l=e.outlineColor??"#FFFFFF",u=e.outlineOpacity??1,s=e.outlineBlur??0,c=e.fillColor??Ce(),h=e.fillOpacity??1,g=e.outlinePosition??"center",v=e.pattern??null;typeof n=="string"&&(n=lt(n));const f=(y=null)=>{if(o.addLayer({id:r,type:"fill",source:t,minzoom:e.minzoom??0,maxzoom:e.maxzoom??23,paint:{"fill-color":typeof c=="string"?c:j(c),"fill-opacity":typeof h=="number"?h:b(h),...y&&{"fill-pattern":y}}},e.beforeId),e.outline===!0){let C;g==="inside"?typeof i=="number"?C=.5*i:C=b(i.map(({zoom:_,value:A})=>({zoom:_,value:.5*A}))):g==="outside"?typeof i=="number"?C=-.5*i:C=b(i.map(_=>({zoom:_.zoom,value:-.5*_.value}))):C=0,o.addLayer({id:a.polygonOutlineLayerId,type:"line",source:t,layout:{"line-join":e.outlineJoin??"round","line-cap":e.outlineCap??"butt"},minzoom:e.minzoom??0,maxzoom:e.maxzoom??23,paint:{"line-opacity":typeof u=="number"?u:b(u),"line-color":typeof l=="string"?l:j(l),"line-width":typeof i=="number"?i:b(i),"line-blur":typeof s=="number"?s:b(s),"line-offset":C,...n&&{"line-dasharray":n}}},e.beforeId)}};return v?o.hasImage(v)?f(v):o.loadImage(v).then(y=>{o.addImage(v,y.data),f(v)}).catch(y=>(console.error("Could not load the pattern image.",y.message),f())):f(),a}function Fo(o,e){if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const t=e.minPointRadius??10,r=e.maxPointRadius??50,a=e.cluster??!1,n=20,i=Array.isArray(e.pointColor)?e.pointColor:we.TURBO.scale(10,e.cluster?1e4:1e3).resample("ease-out-square"),l=i.getBounds(),u=e.sourceId??te(),s=e.layerId??oe(),c=e.showLabel??a,h=e.alignOnViewport??!0,g=e.outline??!1,v=e.outlineOpacity??1,f=e.outlineWidth??1,y=e.outlineColor??"#FFFFFF";let C;const _=e.zoomCompensation??!0,A=e.minzoom??0,I=e.maxzoom??23;typeof e.pointOpacity=="number"?C=e.pointOpacity:Array.isArray(e.pointOpacity)?C=b(e.pointOpacity):e.cluster?C=ut(i,"point_count"):e.property?C=ut(i,e.property):C=b([{zoom:A,value:0},{zoom:A+.25,value:1},{zoom:I-.25,value:1},{zoom:I,value:0}]);const R={pointLayerId:s,clusterLayerId:"",labelLayerId:"",pointSourceId:u};if(e.data&&!o.getSource(u)){let T=e.data;typeof T=="string"&&q(T)&&(T=`https://api.maptiler.com/data/${T}/features.json?key=${E.apiKey}`),o.addSource(u,{type:"geojson",data:T,cluster:a})}if(a){R.clusterLayerId=`${s}_cluster`;const T=Array.from({length:n},(z,H)=>{const K=l.min+H*(l.max-l.min)/(n-1);return{value:K,pointRadius:t+(r-t)*(H/(n-1))**.5,color:i.getColorHex(K)}});o.addLayer({id:R.clusterLayerId,type:"circle",source:u,filter:["has","point_count"],paint:{"circle-color":typeof e.pointColor=="string"?e.pointColor:st(T,"point_count"),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?b(e.pointRadius):ct(T,"point_count",!1),"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-opacity":C,...g&&{"circle-stroke-opacity":typeof v=="number"?v:b(v),"circle-stroke-width":typeof f=="number"?f:b(f),"circle-stroke-color":typeof y=="string"?y:j(y)}},minzoom:A,maxzoom:I},e.beforeId),o.addLayer({id:R.pointLayerId,type:"circle",source:u,filter:["!",["has","point_count"]],paint:{"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-color":typeof e.pointColor=="string"?e.pointColor:i.getColorHex(i.getBounds().min),"circle-radius":typeof e.pointRadius=="number"?e.pointRadius:Array.isArray(e.pointRadius)?b(e.pointRadius):T[0].pointRadius*.75,"circle-opacity":C,...g&&{"circle-stroke-opacity":typeof v=="number"?v:b(v),"circle-stroke-width":typeof f=="number"?f:b(f),"circle-stroke-color":typeof y=="string"?y:j(y)}},minzoom:A,maxzoom:I},e.beforeId)}else{let T=typeof e.pointColor=="string"?e.pointColor:Array.isArray(e.pointColor)?e.pointColor.getColorHex(e.pointColor.getBounds().min):Ce(),z=typeof e.pointRadius=="number"?_?b([{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)?b(e.pointRadius):_?b([{zoom:0,value:t*.05},{zoom:2,value:t*.1},{zoom:4,value:t*.2},{zoom:8,value:t*.5},{zoom:16,value:t*1}]):t;if(e.property&&Array.isArray(e.pointColor)){const H=Array.from({length:n},(K,Z)=>{const Y=l.min+Z*(l.max-l.min)/(n-1);return{value:Y,pointRadius:typeof e.pointRadius=="number"?e.pointRadius:t+(r-t)*(Z/(n-1))**.5,color:typeof e.pointColor=="string"?e.pointColor:i.getColorHex(Y)}});T=st(H,e.property),z=ct(H,e.property,_)}o.addLayer({id:R.pointLayerId,type:"circle",source:u,layout:{"circle-sort-key":e.property?["/",1,["get",e.property]]:0},paint:{"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-color":T,"circle-opacity":C,"circle-radius":z,...g&&{"circle-stroke-opacity":typeof v=="number"?v:b(v),"circle-stroke-width":typeof f=="number"?f:b(f),"circle-stroke-color":typeof y=="string"?y:j(y)}},minzoom:A,maxzoom:I},e.beforeId)}if(c!==!1&&(e.cluster||e.property)){R.labelLayerId=`${s}_label`;const T=e.labelColor??"#fff",z=e.labelSize??12;o.addLayer({id:R.labelLayerId,type:"symbol",source:u,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":z,"text-pitch-alignment":h?"viewport":"map","symbol-sort-key":["/",1,["get",e.cluster?"point_count":e.property]]},paint:{"text-color":T,"text-opacity":C},minzoom:A,maxzoom:I},e.beforeId)}return R}function zo(o,e){if(e.layerId&&o.getLayer(e.layerId))throw new Error(`A layer already exists with the layer id: ${e.layerId}`);const t=e.sourceId??te(),r=e.layerId??oe(),a=e.minzoom??0,n=e.maxzoom??23,i=e.zoomCompensation??!0,l=e.opacity??[{zoom:a,value:0},{zoom:a+.25,value:1},{zoom:n-.25,value:1},{zoom:n,value:0}];let u=Array.isArray(e.colorRamp)?e.colorRamp:we.TURBO.transparentStart();const s=u.getBounds();(s.min!==0||s.max!==1)&&(u=u.scale(0,1)),u.hasTransparentStart()||(u=u.transparentStart());const c=e.intensity??[{zoom:0,value:.01},{zoom:4,value:.2},{zoom:16,value:1}],h=e.property??null,g=e.weight??1;let v=1;h?typeof g=="number"?(v=g,typeof e.weight=="number"&&console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`")):Array.isArray(g)?v=_o(g,h):console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"):typeof g=="number"?v=g:Array.isArray(g)&&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}],y=e.radius??(i?f:10);let C=1;typeof y=="number"?C=y:Array.isArray(y)&&"zoom"in y[0]?C=b(y):h&&Array.isArray(y)&&"propertyValue"in y[0]?C=No(y,h,i):!h&&Array.isArray(y)&&"propertyValue"in y[0]?(C=b(f),console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.")):C=b(f);const _={heatmapLayerId:r,heatmapSourceId:t};if(e.data&&!o.getSource(t)){let A=e.data;typeof A=="string"&&q(A)&&(A=`https://api.maptiler.com/data/${A}/features.json?key=${E.apiKey}`),o.addSource(t,{type:"geojson",data:A})}return o.addLayer({id:r,type:"heatmap",source:t,minzoom:a,maxzoom:n,paint:{"heatmap-weight":v,"heatmap-intensity":typeof c=="number"?c:b(c),"heatmap-color":Po(u),"heatmap-radius":C,"heatmap-opacity":typeof l=="number"?l:b(l)}}),_}const Bo={addPolyline:Mo,addPolygon:Oo,addPoint:Fo,addHeatmap:zo},{setRTLTextPlugin:$o,getRTLTextPluginStatus:Uo,LngLat:Ho,LngLatBounds:Go,MercatorCoordinate:Do,Evented:Wo,AJAXError:Pr,prewarm:jo,clearPrewarmedResources:Vo,addProtocol:Se,removeProtocol:Ko,Hash:Zo,Point:Yo,config:qo,EdgeInsets:Jo,DragRotateHandler:Xo,DragPanHandler:Qo,TwoFingersTouchZoomRotateHandler:er,DoubleClickZoomHandler:tr,TwoFingersTouchZoomHandler:or,TwoFingersTouchRotateHandler:rr,getWorkerCount:ar,setWorkerCount:nr,getMaxParallelImageRequests:ir,setMaxParallelImageRequests:lr,getWorkerUrl:sr,setWorkerUrl:cr,addSourceType:ur,importScriptInWorkers:pr}=p;function hr(){return $t.version}function mr(){return p.getVersion()}const dr=p.Map,gr=p.Marker,yr=p.Popup,vr=p.Style;p.CanvasSource,p.GeoJSONSource;const fr=p.ImageSource,Lr=p.RasterTileSource;p.RasterDEMTileSource,p.VectorTileSource;const Ar=p.VideoSource;p.NavigationControl,p.GeolocateControl,p.AttributionControl,p.LogoControl,p.ScaleControl,p.FullscreenControl,p.TerrainControl;const wr=p.BoxZoomHandler,Cr=p.ScrollZoomHandler,Sr=p.CooperativeGesturesHandler,br=p.KeyboardHandler,Tr=p.TwoFingersTouchPitchHandler;p.MapWheelEvent,p.MapTouchEvent,p.MapMouseEvent;export{uo as AttributionControl,ho as BoxZoomHandler,wr as BoxZoomHandlerMLGL,ro as CanvasSource,m as ColorRamp,we as ColorRampCollection,go as CooperativeGesturesHandler,Sr as CooperativeGesturesHandlerMLGL,tr as DoubleClickZoomHandler,Qo as DragPanHandler,Xo as DragRotateHandler,Jo as EdgeInsets,Wo as Evented,De as FullscreenControl,ao as GeoJSONSource,Be as GeolocateControl,Ke as GeolocationType,Zo as Hash,no as ImageSource,fr as ImageSourceMLGL,yo as KeyboardHandler,br as KeyboardHandlerMLGL,w as Language,Or as LanguageGeocoding,Ho as LngLat,Go as LngLatBounds,Re as LogoControl,Ze as Map,dr as MapMLGL,Ao as MapMouseEvent,Fr as MapStyle,zr as MapStyleVariant,Lo as MapTouchEvent,fo as MapWheelEvent,He as MaptilerGeolocateControl,ie as MaptilerLogoControl,ze as MaptilerNavigationControl,Oe as MaptilerTerrainControl,eo as Marker,gr as MarkerMLGL,Do as MercatorCoordinate,Fe as NavigationControl,Yo as Point,to as Popup,yr as PopupMLGL,lo as RasterDEMTileSource,io as RasterTileSource,Lr as RasterTileSourceMLGL,Br as ReferenceMapStyle,Ge as ScaleControl,mo as ScrollZoomHandler,Cr as ScrollZoomHandlerMLGL,Ie as SdkConfig,$r as ServiceError,oo as Style,vr as StyleMLGL,po as TerrainControl,vo as TwoFingersTouchPitchHandler,Tr as TwoFingersTouchPitchHandlerMLGL,rr as TwoFingersTouchRotateHandler,or as TwoFingersTouchZoomHandler,er as TwoFingersTouchZoomRotateHandler,so as VectorTileSource,co as VideoSource,Ar as VideoSourceMLGL,Se as addProtocol,ur as addSourceType,Ur as bufferToPixelDataBrowser,Hr as circumferenceAtLatitude,Vo as clearPrewarmedResources,E as config,qo as configMLGL,Gr as coordinates,Dr as data,Wr as elevation,jr as expandMapStyle,Vr as geocoding,Kr as geolocation,Zr as getAutoLanguageGeocoding,ne as getBrowserLanguage,Yr as getBufferToPixelDataParser,mr as getMapLibreVersion,ir as getMaxParallelImageRequests,Uo as getRTLTextPluginStatus,qr as getTileCache,hr as getVersion,ar as getWorkerCount,sr as getWorkerUrl,ve as gpx,at as gpxOrKml,ge as hasChildNodeWithName,Bo as helpers,pr as importScriptInWorkers,ae as isLanguageSupported,fe as kml,Jr as mapStylePresetList,Xr as math,Qr as misc,jo as prewarm,Ko as removeProtocol,lr as setMaxParallelImageRequests,$o as setRTLTextPlugin,nr as setWorkerCount,cr as setWorkerUrl,ea as staticMaps,X as str2xml,ta as styleToStyle,ye as xml2str};