@defra/interactive-map 0.0.54-alpha → 0.0.55-alpha
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/assets/templates/add-polygons.njk +1 -1
- package/assets/templates/add-symbols.njk +4 -4
- package/assets/templates/draw-tools.njk +7 -7
- package/assets/templates/marker-panel.njk +5 -5
- package/assets/templates/place-marker.njk +8 -8
- package/assets/templates/search-control.njk +1 -1
- package/assets/templates/select-feature.njk +7 -7
- package/assets/templates/style-switcher.njk +4 -4
- package/assets/templates/toggle-marker-label.njk +3 -3
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/im-shell.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/im-core.js.LICENSE.txt +0 -30
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.LICENSE.txt +0 -20
- package/docs/api.md +3 -13
- package/docs/building-a-plugin.md +2 -2
- package/docs/examples/add-marker-with-panel.mdx +46 -44
- package/docs/examples/add-polygons.mdx +100 -98
- package/docs/examples/add-symbols.mdx +75 -73
- package/docs/examples/basic-map.mdx +16 -14
- package/docs/examples/button-map.mdx +16 -14
- package/docs/examples/draw-tools.mdx +119 -117
- package/docs/examples/place-marker.mdx +51 -49
- package/docs/examples/search-control.mdx +22 -20
- package/docs/examples/select-feature.mdx +107 -105
- package/docs/examples/style-switcher.mdx +47 -45
- package/docs/examples/toggle-marker-label.mdx +30 -28
- package/docs/getting-started.md +26 -24
- package/docs/plugins/draw.md +10 -10
- package/docs/plugins/interact.md +9 -9
- package/docs/plugins/plugin-descriptor.md +1 -1
- package/docs/plugins/search.md +3 -3
- package/docusaurus.config.cjs +23 -0
- package/package.json +3 -7
- package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -1
- package/plugins/beta/draw-es/dist/esm/index.js +1 -1
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/dist/esm/index.js +1 -1
- package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/dist/umd/index.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/DrawMode.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/EditMode.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/geometryHelpers.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/im-draw-ol-plugin.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/index.js +1 -1
- package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -1
- package/plugins/beta/frame/dist/esm/index.js +1 -1
- package/plugins/beta/frame/dist/umd/im-frame-plugin.js +1 -1
- package/plugins/beta/frame/dist/umd/index.js +1 -1
- package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/esm/index.js +1 -1
- package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/umd/index.js +1 -1
- package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -1
- package/plugins/beta/scale-bar/dist/esm/index.js +1 -1
- package/plugins/beta/scale-bar/dist/umd/im-scale-bar-plugin.js +1 -1
- package/plugins/beta/scale-bar/dist/umd/index.js +1 -1
- package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -1
- package/plugins/beta/use-location/dist/esm/index.js +1 -1
- package/plugins/beta/use-location/dist/umd/im-use-location-plugin.js +1 -1
- package/plugins/beta/use-location/dist/umd/index.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-esri-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ol-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/esm/index.js +1 -1
- package/plugins/datasets/dist/esm/layerAdapter.js +1 -1
- package/plugins/datasets/dist/esm/mapboxStyleLayerAdapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/umd/index.js +1 -1
- package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/esm/index.js +1 -1
- package/plugins/draw/dist/esm/liveDrawChecks.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/umd/index.js +1 -1
- package/plugins/draw/src/adapters/maplibre/styles.js +3 -2
- package/plugins/draw/src/adapters/maplibre/styles.test.js +3 -3
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/esm/index.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/index.js +1 -1
- package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/esm/index.js +1 -1
- package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/umd/index.js +1 -1
- package/plugins/menu/dist/esm/im-menu-plugin.js +1 -1
- package/plugins/menu/dist/esm/index.js +1 -1
- package/plugins/menu/dist/umd/im-menu-plugin.js +1 -1
- package/plugins/menu/dist/umd/index.js +1 -1
- package/plugins/search/dist/esm/im-search-plugin.js +1 -1
- package/plugins/search/dist/esm/index.js +1 -1
- package/plugins/search/dist/umd/im-search-plugin.js +1 -1
- package/plugins/search/dist/umd/index.js +1 -1
- package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
- package/providers/beta/esri/dist/esm/index.js +1 -1
- package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +1 -1
- package/providers/beta/open-names/dist/esm/index.js +1 -1
- package/providers/beta/open-names/dist/umd/im-reverse-geocode.js +1 -1
- package/providers/beta/open-names/dist/umd/index.js +1 -1
- package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/esm/index.js +1 -1
- package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/umd/index.js +1 -1
- package/providers/beta/openlayers/src/index.js +27 -4
- package/providers/beta/openlayers/src/index.test.js +47 -0
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/esm/index.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-framework.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-framework.js.LICENSE.txt +3 -3
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-worker.js +2 -0
- package/providers/maplibre/dist/umd/im-maplibre-worker.js.LICENSE.txt +4 -0
- package/providers/maplibre/dist/umd/index.js +1 -1
- package/providers/maplibre/src/index.js +41 -12
- package/providers/maplibre/src/index.test.js +43 -12
- package/providers/maplibre/src/utils/detectModuleWorker.js +25 -0
- package/providers/maplibre/src/utils/detectModuleWorker.test.js +40 -0
- package/providers/maplibre/src/utils/spatial.js +22 -12
- package/providers/maplibre/src/utils/spatial.test.js +6 -6
- package/providers/maplibre/src/utils/workerUrl.js +15 -0
- package/providers/maplibre/src/utils/workerUrl.test.js +14 -0
- package/rollup.esm.mjs +38 -1
- package/src/InteractiveMap/InteractiveMap.js +2 -1
- package/src/InteractiveMap/InteractiveMap.test.js +9 -2
- package/src/InteractiveMap/domStateManager.js +21 -1
- package/src/InteractiveMap/domStateManager.test.js +48 -1
- package/src/InteractiveMap/polyfills.js +4 -3
- package/src/InteractiveMap/polyfills.test.js +12 -0
- package/src/types.js +3 -5
- package/webpack.dev.mjs +2 -0
- package/webpack.umd.mjs +28 -7
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.openLayersProvider=t())}(this,()
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.openLayersProvider=t())}(Object("undefined"!=typeof self?self:this),function(){return function(){"use strict";var e,t,r={},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.m=r,o.d=function(e,t){for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=function(e){return Promise.all(Object.keys(o.f).reduce(function(t,r){return o.f[r](e,t),t},[]))},o.u=function(e){return"im-openlayers-provider.js"},o.miniCssF=function(e){},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e={},t="defra.openLayersProvider:",o.l=function(r,n,i,u){if(e[r])e[r].push(n);else{var a,c;if(void 0!==i)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var s=f[p];if(s.getAttribute("src")==r||s.getAttribute("data-webpack")==t+i){a=s;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",o.nc&&a.setAttribute("nonce",o.nc),a.setAttribute("data-webpack",t+i),a.src=r),e[r]=[n];var l=function(t,n){a.onerror=a.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach(function(e){return e(n)}),t)return t(n)},d=setTimeout(l.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=l.bind(null,a.onerror),a.onload=l.bind(null,a.onload),c&&document.head.appendChild(a)}},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},function(){var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e}(),function(){var e={57:0};o.f.j=function(t,r){var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise(function(r,o){n=e[t]=[r,o]});r.push(n[2]=i);var u=o.p+o.u(t),a=new Error;o.l(u,function(r){if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+i+": "+u+")",a.name="ChunkLoadError",a.type=i,a.request=u,n[1](a)}},"chunk-"+t,t)}};var t=function(t,r){var n,i,u=r[0],a=r[1],c=r[2],f=0;if(u.some(function(t){return 0!==e[t]})){for(n in a)o.o(a,n)&&(o.m[n]=a[n]);c&&c(o)}for(t&&t(r);f<u.length;f++)i=u[f],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap=Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))}();var i={};function u(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof f?n:f,p=Object.create(u.prototype);return a(p,"_invoke",function(r,n,o){var i,u,a,f=0,p=o||[],s=!1,l={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,u=0,a=e,l.n=r,c}};function d(r,n){for(u=r,a=n,t=0;!s&&f&&!o&&t<p.length;t++){var o,i=p[t],d=l.p,v=i[2];r>3?(o=v===n)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(u=0,l.v=n,l.n=i[1]):d<v&&(o=r<3||i[0]>n||n>v)&&(i[4]=r,i[5]=n,l.n=v,u=0))}if(o||r>1)return c;throw s=!0,n}return function(o,p,v){if(f>1)throw TypeError("Generator is already running");for(s&&1===p&&d(p,v),u=p,a=v;(t=u<2?e:a)||!s;){i||(u?u<3?(u>1&&(l.n=-1),d(u,a)):l.n=a:l.v=a);try{if(f=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(s=l.n<0)?a:r.call(n,l))!==c)break}catch(t){i=e,u=1,a=t}finally{f=1}}return{value:t,done:s}}}(r,o,i),!0),p}var c={};function f(){}function p(){}function s(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(a(t={},n,function(){return this}),t),d=s.prototype=f.prototype=Object.create(l);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,a(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return p.prototype=s,a(d,"constructor",s),a(s,"constructor",p),p.displayName="GeneratorFunction",a(s,o,"GeneratorFunction"),a(d),a(d,o,"Generator"),a(d,n,function(){return this}),a(d,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:v}})()}function a(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}a=function(e,t,r,n){function i(t,r){a(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},a(e,t,r,n)}function c(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function f(){var e,t,r=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).zoomAlignment;return{checkDeviceCapabilities:function(){var e=document.documentMode?"Internet Explorer is not supported":document.createElement("canvas").getContext?"function"!=typeof[].at?"Browser does not support the JavaScript features OpenLayers requires":void 0:"Canvas is not supported in this browser";return{isSupported:!e,error:e}},load:(e=u().m(function e(){var t,n;return u().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.e(142).then(o.bind(o,256));case 1:return t=e.v.default,n={zoomAlignment:r,crs:"EPSG:27700"},e.a(2,{MapProvider:t,mapProviderConfig:n})}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function u(e){c(i,n,o,u,a,"next",e)}function a(e){c(i,n,o,u,a,"throw",e)}u(void 0)})},function(){return t.apply(this,arguments)})}}return o.d(i,{default:function(){return f}}),i.default}()});
|
|
@@ -5,6 +5,26 @@
|
|
|
5
5
|
* @typedef {import('../../../../src/types.js').OpenLayersProviderConfig} OpenLayersProviderConfig
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Returns the reason the device cannot run OpenLayers, or undefined if it can.
|
|
10
|
+
* OpenLayers uses class fields and private methods (Chrome 84 / Firefox 90 /
|
|
11
|
+
* Safari 15); `Array.prototype.at` (Chrome 92 / Firefox 90 / Safari 15.4) is the proxy.
|
|
12
|
+
*
|
|
13
|
+
* @returns {string|undefined}
|
|
14
|
+
*/
|
|
15
|
+
function getUnsupportedReason () {
|
|
16
|
+
if (document.documentMode) {
|
|
17
|
+
return 'Internet Explorer is not supported'
|
|
18
|
+
}
|
|
19
|
+
if (!document.createElement('canvas').getContext) {
|
|
20
|
+
return 'Canvas is not supported in this browser'
|
|
21
|
+
}
|
|
22
|
+
if (typeof [].at !== 'function') {
|
|
23
|
+
return 'Browser does not support the JavaScript features OpenLayers requires'
|
|
24
|
+
}
|
|
25
|
+
return undefined
|
|
26
|
+
}
|
|
27
|
+
|
|
8
28
|
/**
|
|
9
29
|
* Creates an OpenLayers provider descriptor for lazy-loading the map provider.
|
|
10
30
|
*
|
|
@@ -13,10 +33,13 @@
|
|
|
13
33
|
*/
|
|
14
34
|
export default function createOpenLayersProvider ({ zoomAlignment } = {}) {
|
|
15
35
|
return {
|
|
16
|
-
checkDeviceCapabilities: () =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
36
|
+
checkDeviceCapabilities: () => {
|
|
37
|
+
const error = getUnsupportedReason()
|
|
38
|
+
return {
|
|
39
|
+
isSupported: !error,
|
|
40
|
+
error
|
|
41
|
+
}
|
|
42
|
+
},
|
|
20
43
|
/** @returns {Promise<MapProviderLoadResult>} */
|
|
21
44
|
load: async () => {
|
|
22
45
|
const MapProvider = (await import(/* webpackChunkName: "im-openlayers-provider" */ './openlayersProvider.js')).default
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import createOpenLayersProvider from './index.js'
|
|
2
|
+
|
|
3
|
+
describe('createOpenLayersProvider checkDeviceCapabilities', () => {
|
|
4
|
+
test('modern browser with canvas → isSupported true', () => {
|
|
5
|
+
const result = createOpenLayersProvider().checkDeviceCapabilities()
|
|
6
|
+
|
|
7
|
+
expect(result.isSupported).toBe(true)
|
|
8
|
+
expect(result.error).toBeFalsy()
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('Internet Explorer → isSupported false', () => {
|
|
12
|
+
Object.defineProperty(document, 'documentMode', { get: () => 11, configurable: true })
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
const result = createOpenLayersProvider().checkDeviceCapabilities()
|
|
16
|
+
expect(result.isSupported).toBe(false)
|
|
17
|
+
expect(result.error).toBe('Internet Explorer is not supported')
|
|
18
|
+
} finally {
|
|
19
|
+
Object.defineProperty(document, 'documentMode', { get: () => undefined, configurable: true })
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
test('no canvas support → isSupported false', () => {
|
|
24
|
+
const createElement = jest.spyOn(document, 'createElement').mockReturnValue({})
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const result = createOpenLayersProvider().checkDeviceCapabilities()
|
|
28
|
+
expect(result.isSupported).toBe(false)
|
|
29
|
+
expect(result.error).toBe('Canvas is not supported in this browser')
|
|
30
|
+
} finally {
|
|
31
|
+
createElement.mockRestore()
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
test('no Array.prototype.at → isSupported false', () => {
|
|
36
|
+
const restoreAt = Array.prototype.at
|
|
37
|
+
delete Array.prototype.at // eslint-disable-line no-extend-native
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const result = createOpenLayersProvider().checkDeviceCapabilities()
|
|
41
|
+
expect(result.isSupported).toBe(false)
|
|
42
|
+
expect(result.error).toBe('Browser does not support the JavaScript features OpenLayers requires')
|
|
43
|
+
} finally {
|
|
44
|
+
Array.prototype.at = restoreAt // eslint-disable-line no-extend-native
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/objectWithoutProperties";import a from"@babel/runtime/helpers/asyncToGenerator";class r{_notImplemented(t){throw new Error("".concat(this.name," must implement ").concat(t,"()"))}isBaseMapReady(){this._notImplemented("isBaseMapReady")}addSymbolsToMap(){this._notImplemented("addSymbolsToMap")}addPatternsToMap(){this._notImplemented("addPatternsToMap")}getActiveSymbolImageId(){this._notImplemented("getActiveSymbolImageId")}getSelectedSymbolImageId(){this._notImplemented("getSelectedSymbolImageId")}}var n=400,i=7,o=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];var s=(t,e)=>{var a=null,r=function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];clearTimeout(a),a=setTimeout(()=>{t(...n)},e)};return r.cancel=()=>{a&&(clearTimeout(a),a=null)},r};function l(t){var{map:e,events:a,eventBus:r,getCenter:n,getZoom:i,getBounds:o,getResolution:l}=t,h=[],c=[],u=()=>{var t=i();return{center:n(),bounds:o(),resolution:l(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},d=(t,e)=>r.emit(t,e),g=()=>d(a.MAP_LOADED);e.on("load",g),h.push(["load",g]);e.once("idle",()=>d(a.MAP_FIRST_IDLE,u()));var p=()=>d(a.MAP_MOVE_START);e.on("movestart",p),h.push(["movestart",p]);var m=s(()=>{d(a.MAP_MOVE_END,u())},500);e.on("moveend",m),h.push(["moveend",m]);var y,f,v,M=(y=()=>{d(a.MAP_MOVE,u())},f=10,v=0,function(){var t=Date.now();t-v>=f&&(v=t,y(...arguments))});e.on("zoom",M),h.push(["zoom",M]);var b=()=>d(a.MAP_RENDER);e.on("render",b),h.push(["render",b]);var w=s(()=>{d(a.MAP_DATA_CHANGE,u())},500),I=t=>{t.isSourceLoaded&&w()};e.on("styledata",w),e.on("sourcedata",I),h.push(["styledata",w],["sourcedata",I]);var x=()=>d(a.MAP_STYLE_CHANGE);e.on("style.load",x),h.push(["style.load",x]);var S=t=>d(a.MAP_CLICK,{point:t.point,coords:[t.lngLat.lng,t.lngLat.lat]});return e.on("click",S),h.push(["click",S]),c.push(m,M,w),{remove(){c.forEach(t=>t.cancel()),h.forEach(t=>{var[a,r]=t;return e.off(a,r)})}}}let h=" ";class c{static get separator(){return h}static set separator(t){h=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let a=null;switch(e.length){case 3:a=e[0]/1+e[1]/60+e[2]/3600;break;case 2:a=e[0]/1+e[1]/60;break;case 1:a=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(a=-a),Number(a)}static toDms(t,e="d",a=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===a)switch(e){case"d":case"deg":a=4;break;case"dm":case"deg+min":a=2;break;case"dms":case"deg+min+sec":a=0;break;default:e="d",a=4}t=Math.abs(t);let r=null,n=null,i=null,o=null;switch(e){default:case"d":case"deg":n=t.toFixed(a),n<100&&(n="0"+n),n<10&&(n="0"+n),r=n+"°";break;case"dm":case"deg+min":n=Math.floor(t),i=(60*t%60).toFixed(a),60==i&&(i=(0).toFixed(a),n++),n=("000"+n).slice(-3),i<10&&(i="0"+i),r=n+"°"+c.separator+i+"′";break;case"dms":case"deg+min+sec":n=Math.floor(t),i=Math.floor(3600*t/60)%60,o=(3600*t%60).toFixed(a),60==o&&(o=(0).toFixed(a),i++),60==i&&(i=0,n++),n=("000"+n).slice(-3),i=("00"+i).slice(-2),o<10&&(o="0"+o),r=n+"°"+c.separator+i+"′"+c.separator+o+"″"}return r}static toLat(t,e,a){const r=c.toDms(c.wrap90(t),e,a);return null===r?"–":r.slice(1)+c.separator+(t<0?"S":"N")}static toLon(t,e,a){const r=c.toDms(c.wrap180(t),e,a);return null===r?"–":r+c.separator+(t<0?"W":"E")}static toBrng(t,e,a){const r=c.toDms(c.wrap360(t),e,a);return null===r?"–":r.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),a={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(a.thousands,"⁜").replace(a.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),a={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",a.decimal).replace("⁜",a.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=c.wrap360(t);const a=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*a/360)%a*16/a]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t,a=360;return 1*Math.abs(((e-90)%a+a)%a-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const u=Math.PI;class d{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=c.wrap90(Number(t)),this._lon=c.wrap180(Number(e))}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?c.wrap90(c.parse(t)):c.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?c.wrap90(c.parse(t)):c.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?c.wrap180(c.parse(t)):c.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?c.wrap180(c.parse(t)):c.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?c.wrap180(c.parse(t)):c.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}static get metresToKm(){return.001}static get metresToMiles(){return 1/1609.344}static get metresToNauticalMiles(){return 1/1852}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");if(null===t[0]||null===t[1])throw new TypeError("invalid (null) point");let e,a;if(2==t.length&&([e,a]=t,e=c.wrap90(c.parse(e)),a=c.wrap180(c.parse(a)),isNaN(e)||isNaN(a)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,a]=t[0].split(","),e=c.wrap90(c.parse(e)),a=c.wrap180(c.parse(a)),isNaN(e)||isNaN(a)))throw new TypeError(`invalid point ‘${t[0]}’`);if(1==t.length&&"object"==typeof t[0]){const r=t[0];if("Point"==r.type&&Array.isArray(r.coordinates)?[a,e]=r.coordinates:(null!=r.latitude&&(e=r.latitude),null!=r.lat&&(e=r.lat),null!=r.longitude&&(a=r.longitude),null!=r.lng&&(a=r.lng),null!=r.lon&&(a=r.lon),e=c.wrap90(c.parse(e)),a=c.wrap180(c.parse(a))),isNaN(e)||isNaN(a))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(a))throw new TypeError(`invalid point ‘${t.toString()}’`);return new d(e,a)}distanceTo(t,e=6371e3){if(t instanceof d||(t=d.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const a=e,r=this.lat.toRadians(),n=this.lon.toRadians(),i=t.lat.toRadians(),o=i-r,s=t.lon.toRadians()-n,l=Math.sin(o/2)*Math.sin(o/2)+Math.cos(r)*Math.cos(i)*Math.sin(s/2)*Math.sin(s/2);return a*(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)))}initialBearingTo(t){if(t instanceof d||(t=d.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),a=t.lat.toRadians(),r=(t.lon-this.lon).toRadians(),n=Math.cos(e)*Math.sin(a)-Math.sin(e)*Math.cos(a)*Math.cos(r),i=Math.sin(r)*Math.cos(a),o=Math.atan2(i,n).toDegrees();return c.wrap360(o)}finalBearingTo(t){t instanceof d||(t=d.parse(t));const e=t.initialBearingTo(this)+180;return c.wrap360(e)}midpointTo(t){t instanceof d||(t=d.parse(t));const e=this.lat.toRadians(),a=this.lon.toRadians(),r=t.lat.toRadians(),n=(t.lon-this.lon).toRadians(),i=Math.cos(e),o=0,s=Math.sin(e),l={x:i+Math.cos(r)*Math.cos(n),y:o+Math.cos(r)*Math.sin(n),z:s+Math.sin(r)},h=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),c=a+Math.atan2(l.y,l.x),u=h.toDegrees(),g=c.toDegrees();return new d(u,g)}intermediatePointTo(t,e){if(t instanceof d||(t=d.parse(t)),this.equals(t))return new d(this.lat,this.lon);const a=this.lat.toRadians(),r=this.lon.toRadians(),n=t.lat.toRadians(),i=t.lon.toRadians(),o=n-a,s=i-r,l=Math.sin(o/2)*Math.sin(o/2)+Math.cos(a)*Math.cos(n)*Math.sin(s/2)*Math.sin(s/2),h=2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),c=Math.sin((1-e)*h)/Math.sin(h),u=Math.sin(e*h)/Math.sin(h),g=c*Math.cos(a)*Math.cos(r)+u*Math.cos(n)*Math.cos(i),p=c*Math.cos(a)*Math.sin(r)+u*Math.cos(n)*Math.sin(i),m=c*Math.sin(a)+u*Math.sin(n),y=Math.atan2(m,Math.sqrt(g*g+p*p)),f=Math.atan2(p,g),v=y.toDegrees(),M=f.toDegrees();return new d(v,M)}destinationPoint(t,e,a=6371e3){const r=t/a,n=Number(e).toRadians(),i=this.lat.toRadians(),o=this.lon.toRadians(),s=Math.sin(i)*Math.cos(r)+Math.cos(i)*Math.sin(r)*Math.cos(n),l=Math.asin(s),h=Math.sin(n)*Math.sin(r)*Math.cos(i),c=Math.cos(r)-Math.sin(i)*s,u=o+Math.atan2(h,c),g=l.toDegrees(),p=u.toDegrees();return new d(g,p)}static intersection(t,e,a,r){if(t instanceof d||(t=d.parse(t)),a instanceof d||(a=d.parse(a)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(r))throw new TypeError(`invalid brng2 ‘${r}’`);const n=t.lat.toRadians(),i=t.lon.toRadians(),o=a.lat.toRadians(),s=a.lon.toRadians(),l=Number(e).toRadians(),h=Number(r).toRadians(),c=o-n,g=s-i,p=2*Math.asin(Math.sqrt(Math.sin(c/2)*Math.sin(c/2)+Math.cos(n)*Math.cos(o)*Math.sin(g/2)*Math.sin(g/2)));if(Math.abs(p)<Number.EPSILON)return new d(t.lat,t.lon);const m=(Math.sin(o)-Math.sin(n)*Math.cos(p))/(Math.sin(p)*Math.cos(n)),y=(Math.sin(n)-Math.sin(o)*Math.cos(p))/(Math.sin(p)*Math.cos(o)),f=Math.acos(Math.min(Math.max(m,-1),1)),v=Math.acos(Math.min(Math.max(y,-1),1)),M=l-(Math.sin(s-i)>0?f:2*u-f),b=(Math.sin(s-i)>0?2*u-v:v)-h;if(0==Math.sin(M)&&0==Math.sin(b))return null;if(Math.sin(M)*Math.sin(b)<0)return null;const w=-Math.cos(M)*Math.cos(b)+Math.sin(M)*Math.sin(b)*Math.cos(p),I=Math.atan2(Math.sin(p)*Math.sin(M)*Math.sin(b),Math.cos(b)+Math.cos(M)*w),x=Math.asin(Math.min(Math.max(Math.sin(n)*Math.cos(I)+Math.cos(n)*Math.sin(I)*Math.cos(l),-1),1)),S=i+Math.atan2(Math.sin(l)*Math.sin(I)*Math.cos(n),Math.cos(I)-Math.sin(n)*Math.sin(x)),P=x.toDegrees(),N=S.toDegrees();return new d(P,N)}crossTrackDistanceTo(t,e,a=6371e3){t instanceof d||(t=d.parse(t)),e instanceof d||(e=d.parse(e));const r=a;if(this.equals(t))return 0;const n=t.distanceTo(this,r)/r,i=t.initialBearingTo(this).toRadians(),o=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(n)*Math.sin(i-o))*r}alongTrackDistanceTo(t,e,a=6371e3){t instanceof d||(t=d.parse(t)),e instanceof d||(e=d.parse(e));const r=a;if(this.equals(t))return 0;const n=t.distanceTo(this,r)/r,i=t.initialBearingTo(this).toRadians(),o=t.initialBearingTo(e).toRadians(),s=Math.asin(Math.sin(n)*Math.sin(i-o));return Math.acos(Math.cos(n)/Math.abs(Math.cos(s)))*Math.sign(Math.cos(o-i))*r}maxLatitude(t){const e=Number(t).toRadians(),a=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(a))).toDegrees()}static crossingParallels(t,e,a){if(t.equals(e))return null;const r=Number(a).toRadians(),n=t.lat.toRadians(),i=t.lon.toRadians(),o=e.lat.toRadians(),s=e.lon.toRadians()-i,l=Math.sin(n)*Math.cos(o)*Math.cos(r)*Math.sin(s),h=Math.sin(n)*Math.cos(o)*Math.cos(r)*Math.cos(s)-Math.cos(n)*Math.sin(o)*Math.cos(r),u=Math.cos(n)*Math.cos(o)*Math.sin(r)*Math.sin(s);if(u*u>l*l+h*h)return null;const d=Math.atan2(-h,l),g=Math.acos(u/Math.sqrt(l*l+h*h)),p=i+d+g,m=(i+d-g).toDegrees(),y=p.toDegrees();return{lon1:c.wrap180(m),lon2:c.wrap180(y)}}rhumbDistanceTo(t,e=6371e3){t instanceof d||(t=d.parse(t));const a=e,r=this.lat.toRadians(),n=t.lat.toRadians(),i=n-r;let o=Math.abs(t.lon-this.lon).toRadians();Math.abs(o)>u&&(o=o>0?-(2*u-o):2*u+o);const s=Math.log(Math.tan(n/2+u/4)/Math.tan(r/2+u/4)),l=Math.abs(s)>1e-11?i/s:Math.cos(r);return Math.sqrt(i*i+l*l*o*o)*a}rhumbBearingTo(t){if(t instanceof d||(t=d.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),a=t.lat.toRadians();let r=(t.lon-this.lon).toRadians();Math.abs(r)>u&&(r=r>0?-(2*u-r):2*u+r);const n=Math.log(Math.tan(a/2+u/4)/Math.tan(e/2+u/4)),i=Math.atan2(r,n).toDegrees();return c.wrap360(i)}rhumbDestinationPoint(t,e,a=6371e3){const r=this.lat.toRadians(),n=this.lon.toRadians(),i=Number(e).toRadians(),o=t/a,s=o*Math.cos(i);let l=r+s;Math.abs(l)>u/2&&(l=l>0?u-l:-u-l);const h=Math.log(Math.tan(l/2+u/4)/Math.tan(r/2+u/4)),c=Math.abs(h)>1e-11?s/h:Math.cos(r),g=n+o*Math.sin(i)/c,p=l.toDegrees(),m=g.toDegrees();return new d(p,m)}rhumbMidpointTo(t){t instanceof d||(t=d.parse(t));const e=this.lat.toRadians();let a=this.lon.toRadians();const r=t.lat.toRadians(),n=t.lon.toRadians();Math.abs(n-a)>u&&(a+=2*u);const i=(e+r)/2,o=Math.tan(u/4+e/2),s=Math.tan(u/4+r/2),l=Math.tan(u/4+i/2);let h=((n-a)*Math.log(l)+a*Math.log(s)-n*Math.log(o))/Math.log(s/o);isFinite(h)||(h=(a+n)/2);const c=i.toDegrees(),g=h.toDegrees();return new d(c,g)}static areaOf(t,e=6371e3){const a=e,r=t[0].equals(t[t.length-1]);r||t.push(t[0]);const n=t.length-1;let i=0;for(let e=0;e<n;e++){const a=t[e].lat.toRadians(),r=t[e+1].lat.toRadians(),n=(t[e+1].lon-t[e].lon).toRadians();i+=2*Math.atan2(Math.tan(n/2)*(Math.tan(a/2)+Math.tan(r/2)),1+Math.tan(a/2)*Math.tan(r/2))}(function(t){let e=0,a=t[0].initialBearingTo(t[1]);for(let r=0;r<t.length-1;r++){const n=t[r].initialBearingTo(t[r+1]),i=t[r].finalBearingTo(t[r+1]);e+=(n-a+540)%360-180,e+=(i-n+540)%360-180,a=i}const r=t[0].initialBearingTo(t[1]);e+=(r-a+540)%360-180;return Math.abs(e)<90})(t)&&(i=Math.abs(i)-2*u);const o=Math.abs(i*a*a);return r||t.pop(),o}equals(t){return t instanceof d||(t=d.parse(t)),!(Math.abs(this.lat-t.lat)>Number.EPSILON)&&!(Math.abs(this.lon-t.lon)>Number.EPSILON)}toGeoJSON(){return{type:"Point",coordinates:[this.lon,this.lat]}}toString(t="d",e=void 0){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);if("n"==t)return null==e&&(e=4),`${this.lat.toFixed(e)},${this.lon.toFixed(e)}`;return`${c.toLat(this.lat,t,e)}, ${c.toLon(this.lon,t,e)}`}}function g(t,e,a){if(null!==t)for(var r,n,i,o,s,l,h,c,u=0,d=0,p=t.type,m="FeatureCollection"===p,y="Feature"===p,f=m?t.features.length:1,v=0;v<f;v++){s=(c=!!(h=m?t.features[v].geometry:y?t.geometry:t)&&"GeometryCollection"===h.type)?h.geometries.length:1;for(var M=0;M<s;M++){var b=0,w=0;if(null!==(o=c?h.geometries[M]:h)){l=o.coordinates;var I=o.type;switch(u=0,I){case null:break;case"Point":if(!1===e(l,d,v,b,w))return!1;d++,b++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(!1===e(l[r],d,v,b,w))return!1;d++,"MultiPoint"===I&&b++}"LineString"===I&&b++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(n=0;n<l[r].length-u;n++){if(!1===e(l[r][n],d,v,b,w))return!1;d++}"MultiLineString"===I&&b++,"Polygon"===I&&w++}"Polygon"===I&&b++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(w=0,n=0;n<l[r].length;n++){for(i=0;i<l[r][n].length-u;i++){if(!1===e(l[r][n][i],d,v,b,w))return!1;d++}w++}b++}break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===g(o.geometries[r],e))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var p=function(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const a=[1/0,1/0,-1/0,-1/0];return g(t,t=>{a[0]>t[0]&&(a[0]=t[0]),a[1]>t[1]&&(a[1]=t[1]),a[2]<t[0]&&(a[2]=t[0]),a[3]<t[1]&&(a[3]=t[1])}),a},m=(t,e)=>{var[a,r]=t,[n,i]=e,o=new d(r,a),s=new d(i,n);return o.distanceTo(s)},y=t=>{var e=t/1609.344;if(e<.5){var a=Math.round(t),r=1===a?"metre":"metres";return"".concat(a," ").concat(r)}if(e<10){var n=Number.parseFloat(e.toFixed(1)),i=1===n?"mile":"miles";return"".concat(n," ").concat(i)}var o=Math.round(e);return"".concat(o," miles")},f=t=>p(t);function v(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,r)}return a}function M(e){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?v(Object(r),!0).forEach(function(a){t(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var b="highlighted-label";function w(t,e){if("number"==typeof t)return t;if(!Array.isArray(t)||"interpolate"!==t[0])return function(t,e){var{stops:a}=t;if(a.length<2)return a.length>0?a[0][1]:0;for(var r=a[0],n=a[a.length-1],i=1;i<a.length;i++){var o=a[i];if(o[0]>e){n=o,r=a[i-1];break}r=a[i-1],n=o}var[s,l]=r,[h,c]=n;return e<=s?l:e>=h?c:l+(e-s)/(h-s)*(c-l)}(t,e);var[,,a,...r]=t;if("zoom"!==a[0])throw new Error("Only zoom-based expressions supported");for(var n=0;n<r.length-2;n+=2){var i=r[n],o=r[n+1],s=r[n+2],l=r[n+3];if(e<=i)return o;if(e<=s)return o+(e-i)/(s-i)*(l-o)}return r[r.length-1]}function I(t,e,a){return e.flatMap(e=>{var r,n=function(t){var e,a;return"string"==typeof t?null===(e=/^{(.+)}$/.exec(t))||void 0===e?void 0:e[1]:Array.isArray(t)?null===(a=t.find(t=>Array.isArray(t)&&"get"===t[0]))||void 0===a?void 0:a[1]:null}(null===(r=e.layout)||void 0===r?void 0:r["text-field"]);return n?a.filter(t=>{var a;return t.layer.id===e.id&&(null===(a=t.properties)||void 0===a?void 0:a[n])}).map(a=>function(t,e,a,r){var n=function(t){var{type:e,coordinates:a}=t;if("Point"===e)return a;if("MultiPoint"===e)return a[0];if(e.includes("LineString")){var r="LineString"===e?a:a[0];return[(r[0][0]+r[r.length-1][0])/2,(r[0][1]+r[r.length-1][1])/2]}if(e.includes("Polygon")){var n="Polygon"===e?a[0]:a[0][0],i=n.reduce((t,e)=>[t[0]+e[0],t[1]+e[1]],[0,0]);return[i[0]/n.length,i[1]/n.length]}return null}(t.geometry);if(!n)return null;var i=r.project({lng:n[0],lat:n[1]});return{text:t.properties[a],x:i.x,y:i.y,feature:t,layer:e}}(a,e,n,t)).filter(Boolean):[]})}function x(t,e){if(e.highlightLayerId&&t.getLayer(e.highlightLayerId)){try{t.removeLayer(e.highlightLayerId)}catch(t){}e.highlightLayerId=null,e.highlightedExpr=null}}function S(t,e,a){var r;if(null!=e&&null!==(r=e.feature)&&void 0!==r&&r.layer){x(t,a);var{feature:n,layer:i}=e;a.highlightLayerId="highlight-".concat(i.id);var{id:o,type:s,properties:l,geometry:h}=n;t.getSource(b).setData({id:o,type:s,properties:l,geometry:h}),a.highlightedExpr=i.layout["text-size"];var c=t.getZoom(),u=function(t,e,a){return{id:"highlight-".concat(t.id),type:t.type,source:b,layout:M(M({},t.layout),{},{"text-size":e,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:M(M({},t.paint),{},{"text-color":a.text,"text-halo-color":a.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})}}(i,1.5*w(a.highlightedExpr,c),a.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"});t.addLayer(u),t.moveLayer(a.highlightLayerId)}}function P(t,e){if(!e.currentPixel)return null;var a=e.labels.map((t,e)=>({pixel:[t.x,t.y],index:e})).filter(t=>t.pixel[0]!==e.currentPixel.x||t.pixel[1]!==e.currentPixel.y);if(!a.length)return null;var r=a.map(t=>t.pixel),n=((t,e,a)=>{var r=(t,e)=>t[0]===e[0]&&t[1]===e[1],n=e.filter(e=>{var n=Math.abs(e[0]-t[0]),i=Math.abs(e[1]-t[1]);return("ArrowUp"===a?e[1]<=t[1]&&i>=n:"ArrowDown"===a?e[1]>t[1]&&i>=n:"ArrowLeft"===a?e[0]<=t[0]&&i<n:"ArrowRight"!==a||e[0]>t[0]&&i<n)&&!r(e,t)});n.length||n.push(t);var i=e=>Math.hypot(t[0]-e[0],t[1]-e[1]),o=n.reduce((t,e)=>i(e)<i(t)?e:t,n[0]);return e.findIndex(t=>r(t,o))})([e.currentPixel.x,e.currentPixel.y],r,t);return(null==n||n<0||n>=a.length)&&(n=0),e.labels[a[n].index]}function N(t){t.getSource(b)||t.addSource(b,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function E(t){t.getStyle().layers.filter(t=>{var e;return"line"===(null===(e=t.layout)||void 0===e?void 0:e["symbol-placement"])}).forEach(e=>t.setLayoutProperty(e.id,"symbol-placement","line-center"))}var L=t=>t.endsWith(".cold")?"".concat(t.slice(0,-5),".hot"):t.endsWith(".hot")?"".concat(t.slice(0,-4),".cold"):null;function R(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,r)}return a}function O(e){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?R(Object(r),!0).forEach(function(a){t(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var T="icon-image",A="active-highlight",D="active-highlight-inner",j="selected-highlight",_=(t,e)=>"active"===e?{property:"user_symbolActiveImageId",getImageId:e=>{var a;return null!==(a=null==t?void 0:t.getActiveImageId(e))&&void 0!==a?a:null}}:{property:"user_symbolSelectedImageId",getImageId:e=>{var a;return null!==(a=null==t?void 0:t.getSelectedImageId(e))&&void 0!==a?a:null}},C=(t,e,a,r)=>{var{featureId:n,idProperty:i,geometry:o}=r,s=t.getLayer(a);s&&(e[a]||(e[a]={ids:new Set,fillIds:new Set,idProperty:i,sourceId:s.source,hasFillGeometry:!1}),!o||"Polygon"!==o.type&&"MultiPolygon"!==o.type||(e[a].hasFillGeometry=!0,e[a].fillIds.add(n)),e[a].ids.add(n))},B=(t,e,a,r)=>{e.forEach(e=>{if(!a.has(e)){var n="".concat(r,"-").concat(e);["".concat(n,"-fill"),"".concat(n,"-line"),"".concat(n,"-symbol")].forEach(e=>{t.getLayer(e)&&t.setFilter(e,["==","id",""])})}})},F=(t,e)=>{var a="_".concat(e.replaceAll("-",""),"Sources");B(t,t[a]||new Set,new Set,e),t[a]=new Set},k=(t,e,a,r,n,i,o)=>{!!t.getLayer(e)||t.addLayer(O(O({id:e,type:a,source:r},n&&{"source-layer":n}),{},{paint:i})),Object.entries(i).forEach(a=>{var[r,n]=a;t.setPaintProperty(e,r,n)}),t.setFilter(e,o),t.moveLayer(e)},z=(t,e,a,r,n,i,o)=>{var s,l=t.getLayoutProperty(n,"icon-offset");t.getLayer(e)||t.addLayer(O(O({id:e,type:"symbol",source:a},r&&{"source-layer":r}),{},{layout:O(O({[T]:i,"icon-anchor":null!==(s=t.getLayoutProperty(n,"icon-anchor"))&&void 0!==s?s:"center"},void 0!==l&&{"icon-offset":l}),{},{"icon-allow-overlap":!0})}));t.setLayoutProperty(e,T,i),void 0!==l&&t.setLayoutProperty(e,"icon-offset",l),t.setFilter(e,o),t.moveLayer(e)},W=(t,e,a,r,n,i)=>{var o,{ids:s,fillIds:l,idProperty:h,sourceId:c,hasFillGeometry:u}=a[e],d=t.getLayer(e),g=null!==(o=r[e])&&void 0!==o?o:r[L(e)];if(d&&g){var p=d.sourceLayer,m=u?"fill":d.type,y="".concat(n,"-").concat(e),{fill:f}=g,v=n===j,M=(t=>t===j||t===D)(n),{lineColor:b,lineWidth:w}=((t,e)=>({lineColor:e?t.selectionStroke:t.stroke,lineWidth:e?t.strokeWidth:t.activeStrokeWidth}))(g,M),I=h?["get",h]:["id"],x=["in",I,["literal",Array.from(s)]];if("fill-extrusion"!==d.type)switch(m){case"fill":((t,e,a,r,n)=>{var{isSelected:i,idExpression:o,fillIds:s,fill:l,lineColor:h,lineWidth:c,filter:u}=n;if(i){var d=[];s.forEach(t=>d.push(t));var g=["in",o,["literal",d]];k(t,"".concat(e,"-fill"),"fill",a,r,{"fill-color":l},g)}k(t,"".concat(e,"-line"),"line",a,r,{"line-color":h,"line-width":c},u)})(t,y,c,p,{isSelected:v,idExpression:I,fillIds:l,fill:f,lineColor:b,lineWidth:w,filter:x});break;case"line":((t,e,a,r,n,i,o)=>{t.getLayer("".concat(e,"-fill"))&&t.setFilter("".concat(e,"-fill"),["==","id",""]),k(t,"".concat(e,"-line"),"line",a,r,{"line-color":n,"line-width":i},o)})(t,y,c,p,b,w,x);break;case"symbol":((t,e,a,r,n,i,o)=>{var s=t.getLayoutProperty(n,T);if(Array.isArray(s))z(t,"".concat(e,"-symbol"),a,r,n,["get",o.property],i);else{var l=o.getImageId(s);l&&z(t,"".concat(e,"-symbol"),a,r,n,l,i)}})(t,y,c,p,e,x,i)}else((t,e,a,r)=>{var{ids:n,lineColor:i,lineWidth:o,idExpression:s}=r,l=[];n.forEach(t=>l.push(t));var h=["in",s,["literal",l]],{source:c,sourceLayer:u}=t.getLayer(a);k(t,"".concat(e,"-line"),"line",c,u,{"line-color":i,"line-width":o},h)})(t,y,e,{ids:s,lineColor:b,lineWidth:w,idExpression:I})}},q=(t,e,a,r,n)=>{var i=((t,e)=>{var a={};return null==e||e.forEach(e=>{C(t,a,e.layerId,e);var r=L(e.layerId);r&&C(t,a,r,e)}),a})(t,e),o=new Set(Object.keys(i)),s="_".concat(r.replaceAll("-",""),"Sources"),l=t[s]||new Set;return B(t,l,o,r),t[s]=o,o.forEach(e=>W(t,e,i,a,r,n)),i};var $=(t,e,a)=>{var r=(e.x-a.x)**2+(e.y-a.y)**2;if(0===r)return(t.x-e.x)**2+(t.y-e.y)**2;var n=((t.x-e.x)*(a.x-e.x)+(t.y-e.y)*(a.y-e.y))/r;return n=Math.max(0,Math.min(1,n)),(t.x-(e.x+n*(a.x-e.x)))**2+(t.y-(e.y+n*(a.y-e.y)))**2},Z=function(t,e){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{radius:r=10}=a,n=[[e.x-r,e.y-r],[e.x+r,e.y+r]],i=t.queryRenderedFeatures(n);if(0===i.length)return[];var o=new Set(t.queryRenderedFeatures([e.x,e.y]).map(t=>{var e,a=void 0===t.id?JSON.stringify(t.properties):t.id;return"".concat(null===(e=t.layer)||void 0===e?void 0:e.source,":").concat(a)})),s=[];i.forEach(t=>{!1===s.includes(t.layer.id)&&s.push(t.layer.id)});for(var l=new Set,h=[],c=i.length-1;c>=0;c--){var u,d=i[c],g=void 0===d.id?JSON.stringify(d.properties):d.id,p="".concat(null===(u=d.layer)||void 0===u?void 0:u.source,":").concat(g);!1===l.has(p)&&(l.add(p),h.push(d))}var m=t.unproject(e),y=[m.lng,m.lat],f=h.filter(t=>{var e=t.geometry.type;if(e.includes("Polygon"))return("Polygon"===e?[t.geometry.coordinates]:t.geometry.coordinates).some(t=>((t,e)=>{for(var[a,r]=t,n=!1,i=0,o=e.length-1;i<e.length;o=i,i++){var[s,l]=e[i],[h,c]=e[o];l>r!=c>r&&a<(h-s)*(r-l)/(c-l)+s&&(n=!n)}return n})(y,t[0]));if("Point"===e||"MultiPoint"===e){var a,r=void 0===t.id?JSON.stringify(t.properties):t.id;return o.has("".concat(null===(a=t.layer)||void 0===a?void 0:a.source,":").concat(r))}return!0});return f.map(a=>{var r=0,n=a.geometry.type,i=((t,e,a)=>{var{coordinates:r,type:n}=a,i=1/0,o=e=>t.project(e),s=t=>{for(var a=0;a<t.length-1;a++){var r=$(e,o(t[a]),o(t[a+1]));r<i&&(i=r)}};if("Point"===n){var l=o(r);i=(e.x-l.x)**2+(e.y-l.y)**2}else"LineString"===n||"MultiPoint"===n?"LineString"===n?s(r):r.forEach(t=>{var a=o(t),r=(e.x-a.x)**2+(e.y-a.y)**2;r<i&&(i=r)}):"Polygon"===n||"MultiLineString"===n?r.forEach(s):"MultiPolygon"===n&&r.forEach(t=>t.forEach(s));return i})(t,e,a.geometry);return r+=1e6*s.indexOf(a.layer.id),n.includes("Polygon")&&(r-=5e5),{f:a,score:r+=i}}).sort((t,e)=>t.score-e.score).map(t=>{var{f:e}=t;return e})},G=(t,e,a)=>{var r=t.getCanvas();if(a&&t.off("mousemove",a),null==e||!e.length)return r.style.cursor="",null;var n=a=>{var n=(t=>{var e=new Set(t);return t.forEach(t=>{var a=L(t);a&&e.add(a)}),[...e]})(e).filter(e=>t.getLayer(e));if(0!==n.length){var{lineLayers:i,otherLayers:o}=((t,e)=>{var a=[],r=[];for(var n of e)if("line"===t.getLayer(n).type){var i=n.endsWith("-stroke")?n.slice(0,-7):null;null!==i&&e.includes(i)||a.push(n)}else r.push(n);return{lineLayers:a,otherLayers:r}})(t,n),{x:s,y:l}=a.point,h=[[s-10,l-10],[s+10,l+10]],c=i.length>0&&t.queryRenderedFeatures(h,{layers:i}).length>0,u=o.length>0&&t.queryRenderedFeatures(a.point,{layers:o}).length>0;r.style.cursor=c||u?"pointer":""}else r.style.cursor=""};return t.on("mousemove",n),n};class H{constructor(){t(this,"sets",new Map)}add(t,e){var a,r=null!==(a=this.sets.get(t))&&void 0!==a?a:new Set;this.sets.delete(t),this.sets.set(t,r),e.forEach(t=>r.add(t));for(var n=new Set;this.sets.size>2;){var[i,o]=this.sets.entries().next().value;this.sets.delete(i),o.forEach(t=>n.add(t))}return this.sets.forEach(t=>t.forEach(t=>n.delete(t))),Array.from(n)}}var J=.25,V=.75,Y=t=>{var[e,a]=t,r=(t=>t<=J?"left":t>=V?"right":"")(e),n=(t=>t<=J?"top":t>=V?"bottom":"")(a);return n+(r&&n?"-":"")+r||"center"},K=t=>t<=J?0:t>=V?1:.5,U=t=>Math.round(100*t)/100,X=(t,e)=>{var[a,r]=t,[,,n,i]=e.split(" ").map(Number);return[U((K(a)-a)*n),U((K(r)-r)*i)]};class Q{constructor(e){t(this,"activeImageIds",new Map),t(this,"selectedImageIds",new Map),t(this,"recentImageSets",new H),this.map=e}getActiveImageId(t){var e;return null!==(e=this.activeImageIds.get(t))&&void 0!==e?e:null}getSelectedImageId(t){var e;return null!==(e=this.selectedImageIds.get(t))&&void 0!==e?e:null}removeImage(t){this.map.hasImage(t)&&this.map.removeImage(t),this.activeImageIds.delete(t),this.selectedImageIds.delete(t)}registerSymbols(t,e,r,n){var i=this;return a(function*(){var{map:o}=i,s=yield Promise.all(t.map(function(){var t=a(function*(t){var s=r.getSymbolImageIds(t,e,n);return s?(i.activeImageIds.set(s.normal,s.active),i.selectedImageIds.set(s.normal,s.selected),yield Promise.all(Object.entries(s).map(function(){var i=a(function*(a){var[i,s]=a;if(!o.hasImage(s)){var l=yield r.rasteriseSymbolImage(t,e,i,n);l&&!o.hasImage(l.imageId)&&o.addImage(l.imageId,l.imageData,{pixelRatio:n})}});return function(t){return i.apply(this,arguments)}}())),Object.values(s)):[]});return function(e){return t.apply(this,arguments)}}()));i.recentImageSets.add("".concat(null==e?void 0:e.id,"|").concat(n),s.flat()).forEach(t=>i.removeImage(t))})()}}class tt{constructor(e){t(this,"recentImageSets",new H),this.map=e}registerPatterns(t,e,r,n){var i=this;return a(function*(){var{map:o}=i,s=new Map;t.forEach(t=>{var a=r.getPatternImageId(t,e,n);a&&!s.has(a)&&s.set(a,t)});var l=(t=>Math.max(2,2*t))(n);yield Promise.all(Array.from(s,function(){var t=a(function*(t){var[a,i]=t;if(!o.hasImage(a)){var s=yield r.rasterisePatternImage(i,e,n);s&&!o.hasImage(s.imageId)&&o.addImage(s.imageId,s.imageData,{pixelRatio:l})}});return function(e){return t.apply(this,arguments)}}())),i.recentImageSets.add("".concat(e,"|").concat(n),Array.from(s.keys())).forEach(t=>{o.hasImage(t)&&o.removeImage(t)})})()}}var et=["container","padding","mapStyle","mapSize","center","zoom","bounds","pixelRatio"];function at(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,r)}return a}function rt(e){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?at(Object(r),!0).forEach(function(a){t(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):at(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}class nt extends r{constructor(t){var{mapFramework:e,mapProviderConfig:a={},events:r,eventBus:n}=t;super(),this.maplibreModule=e,this.events=r,this.eventBus=n,this.capabilities={supportedShortcuts:o,supportsMapSizes:!0},Object.assign(this,a)}get name(){return"MapLibreProvider"}initMap(t){var r=this;return a(function*(){var{container:a,padding:n,mapStyle:i,mapSize:o,center:s,zoom:h,bounds:c,pixelRatio:u}=t,d=e(t,et);r.mapStyleId=null==i?void 0:i.id,r.mapSize=o;var{Map:g}=r.maplibreModule,{events:p,eventBus:m}=r,y=new g(rt(rt({},d),{},{container:a,style:null==i?void 0:i.url,pixelRatio:u,padding:n,center:s,zoom:h,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}));y.touchZoomRotate.disableRotation(),r.map=y,r.symbolImages=new Q(y),r.patternImages=new tt(y),r.map.setPadding(n),c&&y.fitBounds(c,{duration:0}),function(t){var e=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){if(("touchmove"===this.type||"touchstart"===this.type)&&!this.cancelable){var a=t.getCanvas();if(a&&(this.target===a||a.contains(this.target)))return}e.call(this)}}(y),function(t){var e=t.getCanvas();e.removeAttribute("role"),e.setAttribute("tabindex",-1),e.removeAttribute("aria-label"),e.style.display="block",e.addEventListener("focus",t=>{e.blur(),t.relatedTarget&&t.relatedTarget.focus({preventScroll:!0})})}(y),l({map:y,events:p,eventBus:m,getCenter:r.getCenter.bind(r),getZoom:r.getZoom.bind(r),getBounds:r.getBounds.bind(r),getResolution:r.getResolution.bind(r)}),function(t){var{mapProvider:e,map:a,events:r,eventBus:n}=t,i=t=>{a.once("style.load",()=>{n.emit(r.MAP_STYLE_CHANGE,{mapStyleId:t.id})}),a.setStyle(t.url,{diff:!1})},o=t=>{a.setPixelRatio(t)},s=t=>{var{mapSize:a}=t;e.mapSize=a};n.on(r.MAP_SET_STYLE,i),n.on(r.MAP_SET_PIXEL_RATIO,o),n.on(r.MAP_SIZE_CHANGE,s)}({mapProvider:r,map:y,events:p,eventBus:m}),y.on("load",()=>{r.labelNavigator=function(t,e,a,r){var n={isDarkStyle:"dark"===e,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function i(){var e=t.getStyle().layers.filter(t=>"symbol"===t.type),a=t.queryRenderedFeatures({layers:e.map(t=>t.id)});n.labels=I(t,e,a)}function o(){if(i(),!n.labels.length)return null;var e=t.project(t.getCenter()),a=function(t,e){var a;return null===(a=t.reduce((t,a)=>{var r=(a.x-e.x)**2+(a.y-e.y)**2;return!t||r<t.dist?{label:a,dist:r}:t},null))||void 0===a?void 0:a.label}(n.labels,e);return n.currentPixel={x:a.x,y:a.y},S(t,a,n),a.text}return E(t),N(t),null==r||r.on(a.MAP_SET_STYLE,e=>{t.once("styledata",()=>t.once("idle",()=>{E(t),N(t),n.isDarkStyle="dark"===(null==e?void 0:e.mapColorScheme)}))}),t.on("zoom",()=>{if(n.highlightLayerId&&n.highlightedExpr){var e=w(n.highlightedExpr,t.getZoom());t.setLayoutProperty(n.highlightLayerId,"text-size",1.5*e)}}),function(t){t.getStyle().layers.filter(t=>"symbol"===t.type).forEach(e=>{t.setPaintProperty(e.id,"text-opacity",["case",["boolean",["feature-state","highlighted"],!1],0,1])})}(t),{refreshLabels:i,highlightNextLabel:function(e){if(i(),!n.labels.length)return null;if(!n.currentPixel)return o();var a=P(e,n);return a?(n.currentPixel={x:a.x,y:a.y},S(t,a,n),a.text):null},highlightLabelAtCenter:o,clearHighlightedLabel:()=>x(t,n)}}(y,null==i?void 0:i.mapColorScheme,p,m)}),r.eventBus.emit(p.MAP_READY,{map:r.map,mapStyleId:r.mapStyleId,mapSize:r.mapSize,crs:r.crs})})()}isBaseMapReady(){var t;return Boolean(null===(t=this.map)||void 0===t?void 0:t.getStyle())}destroyMap(){var t,e;this.setHoverCursor([]),null===(t=this.mapEvents)||void 0===t||t.remove(),null===(e=this.appEvents)||void 0===e||e.remove(),this.mapEvents=null,this.appEvents=null,this.map.remove()}setHoverCursor(t){this.map&&(this._onHoverMove=G(this.map,t,this._onHoverMove))}setView(t){var{center:e,zoom:a}=t;this.map.flyTo({center:e||this.getCenter(),zoom:a||this.getZoom(),duration:this.map.isStyleLoaded()?n:0})}zoomIn(t){this.map.easeTo({zoom:this.getZoom()+t,duration:n})}zoomOut(t){this.map.easeTo({zoom:this.getZoom()-t,duration:n})}panBy(t){this.map.panBy(t,{duration:n})}fitToBounds(t){var e=Array.isArray(t)?t:f(t),a=this.map.isStyleLoaded()?n:0;this.map.fitBounds(e,{duration:a})}setPadding(t){this.map.setPadding(t)}updateHighlightedFeatures(t,e,a){var{LngLatBounds:r}=this.maplibreModule;return function(t){var{LngLatBounds:e,map:a,selectedFeatures:r,activeFeatures:n,stylesMap:i,symbolImages:o}=t;if(!a)return null;var s=_(o,"active"),l=_(o,"selected");null!=n&&n.length?(q(a,n,i,A,s),q(a,n,i,D,l)):(F(a,A),F(a,D));var h={};null!=r&&r.length?h=q(a,r,i,j,l):F(a,j);var c=[];return Object.entries(h).forEach(t=>{var[e,{ids:r,idProperty:n}]=t;c.push(...a.queryRenderedFeatures({layers:[e]}).filter(t=>{var e;return r.has(n?null===(e=t.properties)||void 0===e?void 0:e[n]:t.id)}))}),((t,e)=>{if(!e.length)return null;var a=new t;return e.forEach(t=>{var e=t=>"number"==typeof t[0]?a.extend(t):t.forEach(e);e(t.geometry.coordinates)}),[a.getWest(),a.getSouth(),a.getEast(),a.getNorth()]})(e,c)}({LngLatBounds:r,map:this.map,selectedFeatures:t,activeFeatures:e,stylesMap:a,symbolImages:this.symbolImages})}highlightNextLabel(t){var e;return(null===(e=this.labelNavigator)||void 0===e?void 0:e.highlightNextLabel(t))||null}highlightLabelAtCenter(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.highlightLabelAtCenter())||null}clearHighlightedLabel(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.clearHighlightedLabel())||null}getCenter(){var t=this.map.getCenter();return[Number(t.lng.toFixed(i)),Number(t.lat.toFixed(i))]}getZoom(){return Number(this.map.getZoom().toFixed(i))}getBounds(){return this.map.getBounds().toArray().flat(1)}getFeaturesAtPoint(t,e){return Z(this.map,t,e)}getVisibleFeatures(t){var e=t.filter(t=>this.map.getLayer(t));return e.length?this.map.queryRenderedFeatures(void 0,{layers:e}):[]}addSymbolsToMap(t,e,r){var n=arguments,i=this;return a(function*(){var a=n.length>3&&void 0!==n[3]?n[3]:i.map.getPixelRatio()||1;return i.symbolImages.registerSymbols(t,e,r,a)})()}getSymbolIconLayout(t){return(t=>{var{anchor:e,viewBox:a}=t;return{"icon-anchor":Y(e),"icon-offset":X(e,a)}})(t)}getActiveSymbolImageId(t){var e,a;return null!==(e=null===(a=this.symbolImages)||void 0===a?void 0:a.getActiveImageId(t))&&void 0!==e?e:null}getSelectedSymbolImageId(t){var e,a;return null!==(e=null===(a=this.symbolImages)||void 0===a?void 0:a.getSelectedImageId(t))&&void 0!==e?e:null}addPatternsToMap(t,e,r){var n=arguments,i=this;return a(function*(){var a=n.length>3&&void 0!==n[3]?n[3]:i.map.getPixelRatio()||1;return i.patternImages.registerPatterns(t,e,r,a)})()}getAreaDimensions(){var{LngLatBounds:t}=this.maplibreModule;return(t=>{var e,a,r,n;if(t&&"function"==typeof t.getWest)e=t.getWest(),a=t.getSouth(),r=t.getEast(),n=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";[[e,a],[r,n]]=t}var i=m([e,a],[r,a]),o=m([e,a],[e,n]),s=y(i),l=y(o);return"".concat(l," by ").concat(s)})(((t,e)=>{var{width:a,height:r}=e.getContainer().getBoundingClientRect(),n=e.getPadding(),i=[n.left,r-n.bottom],o=[a-n.right,n.top];return new t(e.unproject(i),e.unproject(o))})(t,this.map))}getCardinalMove(t,e){return((t,e)=>{var[a,r]=t,[n,i]=e,o=i-r,s=n-a,l=[];if(Math.abs(o)>1e-4){var h=Math.round(m([a,r],[a,i]));l.push("".concat(o>0?"north":"south"," ").concat(y(h)))}if(Math.abs(s)>1e-4){var c=Math.round(m([a,r],[n,r]));l.push("".concat(s>0?"east":"west"," ").concat(y(c)))}return l.join(", ")})(t,e)}getResolution(){return t=this.map.getCenter(),e=this.map.getZoom(),a=t.lat,r=Math.pow(2,e),40075016.686*Math.cos(a*Math.PI/180)/(512*r);var t,e,a,r}mapToScreen(t){return this.map.project(t)}screenToMap(t){var{lng:e,lat:a}=this.map.unproject([t.x,t.y]);return[e,a]}isGeometryObscured(t,e){return((t,e,a)=>{var r=a.getContainer().getBoundingClientRect(),[n,i,o,s]=f(t),l=[a.project([n,i]),a.project([n,s]),a.project([o,i]),a.project([o,s])],h=Math.min(...l.map(t=>t.x)),c=Math.max(...l.map(t=>t.x)),u=Math.min(...l.map(t=>t.y)),d=Math.max(...l.map(t=>t.y)),g=e.left-r.left,p=e.top-r.top,m=e.right-r.left,y=e.bottom-r.top;return h<m&&c>g&&u<y&&d>p})(t,e,this.map)}}export{nt as default};
|
|
1
|
+
class e{_notImplemented(e){throw new Error(`${this.name} must implement ${e}()`)}isBaseMapReady(){this._notImplemented("isBaseMapReady")}addSymbolsToMap(){this._notImplemented("addSymbolsToMap")}addPatternsToMap(){this._notImplemented("addPatternsToMap")}getActiveSymbolImageId(){this._notImplemented("getActiveSymbolImageId")}getSelectedSymbolImageId(){this._notImplemented("getSelectedSymbolImageId")}}const t=400,r=7,o=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];const n=(e,t)=>{let r=null;const o=(...o)=>{clearTimeout(r),r=setTimeout(()=>{e(...o)},t)};return o.cancel=()=>{r&&(clearTimeout(r),r=null)},o};function i({map:e,events:t,eventBus:r,getCenter:o,getZoom:i,getBounds:s,getResolution:a}){const l=[],c=[],u=()=>{const t=i();return{center:o(),bounds:s(),resolution:a(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},h=(e,t)=>r.emit(e,t),g=()=>h(t.MAP_LOADED);e.on("load",g),l.push(["load",g]);e.once("idle",()=>h(t.MAP_FIRST_IDLE,u()));const d=()=>h(t.MAP_MOVE_START);e.on("movestart",d),l.push(["movestart",d]);const m=n(()=>{h(t.MAP_MOVE_END,u())},500);e.on("moveend",m),l.push(["moveend",m]);const y=((e,t)=>{let r=0;return(...o)=>{const n=Date.now();n-r>=t&&(r=n,e(...o))}})(()=>{h(t.MAP_MOVE,u())},10);e.on("zoom",y),l.push(["zoom",y]);const p=()=>h(t.MAP_RENDER);e.on("render",p),l.push(["render",p]);const f=n(()=>{h(t.MAP_DATA_CHANGE,u())},500),I=e=>{e.isSourceLoaded&&f()};e.on("styledata",f),e.on("sourcedata",I),l.push(["styledata",f],["sourcedata",I]);const b=()=>h(t.MAP_STYLE_CHANGE);e.on("style.load",b),l.push(["style.load",b]);const x=e=>h(t.MAP_CLICK,{point:e.point,coords:[e.lngLat.lng,e.lngLat.lat]});return e.on("click",x),l.push(["click",x]),c.push(m,y,f),{remove(){c.forEach(e=>e.cancel()),l.forEach(([t,r])=>e.off(t,r))}}}function s(e,t,r){if(null!==e)for(var o,n,i,a,l,c,u,h,g=0,d=0,m=e.type,y="FeatureCollection"===m,p="Feature"===m,f=y?e.features.length:1,I=0;I<f;I++){l=(h=!!(u=y?e.features[I].geometry:p?e.geometry:e)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var b=0;b<l;b++){var x=0,v=0;if(null!==(a=h?u.geometries[b]:u)){c=a.coordinates;var S=a.type;switch(g=0,S){case null:break;case"Point":if(!1===t(c,d,I,x,v))return!1;d++,x++;break;case"LineString":case"MultiPoint":for(o=0;o<c.length;o++){if(!1===t(c[o],d,I,x,v))return!1;d++,"MultiPoint"===S&&x++}"LineString"===S&&x++;break;case"Polygon":case"MultiLineString":for(o=0;o<c.length;o++){for(n=0;n<c[o].length-g;n++){if(!1===t(c[o][n],d,I,x,v))return!1;d++}"MultiLineString"===S&&x++,"Polygon"===S&&v++}"Polygon"===S&&x++;break;case"MultiPolygon":for(o=0;o<c.length;o++){for(v=0,n=0;n<c[o].length;n++){for(i=0;i<c[o][n].length-g;i++){if(!1===t(c[o][n][i],d,I,x,v))return!1;d++}v++}x++}break;case"GeometryCollection":for(o=0;o<a.geometries.length;o++)if(!1===s(a.geometries[o],t))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var a=function(e,t={}){if(null!=e.bbox&&!0!==t.recompute)return e.bbox;const r=[1/0,1/0,-1/0,-1/0];return s(e,e=>{r[0]>e[0]&&(r[0]=e[0]),r[1]>e[1]&&(r[1]=e[1]),r[2]<e[0]&&(r[2]=e[0]),r[3]<e[1]&&(r[3]=e[1])}),r};const l=Math.PI/180,c=1e-4,u=e=>e*l,h=(e,t)=>{const[r,o]=e,[n,i]=t,s=u(o),a=u(i),l=a-s,c=u(n-r),h=Math.sin(l/2)**2+Math.cos(s)*Math.cos(a)*Math.sin(c/2)**2;return 6371e3*(2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)))},g=e=>{const t=e/1609.344;if(t<.5){const t=Math.round(e);return`${t} ${1===t?"metre":"metres"}`}if(t<10){const e=Number.parseFloat(t.toFixed(1));return`${e} ${1===e?"mile":"miles"}`}return`${Math.round(t)} miles`},d=e=>a(e);const m="highlighted-label";function y(e,t){if("number"==typeof e)return e;if(!Array.isArray(e)||"interpolate"!==e[0])return function(e,t){const{stops:r}=e;if(r.length<2)return r.length>0?r[0][1]:0;let o=r[0],n=r[r.length-1];for(let e=1;e<r.length;e++){const i=r[e];if(i[0]>t){n=i,o=r[e-1];break}o=r[e-1],n=i}const[i,s]=o,[a,l]=n;return t<=i?s:t>=a?l:s+(t-i)/(a-i)*(l-s)}(e,t);const[,,r,...o]=e;if("zoom"!==r[0])throw new Error("Only zoom-based expressions supported");for(let e=0;e<o.length-2;e+=2){const r=o[e],n=o[e+1],i=o[e+2],s=o[e+3];if(t<=r)return n;if(t<=i)return n+(t-r)/(i-r)*(s-n)}return o[o.length-1]}function p(e,t,r){return t.flatMap(t=>{const o=t.layout?.["text-field"],n=function(e){return"string"==typeof e?/^{(.+)}$/.exec(e)?.[1]:Array.isArray(e)?e.find(e=>Array.isArray(e)&&"get"===e[0])?.[1]:null}(o);return n?r.filter(e=>e.layer.id===t.id&&e.properties?.[n]).map(r=>function(e,t,r,o){const n=function(e){const{type:t,coordinates:r}=e;if("Point"===t)return r;if("MultiPoint"===t)return r[0];if(t.includes("LineString")){const e="LineString"===t?r:r[0];return[(e[0][0]+e[e.length-1][0])/2,(e[0][1]+e[e.length-1][1])/2]}if(t.includes("Polygon")){const e="Polygon"===t?r[0]:r[0][0],o=e.reduce((e,t)=>[e[0]+t[0],e[1]+t[1]],[0,0]);return[o[0]/e.length,o[1]/e.length]}return null}(e.geometry);if(!n)return null;const i=o.project({lng:n[0],lat:n[1]});return{text:e.properties[r],x:i.x,y:i.y,feature:e,layer:t}}(r,t,n,e)).filter(Boolean):[]})}function f(e,t){if(t.highlightLayerId&&e.getLayer(t.highlightLayerId)){try{e.removeLayer(t.highlightLayerId)}catch{}t.highlightLayerId=null,t.highlightedExpr=null}}function I(e,t,r){if(!t?.feature?.layer)return;f(e,r);const{feature:o,layer:n}=t;r.highlightLayerId=`highlight-${n.id}`;const{id:i,type:s,properties:a,geometry:l}=o;e.getSource(m).setData({id:i,type:s,properties:a,geometry:l}),r.highlightedExpr=n.layout["text-size"];const c=e.getZoom();const u=function(e,t,r){return{id:`highlight-${e.id}`,type:e.type,source:m,layout:{...e.layout,"text-size":t,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90},paint:{...e.paint,"text-color":r.text,"text-halo-color":r.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1}}}(n,1.5*y(r.highlightedExpr,c),r.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"});e.addLayer(u),e.moveLayer(r.highlightLayerId)}function b(e,t){if(!t.currentPixel)return null;const r=t.labels.map((e,t)=>({pixel:[e.x,e.y],index:t})).filter(e=>e.pixel[0]!==t.currentPixel.x||e.pixel[1]!==t.currentPixel.y);if(!r.length)return null;const o=r.map(e=>e.pixel);let n=((e,t,r)=>{const o=(e,t)=>e[0]===t[0]&&e[1]===t[1],n=t.filter(t=>{const n=Math.abs(t[0]-e[0]),i=Math.abs(t[1]-e[1]);let s=!1;return s="ArrowUp"===r?t[1]<=e[1]&&i>=n:"ArrowDown"===r?t[1]>e[1]&&i>=n:"ArrowLeft"===r?t[0]<=e[0]&&i<n:"ArrowRight"!==r||t[0]>e[0]&&i<n,s&&!o(t,e)});n.length||n.push(e);const i=t=>Math.hypot(e[0]-t[0],e[1]-t[1]),s=n.reduce((e,t)=>i(t)<i(e)?t:e,n[0]);return t.findIndex(e=>o(e,s))})([t.currentPixel.x,t.currentPixel.y],o,e);return(null==n||n<0||n>=r.length)&&(n=0),t.labels[r[n].index]}function x(e){e.getSource(m)||e.addSource(m,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function v(e){e.getStyle().layers.filter(e=>"line"===e.layout?.["symbol-placement"]).forEach(t=>e.setLayoutProperty(t.id,"symbol-placement","line-center"))}const S=e=>e.endsWith(".cold")?`${e.slice(0,-5)}.hot`:e.endsWith(".hot")?`${e.slice(0,-4)}.cold`:null,M="icon-image",L="active-highlight",P="active-highlight-inner",E="selected-highlight",A=(e,t)=>"active"===t?{property:"user_symbolActiveImageId",getImageId:t=>e?.getActiveImageId(t)??null}:{property:"user_symbolSelectedImageId",getImageId:t=>e?.getSelectedImageId(t)??null},w=(e,t,r,{featureId:o,idProperty:n,geometry:i})=>{const s=e.getLayer(r);s&&(t[r]||(t[r]={ids:new Set,fillIds:new Set,idProperty:n,sourceId:s.source,hasFillGeometry:!1}),!i||"Polygon"!==i.type&&"MultiPolygon"!==i.type||(t[r].hasFillGeometry=!0,t[r].fillIds.add(o)),t[r].ids.add(o))},$=(e,t,r,o)=>{t.forEach(t=>{if(!r.has(t)){const r=`${o}-${t}`;[`${r}-fill`,`${r}-line`,`${r}-symbol`].forEach(t=>{e.getLayer(t)&&e.setFilter(t,["==","id",""])})}})},C=(e,t)=>{const r=`_${t.replaceAll("-","")}Sources`;$(e,e[r]||new Set,new Set,t),e[r]=new Set},_=(e,t,r,o,n,i,s)=>{!!e.getLayer(t)||e.addLayer({id:t,type:r,source:o,...n&&{"source-layer":n},paint:i}),Object.entries(i).forEach(([r,o])=>{e.setPaintProperty(t,r,o)}),e.setFilter(t,s),e.moveLayer(t)},R=(e,t,r,o,n,i,s)=>{const a=e.getLayoutProperty(n,"icon-offset");e.getLayer(t)||e.addLayer({id:t,type:"symbol",source:r,...o&&{"source-layer":o},layout:{[M]:i,"icon-anchor":e.getLayoutProperty(n,"icon-anchor")??"center",...void 0!==a&&{"icon-offset":a},"icon-allow-overlap":!0}}),e.setLayoutProperty(t,M,i),void 0!==a&&e.setLayoutProperty(t,"icon-offset",a),e.setFilter(t,s),e.moveLayer(t)},F=(e,t,r,o,n,i)=>{const{ids:s,fillIds:a,idProperty:l,sourceId:c,hasFillGeometry:u}=r[t],h=e.getLayer(t),g=o[t]??o[S(t)];if(!h||!g)return;const d=h.sourceLayer,m=u?"fill":h.type,y=`${n}-${t}`,{fill:p}=g,f=n===E,I=(e=>e===E||e===P)(n),{lineColor:b,lineWidth:x}=((e,t)=>({lineColor:t?e.selectionStroke:e.stroke,lineWidth:t?e.strokeWidth:e.activeStrokeWidth}))(g,I),v=l?["get",l]:["id"],L=["in",v,["literal",Array.from(s)]];if("fill-extrusion"!==h.type)switch(m){case"fill":((e,t,r,o,{isSelected:n,idExpression:i,fillIds:s,fill:a,lineColor:l,lineWidth:c,filter:u})=>{if(n){const n=[];s.forEach(e=>n.push(e)),_(e,`${t}-fill`,"fill",r,o,{"fill-color":a},["in",i,["literal",n]])}_(e,`${t}-line`,"line",r,o,{"line-color":l,"line-width":c},u)})(e,y,c,d,{isSelected:f,idExpression:v,fillIds:a,fill:p,lineColor:b,lineWidth:x,filter:L});break;case"line":((e,t,r,o,n,i,s)=>{e.getLayer(`${t}-fill`)&&e.setFilter(`${t}-fill`,["==","id",""]),_(e,`${t}-line`,"line",r,o,{"line-color":n,"line-width":i},s)})(e,y,c,d,b,x,L);break;case"symbol":((e,t,r,o,n,i,s)=>{const a=e.getLayoutProperty(n,M);if(Array.isArray(a))return void R(e,`${t}-symbol`,r,o,n,["get",s.property],i);const l=s.getImageId(a);l&&R(e,`${t}-symbol`,r,o,n,l,i)})(e,y,c,d,t,L,i)}else((e,t,r,{ids:o,lineColor:n,lineWidth:i,idExpression:s})=>{const a=[];o.forEach(e=>a.push(e));const l=["in",s,["literal",a]],{source:c,sourceLayer:u}=e.getLayer(r);_(e,`${t}-line`,"line",c,u,{"line-color":n,"line-width":i},l)})(e,y,t,{ids:s,lineColor:b,lineWidth:x,idExpression:v})},B=(e,t,r,o,n)=>{const i=((e,t)=>{const r={};return t?.forEach(t=>{w(e,r,t.layerId,t);const o=S(t.layerId);o&&w(e,r,o,t)}),r})(e,t),s=new Set(Object.keys(i)),a=`_${o.replaceAll("-","")}Sources`,l=e[a]||new Set;return $(e,l,s,o),e[a]=s,s.forEach(t=>F(e,t,i,r,o,n)),i};const T=(e,t,r)=>{const o=(t.x-r.x)**2+(t.y-r.y)**2;if(0===o)return(e.x-t.x)**2+(e.y-t.y)**2;let n=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/o;return n=Math.max(0,Math.min(1,n)),(e.x-(t.x+n*(r.x-t.x)))**2+(e.y-(t.y+n*(r.y-t.y)))**2},k=(e,t,r={})=>{const{radius:o=10}=r,n=[[t.x-o,t.y-o],[t.x+o,t.y+o]],i=e.queryRenderedFeatures(n);if(0===i.length)return[];const s=new Set(e.queryRenderedFeatures([t.x,t.y]).map(e=>{const t=void 0===e.id?JSON.stringify(e.properties):e.id;return`${e.layer?.source}:${t}`})),a=[];i.forEach(e=>{!1===a.includes(e.layer.id)&&a.push(e.layer.id)});const l=new Set,c=[];for(let e=i.length-1;e>=0;e--){const t=i[e],r=void 0===t.id?JSON.stringify(t.properties):t.id,o=`${t.layer?.source}:${r}`;!1===l.has(o)&&(l.add(o),c.push(t))}const u=e.unproject(t),h=[u.lng,u.lat],g=c.filter(e=>{const t=e.geometry.type;if(t.includes("Polygon")){return("Polygon"===t?[e.geometry.coordinates]:e.geometry.coordinates).some(e=>((e,t)=>{const[r,o]=e;let n=!1;for(let e=0,i=t.length-1;e<t.length;i=e,e++){const[s,a]=t[e],[l,c]=t[i];a>o!=c>o&&(r<(l-s)*(o-a)/(c-a)+s&&(n=!n))}return n})(h,e[0]))}if("Point"===t||"MultiPoint"===t){const t=void 0===e.id?JSON.stringify(e.properties):e.id;return s.has(`${e.layer?.source}:${t}`)}return!0});return g.map(r=>{let o=0;const n=r.geometry.type,i=((e,t,r)=>{const{coordinates:o,type:n}=r;let i=1/0;const s=t=>e.project(t),a=e=>{for(let r=0;r<e.length-1;r++){const o=T(t,s(e[r]),s(e[r+1]));o<i&&(i=o)}};if("Point"===n){const e=s(o);i=(t.x-e.x)**2+(t.y-e.y)**2}else"LineString"===n||"MultiPoint"===n?"LineString"===n?a(o):o.forEach(e=>{const r=s(e),o=(t.x-r.x)**2+(t.y-r.y)**2;o<i&&(i=o)}):"Polygon"===n||"MultiLineString"===n?o.forEach(a):"MultiPolygon"===n&&o.forEach(e=>e.forEach(a));return i})(e,t,r.geometry);return o+=1e6*a.indexOf(r.layer.id),n.includes("Polygon")&&(o-=5e5),o+=i,{f:r,score:o}}).sort((e,t)=>e.score-t.score).map(({f:e})=>e)},z=(e,t,r)=>{const o=e.getCanvas();if(r&&e.off("mousemove",r),!t?.length)return o.style.cursor="",null;const n=r=>{const n=(e=>{const t=new Set(e);return e.forEach(e=>{const r=S(e);r&&t.add(r)}),[...t]})(t).filter(t=>e.getLayer(t));if(0===n.length)return void(o.style.cursor="");const{lineLayers:i,otherLayers:s}=((e,t)=>{const r=[],o=[];for(const n of t)if("line"===e.getLayer(n).type){const e=n.endsWith("-stroke")?n.slice(0,-7):null;null!==e&&t.includes(e)||r.push(n)}else o.push(n);return{lineLayers:r,otherLayers:o}})(e,n),{x:a,y:l}=r.point,c=[[a-10,l-10],[a+10,l+10]],u=i.length>0&&e.queryRenderedFeatures(c,{layers:i}).length>0,h=s.length>0&&e.queryRenderedFeatures(r.point,{layers:s}).length>0;o.style.cursor=u||h?"pointer":""};return e.on("mousemove",n),n};class N{sets=(()=>new Map)();add(e,t){const r=this.sets.get(e)??new Set;this.sets.delete(e),this.sets.set(e,r),t.forEach(e=>r.add(e));const o=new Set;for(;this.sets.size>2;){const[e,t]=this.sets.entries().next().value;this.sets.delete(e),t.forEach(e=>o.add(e))}return this.sets.forEach(e=>e.forEach(e=>o.delete(e))),Array.from(o)}}const j=.25,D=.75,Z=([e,t])=>{const r=(e=>e<=j?"left":e>=D?"right":"")(e),o=(e=>e<=j?"top":e>=D?"bottom":"")(t);return o+(r&&o?"-":"")+r||"center"},O=e=>e<=j?0:e>=D?1:.5,W=e=>Math.round(100*e)/100,H=([e,t],r)=>{const[,,o,n]=r.split(" ").map(Number);return[W((O(e)-e)*o),W((O(t)-t)*n)]};class G{activeImageIds=(()=>new Map)();selectedImageIds=(()=>new Map)();recentImageSets=(()=>new N)();constructor(e){this.map=e}getActiveImageId(e){return this.activeImageIds.get(e)??null}getSelectedImageId(e){return this.selectedImageIds.get(e)??null}removeImage(e){this.map.hasImage(e)&&this.map.removeImage(e),this.activeImageIds.delete(e),this.selectedImageIds.delete(e)}async registerSymbols(e,t,r,o){const{map:n}=this,i=await Promise.all(e.map(async e=>{const i=r.getSymbolImageIds(e,t,o);return i?(this.activeImageIds.set(i.normal,i.active),this.selectedImageIds.set(i.normal,i.selected),await Promise.all(Object.entries(i).map(async([i,s])=>{if(n.hasImage(s))return;const a=await r.rasteriseSymbolImage(e,t,i,o);a&&!n.hasImage(a.imageId)&&n.addImage(a.imageId,a.imageData,{pixelRatio:o})})),Object.values(i)):[]}));this.recentImageSets.add(`${t?.id}|${o}`,i.flat()).forEach(e=>this.removeImage(e))}}class q{recentImageSets=(()=>new N)();constructor(e){this.map=e}async registerPatterns(e,t,r,o){const{map:n}=this,i=new Map;e.forEach(e=>{const n=r.getPatternImageId(e,t,o);n&&!i.has(n)&&i.set(n,e)});const s=(e=>Math.max(2,2*e))(o);await Promise.all(Array.from(i,async([e,i])=>{if(n.hasImage(e))return;const a=await r.rasterisePatternImage(i,t,o);a&&!n.hasImage(a.imageId)&&n.addImage(a.imageId,a.imageData,{pixelRatio:s})})),this.recentImageSets.add(`${t}|${o}`,Array.from(i.keys())).forEach(e=>{n.hasImage(e)&&n.removeImage(e)})}}class V extends e{constructor({mapFramework:e,mapProviderConfig:t={},events:r,eventBus:n}){super(),this.maplibreModule=e,this.events=r,this.eventBus=n,this.capabilities={supportedShortcuts:o,supportsMapSizes:!0},Object.assign(this,t)}get name(){return"MapLibreProvider"}async initMap(e){const{container:t,padding:r,mapStyle:o,mapSize:n,center:s,zoom:a,bounds:l,pixelRatio:c,...u}=e;this.mapStyleId=o?.id,this.mapSize=n;const{Map:h}=this.maplibreModule,{events:g,eventBus:d}=this,m=new h({...u,container:t,style:o?.url,pixelRatio:c,padding:r,center:s,zoom:a,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1});m.touchZoomRotate.disableRotation(),this.map=m,this.symbolImages=new G(m),this.patternImages=new q(m),this.map.setPadding(r),l&&m.fitBounds(l,{duration:0}),function(e){const t=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){if(("touchmove"===this.type||"touchstart"===this.type)&&!this.cancelable){const t=e.getCanvas();if(t&&(this.target===t||t.contains(this.target)))return}t.call(this)}}(m),function(e){const t=e.getCanvas();t.removeAttribute("role"),t.setAttribute("tabindex",-1),t.removeAttribute("aria-label"),t.style.display="block",t.addEventListener("focus",e=>{t.blur(),e.relatedTarget&&e.relatedTarget.focus({preventScroll:!0})})}(m),i({map:m,events:g,eventBus:d,getCenter:this.getCenter.bind(this),getZoom:this.getZoom.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),function({mapProvider:e,map:t,events:r,eventBus:o}){const n=e=>{t.once("style.load",()=>{o.emit(r.MAP_STYLE_CHANGE,{mapStyleId:e.id})}),t.setStyle(e.url,{diff:!1})},i=e=>{t.setPixelRatio(e)},s=({mapSize:t})=>{e.mapSize=t};o.on(r.MAP_SET_STYLE,n),o.on(r.MAP_SET_PIXEL_RATIO,i),o.on(r.MAP_SIZE_CHANGE,s)}({mapProvider:this,map:m,events:g,eventBus:d}),m.on("load",()=>{this.labelNavigator=function(e,t,r,o){const n={isDarkStyle:"dark"===t,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function i(){const t=e.getStyle().layers.filter(e=>"symbol"===e.type),r=e.queryRenderedFeatures({layers:t.map(e=>e.id)});n.labels=p(e,t,r)}function s(){if(i(),!n.labels.length)return null;const t=e.project(e.getCenter()),r=function(e,t){return e.reduce((e,r)=>{const o=(r.x-t.x)**2+(r.y-t.y)**2;return!e||o<e.dist?{label:r,dist:o}:e},null)?.label}(n.labels,t);return n.currentPixel={x:r.x,y:r.y},I(e,r,n),r.text}return v(e),x(e),o?.on(r.MAP_SET_STYLE,t=>{e.once("styledata",()=>e.once("idle",()=>{v(e),x(e),n.isDarkStyle="dark"===t?.mapColorScheme}))}),e.on("zoom",()=>{if(n.highlightLayerId&&n.highlightedExpr){const t=y(n.highlightedExpr,e.getZoom());e.setLayoutProperty(n.highlightLayerId,"text-size",1.5*t)}}),function(e){e.getStyle().layers.filter(e=>"symbol"===e.type).forEach(t=>{e.setPaintProperty(t.id,"text-opacity",["case",["boolean",["feature-state","highlighted"],!1],0,1])})}(e),{refreshLabels:i,highlightNextLabel:function(t){if(i(),!n.labels.length)return null;if(!n.currentPixel)return s();const r=b(t,n);return r?(n.currentPixel={x:r.x,y:r.y},I(e,r,n),r.text):null},highlightLabelAtCenter:s,clearHighlightedLabel:()=>f(e,n)}}(m,o?.mapColorScheme,g,d)}),this.eventBus.emit(g.MAP_READY,{map:this.map,mapStyleId:this.mapStyleId,mapSize:this.mapSize,crs:this.crs})}isBaseMapReady(){return Boolean(this.map?.getStyle())}destroyMap(){this.setHoverCursor([]),this.mapEvents?.remove(),this.appEvents?.remove(),this.mapEvents=null,this.appEvents=null,this.map.remove()}setHoverCursor(e){this.map&&(this._onHoverMove=z(this.map,e,this._onHoverMove))}setView({center:e,zoom:r}){this.map.flyTo({center:e||this.getCenter(),zoom:r||this.getZoom(),duration:this.map.isStyleLoaded()?t:0})}zoomIn(e){this.map.easeTo({zoom:this.getZoom()+e,duration:t})}zoomOut(e){this.map.easeTo({zoom:this.getZoom()-e,duration:t})}panBy(e){this.map.panBy(e,{duration:t})}fitToBounds(e){const r=Array.isArray(e)?e:d(e),o=this.map.isStyleLoaded()?t:0;this.map.fitBounds(r,{duration:o})}setPadding(e){this.map.setPadding(e)}updateHighlightedFeatures(e,t,r){const{LngLatBounds:o}=this.maplibreModule;return function({LngLatBounds:e,map:t,selectedFeatures:r,activeFeatures:o,stylesMap:n,symbolImages:i}){if(!t)return null;const s=A(i,"active"),a=A(i,"selected");o?.length?(B(t,o,n,L,s),B(t,o,n,P,a)):(C(t,L),C(t,P));let l={};r?.length?l=B(t,r,n,E,a):C(t,E);const c=[];return Object.entries(l).forEach(([e,{ids:r,idProperty:o}])=>{c.push(...t.queryRenderedFeatures({layers:[e]}).filter(e=>r.has(o?e.properties?.[o]:e.id)))}),((e,t)=>{if(!t.length)return null;const r=new e;return t.forEach(e=>{const t=e=>"number"==typeof e[0]?r.extend(e):e.forEach(t);t(e.geometry.coordinates)}),[r.getWest(),r.getSouth(),r.getEast(),r.getNorth()]})(e,c)}({LngLatBounds:o,map:this.map,selectedFeatures:e,activeFeatures:t,stylesMap:r,symbolImages:this.symbolImages})}highlightNextLabel(e){return this.labelNavigator?.highlightNextLabel(e)||null}highlightLabelAtCenter(){return this.labelNavigator?.highlightLabelAtCenter()||null}clearHighlightedLabel(){return this.labelNavigator?.clearHighlightedLabel()||null}getCenter(){const e=this.map.getCenter();return[Number(e.lng.toFixed(r)),Number(e.lat.toFixed(r))]}getZoom(){return Number(this.map.getZoom().toFixed(r))}getBounds(){return this.map.getBounds().toArray().flat(1)}getFeaturesAtPoint(e,t){return k(this.map,e,t)}getVisibleFeatures(e){const t=e.filter(e=>this.map.getLayer(e));return t.length?this.map.queryRenderedFeatures(void 0,{layers:t}):[]}async addSymbolsToMap(e,t,r,o=this.map.getPixelRatio()||1){return this.symbolImages.registerSymbols(e,t,r,o)}getSymbolIconLayout(e){return(({anchor:e,viewBox:t})=>({"icon-anchor":Z(e),"icon-offset":H(e,t)}))(e)}getActiveSymbolImageId(e){return this.symbolImages?.getActiveImageId(e)??null}getSelectedSymbolImageId(e){return this.symbolImages?.getSelectedImageId(e)??null}async addPatternsToMap(e,t,r,o=this.map.getPixelRatio()||1){return this.patternImages.registerPatterns(e,t,r,o)}getAreaDimensions(){const{LngLatBounds:e}=this.maplibreModule;return(e=>{let t,r,o,n;if(e&&"function"==typeof e.getWest)t=e.getWest(),r=e.getSouth(),o=e.getEast(),n=e.getNorth();else{if(!Array.isArray(e)||2!==e.length)return"";[[t,r],[o,n]]=e}const i=h([t,r],[o,r]),s=h([t,r],[t,n]),a=g(i);return`${g(s)} by ${a}`})(((e,t)=>{const{width:r,height:o}=t.getContainer().getBoundingClientRect(),n=t.getPadding(),i=[n.left,o-n.bottom],s=[r-n.right,n.top];return new e(t.unproject(i),t.unproject(s))})(e,this.map))}getCardinalMove(e,t){return((e,t)=>{const[r,o]=e,[n,i]=t,s=i-o,a=n-r,l=[];if(Math.abs(s)>c){const e=Math.round(h([r,o],[r,i]));l.push(`${s>0?"north":"south"} ${g(e)}`)}if(Math.abs(a)>c){const e=Math.round(h([r,o],[n,o]));l.push(`${a>0?"east":"west"} ${g(e)}`)}return l.join(", ")})(e,t)}getResolution(){return((e,t)=>{const r=e.lat,o=Math.pow(2,t);return 40075016.686*Math.cos(u(r))/(512*o)})(this.map.getCenter(),this.map.getZoom())}mapToScreen(e){return this.map.project(e)}screenToMap(e){const{lng:t,lat:r}=this.map.unproject([e.x,e.y]);return[t,r]}isGeometryObscured(e,t){return((e,t,r)=>{const o=r.getContainer().getBoundingClientRect(),[n,i,s,a]=d(e),l=[r.project([n,i]),r.project([n,a]),r.project([s,i]),r.project([s,a])],c=Math.min(...l.map(e=>e.x)),u=Math.max(...l.map(e=>e.x)),h=Math.min(...l.map(e=>e.y)),g=Math.max(...l.map(e=>e.y)),m=t.left-o.left,y=t.top-o.top,p=t.right-o.left,f=t.bottom-o.top;return c<p&&u>m&&h<f&&g>y})(e,t,this.map)}}export{V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/regenerator";function n(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),t.push.apply(t,n)}return t}function o(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function i(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=function(r,e){if(r){if("string"==typeof r)return a(r,e);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(r,e):void 0}}(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var n=0,o=function(){};return{s:o,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,c=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return u=r.done,r},e:function(r){c=!0,i=r},f:function(){try{u||null==t.return||t.return()}finally{if(c)throw i}}}}function a(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}var u=function(r){var e=new URL("maplibre-gl/dist/maplibre-gl-worker.mjs",import.meta.url);return e.searchParams.set("v",r),e.href};function c(){if(document.documentMode)return"Internet Explorer is not supported";var r=function(r){if(!window.WebGLRenderingContext)return{isEnabled:!1,error:"WebGL is not supported"};var e,t=document.createElement("canvas"),n=!1,o=i(r);try{for(o.s();!(e=o.n()).done;){var a=e.value;try{if((n=t.getContext(a))&&"function"==typeof n.getParameter)return{isEnabled:!0}}catch(r){}}}catch(r){o.e(r)}finally{o.f()}return{isEnabled:!1,error:"WebGL is supported, but disabled"}}(["webgl2"]);return r.isEnabled?function(){if("function"!=typeof(null===Intl||void 0===Intl?void 0:Intl.supportedValuesOf))return!1;try{return new RegExp("(?<=a)b").test("ab")}catch(r){return!1}}()?function(){if("undefined"==typeof Worker)return!1;var r=!1,e={get type(){return r=!0,"module"}};try{new Worker("blob://",e).terminate()}catch(r){}return r}()?void 0:"Browser does not support module workers":"Browser does not support the JavaScript features MapLibre requires":r.error}function s(){var r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{checkDeviceCapabilities:function(){var r=c();return{isSupported:!r,error:r}},load:(r=e(t.mark(function r(){var e,i,a;return t.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=1,import("maplibre-gl");case 1:return(e=r.sent).setWorkerUrl(n.workerUrl||u(e.getVersion())),r.next=2,import(/* webpackChunkName: "im-maplibre-provider" */ "./im-maplibre-provider.js");case 2:return i=r.sent.default,a=o(o({},n),{},{crs:"EPSG:4326"}),r.abrupt("return",{MapProvider:i,mapProviderConfig:a,mapFramework:e});case 3:case"end":return r.stop()}},r)})),function(){return r.apply(this,arguments)})}}export{s as default};
|