@defra/interactive-map 0.0.3-alpha → 0.0.4-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/README.md +16 -57
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api/button-definition.md +176 -0
- package/docs/api/context.md +124 -0
- package/docs/api/control-definition.md +72 -0
- package/docs/api/icon-definition.md +28 -0
- package/docs/api/map-style-config.md +76 -0
- package/docs/api/marker-config.md +51 -0
- package/docs/api/panel-definition.md +117 -0
- package/docs/api/slots.md +25 -0
- package/docs/api.md +713 -0
- package/docs/architecture.md +139 -0
- package/docs/building-a-plugin.md +149 -0
- package/docs/getting-started.md +46 -0
- package/docs/govuk-prototype.md +0 -0
- package/docs/plugins/interact.md +205 -0
- package/docs/plugins/map-styles.md +84 -0
- package/docs/plugins/plugin-context.md +67 -0
- package/docs/plugins/plugin-descriptor.md +71 -0
- package/docs/plugins/plugin-manifest.md +118 -0
- package/docs/plugins/scale-bar.md +62 -0
- package/docs/plugins/search.md +162 -0
- package/docs/plugins.md +116 -0
- package/govuk-prototype-kit.config.json +7 -7
- package/package.json +14 -1
- package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -0
- package/plugins/beta/datasets/dist/esm/index.js +2 -0
- package/plugins/beta/datasets/dist/umd/im-datasets-plugin.js +1 -0
- package/plugins/beta/datasets/dist/umd/index.js +2 -0
- package/plugins/{datasets → beta/datasets}/src/manifest.js +1 -1
- package/plugins/{datasets → beta/datasets}/src/mapLayers.js +1 -1
- package/plugins/{datasets → beta/datasets}/src/panels/Key.jsx +1 -1
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -0
- package/plugins/beta/draw-ml/dist/esm/index.js +2 -0
- package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -0
- package/plugins/beta/draw-ml/dist/umd/index.js +2 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/api/editFeature.js +1 -1
- package/plugins/beta/draw-ml/src/api/merge.js +9 -0
- package/plugins/beta/draw-ml/src/api/newLine.js +43 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/api/newPolygon.js +5 -5
- package/plugins/beta/draw-ml/src/api/split.js +81 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/defaults.js +2 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/events.js +105 -3
- package/plugins/{draw-ml → beta/draw-ml}/src/manifest.js +17 -11
- package/plugins/{draw-ml → beta/draw-ml}/src/mapboxDraw.js +51 -2
- package/plugins/{draw-ml → beta/draw-ml}/src/mapboxSnap.js +2 -0
- package/plugins/beta/draw-ml/src/modes/createDrawMode.js +496 -0
- package/plugins/beta/draw-ml/src/modes/drawLineMode.js +18 -0
- package/plugins/beta/draw-ml/src/modes/drawPolygonMode.js +16 -0
- package/plugins/beta/draw-ml/src/modes/editVertexMode.js +792 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/reducer.js +30 -2
- package/plugins/{draw-ml → beta/draw-ml}/src/styles.js +66 -36
- package/plugins/beta/draw-ml/src/undoStack.js +50 -0
- package/plugins/beta/draw-ml/src/utils/debounce.js +16 -0
- package/plugins/beta/draw-ml/src/utils/spatial.js +258 -0
- package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -0
- package/plugins/beta/frame/dist/esm/index.js +2 -0
- package/plugins/beta/frame/dist/umd/im-frame-plugin.js +1 -0
- package/plugins/beta/frame/dist/umd/index.js +2 -0
- package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -0
- package/plugins/beta/map-styles/dist/esm/index.js +2 -0
- package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -0
- package/plugins/beta/map-styles/dist/umd/index.js +2 -0
- package/plugins/{map-styles → beta/map-styles}/src/MapStyles.jsx +1 -1
- package/plugins/{map-styles → beta/map-styles}/src/manifest.js +8 -10
- package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -0
- package/plugins/beta/scale-bar/dist/esm/index.js +2 -0
- package/plugins/beta/scale-bar/dist/umd/im-scale-bar-plugin.js +1 -0
- package/plugins/beta/scale-bar/dist/umd/index.js +2 -0
- package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -0
- package/plugins/beta/use-location/dist/esm/index.js +2 -0
- package/plugins/beta/use-location/dist/umd/im-use-location-plugin.js +1 -0
- package/plugins/beta/use-location/dist/umd/index.js +2 -0
- 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/interact/src/InteractInit.test.js +97 -0
- package/plugins/interact/src/api/clear.test.js +18 -0
- package/plugins/interact/src/api/disable.test.js +12 -0
- package/plugins/interact/src/api/enable.test.js +48 -0
- package/plugins/interact/src/api/selectFeature.test.js +33 -0
- package/plugins/interact/src/api/unselectFeature.test.js +33 -0
- package/plugins/interact/src/defaults.js +1 -0
- package/plugins/interact/src/events.test.js +151 -0
- package/plugins/interact/src/hooks/useHighlightSync.test.js +212 -0
- package/plugins/interact/src/hooks/useInteractionHandlers.js +14 -7
- package/plugins/interact/src/hooks/useInteractionHandlers.test.js +260 -0
- package/plugins/interact/src/index.test.js +22 -0
- package/plugins/interact/src/manifest.js +1 -1
- package/plugins/interact/src/manifest.test.js +94 -0
- package/plugins/interact/src/reducer.js +10 -1
- package/plugins/interact/src/reducer.test.js +142 -0
- package/plugins/interact/src/utils/buildStylesMap.test.js +57 -0
- package/plugins/interact/src/utils/featureQueries.test.js +56 -0
- package/plugins/interact/src/utils/turfHelpers.js +30 -0
- package/plugins/interact/src/utils/turfHelpers.test.js +30 -0
- 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/plugins/search/src/utils/parseOsNamesResults.js +3 -7
- package/providers/{esri → beta/esri}/src/mapEvents.js +2 -2
- package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +2 -0
- package/providers/beta/open-names/dist/esm/index.js +2 -0
- package/providers/beta/open-names/dist/umd/im-reverse-geocode.js +2 -0
- package/providers/beta/open-names/dist/umd/index.js +2 -0
- package/providers/maplibre/dist/esm/im-maplibre-framework.js +1 -1
- package/providers/maplibre/dist/esm/im-maplibre-framework.js.LICENSE.txt +1 -1
- package/providers/maplibre/dist/esm/im-maplibre-legacy-framework.js +1 -1
- 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 +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-legacy-framework.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/index.js +1 -1
- package/providers/maplibre/src/index.js +14 -1
- package/providers/maplibre/src/maplibreProvider.js +127 -0
- package/sonar-project.properties +1 -1
- package/src/App/hooks/useInterfaceAPI.js +24 -1
- package/src/App/renderer/mapButtons.js +1 -1
- package/src/App/store/appActionsMap.js +22 -1
- package/src/InteractiveMap/InteractiveMap.js +114 -6
- package/src/config/defaults.js +29 -20
- package/src/config/events.js +110 -4
- package/src/index.js +5 -2
- package/src/scss/tools/_border-focus.scss +20 -4
- package/src/types.js +585 -0
- package/webpack.esm.mjs +8 -8
- package/webpack.umd.mjs +8 -8
- package/plugins/datasets/dist/esm/im-datasets-plugin.js +0 -1
- package/plugins/datasets/dist/esm/index.js +0 -2
- package/plugins/datasets/dist/umd/im-datasets-plugin.js +0 -1
- package/plugins/datasets/dist/umd/index.js +0 -2
- package/plugins/draw-ml/dist/esm/im-draw-ml-plugin.js +0 -1
- package/plugins/draw-ml/dist/esm/index.js +0 -2
- package/plugins/draw-ml/dist/umd/im-draw-ml-plugin.js +0 -1
- package/plugins/draw-ml/dist/umd/index.js +0 -2
- package/plugins/draw-ml/src/modes/drawVertexMode.js +0 -275
- package/plugins/draw-ml/src/modes/editVertexMode.js +0 -426
- package/plugins/draw-ml/src/utils.js +0 -102
- package/plugins/frame/dist/esm/im-frame-plugin.js +0 -1
- package/plugins/frame/dist/esm/index.js +0 -2
- package/plugins/frame/dist/umd/im-frame-plugin.js +0 -1
- package/plugins/frame/dist/umd/index.js +0 -2
- package/plugins/map-styles/dist/esm/im-map-styles-plugin.js +0 -1
- package/plugins/map-styles/dist/esm/index.js +0 -2
- package/plugins/map-styles/dist/umd/im-map-styles-plugin.js +0 -1
- package/plugins/map-styles/dist/umd/index.js +0 -2
- package/plugins/scale-bar/dist/esm/im-scale-bar-plugin.js +0 -1
- package/plugins/scale-bar/dist/esm/index.js +0 -2
- package/plugins/scale-bar/dist/umd/im-scale-bar-plugin.js +0 -1
- package/plugins/scale-bar/dist/umd/index.js +0 -2
- package/plugins/use-location/dist/esm/im-use-location-plugin.js +0 -1
- package/plugins/use-location/dist/esm/index.js +0 -2
- package/plugins/use-location/dist/umd/im-use-location-plugin.js +0 -1
- package/plugins/use-location/dist/umd/index.js +0 -2
- package/providers/open-names/dist/esm/im-reverse-geocode.js +0 -2
- package/providers/open-names/dist/esm/index.js +0 -2
- package/providers/open-names/dist/umd/im-reverse-geocode.js +0 -2
- package/providers/open-names/dist/umd/index.js +0 -2
- /package/docs/architecture/{ARCHITECTURE_DIAGRAMS.md → architecture-diagrams.md} +0 -0
- /package/plugins/{datasets → beta/datasets}/dist/css/index.css +0 -0
- /package/plugins/{datasets → beta/datasets}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{datasets → beta/datasets}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{datasets → beta/datasets}/src/DatasetsInit.jsx +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/addDataset.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/hideDataset.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/hideFeatures.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/removeDataset.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/showDataset.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/showFeatures.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/datasets.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/datasets.scss +0 -0
- /package/plugins/{datasets → beta/datasets}/src/defaults.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/handleSetMapStyle.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/index.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/panels/Key.module.scss +0 -0
- /package/plugins/{datasets → beta/datasets}/src/panels/Layers.jsx +0 -0
- /package/plugins/{datasets → beta/datasets}/src/panels/Layers.module.scss +0 -0
- /package/plugins/{datasets → beta/datasets}/src/reducer.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/utils/bbox.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/utils/debounce.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/utils/filters.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/DrawInit.jsx +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/api/addFeature.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/api/deleteFeature.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/api/editFeature.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/api/newPolygon.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/events.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/graphic.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/index.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/manifest.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/reducer.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/sketchViewModel.js +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/dist/css/index.css +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/DrawInit.jsx +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/api/addFeature.js +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/api/deleteFeature.js +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/draw.scss +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/index.js +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/modes/disabledMode.js +0 -0
- /package/plugins/{draw-ml/src → beta/draw-ml/src/utils}/snapHelpers.js +0 -0
- /package/plugins/{frame → beta/frame}/dist/css/index.css +0 -0
- /package/plugins/{frame → beta/frame}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{frame → beta/frame}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{frame → beta/frame}/package.json +0 -0
- /package/plugins/{frame → beta/frame}/src/Frame.jsx +0 -0
- /package/plugins/{frame → beta/frame}/src/FrameInit.jsx +0 -0
- /package/plugins/{frame → beta/frame}/src/api/addFrame.js +0 -0
- /package/plugins/{frame → beta/frame}/src/api/editFeature.js +0 -0
- /package/plugins/{frame → beta/frame}/src/config.js +0 -0
- /package/plugins/{frame → beta/frame}/src/frame.scss +0 -0
- /package/plugins/{frame → beta/frame}/src/index.js +0 -0
- /package/plugins/{frame → beta/frame}/src/manifest.js +0 -0
- /package/plugins/{frame → beta/frame}/src/reducer.js +0 -0
- /package/plugins/{frame → beta/frame}/src/utils.js +0 -0
- /package/plugins/{map-styles → beta/map-styles}/dist/css/index.css +0 -0
- /package/plugins/{map-styles → beta/map-styles}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{map-styles → beta/map-styles}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{map-styles → beta/map-styles}/src/MapStylesInit.jsx +0 -0
- /package/plugins/{map-styles → beta/map-styles}/src/config.js +0 -0
- /package/plugins/{map-styles → beta/map-styles}/src/index.js +0 -0
- /package/plugins/{map-styles → beta/map-styles}/src/mapStyles.scss +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/dist/css/index.css +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/package.json +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/ScaleBar.jsx +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/ScaleBar.test.jsx +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/index.js +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/index.test.js +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/manifest.js +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/scaleBar.scss +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/utils.js +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/utils.test.js +0 -0
- /package/plugins/{use-location → beta/use-location}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{use-location → beta/use-location}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{use-location → beta/use-location}/src/UseLocation.jsx +0 -0
- /package/plugins/{use-location → beta/use-location}/src/UseLocationInit.jsx +0 -0
- /package/plugins/{use-location → beta/use-location}/src/defaults.js +0 -0
- /package/plugins/{use-location → beta/use-location}/src/events.js +0 -0
- /package/plugins/{use-location → beta/use-location}/src/index.js +0 -0
- /package/plugins/{use-location → beta/use-location}/src/manifest.js +0 -0
- /package/plugins/{use-location → beta/use-location}/src/reducer.js +0 -0
- /package/providers/{esri → beta/esri}/src/appEvents.js +0 -0
- /package/providers/{esri → beta/esri}/src/defaults.js +0 -0
- /package/providers/{esri → beta/esri}/src/esriProvider.js +0 -0
- /package/providers/{esri → beta/esri}/src/esriProvider.scss +0 -0
- /package/providers/{esri → beta/esri}/src/index.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/coords.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/detectWebGL.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/esriFixes.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/query.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/spatial.js +0 -0
- /package/providers/{open-names → beta/open-names}/dist/esm/im-reverse-geocode.js.LICENSE.txt +0 -0
- /package/providers/{open-names → beta/open-names}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/providers/{open-names → beta/open-names}/dist/umd/im-reverse-geocode.js.LICENSE.txt +0 -0
- /package/providers/{open-names → beta/open-names}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/providers/{open-names → beta/open-names}/src/index.js +0 -0
- /package/providers/{open-names → beta/open-names}/src/reverseGeocode.js +0 -0
- /package/providers/{open-names → beta/open-names}/src/utils/mapToLocationModel.js +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see im-maplibre-provider.js.LICENSE.txt */
|
|
2
|
-
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[772],{6102:(t,e,n)=>{n.r(e),n.d(e,{default:()=>H});var r=400,a=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];function o(t){var e=t.getCanvas();e.removeAttribute("role"),e.setAttribute("tabindex",-1),e.removeAttribute("aria-label"),e.style.display="block"}function i(t){var e=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){if(("touchmove"===this.type||"touchstart"===this.type)&&!this.cancelable){var n=t.getCanvas();if(n&&(this.target===n||n.contains(this.target)))return}return e.call(this)}}var s=function(t,e){var n=null,r=function(){for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];clearTimeout(n),n=setTimeout(function(){t.apply(void 0,a)},e)};return r.cancel=function(){n&&(clearTimeout(n),n=null)},r};function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function u(t){var e=t.map,n=t.events,r=t.eventBus,a=t.getCenter,o=t.getZoom,i=t.getBounds,u=t.getResolution,c=[],h=[],f=function(){var t=o();return{center:a(),bounds:i(),resolution:u(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},p=function(t,e){return r.emit(t,e)},d=function(){return p(n.MAP_LOADED)};e.on("load",d),c.push(["load",d]),e.once("idle",function(){return p(n.MAP_FIRST_IDLE,f())});var y=function(){return p(n.MAP_MOVE_START)};e.on("movestart",y),c.push(["movestart",y]);var g=s(function(){p(n.MAP_MOVE_END,f())},500);e.on("moveend",g),c.push(["moveend",g]),h.push(g);var v,m,b=(v=function(){p(n.MAP_MOVE,f())},m=0,function(){var t=Date.now();t-m>=10&&(m=t,v.apply(void 0,arguments))});e.on("zoom",b),c.push(["zoom",b]),h.push(b);var M=function(){return p(n.MAP_RENDER)};e.on("render",M),c.push(["render",M]);var w=s(function(){p(n.MAP_DATA_CHANGE,f())},500);e.on("styledata",w),c.push(["styledata",w]),h.push(w);var S=function(){return p(n.MAP_STYLE_CHANGE)};e.on("style.load",S),c.push(["style.load",S]);var N=function(t){return p(n.MAP_CLICK,{point:t.point,coords:[t.lngLat.lng,t.lngLat.lat]})};return e.on("click",N),c.push(["click",N]),{remove:function(){h.forEach(function(t){return t.cancel()}),c.forEach(function(t){var n,r,a=(r=2,function(t){if(Array.isArray(t))return t}(n=t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,a=t}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return s}}(n,r)||function(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=a[0],i=a[1];return e.off(o,i)})}}}function c(t){var e=t.map,n=t.events,r=t.eventBus,a=function(t){e.setStyle(t.url,{diff:!1})},o=function(t){e.setPixelRatio(t)};return r.on(n.MAP_SET_STYLE,a),r.on(n.MAP_SET_PIXEL_RATIO,o),{remove:function(){r.off(n.MAP_SET_STYLE,a),r.off(n.MAP_SET_PIXEL_RATIO,o)}}}let h=" ";class f{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 n=null;switch(e.length){case 3:n=e[0]/1+e[1]/60+e[2]/3600;break;case 2:n=e[0]/1+e[1]/60;break;case 1:n=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(n=-n),Number(n)}static toDms(t,e="d",n=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===n)switch(e){case"d":case"deg":n=4;break;case"dm":case"deg+min":n=2;break;case"dms":case"deg+min+sec":n=0;break;default:e="d",n=4}t=Math.abs(t);let r=null,a=null,o=null,i=null;switch(e){default:case"d":case"deg":a=t.toFixed(n),a<100&&(a="0"+a),a<10&&(a="0"+a),r=a+"°";break;case"dm":case"deg+min":a=Math.floor(t),o=(60*t%60).toFixed(n),60==o&&(o=(0).toFixed(n),a++),a=("000"+a).slice(-3),o<10&&(o="0"+o),r=a+"°"+f.separator+o+"′";break;case"dms":case"deg+min+sec":a=Math.floor(t),o=Math.floor(3600*t/60)%60,i=(3600*t%60).toFixed(n),60==i&&(i=(0).toFixed(n),o++),60==o&&(o=0,a++),a=("000"+a).slice(-3),o=("00"+o).slice(-2),i<10&&(i="0"+i),r=a+"°"+f.separator+o+"′"+f.separator+i+"″"}return r}static toLat(t,e,n){const r=f.toDms(f.wrap90(t),e,n);return null===r?"–":r.slice(1)+f.separator+(t<0?"S":"N")}static toLon(t,e,n){const r=f.toDms(f.wrap180(t),e,n);return null===r?"–":r+f.separator+(t<0?"W":"E")}static toBrng(t,e,n){const r=f.toDms(f.wrap360(t),e,n);return null===r?"–":r.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(n.thousands,"⁜").replace(n.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",n.decimal).replace("⁜",n.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=f.wrap360(t);const n=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*n/360)%n*16/n]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t;return 1*Math.abs(((e-90)%360+360)%360-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 p=f,d=Math.PI;class y{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=p.wrap90(Number(t)),this._lon=p.wrap180(Number(e))}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.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)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.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,n;if(2==t.length&&([e,n]=t,e=p.wrap90(p.parse(e)),n=p.wrap180(p.parse(n)),isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,n]=t[0].split(","),e=p.wrap90(p.parse(e)),n=p.wrap180(p.parse(n)),isNaN(e)||isNaN(n)))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)?[n,e]=r.coordinates:(null!=r.latitude&&(e=r.latitude),null!=r.lat&&(e=r.lat),null!=r.longitude&&(n=r.longitude),null!=r.lng&&(n=r.lng),null!=r.lon&&(n=r.lon),e=p.wrap90(p.parse(e)),n=p.wrap180(p.parse(n))),isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${t.toString()}’`);return new y(e,n)}distanceTo(t,e=6371e3){if(t instanceof y||(t=y.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const n=e,r=this.lat.toRadians(),a=this.lon.toRadians(),o=t.lat.toRadians(),i=o-r,s=t.lon.toRadians()-a,l=Math.sin(i/2)*Math.sin(i/2)+Math.cos(r)*Math.cos(o)*Math.sin(s/2)*Math.sin(s/2);return n*(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)))}initialBearingTo(t){if(t instanceof y||(t=y.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),n=t.lat.toRadians(),r=(t.lon-this.lon).toRadians(),a=Math.cos(e)*Math.sin(n)-Math.sin(e)*Math.cos(n)*Math.cos(r),o=Math.sin(r)*Math.cos(n),i=Math.atan2(o,a).toDegrees();return p.wrap360(i)}finalBearingTo(t){t instanceof y||(t=y.parse(t));const e=t.initialBearingTo(this)+180;return p.wrap360(e)}midpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians(),n=this.lon.toRadians(),r=t.lat.toRadians(),a=(t.lon-this.lon).toRadians(),o=Math.cos(e),i=Math.sin(e),s={x:o+Math.cos(r)*Math.cos(a),y:0+Math.cos(r)*Math.sin(a),z:i+Math.sin(r)},l=Math.atan2(s.z,Math.sqrt(s.x*s.x+s.y*s.y)),u=n+Math.atan2(s.y,s.x),c=l.toDegrees(),h=u.toDegrees();return new y(c,h)}intermediatePointTo(t,e){if(t instanceof y||(t=y.parse(t)),this.equals(t))return new y(this.lat,this.lon);const n=this.lat.toRadians(),r=this.lon.toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=a-n,s=o-r,l=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(a)*Math.sin(s/2)*Math.sin(s/2),u=2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),c=Math.sin((1-e)*u)/Math.sin(u),h=Math.sin(e*u)/Math.sin(u),f=c*Math.cos(n)*Math.cos(r)+h*Math.cos(a)*Math.cos(o),p=c*Math.cos(n)*Math.sin(r)+h*Math.cos(a)*Math.sin(o),d=c*Math.sin(n)+h*Math.sin(a),g=Math.atan2(d,Math.sqrt(f*f+p*p)),v=Math.atan2(p,f),m=g.toDegrees(),b=v.toDegrees();return new y(m,b)}destinationPoint(t,e,n=6371e3){const r=t/n,a=Number(e).toRadians(),o=this.lat.toRadians(),i=this.lon.toRadians(),s=Math.sin(o)*Math.cos(r)+Math.cos(o)*Math.sin(r)*Math.cos(a),l=Math.asin(s),u=Math.sin(a)*Math.sin(r)*Math.cos(o),c=Math.cos(r)-Math.sin(o)*s,h=i+Math.atan2(u,c),f=l.toDegrees(),p=h.toDegrees();return new y(f,p)}static intersection(t,e,n,r){if(t instanceof y||(t=y.parse(t)),n instanceof y||(n=y.parse(n)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(r))throw new TypeError(`invalid brng2 ‘${r}’`);const a=t.lat.toRadians(),o=t.lon.toRadians(),i=n.lat.toRadians(),s=n.lon.toRadians(),l=Number(e).toRadians(),u=Number(r).toRadians(),c=i-a,h=s-o,f=2*Math.asin(Math.sqrt(Math.sin(c/2)*Math.sin(c/2)+Math.cos(a)*Math.cos(i)*Math.sin(h/2)*Math.sin(h/2)));if(Math.abs(f)<Number.EPSILON)return new y(t.lat,t.lon);const p=(Math.sin(i)-Math.sin(a)*Math.cos(f))/(Math.sin(f)*Math.cos(a)),g=(Math.sin(a)-Math.sin(i)*Math.cos(f))/(Math.sin(f)*Math.cos(i)),v=Math.acos(Math.min(Math.max(p,-1),1)),m=Math.acos(Math.min(Math.max(g,-1),1)),b=l-(Math.sin(s-o)>0?v:2*d-v),M=(Math.sin(s-o)>0?2*d-m:m)-u;if(0==Math.sin(b)&&0==Math.sin(M))return null;if(Math.sin(b)*Math.sin(M)<0)return null;const w=-Math.cos(b)*Math.cos(M)+Math.sin(b)*Math.sin(M)*Math.cos(f),S=Math.atan2(Math.sin(f)*Math.sin(b)*Math.sin(M),Math.cos(M)+Math.cos(b)*w),N=Math.asin(Math.min(Math.max(Math.sin(a)*Math.cos(S)+Math.cos(a)*Math.sin(S)*Math.cos(l),-1),1)),O=o+Math.atan2(Math.sin(l)*Math.sin(S)*Math.cos(a),Math.cos(S)-Math.sin(a)*Math.sin(N)),P=N.toDegrees(),E=O.toDegrees();return new y(P,E)}crossTrackDistanceTo(t,e,n=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const r=n;if(this.equals(t))return 0;const a=t.distanceTo(this,r)/r,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(a)*Math.sin(o-i))*r}alongTrackDistanceTo(t,e,n=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const r=n;if(this.equals(t))return 0;const a=t.distanceTo(this,r)/r,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians(),s=Math.asin(Math.sin(a)*Math.sin(o-i));return Math.acos(Math.cos(a)/Math.abs(Math.cos(s)))*Math.sign(Math.cos(i-o))*r}maxLatitude(t){const e=Number(t).toRadians(),n=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(n))).toDegrees()}static crossingParallels(t,e,n){if(t.equals(e))return null;const r=Number(n).toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=e.lat.toRadians(),s=e.lon.toRadians()-o,l=Math.sin(a)*Math.cos(i)*Math.cos(r)*Math.sin(s),u=Math.sin(a)*Math.cos(i)*Math.cos(r)*Math.cos(s)-Math.cos(a)*Math.sin(i)*Math.cos(r),c=Math.cos(a)*Math.cos(i)*Math.sin(r)*Math.sin(s);if(c*c>l*l+u*u)return null;const h=Math.atan2(-u,l),f=Math.acos(c/Math.sqrt(l*l+u*u)),d=o+h+f,y=(o+h-f).toDegrees(),g=d.toDegrees();return{lon1:p.wrap180(y),lon2:p.wrap180(g)}}rhumbDistanceTo(t,e=6371e3){t instanceof y||(t=y.parse(t));const n=e,r=this.lat.toRadians(),a=t.lat.toRadians(),o=a-r;let i=Math.abs(t.lon-this.lon).toRadians();Math.abs(i)>d&&(i=i>0?-(2*d-i):2*d+i);const s=Math.log(Math.tan(a/2+d/4)/Math.tan(r/2+d/4)),l=Math.abs(s)>1e-11?o/s:Math.cos(r);return Math.sqrt(o*o+l*l*i*i)*n}rhumbBearingTo(t){if(t instanceof y||(t=y.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),n=t.lat.toRadians();let r=(t.lon-this.lon).toRadians();Math.abs(r)>d&&(r=r>0?-(2*d-r):2*d+r);const a=Math.log(Math.tan(n/2+d/4)/Math.tan(e/2+d/4)),o=Math.atan2(r,a).toDegrees();return p.wrap360(o)}rhumbDestinationPoint(t,e,n=6371e3){const r=this.lat.toRadians(),a=this.lon.toRadians(),o=Number(e).toRadians(),i=t/n,s=i*Math.cos(o);let l=r+s;Math.abs(l)>d/2&&(l=l>0?d-l:-d-l);const u=Math.log(Math.tan(l/2+d/4)/Math.tan(r/2+d/4)),c=Math.abs(u)>1e-11?s/u:Math.cos(r),h=a+i*Math.sin(o)/c,f=l.toDegrees(),p=h.toDegrees();return new y(f,p)}rhumbMidpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians();let n=this.lon.toRadians();const r=t.lat.toRadians(),a=t.lon.toRadians();Math.abs(a-n)>d&&(n+=2*d);const o=(e+r)/2,i=Math.tan(d/4+e/2),s=Math.tan(d/4+r/2),l=Math.tan(d/4+o/2);let u=((a-n)*Math.log(l)+n*Math.log(s)-a*Math.log(i))/Math.log(s/i);isFinite(u)||(u=(n+a)/2);const c=o.toDegrees(),h=u.toDegrees();return new y(c,h)}static areaOf(t,e=6371e3){const n=e,r=t[0].equals(t[t.length-1]);r||t.push(t[0]);const a=t.length-1;let o=0;for(let e=0;e<a;e++){const n=t[e].lat.toRadians(),r=t[e+1].lat.toRadians(),a=(t[e+1].lon-t[e].lon).toRadians();o+=2*Math.atan2(Math.tan(a/2)*(Math.tan(n/2)+Math.tan(r/2)),1+Math.tan(n/2)*Math.tan(r/2))}(function(t){let e=0,n=t[0].initialBearingTo(t[1]);for(let r=0;r<t.length-1;r++){const a=t[r].initialBearingTo(t[r+1]),o=t[r].finalBearingTo(t[r+1]);e+=(a-n+540)%360-180,e+=(o-a+540)%360-180,n=o}return e+=(t[0].initialBearingTo(t[1])-n+540)%360-180,Math.abs(e)<90})(t)&&(o=Math.abs(o)-2*d);const i=Math.abs(o*n*n);return r||t.pop(),i}equals(t){return t instanceof y||(t=y.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}’`);return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)},${this.lon.toFixed(e)}`):`${p.toLat(this.lat,t,e)}, ${p.toLon(this.lon,t,e)}`}}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,a=t}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return v(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var m=function(t,e){var n=g(t,2),r=n[0],a=n[1],o=g(e,2),i=o[0],s=o[1],l=new y(a,r),u=new y(s,i);return l.distanceTo(u)},b=function(t){var e=1609.344,n=t/e;if(n<.5/e)return"".concat(Math.round(t),"m");if(n<10){var r=Number.parseFloat(n.toFixed(1)),a=1===r?"mile":"miles";return"".concat(r," ").concat(a)}var o=Math.round(n),i=1===o?"mile":"miles";return"".concat(o," ").concat(i)};function M(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,a=t}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return w(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function S(t){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},S(t)}function N(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function O(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?N(Object(n),!0).forEach(function(e){P(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function P(t,e,n){return(e=function(t){var e=function(t){if("object"!=S(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=S(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==S(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function A(t,e){if("number"==typeof t)return t;if(!Array.isArray(t)||"interpolate"!==t[0])return function(t,e){var n=t.stops;if(n.length<2)return n.length>0?n[0][1]:0;for(var r=n[0],a=n[n.length-1],o=1;o<n.length;o++){var i=n[o];if(i[0]>e){a=i,r=n[o-1];break}r=n[o-1],a=i}var s=M(r,2),l=s[0],u=s[1],c=M(a,2),h=c[0],f=c[1];return e<=l?u:e>=h?f:u+(e-l)/(h-l)*(f-u)}(t,e);var n,r=function(t){if(Array.isArray(t))return t}(n=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||function(t,e){if(t){if("string"==typeof t)return E(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(t,e):void 0}}(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=r[2],o=r.slice(3);if("zoom"!==a[0])throw new Error("Only zoom-based expressions supported");for(var i=0;i<o.length-2;i+=2){var s=o[i],l=o[i+1],u=o[i+2],c=o[i+3];if(e<=s)return l;if(e<=u)return l+(e-s)/(u-s)*(c-l)}return o[o.length-1]}function j(t,e,n,r){var a="dark"===e,o=[],i=null,s=null,l=null,u=null,c={get current(){return a?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"}}},h=function(){t.getSource("highlighted-label")||t.addSource("highlighted-label",{type:"geojson",data:{type:"FeatureCollection",features:[]}})};function f(){var e=t.getStyle().layers.filter(function(t){return"symbol"===t.type}),n=t.queryRenderedFeatures({layers:e.map(function(t){return t.id})});o=e.flatMap(function(e){var r,a,o,i=null===(r=e.layout)||void 0===r?void 0:r["text-field"],s="string"==typeof i?null===(a=i.match(/^{(.+)}$/))||void 0===a?void 0:a[1]:Array.isArray(i)?null===(o=i.find(function(t){return Array.isArray(t)&&"get"===t[0]}))||void 0===o?void 0:o[1]:null;return s?n.filter(function(t){var n;return t.layer.id===e.id&&(null===(n=t.properties)||void 0===n?void 0:n[s])}).map(function(n){var r=function(t){var e=t.type,n=t.coordinates;if("Point"===e)return n;if("MultiPoint"===e)return n[0];if(e.includes("LineString")){var r="LineString"===e?n:n[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 a="Polygon"===e?n[0]:n[0][0],o=a.reduce(function(t,e){return[t[0]+e[0],t[1]+e[1]]},[0,0]);return[o[0]/a.length,o[1]/a.length]}return null}(n.geometry);if(!r)return null;var a=t.project({lng:r[0],lat:r[1]});return{text:n.properties[s],x:a.x,y:a.y,feature:n,layer:e}}).filter(Boolean):[]})}function p(){if(s&&t.getLayer(s)){try{t.removeLayer(s)}catch(t){}s=null,l=null,u=null}}function d(e){var n;if(null!=e&&null!==(n=e.feature)&&void 0!==n&&n.layer){p();var r=e.feature,a=e.layer;s="highlight-".concat(a.id);var o=r.id,i=r.type,h=r.properties,f=r.geometry;u={id:o,type:i,properties:h,geometry:f},t.getSource("highlighted-label").setData(u),l=a.layout["text-size"];var d=t.getZoom(),y=1.5*A(l,d);t.addLayer({id:s,type:a.type,source:"highlighted-label",layout:O(O({},a.layout),{},{"text-size":y,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:O(O({},a.paint),{},{"text-color":c.current.text,"text-halo-color":c.current.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})}),t.moveLayer(s)}}function y(){var e;if(f(),!o.length)return null;var n=t.project(t.getCenter()),r=null===(e=o.reduce(function(t,e){var r=Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2);return!t||r<t.dist?{label:e,dist:r}:t},null))||void 0===e?void 0:e.label;return r&&(i={x:r.x,y:r.y}),d(r),"".concat(r.text," (").concat(r.layer.id,")")}return t.getStyle().layers.filter(function(t){var e;return"line"===(null===(e=t.layout)||void 0===e?void 0:e["symbol-placement"])}).forEach(function(e){t.setLayoutProperty(e.id,"symbol-placement","line-center")}),h(),null==r||r.on(n.MAP_SET_STYLE,function(e){t.once("styledata",function(){return t.once("idle",function(){t.getStyle().layers.filter(function(t){var e;return"line"===(null===(e=t.layout)||void 0===e?void 0:e["symbol-placement"])}).forEach(function(e){t.setLayoutProperty(e.id,"symbol-placement","line-center")}),h(),a="dark"===(null==e?void 0:e.mapColorScheme)})})}),t.on("zoom",function(){if(s&&l){var e=t.getZoom(),n=A(l,e);t.setLayoutProperty(s,"text-size",1.5*n)}}),t.getStyle().layers.filter(function(t){return"symbol"===t.type}).forEach(function(e){t.setPaintProperty(e.id,"text-opacity",["case",["boolean",["feature-state","highlighted"],!1],0,1])}),{refreshLabels:f,highlightNextLabel:function(t){if(f(),!o.length)return null;if(!i)return y();var e=o.map(function(t,e){return{pixel:[t.x,t.y],index:e}}).filter(function(t){return t.pixel[0]!==i.x||t.pixel[1]!==i.y});if(!e.length)return null;var n=e.map(function(t){return t.pixel}),r=function(t,e,n){var r=g(e,2),a=r[0],o=r[1],i=n.filter(function(e){var n=g(e,2),r=n[0],i=n[1];if(r===a&&i===o)return!1;var s=r-a,l=i-o;switch(t){case"ArrowUp":return l<0&&Math.abs(l)>=Math.abs(s);case"ArrowDown":return l>0&&Math.abs(l)>=Math.abs(s);case"ArrowLeft":return s<0&&Math.abs(s)>Math.abs(l);case"ArrowRight":return s>0&&Math.abs(s)>Math.abs(l);default:return!1}});if(!i.length)return n.findIndex(function(t){return t[0]===a&&t[1]===o});var s=-1,l=1/0;return i.forEach(function(t){var e=t[0]-a,r=t[1]-o,i=e*e+r*r;i<l&&(l=i,s=n.indexOf(t))}),s}(t,[i.x,i.y],n);(null==r||r<0||r>=e.length)&&(r=0);var a=o[e[r].index];return i={x:a.x,y:a.y},d(a),"".concat(a.text," (").concat(a.layer.id,")")},highlightLabelAtCenter:y,clearHighlightedLabel:p}}function T(t){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T(t)}function x(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function R(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?x(Object(n),!0).forEach(function(e){L(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function L(t,e,n){return(e=function(t){var e=function(t){if("object"!=T(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=T(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==T(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function D(t){return function(t){if(Array.isArray(t))return _(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return _(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var k=["container","padding","mapStyle","center","zoom","bounds","pixelRatio"];function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function C(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return I(u,"_invoke",function(n,r,a){var o,s,l,u=0,c=a||[],h=!1,f={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,i}};function p(n,r){for(s=n,l=r,e=0;!h&&u&&!a&&e<c.length;e++){var a,o=c[e],p=f.p,d=o[2];n>3?(a=d===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=p&&((a=n<2&&p<o[1])?(s=0,f.v=r,f.n=o[1]):p<d&&(a=n<3||o[0]>r||r>d)&&(o[4]=n,o[5]=r,f.n=d,s=0))}if(a||n>1)return i;throw h=!0,r}return function(a,c,d){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,d),s=c,l=d;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),p(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(a="next"),e=o[a]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==i)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,a,o),!0),u}var i={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(I(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,I(t,a,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,I(h,"constructor",u),I(u,"constructor",l),l.displayName="GeneratorFunction",I(u,a,"GeneratorFunction"),I(h),I(h,a,"Generator"),I(h,r,function(){return this}),I(h,"toString",function(){return"[object Generator]"}),(C=function(){return{w:o,m:f}})()}function I(t,e,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(t){a=0}I=function(t,e,n,r){if(e)a?a(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n;else{function o(e,n){I(t,e,function(t){return this._invoke(e,n,t)})}o("next",0),o("throw",1),o("return",2)}},I(t,e,n,r)}function F(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function $(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?F(Object(n),!0).forEach(function(e){z(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):F(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function z(t,e,n){return(e=G(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function q(t,e){if(null==t)return{};var n,r,a=function(t,e){if(null==t)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;n[r]=t[r]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function Z(t,e,n,r,a,o,i){try{var s=t[o](i),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,a)}function W(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,G(r.key),r)}}function G(t){var e=function(t){if("object"!=B(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=B(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==B(e)?e:e+""}var H=function(){return t=function t(e){var n=e.mapFramework,r=e.mapProviderConfig,o=void 0===r?{}:r,i=e.events,s=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.maplibreModule=n,this.events=i,this.eventBus=s,this.capabilities={supportedShortcuts:a,supportsMapSizes:!0},Object.assign(this,o)},e=[{key:"initMap",value:(n=C().m(function t(e){var n,r,a,s,l,h,f,p,d,y,g,v,m=this;return C().w(function(t){for(;;)switch(t.n){case 0:n=e.container,r=e.padding,a=e.mapStyle,s=e.center,l=e.zoom,h=e.bounds,f=e.pixelRatio,p=q(e,k),d=this.maplibreModule.Map,y=this.events,g=this.eventBus,(v=new d($($({},p),{},{container:n,style:null==a?void 0:a.url,pixelRatio:f,padding:r,center:s,zoom:l,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}))).touchZoomRotate.disableRotation(),this.map=v,this.map.setPadding(r),h&&v.fitBounds(h,{duration:0}),i(v),o(v),u({map:v,events:y,eventBus:g,getCenter:this.getCenter.bind(this),getZoom:this.getZoom.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),c({map:v,events:y,eventBus:g}),v.on("load",function(){m.labelNavigator=j(v,null==a?void 0:a.mapColorScheme,y,g)}),this.eventBus.emit(y.MAP_READY,{map:v});case 1:return t.a(2)}},t,this)}),s=function(){var t=this,e=arguments;return new Promise(function(r,a){var o=n.apply(t,e);function i(t){Z(o,r,a,i,s,"next",t)}function s(t){Z(o,r,a,i,s,"throw",t)}i(void 0)})},function(t){return s.apply(this,arguments)})},{key:"destroyMap",value:function(){var t,e;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()}},{key:"setView",value:function(t){var e=t.center,n=t.zoom;this.map.flyTo({center:e||this.getCenter(),zoom:n||this.getZoom(),duration:r})}},{key:"zoomIn",value:function(t){this.map.easeTo({zoom:this.getZoom()+t,duration:r})}},{key:"zoomOut",value:function(t){this.map.easeTo({zoom:this.getZoom()-t,duration:r})}},{key:"panBy",value:function(t){this.map.panBy(t,{duration:r})}},{key:"fitToBounds",value:function(t){this.map.fitBounds(t,{duration:r})}},{key:"setPadding",value:function(t){this.map.setPadding(t)}},{key:"updateHighlightedFeatures",value:function(t,e){return function(t){var e=t.LngLatBounds,n=t.map,r=t.selectedFeatures,a=t.stylesMap;if(!n)return null;var o={},i=[];null==r||r.forEach(function(t){var e=t.featureId,r=t.layerId,a=t.idProperty,i=n.getLayer(r);if(i){var s=i.source;o[s]||(o[s]={ids:new Set,idProperty:a,layerId:r}),o[s].ids.add(e)}});var s=new Set(Object.keys(o));if((n._highlightedSources||new Set).forEach(function(t){if(!s.has(t)){var e="highlight-".concat(t);["".concat(e,"-fill"),"".concat(e,"-line")].forEach(function(t){n.getLayer(t)&&n.setFilter(t,["==","id",""])})}}),n._highlightedSources=s,s.forEach(function(t){var e=o[t],r=e.ids,s=e.idProperty,l=e.layerId,u=n.getLayer(l),c=u.sourceLayer,h=u.type,f="highlight-".concat(t),p=a[l],d=p.stroke,y=p.strokeWidth,g=p.fill,v=["in",["get",s],["literal",D(r)]];"fill"===h&&(n.getLayer("".concat(f,"-fill"))||n.addLayer(R(R({id:"".concat(f,"-fill"),type:"fill",source:t},c&&{"source-layer":c}),{},{paint:{"fill-color":g}})),n.setPaintProperty("".concat(f,"-fill"),"fill-color",g),n.setFilter("".concat(f,"-fill"),v),n.getLayer("".concat(f,"-line"))||n.addLayer(R(R({id:"".concat(f,"-line"),type:"line",source:t},c&&{"source-layer":c}),{},{paint:{"line-color":d,"line-width":y}})),n.setPaintProperty("".concat(f,"-line"),"line-color",d),n.setPaintProperty("".concat(f,"-line"),"line-width",y),n.setFilter("".concat(f,"-line"),v)),"line"===h&&(n.getLayer("".concat(f,"-line"))||n.addLayer(R(R({id:"".concat(f,"-line"),type:"line",source:t},c&&{"source-layer":c}),{},{paint:{"line-color":d,"line-width":y}})),n.setFilter("".concat(f,"-line"),v)),i.push.apply(i,D(n.queryRenderedFeatures({layers:[l]}).filter(function(t){var e;return r.has(null===(e=t.properties)||void 0===e?void 0:e[s])})))}),!i.length)return null;var l=new e;return i.forEach(function(t){var e=function(t){return"number"==typeof t[0]?l.extend(t):t.forEach(e)};e(t.geometry.coordinates)}),[l.getWest(),l.getSouth(),l.getEast(),l.getNorth()]}({LngLatBounds:this.maplibreModule.LngLatBounds,map:this.map,selectedFeatures:t,stylesMap:e})}},{key:"highlightNextLabel",value:function(t){var e;return(null===(e=this.labelNavigator)||void 0===e?void 0:e.highlightNextLabel(t))||null}},{key:"highlightLabelAtCenter",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.highlightLabelAtCenter())||null}},{key:"clearHighlightedLabel",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.clearHighlightedLabel())||null}},{key:"getCenter",value:function(){var t=this.map.getCenter();return[Number(t.lng.toFixed(7)),Number(t.lat.toFixed(7))]}},{key:"getZoom",value:function(){return Number(this.map.getZoom().toFixed(7))}},{key:"getBounds",value:function(){return this.map.getBounds().toArray().flat(1)}},{key:"getFeaturesAtPoint",value:function(t){return this.map.queryRenderedFeatures(t)}},{key:"getAreaDimensions",value:function(){return function(t){var e,n,r,a;if(t&&"function"==typeof t.getWest)e=t.getWest(),n=t.getSouth(),r=t.getEast(),a=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";var o=g(t,2),i=g(o[0],2);e=i[0],n=i[1];var s=g(o[1],2);r=s[0],a=s[1]}var l=m([e,n],[r,n]),u=m([e,n],[e,a]),c=b(l),h=b(u);return"".concat(h," by ").concat(c)}((t=this.maplibreModule.LngLatBounds,e=this.map,n=e.getContainer().getBoundingClientRect(),r=n.width,a=n.height,o=e.getPadding(),i=[o.left,a-o.bottom],s=[r-o.right,o.top],new t(e.unproject(i),e.unproject(s))));var t,e,n,r,a,o,i,s}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var n=g(t,2),r=n[0],a=n[1],o=g(e,2),i=o[0],s=o[1],l=s-a,u=i-r,c=[];if(Math.abs(l)>1e-4){var h=Math.round(m([r,a],[r,s]));c.push("".concat(l>0?"north":"south"," ").concat(b(h)))}if(Math.abs(u)>1e-4){var f=Math.round(m([r,a],[i,a]));c.push("".concat(u>0?"east":"west"," ").concat(b(f)))}return c.join(", ")}(t,e)}},{key:"getResolution",value:function(){return t=this.map.getCenter(),e=this.map.getZoom(),n=t.lat,r=Math.pow(2,e),40075016.686*Math.cos(n*Math.PI/180)/(512*r);var t,e,n,r}},{key:"mapToScreen",value:function(t){return this.map.project(t)}},{key:"screenToMap",value:function(t){var e=this.map.unproject([t.x,t.y]);return[e.lng,e.lat]}}],e&&W(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,s}()}}]);
|
|
2
|
+
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[772],{6102(t,e,n){n.r(e),n.d(e,{default:()=>H});var r=400,a=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];function o(t){var e=t.getCanvas();e.removeAttribute("role"),e.setAttribute("tabindex",-1),e.removeAttribute("aria-label"),e.style.display="block"}function i(t){var e=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){if(("touchmove"===this.type||"touchstart"===this.type)&&!this.cancelable){var n=t.getCanvas();if(n&&(this.target===n||n.contains(this.target)))return}return e.call(this)}}var s=function(t,e){var n=null,r=function(){for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];clearTimeout(n),n=setTimeout(function(){t.apply(void 0,a)},e)};return r.cancel=function(){n&&(clearTimeout(n),n=null)},r};function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function u(t){var e=t.map,n=t.events,r=t.eventBus,a=t.getCenter,o=t.getZoom,i=t.getBounds,u=t.getResolution,c=[],h=[],f=function(){var t=o();return{center:a(),bounds:i(),resolution:u(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},p=function(t,e){return r.emit(t,e)},d=function(){return p(n.MAP_LOADED)};e.on("load",d),c.push(["load",d]),e.once("idle",function(){return p(n.MAP_FIRST_IDLE,f())});var y=function(){return p(n.MAP_MOVE_START)};e.on("movestart",y),c.push(["movestart",y]);var g=s(function(){p(n.MAP_MOVE_END,f())},500);e.on("moveend",g),c.push(["moveend",g]),h.push(g);var v,m,b=(v=function(){p(n.MAP_MOVE,f())},m=0,function(){var t=Date.now();t-m>=10&&(m=t,v.apply(void 0,arguments))});e.on("zoom",b),c.push(["zoom",b]),h.push(b);var M=function(){return p(n.MAP_RENDER)};e.on("render",M),c.push(["render",M]);var w=s(function(){p(n.MAP_DATA_CHANGE,f())},500);e.on("styledata",w),c.push(["styledata",w]),h.push(w);var S=function(){return p(n.MAP_STYLE_CHANGE)};e.on("style.load",S),c.push(["style.load",S]);var N=function(t){return p(n.MAP_CLICK,{point:t.point,coords:[t.lngLat.lng,t.lngLat.lat]})};return e.on("click",N),c.push(["click",N]),{remove:function(){h.forEach(function(t){return t.cancel()}),c.forEach(function(t){var n,r,a=(r=2,function(t){if(Array.isArray(t))return t}(n=t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,a=t}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return s}}(n,r)||function(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=a[0],i=a[1];return e.off(o,i)})}}}function c(t){var e=t.map,n=t.events,r=t.eventBus,a=function(t){e.setStyle(t.url,{diff:!1})},o=function(t){e.setPixelRatio(t)};return r.on(n.MAP_SET_STYLE,a),r.on(n.MAP_SET_PIXEL_RATIO,o),{remove:function(){r.off(n.MAP_SET_STYLE,a),r.off(n.MAP_SET_PIXEL_RATIO,o)}}}let h=" ";class f{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 n=null;switch(e.length){case 3:n=e[0]/1+e[1]/60+e[2]/3600;break;case 2:n=e[0]/1+e[1]/60;break;case 1:n=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(n=-n),Number(n)}static toDms(t,e="d",n=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===n)switch(e){case"d":case"deg":n=4;break;case"dm":case"deg+min":n=2;break;case"dms":case"deg+min+sec":n=0;break;default:e="d",n=4}t=Math.abs(t);let r=null,a=null,o=null,i=null;switch(e){default:case"d":case"deg":a=t.toFixed(n),a<100&&(a="0"+a),a<10&&(a="0"+a),r=a+"°";break;case"dm":case"deg+min":a=Math.floor(t),o=(60*t%60).toFixed(n),60==o&&(o=(0).toFixed(n),a++),a=("000"+a).slice(-3),o<10&&(o="0"+o),r=a+"°"+f.separator+o+"′";break;case"dms":case"deg+min+sec":a=Math.floor(t),o=Math.floor(3600*t/60)%60,i=(3600*t%60).toFixed(n),60==i&&(i=(0).toFixed(n),o++),60==o&&(o=0,a++),a=("000"+a).slice(-3),o=("00"+o).slice(-2),i<10&&(i="0"+i),r=a+"°"+f.separator+o+"′"+f.separator+i+"″"}return r}static toLat(t,e,n){const r=f.toDms(f.wrap90(t),e,n);return null===r?"–":r.slice(1)+f.separator+(t<0?"S":"N")}static toLon(t,e,n){const r=f.toDms(f.wrap180(t),e,n);return null===r?"–":r+f.separator+(t<0?"W":"E")}static toBrng(t,e,n){const r=f.toDms(f.wrap360(t),e,n);return null===r?"–":r.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(n.thousands,"⁜").replace(n.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",n.decimal).replace("⁜",n.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=f.wrap360(t);const n=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*n/360)%n*16/n]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t;return 1*Math.abs(((e-90)%360+360)%360-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 p=f,d=Math.PI;class y{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=p.wrap90(Number(t)),this._lon=p.wrap180(Number(e))}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.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)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.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,n;if(2==t.length&&([e,n]=t,e=p.wrap90(p.parse(e)),n=p.wrap180(p.parse(n)),isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,n]=t[0].split(","),e=p.wrap90(p.parse(e)),n=p.wrap180(p.parse(n)),isNaN(e)||isNaN(n)))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)?[n,e]=r.coordinates:(null!=r.latitude&&(e=r.latitude),null!=r.lat&&(e=r.lat),null!=r.longitude&&(n=r.longitude),null!=r.lng&&(n=r.lng),null!=r.lon&&(n=r.lon),e=p.wrap90(p.parse(e)),n=p.wrap180(p.parse(n))),isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${t.toString()}’`);return new y(e,n)}distanceTo(t,e=6371e3){if(t instanceof y||(t=y.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const n=e,r=this.lat.toRadians(),a=this.lon.toRadians(),o=t.lat.toRadians(),i=o-r,s=t.lon.toRadians()-a,l=Math.sin(i/2)*Math.sin(i/2)+Math.cos(r)*Math.cos(o)*Math.sin(s/2)*Math.sin(s/2);return n*(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)))}initialBearingTo(t){if(t instanceof y||(t=y.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),n=t.lat.toRadians(),r=(t.lon-this.lon).toRadians(),a=Math.cos(e)*Math.sin(n)-Math.sin(e)*Math.cos(n)*Math.cos(r),o=Math.sin(r)*Math.cos(n),i=Math.atan2(o,a).toDegrees();return p.wrap360(i)}finalBearingTo(t){t instanceof y||(t=y.parse(t));const e=t.initialBearingTo(this)+180;return p.wrap360(e)}midpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians(),n=this.lon.toRadians(),r=t.lat.toRadians(),a=(t.lon-this.lon).toRadians(),o=Math.cos(e),i=Math.sin(e),s={x:o+Math.cos(r)*Math.cos(a),y:0+Math.cos(r)*Math.sin(a),z:i+Math.sin(r)},l=Math.atan2(s.z,Math.sqrt(s.x*s.x+s.y*s.y)),u=n+Math.atan2(s.y,s.x),c=l.toDegrees(),h=u.toDegrees();return new y(c,h)}intermediatePointTo(t,e){if(t instanceof y||(t=y.parse(t)),this.equals(t))return new y(this.lat,this.lon);const n=this.lat.toRadians(),r=this.lon.toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=a-n,s=o-r,l=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(a)*Math.sin(s/2)*Math.sin(s/2),u=2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),c=Math.sin((1-e)*u)/Math.sin(u),h=Math.sin(e*u)/Math.sin(u),f=c*Math.cos(n)*Math.cos(r)+h*Math.cos(a)*Math.cos(o),p=c*Math.cos(n)*Math.sin(r)+h*Math.cos(a)*Math.sin(o),d=c*Math.sin(n)+h*Math.sin(a),g=Math.atan2(d,Math.sqrt(f*f+p*p)),v=Math.atan2(p,f),m=g.toDegrees(),b=v.toDegrees();return new y(m,b)}destinationPoint(t,e,n=6371e3){const r=t/n,a=Number(e).toRadians(),o=this.lat.toRadians(),i=this.lon.toRadians(),s=Math.sin(o)*Math.cos(r)+Math.cos(o)*Math.sin(r)*Math.cos(a),l=Math.asin(s),u=Math.sin(a)*Math.sin(r)*Math.cos(o),c=Math.cos(r)-Math.sin(o)*s,h=i+Math.atan2(u,c),f=l.toDegrees(),p=h.toDegrees();return new y(f,p)}static intersection(t,e,n,r){if(t instanceof y||(t=y.parse(t)),n instanceof y||(n=y.parse(n)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(r))throw new TypeError(`invalid brng2 ‘${r}’`);const a=t.lat.toRadians(),o=t.lon.toRadians(),i=n.lat.toRadians(),s=n.lon.toRadians(),l=Number(e).toRadians(),u=Number(r).toRadians(),c=i-a,h=s-o,f=2*Math.asin(Math.sqrt(Math.sin(c/2)*Math.sin(c/2)+Math.cos(a)*Math.cos(i)*Math.sin(h/2)*Math.sin(h/2)));if(Math.abs(f)<Number.EPSILON)return new y(t.lat,t.lon);const p=(Math.sin(i)-Math.sin(a)*Math.cos(f))/(Math.sin(f)*Math.cos(a)),g=(Math.sin(a)-Math.sin(i)*Math.cos(f))/(Math.sin(f)*Math.cos(i)),v=Math.acos(Math.min(Math.max(p,-1),1)),m=Math.acos(Math.min(Math.max(g,-1),1)),b=l-(Math.sin(s-o)>0?v:2*d-v),M=(Math.sin(s-o)>0?2*d-m:m)-u;if(0==Math.sin(b)&&0==Math.sin(M))return null;if(Math.sin(b)*Math.sin(M)<0)return null;const w=-Math.cos(b)*Math.cos(M)+Math.sin(b)*Math.sin(M)*Math.cos(f),S=Math.atan2(Math.sin(f)*Math.sin(b)*Math.sin(M),Math.cos(M)+Math.cos(b)*w),N=Math.asin(Math.min(Math.max(Math.sin(a)*Math.cos(S)+Math.cos(a)*Math.sin(S)*Math.cos(l),-1),1)),O=o+Math.atan2(Math.sin(l)*Math.sin(S)*Math.cos(a),Math.cos(S)-Math.sin(a)*Math.sin(N)),P=N.toDegrees(),E=O.toDegrees();return new y(P,E)}crossTrackDistanceTo(t,e,n=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const r=n;if(this.equals(t))return 0;const a=t.distanceTo(this,r)/r,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(a)*Math.sin(o-i))*r}alongTrackDistanceTo(t,e,n=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const r=n;if(this.equals(t))return 0;const a=t.distanceTo(this,r)/r,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians(),s=Math.asin(Math.sin(a)*Math.sin(o-i));return Math.acos(Math.cos(a)/Math.abs(Math.cos(s)))*Math.sign(Math.cos(i-o))*r}maxLatitude(t){const e=Number(t).toRadians(),n=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(n))).toDegrees()}static crossingParallels(t,e,n){if(t.equals(e))return null;const r=Number(n).toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=e.lat.toRadians(),s=e.lon.toRadians()-o,l=Math.sin(a)*Math.cos(i)*Math.cos(r)*Math.sin(s),u=Math.sin(a)*Math.cos(i)*Math.cos(r)*Math.cos(s)-Math.cos(a)*Math.sin(i)*Math.cos(r),c=Math.cos(a)*Math.cos(i)*Math.sin(r)*Math.sin(s);if(c*c>l*l+u*u)return null;const h=Math.atan2(-u,l),f=Math.acos(c/Math.sqrt(l*l+u*u)),d=o+h+f,y=(o+h-f).toDegrees(),g=d.toDegrees();return{lon1:p.wrap180(y),lon2:p.wrap180(g)}}rhumbDistanceTo(t,e=6371e3){t instanceof y||(t=y.parse(t));const n=e,r=this.lat.toRadians(),a=t.lat.toRadians(),o=a-r;let i=Math.abs(t.lon-this.lon).toRadians();Math.abs(i)>d&&(i=i>0?-(2*d-i):2*d+i);const s=Math.log(Math.tan(a/2+d/4)/Math.tan(r/2+d/4)),l=Math.abs(s)>1e-11?o/s:Math.cos(r);return Math.sqrt(o*o+l*l*i*i)*n}rhumbBearingTo(t){if(t instanceof y||(t=y.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),n=t.lat.toRadians();let r=(t.lon-this.lon).toRadians();Math.abs(r)>d&&(r=r>0?-(2*d-r):2*d+r);const a=Math.log(Math.tan(n/2+d/4)/Math.tan(e/2+d/4)),o=Math.atan2(r,a).toDegrees();return p.wrap360(o)}rhumbDestinationPoint(t,e,n=6371e3){const r=this.lat.toRadians(),a=this.lon.toRadians(),o=Number(e).toRadians(),i=t/n,s=i*Math.cos(o);let l=r+s;Math.abs(l)>d/2&&(l=l>0?d-l:-d-l);const u=Math.log(Math.tan(l/2+d/4)/Math.tan(r/2+d/4)),c=Math.abs(u)>1e-11?s/u:Math.cos(r),h=a+i*Math.sin(o)/c,f=l.toDegrees(),p=h.toDegrees();return new y(f,p)}rhumbMidpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians();let n=this.lon.toRadians();const r=t.lat.toRadians(),a=t.lon.toRadians();Math.abs(a-n)>d&&(n+=2*d);const o=(e+r)/2,i=Math.tan(d/4+e/2),s=Math.tan(d/4+r/2),l=Math.tan(d/4+o/2);let u=((a-n)*Math.log(l)+n*Math.log(s)-a*Math.log(i))/Math.log(s/i);isFinite(u)||(u=(n+a)/2);const c=o.toDegrees(),h=u.toDegrees();return new y(c,h)}static areaOf(t,e=6371e3){const n=e,r=t[0].equals(t[t.length-1]);r||t.push(t[0]);const a=t.length-1;let o=0;for(let e=0;e<a;e++){const n=t[e].lat.toRadians(),r=t[e+1].lat.toRadians(),a=(t[e+1].lon-t[e].lon).toRadians();o+=2*Math.atan2(Math.tan(a/2)*(Math.tan(n/2)+Math.tan(r/2)),1+Math.tan(n/2)*Math.tan(r/2))}(function(t){let e=0,n=t[0].initialBearingTo(t[1]);for(let r=0;r<t.length-1;r++){const a=t[r].initialBearingTo(t[r+1]),o=t[r].finalBearingTo(t[r+1]);e+=(a-n+540)%360-180,e+=(o-a+540)%360-180,n=o}return e+=(t[0].initialBearingTo(t[1])-n+540)%360-180,Math.abs(e)<90})(t)&&(o=Math.abs(o)-2*d);const i=Math.abs(o*n*n);return r||t.pop(),i}equals(t){return t instanceof y||(t=y.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}’`);return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)},${this.lon.toFixed(e)}`):`${p.toLat(this.lat,t,e)}, ${p.toLon(this.lon,t,e)}`}}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,a=t}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return v(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var m=function(t,e){var n=g(t,2),r=n[0],a=n[1],o=g(e,2),i=o[0],s=o[1],l=new y(a,r),u=new y(s,i);return l.distanceTo(u)},b=function(t){var e=1609.344,n=t/e;if(n<.5/e)return"".concat(Math.round(t),"m");if(n<10){var r=Number.parseFloat(n.toFixed(1)),a=1===r?"mile":"miles";return"".concat(r," ").concat(a)}var o=Math.round(n),i=1===o?"mile":"miles";return"".concat(o," ").concat(i)};function M(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,a=t}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return w(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function S(t){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},S(t)}function N(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function O(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?N(Object(n),!0).forEach(function(e){P(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function P(t,e,n){return(e=function(t){var e=function(t){if("object"!=S(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=S(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==S(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function A(t,e){if("number"==typeof t)return t;if(!Array.isArray(t)||"interpolate"!==t[0])return function(t,e){var n=t.stops;if(n.length<2)return n.length>0?n[0][1]:0;for(var r=n[0],a=n[n.length-1],o=1;o<n.length;o++){var i=n[o];if(i[0]>e){a=i,r=n[o-1];break}r=n[o-1],a=i}var s=M(r,2),l=s[0],u=s[1],c=M(a,2),h=c[0],f=c[1];return e<=l?u:e>=h?f:u+(e-l)/(h-l)*(f-u)}(t,e);var n,r=function(t){if(Array.isArray(t))return t}(n=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||function(t,e){if(t){if("string"==typeof t)return E(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(t,e):void 0}}(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=r[2],o=E(r).slice(3);if("zoom"!==a[0])throw new Error("Only zoom-based expressions supported");for(var i=0;i<o.length-2;i+=2){var s=o[i],l=o[i+1],u=o[i+2],c=o[i+3];if(e<=s)return l;if(e<=u)return l+(e-s)/(u-s)*(c-l)}return o[o.length-1]}function j(t,e,n,r){var a="dark"===e,o=[],i=null,s=null,l=null,u=null,c={get current(){return a?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"}}},h=function(){t.getSource("highlighted-label")||t.addSource("highlighted-label",{type:"geojson",data:{type:"FeatureCollection",features:[]}})};function f(){var e=t.getStyle().layers.filter(function(t){return"symbol"===t.type}),n=t.queryRenderedFeatures({layers:e.map(function(t){return t.id})});o=e.flatMap(function(e){var r,a,o,i=null===(r=e.layout)||void 0===r?void 0:r["text-field"],s="string"==typeof i?null===(a=i.match(/^{(.+)}$/))||void 0===a?void 0:a[1]:Array.isArray(i)?null===(o=i.find(function(t){return Array.isArray(t)&&"get"===t[0]}))||void 0===o?void 0:o[1]:null;return s?n.filter(function(t){var n;return t.layer.id===e.id&&(null===(n=t.properties)||void 0===n?void 0:n[s])}).map(function(n){var r=function(t){var e=t.type,n=t.coordinates;if("Point"===e)return n;if("MultiPoint"===e)return n[0];if(e.includes("LineString")){var r="LineString"===e?n:n[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 a="Polygon"===e?n[0]:n[0][0],o=a.reduce(function(t,e){return[t[0]+e[0],t[1]+e[1]]},[0,0]);return[o[0]/a.length,o[1]/a.length]}return null}(n.geometry);if(!r)return null;var a=t.project({lng:r[0],lat:r[1]});return{text:n.properties[s],x:a.x,y:a.y,feature:n,layer:e}}).filter(Boolean):[]})}function p(){if(s&&t.getLayer(s)){try{t.removeLayer(s)}catch(t){}s=null,l=null,u=null}}function d(e){var n;if(null!=e&&null!==(n=e.feature)&&void 0!==n&&n.layer){p();var r=e.feature,a=e.layer;s="highlight-".concat(a.id);var o=r.id,i=r.type,h=r.properties,f=r.geometry;u={id:o,type:i,properties:h,geometry:f},t.getSource("highlighted-label").setData(u),l=a.layout["text-size"];var d=t.getZoom(),y=1.5*A(l,d);t.addLayer({id:s,type:a.type,source:"highlighted-label",layout:O(O({},a.layout),{},{"text-size":y,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:O(O({},a.paint),{},{"text-color":c.current.text,"text-halo-color":c.current.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})}),t.moveLayer(s)}}function y(){var e;if(f(),!o.length)return null;var n=t.project(t.getCenter()),r=null===(e=o.reduce(function(t,e){var r=Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2);return!t||r<t.dist?{label:e,dist:r}:t},null))||void 0===e?void 0:e.label;return r&&(i={x:r.x,y:r.y}),d(r),"".concat(r.text," (").concat(r.layer.id,")")}return t.getStyle().layers.filter(function(t){var e;return"line"===(null===(e=t.layout)||void 0===e?void 0:e["symbol-placement"])}).forEach(function(e){t.setLayoutProperty(e.id,"symbol-placement","line-center")}),h(),null==r||r.on(n.MAP_SET_STYLE,function(e){t.once("styledata",function(){return t.once("idle",function(){t.getStyle().layers.filter(function(t){var e;return"line"===(null===(e=t.layout)||void 0===e?void 0:e["symbol-placement"])}).forEach(function(e){t.setLayoutProperty(e.id,"symbol-placement","line-center")}),h(),a="dark"===(null==e?void 0:e.mapColorScheme)})})}),t.on("zoom",function(){if(s&&l){var e=t.getZoom(),n=A(l,e);t.setLayoutProperty(s,"text-size",1.5*n)}}),t.getStyle().layers.filter(function(t){return"symbol"===t.type}).forEach(function(e){t.setPaintProperty(e.id,"text-opacity",["case",["boolean",["feature-state","highlighted"],!1],0,1])}),{refreshLabels:f,highlightNextLabel:function(t){if(f(),!o.length)return null;if(!i)return y();var e=o.map(function(t,e){return{pixel:[t.x,t.y],index:e}}).filter(function(t){return t.pixel[0]!==i.x||t.pixel[1]!==i.y});if(!e.length)return null;var n=e.map(function(t){return t.pixel}),r=function(t,e,n){var r=g(e,2),a=r[0],o=r[1],i=n.filter(function(e){var n=g(e,2),r=n[0],i=n[1];if(r===a&&i===o)return!1;var s=r-a,l=i-o;switch(t){case"ArrowUp":return l<0&&Math.abs(l)>=Math.abs(s);case"ArrowDown":return l>0&&Math.abs(l)>=Math.abs(s);case"ArrowLeft":return s<0&&Math.abs(s)>Math.abs(l);case"ArrowRight":return s>0&&Math.abs(s)>Math.abs(l);default:return!1}});if(!i.length)return n.findIndex(function(t){return t[0]===a&&t[1]===o});var s=-1,l=1/0;return i.forEach(function(t){var e=t[0]-a,r=t[1]-o,i=e*e+r*r;i<l&&(l=i,s=n.indexOf(t))}),s}(t,[i.x,i.y],n);(null==r||r<0||r>=e.length)&&(r=0);var a=o[e[r].index];return i={x:a.x,y:a.y},d(a),"".concat(a.text," (").concat(a.layer.id,")")},highlightLabelAtCenter:y,clearHighlightedLabel:p}}function T(t){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T(t)}function x(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function R(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?x(Object(n),!0).forEach(function(e){L(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function L(t,e,n){return(e=function(t){var e=function(t){if("object"!=T(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=T(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==T(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function D(t){return function(t){if(Array.isArray(t))return _(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return _(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var k=["container","padding","mapStyle","center","zoom","bounds","pixelRatio"];function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function C(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return I(u,"_invoke",function(n,r,a){var o,s,l,u=0,c=a||[],h=!1,f={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,i}};function p(n,r){for(s=n,l=r,e=0;!h&&u&&!a&&e<c.length;e++){var a,o=c[e],p=f.p,d=o[2];n>3?(a=d===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=p&&((a=n<2&&p<o[1])?(s=0,f.v=r,f.n=o[1]):p<d&&(a=n<3||o[0]>r||r>d)&&(o[4]=n,o[5]=r,f.n=d,s=0))}if(a||n>1)return i;throw h=!0,r}return function(a,c,d){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,d),s=c,l=d;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),p(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(a="next"),e=o[a]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==i)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,a,o),!0),u}var i={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(I(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,I(t,a,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,I(h,"constructor",u),I(u,"constructor",l),l.displayName="GeneratorFunction",I(u,a,"GeneratorFunction"),I(h),I(h,a,"Generator"),I(h,r,function(){return this}),I(h,"toString",function(){return"[object Generator]"}),(C=function(){return{w:o,m:f}})()}function I(t,e,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(t){a=0}I=function(t,e,n,r){function o(e,n){I(t,e,function(t){return this._invoke(e,n,t)})}e?a?a(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},I(t,e,n,r)}function F(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function $(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?F(Object(n),!0).forEach(function(e){z(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):F(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function z(t,e,n){return(e=G(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function q(t,e){if(null==t)return{};var n,r,a=function(t,e){if(null==t)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;n[r]=t[r]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function Z(t,e,n,r,a,o,i){try{var s=t[o](i),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,a)}function W(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,G(r.key),r)}}function G(t){var e=function(t){if("object"!=B(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=B(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==B(e)?e:e+""}var H=function(){return t=function t(e){var n=e.mapFramework,r=e.mapProviderConfig,o=void 0===r?{}:r,i=e.events,s=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.maplibreModule=n,this.events=i,this.eventBus=s,this.capabilities={supportedShortcuts:a,supportsMapSizes:!0},Object.assign(this,o)},e=[{key:"initMap",value:(n=C().m(function t(e){var n,r,a,s,l,h,f,p,d,y,g,v,m=this;return C().w(function(t){for(;;)switch(t.n){case 0:n=e.container,r=e.padding,a=e.mapStyle,s=e.center,l=e.zoom,h=e.bounds,f=e.pixelRatio,p=q(e,k),d=this.maplibreModule.Map,y=this.events,g=this.eventBus,(v=new d($($({},p),{},{container:n,style:null==a?void 0:a.url,pixelRatio:f,padding:r,center:s,zoom:l,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}))).touchZoomRotate.disableRotation(),this.map=v,this.map.setPadding(r),h&&v.fitBounds(h,{duration:0}),i(v),o(v),u({map:v,events:y,eventBus:g,getCenter:this.getCenter.bind(this),getZoom:this.getZoom.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),c({map:v,events:y,eventBus:g}),v.on("load",function(){m.labelNavigator=j(v,null==a?void 0:a.mapColorScheme,y,g)}),this.eventBus.emit(y.MAP_READY,{map:v});case 1:return t.a(2)}},t,this)}),s=function(){var t=this,e=arguments;return new Promise(function(r,a){var o=n.apply(t,e);function i(t){Z(o,r,a,i,s,"next",t)}function s(t){Z(o,r,a,i,s,"throw",t)}i(void 0)})},function(t){return s.apply(this,arguments)})},{key:"destroyMap",value:function(){var t,e;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()}},{key:"setView",value:function(t){var e=t.center,n=t.zoom;this.map.flyTo({center:e||this.getCenter(),zoom:n||this.getZoom(),duration:r})}},{key:"zoomIn",value:function(t){this.map.easeTo({zoom:this.getZoom()+t,duration:r})}},{key:"zoomOut",value:function(t){this.map.easeTo({zoom:this.getZoom()-t,duration:r})}},{key:"panBy",value:function(t){this.map.panBy(t,{duration:r})}},{key:"fitToBounds",value:function(t){this.map.fitBounds(t,{duration:r})}},{key:"setPadding",value:function(t){this.map.setPadding(t)}},{key:"updateHighlightedFeatures",value:function(t,e){return function(t){var e=t.LngLatBounds,n=t.map,r=t.selectedFeatures,a=t.stylesMap;if(!n)return null;var o={},i=[];null==r||r.forEach(function(t){var e=t.featureId,r=t.layerId,a=t.idProperty,i=n.getLayer(r);if(i){var s=i.source;o[s]||(o[s]={ids:new Set,idProperty:a,layerId:r}),o[s].ids.add(e)}});var s=new Set(Object.keys(o));if((n._highlightedSources||new Set).forEach(function(t){if(!s.has(t)){var e="highlight-".concat(t);["".concat(e,"-fill"),"".concat(e,"-line")].forEach(function(t){n.getLayer(t)&&n.setFilter(t,["==","id",""])})}}),n._highlightedSources=s,s.forEach(function(t){var e=o[t],r=e.ids,s=e.idProperty,l=e.layerId,u=n.getLayer(l),c=u.sourceLayer,h=u.type,f="highlight-".concat(t),p=a[l],d=p.stroke,y=p.strokeWidth,g=p.fill,v=["in",["get",s],["literal",D(r)]];"fill"===h&&(n.getLayer("".concat(f,"-fill"))||n.addLayer(R(R({id:"".concat(f,"-fill"),type:"fill",source:t},c&&{"source-layer":c}),{},{paint:{"fill-color":g}})),n.setPaintProperty("".concat(f,"-fill"),"fill-color",g),n.setFilter("".concat(f,"-fill"),v),n.getLayer("".concat(f,"-line"))||n.addLayer(R(R({id:"".concat(f,"-line"),type:"line",source:t},c&&{"source-layer":c}),{},{paint:{"line-color":d,"line-width":y}})),n.setPaintProperty("".concat(f,"-line"),"line-color",d),n.setPaintProperty("".concat(f,"-line"),"line-width",y),n.setFilter("".concat(f,"-line"),v)),"line"===h&&(n.getLayer("".concat(f,"-line"))||n.addLayer(R(R({id:"".concat(f,"-line"),type:"line",source:t},c&&{"source-layer":c}),{},{paint:{"line-color":d,"line-width":y}})),n.setFilter("".concat(f,"-line"),v)),i.push.apply(i,D(n.queryRenderedFeatures({layers:[l]}).filter(function(t){var e;return r.has(null===(e=t.properties)||void 0===e?void 0:e[s])})))}),!i.length)return null;var l=new e;return i.forEach(function(t){var e=function(t){return"number"==typeof t[0]?l.extend(t):t.forEach(e)};e(t.geometry.coordinates)}),[l.getWest(),l.getSouth(),l.getEast(),l.getNorth()]}({LngLatBounds:this.maplibreModule.LngLatBounds,map:this.map,selectedFeatures:t,stylesMap:e})}},{key:"highlightNextLabel",value:function(t){var e;return(null===(e=this.labelNavigator)||void 0===e?void 0:e.highlightNextLabel(t))||null}},{key:"highlightLabelAtCenter",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.highlightLabelAtCenter())||null}},{key:"clearHighlightedLabel",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.clearHighlightedLabel())||null}},{key:"getCenter",value:function(){var t=this.map.getCenter();return[Number(t.lng.toFixed(7)),Number(t.lat.toFixed(7))]}},{key:"getZoom",value:function(){return Number(this.map.getZoom().toFixed(7))}},{key:"getBounds",value:function(){return this.map.getBounds().toArray().flat(1)}},{key:"getFeaturesAtPoint",value:function(t){return this.map.queryRenderedFeatures(t)}},{key:"getAreaDimensions",value:function(){return function(t){var e,n,r,a;if(t&&"function"==typeof t.getWest)e=t.getWest(),n=t.getSouth(),r=t.getEast(),a=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";var o=g(t,2),i=g(o[0],2);e=i[0],n=i[1];var s=g(o[1],2);r=s[0],a=s[1]}var l=m([e,n],[r,n]),u=m([e,n],[e,a]),c=b(l),h=b(u);return"".concat(h," by ").concat(c)}((t=this.maplibreModule.LngLatBounds,e=this.map,n=e.getContainer().getBoundingClientRect(),r=n.width,a=n.height,o=e.getPadding(),i=[o.left,a-o.bottom],s=[r-o.right,o.top],new t(e.unproject(i),e.unproject(s))));var t,e,n,r,a,o,i,s}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var n=g(t,2),r=n[0],a=n[1],o=g(e,2),i=o[0],s=o[1],l=s-a,u=i-r,c=[];if(Math.abs(l)>1e-4){var h=Math.round(m([r,a],[r,s]));c.push("".concat(l>0?"north":"south"," ").concat(b(h)))}if(Math.abs(u)>1e-4){var f=Math.round(m([r,a],[i,a]));c.push("".concat(u>0?"east":"west"," ").concat(b(f)))}return c.join(", ")}(t,e)}},{key:"getResolution",value:function(){return t=this.map.getCenter(),e=this.map.getZoom(),n=t.lat,r=Math.pow(2,e),40075016.686*Math.cos(n*Math.PI/180)/(512*r);var t,e,n,r}},{key:"mapToScreen",value:function(t){return this.map.project(t)}},{key:"screenToMap",value:function(t){var e=this.map.unproject([t.x,t.y]);return[e.lng,e.lat]}}],e&&W(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,s}()}}]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("defra",[],r):"object"==typeof exports?exports.defra=r():(e.defra=e.defra||{},e.defra.maplibreProvider=r())}(this,()=>(()=>{"use strict";var e,r,t,n,o={},i={};function a(e){var r=i[e];if(void 0!==r)return r.exports;var t=i[e]={exports:{}};return o[e].call(t.exports,t,t.exports,a),t.exports}a.m=o,r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var o=Object.create(null);a.r(o);var i={};e=e||[null,r({}),r([]),r(r)];for(var u=2&n&&t;("object"==typeof u||"function"==typeof u)&&!~e.indexOf(u);u=r(u))Object.getOwnPropertyNames(u).forEach(e=>i[e]=()=>t[e]);return i.default=()=>t,a.d(o,i),o},a.d=(e,r)=>{for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((r,t)=>(a.f[t](e,r),r),[])),a.u=e=>({649:"im-maplibre-framework",765:"im-maplibre-legacy-framework",772:"im-maplibre-provider"}[e]+".js"),a.miniCssF=e=>{},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t={},n="defra.maplibreProvider:",a.l=(e,r,o,i)=>{if(t[e])t[e].push(r);else{var u,c;if(void 0!==o)for(var f=document.getElementsByTagName("script"),l=0;l<f.length;l++){var p=f[l];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")==n+o){u=p;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",u.timeout=120,a.nc&&u.setAttribute("nonce",a.nc),u.setAttribute("data-webpack",n+o),u.src=e),t[e]=[r];var s=(r,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=t[e];if(delete t[e],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),r)return r(n)},d=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),c&&document.head.appendChild(u)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var r=a.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={57:0};a.f.j=(r,t)=>{var n=a.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((t,o)=>n=e[r]=[t,o]);t.push(n[2]=o);var i=a.p+a.u(r),u=new Error;a.l(i,t=>{if(a.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;u.message="Loading chunk "+r+" failed.\n("+o+": "+i+")",u.name="ChunkLoadError",u.type=o,u.request=i,n[1](u)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[i,u,c]=t,f=0;if(i.some(r=>0!==e[r])){for(n in u)a.o(u,n)&&(a.m[n]=u[n]);c&&c(a)}for(r&&r(t);f<i.length;f++)o=i[f],a.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var u={};function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}a.d(u,{default:()=>w});var f=function(e){if(!window.WebGLRenderingContext)return{isEnabled:!1,error:"WebGL is not supported"};var r,t=document.createElement("canvas"),n=!1,o=function(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return c(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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,a=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw i}}}}(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;try{if((n=t.getContext(i))&&"function"==typeof n.getParameter)return{isEnabled:!0}}catch(e){}}}catch(e){o.e(e)}finally{o.f()}return{isEnabled:!1,error:"WebGL is supported, but disabled"}};function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function p(){var e,r,t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",o=t.toStringTag||"@@toStringTag";function i(t,n,o,i){var c=n&&n.prototype instanceof u?n:u,f=Object.create(c.prototype);return s(f,"_invoke",function(t,n,o){var i,u,c,f=0,l=o||[],p=!1,s={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(r,t){return i=r,u=0,c=e,s.n=t,a}};function d(t,n){for(u=t,c=n,r=0;!p&&f&&!o&&r<l.length;r++){var o,i=l[r],d=s.p,b=i[2];t>3?(o=b===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=t<2&&d<i[1])?(u=0,s.v=n,s.n=i[1]):d<b&&(o=t<3||i[0]>n||n>b)&&(i[4]=t,i[5]=n,s.n=b,u=0))}if(o||t>1)return a;throw p=!0,n}return function(o,l,b){if(f>1)throw TypeError("Generator is already running");for(p&&1===l&&d(l,b),u=l,c=b;(r=u<2?e:c)||!p;){i||(u?u<3?(u>1&&(s.n=-1),d(u,c)):s.n=c:s.v=c);try{if(f=2,i){if(u||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,u<2&&(u=0)}else 1===u&&(r=i.return)&&r.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((r=(p=s.n<0)?c:t.call(n,s))!==a)break}catch(r){i=e,u=1,c=r}finally{f=1}}return{value:r,done:p}}}(t,o,i),!0),f}var a={};function u(){}function c(){}function f(){}r=Object.getPrototypeOf;var l=[][n]?r(r([][n]())):(s(r={},n,function(){return this}),r),d=f.prototype=u.prototype=Object.create(l);function b(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,s(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=f,s(d,"constructor",f),s(f,"constructor",c),c.displayName="GeneratorFunction",s(f,o,"GeneratorFunction"),s(d),s(d,o,"Generator"),s(d,n,function(){return this}),s(d,"toString",function(){return"[object Generator]"}),(p=function(){return{w:i,m:b}})()}function s(e,r,t,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}s=function(e,r,t,n){if(r)o?o(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t;else{function i(r,t){s(e,r,function(e){return this._invoke(r,t,e)})}i("next",0),i("throw",1),i("return",2)}},s(e,r,t,n)}function d(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function b(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?d(Object(t),!0).forEach(function(r){y(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):d(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function y(e,r,t){return(r=function(e){var r=function(e){if("object"!=l(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var t=r.call(e,"string");if("object"!=l(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==l(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function v(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,u=[],c=!0,f=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;c=!1}else for(;!(c=(n=i.call(t)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(e){f=!0,o=e}finally{try{if(!c&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(f)throw o}}return u}}(e,r)||function(e,r){if(e){if("string"==typeof e)return m(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?m(e,r):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function h(e,r,t,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void t(e)}u.done?r(c):Promise.resolve(c).then(n,o)}var g=!!window.globalThis;function w(){var e,r,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{checkDeviceCapabilities:function(){var e=f(["webgl2","webgl1"]),r=document.documentMode;return{isSupported:e.isEnabled,error:r?"Internet Explorer is not supported":e.error}},load:(e=p().m(function e(){var r,n,o,i,u,c,f,l;return p().w(function(e){for(;;)switch(e.n){case 0:if(!g){e.n=2;break}return e.n=1,a.e(649).then(a.t.bind(a,6443,19));case 1:n=e.v,r=n,e.n=4;break;case 2:return e.n=3,Promise.all([a.e(765).then(a.t.bind(a,6634,19)),a.e(765).then(a.t.bind(a,9130,19)),a.e(765).then(a.t.bind(a,2323,19))]);case 3:o=e.v,i=v(o,2),u=i[0],c=i[1],window.ResizeObserver||c.install(),r=u;case 4:return e.n=5,a.e(772).then(a.bind(a,6102));case 5:return f=e.v.default,l=b(b({},t),{},{crs:"EPSG:4326"}),e.a(2,{MapProvider:f,mapProviderConfig:l,mapFramework:r})}},e)}),r=function(){var r=this,t=arguments;return new Promise(function(n,o){var i=e.apply(r,t);function a(e){h(i,n,o,a,u,"next",e)}function u(e){h(i,n,o,a,u,"throw",e)}a(void 0)})},function(){return r.apply(this,arguments)})}}return u.default})());
|
|
2
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("defra",[],r):"object"==typeof exports?exports.defra=r():(e.defra=e.defra||{},e.defra.maplibreProvider=r())}(this,()=>(()=>{"use strict";var e,r,t,n,o={},i={};function a(e){var r=i[e];if(void 0!==r)return r.exports;var t=i[e]={exports:{}};return o[e].call(t.exports,t,t.exports,a),t.exports}a.m=o,r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var o=Object.create(null);a.r(o);var i={};e=e||[null,r({}),r([]),r(r)];for(var u=2&n&&t;("object"==typeof u||"function"==typeof u)&&!~e.indexOf(u);u=r(u))Object.getOwnPropertyNames(u).forEach(e=>i[e]=()=>t[e]);return i.default=()=>t,a.d(o,i),o},a.d=(e,r)=>{for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((r,t)=>(a.f[t](e,r),r),[])),a.u=e=>({649:"im-maplibre-framework",765:"im-maplibre-legacy-framework",772:"im-maplibre-provider"}[e]+".js"),a.miniCssF=e=>{},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t={},n="defra.maplibreProvider:",a.l=(e,r,o,i)=>{if(t[e])t[e].push(r);else{var u,c;if(void 0!==o)for(var f=document.getElementsByTagName("script"),l=0;l<f.length;l++){var p=f[l];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")==n+o){u=p;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",a.nc&&u.setAttribute("nonce",a.nc),u.setAttribute("data-webpack",n+o),u.src=e),t[e]=[r];var s=(r,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=t[e];if(delete t[e],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),r)return r(n)},d=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),c&&document.head.appendChild(u)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var r=a.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={57:0};a.f.j=(r,t)=>{var n=a.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((t,o)=>n=e[r]=[t,o]);t.push(n[2]=o);var i=a.p+a.u(r),u=new Error;a.l(i,t=>{if(a.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;u.message="Loading chunk "+r+" failed.\n("+o+": "+i+")",u.name="ChunkLoadError",u.type=o,u.request=i,n[1](u)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[i,u,c]=t,f=0;if(i.some(r=>0!==e[r])){for(n in u)a.o(u,n)&&(a.m[n]=u[n]);c&&c(a)}for(r&&r(t);f<i.length;f++)o=i[f],a.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var u={};function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}a.d(u,{default:()=>w});var f=function(e){if(!window.WebGLRenderingContext)return{isEnabled:!1,error:"WebGL is not supported"};var r,t=document.createElement("canvas"),n=!1,o=function(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return c(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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,a=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw i}}}}(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;try{if((n=t.getContext(i))&&"function"==typeof n.getParameter)return{isEnabled:!0}}catch(e){}}}catch(e){o.e(e)}finally{o.f()}return{isEnabled:!1,error:"WebGL is supported, but disabled"}};function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function p(){var e,r,t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",o=t.toStringTag||"@@toStringTag";function i(t,n,o,i){var c=n&&n.prototype instanceof u?n:u,f=Object.create(c.prototype);return s(f,"_invoke",function(t,n,o){var i,u,c,f=0,l=o||[],p=!1,s={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(r,t){return i=r,u=0,c=e,s.n=t,a}};function d(t,n){for(u=t,c=n,r=0;!p&&f&&!o&&r<l.length;r++){var o,i=l[r],d=s.p,b=i[2];t>3?(o=b===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=t<2&&d<i[1])?(u=0,s.v=n,s.n=i[1]):d<b&&(o=t<3||i[0]>n||n>b)&&(i[4]=t,i[5]=n,s.n=b,u=0))}if(o||t>1)return a;throw p=!0,n}return function(o,l,b){if(f>1)throw TypeError("Generator is already running");for(p&&1===l&&d(l,b),u=l,c=b;(r=u<2?e:c)||!p;){i||(u?u<3?(u>1&&(s.n=-1),d(u,c)):s.n=c:s.v=c);try{if(f=2,i){if(u||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,u<2&&(u=0)}else 1===u&&(r=i.return)&&r.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((r=(p=s.n<0)?c:t.call(n,s))!==a)break}catch(r){i=e,u=1,c=r}finally{f=1}}return{value:r,done:p}}}(t,o,i),!0),f}var a={};function u(){}function c(){}function f(){}r=Object.getPrototypeOf;var l=[][n]?r(r([][n]())):(s(r={},n,function(){return this}),r),d=f.prototype=u.prototype=Object.create(l);function b(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,s(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=f,s(d,"constructor",f),s(f,"constructor",c),c.displayName="GeneratorFunction",s(f,o,"GeneratorFunction"),s(d),s(d,o,"Generator"),s(d,n,function(){return this}),s(d,"toString",function(){return"[object Generator]"}),(p=function(){return{w:i,m:b}})()}function s(e,r,t,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}s=function(e,r,t,n){function i(r,t){s(e,r,function(e){return this._invoke(r,t,e)})}r?o?o(e,r,{value:t,enumerable:!n,configurable:!n,writable:!n}):e[r]=t:(i("next",0),i("throw",1),i("return",2))},s(e,r,t,n)}function d(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function b(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?d(Object(t),!0).forEach(function(r){y(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):d(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function y(e,r,t){return(r=function(e){var r=function(e){if("object"!=l(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var t=r.call(e,"string");if("object"!=l(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==l(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function v(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,u=[],c=!0,f=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;c=!1}else for(;!(c=(n=i.call(t)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(e){f=!0,o=e}finally{try{if(!c&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(f)throw o}}return u}}(e,r)||function(e,r){if(e){if("string"==typeof e)return m(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?m(e,r):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function h(e,r,t,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void t(e)}u.done?r(c):Promise.resolve(c).then(n,o)}var g=!!window.globalThis;function w(){var e,r,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{checkDeviceCapabilities:function(){var e=f(["webgl2","webgl1"]),r=document.documentMode;return{isSupported:e.isEnabled,error:r?"Internet Explorer is not supported":e.error}},load:(e=p().m(function e(){var r,n,o,i,u,c,f,l;return p().w(function(e){for(;;)switch(e.n){case 0:if(!g){e.n=2;break}return e.n=1,a.e(649).then(a.t.bind(a,6443,19));case 1:n=e.v,r=n,e.n=4;break;case 2:return e.n=3,Promise.all([a.e(765).then(a.t.bind(a,6634,19)),a.e(765).then(a.t.bind(a,9130,19)),a.e(765).then(a.t.bind(a,2323,19))]);case 3:o=e.v,i=v(o,2),u=i[0],c=i[1],window.ResizeObserver||c.install(),r=u;case 4:return e.n=5,a.e(772).then(a.bind(a,6102));case 5:return f=e.v.default,l=b(b({},t),{},{crs:"EPSG:4326"}),e.a(2,{MapProvider:f,mapProviderConfig:l,mapFramework:r})}},e)}),r=function(){var r=this,t=arguments;return new Promise(function(n,o){var i=e.apply(r,t);function a(e){h(i,n,o,a,u,"next",e)}function u(e){h(i,n,o,a,u,"throw",e)}a(void 0)})},function(){return r.apply(this,arguments)})}}return u.default})());
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../../../src/types.js').MapProviderDescriptor} MapProviderDescriptor
|
|
3
|
+
* @typedef {import('../../../src/types.js').MapProviderLoadResult} MapProviderLoadResult
|
|
4
|
+
* @typedef {import('../../../src/types.js').MapProviderConfig} MapProviderConfig
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
import { getWebGL } from './utils/detectWebgl.js'
|
|
2
8
|
|
|
3
9
|
const isLatest = !!window.globalThis
|
|
4
10
|
|
|
5
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Creates a MapLibre provider descriptor for lazy-loading the map provider.
|
|
13
|
+
*
|
|
14
|
+
* @param {Partial<MapProviderConfig>} [config={}] - Optional provider configuration overrides.
|
|
15
|
+
* @returns {MapProviderDescriptor} The map provider descriptor.
|
|
16
|
+
*/
|
|
6
17
|
export default function (config = {}) {
|
|
7
18
|
return {
|
|
8
19
|
checkDeviceCapabilities: () => {
|
|
@@ -13,6 +24,7 @@ export default function (config = {}) {
|
|
|
13
24
|
error: (isIE && 'Internet Explorer is not supported') || webGL.error
|
|
14
25
|
}
|
|
15
26
|
},
|
|
27
|
+
/** @returns {Promise<MapProviderLoadResult>} */
|
|
16
28
|
load: async () => {
|
|
17
29
|
let mapFramework
|
|
18
30
|
if (isLatest) {
|
|
@@ -32,6 +44,7 @@ export default function (config = {}) {
|
|
|
32
44
|
|
|
33
45
|
const MapProvider = (await import(/* webpackChunkName: "im-maplibre-provider" */ './maplibreProvider.js')).default
|
|
34
46
|
|
|
47
|
+
/** @type {MapProviderConfig} */
|
|
35
48
|
const mapProviderConfig = {
|
|
36
49
|
...config,
|
|
37
50
|
crs: 'EPSG:4326'
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../../../src/types.js').MapProvider} MapProvider
|
|
3
|
+
* @typedef {import('../../../src/types.js').MapProviderConfig} MapProviderConfig
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
import { defaults, supportedShortcuts } from './defaults.js'
|
|
2
7
|
import { cleanCanvas, applyPreventDefaultFix } from './utils/maplibreFixes.js'
|
|
3
8
|
import { attachMapEvents } from './mapEvents.js'
|
|
@@ -6,7 +11,19 @@ import { getAreaDimensions, getCardinalMove, getResolution, getPaddedBounds } fr
|
|
|
6
11
|
import { createMapLabelNavigator } from './utils/labels.js'
|
|
7
12
|
import { updateHighlightedFeatures } from './utils/highlightFeatures.js'
|
|
8
13
|
|
|
14
|
+
/**
|
|
15
|
+
* MapLibre GL JS implementation of the MapProvider interface.
|
|
16
|
+
*
|
|
17
|
+
* @implements {MapProvider}
|
|
18
|
+
*/
|
|
9
19
|
export default class MapLibreProvider {
|
|
20
|
+
/**
|
|
21
|
+
* @param {Object} options - Constructor options.
|
|
22
|
+
* @param {any} options.mapFramework - The MapLibre GL JS module.
|
|
23
|
+
* @param {MapProviderConfig} [options.mapProviderConfig={}] - Provider configuration.
|
|
24
|
+
* @param {Object} options.events - Event name constants.
|
|
25
|
+
* @param {Object} options.eventBus - Event emitter for publishing map events.
|
|
26
|
+
*/
|
|
10
27
|
constructor ({ mapFramework, mapProviderConfig = {}, events, eventBus }) {
|
|
11
28
|
this.maplibreModule = mapFramework
|
|
12
29
|
this.events = events
|
|
@@ -19,6 +36,12 @@ export default class MapLibreProvider {
|
|
|
19
36
|
Object.assign(this, mapProviderConfig)
|
|
20
37
|
}
|
|
21
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Initialize the map.
|
|
41
|
+
*
|
|
42
|
+
* @param {Object} config - Map initialization configuration.
|
|
43
|
+
* @returns {Promise<void>}
|
|
44
|
+
*/
|
|
22
45
|
async initMap (config) {
|
|
23
46
|
const { container, padding, mapStyle, center, zoom, bounds, pixelRatio, ...initConfig } = config
|
|
24
47
|
const { Map: MaplibreMap } = this.maplibreModule
|
|
@@ -80,6 +103,7 @@ export default class MapLibreProvider {
|
|
|
80
103
|
this.eventBus.emit(events.MAP_READY, { map })
|
|
81
104
|
}
|
|
82
105
|
|
|
106
|
+
/** Destroy the map and clean up resources. */
|
|
83
107
|
destroyMap () {
|
|
84
108
|
this.mapEvents?.remove()
|
|
85
109
|
this.appEvents?.remove()
|
|
@@ -94,6 +118,13 @@ export default class MapLibreProvider {
|
|
|
94
118
|
// Side-effects
|
|
95
119
|
// ==========================
|
|
96
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Set map view with optional center and zoom.
|
|
123
|
+
*
|
|
124
|
+
* @param {Object} options - View options.
|
|
125
|
+
* @param {[number, number]} [options.center] - Center coordinates [lng, lat].
|
|
126
|
+
* @param {number} [options.zoom] - Zoom level.
|
|
127
|
+
*/
|
|
97
128
|
setView ({ center, zoom }) {
|
|
98
129
|
this.map.flyTo({
|
|
99
130
|
center: center || this.getCenter(),
|
|
@@ -102,6 +133,11 @@ export default class MapLibreProvider {
|
|
|
102
133
|
})
|
|
103
134
|
}
|
|
104
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Zoom in by delta.
|
|
138
|
+
*
|
|
139
|
+
* @param {number} zoomDelta - Amount to zoom in.
|
|
140
|
+
*/
|
|
105
141
|
zoomIn (zoomDelta) {
|
|
106
142
|
this.map.easeTo({
|
|
107
143
|
zoom: this.getZoom() + zoomDelta,
|
|
@@ -109,6 +145,11 @@ export default class MapLibreProvider {
|
|
|
109
145
|
})
|
|
110
146
|
}
|
|
111
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Zoom out by delta.
|
|
150
|
+
*
|
|
151
|
+
* @param {number} zoomDelta - Amount to zoom out.
|
|
152
|
+
*/
|
|
112
153
|
zoomOut (zoomDelta) {
|
|
113
154
|
this.map.easeTo({
|
|
114
155
|
zoom: this.getZoom() - zoomDelta,
|
|
@@ -116,14 +157,29 @@ export default class MapLibreProvider {
|
|
|
116
157
|
})
|
|
117
158
|
}
|
|
118
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Pan map by pixel offset [x, y]. Positive x pans right, positive y pans down.
|
|
162
|
+
*
|
|
163
|
+
* @param {[number, number]} offset - Pixel offset [x, y].
|
|
164
|
+
*/
|
|
119
165
|
panBy (offset) {
|
|
120
166
|
this.map.panBy(offset, { duration: defaults.animationDuration })
|
|
121
167
|
}
|
|
122
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Fit map view to the specified bounds [west, south, east, north].
|
|
171
|
+
*
|
|
172
|
+
* @param {[number, number, number, number]} bounds - Bounds as [west, south, east, north].
|
|
173
|
+
*/
|
|
123
174
|
fitToBounds (bounds) {
|
|
124
175
|
this.map.fitBounds(bounds, { duration: defaults.animationDuration })
|
|
125
176
|
}
|
|
126
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Set map padding as pixel insets from the top, bottom, left and right edges of the map.
|
|
180
|
+
*
|
|
181
|
+
* @param {{ top?: number, bottom?: number, left?: number, right?: number }} padding - Padding in pixels.
|
|
182
|
+
*/
|
|
127
183
|
setPadding (padding) {
|
|
128
184
|
this.map.setPadding(padding)
|
|
129
185
|
}
|
|
@@ -132,6 +188,13 @@ export default class MapLibreProvider {
|
|
|
132
188
|
// Feature highlighting
|
|
133
189
|
// ==========================
|
|
134
190
|
|
|
191
|
+
/**
|
|
192
|
+
* @experimental Update highlighted features on the map.
|
|
193
|
+
*
|
|
194
|
+
* @param {any[]} selectedFeatures - Features to highlight.
|
|
195
|
+
* @param {any} stylesMap - Style configuration for highlighting.
|
|
196
|
+
* @returns {any}
|
|
197
|
+
*/
|
|
135
198
|
updateHighlightedFeatures (selectedFeatures, stylesMap) {
|
|
136
199
|
const { LngLatBounds } = this.maplibreModule
|
|
137
200
|
return updateHighlightedFeatures({ LngLatBounds, map: this.map, selectedFeatures, stylesMap })
|
|
@@ -141,14 +204,28 @@ export default class MapLibreProvider {
|
|
|
141
204
|
// Map label (keyboard-friendly)
|
|
142
205
|
// ==========================
|
|
143
206
|
|
|
207
|
+
/**
|
|
208
|
+
* @experimental Highlight the next label in the specified direction for keyboard navigation.
|
|
209
|
+
*
|
|
210
|
+
* @param {string} direction - Direction to navigate (e.g., 'up', 'down', 'left', 'right').
|
|
211
|
+
* @returns {any}
|
|
212
|
+
*/
|
|
144
213
|
highlightNextLabel (direction) {
|
|
145
214
|
return this.labelNavigator?.highlightNextLabel(direction) || null
|
|
146
215
|
}
|
|
147
216
|
|
|
217
|
+
/**
|
|
218
|
+
* @experimental Highlight the label nearest to the map center.
|
|
219
|
+
*
|
|
220
|
+
* @returns {any}
|
|
221
|
+
*/
|
|
148
222
|
highlightLabelAtCenter () {
|
|
149
223
|
return this.labelNavigator?.highlightLabelAtCenter() || null
|
|
150
224
|
}
|
|
151
225
|
|
|
226
|
+
/**
|
|
227
|
+
* @experimental Clear any highlighted label.
|
|
228
|
+
*/
|
|
152
229
|
clearHighlightedLabel () {
|
|
153
230
|
return this.labelNavigator?.clearHighlightedLabel() || null
|
|
154
231
|
}
|
|
@@ -157,19 +234,40 @@ export default class MapLibreProvider {
|
|
|
157
234
|
// Read-only getters
|
|
158
235
|
// ==========================
|
|
159
236
|
|
|
237
|
+
/**
|
|
238
|
+
* Get current center coordinates [lng, lat].
|
|
239
|
+
*
|
|
240
|
+
* @returns {[number, number]}
|
|
241
|
+
*/
|
|
160
242
|
getCenter () {
|
|
161
243
|
const coord = this.map.getCenter()
|
|
162
244
|
return [Number(coord.lng.toFixed(7)), Number(coord.lat.toFixed(7))]
|
|
163
245
|
}
|
|
164
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Get current zoom level.
|
|
249
|
+
*
|
|
250
|
+
* @returns {number}
|
|
251
|
+
*/
|
|
165
252
|
getZoom () {
|
|
166
253
|
return Number(this.map.getZoom().toFixed(7))
|
|
167
254
|
}
|
|
168
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Get current bounds as [west, south, east, north].
|
|
258
|
+
*
|
|
259
|
+
* @returns {[number, number, number, number]}
|
|
260
|
+
*/
|
|
169
261
|
getBounds () {
|
|
170
262
|
return this.map.getBounds().toArray().flat(1)
|
|
171
263
|
}
|
|
172
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Query rendered features at a screen pixel position (x from left edge, y from top edge of viewport).
|
|
267
|
+
*
|
|
268
|
+
* @param {{ x: number, y: number }} point - Screen pixel position.
|
|
269
|
+
* @returns {any[]}
|
|
270
|
+
*/
|
|
173
271
|
getFeaturesAtPoint (point) {
|
|
174
272
|
return this.map.queryRenderedFeatures(point)
|
|
175
273
|
}
|
|
@@ -178,23 +276,52 @@ export default class MapLibreProvider {
|
|
|
178
276
|
// Spatial helpers
|
|
179
277
|
// ==========================
|
|
180
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Get the dimensions of the visible map area as a formatted string (e.g., '400m by 750m').
|
|
281
|
+
*
|
|
282
|
+
* @returns {string}
|
|
283
|
+
*/
|
|
181
284
|
getAreaDimensions () {
|
|
182
285
|
const { LngLatBounds } = this.maplibreModule
|
|
183
286
|
return getAreaDimensions(getPaddedBounds(LngLatBounds, this.map)) // Use padded bounds
|
|
184
287
|
}
|
|
185
288
|
|
|
289
|
+
/**
|
|
290
|
+
* Get cardinal direction and distance between two coordinates [lng, lat]. Returns a formatted string (e.g., 'north 400m' or 'south 400m, west 750m').
|
|
291
|
+
*
|
|
292
|
+
* @param {[number, number]} from - Start coordinates [lng, lat].
|
|
293
|
+
* @param {[number, number]} to - End coordinates [lng, lat].
|
|
294
|
+
* @returns {string}
|
|
295
|
+
*/
|
|
186
296
|
getCardinalMove (from, to) {
|
|
187
297
|
return getCardinalMove(from, to)
|
|
188
298
|
}
|
|
189
299
|
|
|
300
|
+
/**
|
|
301
|
+
* Get map resolution in meters per pixel.
|
|
302
|
+
*
|
|
303
|
+
* @returns {number}
|
|
304
|
+
*/
|
|
190
305
|
getResolution () {
|
|
191
306
|
return getResolution(this.map.getCenter(), this.map.getZoom())
|
|
192
307
|
}
|
|
193
308
|
|
|
309
|
+
/**
|
|
310
|
+
* Convert map coordinates [lng, lat] to screen pixel position (x from left edge, y from top edge of viewport).
|
|
311
|
+
*
|
|
312
|
+
* @param {[number, number]} coords - Map coordinates [lng, lat].
|
|
313
|
+
* @returns {{ x: number, y: number }} Screen pixel position.
|
|
314
|
+
*/
|
|
194
315
|
mapToScreen (coords) {
|
|
195
316
|
return this.map.project(coords)
|
|
196
317
|
}
|
|
197
318
|
|
|
319
|
+
/**
|
|
320
|
+
* Convert screen pixel position (x from left edge, y from top edge of viewport) to map coordinates [lng, lat].
|
|
321
|
+
*
|
|
322
|
+
* @param {{ x: number, y: number }} point - Screen pixel position.
|
|
323
|
+
* @returns {[number, number]} Map coordinates [lng, lat].
|
|
324
|
+
*/
|
|
198
325
|
screenToMap (point) {
|
|
199
326
|
const { lng, lat } = this.map.unproject([point.x, point.y])
|
|
200
327
|
return [lng, lat]
|
package/sonar-project.properties
CHANGED
|
@@ -11,7 +11,7 @@ sonar.javascript.lcov.reportPaths=coverage/lcov.info
|
|
|
11
11
|
sonar.sourceEncoding=UTF-8
|
|
12
12
|
|
|
13
13
|
sonar.sources=src,plugins,providers
|
|
14
|
-
sonar.exclusions=**/*.test.*,**/__mocks__/**,**/__stubs__/**,**/dist/**,**/node_modules/**
|
|
14
|
+
sonar.exclusions=**/*.test.*,**/__mocks__/**,**/__stubs__/**,**/dist/**,**/node_modules/**,plugins/beta/**,providers/beta/**
|
|
15
15
|
sonar.tests=src,plugins,providers
|
|
16
16
|
sonar.test.inclusions=**/*.test.*,**/__mocks__/**,**/__stubs__/**
|
|
17
17
|
sonar.cpd.exclusions=**/*.test.*,**/__mocks__/**,**/__stubs__/**
|
|
@@ -5,7 +5,7 @@ import { useApp } from '../store/appContext.js'
|
|
|
5
5
|
import { useService } from '../store/serviceContext.js'
|
|
6
6
|
|
|
7
7
|
export const useInterfaceAPI = () => {
|
|
8
|
-
const { dispatch } = useApp()
|
|
8
|
+
const { dispatch, hiddenButtons, pressedButtons, disabledButtons } = useApp()
|
|
9
9
|
const { eventBus } = useService()
|
|
10
10
|
|
|
11
11
|
useEffect(() => {
|
|
@@ -13,6 +13,28 @@ export const useInterfaceAPI = () => {
|
|
|
13
13
|
dispatch({ type: 'ADD_BUTTON', payload: { id, config } })
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
const handleToggleButtonState = ({ id, prop, value }) => {
|
|
17
|
+
switch (prop) {
|
|
18
|
+
case 'hidden': {
|
|
19
|
+
const isHidden = typeof value === 'boolean' ? value : !hiddenButtons.has(id)
|
|
20
|
+
dispatch({ type: 'TOGGLE_BUTTON_HIDDEN', payload: { id, isHidden } })
|
|
21
|
+
break
|
|
22
|
+
}
|
|
23
|
+
case 'pressed': {
|
|
24
|
+
const isPressed = typeof value === 'boolean' ? value : !pressedButtons.has(id)
|
|
25
|
+
dispatch({ type: 'TOGGLE_BUTTON_PRESSED', payload: { id, isPressed } })
|
|
26
|
+
break
|
|
27
|
+
}
|
|
28
|
+
case 'disabled': {
|
|
29
|
+
const isDisabled = typeof value === 'boolean' ? value : !disabledButtons.has(id)
|
|
30
|
+
dispatch({ type: 'TOGGLE_BUTTON_DISABLED', payload: { id, isDisabled } })
|
|
31
|
+
break
|
|
32
|
+
}
|
|
33
|
+
default:
|
|
34
|
+
break
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
16
38
|
const handleAddPanel = ({ id, config }) => {
|
|
17
39
|
dispatch({ type: 'ADD_PANEL', payload: { id, config } })
|
|
18
40
|
}
|
|
@@ -34,6 +56,7 @@ export const useInterfaceAPI = () => {
|
|
|
34
56
|
}
|
|
35
57
|
|
|
36
58
|
eventBus.on(events.APP_ADD_BUTTON, handleAddButton)
|
|
59
|
+
eventBus.on(events.APP_TOGGLE_BUTTON_STATE, handleToggleButtonState)
|
|
37
60
|
eventBus.on(events.APP_ADD_PANEL, handleAddPanel)
|
|
38
61
|
eventBus.on(events.APP_REMOVE_PANEL, handleRemovePanel)
|
|
39
62
|
eventBus.on(events.APP_SHOW_PANEL, handleShowPanel)
|
|
@@ -73,7 +73,7 @@ function renderButton ({ btn, appState, appConfig, evaluateProp, groupStart, gro
|
|
|
73
73
|
showLabel={bpConfig.showLabel}
|
|
74
74
|
isDisabled={appState.disabledButtons.has(buttonId)}
|
|
75
75
|
isHidden={appState.hiddenButtons.has(buttonId)}
|
|
76
|
-
isPressed={config.pressedWhen ? appState.pressedButtons.has(buttonId) : undefined}
|
|
76
|
+
isPressed={(config.isPressed !== undefined || config.pressedWhen) ? appState.pressedButtons.has(buttonId) : undefined}
|
|
77
77
|
isOpen={isOpen}
|
|
78
78
|
onClick={handleClick}
|
|
79
79
|
panelId={config.panelId}
|
|
@@ -212,6 +212,24 @@ const addButton = (state, payload) => {
|
|
|
212
212
|
const { id, config } = payload
|
|
213
213
|
const newButtonConfig = addButtonFn(state.buttonConfig, id, config)
|
|
214
214
|
|
|
215
|
+
// Set hidden state
|
|
216
|
+
const hiddenButtons = new Set(state.hiddenButtons)
|
|
217
|
+
if (config.isHidden) {
|
|
218
|
+
hiddenButtons.add(id)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Set disabled state
|
|
222
|
+
const disabledButtons = new Set(state.disabledButtons)
|
|
223
|
+
if (config.isDisabled) {
|
|
224
|
+
disabledButtons.add(id)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Set pressed state
|
|
228
|
+
const pressedButtons = new Set(state.pressedButtons)
|
|
229
|
+
if (config.isPressed) {
|
|
230
|
+
pressedButtons.add(id)
|
|
231
|
+
}
|
|
232
|
+
|
|
215
233
|
// Also update the registry instance for persistence across app lifecycle
|
|
216
234
|
if (state.buttonRegistry?.addButton) {
|
|
217
235
|
state.buttonRegistry.addButton(id, config)
|
|
@@ -219,7 +237,10 @@ const addButton = (state, payload) => {
|
|
|
219
237
|
|
|
220
238
|
return {
|
|
221
239
|
...state,
|
|
222
|
-
buttonConfig: newButtonConfig
|
|
240
|
+
buttonConfig: newButtonConfig,
|
|
241
|
+
hiddenButtons,
|
|
242
|
+
disabledButtons,
|
|
243
|
+
pressedButtons
|
|
223
244
|
}
|
|
224
245
|
}
|
|
225
246
|
|