@defra/interactive-map 0.0.3-alpha → 0.0.5-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 (407) hide show
  1. package/README.md +16 -57
  2. package/dist/css/index.css +1 -1
  3. package/dist/esm/im-core.js +1 -1
  4. package/dist/esm/index.js +1 -1
  5. package/dist/umd/im-core.js +1 -1
  6. package/dist/umd/index.js +1 -1
  7. package/docs/api/button-definition.md +176 -0
  8. package/docs/api/context.md +124 -0
  9. package/docs/api/control-definition.md +72 -0
  10. package/docs/api/icon-definition.md +28 -0
  11. package/docs/api/map-style-config.md +76 -0
  12. package/docs/api/marker-config.md +51 -0
  13. package/docs/api/panel-definition.md +117 -0
  14. package/docs/api/slots.md +25 -0
  15. package/docs/api.md +721 -0
  16. package/docs/architecture.md +139 -0
  17. package/docs/building-a-plugin.md +149 -0
  18. package/docs/getting-started.md +46 -0
  19. package/docs/govuk-prototype.md +0 -0
  20. package/docs/plugins/interact.md +205 -0
  21. package/docs/plugins/map-styles.md +84 -0
  22. package/docs/plugins/plugin-context.md +67 -0
  23. package/docs/plugins/plugin-descriptor.md +71 -0
  24. package/docs/plugins/plugin-manifest.md +118 -0
  25. package/docs/plugins/scale-bar.md +62 -0
  26. package/docs/plugins/search.md +162 -0
  27. package/docs/plugins.md +116 -0
  28. package/govuk-prototype-kit.config.json +7 -7
  29. package/package.json +16 -2
  30. package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +2 -0
  31. package/plugins/beta/datasets/dist/esm/index.js +2 -0
  32. package/plugins/beta/datasets/dist/umd/im-datasets-plugin.js +2 -0
  33. package/plugins/beta/datasets/dist/umd/index.js +2 -0
  34. package/plugins/beta/datasets/src/datasets.js +113 -0
  35. package/plugins/beta/datasets/src/fetch/createDynamicSource.js +206 -0
  36. package/plugins/beta/datasets/src/fetch/fetchGeoJSON.js +38 -0
  37. package/plugins/{datasets → beta/datasets}/src/handleSetMapStyle.js +8 -1
  38. package/plugins/{datasets → beta/datasets}/src/manifest.js +1 -1
  39. package/plugins/{datasets → beta/datasets}/src/mapLayers.js +42 -4
  40. package/plugins/{datasets → beta/datasets}/src/panels/Key.jsx +1 -1
  41. package/plugins/beta/datasets/src/utils/bbox.js +115 -0
  42. package/plugins/beta/draw-ml/dist/css/index.css +1 -0
  43. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -0
  44. package/plugins/beta/draw-ml/dist/esm/index.js +2 -0
  45. package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -0
  46. package/plugins/beta/draw-ml/dist/umd/index.js +2 -0
  47. package/plugins/beta/draw-ml/src/api/addFeature.js +27 -0
  48. package/plugins/{draw-ml → beta/draw-ml}/src/api/editFeature.js +17 -6
  49. package/plugins/beta/draw-ml/src/api/merge.js +9 -0
  50. package/plugins/beta/draw-ml/src/api/newLine.js +68 -0
  51. package/plugins/beta/draw-ml/src/api/newPolygon.js +68 -0
  52. package/plugins/beta/draw-ml/src/api/split.js +81 -0
  53. package/plugins/{draw-ml → beta/draw-ml}/src/defaults.js +3 -0
  54. package/plugins/beta/draw-ml/src/draw.scss +32 -0
  55. package/plugins/beta/draw-ml/src/events.js +171 -0
  56. package/plugins/beta/draw-ml/src/manifest.js +132 -0
  57. package/plugins/{draw-ml → beta/draw-ml}/src/mapboxDraw.js +51 -2
  58. package/plugins/{draw-ml → beta/draw-ml}/src/mapboxSnap.js +18 -12
  59. package/plugins/beta/draw-ml/src/modes/createDrawMode.js +497 -0
  60. package/plugins/beta/draw-ml/src/modes/drawLineMode.js +18 -0
  61. package/plugins/beta/draw-ml/src/modes/drawPolygonMode.js +16 -0
  62. package/plugins/beta/draw-ml/src/modes/editVertex/geometryHelpers.js +135 -0
  63. package/plugins/beta/draw-ml/src/modes/editVertex/helpers.js +2 -0
  64. package/plugins/beta/draw-ml/src/modes/editVertex/touchHandlers.js +134 -0
  65. package/plugins/beta/draw-ml/src/modes/editVertex/undoHandlers.js +133 -0
  66. package/plugins/beta/draw-ml/src/modes/editVertex/vertexOperations.js +141 -0
  67. package/plugins/beta/draw-ml/src/modes/editVertex/vertexQueries.js +121 -0
  68. package/plugins/beta/draw-ml/src/modes/editVertexMode.js +437 -0
  69. package/plugins/{draw-ml → beta/draw-ml}/src/reducer.js +30 -2
  70. package/plugins/{draw-ml → beta/draw-ml}/src/styles.js +66 -36
  71. package/plugins/beta/draw-ml/src/undoStack.js +50 -0
  72. package/plugins/beta/draw-ml/src/utils/debounce.js +16 -0
  73. package/plugins/beta/draw-ml/src/utils/flattenStyleProperties.js +49 -0
  74. package/plugins/beta/draw-ml/src/utils/spatial.js +258 -0
  75. package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -0
  76. package/plugins/beta/frame/dist/esm/index.js +2 -0
  77. package/plugins/beta/frame/dist/umd/im-frame-plugin.js +1 -0
  78. package/plugins/beta/frame/dist/umd/index.js +2 -0
  79. package/plugins/{frame → beta/frame}/src/Frame.jsx +1 -1
  80. package/plugins/{map-styles → beta/map-styles}/dist/css/index.css +1 -1
  81. package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -0
  82. package/plugins/beta/map-styles/dist/esm/index.js +2 -0
  83. package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -0
  84. package/plugins/beta/map-styles/dist/umd/index.js +2 -0
  85. package/plugins/{map-styles → beta/map-styles}/src/MapStyles.jsx +1 -1
  86. package/plugins/{map-styles → beta/map-styles}/src/manifest.js +8 -10
  87. package/plugins/{map-styles → beta/map-styles}/src/mapStyles.scss +4 -1
  88. package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -0
  89. package/plugins/beta/scale-bar/dist/esm/index.js +2 -0
  90. package/plugins/beta/scale-bar/dist/umd/im-scale-bar-plugin.js +1 -0
  91. package/plugins/beta/scale-bar/dist/umd/index.js +2 -0
  92. package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -0
  93. package/plugins/beta/use-location/dist/esm/index.js +2 -0
  94. package/plugins/beta/use-location/dist/umd/im-use-location-plugin.js +1 -0
  95. package/plugins/beta/use-location/dist/umd/index.js +2 -0
  96. package/plugins/interact/dist/css/index.css +1 -1
  97. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  98. package/plugins/interact/dist/esm/index.js +1 -1
  99. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  100. package/plugins/interact/dist/umd/index.js +1 -1
  101. package/plugins/interact/src/InteractInit.jsx +1 -1
  102. package/plugins/interact/src/InteractInit.test.js +97 -0
  103. package/plugins/interact/src/api/clear.test.js +18 -0
  104. package/plugins/interact/src/api/disable.test.js +12 -0
  105. package/plugins/interact/src/api/enable.test.js +48 -0
  106. package/plugins/interact/src/api/selectFeature.test.js +33 -0
  107. package/plugins/interact/src/api/unselectFeature.test.js +33 -0
  108. package/plugins/interact/src/defaults.js +2 -0
  109. package/plugins/interact/src/events.js +37 -52
  110. package/plugins/interact/src/events.test.js +186 -0
  111. package/plugins/interact/src/hooks/useHighlightSync.js +1 -1
  112. package/plugins/interact/src/hooks/useHighlightSync.test.js +212 -0
  113. package/plugins/interact/src/hooks/useInteractionHandlers.js +80 -41
  114. package/plugins/interact/src/hooks/useInteractionHandlers.test.js +316 -0
  115. package/plugins/interact/src/index.test.js +22 -0
  116. package/plugins/interact/src/interact.scss +6 -0
  117. package/plugins/interact/src/manifest.js +1 -1
  118. package/plugins/interact/src/manifest.test.js +94 -0
  119. package/plugins/interact/src/reducer.js +28 -21
  120. package/plugins/interact/src/reducer.test.js +155 -0
  121. package/plugins/interact/src/utils/buildStylesMap.test.js +57 -0
  122. package/plugins/interact/src/utils/featureQueries.js +2 -2
  123. package/plugins/interact/src/utils/featureQueries.test.js +56 -0
  124. package/plugins/interact/src/utils/spatial.js +95 -0
  125. package/plugins/interact/src/utils/spatial.test.js +93 -0
  126. package/plugins/search/dist/css/index.css +1 -1
  127. package/plugins/search/dist/esm/im-search-plugin.js +1 -1
  128. package/plugins/search/dist/esm/index.js +1 -1
  129. package/plugins/search/dist/umd/im-search-plugin.js +1 -1
  130. package/plugins/search/dist/umd/index.js +1 -1
  131. package/plugins/search/src/Search.jsx +2 -2
  132. package/plugins/search/src/components/Form/Form.jsx +1 -1
  133. package/plugins/search/src/components/Suggestions/Suggestions.jsx +5 -5
  134. package/plugins/search/src/datasets.js +1 -1
  135. package/plugins/search/src/defaults.js +3 -0
  136. package/plugins/search/src/events/fetchSuggestions.js +48 -53
  137. package/plugins/search/src/events/formHandlers.js +3 -2
  138. package/plugins/search/src/events/index.js +1 -1
  139. package/plugins/search/src/events/inputHandlers.js +3 -1
  140. package/plugins/search/src/events/suggestionHandlers.js +12 -3
  141. package/plugins/search/src/search.scss +4 -1
  142. package/plugins/search/src/utils/parseOsNamesResults.js +15 -19
  143. package/providers/{esri → beta/esri}/src/esriProvider.js +1 -1
  144. package/providers/{esri → beta/esri}/src/index.js +1 -1
  145. package/providers/{esri → beta/esri}/src/mapEvents.js +2 -2
  146. package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +2 -0
  147. package/providers/beta/open-names/dist/esm/index.js +2 -0
  148. package/providers/beta/open-names/dist/umd/im-reverse-geocode.js +2 -0
  149. package/providers/beta/open-names/dist/umd/im-reverse-geocode.js.LICENSE.txt +1 -0
  150. package/providers/beta/open-names/dist/umd/index.js +2 -0
  151. package/providers/beta/open-names/dist/umd/index.js.LICENSE.txt +1 -0
  152. package/providers/maplibre/dist/esm/im-maplibre-framework.js +1 -1
  153. package/providers/maplibre/dist/esm/im-maplibre-framework.js.LICENSE.txt +1 -1
  154. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  155. package/providers/maplibre/dist/esm/index.js +1 -1
  156. package/providers/maplibre/dist/umd/im-maplibre-framework.js +1 -1
  157. package/providers/maplibre/dist/umd/im-maplibre-framework.js.LICENSE.txt +1 -1
  158. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  159. package/providers/maplibre/dist/umd/index.js +1 -1
  160. package/providers/maplibre/src/defaults.js +3 -2
  161. package/providers/maplibre/src/index.js +36 -20
  162. package/providers/maplibre/src/maplibreProvider.js +140 -11
  163. package/providers/maplibre/src/utils/detectWebgl.js +1 -2
  164. package/providers/maplibre/src/utils/highlightFeatures.js +78 -67
  165. package/providers/maplibre/src/utils/labels.js +174 -120
  166. package/providers/maplibre/src/utils/maplibreFixes.js +2 -2
  167. package/providers/maplibre/src/utils/queryFeatures.js +146 -0
  168. package/providers/maplibre/src/utils/spatial.js +14 -17
  169. package/sonar-project.properties +40 -3
  170. package/src/App/components/Actions/Actions.jsx +2 -2
  171. package/src/App/components/Actions/Actions.module.scss +2 -2
  172. package/src/App/components/KeyboardHelp/KeyboardHelp.jsx +3 -1
  173. package/src/App/components/KeyboardHelp/KeyboardHelp.test.jsx +9 -0
  174. package/src/App/components/Logo/Logo.jsx +1 -1
  175. package/src/App/components/MapButton/MapButton.jsx +217 -41
  176. package/src/App/components/MapButton/MapButton.module.scss +32 -21
  177. package/src/App/components/MapButton/MapButton.test.jsx +128 -84
  178. package/src/App/components/Markers/Markers.jsx +1 -1
  179. package/src/App/components/Markers/Markers.module.scss +0 -5
  180. package/src/App/components/Panel/Panel.jsx +75 -45
  181. package/src/App/components/Panel/Panel.module.scss +18 -24
  182. package/src/App/components/Panel/Panel.test.jsx +18 -0
  183. package/src/App/components/PopupMenu/PopupMenu.jsx +246 -0
  184. package/src/App/components/PopupMenu/PopupMenu.module.scss +70 -0
  185. package/src/App/components/PopupMenu/PopupMenu.test.jsx +304 -0
  186. package/src/App/components/Tooltip/Tooltip.jsx +4 -2
  187. package/src/App/components/Tooltip/getTooltipPosition.js +1 -1
  188. package/src/App/components/Viewport/MapController.jsx +1 -1
  189. package/src/App/components/Viewport/MapStatus.jsx +1 -1
  190. package/src/App/components/Viewport/Viewport.jsx +2 -2
  191. package/src/App/components/Viewport/Viewport.module.scss +2 -2
  192. package/src/App/controls/keyboardActions.js +3 -2
  193. package/src/App/controls/keyboardShortcuts.js +4 -2
  194. package/src/App/hooks/useButtonStateEvaluator.js +58 -45
  195. package/src/App/hooks/useButtonStateEvaluator.test.js +36 -3
  196. package/src/App/hooks/useCrossHairAPI.js +49 -47
  197. package/src/App/hooks/useFocusVisible.js +2 -2
  198. package/src/App/hooks/useInterfaceAPI.js +36 -1
  199. package/src/App/hooks/useKeyboardHint.js +1 -1
  200. package/src/App/hooks/useKeyboardShortcuts.js +4 -2
  201. package/src/App/hooks/useMapAnnouncements.js +34 -32
  202. package/src/App/hooks/useMapEvents.js +12 -1
  203. package/src/App/hooks/useMapProviderOverrides.js +3 -3
  204. package/src/App/hooks/useMapStateSync.js +7 -1
  205. package/src/App/hooks/useMapURLSync.js +6 -1
  206. package/src/App/hooks/useMarkersAPI.js +88 -50
  207. package/src/App/hooks/useMediaQueryDispatch.test.js +48 -0
  208. package/src/App/hooks/useModalPanelBehaviour.js +46 -40
  209. package/src/App/hooks/useResizeObserver.js +2 -2
  210. package/src/App/initialiseApp.js +45 -38
  211. package/src/App/layout/Layout.jsx +6 -4
  212. package/src/App/layout/layout.module.scss +13 -17
  213. package/src/App/registry/keyboardShortcutRegistry.js +12 -2
  214. package/src/App/registry/keyboardShortcutRegistry.test.js +28 -0
  215. package/src/App/registry/mergeManifests.js +1 -1
  216. package/src/App/registry/panelRegistry.js +1 -1
  217. package/src/App/registry/panelRegistry.test.js +30 -1
  218. package/src/App/registry/pluginRegistry.js +14 -51
  219. package/src/App/registry/pluginRegistry.test.js +54 -6
  220. package/src/App/renderer/HtmlElementHost.jsx +186 -0
  221. package/src/App/renderer/HtmlElementHost.test.jsx +231 -0
  222. package/src/App/renderer/mapButtons.js +12 -9
  223. package/src/App/renderer/mapButtons.test.js +6 -4
  224. package/src/App/renderer/mapControls.js +6 -0
  225. package/src/App/renderer/mapControls.test.js +10 -2
  226. package/src/App/renderer/mapPanels.js +39 -26
  227. package/src/App/renderer/mapPanels.test.js +29 -0
  228. package/src/App/renderer/pluginWrapper.test.js +28 -0
  229. package/src/App/renderer/slotHelpers.js +60 -0
  230. package/src/App/renderer/slotHelpers.test.js +82 -0
  231. package/src/App/store/AppProvider.jsx +3 -0
  232. package/src/App/store/AppProvider.test.jsx +40 -0
  233. package/src/App/store/PluginProvider.jsx +7 -5
  234. package/src/App/store/appActionsMap.js +46 -1
  235. package/src/App/store/appActionsMap.test.js +21 -0
  236. package/src/App/store/appReducer.js +1 -0
  237. package/src/App/store/mapActionsMap.js +12 -24
  238. package/src/App/store/mapReducer.js +1 -1
  239. package/src/InteractiveMap/InteractiveMap.js +194 -13
  240. package/src/InteractiveMap/InteractiveMap.test.js +164 -2
  241. package/src/InteractiveMap/behaviourController.js +12 -2
  242. package/src/InteractiveMap/behaviourController.test.js +82 -1
  243. package/src/InteractiveMap/deviceChecker.js +1 -1
  244. package/src/InteractiveMap/deviceChecker.test.js +2 -2
  245. package/src/InteractiveMap/historyManager.js +41 -5
  246. package/src/InteractiveMap/historyManager.test.js +37 -6
  247. package/src/InteractiveMap/polyfills.js +39 -0
  248. package/src/InteractiveMap/polyfills.test.js +127 -0
  249. package/src/config/appConfig.js +5 -5
  250. package/src/config/appConfig.test.js +107 -42
  251. package/src/config/defaults.js +30 -20
  252. package/src/config/events.js +110 -4
  253. package/src/index.js +5 -2
  254. package/src/index.umd.js +1 -1
  255. package/src/scss/main.scss +1 -0
  256. package/src/scss/settings/_dimensions.scss +6 -2
  257. package/src/scss/tools/_border-focus.scss +20 -4
  258. package/src/services/eventBus.test.js +24 -1
  259. package/src/test-utils.js +1 -0
  260. package/src/types.js +590 -0
  261. package/src/utils/detectBreakpoint.js +78 -77
  262. package/src/utils/detectBreakpoint.test.js +50 -4
  263. package/src/utils/detectInterfaceType.js +4 -4
  264. package/src/utils/getIsFullscreen.js +3 -1
  265. package/src/utils/getSafeZoneInset.js +23 -7
  266. package/src/utils/getSafeZoneInset.test.js +18 -0
  267. package/src/utils/mapStateSync.js +3 -3
  268. package/src/utils/queryString.js +1 -1
  269. package/src/utils/stringToKebab.js +1 -1
  270. package/src/utils/toggleInertElements.js +37 -12
  271. package/webpack.dev.mjs +3 -4
  272. package/webpack.esm.mjs +8 -8
  273. package/webpack.umd.mjs +8 -8
  274. package/plugins/datasets/dist/esm/im-datasets-plugin.js +0 -1
  275. package/plugins/datasets/dist/esm/index.js +0 -2
  276. package/plugins/datasets/dist/umd/im-datasets-plugin.js +0 -1
  277. package/plugins/datasets/dist/umd/index.js +0 -2
  278. package/plugins/datasets/src/datasets.js +0 -60
  279. package/plugins/datasets/src/utils/bbox.js +0 -4
  280. package/plugins/draw-ml/dist/css/index.css +0 -1
  281. package/plugins/draw-ml/dist/esm/im-draw-ml-plugin.js +0 -1
  282. package/plugins/draw-ml/dist/esm/index.js +0 -2
  283. package/plugins/draw-ml/dist/umd/im-draw-ml-plugin.js +0 -1
  284. package/plugins/draw-ml/dist/umd/index.js +0 -2
  285. package/plugins/draw-ml/src/api/addFeature.js +0 -15
  286. package/plugins/draw-ml/src/api/newPolygon.js +0 -43
  287. package/plugins/draw-ml/src/draw.scss +0 -9
  288. package/plugins/draw-ml/src/events.js +0 -127
  289. package/plugins/draw-ml/src/manifest.js +0 -100
  290. package/plugins/draw-ml/src/modes/drawVertexMode.js +0 -275
  291. package/plugins/draw-ml/src/modes/editVertexMode.js +0 -426
  292. package/plugins/draw-ml/src/utils.js +0 -102
  293. package/plugins/frame/dist/esm/im-frame-plugin.js +0 -1
  294. package/plugins/frame/dist/esm/index.js +0 -2
  295. package/plugins/frame/dist/umd/im-frame-plugin.js +0 -1
  296. package/plugins/frame/dist/umd/index.js +0 -2
  297. package/plugins/map-styles/dist/esm/im-map-styles-plugin.js +0 -1
  298. package/plugins/map-styles/dist/esm/index.js +0 -2
  299. package/plugins/map-styles/dist/umd/im-map-styles-plugin.js +0 -1
  300. package/plugins/map-styles/dist/umd/index.js +0 -2
  301. package/plugins/scale-bar/dist/esm/im-scale-bar-plugin.js +0 -1
  302. package/plugins/scale-bar/dist/esm/index.js +0 -2
  303. package/plugins/scale-bar/dist/umd/im-scale-bar-plugin.js +0 -1
  304. package/plugins/scale-bar/dist/umd/index.js +0 -2
  305. package/plugins/search/src/utils/fetchDataset.js +0 -23
  306. package/plugins/use-location/dist/esm/im-use-location-plugin.js +0 -1
  307. package/plugins/use-location/dist/esm/index.js +0 -2
  308. package/plugins/use-location/dist/umd/im-use-location-plugin.js +0 -1
  309. package/plugins/use-location/dist/umd/index.js +0 -2
  310. package/providers/maplibre/dist/esm/im-maplibre-legacy-framework.js +0 -1
  311. package/providers/maplibre/dist/umd/im-maplibre-legacy-framework.js +0 -1
  312. package/providers/open-names/dist/esm/im-reverse-geocode.js +0 -2
  313. package/providers/open-names/dist/esm/index.js +0 -2
  314. package/providers/open-names/dist/umd/im-reverse-geocode.js +0 -2
  315. package/providers/open-names/dist/umd/index.js +0 -2
  316. /package/docs/architecture/{ARCHITECTURE_DIAGRAMS.md → architecture-diagrams.md} +0 -0
  317. /package/plugins/{datasets → beta/datasets}/dist/css/index.css +0 -0
  318. /package/plugins/{datasets/dist/esm/index.js.LICENSE.txt → beta/datasets/dist/esm/im-datasets-plugin.js.LICENSE.txt} +0 -0
  319. /package/plugins/{datasets/dist/umd → beta/datasets/dist/esm}/index.js.LICENSE.txt +0 -0
  320. /package/plugins/{draw-ml/dist/esm/index.js.LICENSE.txt → beta/datasets/dist/umd/im-datasets-plugin.js.LICENSE.txt} +0 -0
  321. /package/plugins/{draw-ml → beta/datasets}/dist/umd/index.js.LICENSE.txt +0 -0
  322. /package/plugins/{datasets → beta/datasets}/src/DatasetsInit.jsx +0 -0
  323. /package/plugins/{datasets → beta/datasets}/src/api/addDataset.js +0 -0
  324. /package/plugins/{datasets → beta/datasets}/src/api/hideDataset.js +0 -0
  325. /package/plugins/{datasets → beta/datasets}/src/api/hideFeatures.js +0 -0
  326. /package/plugins/{datasets → beta/datasets}/src/api/removeDataset.js +0 -0
  327. /package/plugins/{datasets → beta/datasets}/src/api/showDataset.js +0 -0
  328. /package/plugins/{datasets → beta/datasets}/src/api/showFeatures.js +0 -0
  329. /package/plugins/{datasets → beta/datasets}/src/datasets.scss +0 -0
  330. /package/plugins/{datasets → beta/datasets}/src/defaults.js +0 -0
  331. /package/plugins/{datasets → beta/datasets}/src/index.js +0 -0
  332. /package/plugins/{datasets → beta/datasets}/src/panels/Key.module.scss +0 -0
  333. /package/plugins/{datasets → beta/datasets}/src/panels/Layers.jsx +0 -0
  334. /package/plugins/{datasets → beta/datasets}/src/panels/Layers.module.scss +0 -0
  335. /package/plugins/{datasets → beta/datasets}/src/reducer.js +0 -0
  336. /package/plugins/{datasets → beta/datasets}/src/utils/debounce.js +0 -0
  337. /package/plugins/{datasets → beta/datasets}/src/utils/filters.js +0 -0
  338. /package/plugins/{draw-es → beta/draw-es}/src/DrawInit.jsx +0 -0
  339. /package/plugins/{draw-es → beta/draw-es}/src/api/addFeature.js +0 -0
  340. /package/plugins/{draw-es → beta/draw-es}/src/api/deleteFeature.js +0 -0
  341. /package/plugins/{draw-es → beta/draw-es}/src/api/editFeature.js +0 -0
  342. /package/plugins/{draw-es → beta/draw-es}/src/api/newPolygon.js +0 -0
  343. /package/plugins/{draw-es → beta/draw-es}/src/events.js +0 -0
  344. /package/plugins/{draw-es → beta/draw-es}/src/graphic.js +0 -0
  345. /package/plugins/{draw-es → beta/draw-es}/src/index.js +0 -0
  346. /package/plugins/{draw-es → beta/draw-es}/src/manifest.js +0 -0
  347. /package/plugins/{draw-es → beta/draw-es}/src/reducer.js +0 -0
  348. /package/plugins/{draw-es → beta/draw-es}/src/sketchViewModel.js +0 -0
  349. /package/plugins/{frame → beta/draw-ml}/dist/esm/index.js.LICENSE.txt +0 -0
  350. /package/plugins/{frame → beta/draw-ml}/dist/umd/index.js.LICENSE.txt +0 -0
  351. /package/plugins/{draw-ml → beta/draw-ml}/src/DrawInit.jsx +0 -0
  352. /package/plugins/{draw-ml → beta/draw-ml}/src/api/deleteFeature.js +0 -0
  353. /package/plugins/{draw-ml → beta/draw-ml}/src/index.js +0 -0
  354. /package/plugins/{draw-ml → beta/draw-ml}/src/modes/disabledMode.js +0 -0
  355. /package/plugins/{draw-ml/src → beta/draw-ml/src/utils}/snapHelpers.js +0 -0
  356. /package/plugins/{frame → beta/frame}/dist/css/index.css +0 -0
  357. /package/plugins/{map-styles → beta/frame}/dist/esm/index.js.LICENSE.txt +0 -0
  358. /package/plugins/{map-styles → beta/frame}/dist/umd/index.js.LICENSE.txt +0 -0
  359. /package/plugins/{frame → beta/frame}/package.json +0 -0
  360. /package/plugins/{frame → beta/frame}/src/FrameInit.jsx +0 -0
  361. /package/plugins/{frame → beta/frame}/src/api/addFrame.js +0 -0
  362. /package/plugins/{frame → beta/frame}/src/api/editFeature.js +0 -0
  363. /package/plugins/{frame → beta/frame}/src/config.js +0 -0
  364. /package/plugins/{frame → beta/frame}/src/frame.scss +0 -0
  365. /package/plugins/{frame → beta/frame}/src/index.js +0 -0
  366. /package/plugins/{frame → beta/frame}/src/manifest.js +0 -0
  367. /package/plugins/{frame → beta/frame}/src/reducer.js +0 -0
  368. /package/plugins/{frame → beta/frame}/src/utils.js +0 -0
  369. /package/plugins/{scale-bar → beta/map-styles}/dist/esm/index.js.LICENSE.txt +0 -0
  370. /package/plugins/{scale-bar → beta/map-styles}/dist/umd/index.js.LICENSE.txt +0 -0
  371. /package/plugins/{map-styles → beta/map-styles}/src/MapStylesInit.jsx +0 -0
  372. /package/plugins/{map-styles → beta/map-styles}/src/config.js +0 -0
  373. /package/plugins/{map-styles → beta/map-styles}/src/index.js +0 -0
  374. /package/plugins/{scale-bar → beta/scale-bar}/dist/css/index.css +0 -0
  375. /package/plugins/{use-location → beta/scale-bar}/dist/esm/index.js.LICENSE.txt +0 -0
  376. /package/plugins/{use-location → beta/scale-bar}/dist/umd/index.js.LICENSE.txt +0 -0
  377. /package/plugins/{scale-bar → beta/scale-bar}/package.json +0 -0
  378. /package/plugins/{scale-bar → beta/scale-bar}/src/ScaleBar.jsx +0 -0
  379. /package/plugins/{scale-bar → beta/scale-bar}/src/ScaleBar.test.jsx +0 -0
  380. /package/plugins/{scale-bar → beta/scale-bar}/src/index.js +0 -0
  381. /package/plugins/{scale-bar → beta/scale-bar}/src/index.test.js +0 -0
  382. /package/plugins/{scale-bar → beta/scale-bar}/src/manifest.js +0 -0
  383. /package/plugins/{scale-bar → beta/scale-bar}/src/scaleBar.scss +0 -0
  384. /package/plugins/{scale-bar → beta/scale-bar}/src/utils.js +0 -0
  385. /package/plugins/{scale-bar → beta/scale-bar}/src/utils.test.js +0 -0
  386. /package/{providers/open-names → plugins/beta/use-location}/dist/esm/index.js.LICENSE.txt +0 -0
  387. /package/{providers/open-names → plugins/beta/use-location}/dist/umd/index.js.LICENSE.txt +0 -0
  388. /package/plugins/{use-location → beta/use-location}/src/UseLocation.jsx +0 -0
  389. /package/plugins/{use-location → beta/use-location}/src/UseLocationInit.jsx +0 -0
  390. /package/plugins/{use-location → beta/use-location}/src/defaults.js +0 -0
  391. /package/plugins/{use-location → beta/use-location}/src/events.js +0 -0
  392. /package/plugins/{use-location → beta/use-location}/src/index.js +0 -0
  393. /package/plugins/{use-location → beta/use-location}/src/manifest.js +0 -0
  394. /package/plugins/{use-location → beta/use-location}/src/reducer.js +0 -0
  395. /package/providers/{esri → beta/esri}/src/appEvents.js +0 -0
  396. /package/providers/{esri → beta/esri}/src/defaults.js +0 -0
  397. /package/providers/{esri → beta/esri}/src/esriProvider.scss +0 -0
  398. /package/providers/{esri → beta/esri}/src/utils/coords.js +0 -0
  399. /package/providers/{esri → beta/esri}/src/utils/detectWebGL.js +0 -0
  400. /package/providers/{esri → beta/esri}/src/utils/esriFixes.js +0 -0
  401. /package/providers/{esri → beta/esri}/src/utils/query.js +0 -0
  402. /package/providers/{esri → beta/esri}/src/utils/spatial.js +0 -0
  403. /package/providers/{open-names → beta/open-names}/dist/esm/im-reverse-geocode.js.LICENSE.txt +0 -0
  404. /package/providers/{open-names/dist/umd/im-reverse-geocode.js.LICENSE.txt → beta/open-names/dist/esm/index.js.LICENSE.txt} +0 -0
  405. /package/providers/{open-names → beta/open-names}/src/index.js +0 -0
  406. /package/providers/{open-names → beta/open-names}/src/reverseGeocode.js +0 -0
  407. /package/providers/{open-names → beta/open-names}/src/utils/mapToLocationModel.js +0 -0
@@ -0,0 +1,2 @@
1
+ /*! For license information please see im-datasets-plugin.js.LICENSE.txt */
2
+ export const __webpack_esm_id__="im-datasets-plugin";export const __webpack_esm_ids__=["im-datasets-plugin"];export const __webpack_esm_modules__={"./plugins/beta/datasets/src/manifest.js"(t,e,r){function n(t){return n="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},n(t)}function o(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return i(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)?i(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(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 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 u(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){l(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 l(t,e,r){return(e=c(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}r.d(e,{manifest:()=>Q}),r.r(e);var s={SET_DATASETS:function(t,e){var r=e.datasets,n=e.datasetDefaults;return u(u({},t),{},{datasets:r.map(function(t){return u(u({},n),t)})})},ADD_DATASET:function(t,e){var r=e.dataset,n=e.datasetDefaults;return u(u({},t),{},{datasets:[].concat(o(t.datasets||[]),[u(u({},n),r)])})},REMOVE_DATASET:function(t,e){var r,n=e.id;return u(u({},t),{},{datasets:(null===(r=t.datasets)||void 0===r?void 0:r.filter(function(t){return t.id!==n}))||[]})},SET_DATASET_VISIBILITY:function(t,e){var r,n=e.id,o=e.visibility;return u(u({},t),{},{datasets:null===(r=t.datasets)||void 0===r?void 0:r.map(function(t){return t.id===n?u(u({},t),{},{visibility:o}):t})})},HIDE_FEATURES:function(t,e){var r=e.layerId,n=e.idProperty,i=e.featureIds,a=t.hiddenFeatures[r],c=(null==a?void 0:a.ids)||[],s=o(new Set([].concat(o(c),o(i))));return u(u({},t),{},{hiddenFeatures:u(u({},t.hiddenFeatures),{},l({},r,{idProperty:n,ids:s}))})},SHOW_FEATURES:function(t,e){var r=e.layerId,n=e.featureIds,o=t.hiddenFeatures[r];if(!o)return t;var i=o.ids.filter(function(t){return!n.includes(t)});if(0===i.length){var a=t.hiddenFeatures,s=(a[r],function(t,e){if(null==t)return{};var r,n,o=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 i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(a,[r].map(c)));return u(u({},t),{},{hiddenFeatures:s})}return u(u({},t),{},{hiddenFeatures:u(u({},t.hiddenFeatures),{},l({},r,u(u({},o),{},{ids:i})))})}},f=r("react"),d={stroke:"#d4351c",strokeWidth:2,fill:"transparent",symbolDescription:"red outline",minZoom:6,maxZoom:24,showInKey:!1,showInLayers:!1,visibility:"visible"};function y(t){return y="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},y(t)}var p=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===y(t)){if(e&&t[e])return t[e];var r=Object.values(t)[0];return null!=r?r:null}return null};function v(t){return v="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},v(t)}function m(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 b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach(function(e){h(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function h(t,e,r){return(e=function(t){var e=function(t){if("object"!=v(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==v(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function g(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){var e,r=0,n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return g(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)?g(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(t);try{for(n.s();!(e=n.n()).done;)r=(r<<5)-r+e.value.codePointAt(0),r&=r}catch(t){n.e(t)}finally{n.f()}return Math.abs(r).toString(36)},j=function(t){if(t.tiles){var e=Array.isArray(t.tiles)?t.tiles.join(","):t.tiles;return"tiles-".concat(S(e))}return t.geojson?w(t)?"geojson-dynamic-".concat(t.id):"string"==typeof t.geojson?"geojson-".concat(S(t.geojson)):"geojson-".concat(t.id):"source-".concat(t.id)},w=function(t){return"string"==typeof t.geojson&&!!t.idProperty&&"function"==typeof t.transformRequest},O=function(t,e,r){var n=j(r);if(!t.getSource(n))if(r.tiles)t.addSource(n,{type:"vector",tiles:r.tiles,minzoom:r.minZoom||0,maxzoom:r.maxZoom||22});else if(r.geojson){var o=w(r)?{type:"FeatureCollection",features:[]}:r.geojson;t.addSource(n,{type:"geojson",data:o})}var i=!!r.fill,a=!!r.stroke,u=i?r.id:null,l=a?i?"".concat(r.id,"-stroke"):r.id:null,c="hidden"===r.visibility?"none":"visible";if(i&&!t.getLayer(u)){var s,f=p(r.fill,e);t.addLayer(b({id:u,type:"fill",source:n,"source-layer":null!=r&&null!==(s=r.tiles)&&void 0!==s&&s.length?r.sourceLayer:void 0,layout:{visibility:c},paint:{"fill-color":f,"fill-opacity":r.opacity||1}},r.filter?{filter:r.filter}:{}))}if(a&&!t.getLayer(l)){var d,y=p(r.stroke,e);t.addLayer(b({id:l,type:"line",source:n,"source-layer":null!=r&&null!==(d=r.tiles)&&void 0!==d&&d.length?r.sourceLayer:void 0,layout:{visibility:c},paint:b({"line-color":y,"line-width":r.strokeWidth||1,"line-opacity":r.opacity||1},r.strokeDashArray?{"line-dasharray":r.strokeDashArray}:{})},r.filter?{filter:r.filter}:{}))}},k=function(t,e,r,n,o){if(t.getLayer(e)){var i=function(t,e,r){if(!r||0===r.length)return t;var n=["!",["in",["to-string",["get",e]],["literal",r.map(function(t){return String(t)})]]];return t?["all",t,n]:n}(r,n,o);t.setFilter(e,i)}};function A(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 P(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var l=n&&n.prototype instanceof u?n:u,c=Object.create(l.prototype);return E(c,"_invoke",function(r,n,o){var i,u,l,c=0,s=o||[],f=!1,d={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return i=e,u=0,l=t,d.n=r,a}};function y(r,n){for(u=r,l=n,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=d.p,p=i[2];r>3?(o=p===n)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=r<2&&y<i[1])?(u=0,d.v=n,d.n=i[1]):y<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,d.n=p,u=0))}if(o||r>1)return a;throw f=!0,n}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(d.n=-1),y(u,l)):d.n=l:d.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=d.n<0)?l:r.call(n,d))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(r,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][n]?e(e([][n]())):(E(e={},n,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,E(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,E(f,"constructor",c),E(c,"constructor",l),l.displayName="GeneratorFunction",E(c,o,"GeneratorFunction"),E(f),E(f,o,"Generator"),E(f,n,function(){return this}),E(f,"toString",function(){return"[object Generator]"}),(P=function(){return{w:i,m:d}})()}function E(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}E=function(t,e,r,n){function i(e,r){E(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},E(t,e,r,n)}function x(t,e,r,n,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void r(t)}u.done?e(l):Promise.resolve(l).then(n,o)}var I=function(){var t,e=(t=P().m(function t(e,r,n){var o,i,a,u,l,c,s;return P().w(function(t){for(;;)switch(t.n){case 0:return o=n(e,r),a=(i="string"==typeof o?{url:o}:o).url,u=i.headers,l=void 0===u?{}:u,t.n=1,fetch(a,{headers:l});case 1:if((c=t.v).ok){t.n=2;break}throw new Error("Failed to fetch GeoJSON: ".concat(c.status," ").concat(c.statusText));case 2:return t.n=3,c.json();case 3:if("FeatureCollection"!==(s=t.v).type){t.n=4;break}return t.a(2,s);case 4:if("Feature"!==s.type){t.n=5;break}return t.a(2,{type:"FeatureCollection",features:[s]});case 5:if(!Array.isArray(s)){t.n=6;break}return t.a(2,{type:"FeatureCollection",features:s});case 6:throw new Error("Invalid GeoJSON response");case 7:return t.a(2)}},t)}),function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){x(i,n,o,a,u,"next",t)}function u(t){x(i,n,o,a,u,"throw",t)}a(void 0)})});return function(t,r,n){return e.apply(this,arguments)}}();function _(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 T=function(t){var e=t.getBounds();return[e.getWest(),e.getSouth(),e.getEast(),e.getNorth()]},D=function(t,e){return!(!t||!e)&&e[0]>=t[0]&&e[1]>=t[1]&&e[2]<=t[2]&&e[3]<=t[3]},L=function(t,e){return t?[Math.min(t[0],e[0]),Math.min(t[1],e[1]),Math.max(t[2],e[2]),Math.max(t[3],e[3])]:function(t){if(Array.isArray(t))return _(t)}(r=e)||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 _(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)?_(t,e):void 0}}(r)||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.")}();var r},F=function(t,e){return!(!t||!e||t[2]<e[0]||t[0]>e[2]||t[3]<e[1]||t[1]>e[3])},M=function(t){var e=1/0,r=1/0,n=-1/0,o=-1/0,i=function(t,a){var u;0===a?(u=t,e=Math.min(e,u[0]),r=Math.min(r,u[1]),n=Math.max(n,u[0]),o=Math.max(o,u[1])):t.forEach(function(t){return i(t,a-1)})};switch(t.type){case"Point":i(t.coordinates,0);break;case"LineString":case"MultiPoint":i(t.coordinates,1);break;case"Polygon":case"MultiLineString":i(t.coordinates,2);break;case"MultiPolygon":i(t.coordinates,3);break;case"GeometryCollection":t.geometries.forEach(function(t){var i=M(t);e=Math.min(e,i[0]),r=Math.min(r,i[1]),n=Math.max(n,i[2]),o=Math.max(o,i[3])})}return[e,r,n,o]};function C(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var l=n&&n.prototype instanceof u?n:u,c=Object.create(l.prototype);return N(c,"_invoke",function(r,n,o){var i,u,l,c=0,s=o||[],f=!1,d={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return i=e,u=0,l=t,d.n=r,a}};function y(r,n){for(u=r,l=n,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=d.p,p=i[2];r>3?(o=p===n)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=r<2&&y<i[1])?(u=0,d.v=n,d.n=i[1]):y<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,d.n=p,u=0))}if(o||r>1)return a;throw f=!0,n}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(d.n=-1),y(u,l)):d.n=l:d.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=d.n<0)?l:r.call(n,d))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(r,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][n]?e(e([][n]())):(N(e={},n,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,N(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,N(f,"constructor",c),N(c,"constructor",l),l.displayName="GeneratorFunction",N(c,o,"GeneratorFunction"),N(f),N(f,o,"Generator"),N(f,n,function(){return this}),N(f,"toString",function(){return"[object Generator]"}),(C=function(){return{w:i,m:d}})()}function N(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}N=function(t,e,r,n){function i(e,r){N(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},N(t,e,r,n)}function W(t,e,r,n,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void r(t)}u.done?e(l):Promise.resolve(l).then(n,o)}function G(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,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||R(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 R(t,e){if(t){if("string"==typeof t)return U(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)?U(t,e):void 0}}function U(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 z=function(t){var e=t.pluginConfig,r=t.pluginStateRef,n=t.mapStyleId,o=t.mapProvider,i=t.events,a=t.eventBus,u=o.map,l=e.datasets,c=new Map,s=function(){return r.current.datasets||l};l.forEach(function(t){if(O(u,n,t),w(t)){var e=j(t),r=function(t){var e,r,n,o=t.dataset,i=t.map,a=t.sourceId,u=t.onUpdate,l=o.geojson,c=o.idProperty,s=o.transformRequest,f=o.maxFeatures,d=o.minZoom,y=void 0===d?0:d,p=new Map,v=null,m=!1,b=function(){return{type:"FeatureCollection",features:Array.from(p.values()).map(function(t){return t.feature})}},h=function(t){var e,r;return c&&null!==(e=null===(r=t.properties)||void 0===r?void 0:r[c])&&void 0!==e?e:t.id},g=function(t){if(f&&!(p.size<=1.2*f)){var e,r=f,n=[],o=[],i=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=R(t))){e&&(t=e);var r=0,n=function(){};return{s:n,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==e.return||e.return()}finally{if(a)throw o}}}}(p);try{for(i.s();!(e=i.n()).done;){var a=G(e.value,2),u=a[0],l=a[1];F(l.bbox,t)?n.push(u):o.push({id:u,addedAt:l.addedAt})}}catch(t){i.e(t)}finally{i.f()}o.sort(function(t,e){return t.addedAt-e.addedAt});for(var c=p.size-r,s=0;s<c&&s<o.length;s++)p.delete(o[s].id);if(p.size>r)for(var d=p.size-r,y=n.map(function(t){return{id:t,addedAt:p.get(t).addedAt}}).sort(function(t,e){return t.addedAt-e.addedAt}),v=0;v<d&&v<y.length;v++)p.delete(y[v].id)}},S=function(){var t,e=(t=C().m(function t(){var e,r,n,c,f,d;return C().w(function(t){for(;;)switch(t.p=t.n){case 0:if(!((e=i.getZoom())<y)){t.n=1;break}return t.a(2);case 1:if(r=T(i),!v||!D(v,r)){t.n=2;break}return t.a(2);case 2:if(!m){t.n=3;break}return t.a(2);case 3:return m=!0,t.p=4,n={bbox:r,zoom:e,dataset:o},t.n=5,I(l,n,s);case 5:c=t.v,f=Date.now(),c.features.forEach(function(t){var e=h(t);null!=e?p.set(e,{feature:t,bbox:M(t.geometry),addedAt:p.has(e)?p.get(e).addedAt:f}):console.warn("Feature missing ID, skipping:",t)}),v=L(v,r),g(r),u(a,b()),t.n=7;break;case 6:t.p=6,d=t.v,console.error("Failed to fetch dynamic GeoJSON for ".concat(o.id,":"),d);case 7:return t.p=7,m=!1,t.f(7);case 8:return t.a(2)}},t,null,[[4,6,7,8]])}),function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){W(i,n,o,a,u,"next",t)}function u(t){W(i,n,o,a,u,"throw",t)}a(void 0)})});return function(){return e.apply(this,arguments)}}(),j=(e=S,n=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){return e.apply(void 0,n)},200)},n.cancel=function(){clearTimeout(r),r=null},n),w=function(){j()};return i.on("moveend",w),S(),{destroy:function(){i.off("moveend",w),j.cancel()},clear:function(){p.clear(),v=null,u(a,{type:"FeatureCollection",features:[]})},refresh:function(){p.clear(),v=null,S()},getFeatureCount:function(){return p.size},reapply:function(){p.size>0&&u(a,b())}}}({dataset:t,map:u,sourceId:e,onUpdate:function(t,e){return function(t,e,r){var n=t.getSource(e);n&&"function"==typeof n.setData&&n.setData(r)}(u,t,e)}});c.set(t.id,r)}}),u.once("idle",function(){a.emit("datasets:ready")});var f=function(t){var e=t.map,r=t.events,n=t.getDatasets,o=t.getHiddenFeatures,i=t.getDynamicSources,a=function(t){e.once("idle",function(){var r=t.id,a=n(),u=o(),l=i?i():new Map;a.forEach(function(t){O(e,r,t)}),l.forEach(function(t){t.reapply()}),Object.entries(u).forEach(function(t){var r=function(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,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return A(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)?A(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.")}()}(t,2),n=r[0],o=r[1],i=o.idProperty,u=o.ids,l=a.find(function(t){return t.id===n});if(l){var c=l.filter||null,s=!!l.fill,f=!!l.stroke,d=s?n:null,y=f?s?"".concat(n,"-stroke"):n:null;d&&k(e,d,c,i,u),y&&k(e,y,c,i,u)}})})};return t.eventBus.on(r.MAP_SET_STYLE,a),a}({map:u,events:i,eventBus:a,getDatasets:s,getHiddenFeatures:function(){return r.current.hiddenFeatures||{}},getDynamicSources:function(){return c}});return{remove:function(){a.off(i.MAP_SET_STYLE,f),c.forEach(function(t){return t.destroy()}),c.clear();var t=s(),e=new Set;t.forEach(function(t){var r=j(t),n=function(t,e){var r=t.getStyle();return null!=r&&r.layers?r.layers.filter(function(t){return t.source===e}).map(function(t){return t.id}):[]}(u,r);n.forEach(function(t){return u.removeLayer(t)}),!e.has(r)&&u.getSource(r)&&(u.removeSource(r),e.add(r))})},refreshDataset:function(t){var e=c.get(t);e&&e.refresh()},clearDatasetCache:function(t){var e=c.get(t);e&&e.clear()},getFeatureCount:function(t){var e=c.get(t);return e?e.getFeatureCount():null}}},B=function(t,e){var r=t.mapProvider,n=t.pluginState,o=r.map;o.getLayer(e)&&o.setLayoutProperty(e,"visibility","visible"),o.getLayer("".concat(e,"-stroke"))&&o.setLayoutProperty("".concat(e,"-stroke"),"visibility","visible"),n.dispatch({type:"SET_DATASET_VISIBILITY",payload:{id:e,visibility:"visible"}})},K=function(t,e){var r=t.mapProvider,n=t.pluginState,o=r.map;o.getLayer(e)&&o.setLayoutProperty(e,"visibility","none"),o.getLayer("".concat(e,"-stroke"))&&o.setLayoutProperty("".concat(e,"-stroke"),"visibility","none"),n.dispatch({type:"SET_DATASET_VISIBILITY",payload:{id:e,visibility:"hidden"}})},H=r("react/jsx-runtime");function Z(t){return Z="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},Z(t)}function $(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 V(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?$(Object(r),!0).forEach(function(e){Y(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Y(t,e,r){return(e=function(t){var e=function(t){if("object"!=Z(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=Z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Z(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function J(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)||function(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}}(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 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}var Q={InitComponent:function(t){var e,r=t.pluginConfig,n=t.pluginState,o=t.appState,i=t.mapState,a=t.mapProvider,u=t.services,l=n.dispatch,c=u.events,s=u.eventBus,y=!(null===(e=a.map)||void 0===e||!e.getStyle()),p=(0,f.useRef)(n);p.current=n;var v=(0,f.useRef)(null);return(0,f.useEffect)(function(){var t,e,u,f,m=null===(t=null===(e=r.includeModes)||void 0===e?void 0:e.includes(o.mode))||void 0===t||t,b=null!==(u=null===(f=r.excludeModes)||void 0===f?void 0:f.includes(o.mode))&&void 0!==u&&u;y&&m&&!b&&(v.current||(n.datasets||l({type:"SET_DATASETS",payload:{datasets:r.datasets,datasetDefaults:d}}),v.current=z({mapStyleId:i.mapStyle.id,pluginConfig:r,pluginStateRef:p,mapProvider:a,events:c,eventBus:s})))},[y,o.mode]),(0,f.useEffect)(function(){return function(){v.current&&(v.current.remove(),v.current=null)}},[]),null},reducer:{initialState:{datasets:null,hiddenFeatures:{}},actions:s},panels:[{id:"datasetsLayers",label:"Layers",mobile:{slot:"bottom",modal:!0,dismissable:!0},tablet:{slot:"inset",dismissable:!0,exclusive:!0,width:"300px"},desktop:{slot:"inset",modal:!1,dismissable:!0,exclusive:!0,width:"320px"},render:function(t){var e=t.pluginState,r=t.mapProvider,n=function(t){var n=t.target,o=n.value;n.checked?B({mapProvider:r,pluginState:e},o):K({mapProvider:r,pluginState:e},o)};return(0,H.jsx)("div",{className:"im-c-datasets-layers",children:(0,H.jsx)("div",{className:"govuk-form-group",children:(0,H.jsxs)("fieldset",{className:"govuk-fieldset",children:[(0,H.jsx)("legend",{className:"govuk-visually-hidden",children:"Layers"}),(0,H.jsx)("div",{className:"govuk-checkboxes govuk-checkboxes--small","data-module":"govuk-checkboxes",children:(e.datasets||[]).filter(function(t){return t.showInLayers}).map(function(t){return(0,H.jsx)("div",{className:"im-c-datasets-layers__item".concat("hidden"!==t.visibility?" im-c-datasets-layers__item--checked":""),children:(0,H.jsxs)("div",{className:"govuk-checkboxes__item",children:[(0,H.jsx)("input",{className:"govuk-checkboxes__input",id:t.id,name:"layers",type:"checkbox",value:t.id,checked:"hidden"!==t.visibility,onChange:n}),(0,H.jsx)("label",{className:"im-c-datasets-layers__item-label govuk-label govuk-checkboxes__label",htmlFor:t.id,children:t.label})]})},t.id)})})]})})})}},{id:"datasetsKey",label:"Key",mobile:{slot:"bottom",modal:!0},tablet:{slot:"inset",width:"300px"},desktop:{slot:"inset",width:"320px"},render:function(t){var e=t.mapState,r=t.pluginState,n=e.mapStyle,o=function(t){return(0,H.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:"line"===t.keySymbolShape?(0,H.jsx)("line",{x1:t.strokeWidth/2,y1:"10",x2:20-t.strokeWidth/2,y2:"10",stroke:p(t.stroke,n.id),strokeWidth:t.strokeWidth,strokeLinecap:"round"}):(0,H.jsx)("rect",{x:t.strokeWidth/2,y:t.strokeWidth/2,width:20-t.strokeWidth,height:20-t.strokeWidth,rx:t.strokeWidth,ry:t.strokeWidth,fill:p(t.fill,n.id),stroke:p(t.stroke,n.id),strokeWidth:t.strokeWidth,strokeLinejoin:"round"})})};return(0,H.jsx)("div",{className:"im-c-datasets-key",children:(r.datasets||[]).filter(function(t){return t.showInKey&&"hidden"!==t.visibility}).map(function(t){return(0,H.jsx)("div",{className:"im-c-datasets-key__item",children:(0,H.jsxs)("div",{className:"im-c-datasets-key__item-label",children:[o(t),t.label,t.symbolDescription&&(0,H.jsxs)("span",{className:"govuk-visually-hidden",children:["(",p(t.symbolDescription,n.id),")"]})]})},t.id)})})}}],buttons:[{id:"datasetsLayers",label:"Layers",panelId:"datasetsLayers",iconId:"layers",excludeWhen:function(t){return!t.pluginConfig.datasets.find(function(t){return t.showInLayers})},mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}},{id:"datasetsKey",label:"Key",panelId:"datasetsKey",iconId:"key",excludeWhen:function(t){return!t.pluginConfig.datasets.find(function(t){return t.showInKey})},mobile:{slot:"top-left",showLabel:!1},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"layers",svgContent:'<path d="M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z"></path><path d="m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845"></path>'},{id:"key",svgContent:'<path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/>'}],api:{showDataset:B,hideDataset:K,addDataset:function(t,e){var r=t.mapProvider,n=t.mapState,o=t.pluginState,i=r.map;O(i,n.mapStyle.id,V(V({},d),e)),o.dispatch({type:"ADD_DATASET",payload:{dataset:e,datasetDefaults:d}})},removeDataset:function(t,e){var r,n,o=t.mapProvider,i=t.pluginState,a=o.map,u=null===(r=i.datasets)||void 0===r?void 0:r.find(function(t){return t.id===e});if(u){var l=function(t){var e=!!t.fill,r=!!t.stroke,n=e?t.id:null,o=null;return r&&(o=e?"".concat(t.id,"-stroke"):t.id),{fillLayerId:n,strokeLayerId:o}}(u),c=l.fillLayerId,s=l.strokeLayerId,f=j(u);[s,c].forEach(function(t){t&&a.getLayer(t)&&a.removeLayer(t)}),!(null===(n=i.datasets)||void 0===n?void 0:n.some(function(t){return t.id!==e&&j(t)===f}))&&a.getSource(f)&&a.removeSource(f),i.dispatch({type:"REMOVE_DATASET",payload:{id:e}})}},showFeatures:function(t,e){var r,n=t.mapProvider,o=t.pluginState,i=e.featureIds,a=e.idProperty,u=e.datasetId,l=n.map,c=o.hiddenFeatures[u];if(c){var s=null===(r=o.datasets)||void 0===r?void 0:r.find(function(t){return t.id===u});if(s){var f=s.filter||null,d=!!s.fill,y=!!s.stroke,p=d?u:null,v=null;y&&(v=d?"".concat(u,"-stroke"):u);var m=c.ids.filter(function(t){return!i.includes(t)});o.dispatch({type:"SHOW_FEATURES",payload:{layerId:u,featureIds:i}}),p&&k(l,p,f,a,m),v&&k(l,v,f,a,m)}}},hideFeatures:function(t,e){var r,n=t.mapProvider,o=t.pluginState,i=e.featureIds,a=e.idProperty,u=e.datasetId,l=n.map,c=null===(r=o.datasets)||void 0===r?void 0:r.find(function(t){return t.id===u});if(c){var s=c.filter||null,f=!!c.fill,d=!!c.stroke,y=f?u:null,p=null;d&&(p=f?"".concat(u,"-stroke"):u);var v=o.hiddenFeatures[u],m=v?J(new Set([].concat(J(v.ids),J(i)))):i;o.dispatch({type:"HIDE_FEATURES",payload:{layerId:u,idProperty:a,featureIds:i}}),y&&k(l,y,s,a,m),p&&k(l,p,s,a,m)}}}}}};
@@ -0,0 +1,2 @@
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ import*as t from"react";import*as e from"react/jsx-runtime";var r,n,o={react(e,r,n){var o,i;e.exports=(o={useEffect:()=>t.useEffect,useRef:()=>t.useRef},i={},n.d(i,o),i)},"react/jsx-runtime"(t,r,n){var o,i;t.exports=(o={jsx:()=>e.jsx,jsxs:()=>e.jsxs},i={},n.d(i,o),i)}},i={};function u(t){var e=i[t];if(void 0!==e)return e.exports;var r=i[t]={exports:{}};return o[t](r,r.exports,u),r.exports}u.m=o,u.d=(t,e)=>{for(var r in e)u.o(e,r)&&!u.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},u.f={},u.e=t=>Promise.all(Object.keys(u.f).reduce((e,r)=>(u.f[r](t,e),e),[])),u.u=t=>"../esm/"+t+".js",u.miniCssF=t=>{},u.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),u.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;if("string"==typeof import.meta.url&&(t=import.meta.url),!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u.p=t+"../css/"})(),r={index:0},n=t=>{var e,n,{__webpack_esm_ids__:o,__webpack_esm_modules__:i,__webpack_esm_runtime__:c}=t,a=0;for(e in i)u.o(i,e)&&(u.m[e]=i[e]);for(c&&c(u);a<o.length;a++)n=o[a],u.o(r,n)&&r[n]&&r[n][0](),r[o[a]]=0},u.f.j=(t,e)=>{var o=u.o(r,t)?r[t]:void 0;if(0!==o)if(o)e.push(o[1]);else{var i=import("../css/"+u.u(t)).then(n,e=>{throw 0!==r[t]&&(r[t]=void 0),e});i=Promise.race([i,new Promise(e=>o=r[t]=[e])]),e.push(o[1]=i)}};var c={};function a(t){return a="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},a(t)}function f(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var a=n&&n.prototype instanceof c?n:c,f=Object.create(a.prototype);return s(f,"_invoke",function(r,n,o){var i,c,a,f=0,s=o||[],p=!1,l={p:0,n:0,v:t,a:b,f:b.bind(t,4),d:function(e,r){return i=e,c=0,a=t,l.n=r,u}};function b(r,n){for(c=r,a=n,e=0;!p&&f&&!o&&e<s.length;e++){var o,i=s[e],b=l.p,y=i[2];r>3?(o=y===n)&&(a=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=t):i[0]<=b&&((o=r<2&&b<i[1])?(c=0,l.v=n,l.n=i[1]):b<y&&(o=r<3||i[0]>n||n>y)&&(i[4]=r,i[5]=n,l.n=y,c=0))}if(o||r>1)return u;throw p=!0,n}return function(o,s,y){if(f>1)throw TypeError("Generator is already running");for(p&&1===s&&b(s,y),c=s,a=y;(e=c<2?t:a)||!p;){i||(c?c<3?(c>1&&(l.n=-1),b(c,a)):l.n=a:l.v=a);try{if(f=2,i){if(c||(o="next"),e=i[o]){if(!(e=e.call(i,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,c<2&&(c=0)}else 1===c&&(e=i.return)&&e.call(i),c<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=t}else if((e=(p=l.n<0)?a:r.call(n,l))!==u)break}catch(e){i=t,c=1,a=e}finally{f=1}}return{value:e,done:p}}}(r,o,i),!0),f}var u={};function c(){}function a(){}function p(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(s(e={},n,function(){return this}),e),b=p.prototype=c.prototype=Object.create(l);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,s(t,o,"GeneratorFunction")),t.prototype=Object.create(b),t}return a.prototype=p,s(b,"constructor",p),s(p,"constructor",a),a.displayName="GeneratorFunction",s(p,o,"GeneratorFunction"),s(b),s(b,o,"Generator"),s(b,n,function(){return this}),s(b,"toString",function(){return"[object Generator]"}),(f=function(){return{w:i,m:y}})()}function s(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}s=function(t,e,r,n){function i(e,r){s(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},s(t,e,r,n)}function p(t,e,r,n,o,i,u){try{var c=t[i](u),a=c.value}catch(t){return void r(t)}c.done?e(a):Promise.resolve(a).then(n,o)}function l(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 b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?l(Object(r),!0).forEach(function(e){y(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function y(t,e,r){return(e=function(t){var e=function(t){if("object"!=a(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function m(){var t,e,r=b(b({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"datasets",load:(t=f().m(function t(){var e;return f().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,u.e("im-datasets-plugin").then(u.bind(u,"./plugins/beta/datasets/src/manifest.js"));case 1:return e=t.v.manifest,t.a(2,e)}},t)}),e=function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function u(t){p(i,n,o,u,c,"next",t)}function c(t){p(i,n,o,u,c,"throw",t)}u(void 0)})},function(){return e.apply(this,arguments)})});return r}u.d(c,{A:()=>m});const v=c.A;export{v as default};
@@ -0,0 +1,2 @@
1
+ /*! For license information please see im-datasets-plugin.js.LICENSE.txt */
2
+ "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[447],{802(t,e,r){function n(t){return n="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},n(t)}function o(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return i(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)?i(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(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 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 u(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){l(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 l(t,e,r){return(e=c(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}r.r(e),r.d(e,{manifest:()=>Q});var s={SET_DATASETS:function(t,e){var r=e.datasets,n=e.datasetDefaults;return u(u({},t),{},{datasets:r.map(function(t){return u(u({},n),t)})})},ADD_DATASET:function(t,e){var r=e.dataset,n=e.datasetDefaults;return u(u({},t),{},{datasets:[].concat(o(t.datasets||[]),[u(u({},n),r)])})},REMOVE_DATASET:function(t,e){var r,n=e.id;return u(u({},t),{},{datasets:(null===(r=t.datasets)||void 0===r?void 0:r.filter(function(t){return t.id!==n}))||[]})},SET_DATASET_VISIBILITY:function(t,e){var r,n=e.id,o=e.visibility;return u(u({},t),{},{datasets:null===(r=t.datasets)||void 0===r?void 0:r.map(function(t){return t.id===n?u(u({},t),{},{visibility:o}):t})})},HIDE_FEATURES:function(t,e){var r=e.layerId,n=e.idProperty,i=e.featureIds,a=t.hiddenFeatures[r],c=(null==a?void 0:a.ids)||[],s=o(new Set([].concat(o(c),o(i))));return u(u({},t),{},{hiddenFeatures:u(u({},t.hiddenFeatures),{},l({},r,{idProperty:n,ids:s}))})},SHOW_FEATURES:function(t,e){var r=e.layerId,n=e.featureIds,o=t.hiddenFeatures[r];if(!o)return t;var i=o.ids.filter(function(t){return!n.includes(t)});if(0===i.length){var a=t.hiddenFeatures,s=(a[r],function(t,e){if(null==t)return{};var r,n,o=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 i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(a,[r].map(c)));return u(u({},t),{},{hiddenFeatures:s})}return u(u({},t),{},{hiddenFeatures:u(u({},t.hiddenFeatures),{},l({},r,u(u({},o),{},{ids:i})))})}},f=r(738),d={stroke:"#d4351c",strokeWidth:2,fill:"transparent",symbolDescription:"red outline",minZoom:6,maxZoom:24,showInKey:!1,showInLayers:!1,visibility:"visible"};function y(t){return y="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},y(t)}var p=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===y(t)){if(e&&t[e])return t[e];var r=Object.values(t)[0];return null!=r?r:null}return null};function v(t){return v="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},v(t)}function m(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 b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach(function(e){h(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function h(t,e,r){return(e=function(t){var e=function(t){if("object"!=v(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==v(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function g(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){var e,r=0,n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return g(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)?g(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(t);try{for(n.s();!(e=n.n()).done;)r=(r<<5)-r+e.value.codePointAt(0),r&=r}catch(t){n.e(t)}finally{n.f()}return Math.abs(r).toString(36)},j=function(t){if(t.tiles){var e=Array.isArray(t.tiles)?t.tiles.join(","):t.tiles;return"tiles-".concat(S(e))}return t.geojson?w(t)?"geojson-dynamic-".concat(t.id):"string"==typeof t.geojson?"geojson-".concat(S(t.geojson)):"geojson-".concat(t.id):"source-".concat(t.id)},w=function(t){return"string"==typeof t.geojson&&!!t.idProperty&&"function"==typeof t.transformRequest},O=function(t,e,r){var n=j(r);if(!t.getSource(n))if(r.tiles)t.addSource(n,{type:"vector",tiles:r.tiles,minzoom:r.minZoom||0,maxzoom:r.maxZoom||22});else if(r.geojson){var o=w(r)?{type:"FeatureCollection",features:[]}:r.geojson;t.addSource(n,{type:"geojson",data:o})}var i=!!r.fill,a=!!r.stroke,u=i?r.id:null,l=a?i?"".concat(r.id,"-stroke"):r.id:null,c="hidden"===r.visibility?"none":"visible";if(i&&!t.getLayer(u)){var s,f=p(r.fill,e);t.addLayer(b({id:u,type:"fill",source:n,"source-layer":null!=r&&null!==(s=r.tiles)&&void 0!==s&&s.length?r.sourceLayer:void 0,layout:{visibility:c},paint:{"fill-color":f,"fill-opacity":r.opacity||1}},r.filter?{filter:r.filter}:{}))}if(a&&!t.getLayer(l)){var d,y=p(r.stroke,e);t.addLayer(b({id:l,type:"line",source:n,"source-layer":null!=r&&null!==(d=r.tiles)&&void 0!==d&&d.length?r.sourceLayer:void 0,layout:{visibility:c},paint:b({"line-color":y,"line-width":r.strokeWidth||1,"line-opacity":r.opacity||1},r.strokeDashArray?{"line-dasharray":r.strokeDashArray}:{})},r.filter?{filter:r.filter}:{}))}},k=function(t,e,r,n,o){if(t.getLayer(e)){var i=function(t,e,r){if(!r||0===r.length)return t;var n=["!",["in",["to-string",["get",e]],["literal",r.map(function(t){return String(t)})]]];return t?["all",t,n]:n}(r,n,o);t.setFilter(e,i)}};function A(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 P(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var l=n&&n.prototype instanceof u?n:u,c=Object.create(l.prototype);return E(c,"_invoke",function(r,n,o){var i,u,l,c=0,s=o||[],f=!1,d={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return i=e,u=0,l=t,d.n=r,a}};function y(r,n){for(u=r,l=n,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=d.p,p=i[2];r>3?(o=p===n)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=r<2&&y<i[1])?(u=0,d.v=n,d.n=i[1]):y<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,d.n=p,u=0))}if(o||r>1)return a;throw f=!0,n}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(d.n=-1),y(u,l)):d.n=l:d.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=d.n<0)?l:r.call(n,d))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(r,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][n]?e(e([][n]())):(E(e={},n,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,E(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,E(f,"constructor",c),E(c,"constructor",l),l.displayName="GeneratorFunction",E(c,o,"GeneratorFunction"),E(f),E(f,o,"Generator"),E(f,n,function(){return this}),E(f,"toString",function(){return"[object Generator]"}),(P=function(){return{w:i,m:d}})()}function E(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}E=function(t,e,r,n){function i(e,r){E(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},E(t,e,r,n)}function I(t,e,r,n,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void r(t)}u.done?e(l):Promise.resolve(l).then(n,o)}var x=function(){var t,e=(t=P().m(function t(e,r,n){var o,i,a,u,l,c,s;return P().w(function(t){for(;;)switch(t.n){case 0:return o=n(e,r),a=(i="string"==typeof o?{url:o}:o).url,u=i.headers,l=void 0===u?{}:u,t.n=1,fetch(a,{headers:l});case 1:if((c=t.v).ok){t.n=2;break}throw new Error("Failed to fetch GeoJSON: ".concat(c.status," ").concat(c.statusText));case 2:return t.n=3,c.json();case 3:if("FeatureCollection"!==(s=t.v).type){t.n=4;break}return t.a(2,s);case 4:if("Feature"!==s.type){t.n=5;break}return t.a(2,{type:"FeatureCollection",features:[s]});case 5:if(!Array.isArray(s)){t.n=6;break}return t.a(2,{type:"FeatureCollection",features:s});case 6:throw new Error("Invalid GeoJSON response");case 7:return t.a(2)}},t)}),function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){I(i,n,o,a,u,"next",t)}function u(t){I(i,n,o,a,u,"throw",t)}a(void 0)})});return function(t,r,n){return e.apply(this,arguments)}}();function T(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 D=function(t){var e=t.getBounds();return[e.getWest(),e.getSouth(),e.getEast(),e.getNorth()]},_=function(t,e){return!(!t||!e)&&e[0]>=t[0]&&e[1]>=t[1]&&e[2]<=t[2]&&e[3]<=t[3]},L=function(t,e){return t?[Math.min(t[0],e[0]),Math.min(t[1],e[1]),Math.max(t[2],e[2]),Math.max(t[3],e[3])]:function(t){if(Array.isArray(t))return T(t)}(r=e)||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 T(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)?T(t,e):void 0}}(r)||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.")}();var r},F=function(t,e){return!(!t||!e||t[2]<e[0]||t[0]>e[2]||t[3]<e[1]||t[1]>e[3])},M=function(t){var e=1/0,r=1/0,n=-1/0,o=-1/0,i=function(t,a){var u;0===a?(u=t,e=Math.min(e,u[0]),r=Math.min(r,u[1]),n=Math.max(n,u[0]),o=Math.max(o,u[1])):t.forEach(function(t){return i(t,a-1)})};switch(t.type){case"Point":i(t.coordinates,0);break;case"LineString":case"MultiPoint":i(t.coordinates,1);break;case"Polygon":case"MultiLineString":i(t.coordinates,2);break;case"MultiPolygon":i(t.coordinates,3);break;case"GeometryCollection":t.geometries.forEach(function(t){var i=M(t);e=Math.min(e,i[0]),r=Math.min(r,i[1]),n=Math.max(n,i[2]),o=Math.max(o,i[3])})}return[e,r,n,o]};function C(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var l=n&&n.prototype instanceof u?n:u,c=Object.create(l.prototype);return N(c,"_invoke",function(r,n,o){var i,u,l,c=0,s=o||[],f=!1,d={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return i=e,u=0,l=t,d.n=r,a}};function y(r,n){for(u=r,l=n,e=0;!f&&c&&!o&&e<s.length;e++){var o,i=s[e],y=d.p,p=i[2];r>3?(o=p===n)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=r<2&&y<i[1])?(u=0,d.v=n,d.n=i[1]):y<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,d.n=p,u=0))}if(o||r>1)return a;throw f=!0,n}return function(o,s,p){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,p),u=s,l=p;(e=u<2?t:l)||!f;){i||(u?u<3?(u>1&&(d.n=-1),y(u,l)):d.n=l:d.v=l);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=d.n<0)?l:r.call(n,d))!==a)break}catch(e){i=t,u=1,l=e}finally{c=1}}return{value:e,done:f}}}(r,o,i),!0),c}var a={};function u(){}function l(){}function c(){}e=Object.getPrototypeOf;var s=[][n]?e(e([][n]())):(N(e={},n,function(){return this}),e),f=c.prototype=u.prototype=Object.create(s);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,N(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=c,N(f,"constructor",c),N(c,"constructor",l),l.displayName="GeneratorFunction",N(c,o,"GeneratorFunction"),N(f),N(f,o,"Generator"),N(f,n,function(){return this}),N(f,"toString",function(){return"[object Generator]"}),(C=function(){return{w:i,m:d}})()}function N(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}N=function(t,e,r,n){function i(e,r){N(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},N(t,e,r,n)}function W(t,e,r,n,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void r(t)}u.done?e(l):Promise.resolve(l).then(n,o)}function G(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,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||R(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 R(t,e){if(t){if("string"==typeof t)return U(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)?U(t,e):void 0}}function U(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 z=function(t){var e=t.pluginConfig,r=t.pluginStateRef,n=t.mapStyleId,o=t.mapProvider,i=t.events,a=t.eventBus,u=o.map,l=e.datasets,c=new Map,s=function(){return r.current.datasets||l};l.forEach(function(t){if(O(u,n,t),w(t)){var e=j(t),r=function(t){var e,r,n,o=t.dataset,i=t.map,a=t.sourceId,u=t.onUpdate,l=o.geojson,c=o.idProperty,s=o.transformRequest,f=o.maxFeatures,d=o.minZoom,y=void 0===d?0:d,p=new Map,v=null,m=!1,b=function(){return{type:"FeatureCollection",features:Array.from(p.values()).map(function(t){return t.feature})}},h=function(t){var e,r;return c&&null!==(e=null===(r=t.properties)||void 0===r?void 0:r[c])&&void 0!==e?e:t.id},g=function(t){if(f&&!(p.size<=1.2*f)){var e,r=f,n=[],o=[],i=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=R(t))){e&&(t=e);var r=0,n=function(){};return{s:n,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==e.return||e.return()}finally{if(a)throw o}}}}(p);try{for(i.s();!(e=i.n()).done;){var a=G(e.value,2),u=a[0],l=a[1];F(l.bbox,t)?n.push(u):o.push({id:u,addedAt:l.addedAt})}}catch(t){i.e(t)}finally{i.f()}o.sort(function(t,e){return t.addedAt-e.addedAt});for(var c=p.size-r,s=0;s<c&&s<o.length;s++)p.delete(o[s].id);if(p.size>r)for(var d=p.size-r,y=n.map(function(t){return{id:t,addedAt:p.get(t).addedAt}}).sort(function(t,e){return t.addedAt-e.addedAt}),v=0;v<d&&v<y.length;v++)p.delete(y[v].id)}},S=function(){var t,e=(t=C().m(function t(){var e,r,n,c,f,d;return C().w(function(t){for(;;)switch(t.p=t.n){case 0:if(!((e=i.getZoom())<y)){t.n=1;break}return t.a(2);case 1:if(r=D(i),!v||!_(v,r)){t.n=2;break}return t.a(2);case 2:if(!m){t.n=3;break}return t.a(2);case 3:return m=!0,t.p=4,n={bbox:r,zoom:e,dataset:o},t.n=5,x(l,n,s);case 5:c=t.v,f=Date.now(),c.features.forEach(function(t){var e=h(t);null!=e?p.set(e,{feature:t,bbox:M(t.geometry),addedAt:p.has(e)?p.get(e).addedAt:f}):console.warn("Feature missing ID, skipping:",t)}),v=L(v,r),g(r),u(a,b()),t.n=7;break;case 6:t.p=6,d=t.v,console.error("Failed to fetch dynamic GeoJSON for ".concat(o.id,":"),d);case 7:return t.p=7,m=!1,t.f(7);case 8:return t.a(2)}},t,null,[[4,6,7,8]])}),function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){W(i,n,o,a,u,"next",t)}function u(t){W(i,n,o,a,u,"throw",t)}a(void 0)})});return function(){return e.apply(this,arguments)}}(),j=(e=S,n=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){return e.apply(void 0,n)},200)},n.cancel=function(){clearTimeout(r),r=null},n),w=function(){j()};return i.on("moveend",w),S(),{destroy:function(){i.off("moveend",w),j.cancel()},clear:function(){p.clear(),v=null,u(a,{type:"FeatureCollection",features:[]})},refresh:function(){p.clear(),v=null,S()},getFeatureCount:function(){return p.size},reapply:function(){p.size>0&&u(a,b())}}}({dataset:t,map:u,sourceId:e,onUpdate:function(t,e){return function(t,e,r){var n=t.getSource(e);n&&"function"==typeof n.setData&&n.setData(r)}(u,t,e)}});c.set(t.id,r)}}),u.once("idle",function(){a.emit("datasets:ready")});var f=function(t){var e=t.map,r=t.events,n=t.getDatasets,o=t.getHiddenFeatures,i=t.getDynamicSources,a=function(t){e.once("idle",function(){var r=t.id,a=n(),u=o(),l=i?i():new Map;a.forEach(function(t){O(e,r,t)}),l.forEach(function(t){t.reapply()}),Object.entries(u).forEach(function(t){var r=function(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,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return A(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)?A(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.")}()}(t,2),n=r[0],o=r[1],i=o.idProperty,u=o.ids,l=a.find(function(t){return t.id===n});if(l){var c=l.filter||null,s=!!l.fill,f=!!l.stroke,d=s?n:null,y=f?s?"".concat(n,"-stroke"):n:null;d&&k(e,d,c,i,u),y&&k(e,y,c,i,u)}})})};return t.eventBus.on(r.MAP_SET_STYLE,a),a}({map:u,events:i,eventBus:a,getDatasets:s,getHiddenFeatures:function(){return r.current.hiddenFeatures||{}},getDynamicSources:function(){return c}});return{remove:function(){a.off(i.MAP_SET_STYLE,f),c.forEach(function(t){return t.destroy()}),c.clear();var t=s(),e=new Set;t.forEach(function(t){var r=j(t),n=function(t,e){var r=t.getStyle();return null!=r&&r.layers?r.layers.filter(function(t){return t.source===e}).map(function(t){return t.id}):[]}(u,r);n.forEach(function(t){return u.removeLayer(t)}),!e.has(r)&&u.getSource(r)&&(u.removeSource(r),e.add(r))})},refreshDataset:function(t){var e=c.get(t);e&&e.refresh()},clearDatasetCache:function(t){var e=c.get(t);e&&e.clear()},getFeatureCount:function(t){var e=c.get(t);return e?e.getFeatureCount():null}}},B=function(t,e){var r=t.mapProvider,n=t.pluginState,o=r.map;o.getLayer(e)&&o.setLayoutProperty(e,"visibility","visible"),o.getLayer("".concat(e,"-stroke"))&&o.setLayoutProperty("".concat(e,"-stroke"),"visibility","visible"),n.dispatch({type:"SET_DATASET_VISIBILITY",payload:{id:e,visibility:"visible"}})},K=function(t,e){var r=t.mapProvider,n=t.pluginState,o=r.map;o.getLayer(e)&&o.setLayoutProperty(e,"visibility","none"),o.getLayer("".concat(e,"-stroke"))&&o.setLayoutProperty("".concat(e,"-stroke"),"visibility","none"),n.dispatch({type:"SET_DATASET_VISIBILITY",payload:{id:e,visibility:"hidden"}})},H=r(287);function Z(t){return Z="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},Z(t)}function $(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 V(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?$(Object(r),!0).forEach(function(e){Y(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Y(t,e,r){return(e=function(t){var e=function(t){if("object"!=Z(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=Z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Z(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function J(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)||function(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}}(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 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}var Q={InitComponent:function(t){var e,r=t.pluginConfig,n=t.pluginState,o=t.appState,i=t.mapState,a=t.mapProvider,u=t.services,l=n.dispatch,c=u.events,s=u.eventBus,y=!(null===(e=a.map)||void 0===e||!e.getStyle()),p=(0,f.useRef)(n);p.current=n;var v=(0,f.useRef)(null);return(0,f.useEffect)(function(){var t,e,u,f,m=null===(t=null===(e=r.includeModes)||void 0===e?void 0:e.includes(o.mode))||void 0===t||t,b=null!==(u=null===(f=r.excludeModes)||void 0===f?void 0:f.includes(o.mode))&&void 0!==u&&u;y&&m&&!b&&(v.current||(n.datasets||l({type:"SET_DATASETS",payload:{datasets:r.datasets,datasetDefaults:d}}),v.current=z({mapStyleId:i.mapStyle.id,pluginConfig:r,pluginStateRef:p,mapProvider:a,events:c,eventBus:s})))},[y,o.mode]),(0,f.useEffect)(function(){return function(){v.current&&(v.current.remove(),v.current=null)}},[]),null},reducer:{initialState:{datasets:null,hiddenFeatures:{}},actions:s},panels:[{id:"datasetsLayers",label:"Layers",mobile:{slot:"bottom",modal:!0,dismissable:!0},tablet:{slot:"inset",dismissable:!0,exclusive:!0,width:"300px"},desktop:{slot:"inset",modal:!1,dismissable:!0,exclusive:!0,width:"320px"},render:function(t){var e=t.pluginState,r=t.mapProvider,n=function(t){var n=t.target,o=n.value;n.checked?B({mapProvider:r,pluginState:e},o):K({mapProvider:r,pluginState:e},o)};return(0,H.jsx)("div",{className:"im-c-datasets-layers",children:(0,H.jsx)("div",{className:"govuk-form-group",children:(0,H.jsxs)("fieldset",{className:"govuk-fieldset",children:[(0,H.jsx)("legend",{className:"govuk-visually-hidden",children:"Layers"}),(0,H.jsx)("div",{className:"govuk-checkboxes govuk-checkboxes--small","data-module":"govuk-checkboxes",children:(e.datasets||[]).filter(function(t){return t.showInLayers}).map(function(t){return(0,H.jsx)("div",{className:"im-c-datasets-layers__item".concat("hidden"!==t.visibility?" im-c-datasets-layers__item--checked":""),children:(0,H.jsxs)("div",{className:"govuk-checkboxes__item",children:[(0,H.jsx)("input",{className:"govuk-checkboxes__input",id:t.id,name:"layers",type:"checkbox",value:t.id,checked:"hidden"!==t.visibility,onChange:n}),(0,H.jsx)("label",{className:"im-c-datasets-layers__item-label govuk-label govuk-checkboxes__label",htmlFor:t.id,children:t.label})]})},t.id)})})]})})})}},{id:"datasetsKey",label:"Key",mobile:{slot:"bottom",modal:!0},tablet:{slot:"inset",width:"300px"},desktop:{slot:"inset",width:"320px"},render:function(t){var e=t.mapState,r=t.pluginState,n=e.mapStyle,o=function(t){return(0,H.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:"line"===t.keySymbolShape?(0,H.jsx)("line",{x1:t.strokeWidth/2,y1:"10",x2:20-t.strokeWidth/2,y2:"10",stroke:p(t.stroke,n.id),strokeWidth:t.strokeWidth,strokeLinecap:"round"}):(0,H.jsx)("rect",{x:t.strokeWidth/2,y:t.strokeWidth/2,width:20-t.strokeWidth,height:20-t.strokeWidth,rx:t.strokeWidth,ry:t.strokeWidth,fill:p(t.fill,n.id),stroke:p(t.stroke,n.id),strokeWidth:t.strokeWidth,strokeLinejoin:"round"})})};return(0,H.jsx)("div",{className:"im-c-datasets-key",children:(r.datasets||[]).filter(function(t){return t.showInKey&&"hidden"!==t.visibility}).map(function(t){return(0,H.jsx)("div",{className:"im-c-datasets-key__item",children:(0,H.jsxs)("div",{className:"im-c-datasets-key__item-label",children:[o(t),t.label,t.symbolDescription&&(0,H.jsxs)("span",{className:"govuk-visually-hidden",children:["(",p(t.symbolDescription,n.id),")"]})]})},t.id)})})}}],buttons:[{id:"datasetsLayers",label:"Layers",panelId:"datasetsLayers",iconId:"layers",excludeWhen:function(t){return!t.pluginConfig.datasets.find(function(t){return t.showInLayers})},mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}},{id:"datasetsKey",label:"Key",panelId:"datasetsKey",iconId:"key",excludeWhen:function(t){return!t.pluginConfig.datasets.find(function(t){return t.showInKey})},mobile:{slot:"top-left",showLabel:!1},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"layers",svgContent:'<path d="M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z"></path><path d="m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845"></path>'},{id:"key",svgContent:'<path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/>'}],api:{showDataset:B,hideDataset:K,addDataset:function(t,e){var r=t.mapProvider,n=t.mapState,o=t.pluginState,i=r.map;O(i,n.mapStyle.id,V(V({},d),e)),o.dispatch({type:"ADD_DATASET",payload:{dataset:e,datasetDefaults:d}})},removeDataset:function(t,e){var r,n,o=t.mapProvider,i=t.pluginState,a=o.map,u=null===(r=i.datasets)||void 0===r?void 0:r.find(function(t){return t.id===e});if(u){var l=function(t){var e=!!t.fill,r=!!t.stroke,n=e?t.id:null,o=null;return r&&(o=e?"".concat(t.id,"-stroke"):t.id),{fillLayerId:n,strokeLayerId:o}}(u),c=l.fillLayerId,s=l.strokeLayerId,f=j(u);[s,c].forEach(function(t){t&&a.getLayer(t)&&a.removeLayer(t)}),!(null===(n=i.datasets)||void 0===n?void 0:n.some(function(t){return t.id!==e&&j(t)===f}))&&a.getSource(f)&&a.removeSource(f),i.dispatch({type:"REMOVE_DATASET",payload:{id:e}})}},showFeatures:function(t,e){var r,n=t.mapProvider,o=t.pluginState,i=e.featureIds,a=e.idProperty,u=e.datasetId,l=n.map,c=o.hiddenFeatures[u];if(c){var s=null===(r=o.datasets)||void 0===r?void 0:r.find(function(t){return t.id===u});if(s){var f=s.filter||null,d=!!s.fill,y=!!s.stroke,p=d?u:null,v=null;y&&(v=d?"".concat(u,"-stroke"):u);var m=c.ids.filter(function(t){return!i.includes(t)});o.dispatch({type:"SHOW_FEATURES",payload:{layerId:u,featureIds:i}}),p&&k(l,p,f,a,m),v&&k(l,v,f,a,m)}}},hideFeatures:function(t,e){var r,n=t.mapProvider,o=t.pluginState,i=e.featureIds,a=e.idProperty,u=e.datasetId,l=n.map,c=null===(r=o.datasets)||void 0===r?void 0:r.find(function(t){return t.id===u});if(c){var s=c.filter||null,f=!!c.fill,d=!!c.stroke,y=f?u:null,p=null;d&&(p=f?"".concat(u,"-stroke"):u);var v=o.hiddenFeatures[u],m=v?J(new Set([].concat(J(v.ids),J(i)))):i;o.dispatch({type:"HIDE_FEATURES",payload:{layerId:u,idProperty:a,featureIds:i}}),y&&k(l,y,s,a,m),p&&k(l,p,s,a,m)}}}}}}]);
@@ -0,0 +1,2 @@
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.datasetsPlugin=t())}(this,()=>(()=>{"use strict";var e,t,r={738(e){e.exports=preactCompat},287(e){e.exports=preactJsxRuntime}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.m=r,o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>"im-datasets-plugin.js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="defra.datasetsPlugin:",o.l=(r,n,i,a)=>{if(e[r])e[r].push(n);else{var u,c;if(void 0!==i)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var l=f[p];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+i){u=l;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+i),u.src=r),e[r]=[n];var s=(t,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),t)return t(n)},d=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),c&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=i);var a=o.p+o.u(t),u=new Error;o.l(a,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",u.name="ChunkLoadError",u.type=i,u.request=a,n[1](u)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,i,[a,u,c]=r,f=0;if(a.some(t=>0!==e[t])){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);c&&c(o)}for(t&&t(r);f<a.length;f++)i=a[f],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function u(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof f?n:f,p=Object.create(u.prototype);return c(p,"_invoke",function(r,n,o){var i,u,c,f=0,p=o||[],l=!1,s={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,u=0,c=e,s.n=r,a}};function d(r,n){for(u=r,c=n,t=0;!l&&f&&!o&&t<p.length;t++){var o,i=p[t],d=s.p,b=i[2];r>3?(o=b===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(u=0,s.v=n,s.n=i[1]):d<b&&(o=r<3||i[0]>n||n>b)&&(i[4]=r,i[5]=n,s.n=b,u=0))}if(o||r>1)return a;throw l=!0,n}return function(o,p,b){if(f>1)throw TypeError("Generator is already running");for(l&&1===p&&d(p,b),u=p,c=b;(t=u<2?e:c)||!l;){i||(u?u<3?(u>1&&(s.n=-1),d(u,c)):s.n=c:s.v=c);try{if(f=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(l=s.n<0)?c:r.call(n,s))!==a)break}catch(t){i=e,u=1,c=t}finally{f=1}}return{value:t,done:l}}}(r,o,i),!0),p}var a={};function f(){}function p(){}function l(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(c(t={},n,function(){return this}),t),d=l.prototype=f.prototype=Object.create(s);function b(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,c(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return p.prototype=l,c(d,"constructor",l),c(l,"constructor",p),p.displayName="GeneratorFunction",c(l,o,"GeneratorFunction"),c(d),c(d,o,"Generator"),c(d,n,function(){return this}),c(d,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:b}})()}function c(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,r,n){function i(t,r){c(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},c(e,t,r,n)}function f(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,t,r){return(t=function(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(){var e,t,r=l(l({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"datasets",load:(e=u().m(function e(){var t;return u().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.e(447).then(o.bind(o,802));case 1:return t=e.v.manifest,e.a(2,t)}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){f(i,n,o,a,u,"next",e)}function u(e){f(i,n,o,a,u,"throw",e)}a(void 0)})},function(){return t.apply(this,arguments)})});return r}return o.d(i,{default:()=>d}),i.default})());
@@ -0,0 +1,113 @@
1
+ import { handleSetMapStyle } from './handleSetMapStyle.js'
2
+ import { addMapLayers, getSourceId, getLayersUsingSource, isDynamicSource, updateSourceData } from './mapLayers.js'
3
+ import { createDynamicSource } from './fetch/createDynamicSource.js'
4
+
5
+ export const createDatasets = ({
6
+ pluginConfig,
7
+ pluginStateRef,
8
+ mapStyleId,
9
+ mapProvider,
10
+ events,
11
+ eventBus
12
+ }) => {
13
+ const { map } = mapProvider
14
+ const { datasets } = pluginConfig
15
+
16
+ // Track dynamic sources for cleanup
17
+ const dynamicSources = new Map()
18
+
19
+ const getDatasets = () => pluginStateRef.current.datasets || datasets
20
+ const getHiddenFeatures = () => pluginStateRef.current.hiddenFeatures || {}
21
+
22
+ // Initialize all datasets once
23
+ datasets.forEach(dataset => {
24
+ addMapLayers(map, mapStyleId, dataset)
25
+
26
+ // Initialize dynamic source if applicable
27
+ if (isDynamicSource(dataset)) {
28
+ const sourceId = getSourceId(dataset)
29
+ const dynamicSource = createDynamicSource({
30
+ dataset,
31
+ map,
32
+ sourceId,
33
+ onUpdate: (id, geojson) => updateSourceData(map, id, geojson)
34
+ })
35
+ dynamicSources.set(dataset.id, dynamicSource)
36
+ }
37
+ })
38
+
39
+ // Emit ready event once map has processed the layers
40
+ map.once('idle', () => {
41
+ eventBus.emit('datasets:ready')
42
+ })
43
+
44
+ // Handle style changes
45
+ const styleHandler = handleSetMapStyle({
46
+ map,
47
+ events,
48
+ eventBus,
49
+ getDatasets,
50
+ getHiddenFeatures,
51
+ getDynamicSources: () => dynamicSources
52
+ })
53
+
54
+ return {
55
+ remove() {
56
+ eventBus.off(events.MAP_SET_STYLE, styleHandler)
57
+
58
+ // Clean up dynamic sources
59
+ dynamicSources.forEach(source => source.destroy())
60
+ dynamicSources.clear()
61
+
62
+ const allDatasets = getDatasets()
63
+ const removedSourceIds = new Set()
64
+
65
+ // Remove layers and sources
66
+ allDatasets.forEach(dataset => {
67
+ const sourceId = getSourceId(dataset)
68
+ const layers = getLayersUsingSource(map, sourceId)
69
+
70
+ // Remove all layers using this source
71
+ layers.forEach(id => map.removeLayer(id))
72
+
73
+ // Remove the source once
74
+ if (!removedSourceIds.has(sourceId) && map.getSource(sourceId)) {
75
+ map.removeSource(sourceId)
76
+ removedSourceIds.add(sourceId)
77
+ }
78
+ })
79
+ },
80
+
81
+ /**
82
+ * Refresh a dynamic source - clears cache and re-fetches
83
+ * @param {string} datasetId - Dataset ID to refresh
84
+ */
85
+ refreshDataset(datasetId) {
86
+ const dynamicSource = dynamicSources.get(datasetId)
87
+ if (dynamicSource) {
88
+ dynamicSource.refresh()
89
+ }
90
+ },
91
+
92
+ /**
93
+ * Clear a dynamic source's cache
94
+ * @param {string} datasetId - Dataset ID to clear
95
+ */
96
+ clearDatasetCache(datasetId) {
97
+ const dynamicSource = dynamicSources.get(datasetId)
98
+ if (dynamicSource) {
99
+ dynamicSource.clear()
100
+ }
101
+ },
102
+
103
+ /**
104
+ * Get feature count for a dynamic source
105
+ * @param {string} datasetId - Dataset ID
106
+ * @returns {number|null} Feature count or null if not a dynamic source
107
+ */
108
+ getFeatureCount(datasetId) {
109
+ const dynamicSource = dynamicSources.get(datasetId)
110
+ return dynamicSource ? dynamicSource.getFeatureCount() : null
111
+ }
112
+ }
113
+ }
@@ -0,0 +1,206 @@
1
+ import { fetchGeoJSON } from './fetchGeoJSON.js'
2
+ import { getBboxArray, bboxContains, expandBbox, bboxIntersects, getGeometryBbox } from '../utils/bbox.js'
3
+ import { debounce } from '../utils/debounce.js'
4
+
5
+ const DEBOUNCE_DELAY = 200
6
+ const EVICTION_THRESHOLD = 1.2 // Trigger eviction at 120% of maxFeatures
7
+
8
+ /**
9
+ * Create a dynamic GeoJSON source that fetches data based on viewport
10
+ * @param {Object} options
11
+ * @param {Object} options.dataset - Dataset configuration
12
+ * @param {Object} options.map - Map instance
13
+ * @param {string} options.sourceId - Source ID for the map
14
+ * @param {Function} options.onUpdate - Callback when source data should be updated
15
+ * @returns {Object} { destroy, clear, refresh }
16
+ */
17
+ export const createDynamicSource = ({ dataset, map, sourceId, onUpdate }) => {
18
+ const { geojson: baseUrl, idProperty, transformRequest, maxFeatures, minZoom = 0 } = dataset
19
+
20
+ // Feature cache: id → { feature, bbox, addedAt }
21
+ const features = new Map()
22
+
23
+ // Track the bbox we've fetched data for
24
+ let fetchedBbox = null
25
+
26
+ // Loading state
27
+ let isLoading = false
28
+
29
+ /**
30
+ * Convert features Map to FeatureCollection
31
+ */
32
+ const toFeatureCollection = () => ({
33
+ type: 'FeatureCollection',
34
+ features: Array.from(features.values()).map(entry => entry.feature)
35
+ })
36
+
37
+ /**
38
+ * Get feature ID from a feature
39
+ */
40
+ const getFeatureId = (feature) => {
41
+ if (idProperty) {
42
+ return feature.properties?.[idProperty] ?? feature.id
43
+ }
44
+ return feature.id
45
+ }
46
+
47
+ /**
48
+ * Evict features that are outside the current viewport
49
+ * Uses "least recently visible" strategy - evicts features furthest from viewport first
50
+ */
51
+ const evictIfNeeded = (currentBbox) => {
52
+ if (!maxFeatures || features.size <= maxFeatures * EVICTION_THRESHOLD) {
53
+ return
54
+ }
55
+
56
+ const targetSize = maxFeatures
57
+
58
+ // Partition features: in-viewport vs out-of-viewport
59
+ const inView = []
60
+ const outOfView = []
61
+
62
+ for (const [id, data] of features) {
63
+ if (bboxIntersects(data.bbox, currentBbox)) {
64
+ inView.push(id)
65
+ } else {
66
+ outOfView.push({ id, addedAt: data.addedAt })
67
+ }
68
+ }
69
+
70
+ // Sort out-of-view by insertion time (oldest first)
71
+ outOfView.sort((a, b) => a.addedAt - b.addedAt)
72
+
73
+ // Evict oldest out-of-view features until under target
74
+ const toEvict = features.size - targetSize
75
+ for (let i = 0; i < toEvict && i < outOfView.length; i++) {
76
+ features.delete(outOfView[i].id)
77
+ }
78
+
79
+ // If still over target (viewport has too many), evict oldest in-view
80
+ if (features.size > targetSize) {
81
+ const remaining = features.size - targetSize
82
+ const inViewSorted = inView
83
+ .map(id => ({ id, addedAt: features.get(id).addedAt }))
84
+ .sort((a, b) => a.addedAt - b.addedAt)
85
+
86
+ for (let i = 0; i < remaining && i < inViewSorted.length; i++) {
87
+ features.delete(inViewSorted[i].id)
88
+ }
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Fetch data for the current viewport
94
+ */
95
+ const fetchData = async () => {
96
+ const zoom = map.getZoom()
97
+ if (zoom < minZoom) {
98
+ return
99
+ }
100
+
101
+ const currentBbox = getBboxArray(map)
102
+
103
+ // Skip if current viewport is already covered
104
+ if (fetchedBbox && bboxContains(fetchedBbox, currentBbox)) {
105
+ return
106
+ }
107
+
108
+ if (isLoading) {
109
+ return
110
+ }
111
+
112
+ isLoading = true
113
+
114
+ try {
115
+ const context = { bbox: currentBbox, zoom, dataset }
116
+ const data = await fetchGeoJSON(baseUrl, context, transformRequest)
117
+
118
+ const now = Date.now()
119
+
120
+ // Add/update features with deduplication
121
+ data.features.forEach(feature => {
122
+ const id = getFeatureId(feature)
123
+ if (id == null) {
124
+ console.warn('Feature missing ID, skipping:', feature)
125
+ return
126
+ }
127
+
128
+ features.set(id, {
129
+ feature,
130
+ bbox: getGeometryBbox(feature.geometry),
131
+ addedAt: features.has(id) ? features.get(id).addedAt : now
132
+ })
133
+ })
134
+
135
+ // Expand tracked bbox
136
+ fetchedBbox = expandBbox(fetchedBbox, currentBbox)
137
+
138
+ // Evict if over limit
139
+ evictIfNeeded(currentBbox)
140
+
141
+ // Update map source
142
+ onUpdate(sourceId, toFeatureCollection())
143
+ } catch (error) {
144
+ console.error(`Failed to fetch dynamic GeoJSON for ${dataset.id}:`, error)
145
+ } finally {
146
+ isLoading = false
147
+ }
148
+ }
149
+
150
+ // Debounced fetch handler
151
+ const debouncedFetch = debounce(fetchData, DEBOUNCE_DELAY)
152
+
153
+ // Listen for map movements
154
+ const handleMoveEnd = () => {
155
+ debouncedFetch()
156
+ }
157
+
158
+ map.on('moveend', handleMoveEnd)
159
+
160
+ // Initial fetch
161
+ fetchData()
162
+
163
+ return {
164
+ /**
165
+ * Clean up event listeners
166
+ */
167
+ destroy() {
168
+ map.off('moveend', handleMoveEnd)
169
+ debouncedFetch.cancel()
170
+ },
171
+
172
+ /**
173
+ * Clear all cached features and reset fetch tracking
174
+ */
175
+ clear() {
176
+ features.clear()
177
+ fetchedBbox = null
178
+ onUpdate(sourceId, { type: 'FeatureCollection', features: [] })
179
+ },
180
+
181
+ /**
182
+ * Force refresh - clear cache and fetch current viewport
183
+ */
184
+ refresh() {
185
+ features.clear()
186
+ fetchedBbox = null
187
+ fetchData()
188
+ },
189
+
190
+ /**
191
+ * Get current feature count
192
+ */
193
+ getFeatureCount() {
194
+ return features.size
195
+ },
196
+
197
+ /**
198
+ * Re-push cached features to the source (e.g., after style change)
199
+ */
200
+ reapply() {
201
+ if (features.size > 0) {
202
+ onUpdate(sourceId, toFeatureCollection())
203
+ }
204
+ }
205
+ }
206
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Fetch GeoJSON from URL with transformRequest
3
+ * @param {string} baseUrl - Base URL for the GeoJSON endpoint
4
+ * @param {Object} context - { bbox, zoom, dataset }
5
+ * @param {Function} transformRequest - Function to transform the request (builds URL with bbox, adds headers)
6
+ * @returns {Promise<Object>} GeoJSON FeatureCollection
7
+ */
8
+ export const fetchGeoJSON = async (baseUrl, context, transformRequest) => {
9
+ const result = transformRequest(baseUrl, context)
10
+
11
+ // Handle both string and object return values
12
+ const config = typeof result === 'string' ? { url: result } : result
13
+ const { url, headers = {} } = config
14
+
15
+ const response = await fetch(url, { headers })
16
+
17
+ if (!response.ok) {
18
+ throw new Error(`Failed to fetch GeoJSON: ${response.status} ${response.statusText}`)
19
+ }
20
+
21
+ const data = await response.json()
22
+
23
+ // Ensure we have a FeatureCollection
24
+ if (data.type === 'FeatureCollection') {
25
+ return data
26
+ }
27
+
28
+ // Wrap single feature or array of features
29
+ if (data.type === 'Feature') {
30
+ return { type: 'FeatureCollection', features: [data] }
31
+ }
32
+
33
+ if (Array.isArray(data)) {
34
+ return { type: 'FeatureCollection', features: data }
35
+ }
36
+
37
+ throw new Error('Invalid GeoJSON response')
38
+ }
@@ -6,19 +6,26 @@ export const handleSetMapStyle = ({
6
6
  events,
7
7
  eventBus,
8
8
  getDatasets,
9
- getHiddenFeatures
9
+ getHiddenFeatures,
10
+ getDynamicSources
10
11
  }) => {
11
12
  const onSetStyle = (e) => {
12
13
  map.once('idle', () => {
13
14
  const newStyleId = e.id
14
15
  const datasets = getDatasets()
15
16
  const hiddenFeatures = getHiddenFeatures()
17
+ const dynamicSources = getDynamicSources ? getDynamicSources() : new Map()
16
18
 
17
19
  // Re-add all layers with correct colors for new style
18
20
  datasets.forEach(dataset => {
19
21
  addMapLayers(map, newStyleId, dataset)
20
22
  })
21
23
 
24
+ // Reapply cached data for dynamic sources
25
+ dynamicSources.forEach(source => {
26
+ source.reapply()
27
+ })
28
+
22
29
  // Reapply hidden features filters
23
30
  Object.entries(hiddenFeatures).forEach(([datasetId, { idProperty, ids }]) => {
24
31
  const dataset = datasets.find(d => d.id === datasetId)
@@ -84,7 +84,7 @@ export const manifest = {
84
84
  excludeWhen: ({ pluginConfig }) => !pluginConfig.datasets.find(l => l.showInKey),
85
85
  mobile: {
86
86
  slot: 'top-left',
87
- showLabel: true
87
+ showLabel: false
88
88
  },
89
89
  tablet: {
90
90
  slot: 'top-left',