@maptiler/sdk 1.0.9 → 1.0.10

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.
@@ -100,14 +100,14 @@ declare const Language: {
100
100
  /**
101
101
  * Type representing the key of the Language object
102
102
  */
103
- declare type LanguageKey = keyof typeof Language;
104
- declare type Values<T> = T[keyof T];
103
+ type LanguageKey = keyof typeof Language;
104
+ type Values<T> = T[keyof T];
105
105
  /**
106
106
  * Built-in languages values as strings
107
107
  */
108
- declare type LanguageString = Values<typeof Language>;
108
+ type LanguageString = Values<typeof Language>;
109
109
 
110
- declare type Unit = "imperial" | "metric" | "nautical";
110
+ type Unit = "imperial" | "metric" | "nautical";
111
111
 
112
112
  /**
113
113
  * Configuration class for the SDK
@@ -166,8 +166,16 @@ declare class SdkConfig extends EventEmitter {
166
166
  }
167
167
  declare const config: SdkConfig;
168
168
 
169
- declare type TransformStyleFunction = (previous: StyleSpecification, next: StyleSpecification) => StyleSpecification;
170
- declare type StyleSwapOptions = {
169
+ type LoadWithTerrainEvent = {
170
+ type: "loadWithTerrain";
171
+ target: Map;
172
+ terrain: {
173
+ source: string;
174
+ exaggeration: number;
175
+ };
176
+ };
177
+ type TransformStyleFunction = (previous: StyleSpecification, next: StyleSpecification) => StyleSpecification;
178
+ type StyleSwapOptions = {
171
179
  diff?: boolean;
172
180
  transformStyle?: TransformStyleFunction;
173
181
  };
@@ -178,7 +186,7 @@ declare const GeolocationType: {
178
186
  /**
179
187
  * Options to provide to the `Map` constructor
180
188
  */
181
- declare type MapOptions = Omit<MapOptions$1, "style" | "maplibreLogo"> & {
189
+ type MapOptions = Omit<MapOptions$1, "style" | "maplibreLogo"> & {
182
190
  /**
183
191
  * Style of the map. Can be:
184
192
  * - a full style URL (possibly with API key)
@@ -248,7 +256,7 @@ declare type MapOptions = Omit<MapOptions$1, "style" | "maplibreLogo"> & {
248
256
  *
249
257
  * Default: `false`
250
258
  */
251
- geolocate?: typeof GeolocationType[keyof typeof GeolocationType] | boolean;
259
+ geolocate?: (typeof GeolocationType)[keyof typeof GeolocationType] | boolean;
252
260
  };
253
261
  /**
254
262
  * The Map class can be instanciated to display a map in a `<div>`
@@ -258,7 +266,24 @@ declare class Map extends maplibre_gl__default.Map {
258
266
  private terrainExaggeration;
259
267
  private primaryLanguage;
260
268
  private secondaryLanguage;
269
+ private terrainGrowing;
270
+ private terrainFlattening;
261
271
  constructor(options: MapOptions);
272
+ /**
273
+ * Awaits for _this_ Map instance to be "loaded" and returns a Promise to the Map.
274
+ * If _this_ Map instance is already loaded, the Promise is resolved directly,
275
+ * otherwise, it is resolved as a result of the "load" event.
276
+ * @returns
277
+ */
278
+ onLoadAsync(): Promise<Map>;
279
+ /**
280
+ * Awaits for _this_ Map instance to be "loaded" as well as with terrain being non-null for the first time
281
+ * and returns a Promise to the Map.
282
+ * If _this_ Map instance is already loaded with terrain, the Promise is resolved directly,
283
+ * otherwise, it is resolved as a result of the "loadWithTerrain" event.
284
+ * @returns
285
+ */
286
+ onLoadWithTerrainAsync(): Promise<Map>;
262
287
  /**
263
288
  * Update the style of the map.
264
289
  * Can be:
@@ -307,6 +332,7 @@ declare class Map extends maplibre_gl__default.Map {
307
332
  * @returns
308
333
  */
309
334
  hasTerrain(): boolean;
335
+ private growTerrain;
310
336
  /**
311
337
  * Enables the 3D terrain visualization
312
338
  * @param exaggeration
@@ -319,10 +345,14 @@ declare class Map extends maplibre_gl__default.Map {
319
345
  disableTerrain(): void;
320
346
  /**
321
347
  * Sets the 3D terrain exageration factor.
322
- * Note: this is only a shortcut to `.enableTerrain()`
348
+ * If the terrain was not enabled prior to the call of this method,
349
+ * the method `.enableTerrain()` will be called.
350
+ * If `animate` is `true`, the terrain transformation will be animated in the span of 1 second.
351
+ * If `animate` is `false`, no animated transition to the newly defined exaggeration.
323
352
  * @param exaggeration
353
+ * @param animate
324
354
  */
325
- setTerrainExaggeration(exaggeration: number): void;
355
+ setTerrainExaggeration(exaggeration: number, animate?: boolean): void;
326
356
  /**
327
357
  * Perform an action when the style is ready. It could be at the moment of calling this method
328
358
  * or later.
@@ -503,7 +533,7 @@ declare class MaptilerGeolocateControl extends GeolocateControl {
503
533
  _onZoom(): void;
504
534
  }
505
535
 
506
- declare type LogoOptions = LogoOptions$1 & {
536
+ type LogoOptions = LogoOptions$1 & {
507
537
  logoURL?: string;
508
538
  linkURL?: string;
509
539
  };
@@ -540,7 +570,7 @@ declare class MaptilerTerrainControl implements maplibregl.IControl {
540
570
  /**
541
571
  * Row major 2x2 matrix
542
572
  */
543
- declare type Matrix2 = [number, number, number, number];
573
+ type Matrix2 = [number, number, number, number];
544
574
  /**
545
575
  * a point
546
576
  * @param x
@@ -721,56 +751,55 @@ declare const clearPrewarmedResources: () => void;
721
751
  declare const version: string;
722
752
  declare const workerCount: number;
723
753
  declare const maxParallelImageRequests: number;
724
- declare const clearStorage: (callback?: (err?: Error) => void) => void;
725
754
  declare const workerUrl: string;
726
755
  declare const addProtocol: (customProtocol: string, loadFn: (requestParameters: maplibre_gl.RequestParameters, callback: maplibre_gl.ResponseCallback<any>) => maplibre_gl.Cancelable) => void;
727
756
  declare const removeProtocol: (customProtocol: string) => void;
728
757
 
729
758
  declare const NavigationControlMLGL: typeof maplibre_gl.NavigationControl;
730
- declare type NavigationControlMLGL = InstanceType<typeof NavigationControlMLGL>;
759
+ type NavigationControlMLGL = InstanceType<typeof NavigationControlMLGL>;
731
760
  declare const GeolocateControlMLGL: typeof maplibre_gl.GeolocateControl;
732
- declare type GeolocateControlMLGL = InstanceType<typeof GeolocateControlMLGL>;
761
+ type GeolocateControlMLGL = InstanceType<typeof GeolocateControlMLGL>;
733
762
  declare const AttributionControlMLGL: typeof maplibre_gl.AttributionControl;
734
- declare type AttributionControlMLGL = InstanceType<typeof AttributionControlMLGL>;
763
+ type AttributionControlMLGL = InstanceType<typeof AttributionControlMLGL>;
735
764
  declare const LogoControlMLGL: typeof maplibre_gl.LogoControl;
736
- declare type LogoControlMLGL = InstanceType<typeof LogoControlMLGL>;
765
+ type LogoControlMLGL = InstanceType<typeof LogoControlMLGL>;
737
766
  declare const ScaleControlMLGL: typeof maplibre_gl.ScaleControl;
738
- declare type ScaleControlMLGL = InstanceType<typeof ScaleControlMLGL>;
767
+ type ScaleControlMLGL = InstanceType<typeof ScaleControlMLGL>;
739
768
  declare const FullscreenControlMLGL: typeof maplibre_gl.FullscreenControl;
740
- declare type FullscreenControlMLGL = InstanceType<typeof FullscreenControlMLGL>;
769
+ type FullscreenControlMLGL = InstanceType<typeof FullscreenControlMLGL>;
741
770
  declare const TerrainControlMLGL: typeof maplibre_gl.TerrainControl;
742
- declare type TerrainControlMLGL = InstanceType<typeof TerrainControlMLGL>;
771
+ type TerrainControlMLGL = InstanceType<typeof TerrainControlMLGL>;
743
772
  declare const MarkerMLGL: typeof maplibre_gl.Marker;
744
- declare type MarkerMLGL = InstanceType<typeof MarkerMLGL>;
773
+ type MarkerMLGL = InstanceType<typeof MarkerMLGL>;
745
774
  declare const PopupMLGL: typeof maplibre_gl.Popup;
746
- declare type PopupMLGL = InstanceType<typeof PopupMLGL>;
775
+ type PopupMLGL = InstanceType<typeof PopupMLGL>;
747
776
  declare const StyleMLGL: typeof maplibre_gl.Style;
748
- declare type StyleMLGL = InstanceType<typeof StyleMLGL>;
777
+ type StyleMLGL = InstanceType<typeof StyleMLGL>;
749
778
  declare const LngLat: typeof maplibre_gl.LngLat;
750
- declare type LngLat = InstanceType<typeof LngLat>;
779
+ type LngLat = InstanceType<typeof LngLat>;
751
780
  declare const LngLatBounds: typeof maplibre_gl.LngLatBounds;
752
- declare type LngLatBounds = InstanceType<typeof LngLatBounds>;
781
+ type LngLatBounds = InstanceType<typeof LngLatBounds>;
753
782
  declare const MercatorCoordinate: typeof maplibre_gl.MercatorCoordinate;
754
- declare type MercatorCoordinate = InstanceType<typeof MercatorCoordinate>;
783
+ type MercatorCoordinate = InstanceType<typeof MercatorCoordinate>;
755
784
  declare const Evented: typeof maplibre_gl.Evented;
756
- declare type Evented = InstanceType<typeof Evented>;
785
+ type Evented = InstanceType<typeof Evented>;
757
786
  declare const AJAXError: typeof maplibre_gl.AJAXError;
758
- declare type AJAXError = InstanceType<typeof AJAXError>;
787
+ type AJAXError = InstanceType<typeof AJAXError>;
759
788
  declare const CanvasSourceMLGL: typeof maplibre_gl.CanvasSource;
760
- declare type CanvasSourceMLGL = InstanceType<typeof CanvasSourceMLGL>;
789
+ type CanvasSourceMLGL = InstanceType<typeof CanvasSourceMLGL>;
761
790
  declare const GeoJSONSourceMLGL: typeof maplibre_gl.GeoJSONSource;
762
- declare type GeoJSONSourceMLGL = InstanceType<typeof GeoJSONSourceMLGL>;
791
+ type GeoJSONSourceMLGL = InstanceType<typeof GeoJSONSourceMLGL>;
763
792
  declare const ImageSourceMLGL: typeof maplibre_gl.ImageSource;
764
- declare type ImageSourceMLGL = InstanceType<typeof ImageSourceMLGL>;
793
+ type ImageSourceMLGL = InstanceType<typeof ImageSourceMLGL>;
765
794
  declare const RasterDEMTileSourceMLGL: typeof maplibre_gl.RasterDEMTileSource;
766
- declare type RasterDEMTileSourceMLGL = InstanceType<typeof RasterDEMTileSourceMLGL>;
795
+ type RasterDEMTileSourceMLGL = InstanceType<typeof RasterDEMTileSourceMLGL>;
767
796
  declare const RasterTileSourceMLGL: typeof maplibre_gl.RasterTileSource;
768
- declare type RasterTileSourceMLGL = InstanceType<typeof RasterTileSourceMLGL>;
797
+ type RasterTileSourceMLGL = InstanceType<typeof RasterTileSourceMLGL>;
769
798
  declare const VectorTileSourceMLGL: typeof maplibre_gl.VectorTileSource;
770
- declare type VectorTileSourceMLGL = InstanceType<typeof VectorTileSourceMLGL>;
799
+ type VectorTileSourceMLGL = InstanceType<typeof VectorTileSourceMLGL>;
771
800
  declare const VideoSourceMLGL: typeof maplibre_gl.VideoSource;
772
- declare type VideoSourceMLGL = InstanceType<typeof VideoSourceMLGL>;
801
+ type VideoSourceMLGL = InstanceType<typeof VideoSourceMLGL>;
773
802
  declare const MapMLGL: typeof maplibre_gl.Map;
774
- declare type MapMLGL = InstanceType<typeof MapMLGL>;
803
+ type MapMLGL = InstanceType<typeof MapMLGL>;
775
804
 
776
- export { AJAXError, AttributionControl, AttributionControlMLGL, CanvasSource, CanvasSourceMLGL, Evented, FullscreenControl, FullscreenControlMLGL, GeoJSONSource, GeoJSONSourceMLGL, GeolocateControl, GeolocateControlMLGL, GeolocationType, ImageSource, ImageSourceMLGL, Language, LanguageKey, LanguageString, LngLat, LngLatBounds, LogoControl, LogoControlMLGL, Map, MapMLGL, MapOptions, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerTerrainControl, Marker, MarkerMLGL, Matrix2, MercatorCoordinate, NavigationControl, NavigationControlMLGL, Point, Popup, PopupMLGL, RasterDEMTileSource, RasterDEMTileSourceMLGL, RasterTileSource, RasterTileSourceMLGL, ScaleControl, ScaleControlMLGL, SdkConfig, Style, StyleMLGL, TerrainControl, TerrainControlMLGL, Unit, VectorTileSource, VectorTileSourceMLGL, VideoSource, VideoSourceMLGL, addProtocol, clearPrewarmedResources, clearStorage, config, getRTLTextPluginStatus, maxParallelImageRequests, prewarm, removeProtocol, setRTLTextPlugin, supported, version, workerCount, workerUrl };
805
+ export { AJAXError, AttributionControl, AttributionControlMLGL, CanvasSource, CanvasSourceMLGL, Evented, FullscreenControl, FullscreenControlMLGL, GeoJSONSource, GeoJSONSourceMLGL, GeolocateControl, GeolocateControlMLGL, GeolocationType, ImageSource, ImageSourceMLGL, Language, LanguageKey, LanguageString, LngLat, LngLatBounds, LoadWithTerrainEvent, LogoControl, LogoControlMLGL, Map, MapMLGL, MapOptions, MaptilerGeolocateControl, MaptilerLogoControl, MaptilerTerrainControl, Marker, MarkerMLGL, Matrix2, MercatorCoordinate, NavigationControl, NavigationControlMLGL, Point, Popup, PopupMLGL, RasterDEMTileSource, RasterDEMTileSourceMLGL, RasterTileSource, RasterTileSourceMLGL, ScaleControl, ScaleControlMLGL, SdkConfig, Style, StyleMLGL, TerrainControl, TerrainControlMLGL, Unit, VectorTileSource, VectorTileSourceMLGL, VideoSource, VideoSourceMLGL, addProtocol, clearPrewarmedResources, config, getRTLTextPluginStatus, maxParallelImageRequests, prewarm, removeProtocol, setRTLTextPlugin, supported, version, workerCount, workerUrl };
@@ -1 +1 @@
1
- import n from"maplibre-gl";export*from"maplibre-gl";import{Base64 as q}from"js-base64";import{v4 as W}from"uuid";import Y from"events";import{config as T,expandMapStyle as X,MapStyleVariant as Q,ReferenceMapStyle as tt,MapStyle as et,mapStylePresetList as rt,geolocation as v}from"@maptiler/client";import{LanguageGeocoding as me,MapStyle as ye,MapStyleVariant as Ae,ReferenceMapStyle as Le,ServiceError as Se,coordinates as fe,data as _e,geocoding as Ce,geolocation as xe,staticMaps as Te}from"@maptiler/client";const S={AUTO:"auto",LATIN:"latin",NON_LATIN:"nonlatin",LOCAL:"",ALBANIAN:"sq",AMHARIC:"am",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BASQUE:"eu",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CORSICAN:"co",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HINDI:"hi",HUNGARIAN:"hu",ICELANDIC:"is",INDONESIAN:"id",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",JAPANESE_HIRAGANA:"ja-Hira",JAPANESE_KANA:"ja_kana",JAPANESE_LATIN:"ja_rm",JAPANESE_2018:"ja-Latn",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",KOREAN_LATIN:"ko-Latn",KURDISH:"ku",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALAYALAM:"ml",MALTESE:"mt",NORWEGIAN:"no",OCCITAN:"oc",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SERBIAN_LATIN:"sr-Latn",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",TAMIL:"ta",TELUGU:"te",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},at=new Set(Object.values(S));function E(r){return at.has(r)}const nt=new Set(Object.values(S));function b(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const r=Array.from(new Set(navigator.languages.map(t=>t.split("-")[0]))).filter(t=>nt.has(t));return r.length?r[0]:S.LATIN}class N extends Y{constructor(){super(),this.primaryLanguage=S.AUTO,this.secondaryLanguage=null,this.session=!0,this._unit="metric",this._apiKey=""}set unit(t){this._unit=t,this.emit("unit",t)}get unit(){return this._unit}set apiKey(t){this._apiKey=t,T.apiKey=t,this.emit("apiKey",t)}get apiKey(){return this._apiKey}set fetch(t){T.fetch=t}get fetch(){return T.fetch}}const y=new N,p={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.AUTO,secondaryLanguage:S.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(p);class w extends n.LogoControl{onAdd(t){return super.onAdd(t)}}class I extends w{constructor(t={}){var e,i;super(t),this.logoURL="",this.linkURL="",this.logoURL=(e=t.logoURL)!=null?e:p.maptilerLogoURL,this.linkURL=(i=t.linkURL)!=null?i:p.maptilerURL}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const e=window.document.createElement("a");return e.style.backgroundRepeat="no-repeat",e.style.cursor="pointer",e.style.display="block",e.style.height="23px",e.style.margin="0 0 -4px -4px",e.style.overflow="hidden",e.style.width="88px",e.style.backgroundImage=`url(${this.logoURL})`,e.style.backgroundSize="100px 30px",e.style.width="100px",e.style.height="30px",e.target="_blank",e.rel="noopener nofollow",e.href=this.linkURL,e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}function ot(){n.getRTLTextPluginStatus()==="unavailable"&&n.setRTLTextPlugin(p.rtlPluginURL,null,!0)}function it(r,t){r.forEach(e=>{!t[e]||(t[e]=t[e].bind(t))})}function f(r,t,e){const i=window.document.createElement(r);return t!==void 0&&(i.className=t),e&&e.appendChild(i),i}function st(r){r.parentNode&&r.parentNode.removeChild(r)}function R(r){return r?typeof r=="string"||r instanceof String?!r.startsWith("http")&&r.toLowerCase().includes(".json")?r:X(r):r instanceof Q?r.getExpandedStyleURL():r instanceof tt?r.getDefaultVariant().getExpandedStyleURL():r:et[rt[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class P{constructor(){it(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(t){return this._map=t,this._container=f("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=f("button","maplibregl-ctrl-terrain",this._container),f("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.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}}class M extends n.NavigationControl{onAdd(t){return super.onAdd(t)}}class lt extends M{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",t=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})}_createButton(t,e){const i=super._createButton(t,e);return i.clickFunction=e,i}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,this._map.transform.pitch)}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t}}class O extends n.GeolocateControl{onAdd(t){return super.onAdd(t)}}var ct=Object.defineProperty,ht=Object.defineProperties,ut=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,dt=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable,k=(r,t,e)=>t in r?ct(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pt=(r,t)=>{for(var e in t||(t={}))dt.call(t,e)&&k(r,e,t[e]);if(U)for(var e of U(t))gt.call(t,e)&&k(r,e,t[e]);return r},mt=(r,t)=>ht(r,ut(t));const B=n.Marker,$=n.LngLat;class G extends O{constructor(){super(...arguments),this.lastUpdatedCenter=new $(0,0)}_updateCamera(t){const e=new $(t.coords.longitude,t.coords.latitude),i=t.coords.accuracy,h=this._map.getBearing(),g=mt(pt({bearing:h},this.options.fitBoundsOptions),{linear:!0}),l=this._map.getZoom();l>this.options.fitBoundsOptions.maxZoom&&(g.zoom=l),this._map.fitBounds(e.toBounds(i),g,{geolocateSource:!0});let a=!1;const o=()=>{a=!0};this._map.once("click",o),this._map.once("dblclick",o),this._map.once("dragstart",o),this._map.once("mousedown",o),this._map.once("touchstart",o),this._map.once("wheel",o),this._map.once("moveend",()=>{this._map.off("click",o),this._map.off("dblclick",o),this._map.off("dragstart",o),this._map.off("mousedown",o),this._map.off("touchstart",o),this._map.off("wheel",o),!a&&(this.lastUpdatedCenter=this._map.getCenter())})}_setupUI(t){if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=f("button","maplibregl-ctrl-geolocate",this._container),f("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=f("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new B(this._dotElement),this._circleElement=f("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new B({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",e=>{const i=e.originalEvent&&e.originalEvent.type==="resize",h=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!e.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!i&&h>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const t=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],e=this._map.project(t),i=this._map.unproject([e.x,e.y]),h=this._map.unproject([e.x+20,e.y]),g=i.distanceTo(h)/20,l=Math.ceil(2*this._accuracy/g);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}class H extends n.AttributionControl{onAdd(t){return super.onAdd(t)}}class j extends n.ScaleControl{onAdd(t){return super.onAdd(t)}}class K extends n.FullscreenControl{onAdd(t){return super.onAdd(t)}}var yt=Object.defineProperty,At=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,St=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,V=(r,t,e)=>t in r?yt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,F=(r,t)=>{for(var e in t||(t={}))St.call(t,e)&&V(r,e,t[e]);if(D)for(var e of D(t))ft.call(t,e)&&V(r,e,t[e]);return r},z=(r,t)=>At(r,Lt(t)),C=(r,t,e)=>new Promise((i,h)=>{var g=o=>{try{a(e.next(o))}catch(d){h(d)}},l=o=>{try{a(e.throw(o))}catch(d){h(d)}},a=o=>o.done?i(o.value):Promise.resolve(o.value).then(g,l);a((e=e.apply(r,t)).next())});const J=W(),Z={POINT:"POINT",COUNTRY:"COUNTRY"};class _t extends n.Map{constructor(t){var e,i;t.apiKey&&(y.apiKey=t.apiKey);const h=R(t.style),g=location.hash;y.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(z(F({},t),{style:h,maplibreLogo:!1,transformRequest:l=>{let a=null;try{a=new URL(l)}catch{return{url:l,headers:{}}}return a.host===p.maptilerApiHost&&(a.searchParams.has("key")||a.searchParams.append("key",y.apiKey),y.session&&a.searchParams.append("mtsid",J)),{url:a.href,headers:{}}}})),this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.primaryLanguage=null,this.secondaryLanguage=null,this.primaryLanguage=(e=t.language)!=null?e:y.primaryLanguage,this.secondaryLanguage=y.secondaryLanguage,this.once("styledata",()=>C(this,null,function*(){if(!t.geolocate||t.center||t.hash&&!!g)return;try{if(t.geolocate===Z.COUNTRY){yield this.fitToIpBounds();return}}catch(a){console.warn(a.message)}let l=null;try{yield this.centerOnIpPoint(t.zoom),l=this.getCameraHash()}catch(a){console.warn(a.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(a=>{l===this.getCameraHash()&&this.easeTo({center:[a.coords.longitude,a.coords.latitude],zoom:t.zoom||12,duration:2e3})},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage),this.setSecondaryLanguage(this.secondaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>C(this,null,function*(){ot()})),this.once("load",()=>C(this,null,function*(){let l={logo:null};try{const a=Object.keys(this.style.sourceCaches).map(d=>this.getSource(d)).filter(d=>typeof d.url=="string"&&d.url.includes("tiles.json")),o=new URL(a[0].url);o.searchParams.has("key")||o.searchParams.append("key",y.apiKey),l=yield(yield fetch(o.href)).json()}catch{}if("logo"in l&&l.logo){const a=l.logo;this.addControl(new I({logoURL:a}),t.logoPosition),t.attributionControl===!1&&this.addControl(new H(t))}else t.maptilerLogo&&this.addControl(new I,t.logoPosition);if(t.scaleControl){const a=t.scaleControl===!0||t.scaleControl===void 0?"bottom-right":t.scaleControl,o=new j({unit:y.unit});this.addControl(o,a),y.on("unit",d=>{o.setUnit(d)})}if(t.navigationControl!==!1){const a=t.navigationControl===!0||t.navigationControl===void 0?"top-right":t.navigationControl;this.addControl(new lt,a)}if(t.geolocateControl!==!1){const a=t.geolocateControl===!0||t.geolocateControl===void 0?"top-right":t.geolocateControl;this.addControl(new G({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),a)}if(t.terrainControl){const a=t.terrainControl===!0||t.terrainControl===void 0?"top-right":t.terrainControl;this.addControl(new P,a)}if(t.fullscreenControl){const a=t.fullscreenControl===!0||t.fullscreenControl===void 0?"top-right":t.fullscreenControl;this.addControl(new K({}),a)}})),t.terrain&&this.enableTerrain((i=t.terrainExaggeration)!=null?i:this.terrainExaggeration)}setStyle(t,e){return super.setStyle(R(t),e)}setLanguage(t=p.primaryLanguage){if(t===S.AUTO)return this.setLanguage(b());this.setPrimaryLanguage(t)}setPrimaryLanguage(t=p.primaryLanguage){!E(t)||(this.primaryLanguage=t,this.onStyleReady(()=>{if(t===S.AUTO)return this.setPrimaryLanguage(b());const e=this.getStyle().layers,i=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,h=/^\s*name\s*(:\s*(\S*))?\s*$/,g=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/,l=/^(.*)({\s*name\s*(:\s*(\S*))?\s*})(.*)$/,a=t?`name:${t}`:"name",o=["case",["has",a],["get",a],["get","name:latin"]];for(let d=0;d<e.length;d+=1){const u=e[d],A=u.layout;if(!A||!A["text-field"])continue;const s=this.getLayoutProperty(u.id,"text-field");let m;if(Array.isArray(s)&&s.length>=2&&s[0].trim().toLowerCase()==="concat"){const c=s.slice();for(let _=0;_<s.length;_+=1){const L=s[_];if((typeof L=="string"||L instanceof String)&&i.exec(L.toString())){c[_]=o;break}else if(Array.isArray(L)&&L.length>=2&&L[0].trim().toLowerCase()==="get"&&h.exec(L[1].toString())){c[_]=o;break}else if(Array.isArray(L)&&L.length===4&&L[0].trim().toLowerCase()==="case"){c[_]=o;break}}this.setLayoutProperty(u.id,"text-field",c)}else if(Array.isArray(s)&&s.length>=2&&s[0].trim().toLowerCase()==="get"&&h.exec(s[1].toString())){const c=o;this.setLayoutProperty(u.id,"text-field",c)}else if((typeof s=="string"||s instanceof String)&&i.exec(s.toString())){const c=o;this.setLayoutProperty(u.id,"text-field",c)}else if(Array.isArray(s)&&s.length===4&&s[0].trim().toLowerCase()==="case"){const c=o;this.setLayoutProperty(u.id,"text-field",c)}else if((typeof s=="string"||s instanceof String)&&(m=g.exec(s.toString()))!==null){const c=`{${a}}${m[3]}{name${m[4]||""}}`;this.setLayoutProperty(u.id,"text-field",c)}else if((typeof s=="string"||s instanceof String)&&(m=l.exec(s.toString()))!==null){const c=`${m[1]}{${a}}${m[5]}`;this.setLayoutProperty(u.id,"text-field",c)}}}))}setSecondaryLanguage(t=p.secondaryLanguage){!E(t)||(this.secondaryLanguage=t,this.onStyleReady(()=>{if(t===S.AUTO)return this.setSecondaryLanguage(b());const e=this.getStyle().layers,i=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,h=/^\s*name\s*(:\s*(\S*))?\s*$/,g=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/;let l;for(let a=0;a<e.length;a+=1){const o=e[a],d=o.layout;if(!d||!d["text-field"])continue;const u=this.getLayoutProperty(o.id,"text-field");let A;if(Array.isArray(u)&&u.length>=2&&u[0].trim().toLowerCase()==="concat"){A=u.slice();let s=0;for(let m=0;m<u.length;m+=1){const c=u[m];if((typeof c=="string"||c instanceof String)&&i.exec(c.toString())){if(s===1){A[m]=`{name:${t}}`;break}s+=1}else if(Array.isArray(c)&&c.length>=2&&c[0].trim().toLowerCase()==="get"&&h.exec(c[1].toString())){if(s===1){A[m][1]=`name:${t}`;break}s+=1}else if(Array.isArray(c)&&c.length===4&&c[0].trim().toLowerCase()==="case"){if(s===1){A[m]=["get",`name:${t}`];break}s+=1}}this.setLayoutProperty(o.id,"text-field",A)}else if((typeof u=="string"||u instanceof String)&&(l=g.exec(u.toString()))!==null){const s=t?`name:${t}`:"name";A=`{name${l[1]||""}}${l[3]}{${s}}`,this.setLayoutProperty(o.id,"text-field",A)}}}))}getPrimaryLanguage(){return this.primaryLanguage}getSecondaryLanguage(){return this.secondaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}enableTerrain(t=this.terrainExaggeration){if(t<0){console.warn("Terrain exaggeration cannot be negative.");return}const e=this.getTerrain(),i=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=t,this.addSource(p.terrainSourceId,{type:"raster-dem",url:p.terrainSourceURL}),this.setTerrain({source:p.terrainSourceId,exaggeration:t})};if(e){this.setTerrain(z(F({},e),{exaggeration:t}));return}this.loaded()||this.isTerrainEnabled?i():this.once("load",()=>{this.getTerrain()&&this.getSource(p.terrainSourceId)||i()})}disableTerrain(){this.isTerrainEnabled=!1,this.setTerrain(null),this.getSource(p.terrainSourceId)&&this.removeSource(p.terrainSourceId)}setTerrainExaggeration(t){this.enableTerrain(t)}onStyleReady(t){this.isStyleLoaded()?t():this.once("styledata",()=>{t()})}fitToIpBounds(){return C(this,null,function*(){const t=yield v.info();this.fitBounds(t.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(t){return C(this,null,function*(){const e=yield v.info();this.jumpTo({center:[e.longitude,e.latitude],zoom:t||11})})}getCameraHash(){const t=new Float32Array(5),e=this.getCenter();return t[0]=e.lng,t[1]=e.lat,t[2]=this.getZoom(),t[3]=this.getPitch(),t[4]=this.getBearing(),q.fromUint8Array(new Uint8Array(t.buffer))}getSdkConfig(){return y}getMaptilerSessionId(){return J}}class Ct extends n.Marker{addTo(t){return super.addTo(t)}}class xt extends n.Popup{addTo(t){return super.addTo(t)}}class Tt extends n.Style{constructor(t,e={}){super(t,e)}}class bt extends n.CanvasSource{onAdd(t){super.onAdd(t)}}class It extends n.GeoJSONSource{onAdd(t){super.onAdd(t)}}class vt extends n.ImageSource{onAdd(t){super.onAdd(t)}}class Et extends n.RasterTileSource{onAdd(t){super.onAdd(t)}}class Nt extends n.RasterDEMTileSource{onAdd(t){super.onAdd(t)}}class wt extends n.VectorTileSource{onAdd(t){super.onAdd(t)}}class Rt extends n.VideoSource{onAdd(t){super.onAdd(t)}}class Pt extends n.TerrainControl{onAdd(t){return super.onAdd(t)}}class x{constructor(t,e){this.x=t,this.y=e}_matMult(t){const e=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=i,this}_add(t){return this.x+=t.x,this.y+=t.y,this}_sub(t){return this.x-=t.x,this.y-=t.y,this}_mult(t){return this.x*=t,this.y*=t,this}_div(t){return this.x/=t,this.y/=t,this}_multByPoint(t){return this.x*=t.x,this.y*=t.y,this}_divByPoint(t){return this.x/=t.x,this.y/=t.y,this}_unit(){return this._div(this.mag()),this}_perp(){const t=this.y;return this.y=this.x,this.x=-t,this}_rotate(t){const e=Math.cos(t),i=Math.sin(t),h=e*this.x-i*this.y,g=i*this.x+e*this.y;return this.x=h,this.y=g,this}_rotateAround(t,e){const i=Math.cos(t),h=Math.sin(t),g=e.x+i*(this.x-e.x)-h*(this.y-e.y),l=e.y+h*(this.x-e.x)+i*(this.y-e.y);return this.x=g,this.y=l,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new x(this.x,this.y)}add(t){return this.clone()._add(t)}sub(t){return this.clone()._sub(t)}multByPoint(t){return this.clone()._multByPoint(t)}divByPoint(t){return this.clone()._divByPoint(t)}mult(t){return this.clone()._mult(t)}div(t){return this.clone()._div(t)}rotate(t){return this.clone()._rotate(t)}rotateAround(t,e){return this.clone()._rotateAround(t,e)}matMult(t){return this.clone()._matMult(t)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}round(){return this.clone()._round()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}equals(t){return this.x===t.x&&this.y===t.y}dist(t){return Math.sqrt(this.distSqr(t))}distSqr(t){const e=t.x-this.x,i=t.y-this.y;return e*e+i*i}angle(){return Math.atan2(this.y,this.x)}angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)}angleWith(t){return this.angleWithSep(t.x,t.y)}angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)}static convert(t){return t instanceof x?t:Array.isArray(t)?new x(t[0],t[1]):t}}const{supported:Mt,setRTLTextPlugin:Ot,getRTLTextPluginStatus:Ut,LngLat:kt,LngLatBounds:Bt,MercatorCoordinate:$t,Evented:Gt,AJAXError:Ht,prewarm:jt,clearPrewarmedResources:Kt,version:Dt,workerCount:Vt,maxParallelImageRequests:Ft,clearStorage:zt,workerUrl:Jt,addProtocol:Zt,removeProtocol:qt}=n,Wt=n.Map,Yt=n.Marker,Xt=n.Popup,Qt=n.Style,te=n.CanvasSource,ee=n.GeoJSONSource,re=n.ImageSource,ae=n.RasterTileSource,ne=n.RasterDEMTileSource,oe=n.VectorTileSource,ie=n.VideoSource;n.NavigationControl,n.GeolocateControl,n.AttributionControl,n.LogoControl,n.ScaleControl,n.FullscreenControl,n.TerrainControl;export{Ht as AJAXError,H as AttributionControl,bt as CanvasSource,te as CanvasSourceMLGL,Gt as Evented,K as FullscreenControl,It as GeoJSONSource,ee as GeoJSONSourceMLGL,O as GeolocateControl,Z as GeolocationType,vt as ImageSource,re as ImageSourceMLGL,S as Language,me as LanguageGeocoding,kt as LngLat,Bt as LngLatBounds,w as LogoControl,_t as Map,Wt as MapMLGL,ye as MapStyle,Ae as MapStyleVariant,G as MaptilerGeolocateControl,I as MaptilerLogoControl,P as MaptilerTerrainControl,Ct as Marker,Yt as MarkerMLGL,$t as MercatorCoordinate,M as NavigationControl,x as Point,xt as Popup,Xt as PopupMLGL,Nt as RasterDEMTileSource,ne as RasterDEMTileSourceMLGL,Et as RasterTileSource,ae as RasterTileSourceMLGL,Le as ReferenceMapStyle,j as ScaleControl,N as SdkConfig,Se as ServiceError,Tt as Style,Qt as StyleMLGL,Pt as TerrainControl,wt as VectorTileSource,oe as VectorTileSourceMLGL,Rt as VideoSource,ie as VideoSourceMLGL,Zt as addProtocol,Kt as clearPrewarmedResources,zt as clearStorage,y as config,fe as coordinates,_e as data,Ce as geocoding,xe as geolocation,Ut as getRTLTextPluginStatus,Ft as maxParallelImageRequests,jt as prewarm,qt as removeProtocol,Ot as setRTLTextPlugin,Te as staticMaps,Mt as supported,Dt as version,Vt as workerCount,Jt as workerUrl};
1
+ import a from"maplibre-gl";export*from"maplibre-gl";import{Base64 as q}from"js-base64";import{v4 as W}from"uuid";import J from"events";import{config as T,expandMapStyle as Z,MapStyleVariant as Y,ReferenceMapStyle as X,MapStyle as Q,mapStylePresetList as tt,geolocation as w}from"@maptiler/client";import{LanguageGeocoding as me,MapStyle as ye,MapStyleVariant as Ae,ReferenceMapStyle as fe,ServiceError as Le,coordinates as _e,data as Se,geocoding as xe,geolocation as Ce,staticMaps as Te}from"@maptiler/client";const L={AUTO:"auto",LATIN:"latin",NON_LATIN:"nonlatin",LOCAL:"",ALBANIAN:"sq",AMHARIC:"am",ARABIC:"ar",ARMENIAN:"hy",AZERBAIJANI:"az",BASQUE:"eu",BELORUSSIAN:"be",BOSNIAN:"bs",BRETON:"br",BULGARIAN:"bg",CATALAN:"ca",CHINESE:"zh",CORSICAN:"co",CROATIAN:"hr",CZECH:"cs",DANISH:"da",DUTCH:"nl",ENGLISH:"en",ESPERANTO:"eo",ESTONIAN:"et",FINNISH:"fi",FRENCH:"fr",FRISIAN:"fy",GEORGIAN:"ka",GERMAN:"de",GREEK:"el",HEBREW:"he",HINDI:"hi",HUNGARIAN:"hu",ICELANDIC:"is",INDONESIAN:"id",IRISH:"ga",ITALIAN:"it",JAPANESE:"ja",JAPANESE_HIRAGANA:"ja-Hira",JAPANESE_KANA:"ja_kana",JAPANESE_LATIN:"ja_rm",JAPANESE_2018:"ja-Latn",KANNADA:"kn",KAZAKH:"kk",KOREAN:"ko",KOREAN_LATIN:"ko-Latn",KURDISH:"ku",ROMAN_LATIN:"la",LATVIAN:"lv",LITHUANIAN:"lt",LUXEMBOURGISH:"lb",MACEDONIAN:"mk",MALAYALAM:"ml",MALTESE:"mt",NORWEGIAN:"no",OCCITAN:"oc",POLISH:"pl",PORTUGUESE:"pt",ROMANIAN:"ro",ROMANSH:"rm",RUSSIAN:"ru",SCOTTISH_GAELIC:"gd",SERBIAN_CYRILLIC:"sr",SERBIAN_LATIN:"sr-Latn",SLOVAK:"sk",SLOVENE:"sl",SPANISH:"es",SWEDISH:"sv",TAMIL:"ta",TELUGU:"te",THAI:"th",TURKISH:"tr",UKRAINIAN:"uk",WELSH:"cy"},et=new Set(Object.values(L));function v(r){return et.has(r)}const rt=new Set(Object.values(L));function b(){if(typeof navigator>"u")return Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];const r=Array.from(new Set(navigator.languages.map(t=>t.split("-")[0]))).filter(t=>rt.has(t));return r.length?r[0]:L.LATIN}let E=class extends J{constructor(){super(),this.primaryLanguage=L.AUTO,this.secondaryLanguage=null,this.session=!0,this._unit="metric",this._apiKey=""}set unit(t){this._unit=t,this.emit("unit",t)}get unit(){return this._unit}set apiKey(t){this._apiKey=t,T.apiKey=t,this.emit("apiKey",t)}get apiKey(){return this._apiKey}set fetch(t){T.fetch=t}get fetch(){return T.fetch}};const A=new E,y={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:L.AUTO,secondaryLanguage:L.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(y);class N extends a.LogoControl{onAdd(t){return super.onAdd(t)}}class I extends N{constructor(t={}){var e,n;super(t),this.logoURL="",this.linkURL="",this.logoURL=(e=t.logoURL)!=null?e:y.maptilerLogoURL,this.linkURL=(n=t.linkURL)!=null?n:y.maptilerURL}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const e=window.document.createElement("a");return e.style.backgroundRepeat="no-repeat",e.style.cursor="pointer",e.style.display="block",e.style.height="23px",e.style.margin="0 0 -4px -4px",e.style.overflow="hidden",e.style.width="88px",e.style.backgroundImage=`url(${this.logoURL})`,e.style.backgroundSize="100px 30px",e.style.width="100px",e.style.height="30px",e.target="_blank",e.rel="noopener nofollow",e.href=this.linkURL,e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}function it(){a.getRTLTextPluginStatus()==="unavailable"&&a.setRTLTextPlugin(y.rtlPluginURL,null,!0)}function nt(r,t){r.forEach(e=>{t[e]&&(t[e]=t[e].bind(t))})}function S(r,t,e){const n=window.document.createElement(r);return t!==void 0&&(n.className=t),e&&e.appendChild(n),n}function at(r){r.parentNode&&r.parentNode.removeChild(r)}function R(r){return r?typeof r=="string"||r instanceof String?!r.startsWith("http")&&r.toLowerCase().includes(".json")?r:Z(r):r instanceof Y?r.getExpandedStyleURL():r instanceof X?r.getDefaultVariant().getExpandedStyleURL():r:Q[tt[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL()}class P{constructor(){nt(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(t){return this._map=t,this._container=S("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=S("button","maplibregl-ctrl-terrain",this._container),S("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(){at(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}}class M extends a.NavigationControl{onAdd(t){return super.onAdd(t)}}class ot extends M{constructor(){super({showCompass:!0,showZoom:!0,visualizePitch:!0}),this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",t=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})}_createButton(t,e){const n=super._createButton(t,e);return n.clickFunction=e,n}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5))}) rotateX(${Math.min(70,this._map.transform.pitch)}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t}}class O extends a.GeolocateControl{onAdd(t){return super.onAdd(t)}}var st=Object.defineProperty,lt=Object.defineProperties,ct=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable,k=(r,t,e)=>t in r?st(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,dt=(r,t)=>{for(var e in t||(t={}))ht.call(t,e)&&k(r,e,t[e]);if(U)for(var e of U(t))ut.call(t,e)&&k(r,e,t[e]);return r},gt=(r,t)=>lt(r,ct(t));const B=a.Marker,$=a.LngLat;class G extends O{constructor(){super(...arguments),this.lastUpdatedCenter=new $(0,0)}_updateCamera(t){const e=new $(t.coords.longitude,t.coords.latitude),n=t.coords.accuracy,s=this._map.getBearing(),d=gt(dt({bearing:s},this.options.fitBoundsOptions),{linear:!0}),u=this._map.getZoom();u>this.options.fitBoundsOptions.maxZoom&&(d.zoom=u),this._map.fitBounds(e.toBounds(n),d,{geolocateSource:!0});let h=!1;const o=()=>{h=!0};this._map.once("click",o),this._map.once("dblclick",o),this._map.once("dragstart",o),this._map.once("mousedown",o),this._map.once("touchstart",o),this._map.once("wheel",o),this._map.once("moveend",()=>{this._map.off("click",o),this._map.off("dblclick",o),this._map.off("dragstart",o),this._map.off("mousedown",o),this._map.off("touchstart",o),this._map.off("wheel",o),!h&&(this.lastUpdatedCenter=this._map.getCenter())})}_setupUI(t){if(this.lastUpdatedCenter=this._map.getCenter(),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=S("button","maplibregl-ctrl-geolocate",this._container),S("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=S("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new B(this._dotElement),this._circleElement=S("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new B({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",e=>{const n=e.originalEvent&&e.originalEvent.type==="resize",s=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!e.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!n&&s>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const t=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],e=this._map.project(t),n=this._map.unproject([e.x,e.y]),s=this._map.unproject([e.x+20,e.y]),d=n.distanceTo(s)/20,u=Math.ceil(2*this._accuracy/d);this._circleElement.style.width=`${u}px`,this._circleElement.style.height=`${u}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}}class H extends a.AttributionControl{onAdd(t){return super.onAdd(t)}}class j extends a.ScaleControl{onAdd(t){return super.onAdd(t)}}class K extends a.FullscreenControl{onAdd(t){return super.onAdd(t)}}var pt=Object.defineProperty,mt=Object.defineProperties,yt=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,D=(r,t,e)=>t in r?pt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Lt=(r,t)=>{for(var e in t||(t={}))At.call(t,e)&&D(r,e,t[e]);if(F)for(var e of F(t))ft.call(t,e)&&D(r,e,t[e]);return r},_t=(r,t)=>mt(r,yt(t)),_=(r,t,e)=>new Promise((n,s)=>{var d=o=>{try{h(e.next(o))}catch(m){s(m)}},u=o=>{try{h(e.throw(o))}catch(m){s(m)}},h=o=>o.done?n(o.value):Promise.resolve(o.value).then(d,u);h((e=e.apply(r,t)).next())});const V=W(),z={POINT:"POINT",COUNTRY:"COUNTRY"};class St extends a.Map{constructor(t){var e,n,s;t.apiKey&&(A.apiKey=t.apiKey);const d=R(t.style),u=location.hash;A.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!"),super(_t(Lt({},t),{style:d,maplibreLogo:!1,transformRequest:c=>{let i=null;try{i=new URL(c)}catch{return{url:c,headers:{}}}return i.host===y.maptilerApiHost&&(i.searchParams.has("key")||i.searchParams.append("key",A.apiKey),A.session&&i.searchParams.append("mtsid",V)),{url:i.href,headers:{}}}})),this.isTerrainEnabled=!1,this.terrainExaggeration=1,this.primaryLanguage=null,this.secondaryLanguage=null,this.terrainGrowing=!1,this.terrainFlattening=!1,this.primaryLanguage=(e=t.language)!=null?e:A.primaryLanguage,this.secondaryLanguage=A.secondaryLanguage,this.terrainExaggeration=(n=t.terrainExaggeration)!=null?n:this.terrainExaggeration,this.once("styledata",()=>_(this,null,function*(){if(!t.geolocate||t.center||t.hash&&u)return;try{if(t.geolocate===z.COUNTRY){yield this.fitToIpBounds();return}}catch(i){console.warn(i.message)}let c=null;try{yield this.centerOnIpPoint(t.zoom),c=this.getCameraHash()}catch(i){console.warn(i.message)}(yield navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(i=>{c===this.getCameraHash()&&(this.terrain?this.easeTo({center:[i.coords.longitude,i.coords.latitude],zoom:t.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[i.coords.longitude,i.coords.latitude],zoom:t.zoom||12,duration:2e3})}))},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage),this.setSecondaryLanguage(this.secondaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",()=>_(this,null,function*(){it()})),this.once("load",()=>_(this,null,function*(){let c={logo:null};try{const i=Object.keys(this.style.sourceCaches).map(l=>this.getSource(l)).filter(l=>typeof l.url=="string"&&l.url.includes("tiles.json")),p=new URL(i[0].url);p.searchParams.has("key")||p.searchParams.append("key",A.apiKey),c=yield(yield fetch(p.href)).json()}catch{}if("logo"in c&&c.logo){const i=c.logo;this.addControl(new I({logoURL:i}),t.logoPosition),t.attributionControl===!1&&this.addControl(new H(t))}else t.maptilerLogo&&this.addControl(new I,t.logoPosition);if(t.scaleControl){const i=t.scaleControl===!0||t.scaleControl===void 0?"bottom-right":t.scaleControl,p=new j({unit:A.unit});this.addControl(p,i),A.on("unit",l=>{p.setUnit(l)})}if(t.navigationControl!==!1){const i=t.navigationControl===!0||t.navigationControl===void 0?"top-right":t.navigationControl;this.addControl(new ot,i)}if(t.geolocateControl!==!1){const i=t.geolocateControl===!0||t.geolocateControl===void 0?"top-right":t.geolocateControl;this.addControl(new G({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),i)}if(t.terrainControl){const i=t.terrainControl===!0||t.terrainControl===void 0?"top-right":t.terrainControl;this.addControl(new P,i)}if(t.fullscreenControl){const i=t.fullscreenControl===!0||t.fullscreenControl===void 0?"top-right":t.fullscreenControl;this.addControl(new K({}),i)}}));let h=!1,o=!1,m=null;this.once("load",c=>{h=!0,o&&this.fire("loadWithTerrain",m)});const g=c=>{c.terrain&&(o=!0,m={type:"loadWithTerrain",target:this,terrain:c.terrain},this.off("terrain",g),h&&this.fire("loadWithTerrain",m))};this.on("terrain",g),t.terrain&&this.enableTerrain((s=t.terrainExaggeration)!=null?s:this.terrainExaggeration)}onLoadAsync(){return _(this,null,function*(){return new Promise((t,e)=>{if(this.loaded())return t(this);this.once("load",n=>{t(this)})})})}onLoadWithTerrainAsync(){return _(this,null,function*(){return new Promise((t,e)=>{if(this.loaded()&&this.terrain)return t(this);this.once("loadWithTerrain",n=>{t(this)})})})}setStyle(t,e){return super.setStyle(R(t),e)}setLanguage(t=y.primaryLanguage){if(t===L.AUTO)return this.setLanguage(b());this.setPrimaryLanguage(t)}setPrimaryLanguage(t=y.primaryLanguage){v(t)&&(this.primaryLanguage=t,this.onStyleReady(()=>{if(t===L.AUTO)return this.setPrimaryLanguage(b());const e=this.getStyle().layers,n=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,s=/^\s*name\s*(:\s*(\S*))?\s*$/,d=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/,u=/^(.*)({\s*name\s*(:\s*(\S*))?\s*})(.*)$/,h=t?`name:${t}`:"name",o=["case",["has",h],["get",h],["get","name:latin"]];for(let m=0;m<e.length;m+=1){const g=e[m],c=g.layout;if(!c||!c["text-field"])continue;const i=this.getLayoutProperty(g.id,"text-field");let p;if(Array.isArray(i)&&i.length>=2&&i[0].trim().toLowerCase()==="concat"){const l=i.slice();for(let x=0;x<i.length;x+=1){const f=i[x];if((typeof f=="string"||f instanceof String)&&n.exec(f.toString())){l[x]=o;break}else if(Array.isArray(f)&&f.length>=2&&f[0].trim().toLowerCase()==="get"&&s.exec(f[1].toString())){l[x]=o;break}else if(Array.isArray(f)&&f.length===4&&f[0].trim().toLowerCase()==="case"){l[x]=o;break}}this.setLayoutProperty(g.id,"text-field",l)}else if(Array.isArray(i)&&i.length>=2&&i[0].trim().toLowerCase()==="get"&&s.exec(i[1].toString())){const l=o;this.setLayoutProperty(g.id,"text-field",l)}else if((typeof i=="string"||i instanceof String)&&n.exec(i.toString())){const l=o;this.setLayoutProperty(g.id,"text-field",l)}else if(Array.isArray(i)&&i.length===4&&i[0].trim().toLowerCase()==="case"){const l=o;this.setLayoutProperty(g.id,"text-field",l)}else if((typeof i=="string"||i instanceof String)&&(p=d.exec(i.toString()))!==null){const l=`{${h}}${p[3]}{name${p[4]||""}}`;this.setLayoutProperty(g.id,"text-field",l)}else if((typeof i=="string"||i instanceof String)&&(p=u.exec(i.toString()))!==null){const l=`${p[1]}{${h}}${p[5]}`;this.setLayoutProperty(g.id,"text-field",l)}}}))}setSecondaryLanguage(t=y.secondaryLanguage){v(t)&&(this.secondaryLanguage=t,this.onStyleReady(()=>{if(t===L.AUTO)return this.setSecondaryLanguage(b());const e=this.getStyle().layers,n=/^\s*{\s*name\s*(:\s*(\S*))?\s*}$/,s=/^\s*name\s*(:\s*(\S*))?\s*$/,d=/^\s*{\s*name\s*(:\s*(\S*))?\s*}(\s*){\s*name\s*(:\s*(\S*))?\s*}$/;let u;for(let h=0;h<e.length;h+=1){const o=e[h],m=o.layout;if(!m||!m["text-field"])continue;const g=this.getLayoutProperty(o.id,"text-field");let c;if(Array.isArray(g)&&g.length>=2&&g[0].trim().toLowerCase()==="concat"){c=g.slice();let i=0;for(let p=0;p<g.length;p+=1){const l=g[p];if((typeof l=="string"||l instanceof String)&&n.exec(l.toString())){if(i===1){c[p]=`{name:${t}}`;break}i+=1}else if(Array.isArray(l)&&l.length>=2&&l[0].trim().toLowerCase()==="get"&&s.exec(l[1].toString())){if(i===1){c[p][1]=`name:${t}`;break}i+=1}else if(Array.isArray(l)&&l.length===4&&l[0].trim().toLowerCase()==="case"){if(i===1){c[p]=["get",`name:${t}`];break}i+=1}}this.setLayoutProperty(o.id,"text-field",c)}else if((typeof g=="string"||g instanceof String)&&(u=d.exec(g.toString()))!==null){const i=t?`name:${t}`:"name";c=`{name${u[1]||""}}${u[3]}{${i}}`,this.setLayoutProperty(o.id,"text-field",c)}}}))}getPrimaryLanguage(){return this.primaryLanguage}getSecondaryLanguage(){return this.secondaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(t,e=1e3){if(!this.terrain)return;const n=performance.now(),s=this.terrain.exaggeration,d=t-s,u=()=>{if(!this.terrain||this.terrainFlattening)return;const h=(performance.now()-n)/e;if(h<.99){const o=1-Math.pow(1-h,4),m=s+o*d;this.terrain.exaggeration=m,requestAnimationFrame(u)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=t;this.triggerRepaint()};this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(u)}enableTerrain(t=this.terrainExaggeration){if(t<0){console.warn("Terrain exaggeration cannot be negative.");return}const e=s=>_(this,null,function*(){!this.terrain||s.type!=="data"||s.dataType!=="source"||!("source"in s)||s.sourceId!=="maptiler-terrain"||s.source.type!=="raster-dem"||s.isSourceLoaded&&(this.off("data",e),this.growTerrain(t))}),n=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=t,this.on("data",e),this.addSource(y.terrainSourceId,{type:"raster-dem",url:y.terrainSourceURL}),this.setTerrain({source:y.terrainSourceId,exaggeration:0})};if(this.getTerrain()){this.isTerrainEnabled=!0,this.growTerrain(t);return}this.loaded()||this.isTerrainEnabled?n():this.once("load",()=>{this.getTerrain()&&this.getSource(y.terrainSourceId)||n()})}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const t=1*1e3,e=performance.now(),n=this.terrain.exaggeration,s=()=>{if(!this.terrain||this.terrainGrowing)return;const d=(performance.now()-e)/t;if(d<.99){const u=Math.pow(1-d,4),h=n*u;this.terrain.exaggeration=h,requestAnimationFrame(s)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(null),this.getSource(y.terrainSourceId)&&this.removeSource(y.terrainSourceId);this.triggerRepaint()};this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(s)}setTerrainExaggeration(t,e=!0){!e&&this.terrain?(this.terrainExaggeration=t,this.terrain.exaggeration=t,this.triggerRepaint()):this.enableTerrain(t)}onStyleReady(t){this.isStyleLoaded()?t():this.once("styledata",()=>{t()})}fitToIpBounds(){return _(this,null,function*(){const t=yield w.info();this.fitBounds(t.country_bounds,{duration:0,padding:100})})}centerOnIpPoint(t){return _(this,null,function*(){const e=yield w.info();this.jumpTo({center:[e.longitude,e.latitude],zoom:t||11})})}getCameraHash(){const t=new Float32Array(5),e=this.getCenter();return t[0]=e.lng,t[1]=e.lat,t[2]=this.getZoom(),t[3]=this.getPitch(),t[4]=this.getBearing(),q.fromUint8Array(new Uint8Array(t.buffer))}getSdkConfig(){return A}getMaptilerSessionId(){return V}}class xt extends a.Marker{addTo(t){return super.addTo(t)}}class Ct extends a.Popup{addTo(t){return super.addTo(t)}}class Tt extends a.Style{constructor(t,e={}){super(t,e)}}class bt extends a.CanvasSource{onAdd(t){super.onAdd(t)}}class It extends a.GeoJSONSource{onAdd(t){super.onAdd(t)}}class wt extends a.ImageSource{onAdd(t){super.onAdd(t)}}class vt extends a.RasterTileSource{onAdd(t){super.onAdd(t)}}class Et extends a.RasterDEMTileSource{onAdd(t){super.onAdd(t)}}class Nt extends a.VectorTileSource{onAdd(t){super.onAdd(t)}}class Rt extends a.VideoSource{onAdd(t){super.onAdd(t)}}class Pt extends a.TerrainControl{onAdd(t){return super.onAdd(t)}}class C{constructor(t,e){this.x=t,this.y=e}_matMult(t){const e=t[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this}_add(t){return this.x+=t.x,this.y+=t.y,this}_sub(t){return this.x-=t.x,this.y-=t.y,this}_mult(t){return this.x*=t,this.y*=t,this}_div(t){return this.x/=t,this.y/=t,this}_multByPoint(t){return this.x*=t.x,this.y*=t.y,this}_divByPoint(t){return this.x/=t.x,this.y/=t.y,this}_unit(){return this._div(this.mag()),this}_perp(){const t=this.y;return this.y=this.x,this.x=-t,this}_rotate(t){const e=Math.cos(t),n=Math.sin(t),s=e*this.x-n*this.y,d=n*this.x+e*this.y;return this.x=s,this.y=d,this}_rotateAround(t,e){const n=Math.cos(t),s=Math.sin(t),d=e.x+n*(this.x-e.x)-s*(this.y-e.y),u=e.y+s*(this.x-e.x)+n*(this.y-e.y);return this.x=d,this.y=u,this}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}clone(){return new C(this.x,this.y)}add(t){return this.clone()._add(t)}sub(t){return this.clone()._sub(t)}multByPoint(t){return this.clone()._multByPoint(t)}divByPoint(t){return this.clone()._divByPoint(t)}mult(t){return this.clone()._mult(t)}div(t){return this.clone()._div(t)}rotate(t){return this.clone()._rotate(t)}rotateAround(t,e){return this.clone()._rotateAround(t,e)}matMult(t){return this.clone()._matMult(t)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}round(){return this.clone()._round()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}equals(t){return this.x===t.x&&this.y===t.y}dist(t){return Math.sqrt(this.distSqr(t))}distSqr(t){const e=t.x-this.x,n=t.y-this.y;return e*e+n*n}angle(){return Math.atan2(this.y,this.x)}angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)}angleWith(t){return this.angleWithSep(t.x,t.y)}angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)}static convert(t){return t instanceof C?t:Array.isArray(t)?new C(t[0],t[1]):t}}const{supported:Mt,setRTLTextPlugin:Ot,getRTLTextPluginStatus:Ut,LngLat:kt,LngLatBounds:Bt,MercatorCoordinate:$t,Evented:Gt,AJAXError:Ht,prewarm:jt,clearPrewarmedResources:Kt,version:Ft,workerCount:Dt,maxParallelImageRequests:Vt,workerUrl:zt,addProtocol:qt,removeProtocol:Wt}=a,Jt=a.Map,Zt=a.Marker,Yt=a.Popup,Xt=a.Style,Qt=a.CanvasSource,te=a.GeoJSONSource,ee=a.ImageSource,re=a.RasterTileSource,ie=a.RasterDEMTileSource,ne=a.VectorTileSource,ae=a.VideoSource;a.NavigationControl,a.GeolocateControl,a.AttributionControl,a.LogoControl,a.ScaleControl,a.FullscreenControl,a.TerrainControl;export{Ht as AJAXError,H as AttributionControl,bt as CanvasSource,Qt as CanvasSourceMLGL,Gt as Evented,K as FullscreenControl,It as GeoJSONSource,te as GeoJSONSourceMLGL,O as GeolocateControl,z as GeolocationType,wt as ImageSource,ee as ImageSourceMLGL,L as Language,me as LanguageGeocoding,kt as LngLat,Bt as LngLatBounds,N as LogoControl,St as Map,Jt as MapMLGL,ye as MapStyle,Ae as MapStyleVariant,G as MaptilerGeolocateControl,I as MaptilerLogoControl,P as MaptilerTerrainControl,xt as Marker,Zt as MarkerMLGL,$t as MercatorCoordinate,M as NavigationControl,C as Point,Ct as Popup,Yt as PopupMLGL,Et as RasterDEMTileSource,ie as RasterDEMTileSourceMLGL,vt as RasterTileSource,re as RasterTileSourceMLGL,fe as ReferenceMapStyle,j as ScaleControl,E as SdkConfig,Le as ServiceError,Tt as Style,Xt as StyleMLGL,Pt as TerrainControl,Nt as VectorTileSource,ne as VectorTileSourceMLGL,Rt as VideoSource,ae as VideoSourceMLGL,qt as addProtocol,Kt as clearPrewarmedResources,A as config,_e as coordinates,Se as data,xe as geocoding,Ce as geolocation,Ut as getRTLTextPluginStatus,Vt as maxParallelImageRequests,jt as prewarm,Wt as removeProtocol,Ot as setRTLTextPlugin,Te as staticMaps,Mt as supported,Ft as version,Dt as workerCount,zt as workerUrl};