@defra/interactive-map 0.0.15-alpha → 0.0.17-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.
Files changed (263) hide show
  1. package/assets/css/docusaurus.css +104 -0
  2. package/assets/images/favicon.svg +1 -0
  3. package/assets/images/hero.png +0 -0
  4. package/assets/images/slot-map.svg +264 -0
  5. package/dist/css/index.css +1 -1
  6. package/dist/esm/im-core.js +1 -1
  7. package/dist/esm/im-shell.js +1 -1
  8. package/dist/umd/im-core.js +1 -1
  9. package/dist/umd/index.js +1 -1
  10. package/docs/api/slots.md +90 -6
  11. package/docs/api.md +4 -4
  12. package/docs/architecture.md +3 -1
  13. package/docs/{demo.mdx → examples.mdx} +1 -1
  14. package/docs/getting-started.md +5 -4
  15. package/docs/index.mdx +42 -0
  16. package/docs/plugins/datasets.md +561 -0
  17. package/docs/plugins/interact.md +176 -55
  18. package/docs/plugins/map-styles.md +64 -7
  19. package/docs/plugins/search.md +207 -63
  20. package/docs/plugins.md +8 -16
  21. package/docusaurus.config.cjs +34 -34
  22. package/jest.setup.js +1 -1
  23. package/package.json +6 -5
  24. package/plugins/beta/datasets/dist/css/index.css +85 -15
  25. package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -1
  26. package/plugins/beta/datasets/dist/umd/im-datasets-plugin.js +1 -1
  27. package/plugins/beta/datasets/dist/umd/index.js +1 -1
  28. package/plugins/beta/datasets/src/DatasetsInit.jsx +24 -9
  29. package/plugins/beta/datasets/src/adapters/maplibre/index.js +18 -0
  30. package/plugins/beta/datasets/src/adapters/maplibre/layerBuilders.js +113 -0
  31. package/plugins/beta/datasets/src/adapters/maplibre/layerIds.js +69 -0
  32. package/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +338 -0
  33. package/plugins/beta/datasets/src/adapters/maplibre/patternRegistry.js +48 -0
  34. package/plugins/beta/datasets/src/api/addDataset.js +3 -9
  35. package/plugins/beta/datasets/src/api/getOpacity.js +17 -0
  36. package/plugins/beta/datasets/src/api/getStyle.js +13 -0
  37. package/plugins/beta/datasets/src/api/removeDataset.js +3 -45
  38. package/plugins/beta/datasets/src/api/setData.js +8 -0
  39. package/plugins/beta/datasets/src/api/setDatasetVisibility.js +37 -0
  40. package/plugins/beta/datasets/src/api/setFeatureVisibility.js +22 -0
  41. package/plugins/beta/datasets/src/api/setOpacity.js +29 -0
  42. package/plugins/beta/datasets/src/api/setStyle.js +22 -0
  43. package/plugins/beta/datasets/src/datasets.js +33 -59
  44. package/plugins/beta/datasets/src/defaults.js +43 -9
  45. package/plugins/beta/datasets/src/fetch/createDynamicSource.js +39 -30
  46. package/plugins/beta/datasets/src/fetch/fetchGeoJSON.js +2 -2
  47. package/plugins/beta/datasets/src/manifest.js +27 -19
  48. package/plugins/beta/datasets/src/panels/Key.jsx +129 -49
  49. package/plugins/beta/datasets/src/panels/Key.module.scss +48 -9
  50. package/plugins/beta/datasets/src/panels/Layers.jsx +131 -29
  51. package/plugins/beta/datasets/src/panels/Layers.module.scss +50 -8
  52. package/plugins/beta/datasets/src/reducer.js +128 -9
  53. package/plugins/beta/datasets/src/styles/patterns.js +157 -0
  54. package/plugins/beta/datasets/src/utils/bbox.js +8 -6
  55. package/plugins/beta/datasets/src/utils/filters.js +5 -2
  56. package/plugins/beta/datasets/src/utils/mergeSublayer.js +78 -0
  57. package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -1
  58. package/plugins/beta/draw-es/src/DrawInit.jsx +16 -16
  59. package/plugins/beta/draw-es/src/api/addFeature.js +3 -3
  60. package/plugins/beta/draw-es/src/api/deleteFeature.js +3 -3
  61. package/plugins/beta/draw-es/src/api/editFeature.js +3 -3
  62. package/plugins/beta/draw-es/src/api/newPolygon.js +3 -3
  63. package/plugins/beta/draw-es/src/events.js +52 -20
  64. package/plugins/beta/draw-es/src/events.test.js +301 -0
  65. package/plugins/beta/draw-es/src/graphic.js +1 -1
  66. package/plugins/beta/draw-es/src/manifest.js +4 -4
  67. package/plugins/beta/draw-es/src/reducer.js +1 -1
  68. package/plugins/beta/draw-es/src/sketchViewModel.js +1 -1
  69. package/plugins/beta/draw-ml/dist/css/index.css +1 -1
  70. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
  71. package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -1
  72. package/plugins/beta/draw-ml/src/DrawInit.jsx +49 -52
  73. package/plugins/beta/draw-ml/src/api/deleteFeature.js +1 -1
  74. package/plugins/beta/draw-ml/src/api/editFeature.js +8 -5
  75. package/plugins/beta/draw-ml/src/api/newLine.js +0 -1
  76. package/plugins/beta/draw-ml/src/api/newPolygon.js +0 -1
  77. package/plugins/beta/draw-ml/src/api/split.js +4 -4
  78. package/plugins/beta/draw-ml/src/defaults.js +1 -1
  79. package/plugins/beta/draw-ml/src/draw.scss +0 -7
  80. package/plugins/beta/draw-ml/src/events.js +8 -6
  81. package/plugins/beta/draw-ml/src/manifest.js +29 -29
  82. package/plugins/beta/draw-ml/src/mapboxDraw.js +1 -1
  83. package/plugins/beta/draw-ml/src/mapboxSnap.js +17 -18
  84. package/plugins/beta/draw-ml/src/modes/createDrawMode.js +31 -31
  85. package/plugins/beta/draw-ml/src/modes/disabledMode.js +1 -1
  86. package/plugins/beta/draw-ml/src/modes/editVertex/touchHandlers.js +11 -11
  87. package/plugins/beta/draw-ml/src/modes/editVertex/undoHandlers.js +7 -7
  88. package/plugins/beta/draw-ml/src/modes/editVertex/vertexOperations.js +8 -8
  89. package/plugins/beta/draw-ml/src/modes/editVertex/vertexQueries.js +7 -7
  90. package/plugins/beta/draw-ml/src/modes/editVertexMode.js +32 -24
  91. package/plugins/beta/draw-ml/src/reducer.js +1 -1
  92. package/plugins/beta/draw-ml/src/undoStack.js +4 -4
  93. package/plugins/beta/draw-ml/src/utils/snapHelpers.js +12 -12
  94. package/plugins/beta/draw-ml/src/utils/spatial.js +11 -11
  95. package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -1
  96. package/plugins/beta/frame/dist/umd/im-frame-plugin.js +1 -1
  97. package/plugins/beta/frame/src/Frame.jsx +9 -9
  98. package/plugins/beta/frame/src/FrameInit.jsx +4 -4
  99. package/plugins/beta/frame/src/api/addFrame.js +1 -1
  100. package/plugins/beta/frame/src/api/editFeature.js +1 -1
  101. package/plugins/beta/frame/src/config.js +1 -1
  102. package/plugins/beta/frame/src/manifest.js +3 -3
  103. package/plugins/beta/frame/src/reducer.js +1 -1
  104. package/plugins/beta/frame/src/utils.js +1 -1
  105. package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -1
  106. package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -1
  107. package/plugins/beta/map-styles/src/MapStyles.jsx +18 -18
  108. package/plugins/beta/map-styles/src/manifest.js +1 -1
  109. package/plugins/beta/scale-bar/dist/css/index.css +1 -1
  110. package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -1
  111. package/plugins/beta/scale-bar/dist/umd/im-scale-bar-plugin.js +1 -1
  112. package/plugins/beta/scale-bar/src/ScaleBar.jsx +5 -5
  113. package/plugins/beta/scale-bar/src/index.test.js +3 -3
  114. package/plugins/beta/scale-bar/src/manifest.js +3 -3
  115. package/plugins/beta/scale-bar/src/scaleBar.scss +2 -1
  116. package/plugins/beta/use-location/src/UseLocation.jsx +1 -1
  117. package/plugins/beta/use-location/src/defaults.js +1 -1
  118. package/plugins/beta/use-location/src/events.js +3 -3
  119. package/plugins/interact/dist/css/index.css +1 -1
  120. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  121. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  122. package/plugins/interact/src/InteractInit.jsx +1 -2
  123. package/plugins/interact/src/api/enable.js +8 -5
  124. package/plugins/interact/src/api/enable.test.js +2 -2
  125. package/plugins/interact/src/api/selectFeature.js +4 -4
  126. package/plugins/interact/src/api/unselectFeature.js +5 -5
  127. package/plugins/interact/src/defaults.js +0 -1
  128. package/plugins/interact/src/events.test.js +15 -15
  129. package/plugins/interact/src/hooks/useHighlightSync.js +1 -1
  130. package/plugins/interact/src/hooks/useInteractionHandlers.js +2 -2
  131. package/plugins/interact/src/hooks/useInteractionHandlers.test.js +5 -5
  132. package/plugins/interact/src/interact.scss +0 -7
  133. package/plugins/interact/src/manifest.js +15 -19
  134. package/plugins/interact/src/manifest.test.js +6 -5
  135. package/plugins/interact/src/reducer.js +3 -3
  136. package/plugins/interact/src/reducer.test.js +0 -1
  137. package/plugins/interact/src/utils/spatial.js +10 -10
  138. package/plugins/interact/src/utils/spatial.test.js +14 -14
  139. package/plugins/search/dist/css/index.css +1 -1
  140. package/plugins/search/dist/esm/im-search-plugin.js +1 -1
  141. package/plugins/search/dist/esm/index.js +1 -1
  142. package/plugins/search/dist/umd/im-search-plugin.js +1 -1
  143. package/plugins/search/dist/umd/index.js +1 -1
  144. package/plugins/search/src/Search.jsx +7 -6
  145. package/plugins/search/src/Search.test.jsx +23 -23
  146. package/plugins/search/src/components/CloseButton/CloseButton.jsx +15 -15
  147. package/plugins/search/src/components/CloseButton/CloseButton.test.jsx +2 -2
  148. package/plugins/search/src/components/Form/Form.jsx +14 -14
  149. package/plugins/search/src/components/Form/Form.module.scss +2 -1
  150. package/plugins/search/src/components/Form/Form.test.jsx +11 -11
  151. package/plugins/search/src/components/OpenButton/OpenButton.jsx +16 -15
  152. package/plugins/search/src/components/OpenButton/OpenButton.test.jsx +6 -2
  153. package/plugins/search/src/components/SubmitButton/SubmitButton.jsx +15 -15
  154. package/plugins/search/src/components/Suggestions/Suggestions.jsx +6 -6
  155. package/plugins/search/src/components/Suggestions/Suggestions.test.jsx +4 -4
  156. package/plugins/search/src/datasets.js +12 -13
  157. package/plugins/search/src/datasets.test.js +1 -1
  158. package/plugins/search/src/defaults.js +1 -1
  159. package/plugins/search/src/events/fetchSuggestions.js +3 -3
  160. package/plugins/search/src/events/fetchSuggestions.test.js +1 -1
  161. package/plugins/search/src/events/formHandlers.js +3 -3
  162. package/plugins/search/src/events/formHandlers.test.js +1 -1
  163. package/plugins/search/src/events/index.js +2 -2
  164. package/plugins/search/src/events/index.test.js +2 -2
  165. package/plugins/search/src/events/inputHandlers.js +4 -4
  166. package/plugins/search/src/events/inputHandlers.test.js +1 -1
  167. package/plugins/search/src/events/suggestionHandlers.js +2 -2
  168. package/plugins/search/src/events/suggestionHandlers.test.js +1 -1
  169. package/plugins/search/src/index.js +2 -1
  170. package/plugins/search/src/index.test.js +3 -3
  171. package/plugins/search/src/manifest.js +6 -4
  172. package/plugins/search/src/reducer.js +1 -2
  173. package/plugins/search/src/reducer.test.js +2 -2
  174. package/plugins/search/src/search.scss +10 -3
  175. package/plugins/search/src/utils/parseOsNamesResults.js +1 -2
  176. package/plugins/search/src/utils/parseOsNamesResults.test.js +2 -2
  177. package/plugins/search/src/utils/updateMap.js +1 -1
  178. package/plugins/search/src/utils/updateMap.test.js +5 -5
  179. package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
  180. package/providers/beta/esri/src/esriProvider.js +5 -5
  181. package/providers/beta/esri/src/utils/coords.js +1 -1
  182. package/providers/beta/esri/src/utils/esriFixes.js +1 -1
  183. package/providers/beta/esri/src/utils/query.js +4 -4
  184. package/providers/beta/esri/src/utils/spatial.js +1 -2
  185. package/providers/beta/esri/src/utils/spatial.test.js +4 -1
  186. package/providers/beta/open-names/src/utils/mapToLocationModel.test.js +1 -1
  187. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  188. package/providers/maplibre/dist/umd/im-maplibre-framework.js +1 -1
  189. package/providers/maplibre/dist/umd/im-maplibre-framework.js.LICENSE.txt +1 -1
  190. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  191. package/providers/maplibre/src/appEvents.test.js +1 -1
  192. package/providers/maplibre/src/index.js +1 -1
  193. package/providers/maplibre/src/index.test.js +3 -5
  194. package/providers/maplibre/src/mapEvents.test.js +15 -5
  195. package/providers/maplibre/src/maplibreProvider.test.js +6 -2
  196. package/providers/maplibre/src/utils/calculateLinearTextSize.js +4 -4
  197. package/providers/maplibre/src/utils/calculateLinearTextSize.test.js +3 -3
  198. package/providers/maplibre/src/utils/detectWebgl.test.js +1 -1
  199. package/providers/maplibre/src/utils/highlightFeatures.js +3 -2
  200. package/providers/maplibre/src/utils/highlightFeatures.test.js +13 -6
  201. package/providers/maplibre/src/utils/labels.js +19 -20
  202. package/providers/maplibre/src/utils/labels.test.js +15 -13
  203. package/providers/maplibre/src/utils/maplibreFixes.test.js +1 -1
  204. package/providers/maplibre/src/utils/queryFeatures.js +6 -6
  205. package/providers/maplibre/src/utils/queryFeatures.test.js +13 -13
  206. package/providers/maplibre/src/utils/spatial.js +0 -1
  207. package/providers/maplibre/src/utils/spatial.test.js +26 -27
  208. package/src/App/components/Actions/Actions.jsx +2 -2
  209. package/src/App/components/Actions/Actions.module.scss +0 -7
  210. package/src/App/components/Actions/Actions.test.jsx +1 -1
  211. package/src/App/components/Icon/Icon.jsx +3 -2
  212. package/src/App/components/Icon/Icon.module.scss +4 -0
  213. package/src/App/components/Icon/Icon.test.jsx +43 -4
  214. package/src/App/components/MapButton/MapButton.jsx +42 -17
  215. package/src/App/components/MapButton/MapButton.module.scss +4 -13
  216. package/src/App/components/MapButton/MapButton.test.jsx +27 -3
  217. package/src/App/components/PopupMenu/PopupMenu.jsx +51 -274
  218. package/src/App/components/PopupMenu/PopupMenu.module.scss +14 -7
  219. package/src/App/components/PopupMenu/PopupMenu.test.jsx +70 -1
  220. package/src/App/components/PopupMenu/usePopupMenu.js +258 -0
  221. package/src/App/hooks/useButtonStateEvaluator.js +12 -2
  222. package/src/App/hooks/useButtonStateEvaluator.test.js +38 -4
  223. package/src/App/hooks/useInterfaceAPI.js +6 -0
  224. package/src/App/hooks/useLayoutMeasurements.js +84 -18
  225. package/src/App/hooks/useLayoutMeasurements.test.js +124 -17
  226. package/src/App/layout/Layout.jsx +12 -7
  227. package/src/App/layout/Layout.test.jsx +2 -2
  228. package/src/App/layout/layout.module.scss +67 -29
  229. package/src/App/registry/pluginRegistry.js +17 -0
  230. package/src/App/registry/pluginRegistry.test.js +33 -0
  231. package/src/App/renderer/HtmlElementHost.jsx +2 -1
  232. package/src/App/renderer/HtmlElementHost.test.jsx +7 -7
  233. package/src/App/renderer/mapButtons.js +3 -2
  234. package/src/App/renderer/mapPanels.test.js +2 -2
  235. package/src/App/renderer/slotHelpers.js +2 -2
  236. package/src/App/renderer/slotHelpers.test.js +5 -5
  237. package/src/App/renderer/slots.js +9 -5
  238. package/src/App/store/AppProvider.jsx +3 -1
  239. package/src/App/store/AppProvider.test.jsx +1 -1
  240. package/src/App/store/ServiceProvider.jsx +3 -1
  241. package/src/App/store/appActionsMap.js +16 -0
  242. package/src/App/store/appActionsMap.test.js +27 -0
  243. package/src/App/store/appDispatchMiddleware.js +33 -1
  244. package/src/App/store/appDispatchMiddleware.test.js +250 -222
  245. package/src/App/store/appReducer.js +2 -0
  246. package/src/InteractiveMap/InteractiveMap.js +4 -0
  247. package/src/config/appConfig.js +7 -4
  248. package/src/config/events.js +28 -0
  249. package/src/scss/main.scss +1 -0
  250. package/src/scss/settings/_dimensions.scss +0 -1
  251. package/src/services/logger.js +6 -0
  252. package/src/services/logger.test.js +32 -0
  253. package/src/utils/getSafeZoneInset.js +9 -7
  254. package/src/utils/getSafeZoneInset.test.js +10 -10
  255. package/webpack.dev.mjs +23 -19
  256. package/docs/govuk-prototype.md +0 -23
  257. package/docs/index.md +0 -19
  258. package/plugins/beta/datasets/src/api/hideDataset.js +0 -14
  259. package/plugins/beta/datasets/src/api/hideFeatures.js +0 -41
  260. package/plugins/beta/datasets/src/api/showDataset.js +0 -14
  261. package/plugins/beta/datasets/src/api/showFeatures.js +0 -44
  262. package/plugins/beta/datasets/src/handleSetMapStyle.js +0 -54
  263. package/plugins/beta/datasets/src/mapLayers.js +0 -165
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * MapLibre GL JS
3
- * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.17.0/LICENSE.txt
3
+ * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.21.1/LICENSE.txt
4
4
  */
@@ -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],{662(t,e,r){r.r(e),r.d(e,{default:()=>lt});var n=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 r=t.getCanvas();if(r&&(this.target===r||r.contains(this.target)))return}e.call(this)}}var l=function(t,e){var r=null,n=function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){t.apply(void 0,a)},e)};return n.cancel=function(){r&&(clearTimeout(r),r=null)},n};function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function u(t){var e=t.map,r=t.events,n=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 n.emit(t,e)},y=function(){return p(r.MAP_LOADED)};e.on("load",y),c.push(["load",y]),e.once("idle",function(){return p(r.MAP_FIRST_IDLE,f())});var d=function(){return p(r.MAP_MOVE_START)};e.on("movestart",d),c.push(["movestart",d]);var g=l(function(){p(r.MAP_MOVE_END,f())},500);e.on("moveend",g),c.push(["moveend",g]),h.push(g);var m,v,b=(m=function(){p(r.MAP_MOVE,f())},v=0,function(){var t=Date.now();t-v>=10&&(v=t,m.apply(void 0,arguments))});e.on("zoom",b),c.push(["zoom",b]),h.push(b);var M=function(){return p(r.MAP_RENDER)};e.on("render",M),c.push(["render",M]);var w=l(function(){p(r.MAP_DATA_CHANGE,f())},500);e.on("styledata",w),c.push(["styledata",w]),h.push(w);var S=function(){return p(r.MAP_STYLE_CHANGE)};e.on("style.load",S),c.push(["style.load",S]);var x=function(t){return p(r.MAP_CLICK,{point:t.point,coords:[t.lngLat.lng,t.lngLat.lat]})};return e.on("click",x),c.push(["click",x]),{remove:function(){h.forEach(function(t){return t.cancel()}),c.forEach(function(t){var r,n,a=(n=2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(r,n)||function(t,e){if(t){if("string"==typeof t)return s(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(r,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.")}()),o=a[0],i=a[1];return e.off(o,i)})}}}function c(t){var e=t.map,r=t.events,n=t.eventBus,a=function(t){e.once("style.load",function(){n.emit(r.MAP_STYLE_CHANGE,{mapStyleId:t.id})}),e.setStyle(t.url,{diff:!1})},o=function(t){e.setPixelRatio(t)};return n.on(r.MAP_SET_STYLE,a),n.on(r.MAP_SET_PIXEL_RATIO,o),{remove:function(){n.off(r.MAP_SET_STYLE,a),n.off(r.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 r=null;switch(e.length){case 3:r=e[0]/1+e[1]/60+e[2]/3600;break;case 2:r=e[0]/1+e[1]/60;break;case 1:r=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(r=-r),Number(r)}static toDms(t,e="d",r=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===r)switch(e){case"d":case"deg":r=4;break;case"dm":case"deg+min":r=2;break;case"dms":case"deg+min+sec":r=0;break;default:e="d",r=4}t=Math.abs(t);let n=null,a=null,o=null,i=null;switch(e){default:case"d":case"deg":a=t.toFixed(r),a<100&&(a="0"+a),a<10&&(a="0"+a),n=a+"°";break;case"dm":case"deg+min":a=Math.floor(t),o=(60*t%60).toFixed(r),60==o&&(o=(0).toFixed(r),a++),a=("000"+a).slice(-3),o<10&&(o="0"+o),n=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(r),60==i&&(i=(0).toFixed(r),o++),60==o&&(o=0,a++),a=("000"+a).slice(-3),o=("00"+o).slice(-2),i<10&&(i="0"+i),n=a+"°"+f.separator+o+"′"+f.separator+i+"″"}return n}static toLat(t,e,r){const n=f.toDms(f.wrap90(t),e,r);return null===n?"–":n.slice(1)+f.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=f.toDms(f.wrap180(t),e,r);return null===n?"–":n+f.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=f.toDms(f.wrap360(t),e,r);return null===n?"–":n.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(r.thousands,"⁜").replace(r.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",r.decimal).replace("⁜",r.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=f.wrap360(t);const r=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*r/360)%r*16/r]}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,y=Math.PI;class d{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=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,r;if(2==t.length&&([e,r]=t,e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r)),isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,r]=t[0].split(","),e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r)),isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t[0]}’`);if(1==t.length&&"object"==typeof t[0]){const n=t[0];if("Point"==n.type&&Array.isArray(n.coordinates)?[r,e]=n.coordinates:(null!=n.latitude&&(e=n.latitude),null!=n.lat&&(e=n.lat),null!=n.longitude&&(r=n.longitude),null!=n.lng&&(r=n.lng),null!=n.lon&&(r=n.lon),e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r))),isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${t.toString()}’`);return new d(e,r)}distanceTo(t,e=6371e3){if(t instanceof d||(t=d.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const r=e,n=this.lat.toRadians(),a=this.lon.toRadians(),o=t.lat.toRadians(),i=o-n,l=t.lon.toRadians()-a,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(o)*Math.sin(l/2)*Math.sin(l/2);return r*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}initialBearingTo(t){if(t instanceof d||(t=d.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),r=t.lat.toRadians(),n=(t.lon-this.lon).toRadians(),a=Math.cos(e)*Math.sin(r)-Math.sin(e)*Math.cos(r)*Math.cos(n),o=Math.sin(n)*Math.cos(r),i=Math.atan2(o,a).toDegrees();return p.wrap360(i)}finalBearingTo(t){t instanceof d||(t=d.parse(t));const e=t.initialBearingTo(this)+180;return p.wrap360(e)}midpointTo(t){t instanceof d||(t=d.parse(t));const e=this.lat.toRadians(),r=this.lon.toRadians(),n=t.lat.toRadians(),a=(t.lon-this.lon).toRadians(),o=Math.cos(e),i=Math.sin(e),l={x:o+Math.cos(n)*Math.cos(a),y:0+Math.cos(n)*Math.sin(a),z:i+Math.sin(n)},s=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),u=r+Math.atan2(l.y,l.x),c=s.toDegrees(),h=u.toDegrees();return new d(c,h)}intermediatePointTo(t,e){if(t instanceof d||(t=d.parse(t)),this.equals(t))return new d(this.lat,this.lon);const r=this.lat.toRadians(),n=this.lon.toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=a-r,l=o-n,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(r)*Math.cos(a)*Math.sin(l/2)*Math.sin(l/2),u=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)),c=Math.sin((1-e)*u)/Math.sin(u),h=Math.sin(e*u)/Math.sin(u),f=c*Math.cos(r)*Math.cos(n)+h*Math.cos(a)*Math.cos(o),p=c*Math.cos(r)*Math.sin(n)+h*Math.cos(a)*Math.sin(o),y=c*Math.sin(r)+h*Math.sin(a),g=Math.atan2(y,Math.sqrt(f*f+p*p)),m=Math.atan2(p,f),v=g.toDegrees(),b=m.toDegrees();return new d(v,b)}destinationPoint(t,e,r=6371e3){const n=t/r,a=Number(e).toRadians(),o=this.lat.toRadians(),i=this.lon.toRadians(),l=Math.sin(o)*Math.cos(n)+Math.cos(o)*Math.sin(n)*Math.cos(a),s=Math.asin(l),u=Math.sin(a)*Math.sin(n)*Math.cos(o),c=Math.cos(n)-Math.sin(o)*l,h=i+Math.atan2(u,c),f=s.toDegrees(),p=h.toDegrees();return new d(f,p)}static intersection(t,e,r,n){if(t instanceof d||(t=d.parse(t)),r instanceof d||(r=d.parse(r)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(n))throw new TypeError(`invalid brng2 ‘${n}’`);const a=t.lat.toRadians(),o=t.lon.toRadians(),i=r.lat.toRadians(),l=r.lon.toRadians(),s=Number(e).toRadians(),u=Number(n).toRadians(),c=i-a,h=l-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 d(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)),m=Math.acos(Math.min(Math.max(p,-1),1)),v=Math.acos(Math.min(Math.max(g,-1),1)),b=s-(Math.sin(l-o)>0?m:2*y-m),M=(Math.sin(l-o)>0?2*y-v:v)-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),x=Math.asin(Math.min(Math.max(Math.sin(a)*Math.cos(S)+Math.cos(a)*Math.sin(S)*Math.cos(s),-1),1)),P=o+Math.atan2(Math.sin(s)*Math.sin(S)*Math.cos(a),Math.cos(S)-Math.sin(a)*Math.sin(x)),N=x.toDegrees(),E=P.toDegrees();return new d(N,E)}crossTrackDistanceTo(t,e,r=6371e3){t instanceof d||(t=d.parse(t)),e instanceof d||(e=d.parse(e));const n=r;if(this.equals(t))return 0;const a=t.distanceTo(this,n)/n,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(a)*Math.sin(o-i))*n}alongTrackDistanceTo(t,e,r=6371e3){t instanceof d||(t=d.parse(t)),e instanceof d||(e=d.parse(e));const n=r;if(this.equals(t))return 0;const a=t.distanceTo(this,n)/n,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians(),l=Math.asin(Math.sin(a)*Math.sin(o-i));return Math.acos(Math.cos(a)/Math.abs(Math.cos(l)))*Math.sign(Math.cos(i-o))*n}maxLatitude(t){const e=Number(t).toRadians(),r=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(r))).toDegrees()}static crossingParallels(t,e,r){if(t.equals(e))return null;const n=Number(r).toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=e.lat.toRadians(),l=e.lon.toRadians()-o,s=Math.sin(a)*Math.cos(i)*Math.cos(n)*Math.sin(l),u=Math.sin(a)*Math.cos(i)*Math.cos(n)*Math.cos(l)-Math.cos(a)*Math.sin(i)*Math.cos(n),c=Math.cos(a)*Math.cos(i)*Math.sin(n)*Math.sin(l);if(c*c>s*s+u*u)return null;const h=Math.atan2(-u,s),f=Math.acos(c/Math.sqrt(s*s+u*u)),y=o+h+f,d=(o+h-f).toDegrees(),g=y.toDegrees();return{lon1:p.wrap180(d),lon2:p.wrap180(g)}}rhumbDistanceTo(t,e=6371e3){t instanceof d||(t=d.parse(t));const r=e,n=this.lat.toRadians(),a=t.lat.toRadians(),o=a-n;let i=Math.abs(t.lon-this.lon).toRadians();Math.abs(i)>y&&(i=i>0?-(2*y-i):2*y+i);const l=Math.log(Math.tan(a/2+y/4)/Math.tan(n/2+y/4)),s=Math.abs(l)>1e-11?o/l:Math.cos(n);return Math.sqrt(o*o+s*s*i*i)*r}rhumbBearingTo(t){if(t instanceof d||(t=d.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),r=t.lat.toRadians();let n=(t.lon-this.lon).toRadians();Math.abs(n)>y&&(n=n>0?-(2*y-n):2*y+n);const a=Math.log(Math.tan(r/2+y/4)/Math.tan(e/2+y/4)),o=Math.atan2(n,a).toDegrees();return p.wrap360(o)}rhumbDestinationPoint(t,e,r=6371e3){const n=this.lat.toRadians(),a=this.lon.toRadians(),o=Number(e).toRadians(),i=t/r,l=i*Math.cos(o);let s=n+l;Math.abs(s)>y/2&&(s=s>0?y-s:-y-s);const u=Math.log(Math.tan(s/2+y/4)/Math.tan(n/2+y/4)),c=Math.abs(u)>1e-11?l/u:Math.cos(n),h=a+i*Math.sin(o)/c,f=s.toDegrees(),p=h.toDegrees();return new d(f,p)}rhumbMidpointTo(t){t instanceof d||(t=d.parse(t));const e=this.lat.toRadians();let r=this.lon.toRadians();const n=t.lat.toRadians(),a=t.lon.toRadians();Math.abs(a-r)>y&&(r+=2*y);const o=(e+n)/2,i=Math.tan(y/4+e/2),l=Math.tan(y/4+n/2),s=Math.tan(y/4+o/2);let u=((a-r)*Math.log(s)+r*Math.log(l)-a*Math.log(i))/Math.log(l/i);isFinite(u)||(u=(r+a)/2);const c=o.toDegrees(),h=u.toDegrees();return new d(c,h)}static areaOf(t,e=6371e3){const r=e,n=t[0].equals(t[t.length-1]);n||t.push(t[0]);const a=t.length-1;let o=0;for(let e=0;e<a;e++){const r=t[e].lat.toRadians(),n=t[e+1].lat.toRadians(),a=(t[e+1].lon-t[e].lon).toRadians();o+=2*Math.atan2(Math.tan(a/2)*(Math.tan(r/2)+Math.tan(n/2)),1+Math.tan(r/2)*Math.tan(n/2))}(function(t){let e=0,r=t[0].initialBearingTo(t[1]);for(let n=0;n<t.length-1;n++){const a=t[n].initialBearingTo(t[n+1]),o=t[n].finalBearingTo(t[n+1]);e+=(a-r+540)%360-180,e+=(o-a+540)%360-180,r=o}return e+=(t[0].initialBearingTo(t[1])-r+540)%360-180,Math.abs(e)<90})(t)&&(o=Math.abs(o)-2*y);const i=Math.abs(o*r*r);return n||t.pop(),i}equals(t){return t instanceof d||(t=d.parse(t)),!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON)}toGeoJSON(){return{type:"Point",coordinates:[this.lon,this.lat]}}toString(t="d",e=void 0){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);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,r){if(null!==t)for(var n,a,o,i,l,s,u,c,h=0,f=0,p=t.type,y="FeatureCollection"===p,d="Feature"===p,m=y?t.features.length:1,v=0;v<m;v++){l=(c=!!(u=y?t.features[v].geometry:d?t.geometry:t)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var b=0;b<l;b++){var M=0,w=0;if(null!==(i=c?u.geometries[b]:u)){s=i.coordinates;var S=i.type;switch(h=!r||"Polygon"!==S&&"MultiPolygon"!==S?0:1,S){case null:break;case"Point":if(!1===e(s,f,v,M,w))return!1;f++,M++;break;case"LineString":case"MultiPoint":for(n=0;n<s.length;n++){if(!1===e(s[n],f,v,M,w))return!1;f++,"MultiPoint"===S&&M++}"LineString"===S&&M++;break;case"Polygon":case"MultiLineString":for(n=0;n<s.length;n++){for(a=0;a<s[n].length-h;a++){if(!1===e(s[n][a],f,v,M,w))return!1;f++}"MultiLineString"===S&&M++,"Polygon"===S&&w++}"Polygon"===S&&M++;break;case"MultiPolygon":for(n=0;n<s.length;n++){for(w=0,a=0;a<s[n].length;a++){for(o=0;o<s[n][a].length-h;o++){if(!1===e(s[n][a][o],f,v,M,w))return!1;f++}w++}M++}break;case"GeometryCollection":for(n=0;n<i.geometries.length;n++)if(!1===g(i.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var m=function(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const r=[1/0,1/0,-1/0,-1/0];return g(t,t=>{r[0]>t[0]&&(r[0]=t[0]),r[1]>t[1]&&(r[1]=t[1]),r[2]<t[0]&&(r[2]=t[0]),r[3]<t[1]&&(r[3]=t[1])}),r};function v(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||M(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 b(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||M(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 M(t,e){if(t){if("string"==typeof t)return w(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(t,e):void 0}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var S=function(t,e){var r=b(t,2),n=r[0],a=r[1],o=b(e,2),i=o[0],l=o[1],s=new d(a,n),u=new d(l,i);return s.distanceTo(u)},x=function(t){var e=t/1609.344;if(e<.5)return"".concat(Math.round(t),"m");if(e<10){var r=Number.parseFloat(e.toFixed(1)),n=1===r?"mile":"miles";return"".concat(r," ").concat(n)}var a=Math.round(e);return"".concat(a," miles")},P=function(t){return m(t)};function N(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return E(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(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 E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function O(t){return O="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},O(t)}function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function j(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach(function(e){T(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function T(t,e,r){return(e=function(t){var e=function(t){if("object"!=O(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=O(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==O(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var R="highlighted-label";function k(t,e){if("number"==typeof t)return t;if(!Array.isArray(t)||"interpolate"!==t[0])return function(t,e){var r=t.stops;if(r.length<2)return r.length>0?r[0][1]:0;for(var n=r[0],a=r[r.length-1],o=1;o<r.length;o++){var i=r[o];if(i[0]>e){a=i,n=r[o-1];break}n=r[o-1],a=i}var l=N(n,2),s=l[0],u=l[1],c=N(a,2),h=c[0],f=c[1];return e<=s?u:e>=h?f:u+(e-s)/(h-s)*(f-u)}(t,e);var r,n=function(t){if(Array.isArray(t))return t}(r=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return L(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?L(t,e):void 0}}(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.")}(),a=n[2],o=L(n).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 l=o[i],s=o[i+1],u=o[i+2],c=o[i+3];if(e<=l)return s;if(e<=u)return s+(e-l)/(u-l)*(c-s)}return o[o.length-1]}function I(t,e){if(e.highlightLayerId&&t.getLayer(e.highlightLayerId)){try{t.removeLayer(e.highlightLayerId)}catch(t){}e.highlightLayerId=null,e.highlightedExpr=null}}function D(t,e,r){var n,a,o,i;if(null!=e&&null!==(n=e.feature)&&void 0!==n&&n.layer){I(t,r);var l=e.feature,s=e.layer;r.highlightLayerId="highlight-".concat(s.id);var u=l.id,c=l.type,h=l.properties,f=l.geometry;t.getSource(R).setData({id:u,type:c,properties:h,geometry:f}),r.highlightedExpr=s.layout["text-size"];var p=t.getZoom(),y=(a=s,o=1.5*k(r.highlightedExpr,p),i=r.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"},{id:"highlight-".concat(a.id),type:a.type,source:R,layout:j(j({},a.layout),{},{"text-size":o,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:j(j({},a.paint),{},{"text-color":i.text,"text-halo-color":i.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})});t.addLayer(y),t.moveLayer(r.highlightLayerId)}}function _(t){t.getSource(R)||t.addSource(R,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function C(t){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){return t.setLayoutProperty(e.id,"symbol-placement","line-center")})}function B(t,e,r,n){var a={isDarkStyle:"dark"===e,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function o(){var e=t.getStyle().layers.filter(function(t){return"symbol"===t.type}),r=t.queryRenderedFeatures({layers:e.map(function(t){return t.id})});a.labels=function(t,e,r){return e.flatMap(function(e){var n,a,o,i,l="string"==typeof(a=null===(n=e.layout)||void 0===n?void 0:n["text-field"])?null===(o=/^{(.+)}$/.exec(a))||void 0===o?void 0:o[1]:Array.isArray(a)?null===(i=a.find(function(t){return Array.isArray(t)&&"get"===t[0]}))||void 0===i?void 0:i[1]:null;return l?r.filter(function(t){var r;return t.layer.id===e.id&&(null===(r=t.properties)||void 0===r?void 0:r[l])}).map(function(r){return function(t,e,r,n){var a=function(t){var e=t.type,r=t.coordinates;if("Point"===e)return r;if("MultiPoint"===e)return r[0];if(e.includes("LineString")){var n="LineString"===e?r:r[0];return[(n[0][0]+n[n.length-1][0])/2,(n[0][1]+n[n.length-1][1])/2]}if(e.includes("Polygon")){var a="Polygon"===e?r[0]:r[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}(t.geometry);if(!a)return null;var o=n.project({lng:a[0],lat:a[1]});return{text:t.properties[r],x:o.x,y:o.y,feature:t,layer:e}}(r,e,l,t)}).filter(Boolean):[]})}(t,e,r)}function i(){if(o(),!a.labels.length)return null;var e=t.project(t.getCenter()),r=function(t,e){var r;return null===(r=t.reduce(function(t,r){var n=Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2);return!t||n<t.dist?{label:r,dist:n}:t},null))||void 0===r?void 0:r.label}(a.labels,e);return a.currentPixel={x:r.x,y:r.y},D(t,r,a),"".concat(r.text," (").concat(r.layer.id,")")}return C(t),_(t),null==n||n.on(r.MAP_SET_STYLE,function(e){t.once("styledata",function(){return t.once("idle",function(){C(t),_(t),a.isDarkStyle="dark"===(null==e?void 0:e.mapColorScheme)})})}),t.on("zoom",function(){if(a.highlightLayerId&&a.highlightedExpr){var e=k(a.highlightedExpr,t.getZoom());t.setLayoutProperty(a.highlightLayerId,"text-size",1.5*e)}}),function(t){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])})}(t),{refreshLabels:o,highlightNextLabel:function(e){if(o(),!a.labels.length)return null;if(!a.currentPixel)return i();var r=function(t,e){if(!e.currentPixel)return null;var r=e.labels.map(function(t,e){return{pixel:[t.x,t.y],index:e}}).filter(function(t){return t.pixel[0]!==e.currentPixel.x||t.pixel[1]!==e.currentPixel.y});if(!r.length)return null;var n=r.map(function(t){return t.pixel}),a=function(t,e,r){var n=b(e,2),a=n[0],o=n[1],i=r.filter(function(e){var r=b(e,2),n=r[0],i=r[1];return(n!==a||i!==o)&&function(t,e,r){switch(t){case"ArrowUp":return r<0&&Math.abs(r)>=Math.abs(e);case"ArrowDown":return r>0&&Math.abs(r)>=Math.abs(e);case"ArrowLeft":return e<0&&Math.abs(e)>Math.abs(r);case"ArrowRight":return e>0&&Math.abs(e)>Math.abs(r);default:return!1}}(t,n-a,i-o)});if(!i.length)return r.findIndex(function(t){return t[0]===a&&t[1]===o});var l=-1,s=1/0;return i.forEach(function(t){var e=t[0]-a,n=t[1]-o,i=e*e+n*n;i<s&&(s=i,l=r.indexOf(t))}),l}(t,[e.currentPixel.x,e.currentPixel.y],n);return(null==a||a<0||a>=r.length)&&(a=0),e.labels[r[a].index]}(e,a);return r?(a.currentPixel={x:r.x,y:r.y},D(t,r,a),"".concat(r.text," (").concat(r.layer.id,")")):null},highlightLabelAtCenter:i,clearHighlightedLabel:function(){return I(t,a)}}}function F(t){return F="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},F(t)}function $(t){return function(t){if(Array.isArray(t))return q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||z(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 z(t,e){if(t){if("string"==typeof t)return q(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?q(t,e):void 0}}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Z(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function G(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Z(Object(r),!0).forEach(function(e){W(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Z(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function W(t,e,r){return(e=function(t){var e=function(t){if("object"!=F(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=F(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==F(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var H=function(t,e,r,n,a,o,i){t.getLayer(e)||t.addLayer(G(G({id:e,type:r,source:n},a&&{"source-layer":a}),{},{paint:o})),Object.entries(o).forEach(function(r){var n,a,o=(a=2,function(t){if(Array.isArray(t))return t}(n=r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(n,a)||z(n,a)||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.")}()),i=o[0],l=o[1];t.setPaintProperty(e,i,l)}),t.setFilter(e,i)};function U(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Y(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Y(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 Y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var V=function(t,e,r){var n=Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2);if(0===n)return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2);var a=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return a=Math.max(0,Math.min(1,a)),Math.pow(t.x-(e.x+a*(r.x-e.x)),2)+Math.pow(t.y-(e.y+a*(r.y-e.y)),2)},J=["container","padding","mapStyle","mapSize","center","zoom","bounds","pixelRatio"];function K(t){return K="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},K(t)}function X(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function o(r,n,a,o){var s=n&&n.prototype instanceof l?n:l,u=Object.create(s.prototype);return Q(u,"_invoke",function(r,n,a){var o,l,s,u=0,c=a||[],h=!1,f={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return o=e,l=0,s=t,f.n=r,i}};function p(r,n){for(l=r,s=n,e=0;!h&&u&&!a&&e<c.length;e++){var a,o=c[e],p=f.p,y=o[2];r>3?(a=y===n)&&(s=o[(l=o[4])?5:(l=3,3)],o[4]=o[5]=t):o[0]<=p&&((a=r<2&&p<o[1])?(l=0,f.v=n,f.n=o[1]):p<y&&(a=r<3||o[0]>n||n>y)&&(o[4]=r,o[5]=n,f.n=y,l=0))}if(a||r>1)return i;throw h=!0,n}return function(a,c,y){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,y),l=c,s=y;(e=l<2?t:s)||!h;){o||(l?l<3?(l>1&&(f.n=-1),p(l,s)):f.n=s:f.v=s);try{if(u=2,o){if(l||(a="next"),e=o[a]){if(!(e=e.call(o,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,l<2&&(l=0)}else 1===l&&(e=o.return)&&e.call(o),l<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),l=1);o=t}else if((e=(h=f.n<0)?s:r.call(n,f))!==i)break}catch(e){o=t,l=1,s=e}finally{u=1}}return{value:e,done:h}}}(r,a,o),!0),u}var i={};function l(){}function s(){}function u(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(Q(e={},n,function(){return this}),e),h=u.prototype=l.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Q(t,a,"GeneratorFunction")),t.prototype=Object.create(h),t}return s.prototype=u,Q(h,"constructor",u),Q(u,"constructor",s),s.displayName="GeneratorFunction",Q(u,a,"GeneratorFunction"),Q(h),Q(h,a,"Generator"),Q(h,n,function(){return this}),Q(h,"toString",function(){return"[object Generator]"}),(X=function(){return{w:o,m:f}})()}function Q(t,e,r,n){var a=Object.defineProperty;try{a({},"",{})}catch(t){a=0}Q=function(t,e,r,n){function o(e,r){Q(t,e,function(t){return this._invoke(e,r,t)})}e?a?a(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(o("next",0),o("throw",1),o("return",2))},Q(t,e,r,n)}function tt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function et(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?tt(Object(r),!0).forEach(function(e){rt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):tt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function rt(t,e,r){return(e=it(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nt(t,e){if(null==t)return{};var r,n,a=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}function at(t,e,r,n,a,o,i){try{var l=t[o](i),s=l.value}catch(t){return void r(t)}l.done?e(s):Promise.resolve(s).then(n,a)}function ot(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,it(n.key),n)}}function it(t){var e=function(t){if("object"!=K(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=K(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==K(e)?e:e+""}var lt=function(){return t=function t(e){var r=e.mapFramework,n=e.mapProviderConfig,o=void 0===n?{}:n,i=e.events,l=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.maplibreModule=r,this.events=i,this.eventBus=l,this.capabilities={supportedShortcuts:a,supportsMapSizes:!0},Object.assign(this,o)},e=[{key:"initMap",value:(r=X().m(function t(e){var r,n,a,l,s,h,f,p,y,d,g,m,v,b=this;return X().w(function(t){for(;;)switch(t.n){case 0:r=e.container,n=e.padding,a=e.mapStyle,l=e.mapSize,s=e.center,h=e.zoom,f=e.bounds,p=e.pixelRatio,y=nt(e,J),this.mapStyleId=null==a?void 0:a.id,this.mapSize=l,d=this.maplibreModule.Map,g=this.events,m=this.eventBus,(v=new d(et(et({},y),{},{container:r,style:null==a?void 0:a.url,pixelRatio:p,padding:n,center:s,zoom:h,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}))).touchZoomRotate.disableRotation(),this.map=v,this.map.setPadding(n),f&&v.fitBounds(f,{duration:0}),i(v),o(v),u({map:v,events:g,eventBus:m,getCenter:this.getCenter.bind(this),getZoom:this.getZoom.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),c({mapProvider:this,map:v,events:g,eventBus:m}),v.on("load",function(){b.labelNavigator=B(v,null==a?void 0:a.mapColorScheme,g,m)}),this.eventBus.emit(g.MAP_READY,{map:this.map,mapStyleId:this.mapStyleId,mapSize:this.mapSize,crs:this.crs});case 1:return t.a(2)}},t,this)}),l=function(){var t=this,e=arguments;return new Promise(function(n,a){var o=r.apply(t,e);function i(t){at(o,n,a,i,l,"next",t)}function l(t){at(o,n,a,i,l,"throw",t)}i(void 0)})},function(t){return l.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,r=t.zoom;this.map.flyTo({center:e||this.getCenter(),zoom:r||this.getZoom(),duration:n})}},{key:"zoomIn",value:function(t){this.map.easeTo({zoom:this.getZoom()+t,duration:n})}},{key:"zoomOut",value:function(t){this.map.easeTo({zoom:this.getZoom()-t,duration:n})}},{key:"panBy",value:function(t){this.map.panBy(t,{duration:n})}},{key:"fitToBounds",value:function(t){var e=Array.isArray(t)?t:P(t);this.map.fitBounds(e,{duration:n})}},{key:"setPadding",value:function(t){this.map.setPadding(t)}},{key:"updateHighlightedFeatures",value:function(t,e){return function(t){var e=t.LngLatBounds,r=t.map,n=t.selectedFeatures,a=t.stylesMap;if(!r)return null;var o=function(t,e){var r={};return null==e||e.forEach(function(e){var n=e.featureId,a=e.layerId,o=e.idProperty,i=e.geometry,l=t.getLayer(a);if(l){var s=l.source;r[s]||(r[s]={ids:new Set,fillIds:new Set,idProperty:o,layerId:a,hasFillGeometry:!1}),!i||"Polygon"!==i.type&&"MultiPolygon"!==i.type||(r[s].hasFillGeometry=!0,r[s].fillIds.add(n)),r[s].ids.add(n)}}),r}(r,n),i=[],l=new Set(Object.keys(o)),s=r._highlightedSources||new Set;return function(t,e,r){e.forEach(function(e){if(!r.has(e)){var n="highlight-".concat(e);["".concat(n,"-fill"),"".concat(n,"-line")].forEach(function(e){t.getLayer(e)&&t.setFilter(e,["==","id",""])})}})}(r,s,l),r._highlightedSources=l,l.forEach(function(t){var e=o[t],n=e.ids,l=e.fillIds,s=e.idProperty,u=e.layerId,c=e.hasFillGeometry,h=r.getLayer(u),f=h.sourceLayer,p=c?"fill":h.type,y="highlight-".concat(t),d=a[u],g=d.stroke,m=d.strokeWidth,v=d.fill,b=s?["get",s]:["id"],M=["in",b,["literal",$(n)]],w=["in",b,["literal",$(l)]],S={"line-color":g,"line-width":m};"fill"===p&&(H(r,"".concat(y,"-fill"),"fill",t,f,{"fill-color":v},w),H(r,"".concat(y,"-line"),"line",t,f,S,M)),"line"===p&&(r.getLayer("".concat(y,"-fill"))&&r.setFilter("".concat(y,"-fill"),["==","id",""]),H(r,"".concat(y,"-line"),"line",t,f,S,M)),i.push.apply(i,$(r.queryRenderedFeatures({layers:[u]}).filter(function(t){var e;return n.has(s?null===(e=t.properties)||void 0===e?void 0:e[s]:t.id)})))}),function(t,e){if(!e.length)return null;var r=new t;return e.forEach(function(t){var e=function(t){return"number"==typeof t[0]?r.extend(t):t.forEach(e)};e(t.geometry.coordinates)}),[r.getWest(),r.getSouth(),r.getEast(),r.getNorth()]}(e,i)}({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,e){return function(t,e){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).radius,n=void 0===r?10:r,a=[[e.x-n,e.y-n],[e.x+n,e.y+n]],o=t.queryRenderedFeatures(a);if(0===o.length)return[];var i=[];o.forEach(function(t){!1===i.includes(t.layer.id)&&i.push(t.layer.id)});for(var l=new Set,s=[],u=o.length-1;u>=0;u--){var c=o[u],h=void 0===c.id?JSON.stringify(c.properties):c.id;!1===l.has(h)&&(l.add(h),s.push(c))}var f=t.unproject(e),p=[f.lng,f.lat];return s.map(function(r){var n=0,a=r.geometry.type,o=function(t,e,r){var n=r.coordinates,a=r.type,o=1/0,i=function(e){return t.project(e)},l=function(t){for(var r=0;r<t.length-1;r++){var n=V(e,i(t[r]),i(t[r+1]));n<o&&(o=n)}};if("Point"===a){var s=i(n);o=Math.pow(e.x-s.x,2)+Math.pow(e.y-s.y,2)}else"LineString"===a||"MultiPoint"===a?"LineString"===a?l(n):n.forEach(function(t){var r=i(t),n=Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2);n<o&&(o=n)}):"Polygon"===a||"MultiLineString"===a?n.forEach(l):"MultiPolygon"===a&&n.forEach(function(t){return t.forEach(l)});return o}(t,e,r.geometry);if(n+=1e6*i.indexOf(r.layer.id),a.includes("Polygon")){var l=("Polygon"===a?[r.geometry.coordinates]:r.geometry.coordinates).some(function(t){return function(t,e){for(var r=U(t,2),n=r[0],a=r[1],o=!1,i=0,l=e.length-1;i<e.length;l=i,i++){var s=U(e[i],2),u=s[0],c=s[1],h=U(e[l],2),f=h[0],p=h[1];c>a!=p>a&&n<(f-u)*(a-c)/(p-c)+u&&(o=!o)}return o}(p,t[0])});!0===l?n-=5e5:n+=1e5}return{f:r,score:n+=o}}).sort(function(t,e){return t.score-e.score}).map(function(t){return t.f})}(this.map,t,e)}},{key:"getAreaDimensions",value:function(){return function(t){var e,r,n,a;if(t&&"function"==typeof t.getWest)e=t.getWest(),r=t.getSouth(),n=t.getEast(),a=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";var o=b(t,2),i=b(o[0],2);e=i[0],r=i[1];var l=b(o[1],2);n=l[0],a=l[1]}var s=S([e,r],[n,r]),u=S([e,r],[e,a]),c=x(s),h=x(u);return"".concat(h," by ").concat(c)}((t=this.maplibreModule.LngLatBounds,e=this.map,r=e.getContainer().getBoundingClientRect(),n=r.width,a=r.height,o=e.getPadding(),i=[o.left,a-o.bottom],l=[n-o.right,o.top],new t(e.unproject(i),e.unproject(l))));var t,e,r,n,a,o,i,l}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var r=b(t,2),n=r[0],a=r[1],o=b(e,2),i=o[0],l=o[1],s=l-a,u=i-n,c=[];if(Math.abs(s)>1e-4){var h=Math.round(S([n,a],[n,l]));c.push("".concat(s>0?"north":"south"," ").concat(x(h)))}if(Math.abs(u)>1e-4){var f=Math.round(S([n,a],[i,a]));c.push("".concat(u>0?"east":"west"," ").concat(x(f)))}return c.join(", ")}(t,e)}},{key:"getResolution",value:function(){return t=this.map.getCenter(),e=this.map.getZoom(),r=t.lat,n=Math.pow(2,e),40075016.686*Math.cos(r*Math.PI/180)/(512*n);var t,e,r,n}},{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]}},{key:"isGeometryObscured",value:function(t,e){return function(t,e,r){var n=r.getContainer().getBoundingClientRect(),a=b(P(t),4),o=a[0],i=a[1],l=a[2],s=a[3],u=[r.project([o,i]),r.project([o,s]),r.project([l,i]),r.project([l,s])],c=Math.min.apply(Math,v(u.map(function(t){return t.x}))),h=Math.max.apply(Math,v(u.map(function(t){return t.x}))),f=Math.min.apply(Math,v(u.map(function(t){return t.y}))),p=Math.max.apply(Math,v(u.map(function(t){return t.y}))),y=e.left-n.left,d=e.top-n.top,g=e.right-n.left,m=e.bottom-n.top;return c<g&&h>y&&f<m&&p>d}(t,e,this.map)}}],e&&ot(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,l}()}}]);
2
+ "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[772],{662(t,e,r){r.r(e),r.d(e,{default:()=>lt});var n=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 r=t.getCanvas();if(r&&(this.target===r||r.contains(this.target)))return}e.call(this)}}var l=function(t,e){var r=null,n=function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){t.apply(void 0,a)},e)};return n.cancel=function(){r&&(clearTimeout(r),r=null)},n};function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function u(t){var e=t.map,r=t.events,n=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 n.emit(t,e)},y=function(){return p(r.MAP_LOADED)};e.on("load",y),c.push(["load",y]),e.once("idle",function(){return p(r.MAP_FIRST_IDLE,f())});var d=function(){return p(r.MAP_MOVE_START)};e.on("movestart",d),c.push(["movestart",d]);var g=l(function(){p(r.MAP_MOVE_END,f())},500);e.on("moveend",g),c.push(["moveend",g]),h.push(g);var m,v,b=(m=function(){p(r.MAP_MOVE,f())},v=0,function(){var t=Date.now();t-v>=10&&(v=t,m.apply(void 0,arguments))});e.on("zoom",b),c.push(["zoom",b]),h.push(b);var M=function(){return p(r.MAP_RENDER)};e.on("render",M),c.push(["render",M]);var w=l(function(){p(r.MAP_DATA_CHANGE,f())},500);e.on("styledata",w),c.push(["styledata",w]),h.push(w);var S=function(){return p(r.MAP_STYLE_CHANGE)};e.on("style.load",S),c.push(["style.load",S]);var x=function(t){return p(r.MAP_CLICK,{point:t.point,coords:[t.lngLat.lng,t.lngLat.lat]})};return e.on("click",x),c.push(["click",x]),{remove:function(){h.forEach(function(t){return t.cancel()}),c.forEach(function(t){var r,n,a=(n=2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(r,n)||function(t,e){if(t){if("string"==typeof t)return s(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(r,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.")}()),o=a[0],i=a[1];return e.off(o,i)})}}}function c(t){var e=t.map,r=t.events,n=t.eventBus,a=function(t){e.once("style.load",function(){n.emit(r.MAP_STYLE_CHANGE,{mapStyleId:t.id})}),e.setStyle(t.url,{diff:!1})},o=function(t){e.setPixelRatio(t)};return n.on(r.MAP_SET_STYLE,a),n.on(r.MAP_SET_PIXEL_RATIO,o),{remove:function(){n.off(r.MAP_SET_STYLE,a),n.off(r.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 r=null;switch(e.length){case 3:r=e[0]/1+e[1]/60+e[2]/3600;break;case 2:r=e[0]/1+e[1]/60;break;case 1:r=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(r=-r),Number(r)}static toDms(t,e="d",r=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===r)switch(e){case"d":case"deg":r=4;break;case"dm":case"deg+min":r=2;break;case"dms":case"deg+min+sec":r=0;break;default:e="d",r=4}t=Math.abs(t);let n=null,a=null,o=null,i=null;switch(e){default:case"d":case"deg":a=t.toFixed(r),a<100&&(a="0"+a),a<10&&(a="0"+a),n=a+"°";break;case"dm":case"deg+min":a=Math.floor(t),o=(60*t%60).toFixed(r),60==o&&(o=(0).toFixed(r),a++),a=("000"+a).slice(-3),o<10&&(o="0"+o),n=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(r),60==i&&(i=(0).toFixed(r),o++),60==o&&(o=0,a++),a=("000"+a).slice(-3),o=("00"+o).slice(-2),i<10&&(i="0"+i),n=a+"°"+f.separator+o+"′"+f.separator+i+"″"}return n}static toLat(t,e,r){const n=f.toDms(f.wrap90(t),e,r);return null===n?"–":n.slice(1)+f.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=f.toDms(f.wrap180(t),e,r);return null===n?"–":n+f.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=f.toDms(f.wrap360(t),e,r);return null===n?"–":n.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(r.thousands,"⁜").replace(r.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",r.decimal).replace("⁜",r.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=f.wrap360(t);const r=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*r/360)%r*16/r]}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,y=Math.PI;class d{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=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,r;if(2==t.length&&([e,r]=t,e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r)),isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,r]=t[0].split(","),e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r)),isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t[0]}’`);if(1==t.length&&"object"==typeof t[0]){const n=t[0];if("Point"==n.type&&Array.isArray(n.coordinates)?[r,e]=n.coordinates:(null!=n.latitude&&(e=n.latitude),null!=n.lat&&(e=n.lat),null!=n.longitude&&(r=n.longitude),null!=n.lng&&(r=n.lng),null!=n.lon&&(r=n.lon),e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r))),isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${t.toString()}’`);return new d(e,r)}distanceTo(t,e=6371e3){if(t instanceof d||(t=d.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const r=e,n=this.lat.toRadians(),a=this.lon.toRadians(),o=t.lat.toRadians(),i=o-n,l=t.lon.toRadians()-a,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(o)*Math.sin(l/2)*Math.sin(l/2);return r*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}initialBearingTo(t){if(t instanceof d||(t=d.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),r=t.lat.toRadians(),n=(t.lon-this.lon).toRadians(),a=Math.cos(e)*Math.sin(r)-Math.sin(e)*Math.cos(r)*Math.cos(n),o=Math.sin(n)*Math.cos(r),i=Math.atan2(o,a).toDegrees();return p.wrap360(i)}finalBearingTo(t){t instanceof d||(t=d.parse(t));const e=t.initialBearingTo(this)+180;return p.wrap360(e)}midpointTo(t){t instanceof d||(t=d.parse(t));const e=this.lat.toRadians(),r=this.lon.toRadians(),n=t.lat.toRadians(),a=(t.lon-this.lon).toRadians(),o=Math.cos(e),i=Math.sin(e),l={x:o+Math.cos(n)*Math.cos(a),y:0+Math.cos(n)*Math.sin(a),z:i+Math.sin(n)},s=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),u=r+Math.atan2(l.y,l.x),c=s.toDegrees(),h=u.toDegrees();return new d(c,h)}intermediatePointTo(t,e){if(t instanceof d||(t=d.parse(t)),this.equals(t))return new d(this.lat,this.lon);const r=this.lat.toRadians(),n=this.lon.toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=a-r,l=o-n,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(r)*Math.cos(a)*Math.sin(l/2)*Math.sin(l/2),u=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)),c=Math.sin((1-e)*u)/Math.sin(u),h=Math.sin(e*u)/Math.sin(u),f=c*Math.cos(r)*Math.cos(n)+h*Math.cos(a)*Math.cos(o),p=c*Math.cos(r)*Math.sin(n)+h*Math.cos(a)*Math.sin(o),y=c*Math.sin(r)+h*Math.sin(a),g=Math.atan2(y,Math.sqrt(f*f+p*p)),m=Math.atan2(p,f),v=g.toDegrees(),b=m.toDegrees();return new d(v,b)}destinationPoint(t,e,r=6371e3){const n=t/r,a=Number(e).toRadians(),o=this.lat.toRadians(),i=this.lon.toRadians(),l=Math.sin(o)*Math.cos(n)+Math.cos(o)*Math.sin(n)*Math.cos(a),s=Math.asin(l),u=Math.sin(a)*Math.sin(n)*Math.cos(o),c=Math.cos(n)-Math.sin(o)*l,h=i+Math.atan2(u,c),f=s.toDegrees(),p=h.toDegrees();return new d(f,p)}static intersection(t,e,r,n){if(t instanceof d||(t=d.parse(t)),r instanceof d||(r=d.parse(r)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(n))throw new TypeError(`invalid brng2 ‘${n}’`);const a=t.lat.toRadians(),o=t.lon.toRadians(),i=r.lat.toRadians(),l=r.lon.toRadians(),s=Number(e).toRadians(),u=Number(n).toRadians(),c=i-a,h=l-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 d(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)),m=Math.acos(Math.min(Math.max(p,-1),1)),v=Math.acos(Math.min(Math.max(g,-1),1)),b=s-(Math.sin(l-o)>0?m:2*y-m),M=(Math.sin(l-o)>0?2*y-v:v)-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),x=Math.asin(Math.min(Math.max(Math.sin(a)*Math.cos(S)+Math.cos(a)*Math.sin(S)*Math.cos(s),-1),1)),P=o+Math.atan2(Math.sin(s)*Math.sin(S)*Math.cos(a),Math.cos(S)-Math.sin(a)*Math.sin(x)),N=x.toDegrees(),E=P.toDegrees();return new d(N,E)}crossTrackDistanceTo(t,e,r=6371e3){t instanceof d||(t=d.parse(t)),e instanceof d||(e=d.parse(e));const n=r;if(this.equals(t))return 0;const a=t.distanceTo(this,n)/n,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(a)*Math.sin(o-i))*n}alongTrackDistanceTo(t,e,r=6371e3){t instanceof d||(t=d.parse(t)),e instanceof d||(e=d.parse(e));const n=r;if(this.equals(t))return 0;const a=t.distanceTo(this,n)/n,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians(),l=Math.asin(Math.sin(a)*Math.sin(o-i));return Math.acos(Math.cos(a)/Math.abs(Math.cos(l)))*Math.sign(Math.cos(i-o))*n}maxLatitude(t){const e=Number(t).toRadians(),r=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(r))).toDegrees()}static crossingParallels(t,e,r){if(t.equals(e))return null;const n=Number(r).toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=e.lat.toRadians(),l=e.lon.toRadians()-o,s=Math.sin(a)*Math.cos(i)*Math.cos(n)*Math.sin(l),u=Math.sin(a)*Math.cos(i)*Math.cos(n)*Math.cos(l)-Math.cos(a)*Math.sin(i)*Math.cos(n),c=Math.cos(a)*Math.cos(i)*Math.sin(n)*Math.sin(l);if(c*c>s*s+u*u)return null;const h=Math.atan2(-u,s),f=Math.acos(c/Math.sqrt(s*s+u*u)),y=o+h+f,d=(o+h-f).toDegrees(),g=y.toDegrees();return{lon1:p.wrap180(d),lon2:p.wrap180(g)}}rhumbDistanceTo(t,e=6371e3){t instanceof d||(t=d.parse(t));const r=e,n=this.lat.toRadians(),a=t.lat.toRadians(),o=a-n;let i=Math.abs(t.lon-this.lon).toRadians();Math.abs(i)>y&&(i=i>0?-(2*y-i):2*y+i);const l=Math.log(Math.tan(a/2+y/4)/Math.tan(n/2+y/4)),s=Math.abs(l)>1e-11?o/l:Math.cos(n);return Math.sqrt(o*o+s*s*i*i)*r}rhumbBearingTo(t){if(t instanceof d||(t=d.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),r=t.lat.toRadians();let n=(t.lon-this.lon).toRadians();Math.abs(n)>y&&(n=n>0?-(2*y-n):2*y+n);const a=Math.log(Math.tan(r/2+y/4)/Math.tan(e/2+y/4)),o=Math.atan2(n,a).toDegrees();return p.wrap360(o)}rhumbDestinationPoint(t,e,r=6371e3){const n=this.lat.toRadians(),a=this.lon.toRadians(),o=Number(e).toRadians(),i=t/r,l=i*Math.cos(o);let s=n+l;Math.abs(s)>y/2&&(s=s>0?y-s:-y-s);const u=Math.log(Math.tan(s/2+y/4)/Math.tan(n/2+y/4)),c=Math.abs(u)>1e-11?l/u:Math.cos(n),h=a+i*Math.sin(o)/c,f=s.toDegrees(),p=h.toDegrees();return new d(f,p)}rhumbMidpointTo(t){t instanceof d||(t=d.parse(t));const e=this.lat.toRadians();let r=this.lon.toRadians();const n=t.lat.toRadians(),a=t.lon.toRadians();Math.abs(a-r)>y&&(r+=2*y);const o=(e+n)/2,i=Math.tan(y/4+e/2),l=Math.tan(y/4+n/2),s=Math.tan(y/4+o/2);let u=((a-r)*Math.log(s)+r*Math.log(l)-a*Math.log(i))/Math.log(l/i);isFinite(u)||(u=(r+a)/2);const c=o.toDegrees(),h=u.toDegrees();return new d(c,h)}static areaOf(t,e=6371e3){const r=e,n=t[0].equals(t[t.length-1]);n||t.push(t[0]);const a=t.length-1;let o=0;for(let e=0;e<a;e++){const r=t[e].lat.toRadians(),n=t[e+1].lat.toRadians(),a=(t[e+1].lon-t[e].lon).toRadians();o+=2*Math.atan2(Math.tan(a/2)*(Math.tan(r/2)+Math.tan(n/2)),1+Math.tan(r/2)*Math.tan(n/2))}(function(t){let e=0,r=t[0].initialBearingTo(t[1]);for(let n=0;n<t.length-1;n++){const a=t[n].initialBearingTo(t[n+1]),o=t[n].finalBearingTo(t[n+1]);e+=(a-r+540)%360-180,e+=(o-a+540)%360-180,r=o}return e+=(t[0].initialBearingTo(t[1])-r+540)%360-180,Math.abs(e)<90})(t)&&(o=Math.abs(o)-2*y);const i=Math.abs(o*r*r);return n||t.pop(),i}equals(t){return t instanceof d||(t=d.parse(t)),!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON)}toGeoJSON(){return{type:"Point",coordinates:[this.lon,this.lat]}}toString(t="d",e=void 0){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);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,r){if(null!==t)for(var n,a,o,i,l,s,u,c,h=0,f=0,p=t.type,y="FeatureCollection"===p,d="Feature"===p,m=y?t.features.length:1,v=0;v<m;v++){l=(c=!!(u=y?t.features[v].geometry:d?t.geometry:t)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var b=0;b<l;b++){var M=0,w=0;if(null!==(i=c?u.geometries[b]:u)){s=i.coordinates;var S=i.type;switch(h=!r||"Polygon"!==S&&"MultiPolygon"!==S?0:1,S){case null:break;case"Point":if(!1===e(s,f,v,M,w))return!1;f++,M++;break;case"LineString":case"MultiPoint":for(n=0;n<s.length;n++){if(!1===e(s[n],f,v,M,w))return!1;f++,"MultiPoint"===S&&M++}"LineString"===S&&M++;break;case"Polygon":case"MultiLineString":for(n=0;n<s.length;n++){for(a=0;a<s[n].length-h;a++){if(!1===e(s[n][a],f,v,M,w))return!1;f++}"MultiLineString"===S&&M++,"Polygon"===S&&w++}"Polygon"===S&&M++;break;case"MultiPolygon":for(n=0;n<s.length;n++){for(w=0,a=0;a<s[n].length;a++){for(o=0;o<s[n][a].length-h;o++){if(!1===e(s[n][a][o],f,v,M,w))return!1;f++}w++}M++}break;case"GeometryCollection":for(n=0;n<i.geometries.length;n++)if(!1===g(i.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var m=function(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const r=[1/0,1/0,-1/0,-1/0];return g(t,t=>{r[0]>t[0]&&(r[0]=t[0]),r[1]>t[1]&&(r[1]=t[1]),r[2]<t[0]&&(r[2]=t[0]),r[3]<t[1]&&(r[3]=t[1])}),r};function v(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||M(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 b(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||M(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 M(t,e){if(t){if("string"==typeof t)return w(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(t,e):void 0}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var S=function(t,e){var r=b(t,2),n=r[0],a=r[1],o=b(e,2),i=o[0],l=o[1],s=new d(a,n),u=new d(l,i);return s.distanceTo(u)},x=function(t){var e=t/1609.344;if(e<.5)return"".concat(Math.round(t),"m");if(e<10){var r=Number.parseFloat(e.toFixed(1)),n=1===r?"mile":"miles";return"".concat(r," ").concat(n)}var a=Math.round(e);return"".concat(a," miles")},P=function(t){return m(t)};function N(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return E(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(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 E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function O(t){return O="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},O(t)}function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function j(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach(function(e){T(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function T(t,e,r){return(e=function(t){var e=function(t){if("object"!=O(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=O(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==O(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var R="highlighted-label";function k(t,e){if("number"==typeof t)return t;if(!Array.isArray(t)||"interpolate"!==t[0])return function(t,e){var r=t.stops;if(r.length<2)return r.length>0?r[0][1]:0;for(var n=r[0],a=r[r.length-1],o=1;o<r.length;o++){var i=r[o];if(i[0]>e){a=i,n=r[o-1];break}n=r[o-1],a=i}var l=N(n,2),s=l[0],u=l[1],c=N(a,2),h=c[0],f=c[1];return e<=s?u:e>=h?f:u+(e-s)/(h-s)*(f-u)}(t,e);var r,n=function(t){if(Array.isArray(t))return t}(r=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return L(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?L(t,e):void 0}}(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.")}(),a=n[2],o=L(n).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 l=o[i],s=o[i+1],u=o[i+2],c=o[i+3];if(e<=l)return s;if(e<=u)return s+(e-l)/(u-l)*(c-s)}return o[o.length-1]}function I(t,e){if(e.highlightLayerId&&t.getLayer(e.highlightLayerId)){try{t.removeLayer(e.highlightLayerId)}catch(t){}e.highlightLayerId=null,e.highlightedExpr=null}}function D(t,e,r){var n,a,o,i;if(null!=e&&null!==(n=e.feature)&&void 0!==n&&n.layer){I(t,r);var l=e.feature,s=e.layer;r.highlightLayerId="highlight-".concat(s.id);var u=l.id,c=l.type,h=l.properties,f=l.geometry;t.getSource(R).setData({id:u,type:c,properties:h,geometry:f}),r.highlightedExpr=s.layout["text-size"];var p=t.getZoom(),y=(a=s,o=1.5*k(r.highlightedExpr,p),i=r.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"},{id:"highlight-".concat(a.id),type:a.type,source:R,layout:j(j({},a.layout),{},{"text-size":o,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:j(j({},a.paint),{},{"text-color":i.text,"text-halo-color":i.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})});t.addLayer(y),t.moveLayer(r.highlightLayerId)}}function _(t){t.getSource(R)||t.addSource(R,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function C(t){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){return t.setLayoutProperty(e.id,"symbol-placement","line-center")})}function B(t,e,r,n){var a={isDarkStyle:"dark"===e,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function o(){var e=t.getStyle().layers.filter(function(t){return"symbol"===t.type}),r=t.queryRenderedFeatures({layers:e.map(function(t){return t.id})});a.labels=function(t,e,r){return e.flatMap(function(e){var n,a,o,i,l="string"==typeof(a=null===(n=e.layout)||void 0===n?void 0:n["text-field"])?null===(o=/^{(.+)}$/.exec(a))||void 0===o?void 0:o[1]:Array.isArray(a)?null===(i=a.find(function(t){return Array.isArray(t)&&"get"===t[0]}))||void 0===i?void 0:i[1]:null;return l?r.filter(function(t){var r;return t.layer.id===e.id&&(null===(r=t.properties)||void 0===r?void 0:r[l])}).map(function(r){return function(t,e,r,n){var a=function(t){var e=t.type,r=t.coordinates;if("Point"===e)return r;if("MultiPoint"===e)return r[0];if(e.includes("LineString")){var n="LineString"===e?r:r[0];return[(n[0][0]+n[n.length-1][0])/2,(n[0][1]+n[n.length-1][1])/2]}if(e.includes("Polygon")){var a="Polygon"===e?r[0]:r[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}(t.geometry);if(!a)return null;var o=n.project({lng:a[0],lat:a[1]});return{text:t.properties[r],x:o.x,y:o.y,feature:t,layer:e}}(r,e,l,t)}).filter(Boolean):[]})}(t,e,r)}function i(){if(o(),!a.labels.length)return null;var e=t.project(t.getCenter()),r=function(t,e){var r;return null===(r=t.reduce(function(t,r){var n=Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2);return!t||n<t.dist?{label:r,dist:n}:t},null))||void 0===r?void 0:r.label}(a.labels,e);return a.currentPixel={x:r.x,y:r.y},D(t,r,a),"".concat(r.text," (").concat(r.layer.id,")")}return C(t),_(t),null==n||n.on(r.MAP_SET_STYLE,function(e){t.once("styledata",function(){return t.once("idle",function(){C(t),_(t),a.isDarkStyle="dark"===(null==e?void 0:e.mapColorScheme)})})}),t.on("zoom",function(){if(a.highlightLayerId&&a.highlightedExpr){var e=k(a.highlightedExpr,t.getZoom());t.setLayoutProperty(a.highlightLayerId,"text-size",1.5*e)}}),function(t){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])})}(t),{refreshLabels:o,highlightNextLabel:function(e){if(o(),!a.labels.length)return null;if(!a.currentPixel)return i();var r=function(t,e){if(!e.currentPixel)return null;var r=e.labels.map(function(t,e){return{pixel:[t.x,t.y],index:e}}).filter(function(t){return t.pixel[0]!==e.currentPixel.x||t.pixel[1]!==e.currentPixel.y});if(!r.length)return null;var n=r.map(function(t){return t.pixel}),a=function(t,e,r){var n=b(e,2),a=n[0],o=n[1],i=r.filter(function(e){var r=b(e,2),n=r[0],i=r[1];return(n!==a||i!==o)&&function(t,e,r){switch(t){case"ArrowUp":return r<0&&Math.abs(r)>=Math.abs(e);case"ArrowDown":return r>0&&Math.abs(r)>=Math.abs(e);case"ArrowLeft":return e<0&&Math.abs(e)>Math.abs(r);case"ArrowRight":return e>0&&Math.abs(e)>Math.abs(r);default:return!1}}(t,n-a,i-o)});if(!i.length)return r.findIndex(function(t){return t[0]===a&&t[1]===o});var l=-1,s=1/0;return i.forEach(function(t){var e=t[0]-a,n=t[1]-o,i=e*e+n*n;i<s&&(s=i,l=r.indexOf(t))}),l}(t,[e.currentPixel.x,e.currentPixel.y],n);return(null==a||a<0||a>=r.length)&&(a=0),e.labels[r[a].index]}(e,a);return r?(a.currentPixel={x:r.x,y:r.y},D(t,r,a),"".concat(r.text," (").concat(r.layer.id,")")):null},highlightLabelAtCenter:i,clearHighlightedLabel:function(){return I(t,a)}}}function F(t){return F="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},F(t)}function $(t){return function(t){if(Array.isArray(t))return q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||z(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 z(t,e){if(t){if("string"==typeof t)return q(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?q(t,e):void 0}}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Z(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function G(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Z(Object(r),!0).forEach(function(e){W(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Z(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function W(t,e,r){return(e=function(t){var e=function(t){if("object"!=F(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=F(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==F(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var H=function(t,e,r,n,a,o,i){t.getLayer(e)||t.addLayer(G(G({id:e,type:r,source:n},a&&{"source-layer":a}),{},{paint:o})),Object.entries(o).forEach(function(r){var n,a,o=(a=2,function(t){if(Array.isArray(t))return t}(n=r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(n,a)||z(n,a)||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.")}()),i=o[0],l=o[1];t.setPaintProperty(e,i,l)}),t.setFilter(e,i),t.moveLayer(e)};function U(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Y(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Y(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 Y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var V=function(t,e,r){var n=Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2);if(0===n)return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2);var a=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return a=Math.max(0,Math.min(1,a)),Math.pow(t.x-(e.x+a*(r.x-e.x)),2)+Math.pow(t.y-(e.y+a*(r.y-e.y)),2)},J=["container","padding","mapStyle","mapSize","center","zoom","bounds","pixelRatio"];function K(t){return K="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},K(t)}function X(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function o(r,n,a,o){var s=n&&n.prototype instanceof l?n:l,u=Object.create(s.prototype);return Q(u,"_invoke",function(r,n,a){var o,l,s,u=0,c=a||[],h=!1,f={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return o=e,l=0,s=t,f.n=r,i}};function p(r,n){for(l=r,s=n,e=0;!h&&u&&!a&&e<c.length;e++){var a,o=c[e],p=f.p,y=o[2];r>3?(a=y===n)&&(s=o[(l=o[4])?5:(l=3,3)],o[4]=o[5]=t):o[0]<=p&&((a=r<2&&p<o[1])?(l=0,f.v=n,f.n=o[1]):p<y&&(a=r<3||o[0]>n||n>y)&&(o[4]=r,o[5]=n,f.n=y,l=0))}if(a||r>1)return i;throw h=!0,n}return function(a,c,y){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,y),l=c,s=y;(e=l<2?t:s)||!h;){o||(l?l<3?(l>1&&(f.n=-1),p(l,s)):f.n=s:f.v=s);try{if(u=2,o){if(l||(a="next"),e=o[a]){if(!(e=e.call(o,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,l<2&&(l=0)}else 1===l&&(e=o.return)&&e.call(o),l<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),l=1);o=t}else if((e=(h=f.n<0)?s:r.call(n,f))!==i)break}catch(e){o=t,l=1,s=e}finally{u=1}}return{value:e,done:h}}}(r,a,o),!0),u}var i={};function l(){}function s(){}function u(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(Q(e={},n,function(){return this}),e),h=u.prototype=l.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Q(t,a,"GeneratorFunction")),t.prototype=Object.create(h),t}return s.prototype=u,Q(h,"constructor",u),Q(u,"constructor",s),s.displayName="GeneratorFunction",Q(u,a,"GeneratorFunction"),Q(h),Q(h,a,"Generator"),Q(h,n,function(){return this}),Q(h,"toString",function(){return"[object Generator]"}),(X=function(){return{w:o,m:f}})()}function Q(t,e,r,n){var a=Object.defineProperty;try{a({},"",{})}catch(t){a=0}Q=function(t,e,r,n){function o(e,r){Q(t,e,function(t){return this._invoke(e,r,t)})}e?a?a(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(o("next",0),o("throw",1),o("return",2))},Q(t,e,r,n)}function tt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function et(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?tt(Object(r),!0).forEach(function(e){rt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):tt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function rt(t,e,r){return(e=it(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nt(t,e){if(null==t)return{};var r,n,a=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}function at(t,e,r,n,a,o,i){try{var l=t[o](i),s=l.value}catch(t){return void r(t)}l.done?e(s):Promise.resolve(s).then(n,a)}function ot(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,it(n.key),n)}}function it(t){var e=function(t){if("object"!=K(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=K(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==K(e)?e:e+""}var lt=function(){return t=function t(e){var r=e.mapFramework,n=e.mapProviderConfig,o=void 0===n?{}:n,i=e.events,l=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.maplibreModule=r,this.events=i,this.eventBus=l,this.capabilities={supportedShortcuts:a,supportsMapSizes:!0},Object.assign(this,o)},e=[{key:"initMap",value:(r=X().m(function t(e){var r,n,a,l,s,h,f,p,y,d,g,m,v,b=this;return X().w(function(t){for(;;)switch(t.n){case 0:r=e.container,n=e.padding,a=e.mapStyle,l=e.mapSize,s=e.center,h=e.zoom,f=e.bounds,p=e.pixelRatio,y=nt(e,J),this.mapStyleId=null==a?void 0:a.id,this.mapSize=l,d=this.maplibreModule.Map,g=this.events,m=this.eventBus,(v=new d(et(et({},y),{},{container:r,style:null==a?void 0:a.url,pixelRatio:p,padding:n,center:s,zoom:h,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}))).touchZoomRotate.disableRotation(),this.map=v,this.map.setPadding(n),f&&v.fitBounds(f,{duration:0}),i(v),o(v),u({map:v,events:g,eventBus:m,getCenter:this.getCenter.bind(this),getZoom:this.getZoom.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),c({mapProvider:this,map:v,events:g,eventBus:m}),v.on("load",function(){b.labelNavigator=B(v,null==a?void 0:a.mapColorScheme,g,m)}),this.eventBus.emit(g.MAP_READY,{map:this.map,mapStyleId:this.mapStyleId,mapSize:this.mapSize,crs:this.crs});case 1:return t.a(2)}},t,this)}),l=function(){var t=this,e=arguments;return new Promise(function(n,a){var o=r.apply(t,e);function i(t){at(o,n,a,i,l,"next",t)}function l(t){at(o,n,a,i,l,"throw",t)}i(void 0)})},function(t){return l.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,r=t.zoom;this.map.flyTo({center:e||this.getCenter(),zoom:r||this.getZoom(),duration:n})}},{key:"zoomIn",value:function(t){this.map.easeTo({zoom:this.getZoom()+t,duration:n})}},{key:"zoomOut",value:function(t){this.map.easeTo({zoom:this.getZoom()-t,duration:n})}},{key:"panBy",value:function(t){this.map.panBy(t,{duration:n})}},{key:"fitToBounds",value:function(t){var e=Array.isArray(t)?t:P(t);this.map.fitBounds(e,{duration:n})}},{key:"setPadding",value:function(t){this.map.setPadding(t)}},{key:"updateHighlightedFeatures",value:function(t,e){return function(t){var e=t.LngLatBounds,r=t.map,n=t.selectedFeatures,a=t.stylesMap;if(!r)return null;var o=function(t,e){var r={};return null==e||e.forEach(function(e){var n=e.featureId,a=e.layerId,o=e.idProperty,i=e.geometry,l=t.getLayer(a);if(l){var s=l.source;r[s]||(r[s]={ids:new Set,fillIds:new Set,idProperty:o,layerId:a,hasFillGeometry:!1}),!i||"Polygon"!==i.type&&"MultiPolygon"!==i.type||(r[s].hasFillGeometry=!0,r[s].fillIds.add(n)),r[s].ids.add(n)}}),r}(r,n),i=[],l=new Set(Object.keys(o)),s=r._highlightedSources||new Set;return function(t,e,r){e.forEach(function(e){if(!r.has(e)){var n="highlight-".concat(e);["".concat(n,"-fill"),"".concat(n,"-line")].forEach(function(e){t.getLayer(e)&&t.setFilter(e,["==","id",""])})}})}(r,s,l),r._highlightedSources=l,l.forEach(function(t){var e=o[t],n=e.ids,l=e.fillIds,s=e.idProperty,u=e.layerId,c=e.hasFillGeometry,h=r.getLayer(u),f=h.sourceLayer,p=c?"fill":h.type,y="highlight-".concat(t),d=a[u],g=d.stroke,m=d.strokeWidth,v=d.fill,b=s?["get",s]:["id"],M=["in",b,["literal",$(n)]],w=["in",b,["literal",$(l)]],S={"line-color":g,"line-width":m};"fill"===p&&(H(r,"".concat(y,"-fill"),"fill",t,f,{"fill-color":v},w),H(r,"".concat(y,"-line"),"line",t,f,S,M)),"line"===p&&(r.getLayer("".concat(y,"-fill"))&&r.setFilter("".concat(y,"-fill"),["==","id",""]),H(r,"".concat(y,"-line"),"line",t,f,S,M)),i.push.apply(i,$(r.queryRenderedFeatures({layers:[u]}).filter(function(t){var e;return n.has(s?null===(e=t.properties)||void 0===e?void 0:e[s]:t.id)})))}),function(t,e){if(!e.length)return null;var r=new t;return e.forEach(function(t){var e=function(t){return"number"==typeof t[0]?r.extend(t):t.forEach(e)};e(t.geometry.coordinates)}),[r.getWest(),r.getSouth(),r.getEast(),r.getNorth()]}(e,i)}({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,e){return function(t,e){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).radius,n=void 0===r?10:r,a=[[e.x-n,e.y-n],[e.x+n,e.y+n]],o=t.queryRenderedFeatures(a);if(0===o.length)return[];var i=[];o.forEach(function(t){!1===i.includes(t.layer.id)&&i.push(t.layer.id)});for(var l=new Set,s=[],u=o.length-1;u>=0;u--){var c=o[u],h=void 0===c.id?JSON.stringify(c.properties):c.id;!1===l.has(h)&&(l.add(h),s.push(c))}var f=t.unproject(e),p=[f.lng,f.lat];return s.map(function(r){var n=0,a=r.geometry.type,o=function(t,e,r){var n=r.coordinates,a=r.type,o=1/0,i=function(e){return t.project(e)},l=function(t){for(var r=0;r<t.length-1;r++){var n=V(e,i(t[r]),i(t[r+1]));n<o&&(o=n)}};if("Point"===a){var s=i(n);o=Math.pow(e.x-s.x,2)+Math.pow(e.y-s.y,2)}else"LineString"===a||"MultiPoint"===a?"LineString"===a?l(n):n.forEach(function(t){var r=i(t),n=Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2);n<o&&(o=n)}):"Polygon"===a||"MultiLineString"===a?n.forEach(l):"MultiPolygon"===a&&n.forEach(function(t){return t.forEach(l)});return o}(t,e,r.geometry);if(n+=1e6*i.indexOf(r.layer.id),a.includes("Polygon")){var l=("Polygon"===a?[r.geometry.coordinates]:r.geometry.coordinates).some(function(t){return function(t,e){for(var r=U(t,2),n=r[0],a=r[1],o=!1,i=0,l=e.length-1;i<e.length;l=i,i++){var s=U(e[i],2),u=s[0],c=s[1],h=U(e[l],2),f=h[0],p=h[1];c>a!=p>a&&n<(f-u)*(a-c)/(p-c)+u&&(o=!o)}return o}(p,t[0])});!0===l?n-=5e5:n+=1e5}return{f:r,score:n+=o}}).sort(function(t,e){return t.score-e.score}).map(function(t){return t.f})}(this.map,t,e)}},{key:"getAreaDimensions",value:function(){return function(t){var e,r,n,a;if(t&&"function"==typeof t.getWest)e=t.getWest(),r=t.getSouth(),n=t.getEast(),a=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";var o=b(t,2),i=b(o[0],2);e=i[0],r=i[1];var l=b(o[1],2);n=l[0],a=l[1]}var s=S([e,r],[n,r]),u=S([e,r],[e,a]),c=x(s),h=x(u);return"".concat(h," by ").concat(c)}((t=this.maplibreModule.LngLatBounds,e=this.map,r=e.getContainer().getBoundingClientRect(),n=r.width,a=r.height,o=e.getPadding(),i=[o.left,a-o.bottom],l=[n-o.right,o.top],new t(e.unproject(i),e.unproject(l))));var t,e,r,n,a,o,i,l}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var r=b(t,2),n=r[0],a=r[1],o=b(e,2),i=o[0],l=o[1],s=l-a,u=i-n,c=[];if(Math.abs(s)>1e-4){var h=Math.round(S([n,a],[n,l]));c.push("".concat(s>0?"north":"south"," ").concat(x(h)))}if(Math.abs(u)>1e-4){var f=Math.round(S([n,a],[i,a]));c.push("".concat(u>0?"east":"west"," ").concat(x(f)))}return c.join(", ")}(t,e)}},{key:"getResolution",value:function(){return t=this.map.getCenter(),e=this.map.getZoom(),r=t.lat,n=Math.pow(2,e),40075016.686*Math.cos(r*Math.PI/180)/(512*n);var t,e,r,n}},{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]}},{key:"isGeometryObscured",value:function(t,e){return function(t,e,r){var n=r.getContainer().getBoundingClientRect(),a=b(P(t),4),o=a[0],i=a[1],l=a[2],s=a[3],u=[r.project([o,i]),r.project([o,s]),r.project([l,i]),r.project([l,s])],c=Math.min.apply(Math,v(u.map(function(t){return t.x}))),h=Math.max.apply(Math,v(u.map(function(t){return t.x}))),f=Math.min.apply(Math,v(u.map(function(t){return t.y}))),p=Math.max.apply(Math,v(u.map(function(t){return t.y}))),y=e.left-n.left,d=e.top-n.top,g=e.right-n.left,m=e.bottom-n.top;return c<g&&h>y&&f<m&&p>d}(t,e,this.map)}}],e&&ot(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,l}()}}]);
@@ -50,4 +50,4 @@ describe('attachAppEvents', () => {
50
50
  expect(eventBus.off).toHaveBeenCalledWith(events.MAP_SET_STYLE, styleHandler)
51
51
  expect(eventBus.off).toHaveBeenCalledWith(events.MAP_SET_PIXEL_RATIO, pixelHandler)
52
52
  })
53
- })
53
+ })
@@ -14,7 +14,7 @@ import { getWebGL } from './utils/detectWebgl.js'
14
14
  *
15
15
  * @returns {boolean} true if modern syntax is supported, false otherwise
16
16
  */
17
- function supportsModernMaplibre() {
17
+ function supportsModernMaplibre () {
18
18
  return typeof ''.replaceAll === 'function'
19
19
  }
20
20
 
@@ -6,12 +6,8 @@ jest.mock('maplibre-gl', () => ({ VERSION: '3.x' }))
6
6
  jest.mock('./maplibreProvider.js', () => ({ default: class MockProvider {} }))
7
7
 
8
8
  describe('createMapLibreProvider', () => {
9
-
10
9
  beforeEach(() => {
11
10
  getWebGL.mockReturnValue({ isEnabled: true, error: null })
12
-
13
- // Ensure modern support by default
14
- String.prototype.replaceAll = jest.fn()
15
11
  })
16
12
 
17
13
  afterEach(() => {
@@ -53,11 +49,13 @@ describe('createMapLibreProvider', () => {
53
49
  })
54
50
 
55
51
  test('checkDeviceCapabilities: no replaceAll support → isSupported false', () => {
52
+ const restoreReplaceAll = String.prototype.replaceAll
56
53
  delete String.prototype.replaceAll
57
54
 
58
55
  const result = createMapLibreProvider().checkDeviceCapabilities()
59
56
 
60
57
  expect(result.isSupported).toBe(false)
58
+ String.prototype.replaceAll = restoreReplaceAll // eslint-disable-line
61
59
  })
62
60
 
63
61
  test('load returns MapProvider, mapFramework, and merged mapProviderConfig', async () => {
@@ -76,4 +74,4 @@ describe('createMapLibreProvider', () => {
76
74
 
77
75
  expect(mapProviderConfig).toEqual({ crs: 'EPSG:4326' })
78
76
  })
79
- })
77
+ })
@@ -31,9 +31,15 @@ describe('attachMapEvents', () => {
31
31
  }
32
32
  eventBus = { emit: jest.fn() }
33
33
  events = {
34
- MAP_LOADED: 'loaded', MAP_FIRST_IDLE: 'firstIdle', MAP_MOVE_START: 'moveStart',
35
- MAP_MOVE_END: 'moveEnd', MAP_MOVE: 'move', MAP_RENDER: 'render',
36
- MAP_DATA_CHANGE: 'dataChange', MAP_STYLE_CHANGE: 'styleChange', MAP_CLICK: 'click'
34
+ MAP_LOADED: 'loaded',
35
+ MAP_FIRST_IDLE: 'firstIdle',
36
+ MAP_MOVE_START: 'moveStart',
37
+ MAP_MOVE_END: 'moveEnd',
38
+ MAP_MOVE: 'move',
39
+ MAP_RENDER: 'render',
40
+ MAP_DATA_CHANGE: 'dataChange',
41
+ MAP_STYLE_CHANGE: 'styleChange',
42
+ MAP_CLICK: 'click'
37
43
  }
38
44
  getCenter = jest.fn(() => [0, 0])
39
45
  getZoom = jest.fn(() => 10)
@@ -62,8 +68,12 @@ describe('attachMapEvents', () => {
62
68
 
63
69
  test('stateful events emit map state', () => {
64
70
  const state = {
65
- center: [0, 0], bounds: [[0, 0], [1, 1]], resolution: 100,
66
- zoom: 10, isAtMaxZoom: false, isAtMinZoom: false
71
+ center: [0, 0],
72
+ bounds: [[0, 0], [1, 1]],
73
+ resolution: 100,
74
+ zoom: 10,
75
+ isAtMaxZoom: false,
76
+ isAtMinZoom: false
67
77
  }
68
78
  map.once.mock.calls.find(([e]) => e === 'idle')[1]()
69
79
  expect(eventBus.emit).toHaveBeenCalledWith(events.MAP_FIRST_IDLE, state)
@@ -67,8 +67,12 @@ describe('MapLibreProvider', () => {
67
67
  })
68
68
 
69
69
  const doInitMap = (p, extra = {}) => p.initMap({
70
- container: 'div', padding: {}, mapStyle: { url: 'style.json', mapColorScheme: 'dark' },
71
- center: [0, 0], zoom: 5, ...extra
70
+ container: 'div',
71
+ padding: {},
72
+ mapStyle: { url: 'style.json', mapColorScheme: 'dark' },
73
+ center: [0, 0],
74
+ zoom: 5,
75
+ ...extra
72
76
  })
73
77
 
74
78
  test('constructor spreads mapProviderConfig and sets capabilities', () => {
@@ -5,7 +5,7 @@
5
5
  * @param {number} zoom - The current map zoom level.
6
6
  * @returns {number} The interpolated size value.
7
7
  */
8
- export function calculateLinearTextSize(expression, zoom) {
8
+ export function calculateLinearTextSize (expression, zoom) {
9
9
  const { stops } = expression
10
10
 
11
11
  if (stops.length < 2) {
@@ -40,10 +40,10 @@ export function calculateLinearTextSize(expression, zoom) {
40
40
 
41
41
  // 3. Perform Simple Linear Interpolation (LERP)
42
42
  // t is the proportion of the distance between Z0 and Z1 that 'zoom' has traveled.
43
- const t = (zoom - Z0) / (Z1 - Z0)
44
-
43
+ const t = (zoom - Z0) / (Z1 - Z0)
44
+
45
45
  // S0 + (S1 - S0) * t
46
46
  const interpolatedSize = S0 + (S1 - S0) * t
47
47
 
48
48
  return interpolatedSize
49
- }
49
+ }
@@ -23,9 +23,9 @@ describe('calculateLinearTextSize', () => {
23
23
 
24
24
  it('works with multiple stops', () => {
25
25
  const expr = { stops: [[0, 5], [5, 15], [10, 25]] }
26
- expect(calculateLinearTextSize(expr, -1)).toBe(5) // below first
27
- expect(calculateLinearTextSize(expr, 12)).toBe(25) // above last
26
+ expect(calculateLinearTextSize(expr, -1)).toBe(5) // below first
27
+ expect(calculateLinearTextSize(expr, 12)).toBe(25) // above last
28
28
  expect(calculateLinearTextSize(expr, 2.5)).toBe(10) // between first two
29
29
  expect(calculateLinearTextSize(expr, 7.5)).toBe(20) // between last two
30
30
  })
31
- })
31
+ })
@@ -60,4 +60,4 @@ describe('getWebGL', () => {
60
60
  error: 'WebGL is supported, but disabled'
61
61
  })
62
62
  })
63
- })
63
+ })
@@ -60,6 +60,7 @@ const applyHighlightLayer = (map, id, type, sourceId, srcLayer, paint, filter) =
60
60
  map.setPaintProperty(id, prop, value)
61
61
  })
62
62
  map.setFilter(id, filter)
63
+ map.moveLayer(id)
63
64
  }
64
65
 
65
66
  const calculateBounds = (LngLatBounds, renderedFeatures) => {
@@ -68,7 +69,7 @@ const calculateBounds = (LngLatBounds, renderedFeatures) => {
68
69
  }
69
70
 
70
71
  const bounds = new LngLatBounds()
71
-
72
+
72
73
  renderedFeatures.forEach(f => {
73
74
  const add = (c) => typeof c[0] === 'number' ? bounds.extend(c) : c.forEach(add)
74
75
  add(f.geometry.coordinates)
@@ -81,7 +82,7 @@ const calculateBounds = (LngLatBounds, renderedFeatures) => {
81
82
  * Update highlighted features using pure filters.
82
83
  * Supports fill + line geometry, multi-source, cleanup, and bounds.
83
84
  */
84
- export function updateHighlightedFeatures({ LngLatBounds, map, selectedFeatures, stylesMap }) {
85
+ export function updateHighlightedFeatures ({ LngLatBounds, map, selectedFeatures, stylesMap }) {
85
86
  if (!map) {
86
87
  return null
87
88
  }
@@ -2,7 +2,7 @@ import { updateHighlightedFeatures } from './highlightFeatures.js'
2
2
 
3
3
  describe('Highlighting Utils', () => {
4
4
  let map
5
- const LngLatBounds = function() {
5
+ const LngLatBounds = function () {
6
6
  this.coords = []
7
7
  this.extend = (c) => this.coords.push(c)
8
8
  this.getWest = () => Math.min(...this.coords.map(c => c[0]))
@@ -16,6 +16,7 @@ describe('Highlighting Utils', () => {
16
16
  _highlightedSources: new Set(['stale']),
17
17
  getLayer: jest.fn(),
18
18
  addLayer: jest.fn(),
19
+ moveLayer: jest.fn(),
19
20
  setFilter: jest.fn(),
20
21
  setPaintProperty: jest.fn(),
21
22
  queryRenderedFeatures: jest.fn()
@@ -60,7 +61,7 @@ describe('Highlighting Utils', () => {
60
61
  // Line 13 verify: map.getLayer returned null and function returned early
61
62
  // Line 49-50 verify: Stale sources filtered out
62
63
  expect(map.setFilter).toHaveBeenCalledWith('highlight-stale-fill', ['==', 'id', ''])
63
-
64
+
64
65
  // Line 124 verify: Clear fill highlight when switching to line geometry
65
66
  expect(map.setFilter).toHaveBeenCalledWith('highlight-s2-fill', ['==', 'id', ''])
66
67
 
@@ -76,7 +77,9 @@ describe('Highlighting Utils', () => {
76
77
  map._highlightedSources = undefined
77
78
  map.getLayer.mockImplementation(id => id === 'l1' ? { source: 's1', type: 'line' } : null)
78
79
  map.queryRenderedFeatures.mockReturnValue([])
79
- updateHighlightedFeatures({ LngLatBounds, map,
80
+ updateHighlightedFeatures({
81
+ LngLatBounds,
82
+ map,
80
83
  selectedFeatures: [{ featureId: 1, layerId: 'l1' }],
81
84
  stylesMap: { l1: { stroke: 'red' } }
82
85
  })
@@ -88,7 +91,9 @@ describe('Highlighting Utils', () => {
88
91
  map._highlightedSources = new Set(['stale', 's1'])
89
92
  map.getLayer.mockImplementation(id => id === 'l1' ? { source: 's1', type: 'line' } : null)
90
93
  map.queryRenderedFeatures.mockReturnValue([])
91
- updateHighlightedFeatures({ LngLatBounds, map,
94
+ updateHighlightedFeatures({
95
+ LngLatBounds,
96
+ map,
92
97
  selectedFeatures: [{ featureId: 1, layerId: 'l1' }],
93
98
  stylesMap: { l1: { stroke: 'red' } }
94
99
  })
@@ -105,7 +110,9 @@ describe('Highlighting Utils', () => {
105
110
  return null
106
111
  })
107
112
  map.queryRenderedFeatures.mockReturnValue([])
108
- updateHighlightedFeatures({ LngLatBounds, map,
113
+ updateHighlightedFeatures({
114
+ LngLatBounds,
115
+ map,
109
116
  selectedFeatures: [
110
117
  { featureId: 1, layerId: 'l1' },
111
118
  { featureId: 2, layerId: 'l2' }
@@ -123,4 +130,4 @@ describe('Highlighting Utils', () => {
123
130
  const res = updateHighlightedFeatures({ LngLatBounds, map, selectedFeatures: [], stylesMap: {} })
124
131
  expect(res).toBeNull()
125
132
  })
126
- })
133
+ })
@@ -4,7 +4,7 @@ import { calculateLinearTextSize } from './calculateLinearTextSize.js'
4
4
  const HIGHLIGHT_SCALE_FACTOR = 1.5
5
5
  const HIGHLIGHT_LABEL_SOURCE = 'highlighted-label'
6
6
 
7
- export function getGeometryCenter(geometry) {
7
+ export function getGeometryCenter (geometry) {
8
8
  const { type, coordinates } = geometry
9
9
  if (type === 'Point') {
10
10
  return coordinates
@@ -24,7 +24,7 @@ export function getGeometryCenter(geometry) {
24
24
  return null
25
25
  }
26
26
 
27
- export function evalInterpolate(expr, zoom) {
27
+ export function evalInterpolate (expr, zoom) {
28
28
  if (typeof expr === 'number') {
29
29
  return expr
30
30
  }
@@ -50,14 +50,14 @@ export function evalInterpolate(expr, zoom) {
50
50
  return stops[stops.length - 1]
51
51
  }
52
52
 
53
- export function getHighlightColors(isDarkStyle) {
53
+ export function getHighlightColors (isDarkStyle) {
54
54
  if (isDarkStyle) {
55
55
  return { text: '#ffffff', halo: '#000000' }
56
56
  }
57
57
  return { text: '#000000', halo: '#ffffff' }
58
58
  }
59
59
 
60
- export function extractTextPropertyName(textField) {
60
+ export function extractTextPropertyName (textField) {
61
61
  if (typeof textField === 'string') {
62
62
  return /^{(.+)}$/.exec(textField)?.[1]
63
63
  }
@@ -67,7 +67,7 @@ export function extractTextPropertyName(textField) {
67
67
  return null
68
68
  }
69
69
 
70
- export function buildLabelFromFeature(feature, layer, propName, map) {
70
+ export function buildLabelFromFeature (feature, layer, propName, map) {
71
71
  const center = getGeometryCenter(feature.geometry)
72
72
  if (!center) {
73
73
  return null
@@ -76,7 +76,7 @@ export function buildLabelFromFeature(feature, layer, propName, map) {
76
76
  return { text: feature.properties[propName], x: projected.x, y: projected.y, feature, layer }
77
77
  }
78
78
 
79
- export function buildLabelsFromLayers(map, symbolLayers, features) {
79
+ export function buildLabelsFromLayers (map, symbolLayers, features) {
80
80
  return symbolLayers.flatMap(layer => {
81
81
  const textField = layer.layout?.['text-field']
82
82
  const propName = extractTextPropertyName(textField)
@@ -90,7 +90,7 @@ export function buildLabelsFromLayers(map, symbolLayers, features) {
90
90
  })
91
91
  }
92
92
 
93
- export function findClosestLabel(labels, centerPoint) {
93
+ export function findClosestLabel (labels, centerPoint) {
94
94
  return labels.reduce((best, label) => {
95
95
  const dist = (label.x - centerPoint.x) ** 2 + (label.y - centerPoint.y) ** 2
96
96
  if (!best || dist < best.dist) {
@@ -100,7 +100,7 @@ export function findClosestLabel(labels, centerPoint) {
100
100
  }, null)?.label
101
101
  }
102
102
 
103
- export function createHighlightLayerConfig(sourceLayer, highlightSize, colors) {
103
+ export function createHighlightLayerConfig (sourceLayer, highlightSize, colors) {
104
104
  return {
105
105
  id: `highlight-${sourceLayer.id}`,
106
106
  type: sourceLayer.type,
@@ -123,18 +123,17 @@ export function createHighlightLayerConfig(sourceLayer, highlightSize, colors) {
123
123
  }
124
124
  }
125
125
 
126
- export function removeHighlightLayer(map, state) {
126
+ export function removeHighlightLayer (map, state) {
127
127
  if (state.highlightLayerId && map.getLayer(state.highlightLayerId)) {
128
128
  try {
129
129
  map.removeLayer(state.highlightLayerId)
130
- }
131
- catch {}
130
+ } catch {}
132
131
  state.highlightLayerId = null
133
132
  state.highlightedExpr = null
134
133
  }
135
134
  }
136
135
 
137
- export function applyHighlight(map, labelData, state) {
136
+ export function applyHighlight (map, labelData, state) {
138
137
  if (!labelData?.feature?.layer) {
139
138
  return
140
139
  }
@@ -156,7 +155,7 @@ export function applyHighlight(map, labelData, state) {
156
155
  map.moveLayer(state.highlightLayerId)
157
156
  }
158
157
 
159
- export function navigateToNextLabel(direction, state) {
158
+ export function navigateToNextLabel (direction, state) {
160
159
  if (!state.currentPixel) {
161
160
  return null
162
161
  }
@@ -174,19 +173,19 @@ export function navigateToNextLabel(direction, state) {
174
173
  return state.labels[filtered[nextFilteredIndex].index]
175
174
  }
176
175
 
177
- function initLabelSource(map) {
176
+ function initLabelSource (map) {
178
177
  if (!map.getSource(HIGHLIGHT_LABEL_SOURCE)) {
179
178
  map.addSource(HIGHLIGHT_LABEL_SOURCE, { type: 'geojson', data: { type: 'FeatureCollection', features: [] } })
180
179
  }
181
180
  }
182
181
 
183
- function setLineCenterPlacement(map) {
182
+ function setLineCenterPlacement (map) {
184
183
  map.getStyle().layers
185
184
  .filter(l => l.layout?.['symbol-placement'] === 'line')
186
185
  .forEach(l => map.setLayoutProperty(l.id, 'symbol-placement', 'line-center'))
187
186
  }
188
187
 
189
- function setSymbolTextOpacity(map) {
188
+ function setSymbolTextOpacity (map) {
190
189
  map.getStyle().layers
191
190
  .filter(l => l.type === 'symbol')
192
191
  .forEach(layer => {
@@ -194,7 +193,7 @@ function setSymbolTextOpacity(map) {
194
193
  })
195
194
  }
196
195
 
197
- export function createMapLabelNavigator(map, mapColorScheme, events, eventBus) {
196
+ export function createMapLabelNavigator (map, mapColorScheme, events, eventBus) {
198
197
  const state = {
199
198
  isDarkStyle: mapColorScheme === 'dark',
200
199
  labels: [],
@@ -221,13 +220,13 @@ export function createMapLabelNavigator(map, mapColorScheme, events, eventBus) {
221
220
  }
222
221
  })
223
222
 
224
- function refreshLabels() {
223
+ function refreshLabels () {
225
224
  const symbolLayers = map.getStyle().layers.filter(l => l.type === 'symbol')
226
225
  const features = map.queryRenderedFeatures({ layers: symbolLayers.map(l => l.id) })
227
226
  state.labels = buildLabelsFromLayers(map, symbolLayers, features)
228
227
  }
229
228
 
230
- function highlightCenter() {
229
+ function highlightCenter () {
231
230
  refreshLabels()
232
231
  if (!state.labels.length) {
233
232
  return null
@@ -239,7 +238,7 @@ export function createMapLabelNavigator(map, mapColorScheme, events, eventBus) {
239
238
  return `${closest.text} (${closest.layer.id})`
240
239
  }
241
240
 
242
- function highlightNext(direction) {
241
+ function highlightNext (direction) {
243
242
  refreshLabels()
244
243
  if (!state.labels.length) {
245
244
  return null