@maptiler/client 2.4.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/maptiler-client.cjs +73 -62
- package/dist/maptiler-client.cjs.map +1 -1
- package/dist/maptiler-client.d.ts +11 -4
- package/dist/maptiler-client.min.mjs +1 -1
- package/dist/maptiler-client.mjs +73 -63
- package/dist/maptiler-client.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -59,6 +59,7 @@ declare function getTileCache(): QuickLRU<string, PixelData>;
|
|
|
59
59
|
*/
|
|
60
60
|
declare function bufferToPixelDataBrowser(buff: ArrayBuffer): Promise<PixelData>;
|
|
61
61
|
declare function getBufferToPixelDataParser(): BufferToPixelDataFunction;
|
|
62
|
+
declare function canParsePixelData(): boolean;
|
|
62
63
|
|
|
63
64
|
type FetchFunction = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
64
65
|
/**
|
|
@@ -78,7 +79,7 @@ declare class ClientConfig {
|
|
|
78
79
|
* Number of tiles to keep in cache
|
|
79
80
|
*/
|
|
80
81
|
tileCacheSize: number;
|
|
81
|
-
bufferToPixelData
|
|
82
|
+
bufferToPixelData?: BufferToPixelDataFunction | null;
|
|
82
83
|
/**
|
|
83
84
|
* Set the MapTiler Cloud API key
|
|
84
85
|
*/
|
|
@@ -2110,10 +2111,16 @@ type ElevationAtOptions = {
|
|
|
2110
2111
|
*/
|
|
2111
2112
|
apiKey?: string;
|
|
2112
2113
|
/**
|
|
2113
|
-
* Zoom level to use for the terrain
|
|
2114
|
-
* If not provided, the highest zoom level will be used
|
|
2114
|
+
* Zoom level to use for the terrain tileset in `client` mode.
|
|
2115
|
+
* If not provided, the highest zoom level will be used.
|
|
2115
2116
|
*/
|
|
2116
2117
|
zoom?: number;
|
|
2118
|
+
/**
|
|
2119
|
+
* If set to `client`, the elevation will be computed from the terrain tiles on the client side.
|
|
2120
|
+
* If set to `server`, the elevation will be obtained from the MapTiler Elevation API.
|
|
2121
|
+
* Defaults to `server` for `at`, `batch`, and `client` for `fromLineString`, `fromMultiLineString` (in browser envs).
|
|
2122
|
+
*/
|
|
2123
|
+
computeOn?: "client" | "server";
|
|
2117
2124
|
};
|
|
2118
2125
|
/**
|
|
2119
2126
|
* Options for batch elevation lookup
|
|
@@ -2197,4 +2204,4 @@ declare const misc: {
|
|
|
2197
2204
|
simplify: typeof simplify;
|
|
2198
2205
|
};
|
|
2199
2206
|
|
|
2200
|
-
export { type AutomaticStaticMapOptions, type BoundedStaticMapOptions, type BufferToPixelDataFunction, type ByIdGeocodingOptions, type CenteredStaticMapOptions, ClientConfig, type CommonForwardAndReverseGeocodingOptions, type CoordinateExport, type CoordinateGrid, type CoordinateId, type CoordinateSearch, type CoordinateSearchResult, type CoordinateTransformResult, type CoordinateTransformation, type Coordinates, type CoordinatesSearchOptions, type CoordinatesTransformOptions, type DefaultTransformation, type ElevationAtOptions, type ElevationBatchOptions, type FeatureHierarchy, type FetchFunction, type GeocodingFeature, type GeocodingOptions, type GeocodingPlaceType, type GeocodingSearchResult, type GeolocationInfoOptions, type GeolocationResult, type GetDataOptions, ISOLanguage, Language, type LanguageGeocodingOptions, type LanguageInfo, MapStyle, type MapStylePreset, type MapStyleType, MapStyleVariant, NonISOLanguage, type PixelData, ReferenceMapStyle, type ReverseGeocodingOptions, ServiceError, type StaticMapBaseOptions, type StaticMapMarker, type TileJSON, type XYZ, areSameLanguages, bufferToPixelDataBrowser, circumferenceAtLatitude, config, coordinates, data, elevation, expandMapStyle, geocoding, geolocation, getAutoLanguage, getBufferToPixelDataParser, getLanguageInfoFromCode, getLanguageInfoFromFlag, getLanguageInfoFromKey, getTileCache, isLanguageInfo, mapStylePresetList, math, misc, staticMaps, styleToStyle, toLanguageInfo };
|
|
2207
|
+
export { type AutomaticStaticMapOptions, type BoundedStaticMapOptions, type BufferToPixelDataFunction, type ByIdGeocodingOptions, type CenteredStaticMapOptions, ClientConfig, type CommonForwardAndReverseGeocodingOptions, type CoordinateExport, type CoordinateGrid, type CoordinateId, type CoordinateSearch, type CoordinateSearchResult, type CoordinateTransformResult, type CoordinateTransformation, type Coordinates, type CoordinatesSearchOptions, type CoordinatesTransformOptions, type DefaultTransformation, type ElevationAtOptions, type ElevationBatchOptions, type FeatureHierarchy, type FetchFunction, type GeocodingFeature, type GeocodingOptions, type GeocodingPlaceType, type GeocodingSearchResult, type GeolocationInfoOptions, type GeolocationResult, type GetDataOptions, ISOLanguage, Language, type LanguageGeocodingOptions, type LanguageInfo, MapStyle, type MapStylePreset, type MapStyleType, MapStyleVariant, NonISOLanguage, type PixelData, ReferenceMapStyle, type ReverseGeocodingOptions, ServiceError, type StaticMapBaseOptions, type StaticMapMarker, type TileJSON, type XYZ, areSameLanguages, bufferToPixelDataBrowser, canParsePixelData, circumferenceAtLatitude, config, coordinates, data, elevation, expandMapStyle, geocoding, geolocation, getAutoLanguage, getBufferToPixelDataParser, getLanguageInfoFromCode, getLanguageInfoFromFlag, getLanguageInfoFromKey, getTileCache, isLanguageInfo, mapStylePresetList, math, misc, staticMaps, styleToStyle, toLanguageInfo };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import we from"quick-lru";function De(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class X{constructor(){this._apiKey="",this._fetch=De(),this.tileCacheSize=200}set apiKey(n){this._apiKey=n}get apiKey(){return this._apiKey}set fetch(n){this._fetch=n}get fetch(){return this._fetch}}const m=new X,ee={AUTO:{code:null,flag:"auto",name:"Auto",latin:!1,isMode:!0,geocoding:!0},LATIN:{code:"latin",flag:"name:latin",name:"Latin",latin:!0,isMode:!1,geocoding:!1},NON_LATIN:{code:"nonlatin",flag:"name:nonlatin",name:"Non Latin",latin:!1,isMode:!1,geocoding:!1},LOCAL:{code:null,flag:"name",name:"Local",latin:!0,isMode:!1,geocoding:!1}},ne={ALBANIAN:{code:"sq",flag:"name:sq",name:"Albanian",latin:!0,isMode:!1,geocoding:!0},AMHARIC:{code:"am",flag:"name:am",name:"Amharic",latin:!1,isMode:!1,geocoding:!0},ARABIC:{code:"ar",flag:"name:ar",name:"Arabic",latin:!1,isMode:!1,geocoding:!0},ARMENIAN:{code:"hy",flag:"name:hy",name:"Armenian",latin:!1,isMode:!1,geocoding:!0},AZERBAIJANI:{code:"az",flag:"name:az",name:"Azerbaijani",latin:!0,isMode:!1,geocoding:!0},BASQUE:{code:"eu",flag:"name:eu",name:"Basque",latin:!0,isMode:!1,geocoding:!0},BELARUSIAN:{code:"be",flag:"name:be",name:"Belarusian",latin:!1,isMode:!1,geocoding:!0},BENGALI:{code:"bn",flag:"name:bn",name:"Bengali",latin:!0,isMode:!1,geocoding:!0},BOSNIAN:{code:"bs",flag:"name:bs",name:"Bosnian",latin:!0,isMode:!1,geocoding:!0},BRETON:{code:"br",flag:"name:br",name:"Breton",latin:!0,isMode:!1,geocoding:!0},BULGARIAN:{code:"bg",flag:"bg",name:"Bulgarian",latin:!1,isMode:!1,geocoding:!0},CATALAN:{code:"ca",flag:"name:ca",name:"Catalan",latin:!0,isMode:!1,geocoding:!0},CHINESE:{code:"zh",flag:"name:zh",name:"Chinese",latin:!1,isMode:!1,geocoding:!0},TRADITIONAL_CHINESE:{code:"zh-Hant",flag:"name:zh-Hant",name:"Chinese (traditional)",latin:!1,isMode:!1,geocoding:!1},SIMPLIFIED_CHINESE:{code:"zh-Hans",flag:"name:zh-Hans",name:"Chinese (simplified)",latin:!1,isMode:!1,geocoding:!1},CORSICAN:{code:"co",flag:"name:co",name:"Corsican",latin:!0,isMode:!1,geocoding:!0},CROATIAN:{code:"hr",flag:"name:hr",name:"Croatian",latin:!0,isMode:!1,geocoding:!0},CZECH:{code:"cs",flag:"name:cs",name:"Czech",latin:!0,isMode:!1,geocoding:!0},DANISH:{code:"da",flag:"name:da",name:"Danish",latin:!0,isMode:!1,geocoding:!0},DUTCH:{code:"nl",flag:"name:nl",name:"Dutch",latin:!0,isMode:!1,geocoding:!0},GERMAN:{code:"de",flag:"name:de",name:"German",latin:!0,isMode:!1,geocoding:!0},GREEK:{code:"el",flag:"name:el",name:"Greek",latin:!1,isMode:!1,geocoding:!0},ENGLISH:{code:"en",flag:"name:en",name:"English",latin:!0,isMode:!1,geocoding:!0},ESPERANTO:{code:"eo",flag:"name:eo",name:"Esperanto",latin:!0,isMode:!1,geocoding:!0},ESTONIAN:{code:"et",flag:"name:et",name:"Estonian",latin:!0,isMode:!1,geocoding:!0},FINNISH:{code:"fi",flag:"name:fi",name:"Finnish",latin:!0,isMode:!1,geocoding:!0},FRENCH:{code:"fr",flag:"name:fr",name:"French",latin:!0,isMode:!1,geocoding:!0},FRISIAN:{code:"fy",flag:"name:fy",name:"Frisian (West)",latin:!0,isMode:!1,geocoding:!0},GEORGIAN:{code:"ka",flag:"name:ka",name:"Georgian",latin:!1,isMode:!1,geocoding:!0},HEBREW:{code:"he",flag:"name:he",name:"Hebrew",latin:!1,isMode:!1,geocoding:!0},HINDI:{code:"hi",flag:"name:hi",name:"Hindi",latin:!1,isMode:!1,geocoding:!0},HUNGARIAN:{code:"hu",flag:"name:hu",name:"Hungarian",latin:!0,isMode:!1,geocoding:!0},ICELANDIC:{code:"is",flag:"name:is",name:"Icelandic",latin:!0,isMode:!1,geocoding:!0},INDONESIAN:{code:"id",flag:"name:id",name:"Indonesian",latin:!0,isMode:!1,geocoding:!0},IRISH:{code:"ga",flag:"name:ga",name:"Irish",latin:!0,isMode:!1,geocoding:!0},ITALIAN:{code:"it",flag:"name:it",name:"Italian",latin:!0,isMode:!1,geocoding:!0},JAPANESE:{code:"ja",flag:"name:ja",name:"Japanese",latin:!1,isMode:!1,geocoding:!0},JAPANESE_HIRAGANA:{code:"ja-Hira",flag:"name:ja-Hira",name:"Japanese Hiragana form",latin:!1,isMode:!1,geocoding:!1},JAPANESE_2018:{code:"ja-Latn",flag:"name:ja-Latn",name:"Japanese (Latin 2018)",latin:!0,isMode:!1,geocoding:!1},JAPANESE_KANA:{code:"ja_kana",flag:"name:ja_kana",name:"Japanese (Kana)",latin:!1,isMode:!1,geocoding:!1},JAPANESE_LATIN:{code:"ja_rm",flag:"name:ja_rm",name:"Japanese (Latin script)",latin:!0,isMode:!1,geocoding:!1},KANNADA:{code:"kn",flag:"name:kn",name:"Kannada",latin:!0,isMode:!1,geocoding:!0},KAZAKH:{code:"kk",flag:"name:kk",name:"Kazakh",latin:!1,isMode:!1,geocoding:!0},KOREAN:{code:"ko",flag:"name:ko",name:"Korean",latin:!1,isMode:!1,geocoding:!0},KOREAN_LATIN:{code:"ko-Latn",flag:"name:ko-Latn",name:"Korean (Latin script)",latin:!0,isMode:!1,geocoding:!1},KURDISH:{code:"ku",flag:"name:ku",name:"Kurdish",latin:!0,isMode:!1,geocoding:!0},CLASSICAL_LATIN:{code:"la",flag:"name:la",name:"Latin",latin:!0,isMode:!1,geocoding:!0},LATVIAN:{code:"lv",flag:"name:lv",name:"Latvian",latin:!0,isMode:!1,geocoding:!0},LITHUANIAN:{code:"lt",flag:"name:lt",name:"Lithuanian",latin:!0,isMode:!1,geocoding:!0},LUXEMBOURGISH:{code:"lb",flag:"name:lb",name:"Luxembourgish",latin:!0,isMode:!1,geocoding:!0},MACEDONIAN:{code:"mk",flag:"name:mk",name:"Macedonian",latin:!1,isMode:!1,geocoding:!0},MALAYALAM:{code:"ml",flag:"name:ml",name:"Malayalam",latin:!1,isMode:!1,geocoding:!0},MALTESE:{code:"mt",flag:"name:mt",name:"Maltese",latin:!0,isMode:!1,geocoding:!0},NORWEGIAN:{code:"no",flag:"name:no",name:"Norwegian",latin:!0,isMode:!1,geocoding:!0},OCCITAN:{code:"oc",flag:"name:oc",name:"Occitan",latin:!0,isMode:!1,geocoding:!0},PERSIAN:{code:"fa",flag:"name:fa",name:"Persian",latin:!1,isMode:!1,geocoding:!0},POLISH:{code:"pl",flag:"name:pl",name:"Polish",latin:!0,isMode:!1,geocoding:!0},PORTUGUESE:{code:"pt",flag:"name:pt",name:"Portuguese",latin:!0,isMode:!1,geocoding:!0},PUNJABI:{code:"pa",flag:"name:pa",name:"Punjabi",latin:!1,isMode:!1,geocoding:!0},WESTERN_PUNJABI:{code:"pnb",flag:"name:pnb",name:"Western Punjabi",latin:!1,isMode:!1,geocoding:!1},ROMANIAN:{code:"ro",flag:"name:ro",name:"Romanian",latin:!0,isMode:!1,geocoding:!0},ROMANSH:{code:"rm",flag:"name:rm",name:"Romansh",latin:!0,isMode:!1,geocoding:!0},RUSSIAN:{code:"ru",flag:"name:ru",name:"Russian",latin:!1,isMode:!1,geocoding:!0},SERBIAN_CYRILLIC:{code:"sr",flag:"name:sr",name:"Serbian (Cyrillic script)",latin:!1,isMode:!1,geocoding:!0},SERBIAN_LATIN:{code:"sr-Latn",flag:"name:sr-Latn",name:"Serbian (Latin script)",latin:!0,isMode:!1,geocoding:!1},SCOTTISH_GAELIC:{code:"gd",flag:"name:gd",name:"Scottish Gaelic",latin:!0,isMode:!1,geocoding:!0},SLOVAK:{code:"sk",flag:"name:sk",name:"Slovak",latin:!0,isMode:!1,geocoding:!0},SLOVENE:{code:"sl",flag:"name:sl",name:"Slovene",latin:!0,isMode:!1,geocoding:!0},SPANISH:{code:"es",flag:"name:es",name:"Spanish",latin:!0,isMode:!1,geocoding:!0},SWEDISH:{code:"sv",flag:"name:sv",name:"Swedish",latin:!0,isMode:!1,geocoding:!0},TAMIL:{code:"ta",flag:"name:ta",name:"Tamil",latin:!1,isMode:!1,geocoding:!0},TELUGU:{code:"te",flag:"name:te",name:"Telugu",latin:!1,isMode:!1,geocoding:!0},THAI:{code:"th",flag:"name:th",name:"Thai",latin:!1,isMode:!1,geocoding:!0},TURKISH:{code:"tr",flag:"name:tr",name:"Turkish",latin:!0,isMode:!1,geocoding:!0},UKRAINIAN:{code:"uk",flag:"name:uk",name:"Ukrainian",latin:!1,isMode:!1,geocoding:!0},VIETNAMESE:{code:"vi",flag:"name:vi",name:"Vietnamese (Latin script)",latin:!0,isMode:!1,geocoding:!0},WELSH:{code:"cy",flag:"name:cy",name:"Welsh",latin:!0,isMode:!1,geocoding:!0}},S={...ee,...ne};function ae(e,n=S){return e in n?e[e]:null}function E(e,n=S){for(const a of Object.values(n))if(a.code===e)return a;return null}function N(e,n=S){for(const a of Object.values(n))if(a.flag===e)return a;return null}function O(){if(typeof navigator>"u"){const e=Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];return E(e)??S.ENGLISH}return Array.from(new Set(navigator.languages.map(e=>e.split("-")[0]))).map(e=>E(e)).filter(e=>e)[0]??S.ENGLISH}function j(e){return e!==null&&typeof e=="object"&&"code"in e&&"flag"in e&&"name"in e&&"latin"in e&&"isMode"in e&&"geocoding"in e&&(typeof e.code=="string"||e.code===null)&&typeof e.flag=="string"&&typeof e.name=="string"&&typeof e.latin=="boolean"&&typeof e.isMode=="boolean"&&typeof e.geocoding=="boolean"}function H(e,n=S){return j(e)?N(e.flag,n):typeof e!="string"?null:ae(e,n)||E(e,n)||N(e,n)||null}function Ue(e,n,a=S){const t=H(e,a),i=H(n,a);return t&&i&&t.flag===i.flag}async function I(e,n={}){if(m.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(e).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return m.fetch(e,n)}const y={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(y);class L extends Error{constructor(n,a=""){super(`Call to enpoint ${n.url} failed with the status code ${n.status}. ${a}`),this.res=n}}const P={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function te(e,n){const{language:a}=n;if(a===void 0)return;const t=(Array.isArray(a)?a:[a]).map(o=>Ee(o)).filter(o=>o),i=Array.from(new Set(t)).join(",");e.set("language",i)}function Ee(e){const n=e===S.AUTO.flag?O():typeof e=="string"?E(e):j(e)?e.flag===S.AUTO.flag?O():N(e.flag):null;return n?.geocoding?n.code:null}function ie(e,n){const{apiKey:a,limit:t,types:i,excludeTypes:o}=n;e.set("key",a??m.apiKey),t!==void 0&&e.set("limit",String(t)),i!==void 0&&e.set("types",i.join(",")),o!==void 0&&e.set("excludeTypes",String(o)),te(e,n)}function oe(e,n){ie(e,n);const{bbox:a,proximity:t,country:i,fuzzyMatch:o,autocomplete:r}=n;a!==void 0&&e.set("bbox",a.join(",")),t!==void 0&&e.set("proximity",t==="ip"?t:t.join(",")),i!==void 0&&e.set("country",i.join(",")),o!==void 0&&e.set("fuzzyMatch",o?"true":"false"),r!==void 0&&e.set("autocomplete",r?"true":"false")}async function ke(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new Error("The query must be a non-empty string");const a=new URL(`geocoding/${encodeURIComponent(e)}.json`,y.maptilerApiURL);oe(a.searchParams,n);const t=await I(a.toString());if(!t.ok)throw new L(t,P[t.status]??"");return await t.json()}async function Ne(e,n={}){if(!Array.isArray(e)||e.length<2)throw new Error("The position must be an array of form [lng, lat].");const a=new URL(`geocoding/${e[0]},${e[1]}.json`,y.maptilerApiURL);ie(a.searchParams,n);const t=await I(a.toString());if(!t.ok)throw new L(t,P[t.status]??"");return await t.json()}async function Pe(e,n={}){const a=new URL(`geocoding/${e}.json`,y.maptilerApiURL);a.searchParams.set("key",n.apiKey??m.apiKey),te(a.searchParams,n);const t=await I(a.toString());if(!t.ok)throw new L(t,P[t.status]??"");return await t.json()}async function $e(e,n={}){if(!e.length)return[];const a=e.map(r=>encodeURIComponent(r)).join(";"),t=new URL(`geocoding/${a}.json`,y.maptilerApiURL);oe(t.searchParams,n);const i=await I(t.toString());if(!i.ok)throw new L(i,P[i.status]??"");const o=await i.json();return e.length===1?[o]:o}const be={forward:ke,reverse:Ne,byId:Pe,batch:$e},re={403:"Key is missing, invalid or restricted"};async function Ce(e={}){const n=new URL("geolocation/ip.json",y.maptilerApiURL);n.searchParams.set("key",e.apiKey??m.apiKey),"elevation"in e&&n.searchParams.set("elevation",e.elevation?"true":"false");const a=n.toString(),t=await I(a);if(!t.ok)throw new L(t,t.status in re?re[t.status]:"");return await t.json()}const Ke={info:Ce},$={403:"Key is missing, invalid or restricted"};async function Oe(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new Error("The query must be a non-empty string");const a=new URL(`coordinates/search/${e}.json`,y.maptilerApiURL);a.searchParams.set("key",n.apiKey??m.apiKey),"limit"in n&&a.searchParams.set("limit",n.limit.toString()),"transformations"in n&&a.searchParams.set("transformations",n.transformations.toString()),"exports"in n&&a.searchParams.set("exports",n.exports.toString());const t=a.toString(),i=await I(t);if(!i.ok)throw new L(i,i.status in $?$[i.status]:"");return await i.json()}async function je(e,n={}){const a=(Array.isArray(e[0])?e:[e]).map(r=>`${r[0]},${r[1]}`).join(";"),t=new URL(`coordinates/transform/${a}.json`,y.maptilerApiURL);t.searchParams.set("key",n.apiKey??m.apiKey),"sourceCrs"in n&&t.searchParams.set("s_srs",n.sourceCrs.toString()),"targetCrs"in n&&t.searchParams.set("t_srs",n.targetCrs.toString()),"operations"in n&&t.searchParams.set("ops",(Array.isArray(n.operations)?n.operations:[n.operations]).join("|"));const i=t.toString(),o=await I(i);if(!o.ok)throw new L(o,o.status in $?$[o.status]:"");return await o.json()}const He={search:Oe,transform:je},se={403:"Key is missing, invalid or restricted"};async function xe(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new Error("The data ID must be a non-empty string");const a=new URL(`data/${encodeURIComponent(e)}/features.json`,y.maptilerApiURL);a.searchParams.set("key",n.apiKey??m.apiKey);const t=a.toString(),i=await I(t);if(!i.ok)throw new L(i,i.status in se?se[i.status]:"");return await i.json()}const Fe={get:xe};function ce(e){const n=/^maptiler:\/\/(.*)/;let a;const t=e.trim();let i;return t.startsWith("http://")||t.startsWith("https://")?i=t:(a=n.exec(t))!==null?i=`https://api.maptiler.com/maps/${a[1]}/style.json`:i=`https://api.maptiler.com/maps/${t}/style.json`,i}class x{constructor(n,a,t,i,o,r,s=!1){this.name=n,this.variantType=a,this.id=t,this.referenceStyle=i,this.description=o,this.imageURL=r,this.deprecated=s}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(n){return this.referenceStyle.hasVariant(n)}getVariant(n){const a=this.referenceStyle.getVariant(n);return this.warnIfDeprecated(a),a}getVariants(){return this.referenceStyle.getVariants().filter(n=>n!==this).map(n=>(this.warnIfDeprecated(n),n))}getImageURL(){return this.imageURL}getExpandedStyleURL(){return ce(this.getId())}warnIfDeprecated(n=this){if(!n.deprecated)return n;const a=n.getFullName();return console.warn(`Style "${a}" is deprecated and will be removed in a future version.`),n}}class F{constructor(n,a){this.name=n,this.id=a,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(n){this.variants[n.getType()]=n,this.orderedVariants.push(n)}hasVariant(n){return n in this.variants}getVariant(n){return n in this.variants?this.variants[n]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0].warnIfDeprecated()}}const b=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",deprecated:!0,name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",deprecated:!0,variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",deprecated:!0,variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",deprecated:!0,variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",deprecated:!0,variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",deprecated:!0,variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",deprecated:!0,description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",deprecated:!0,description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"AQUARELLE",name:"Aquarelle",description:"Watercolor map for creative use",variants:[{id:"aquarelle",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"aquarelle-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"aquarelle-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""}]},{referenceStyleID:"LANDSCAPE",name:"Landscape",description:"Terrain map for data overlays and visualisations",variants:[{id:"landscape",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"landscape-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"landscape-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""}]}];function Ve(e){return new Proxy(e,{get(n,a,t){return n.hasVariant(a)?n.getVariant(a):a.toString().toUpperCase()===a?e.getDefaultVariant():Reflect.get(n,a,t)}})}function _e(){const e={};for(let n=0;n<b.length;n+=1){const a=b[n],t=Ve(new F(a.name,a.referenceStyleID));for(let i=0;i<a.variants.length;i+=1){const o=a.variants[i],r=new x(o.name,o.variantType,o.id,t,o.description,o.imageURL,o.deprecated);t.addVariant(r)}e[a.referenceStyleID]=t}return e}function C(e){if(!e)return de[b[0].referenceStyleID].getDefaultVariant().getId();if(typeof e=="string"||e instanceof String)return e.trim().toLowerCase();if(e instanceof x)return e.getId();if(e instanceof F)return e.getDefaultVariant().getId()}const de=_e();function Be(e){const n=[];function a(o){(o.type==="LineString"||o.type==="MultiLineString")&&n.push(o)}function t(o){o.geometry&&a(o.geometry)}function i(o){for(const r of o.features)r.type==="Feature"?t(r):r.type==="FeatureCollection"&&i(r)}return e.type==="Feature"?t(e):e.type==="FeatureCollection"?i(e):a(e),n}function Ge(e,n,a){let t=n[0],i=n[1],o=a[0]-t,r=a[1]-i;if(o!==0||r!==0){const s=((e[0]-t)*o+(e[1]-i)*r)/(o*o+r*r);s>1?(t=a[0],i=a[1]):s>0&&(t+=o*s,i+=r*s)}return o=e[0]-t,r=e[1]-i,o*o+r*r}function V(e,n,a,t,i){let o=t,r;for(let s=n+1;s<a;s++){const c=Ge(e[s],e[n],e[a]);c>o&&(r=s,o=c)}o>t&&(r-n>1&&V(e,n,r,t,i),i.push(e[r]),a-r>1&&V(e,r,a,t,i))}function ze(e,n){const a=e.length-1,t=[e[0]];return V(e,0,a,n,t),t.push(e[a]),t}function We(e,n){if(e.length<=2)return e;const a=n!==void 0?n*n:1;return ze(e,a)}const le={extractLineStrings:Be,simplify:We};function _(e,n=!0){let a=`${e[0]},${e[1]}`;return e.length===3&&n&&(a+=`,${e[2]}`),a}function B(e,n=3e3){let a=e.map(o=>o.join(",")).join("|"),t=5e-6;const i=1e-5;for(;a.length>n;)a=le.simplify(e,t).map(o=>`${o[0]},${o[1]}`).join("|"),t+=i;return a}function Je(e,n,a={}){const t=C(a.style),i=a.hiDPI?"@2x":"",o=a.format??"png";let r=~~(a.width??1024),s=~~(a.height??1024);a.hiDPI&&(r=~~(r/2),s=~~(s/2));const c=new URL(`maps/${encodeURIComponent(t)}/static/${e[0]},${e[1]},${n}/${r}x${s}${i}.${o}`,y.maptilerApiURL);if("attribution"in a&&c.searchParams.set("attribution",a.attribution.toString()),"markers"in a){let l="";const g="markerIcon"in a;g&&(l+=`icon:${a.markerIcon}|`),g&&"markerAnchor"in a&&(l+=`anchor:${a.markerAnchor}|`),g&&a.hiDPI&&(l+="scale:2|");const A=Array.isArray(a.markers[0])?a.markers:[a.markers];l+=A.map(f=>_(f,!g)).join("|"),c.searchParams.set("markers",l)}if("path"in a){let l="";if(l+=`fill:${a.pathFillColor??"none"}|`,"pathStrokeColor"in a&&(l+=`stroke:${a.pathStrokeColor}|`),"pathWidth"in a){const g=a.pathWidth/(a.hiDPI?2:1);l+=`width:${g.toString()}|`}l+=B(a.path),c.searchParams.set("path",l)}return c.searchParams.set("key",a.apiKey??m.apiKey),c.toString()}function qe(e,n={}){const a=C(n.style),t=n.hiDPI?"@2x":"",i=n.format??"png";let o=~~(n.width??1024),r=~~(n.height??1024);n.hiDPI&&(o=~~(o/2),r=~~(r/2));const s=new URL(`maps/${encodeURIComponent(a)}/static/${e[0]},${e[1]},${e[2]},${e[3]}/${o}x${r}${t}.${i}`,y.maptilerApiURL);if("attribution"in n&&s.searchParams.set("attribution",n.attribution.toString()),"padding"in n&&s.searchParams.set("padding",n.padding.toString()),"markers"in n){let c="";const l="markerIcon"in n;l&&(c+=`icon:${n.markerIcon}|`),l&&"markerAnchor"in n&&(c+=`anchor:${n.markerAnchor}|`),l&&n.hiDPI&&(c+="scale:2|");const g=Array.isArray(n.markers[0])?n.markers:[n.markers];c+=g.map(A=>_(A,!l)).join("|"),s.searchParams.set("markers",c)}if("path"in n){let c="";if(c+=`fill:${n.pathFillColor??"none"}|`,"pathStrokeColor"in n&&(c+=`stroke:${n.pathStrokeColor}|`),"pathWidth"in n){const l=n.pathWidth/(n.hiDPI?2:1);c+=`width:${l.toString()}|`}c+=B(n.path),s.searchParams.set("path",c)}return s.searchParams.set("key",n.apiKey??m.apiKey),s.toString()}function Ye(e={}){if(!("markers"in e)&&!("path"in e))throw new Error("Automatic static maps require markers and/or path to be created.");const n=C(e.style),a=e.hiDPI?"@2x":"",t=e.format??"png";let i=~~(e.width??1024),o=~~(e.height??1024);e.hiDPI&&(i=~~(i/2),o=~~(o/2));const r=new URL(`maps/${encodeURIComponent(n)}/static/auto/${i}x${o}${a}.${t}`,y.maptilerApiURL);if("attribution"in e&&r.searchParams.set("attribution",e.attribution.toString()),"padding"in e&&r.searchParams.set("padding",e.padding.toString()),"markers"in e){let s="";const c="markerIcon"in e;c&&(s+=`icon:${e.markerIcon}|`),c&&"markerAnchor"in e&&(s+=`anchor:${e.markerAnchor}|`),c&&e.hiDPI&&(s+="scale:2|");const l=Array.isArray(e.markers[0])?e.markers:[e.markers];s+=l.map(g=>_(g,!c)).join("|"),r.searchParams.set("markers",s)}if("path"in e){let s="";if(s+=`fill:${e.pathFillColor??"none"}|`,"pathStrokeColor"in e&&(s+=`stroke:${e.pathStrokeColor}|`),"pathWidth"in e){const c=e.pathWidth/(e.hiDPI?2:1);s+=`width:${c.toString()}|`}s+=B(e.path),r.searchParams.set("path",s)}return r.searchParams.set("key",e.apiKey??m.apiKey),r.toString()}const Qe={centered:Je,bounded:qe,automatic:Ye},K=63710088e-1,ge=2*Math.PI*K;function me(e){return(180+e)/360}function pe(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function fe(e){const n=ye(e);return[me(n[0]),pe(n[1])]}function he(e){return e*360-180}function ue(e){const n=180-e*360;return 360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90}function Ze(e){return[he(e[0]),ue(e[1])]}function G(e,n){const a=Math.PI/180,t=e[1]*a,i=n[1]*a,o=Math.sin(t)*Math.sin(i)+Math.cos(t)*Math.cos(i)*Math.cos((n[0]-e[0])*a);return K*Math.acos(Math.min(o,1))}function Xe(e){const n=Array(e.length);n[0]=0;const a=n.length;for(let t=1;t<a;t++)n[t]=G(e[t-1],e[t])+n[t-1];return n}function ye(e){const n=e[0],a=e[1],t=360,i=((n+180)%t+t)%t-180;return[i===-180?180:i,a]}function Ae(e){return ge*Math.cos(e*Math.PI/180)}function Le(e,n,a=!0){const t=2**n,i=[e[0]*t,e[1]*t];return a?[~~i[0],~~i[1]]:i}function en(e,n,a=!0){const t=fe(e);return Le(t,n,a)}function k(e){return e*Math.PI/180}function z(e){return e*180/Math.PI}function nn(e,n,a){const t=G(e,n),i=k(e[0]),o=k(e[1]),r=k(n[0]),s=k(n[1]),c=t/K,l=Math.sin((1-a)*c)/Math.sin(c),g=Math.sin(a*c)/Math.sin(c),A=l*Math.cos(o)*Math.cos(i)+g*Math.cos(s)*Math.cos(r),f=l*Math.cos(o)*Math.sin(i)+g*Math.cos(s)*Math.sin(r),M=l*Math.sin(o)+g*Math.sin(s),w=Math.atan2(M,Math.sqrt(A*A+f*f)),R=Math.atan2(f,A);return[z(R),z(w)]}const W={EARTH_RADIUS:K,EARTH_CIRCUMFERENCE:ge,longitudeToMercatorX:me,latitudeToMercatorY:pe,wgs84ToMercator:fe,mercatorXToLongitude:he,mercatorYToLatitude:ue,mercatorToWgs84:Ze,haversineDistanceWgs84:G,wrapWgs84:ye,circumferenceAtLatitude:Ae,mercatorToTileIndex:Le,wgs84ToTileIndex:en,toRadians:k,toDegrees:z,haversineIntermediateWgs84:nn,haversineCumulatedDistanceWgs84:Xe};let J=null;function q(){return J||(J=new we({maxSize:m.tileCacheSize})),J}async function Ie(e){const n=new Blob([e]),a=await createImageBitmap(n),t=document.createElement("canvas"),i=t.getContext("2d");t.width=a.width,t.height=a.height,i.drawImage(a,0,0);const o=i.getImageData(0,0,t.width,t.height);return{pixels:o.data,width:t.width,height:t.height,components:o.data.length/(t.width*t.height)}}function Y(){if(m.bufferToPixelData)return m.bufferToPixelData;if(typeof window<"u")return Ie;throw new Error("An image file buffer to pixel data parser is necessary. Specify it in `config.bufferToPixelData`")}const an="tiles/terrain-rgb-v2/tiles.json";let T=null;const Q={403:"Key is missing, invalid or restricted"};async function Se(e){const n=new URL(an,y.maptilerApiURL);n.searchParams.set("key",e);const a=n.toString(),t=await I(a);if(t.ok)return T=await t.json(),T;if(!t.ok)throw new L(t,Q[t.status]??"")}async function tn(e,n={}){const a=n.apiKey??m.apiKey;T||await Se(a);const t=T.maxzoom;let i=~~(n.zoom??t);(i>t||i<0)&&(i=t);const o=W.wgs84ToTileIndex(e,i,!1),r=~~o[0],s=~~o[1];if(!T.tiles.length)throw new Error("Terrain tileJSON tile list is empty.");const c=`terrain_${i.toString()}_${r.toString()}_${s.toString()}`;let l;const g=q();if(g.has(c))l=g.get(c);else{const v=T.tiles[0].replace("{x}",r.toString()).replace("{y}",s.toString()).replace("{z}",i.toString()),p=await I(v);if(!p.ok)throw new L(p,Q[p.status]??"");const h=await p.arrayBuffer();l=await Y()(h),g.set(c,l)}const A=~~(l.width*(o[0]%1)),f=(~~(l.height*(o[1]%1))*l.width+A)*l.components,M=l.pixels[f],w=l.pixels[f+1],R=l.pixels[f+2],d=-1e4+(M*256*256+w*256+R)*.1;return[e[0],e[1],d]}async function Z(e,n={}){const a=n.apiKey??m.apiKey;T||await Se(a);const t=Y(),i=T.tiles[0],o=q(),r=T.maxzoom;let s=~~(n.zoom??r);(s>r||s<0)&&(s=r);const c=e.map(d=>W.wgs84ToTileIndex(d,s,!1)),l=c.map(d=>[~~d[0],~~d[1]]).map(d=>`terrain_${s.toString()}_${d[0].toString()}_${d[1].toString()}`),g=Array.from(new Set(l.filter(d=>!o.has(d)))).map(d=>d.split("_").slice(1)),A=g.map(d=>i.replace("{x}",d[1].toString()).replace("{y}",d[2].toString()).replace("{z}",d[0].toString())).map(d=>I(d)),f=(await Promise.allSettled(A)).map(d=>d.status==="fulfilled"?d.value:null).filter(d=>d),M=f.filter(d=>!d.ok);if(f.length!==A.length)throw new Error("Some tiles could not be fetched.");if(M.length)throw new L(M[0],Q[M[0].status]??"");const w=await Promise.all(f.map(d=>d.arrayBuffer()));if(!w.every(d=>d.byteLength>0))throw new Error("Some tiles are not available.");(await Promise.all(w.map(d=>t(d)))).forEach((d,v)=>{const p=g[v],h=`terrain_${p[0].toString()}_${p[1].toString()}_${p[2].toString()}`;o.set(h,d)});const R=e.map((d,v)=>{const p=l[v],h=c[v],u=o.get(p),D=Math.min(Math.round(u.width*(h[0]%1)),u.width-1),U=(Math.min(Math.round(u.height*(h[1]%1)),u.height-1)*u.width+D)*u.components,ve=u.pixels[U],Te=u.pixels[U+1],Me=u.pixels[U+2],Re=-1e4+(ve*256*256+Te*256+Me)*.1;return[d[0],d[1],~~(Re*1e3)/1e3]});if(n.smoothingKernelSize){const d=~~(n.smoothingKernelSize/2)*2+1,v=R.map(h=>h[2]),p=~~(d/2);for(let h=p;h<v.length-p-1;h+=1){let u=0;for(let D=0;D<d;D+=1){const U=v[h-p+D];u+=U}u/=d,R[h][2]=u}}return R}async function on(e,n={}){if(e.type!=="LineString")throw new Error("The provided object is not a GeoJSON LineString");const a=structuredClone(e),t=await Z(a.coordinates,n);return a.coordinates=t,a}async function rn(e,n={}){if(e.type!=="MultiLineString")throw new Error("The provided object is not a GeoJSON MultiLineString");const a=structuredClone(e),t=a.coordinates.map(c=>c.length),i=a.coordinates.flat(),o=await Z(i,n),r=[];let s=0;for(const c of t)r.push(o.slice(s,s+c)),s+=c;return a.coordinates=r,a}const sn={at:tn,batch:Z,fromLineString:on,fromMultiLineString:rn};export{X as ClientConfig,ne as ISOLanguage,S as Language,de as MapStyle,x as MapStyleVariant,ee as NonISOLanguage,F as ReferenceMapStyle,L as ServiceError,Ue as areSameLanguages,Ie as bufferToPixelDataBrowser,Ae as circumferenceAtLatitude,m as config,He as coordinates,Fe as data,sn as elevation,ce as expandMapStyle,be as geocoding,Ke as geolocation,O as getAutoLanguage,Y as getBufferToPixelDataParser,E as getLanguageInfoFromCode,N as getLanguageInfoFromFlag,ae as getLanguageInfoFromKey,q as getTileCache,j as isLanguageInfo,b as mapStylePresetList,W as math,le as misc,Qe as staticMaps,C as styleToStyle,H as toLanguageInfo};
|
|
1
|
+
import we from"quick-lru";function De(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class q{constructor(){this._apiKey="",this._fetch=De(),this.tileCacheSize=200}set apiKey(n){this._apiKey=n}get apiKey(){return this._apiKey}set fetch(n){this._fetch=n}get fetch(){return this._fetch}}const m=new q,Y={AUTO:{code:null,flag:"auto",name:"Auto",latin:!1,isMode:!0,geocoding:!0},LATIN:{code:"latin",flag:"name:latin",name:"Latin",latin:!0,isMode:!1,geocoding:!1},NON_LATIN:{code:"nonlatin",flag:"name:nonlatin",name:"Non Latin",latin:!1,isMode:!1,geocoding:!1},LOCAL:{code:null,flag:"name",name:"Local",latin:!0,isMode:!1,geocoding:!1}},Z={ALBANIAN:{code:"sq",flag:"name:sq",name:"Albanian",latin:!0,isMode:!1,geocoding:!0},AMHARIC:{code:"am",flag:"name:am",name:"Amharic",latin:!1,isMode:!1,geocoding:!0},ARABIC:{code:"ar",flag:"name:ar",name:"Arabic",latin:!1,isMode:!1,geocoding:!0},ARMENIAN:{code:"hy",flag:"name:hy",name:"Armenian",latin:!1,isMode:!1,geocoding:!0},AZERBAIJANI:{code:"az",flag:"name:az",name:"Azerbaijani",latin:!0,isMode:!1,geocoding:!0},BASQUE:{code:"eu",flag:"name:eu",name:"Basque",latin:!0,isMode:!1,geocoding:!0},BELARUSIAN:{code:"be",flag:"name:be",name:"Belarusian",latin:!1,isMode:!1,geocoding:!0},BENGALI:{code:"bn",flag:"name:bn",name:"Bengali",latin:!0,isMode:!1,geocoding:!0},BOSNIAN:{code:"bs",flag:"name:bs",name:"Bosnian",latin:!0,isMode:!1,geocoding:!0},BRETON:{code:"br",flag:"name:br",name:"Breton",latin:!0,isMode:!1,geocoding:!0},BULGARIAN:{code:"bg",flag:"bg",name:"Bulgarian",latin:!1,isMode:!1,geocoding:!0},CATALAN:{code:"ca",flag:"name:ca",name:"Catalan",latin:!0,isMode:!1,geocoding:!0},CHINESE:{code:"zh",flag:"name:zh",name:"Chinese",latin:!1,isMode:!1,geocoding:!0},TRADITIONAL_CHINESE:{code:"zh-Hant",flag:"name:zh-Hant",name:"Chinese (traditional)",latin:!1,isMode:!1,geocoding:!1},SIMPLIFIED_CHINESE:{code:"zh-Hans",flag:"name:zh-Hans",name:"Chinese (simplified)",latin:!1,isMode:!1,geocoding:!1},CORSICAN:{code:"co",flag:"name:co",name:"Corsican",latin:!0,isMode:!1,geocoding:!0},CROATIAN:{code:"hr",flag:"name:hr",name:"Croatian",latin:!0,isMode:!1,geocoding:!0},CZECH:{code:"cs",flag:"name:cs",name:"Czech",latin:!0,isMode:!1,geocoding:!0},DANISH:{code:"da",flag:"name:da",name:"Danish",latin:!0,isMode:!1,geocoding:!0},DUTCH:{code:"nl",flag:"name:nl",name:"Dutch",latin:!0,isMode:!1,geocoding:!0},GERMAN:{code:"de",flag:"name:de",name:"German",latin:!0,isMode:!1,geocoding:!0},GREEK:{code:"el",flag:"name:el",name:"Greek",latin:!1,isMode:!1,geocoding:!0},ENGLISH:{code:"en",flag:"name:en",name:"English",latin:!0,isMode:!1,geocoding:!0},ESPERANTO:{code:"eo",flag:"name:eo",name:"Esperanto",latin:!0,isMode:!1,geocoding:!0},ESTONIAN:{code:"et",flag:"name:et",name:"Estonian",latin:!0,isMode:!1,geocoding:!0},FINNISH:{code:"fi",flag:"name:fi",name:"Finnish",latin:!0,isMode:!1,geocoding:!0},FRENCH:{code:"fr",flag:"name:fr",name:"French",latin:!0,isMode:!1,geocoding:!0},FRISIAN:{code:"fy",flag:"name:fy",name:"Frisian (West)",latin:!0,isMode:!1,geocoding:!0},GEORGIAN:{code:"ka",flag:"name:ka",name:"Georgian",latin:!1,isMode:!1,geocoding:!0},HEBREW:{code:"he",flag:"name:he",name:"Hebrew",latin:!1,isMode:!1,geocoding:!0},HINDI:{code:"hi",flag:"name:hi",name:"Hindi",latin:!1,isMode:!1,geocoding:!0},HUNGARIAN:{code:"hu",flag:"name:hu",name:"Hungarian",latin:!0,isMode:!1,geocoding:!0},ICELANDIC:{code:"is",flag:"name:is",name:"Icelandic",latin:!0,isMode:!1,geocoding:!0},INDONESIAN:{code:"id",flag:"name:id",name:"Indonesian",latin:!0,isMode:!1,geocoding:!0},IRISH:{code:"ga",flag:"name:ga",name:"Irish",latin:!0,isMode:!1,geocoding:!0},ITALIAN:{code:"it",flag:"name:it",name:"Italian",latin:!0,isMode:!1,geocoding:!0},JAPANESE:{code:"ja",flag:"name:ja",name:"Japanese",latin:!1,isMode:!1,geocoding:!0},JAPANESE_HIRAGANA:{code:"ja-Hira",flag:"name:ja-Hira",name:"Japanese Hiragana form",latin:!1,isMode:!1,geocoding:!1},JAPANESE_2018:{code:"ja-Latn",flag:"name:ja-Latn",name:"Japanese (Latin 2018)",latin:!0,isMode:!1,geocoding:!1},JAPANESE_KANA:{code:"ja_kana",flag:"name:ja_kana",name:"Japanese (Kana)",latin:!1,isMode:!1,geocoding:!1},JAPANESE_LATIN:{code:"ja_rm",flag:"name:ja_rm",name:"Japanese (Latin script)",latin:!0,isMode:!1,geocoding:!1},KANNADA:{code:"kn",flag:"name:kn",name:"Kannada",latin:!0,isMode:!1,geocoding:!0},KAZAKH:{code:"kk",flag:"name:kk",name:"Kazakh",latin:!1,isMode:!1,geocoding:!0},KOREAN:{code:"ko",flag:"name:ko",name:"Korean",latin:!1,isMode:!1,geocoding:!0},KOREAN_LATIN:{code:"ko-Latn",flag:"name:ko-Latn",name:"Korean (Latin script)",latin:!0,isMode:!1,geocoding:!1},KURDISH:{code:"ku",flag:"name:ku",name:"Kurdish",latin:!0,isMode:!1,geocoding:!0},CLASSICAL_LATIN:{code:"la",flag:"name:la",name:"Latin",latin:!0,isMode:!1,geocoding:!0},LATVIAN:{code:"lv",flag:"name:lv",name:"Latvian",latin:!0,isMode:!1,geocoding:!0},LITHUANIAN:{code:"lt",flag:"name:lt",name:"Lithuanian",latin:!0,isMode:!1,geocoding:!0},LUXEMBOURGISH:{code:"lb",flag:"name:lb",name:"Luxembourgish",latin:!0,isMode:!1,geocoding:!0},MACEDONIAN:{code:"mk",flag:"name:mk",name:"Macedonian",latin:!1,isMode:!1,geocoding:!0},MALAYALAM:{code:"ml",flag:"name:ml",name:"Malayalam",latin:!1,isMode:!1,geocoding:!0},MALTESE:{code:"mt",flag:"name:mt",name:"Maltese",latin:!0,isMode:!1,geocoding:!0},NORWEGIAN:{code:"no",flag:"name:no",name:"Norwegian",latin:!0,isMode:!1,geocoding:!0},OCCITAN:{code:"oc",flag:"name:oc",name:"Occitan",latin:!0,isMode:!1,geocoding:!0},PERSIAN:{code:"fa",flag:"name:fa",name:"Persian",latin:!1,isMode:!1,geocoding:!0},POLISH:{code:"pl",flag:"name:pl",name:"Polish",latin:!0,isMode:!1,geocoding:!0},PORTUGUESE:{code:"pt",flag:"name:pt",name:"Portuguese",latin:!0,isMode:!1,geocoding:!0},PUNJABI:{code:"pa",flag:"name:pa",name:"Punjabi",latin:!1,isMode:!1,geocoding:!0},WESTERN_PUNJABI:{code:"pnb",flag:"name:pnb",name:"Western Punjabi",latin:!1,isMode:!1,geocoding:!1},ROMANIAN:{code:"ro",flag:"name:ro",name:"Romanian",latin:!0,isMode:!1,geocoding:!0},ROMANSH:{code:"rm",flag:"name:rm",name:"Romansh",latin:!0,isMode:!1,geocoding:!0},RUSSIAN:{code:"ru",flag:"name:ru",name:"Russian",latin:!1,isMode:!1,geocoding:!0},SERBIAN_CYRILLIC:{code:"sr",flag:"name:sr",name:"Serbian (Cyrillic script)",latin:!1,isMode:!1,geocoding:!0},SERBIAN_LATIN:{code:"sr-Latn",flag:"name:sr-Latn",name:"Serbian (Latin script)",latin:!0,isMode:!1,geocoding:!1},SCOTTISH_GAELIC:{code:"gd",flag:"name:gd",name:"Scottish Gaelic",latin:!0,isMode:!1,geocoding:!0},SLOVAK:{code:"sk",flag:"name:sk",name:"Slovak",latin:!0,isMode:!1,geocoding:!0},SLOVENE:{code:"sl",flag:"name:sl",name:"Slovene",latin:!0,isMode:!1,geocoding:!0},SPANISH:{code:"es",flag:"name:es",name:"Spanish",latin:!0,isMode:!1,geocoding:!0},SWEDISH:{code:"sv",flag:"name:sv",name:"Swedish",latin:!0,isMode:!1,geocoding:!0},TAMIL:{code:"ta",flag:"name:ta",name:"Tamil",latin:!1,isMode:!1,geocoding:!0},TELUGU:{code:"te",flag:"name:te",name:"Telugu",latin:!1,isMode:!1,geocoding:!0},THAI:{code:"th",flag:"name:th",name:"Thai",latin:!1,isMode:!1,geocoding:!0},TURKISH:{code:"tr",flag:"name:tr",name:"Turkish",latin:!0,isMode:!1,geocoding:!0},UKRAINIAN:{code:"uk",flag:"name:uk",name:"Ukrainian",latin:!1,isMode:!1,geocoding:!0},VIETNAMESE:{code:"vi",flag:"name:vi",name:"Vietnamese (Latin script)",latin:!0,isMode:!1,geocoding:!0},WELSH:{code:"cy",flag:"name:cy",name:"Welsh",latin:!0,isMode:!1,geocoding:!0}},A={...Y,...Z};function Q(e,n=A){return e in n?e[e]:null}function T(e,n=A){for(const a of Object.values(n))if(a.code===e)return a;return null}function D(e,n=A){for(const a of Object.values(n))if(a.flag===e)return a;return null}function K(){if(typeof navigator>"u"){const e=Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];return T(e)??A.ENGLISH}return Array.from(new Set(navigator.languages.map(e=>e.split("-")[0]))).map(e=>T(e)).filter(e=>e)[0]??A.ENGLISH}function j(e){return e!==null&&typeof e=="object"&&"code"in e&&"flag"in e&&"name"in e&&"latin"in e&&"isMode"in e&&"geocoding"in e&&(typeof e.code=="string"||e.code===null)&&typeof e.flag=="string"&&typeof e.name=="string"&&typeof e.latin=="boolean"&&typeof e.isMode=="boolean"&&typeof e.geocoding=="boolean"}function O(e,n=A){return j(e)?D(e.flag,n):typeof e!="string"?null:Q(e,n)||T(e,n)||D(e,n)||null}function Ue(e,n,a=A){const t=O(e,a),o=O(n,a);return t&&o&&t.flag===o.flag}async function f(e,n={}){if(m.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(e).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return m.fetch(e,n)}const p={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(p);class h extends Error{constructor(n,a=""){super(`Call to enpoint ${n.url} failed with the status code ${n.status}. ${a}`),this.res=n}}const U={400:"Query too long / Invalid parameters",403:"Key is missing, invalid or restricted"};function X(e,n){const{language:a}=n;if(a===void 0)return;const t=(Array.isArray(a)?a:[a]).map(i=>Ee(i)).filter(i=>i),o=Array.from(new Set(t)).join(",");e.set("language",o)}function Ee(e){const n=e===A.AUTO.flag?K():typeof e=="string"?T(e):j(e)?e.flag===A.AUTO.flag?K():D(e.flag):null;return n?.geocoding?n.code:null}function ee(e,n){const{apiKey:a,limit:t,types:o,excludeTypes:i}=n;e.set("key",a??m.apiKey),t!==void 0&&e.set("limit",String(t)),o!==void 0&&e.set("types",o.join(",")),i!==void 0&&e.set("excludeTypes",String(i)),X(e,n)}function ne(e,n){ee(e,n);const{bbox:a,proximity:t,country:o,fuzzyMatch:i,autocomplete:r}=n;a!==void 0&&e.set("bbox",a.join(",")),t!==void 0&&e.set("proximity",t==="ip"?t:t.join(",")),o!==void 0&&e.set("country",o.join(",")),i!==void 0&&e.set("fuzzyMatch",i?"true":"false"),r!==void 0&&e.set("autocomplete",r?"true":"false")}async function ke(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new Error("The query must be a non-empty string");const a=new URL(`geocoding/${encodeURIComponent(e)}.json`,p.maptilerApiURL);ne(a.searchParams,n);const t=await f(a.toString());if(!t.ok)throw new h(t,U[t.status]??"");return await t.json()}async function Pe(e,n={}){if(!Array.isArray(e)||e.length<2)throw new Error("The position must be an array of form [lng, lat].");const a=new URL(`geocoding/${e[0]},${e[1]}.json`,p.maptilerApiURL);ee(a.searchParams,n);const t=await f(a.toString());if(!t.ok)throw new h(t,U[t.status]??"");return await t.json()}async function Ne(e,n={}){const a=new URL(`geocoding/${e}.json`,p.maptilerApiURL);a.searchParams.set("key",n.apiKey??m.apiKey),X(a.searchParams,n);const t=await f(a.toString());if(!t.ok)throw new h(t,U[t.status]??"");return await t.json()}async function $e(e,n={}){if(!e.length)return[];const a=e.map(r=>encodeURIComponent(r)).join(";"),t=new URL(`geocoding/${a}.json`,p.maptilerApiURL);ne(t.searchParams,n);const o=await f(t.toString());if(!o.ok)throw new h(o,U[o.status]??"");const i=await o.json();return e.length===1?[i]:i}const be={forward:ke,reverse:Pe,byId:Ne,batch:$e},ae={403:"Key is missing, invalid or restricted"};async function Ce(e={}){const n=new URL("geolocation/ip.json",p.maptilerApiURL);n.searchParams.set("key",e.apiKey??m.apiKey),"elevation"in e&&n.searchParams.set("elevation",e.elevation?"true":"false");const a=n.toString(),t=await f(a);if(!t.ok)throw new h(t,t.status in ae?ae[t.status]:"");return await t.json()}const Ke={info:Ce},E={403:"Key is missing, invalid or restricted"};async function je(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new Error("The query must be a non-empty string");const a=new URL(`coordinates/search/${e}.json`,p.maptilerApiURL);a.searchParams.set("key",n.apiKey??m.apiKey),"limit"in n&&a.searchParams.set("limit",n.limit.toString()),"transformations"in n&&a.searchParams.set("transformations",n.transformations.toString()),"exports"in n&&a.searchParams.set("exports",n.exports.toString());const t=a.toString(),o=await f(t);if(!o.ok)throw new h(o,o.status in E?E[o.status]:"");return await o.json()}async function Oe(e,n={}){const a=(Array.isArray(e[0])?e:[e]).map(r=>`${r[0]},${r[1]}`).join(";"),t=new URL(`coordinates/transform/${a}.json`,p.maptilerApiURL);t.searchParams.set("key",n.apiKey??m.apiKey),"sourceCrs"in n&&t.searchParams.set("s_srs",n.sourceCrs.toString()),"targetCrs"in n&&t.searchParams.set("t_srs",n.targetCrs.toString()),"operations"in n&&t.searchParams.set("ops",(Array.isArray(n.operations)?n.operations:[n.operations]).join("|"));const o=t.toString(),i=await f(o);if(!i.ok)throw new h(i,i.status in E?E[i.status]:"");return await i.json()}const He={search:je,transform:Oe},te={403:"Key is missing, invalid or restricted"};async function xe(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new Error("The data ID must be a non-empty string");const a=new URL(`data/${encodeURIComponent(e)}/features.json`,p.maptilerApiURL);a.searchParams.set("key",n.apiKey??m.apiKey);const t=a.toString(),o=await f(t);if(!o.ok)throw new h(o,o.status in te?te[o.status]:"");return await o.json()}const Fe={get:xe};function ie(e){const n=/^maptiler:\/\/(.*)/;let a;const t=e.trim();let o;return t.startsWith("http://")||t.startsWith("https://")?o=t:(a=n.exec(t))!==null?o=`https://api.maptiler.com/maps/${a[1]}/style.json`:o=`https://api.maptiler.com/maps/${t}/style.json`,o}class H{constructor(n,a,t,o,i,r,s=!1){this.name=n,this.variantType=a,this.id=t,this.referenceStyle=o,this.description=i,this.imageURL=r,this.deprecated=s}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(n){return this.referenceStyle.hasVariant(n)}getVariant(n){const a=this.referenceStyle.getVariant(n);return this.warnIfDeprecated(a),a}getVariants(){return this.referenceStyle.getVariants().filter(n=>n!==this).map(n=>(this.warnIfDeprecated(n),n))}getImageURL(){return this.imageURL}getExpandedStyleURL(){return ie(this.getId())}warnIfDeprecated(n=this){if(!n.deprecated)return n;const a=n.getFullName();return console.warn(`Style "${a}" is deprecated and will be removed in a future version.`),n}}class x{constructor(n,a){this.name=n,this.id=a,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(n){this.variants[n.getType()]=n,this.orderedVariants.push(n)}hasVariant(n){return n in this.variants}getVariant(n){return n in this.variants?this.variants[n]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0].warnIfDeprecated()}}const k=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",deprecated:!0,variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",deprecated:!0,variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",deprecated:!0,variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",deprecated:!0,variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",deprecated:!0,variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",deprecated:!0,description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",deprecated:!0,description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"AQUARELLE",name:"Aquarelle",description:"Watercolor map for creative use",variants:[{id:"aquarelle",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"aquarelle-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"aquarelle-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""}]},{referenceStyleID:"LANDSCAPE",name:"Landscape",description:"Terrain map for data overlays and visualisations",variants:[{id:"landscape",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"landscape-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"landscape-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""}]}];function Ve(e){return new Proxy(e,{get(n,a,t){return n.hasVariant(a)?n.getVariant(a):a.toString().toUpperCase()===a?e.getDefaultVariant():Reflect.get(n,a,t)}})}function Be(){const e={};for(let n=0;n<k.length;n+=1){const a=k[n],t=Ve(new x(a.name,a.referenceStyleID));for(let o=0;o<a.variants.length;o+=1){const i=a.variants[o],r=new H(i.name,i.variantType,i.id,t,i.description,i.imageURL,i.deprecated);t.addVariant(r)}e[a.referenceStyleID]=t}return e}function P(e){if(!e)return oe[k[0].referenceStyleID].getDefaultVariant().getId();if(typeof e=="string"||e instanceof String)return e.trim().toLowerCase();if(e instanceof H)return e.getId();if(e instanceof x)return e.getDefaultVariant().getId()}const oe=Be();function Ge(e){const n=[];function a(i){(i.type==="LineString"||i.type==="MultiLineString")&&n.push(i)}function t(i){i.geometry&&a(i.geometry)}function o(i){for(const r of i.features)r.type==="Feature"?t(r):r.type==="FeatureCollection"&&o(r)}return e.type==="Feature"?t(e):e.type==="FeatureCollection"?o(e):a(e),n}function _e(e,n,a){let t=n[0],o=n[1],i=a[0]-t,r=a[1]-o;if(i!==0||r!==0){const s=((e[0]-t)*i+(e[1]-o)*r)/(i*i+r*r);s>1?(t=a[0],o=a[1]):s>0&&(t+=i*s,o+=r*s)}return i=e[0]-t,r=e[1]-o,i*i+r*r}function F(e,n,a,t,o){let i=t,r;for(let s=n+1;s<a;s++){const c=_e(e[s],e[n],e[a]);c>i&&(r=s,i=c)}i>t&&(r-n>1&&F(e,n,r,t,o),o.push(e[r]),a-r>1&&F(e,r,a,t,o))}function ze(e,n){const a=e.length-1,t=[e[0]];return F(e,0,a,n,t),t.push(e[a]),t}function We(e,n){if(e.length<=2)return e;const a=n!==void 0?n*n:1;return ze(e,a)}const re={extractLineStrings:Ge,simplify:We};function V(e,n=!0){let a=`${e[0]},${e[1]}`;return e.length===3&&n&&(a+=`,${e[2]}`),a}function B(e,n=3e3){let a=e.map(i=>i.join(",")).join("|"),t=5e-6;const o=1e-5;for(;a.length>n;)a=re.simplify(e,t).map(i=>`${i[0]},${i[1]}`).join("|"),t+=o;return a}function Je(e,n,a={}){const t=P(a.style),o=a.hiDPI?"@2x":"",i=a.format??"png";let r=~~(a.width??1024),s=~~(a.height??1024);a.hiDPI&&(r=~~(r/2),s=~~(s/2));const c=new URL(`maps/${encodeURIComponent(t)}/static/${e[0]},${e[1]},${n}/${r}x${s}${o}.${i}`,p.maptilerApiURL);if("attribution"in a&&c.searchParams.set("attribution",a.attribution.toString()),"markers"in a){let d="";const g="markerIcon"in a;g&&(d+=`icon:${a.markerIcon}|`),g&&"markerAnchor"in a&&(d+=`anchor:${a.markerAnchor}|`),g&&a.hiDPI&&(d+="scale:2|");const u=Array.isArray(a.markers[0])?a.markers:[a.markers];d+=u.map(L=>V(L,!g)).join("|"),c.searchParams.set("markers",d)}if("path"in a){let d="";if(d+=`fill:${a.pathFillColor??"none"}|`,"pathStrokeColor"in a&&(d+=`stroke:${a.pathStrokeColor}|`),"pathWidth"in a){const g=a.pathWidth/(a.hiDPI?2:1);d+=`width:${g.toString()}|`}d+=B(a.path),c.searchParams.set("path",d)}return c.searchParams.set("key",a.apiKey??m.apiKey),c.toString()}function qe(e,n={}){const a=P(n.style),t=n.hiDPI?"@2x":"",o=n.format??"png";let i=~~(n.width??1024),r=~~(n.height??1024);n.hiDPI&&(i=~~(i/2),r=~~(r/2));const s=new URL(`maps/${encodeURIComponent(a)}/static/${e[0]},${e[1]},${e[2]},${e[3]}/${i}x${r}${t}.${o}`,p.maptilerApiURL);if("attribution"in n&&s.searchParams.set("attribution",n.attribution.toString()),"padding"in n&&s.searchParams.set("padding",n.padding.toString()),"markers"in n){let c="";const d="markerIcon"in n;d&&(c+=`icon:${n.markerIcon}|`),d&&"markerAnchor"in n&&(c+=`anchor:${n.markerAnchor}|`),d&&n.hiDPI&&(c+="scale:2|");const g=Array.isArray(n.markers[0])?n.markers:[n.markers];c+=g.map(u=>V(u,!d)).join("|"),s.searchParams.set("markers",c)}if("path"in n){let c="";if(c+=`fill:${n.pathFillColor??"none"}|`,"pathStrokeColor"in n&&(c+=`stroke:${n.pathStrokeColor}|`),"pathWidth"in n){const d=n.pathWidth/(n.hiDPI?2:1);c+=`width:${d.toString()}|`}c+=B(n.path),s.searchParams.set("path",c)}return s.searchParams.set("key",n.apiKey??m.apiKey),s.toString()}function Ye(e={}){if(!("markers"in e)&&!("path"in e))throw new Error("Automatic static maps require markers and/or path to be created.");const n=P(e.style),a=e.hiDPI?"@2x":"",t=e.format??"png";let o=~~(e.width??1024),i=~~(e.height??1024);e.hiDPI&&(o=~~(o/2),i=~~(i/2));const r=new URL(`maps/${encodeURIComponent(n)}/static/auto/${o}x${i}${a}.${t}`,p.maptilerApiURL);if("attribution"in e&&r.searchParams.set("attribution",e.attribution.toString()),"padding"in e&&r.searchParams.set("padding",e.padding.toString()),"markers"in e){let s="";const c="markerIcon"in e;c&&(s+=`icon:${e.markerIcon}|`),c&&"markerAnchor"in e&&(s+=`anchor:${e.markerAnchor}|`),c&&e.hiDPI&&(s+="scale:2|");const d=Array.isArray(e.markers[0])?e.markers:[e.markers];s+=d.map(g=>V(g,!c)).join("|"),r.searchParams.set("markers",s)}if("path"in e){let s="";if(s+=`fill:${e.pathFillColor??"none"}|`,"pathStrokeColor"in e&&(s+=`stroke:${e.pathStrokeColor}|`),"pathWidth"in e){const c=e.pathWidth/(e.hiDPI?2:1);s+=`width:${c.toString()}|`}s+=B(e.path),r.searchParams.set("path",s)}return r.searchParams.set("key",e.apiKey??m.apiKey),r.toString()}const Ze={centered:Je,bounded:qe,automatic:Ye},N=63710088e-1,se=2*Math.PI*N;function ce(e){return(180+e)/360}function le(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function de(e){const n=pe(e);return[ce(n[0]),le(n[1])]}function ge(e){return e*360-180}function me(e){const n=180-e*360;return 360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90}function Qe(e){return[ge(e[0]),me(e[1])]}function G(e,n){const a=Math.PI/180,t=e[1]*a,o=n[1]*a,i=Math.sin(t)*Math.sin(o)+Math.cos(t)*Math.cos(o)*Math.cos((n[0]-e[0])*a);return N*Math.acos(Math.min(i,1))}function Xe(e){const n=Array(e.length);n[0]=0;const a=n.length;for(let t=1;t<a;t++)n[t]=G(e[t-1],e[t])+n[t-1];return n}function pe(e){const n=e[0],a=e[1],t=360,o=((n+180)%t+t)%t-180;return[o===-180?180:o,a]}function fe(e){return se*Math.cos(e*Math.PI/180)}function he(e,n,a=!0){const t=2**n,o=[e[0]*t,e[1]*t];return a?[~~o[0],~~o[1]]:o}function en(e,n,a=!0){const t=de(e);return he(t,n,a)}function M(e){return e*Math.PI/180}function _(e){return e*180/Math.PI}function nn(e,n,a){const t=G(e,n),o=M(e[0]),i=M(e[1]),r=M(n[0]),s=M(n[1]),c=t/N,d=Math.sin((1-a)*c)/Math.sin(c),g=Math.sin(a*c)/Math.sin(c),u=d*Math.cos(i)*Math.cos(o)+g*Math.cos(s)*Math.cos(r),L=d*Math.cos(i)*Math.sin(o)+g*Math.cos(s)*Math.sin(r),v=d*Math.sin(i)+g*Math.sin(s),R=Math.atan2(v,Math.sqrt(u*u+L*L)),l=Math.atan2(L,u);return[_(l),_(R)]}const ue={EARTH_RADIUS:N,EARTH_CIRCUMFERENCE:se,longitudeToMercatorX:ce,latitudeToMercatorY:le,wgs84ToMercator:de,mercatorXToLongitude:ge,mercatorYToLatitude:me,mercatorToWgs84:Qe,haversineDistanceWgs84:G,wrapWgs84:pe,circumferenceAtLatitude:fe,mercatorToTileIndex:he,wgs84ToTileIndex:en,toRadians:M,toDegrees:_,haversineIntermediateWgs84:nn,haversineCumulatedDistanceWgs84:Xe};let z=null;function ye(){return z||(z=new we({maxSize:m.tileCacheSize})),z}async function Ae(e){const n=new Blob([e]),a=await createImageBitmap(n),t=document.createElement("canvas"),o=t.getContext("2d");t.width=a.width,t.height=a.height,o.drawImage(a,0,0);const i=o.getImageData(0,0,t.width,t.height);return{pixels:i.data,width:t.width,height:t.height,components:i.data.length/(t.width*t.height)}}function Le(){if(m.bufferToPixelData)return m.bufferToPixelData;if(typeof window<"u")return Ae;throw new Error("An image file buffer to pixel data parser is necessary. Specify it in `config.bufferToPixelData`")}function W(){return!!m.bufferToPixelData||typeof window<"u"}const an="terrain-rgb-v2",J=50,tn=1e3;let $=null;const Ie={403:"Key is missing, invalid or restricted"};async function on(e,n){e.length>tn&&console.warn("Computing elevation for complex geometries is discouraged - simplify the geometry before proceeding");const a=Math.ceil(e.length/J),t=Array.from({length:a},()=>null).map((i,r)=>{const s=r*J,c=e.slice(s,s+J).map(g=>g.join(",")).join(";"),d=new URL(`elevation/${c}.json`,p.maptilerApiURL);return d.searchParams.set("key",n),f(d.toString())}),o=await Promise.allSettled(t);return(await Promise.all(o.map(async i=>{if(i.status==="rejected")throw new Error(`Some segments could not be fetched, error: ${i.reason}`);if(!i.value.ok)throw new Error(`Some segments could not be fetched, response: ${i.value.status} ${await i.value.text()}, url: ${i.value.url}`);return i.value.json()}))).flat()}async function rn(e,n,a){if(!$){const l=new URL(`tiles/${an}/tiles.json`,p.maptilerApiURL);l.searchParams.set("key",n);const S=l.toString(),y=await f(S);if(y.ok)$=await y.json();else throw new h(y,Ie[y.status]??"")}const t=Le(),o=$.tiles[0],i=ye(),r=$.maxzoom;let s=~~(a??r);(s>r||s<0)&&(s=r);const c=e.map(l=>ue.wgs84ToTileIndex(l,s,!1)),d=c.map(l=>[~~l[0],~~l[1]]).map(l=>`terrain_${s.toString()}_${l[0].toString()}_${l[1].toString()}`),g=Array.from(new Set(d.filter(l=>!i.has(l)))).map(l=>l.split("_").slice(1)),u=g.map(l=>o.replace("{x}",l[1].toString()).replace("{y}",l[2].toString()).replace("{z}",l[0].toString())).map(l=>f(l)),L=(await Promise.allSettled(u)).map(l=>l.status==="fulfilled"?l.value:null).filter(l=>l),v=L.filter(l=>!l.ok);if(L.length!==u.length)throw new Error("Some tiles could not be fetched.");if(v.length)throw new h(v[0],Ie[v[0].status]??"");const R=await Promise.all(L.map(l=>l.arrayBuffer()));if(!R.every(l=>l.byteLength>0))throw new Error("Some tiles are not available.");return(await Promise.all(R.map(l=>t(l)))).forEach((l,S)=>{const y=g[S],w=`terrain_${y[0].toString()}_${y[1].toString()}_${y[2].toString()}`;i.set(w,l)}),e.map((l,S)=>{const y=d[S],w=c[S],I=i.get(y),Se=Math.min(Math.round(I.width*(w[0]%1)),I.width-1),C=(Math.min(Math.round(I.height*(w[1]%1)),I.height-1)*I.width+Se)*I.components,ve=I.pixels[C],Te=I.pixels[C+1],Me=I.pixels[C+2],Re=-1e4+(ve*256*256+Te*256+Me)*.1;return[l[0],l[1],~~(Re*1e3)/1e3]})}async function sn(e,n={}){return(await b([e],n))[0]}async function b(e,n={}){if(e.length===0)return[];const a=n.apiKey??m.apiKey,t=n.computeOn==="client"?await rn(e,a,n.zoom):await on(e,a);if(n.smoothingKernelSize){const o=~~(n.smoothingKernelSize/2)*2+1,i=t.map(s=>s[2]),r=~~(o/2);for(let s=r;s<i.length-r-1;s+=1){let c=0;for(let d=0;d<o;d+=1){const g=i[s-r+d];c+=g}c/=o,t[s][2]=c}}return t}async function cn(e,n={}){if(e.type!=="LineString")throw new Error("The provided object is not a GeoJSON LineString");n.computeOn??(n.computeOn=W()?"client":"server");const a=structuredClone(e),t=await b(a.coordinates,n);return a.coordinates=t,a}async function ln(e,n={}){if(e.type!=="MultiLineString")throw new Error("The provided object is not a GeoJSON MultiLineString");n.computeOn??(n.computeOn=W()?"client":"server");const a=structuredClone(e),t=a.coordinates.map(c=>c.length),o=a.coordinates.flat(),i=await b(o,n),r=[];let s=0;for(const c of t)r.push(i.slice(s,s+c)),s+=c;return a.coordinates=r,a}const dn={at:sn,batch:b,fromLineString:cn,fromMultiLineString:ln};export{q as ClientConfig,Z as ISOLanguage,A as Language,oe as MapStyle,H as MapStyleVariant,Y as NonISOLanguage,x as ReferenceMapStyle,h as ServiceError,Ue as areSameLanguages,Ae as bufferToPixelDataBrowser,W as canParsePixelData,fe as circumferenceAtLatitude,m as config,He as coordinates,Fe as data,dn as elevation,ie as expandMapStyle,be as geocoding,Ke as geolocation,K as getAutoLanguage,Le as getBufferToPixelDataParser,T as getLanguageInfoFromCode,D as getLanguageInfoFromFlag,Q as getLanguageInfoFromKey,ye as getTileCache,j as isLanguageInfo,k as mapStylePresetList,ue as math,re as misc,Ze as staticMaps,P as styleToStyle,O as toLanguageInfo};
|
package/dist/maptiler-client.mjs
CHANGED
|
@@ -1562,7 +1562,6 @@ const mapStylePresetList = [
|
|
|
1562
1562
|
variants: [
|
|
1563
1563
|
{
|
|
1564
1564
|
id: "hybrid",
|
|
1565
|
-
deprecated: true,
|
|
1566
1565
|
name: "Default",
|
|
1567
1566
|
variantType: "DEFAULT",
|
|
1568
1567
|
description: "",
|
|
@@ -2363,89 +2362,87 @@ function getBufferToPixelDataParser() {
|
|
|
2363
2362
|
"An image file buffer to pixel data parser is necessary. Specify it in `config.bufferToPixelData`"
|
|
2364
2363
|
);
|
|
2365
2364
|
}
|
|
2365
|
+
function canParsePixelData() {
|
|
2366
|
+
return !!config.bufferToPixelData || typeof window !== "undefined";
|
|
2367
|
+
}
|
|
2366
2368
|
|
|
2367
|
-
const
|
|
2369
|
+
const TERRAIN_TILESET = "terrain-rgb-v2";
|
|
2370
|
+
const API_BATCH_SIZE = 50;
|
|
2371
|
+
const API_WARN_SIZE = 1e3;
|
|
2368
2372
|
let terrainTileJson = null;
|
|
2369
2373
|
const customMessages = {
|
|
2370
2374
|
403: "Key is missing, invalid or restricted"
|
|
2371
2375
|
};
|
|
2372
|
-
async function
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
if (res.ok) {
|
|
2378
|
-
terrainTileJson = await res.json();
|
|
2379
|
-
return terrainTileJson;
|
|
2380
|
-
} else {
|
|
2381
|
-
if (!res.ok) {
|
|
2382
|
-
throw new ServiceError(res, customMessages[res.status] ?? "");
|
|
2383
|
-
}
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
|
-
async function at(position, options = {}) {
|
|
2387
|
-
const apiKey = options.apiKey ?? config.apiKey;
|
|
2388
|
-
if (!terrainTileJson) {
|
|
2389
|
-
await fetchTerrainTileJson(apiKey);
|
|
2376
|
+
async function computeOnServer(positions, apiKey) {
|
|
2377
|
+
if (positions.length > API_WARN_SIZE) {
|
|
2378
|
+
console.warn(
|
|
2379
|
+
"Computing elevation for complex geometries is discouraged - simplify the geometry before proceeding"
|
|
2380
|
+
);
|
|
2390
2381
|
}
|
|
2391
|
-
const
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
let tilePixelData;
|
|
2404
|
-
const cache = getTileCache();
|
|
2405
|
-
if (cache.has(tileID)) {
|
|
2406
|
-
tilePixelData = cache.get(tileID);
|
|
2407
|
-
} else {
|
|
2408
|
-
const tileURL = terrainTileJson.tiles[0].replace("{x}", tileX.toString()).replace("{y}", tileY.toString()).replace("{z}", zoom.toString());
|
|
2409
|
-
const tileRes = await callFetch(tileURL);
|
|
2410
|
-
if (!tileRes.ok) {
|
|
2411
|
-
throw new ServiceError(tileRes, customMessages[tileRes.status] ?? "");
|
|
2382
|
+
const parts = Math.ceil(positions.length / API_BATCH_SIZE);
|
|
2383
|
+
const respPromises = Array.from({ length: parts }, () => null).map(
|
|
2384
|
+
(_, part) => {
|
|
2385
|
+
const startPos = part * API_BATCH_SIZE;
|
|
2386
|
+
const batch2 = positions.slice(startPos, startPos + API_BATCH_SIZE);
|
|
2387
|
+
const batchEncoded = batch2.map((pos) => pos.join(",")).join(";");
|
|
2388
|
+
const endpoint = new URL(
|
|
2389
|
+
`elevation/${batchEncoded}.json`,
|
|
2390
|
+
defaults.maptilerApiURL
|
|
2391
|
+
);
|
|
2392
|
+
endpoint.searchParams.set("key", apiKey);
|
|
2393
|
+
return callFetch(endpoint.toString());
|
|
2412
2394
|
}
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2395
|
+
);
|
|
2396
|
+
const resps = await Promise.allSettled(respPromises);
|
|
2397
|
+
const jsons = await Promise.all(
|
|
2398
|
+
resps.map(async (resp) => {
|
|
2399
|
+
if (resp.status === "rejected") {
|
|
2400
|
+
throw new Error(
|
|
2401
|
+
`Some segments could not be fetched, error: ${resp.reason}`
|
|
2402
|
+
);
|
|
2403
|
+
}
|
|
2404
|
+
if (!resp.value.ok) {
|
|
2405
|
+
throw new Error(
|
|
2406
|
+
`Some segments could not be fetched, response: ${resp.value.status} ${await resp.value.text()}, url: ${resp.value.url}`
|
|
2407
|
+
);
|
|
2408
|
+
}
|
|
2409
|
+
return resp.value.json();
|
|
2410
|
+
})
|
|
2411
|
+
);
|
|
2412
|
+
return jsons.flat();
|
|
2426
2413
|
}
|
|
2427
|
-
async function
|
|
2428
|
-
const apiKey = options.apiKey ?? config.apiKey;
|
|
2414
|
+
async function computeOnClient(positions, apiKey, zoom) {
|
|
2429
2415
|
if (!terrainTileJson) {
|
|
2430
|
-
|
|
2416
|
+
const endpoint = new URL(
|
|
2417
|
+
`tiles/${TERRAIN_TILESET}/tiles.json`,
|
|
2418
|
+
defaults.maptilerApiURL
|
|
2419
|
+
);
|
|
2420
|
+
endpoint.searchParams.set("key", apiKey);
|
|
2421
|
+
const urlWithParams = endpoint.toString();
|
|
2422
|
+
const res = await callFetch(urlWithParams);
|
|
2423
|
+
if (res.ok) {
|
|
2424
|
+
terrainTileJson = await res.json();
|
|
2425
|
+
} else {
|
|
2426
|
+
throw new ServiceError(res, customMessages[res.status] ?? "");
|
|
2427
|
+
}
|
|
2431
2428
|
}
|
|
2432
2429
|
const tileParser = getBufferToPixelDataParser();
|
|
2433
2430
|
const tileURLSchema = terrainTileJson.tiles[0];
|
|
2434
2431
|
const cache = getTileCache();
|
|
2435
2432
|
const maxZoom = terrainTileJson.maxzoom;
|
|
2436
|
-
let
|
|
2437
|
-
if (
|
|
2438
|
-
|
|
2433
|
+
let usedZoom = ~~(zoom ?? maxZoom);
|
|
2434
|
+
if (usedZoom > maxZoom || usedZoom < 0) {
|
|
2435
|
+
usedZoom = maxZoom;
|
|
2439
2436
|
}
|
|
2440
2437
|
const tileIndicesFloats = positions.map(
|
|
2441
|
-
(position) => math.wgs84ToTileIndex(position,
|
|
2438
|
+
(position) => math.wgs84ToTileIndex(position, usedZoom, false)
|
|
2442
2439
|
);
|
|
2443
2440
|
const tileIndicesInteger = tileIndicesFloats.map((index) => [
|
|
2444
2441
|
~~index[0],
|
|
2445
2442
|
~~index[1]
|
|
2446
2443
|
]);
|
|
2447
2444
|
const tileIDs = tileIndicesInteger.map(
|
|
2448
|
-
(index) => `terrain_${
|
|
2445
|
+
(index) => `terrain_${usedZoom.toString()}_${index[0].toString()}_${index[1].toString()}`
|
|
2449
2446
|
);
|
|
2450
2447
|
const uniqueTilesToFetch = Array.from(
|
|
2451
2448
|
new Set(tileIDs.filter((tileID) => !cache.has(tileID)))
|
|
@@ -2501,6 +2498,17 @@ async function batch(positions, options = {}) {
|
|
|
2501
2498
|
const elevation2 = -1e4 + (R * 256 * 256 + G * 256 + B) * 0.1;
|
|
2502
2499
|
return [position[0], position[1], ~~(elevation2 * 1e3) / 1e3];
|
|
2503
2500
|
});
|
|
2501
|
+
return elevatedPositions;
|
|
2502
|
+
}
|
|
2503
|
+
async function at(position, options = {}) {
|
|
2504
|
+
const elevatedPositions = await batch([position], options);
|
|
2505
|
+
return elevatedPositions[0];
|
|
2506
|
+
}
|
|
2507
|
+
async function batch(positions, options = {}) {
|
|
2508
|
+
if (positions.length === 0)
|
|
2509
|
+
return [];
|
|
2510
|
+
const apiKey = options.apiKey ?? config.apiKey;
|
|
2511
|
+
const elevatedPositions = options.computeOn === "client" ? await computeOnClient(positions, apiKey, options.zoom) : await computeOnServer(positions, apiKey);
|
|
2504
2512
|
if (options.smoothingKernelSize) {
|
|
2505
2513
|
const kernelSize = ~~(options.smoothingKernelSize / 2) * 2 + 1;
|
|
2506
2514
|
const elevations = elevatedPositions.map((pos) => pos[2]);
|
|
@@ -2521,6 +2529,7 @@ async function fromLineString(ls, options = {}) {
|
|
|
2521
2529
|
if (ls.type !== "LineString") {
|
|
2522
2530
|
throw new Error("The provided object is not a GeoJSON LineString");
|
|
2523
2531
|
}
|
|
2532
|
+
options.computeOn ?? (options.computeOn = canParsePixelData() ? "client" : "server");
|
|
2524
2533
|
const clone = structuredClone(ls);
|
|
2525
2534
|
const elevatedPositions = await batch(clone.coordinates, options);
|
|
2526
2535
|
clone.coordinates = elevatedPositions;
|
|
@@ -2530,6 +2539,7 @@ async function fromMultiLineString(ls, options = {}) {
|
|
|
2530
2539
|
if (ls.type !== "MultiLineString") {
|
|
2531
2540
|
throw new Error("The provided object is not a GeoJSON MultiLineString");
|
|
2532
2541
|
}
|
|
2542
|
+
options.computeOn ?? (options.computeOn = canParsePixelData() ? "client" : "server");
|
|
2533
2543
|
const clone = structuredClone(ls);
|
|
2534
2544
|
const multiLengths = clone.coordinates.map((poss) => poss.length);
|
|
2535
2545
|
const flattenPositions = clone.coordinates.flat();
|
|
@@ -2550,5 +2560,5 @@ const elevation = {
|
|
|
2550
2560
|
fromMultiLineString
|
|
2551
2561
|
};
|
|
2552
2562
|
|
|
2553
|
-
export { ClientConfig, ISOLanguage, Language, MapStyle, MapStyleVariant, NonISOLanguage, ReferenceMapStyle, ServiceError, areSameLanguages, bufferToPixelDataBrowser, circumferenceAtLatitude, config, coordinates, data, elevation, expandMapStyle, geocoding, geolocation, getAutoLanguage, getBufferToPixelDataParser, getLanguageInfoFromCode, getLanguageInfoFromFlag, getLanguageInfoFromKey, getTileCache, isLanguageInfo, mapStylePresetList, math, misc, staticMaps, styleToStyle, toLanguageInfo };
|
|
2563
|
+
export { ClientConfig, ISOLanguage, Language, MapStyle, MapStyleVariant, NonISOLanguage, ReferenceMapStyle, ServiceError, areSameLanguages, bufferToPixelDataBrowser, canParsePixelData, circumferenceAtLatitude, config, coordinates, data, elevation, expandMapStyle, geocoding, geolocation, getAutoLanguage, getBufferToPixelDataParser, getLanguageInfoFromCode, getLanguageInfoFromFlag, getLanguageInfoFromKey, getTileCache, isLanguageInfo, mapStylePresetList, math, misc, staticMaps, styleToStyle, toLanguageInfo };
|
|
2554
2564
|
//# sourceMappingURL=maptiler-client.mjs.map
|