@defra/interactive-map 0.0.55-alpha → 0.0.57-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 (502) hide show
  1. package/assets/templates/style-switcher.njk +2 -2
  2. package/dist/esm/im-core.js +1 -1
  3. package/dist/esm/im-shell.js +1 -1
  4. package/dist/umd/im-core.js +1 -1
  5. package/dist/umd/index.js +1 -1
  6. package/docs/api/button-definition.md +11 -0
  7. package/docs/api/context.md +4 -0
  8. package/docs/api.md +20 -2
  9. package/docs/architecture/interactive-map.likec4 +4 -4
  10. package/docs/plugins/datasets.md +11 -0
  11. package/docs/plugins/draw.md +197 -35
  12. package/docs/plugins/interact.md +24 -1
  13. package/docs/plugins/search.md +2 -2
  14. package/docusaurus.config.cjs +25 -3
  15. package/govuk-prototype-kit.config.json +6 -7
  16. package/package.json +20 -23
  17. package/plugins/datasets/dist/esm/im-datasets-esri-adapter.js +1 -1
  18. package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
  19. package/plugins/datasets/dist/esm/im-datasets-ol-adapter.js +1 -1
  20. package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
  21. package/plugins/datasets/dist/esm/index.js +1 -1
  22. package/plugins/datasets/dist/esm/mapboxStyleLayerAdapter.js +1 -1
  23. package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
  24. package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
  25. package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
  26. package/plugins/datasets/dist/umd/index.js +1 -1
  27. package/plugins/datasets/src/adapters/esri/esriLayerAdapter.js +18 -16
  28. package/plugins/datasets/src/adapters/esri/esriLayerAdapter.test.js +2 -2
  29. package/plugins/datasets/src/adapters/esri/registry/esriDataset.js +2 -3
  30. package/plugins/datasets/src/adapters/esri/registry/esriDataset.test.js +1 -1
  31. package/plugins/datasets/src/adapters/loadLayerAdapter.js +2 -20
  32. package/plugins/datasets/src/adapters/loadLayerAdapter.test.js +9 -9
  33. package/plugins/datasets/src/adapters/mapboxStyleLayerAdapter.js +7 -7
  34. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +19 -19
  35. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +1 -1
  36. package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +1 -1
  37. package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.test.js +2 -2
  38. package/plugins/datasets/src/adapters/openlayers/layerBuilders.test.js +1 -1
  39. package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.js +21 -21
  40. package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.test.js +5 -5
  41. package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.js +2 -3
  42. package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.test.js +2 -2
  43. package/plugins/datasets/src/api/getOpacity.js +1 -2
  44. package/plugins/datasets/src/api/getOpacity.test.js +9 -12
  45. package/plugins/datasets/src/api/getStyle.js +1 -2
  46. package/plugins/datasets/src/api/getStyle.test.js +5 -8
  47. package/plugins/datasets/src/api/removeDataset.js +2 -4
  48. package/plugins/datasets/src/api/removeDataset.test.js +5 -10
  49. package/plugins/datasets/src/api/setData.js +2 -4
  50. package/plugins/datasets/src/api/setData.test.js +6 -14
  51. package/plugins/datasets/src/api/setFeatureVisibility.js +1 -2
  52. package/plugins/datasets/src/api/setFeatureVisibility.test.js +8 -11
  53. package/plugins/datasets/src/components/LayersMenu/LayersMenu.jsx +1 -0
  54. package/plugins/datasets/src/components/LayersMenu/LayersMenuCheckbox.jsx +1 -3
  55. package/plugins/datasets/src/components/LayersMenu/LayersMenuCheckbox.test.jsx +13 -18
  56. package/plugins/datasets/src/index.js +2 -2
  57. package/plugins/datasets/src/index.test.js +8 -1
  58. package/plugins/datasets/src/initialise/DatasetsInit.jsx +37 -26
  59. package/plugins/datasets/src/initialise/DatasetsInit.test.jsx +120 -89
  60. package/plugins/datasets/src/initialise/initialiseDatasets.js +2 -3
  61. package/plugins/datasets/src/initialise/initialiseDatasets.test.js +23 -10
  62. package/plugins/datasets/src/manifest.js +53 -44
  63. package/plugins/datasets/src/manifest.test.js +36 -4
  64. package/plugins/datasets/src/reducers/pluginState.js +5 -5
  65. package/plugins/datasets/src/reducers/pluginState.test.js +21 -20
  66. package/plugins/datasets/src/registry/__mocks__/datasetRegistry.js +7 -6
  67. package/plugins/datasets/src/registry/createDataset.js +2 -2
  68. package/plugins/datasets/src/registry/dataset.js +9 -10
  69. package/plugins/datasets/src/registry/dataset.test.js +63 -64
  70. package/plugins/datasets/src/registry/datasetRegistry.js +39 -10
  71. package/plugins/datasets/src/registry/datasetRegistry.test.js +83 -1
  72. package/plugins/datasets/src/registry/globalDataset.js +9 -17
  73. package/plugins/datasets/src/registry/isVisibleWhen.js +9 -17
  74. package/plugins/datasets/src/registry/isVisibleWhen.test.js +27 -20
  75. package/plugins/datasets/src/registry/mapboxStyleDataset.test.js +26 -27
  76. package/plugins/datasets/src/utils/hasLayersMenu.js +13 -0
  77. package/plugins/datasets/src/utils/hasLayersMenu.test.js +25 -0
  78. package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
  79. package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
  80. package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
  81. package/plugins/draw/dist/esm/index.js +1 -1
  82. package/plugins/draw/dist/esm/liveDrawChecks.js +1 -1
  83. package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
  84. package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
  85. package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
  86. package/plugins/draw/dist/umd/index.js +1 -1
  87. package/plugins/draw/src/DrawInit.jsx +53 -29
  88. package/plugins/draw/src/DrawInit.test.jsx +105 -2
  89. package/plugins/draw/src/adapterEvents.js +78 -44
  90. package/plugins/draw/src/adapters/adapterContract.test.js +3 -3
  91. package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.js +18 -10
  92. package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.test.js +31 -22
  93. package/plugins/draw/src/adapters/maplibre/drawEvents.js +2 -1
  94. package/plugins/draw/src/adapters/maplibre/modes/drawMode/clickHandlers.js +13 -12
  95. package/plugins/draw/src/adapters/maplibre/modes/drawMode/clickHandlers.test.js +5 -5
  96. package/plugins/draw/src/adapters/maplibre/modes/drawMode/undoHandlers.js +1 -1
  97. package/plugins/draw/src/adapters/maplibre/modes/drawMode/undoHandlers.test.js +2 -2
  98. package/plugins/draw/src/adapters/maplibre/modes/drawPointMode.js +6 -9
  99. package/plugins/draw/src/adapters/maplibre/modes/drawPointMode.test.js +4 -4
  100. package/plugins/draw/src/adapters/maplibre/modes/editPointMode/pointerHandlers.js +6 -9
  101. package/plugins/draw/src/adapters/maplibre/modes/editPointMode/pointerHandlers.test.js +1 -1
  102. package/plugins/draw/src/adapters/maplibre/modes/editPointMode/undoHandlers.js +8 -14
  103. package/plugins/draw/src/adapters/maplibre/modes/editPointMode/undoHandlers.test.js +37 -8
  104. package/plugins/draw/src/adapters/maplibre/modes/editPointMode.js +11 -1
  105. package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/undoHandlers.js +14 -19
  106. package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/undoHandlers.test.js +41 -4
  107. package/plugins/draw/src/adapters/maplibre/modes/editVertexMode.js +12 -1
  108. package/plugins/draw/src/adapters/maplibre/utils/editModeEvents.js +3 -1
  109. package/plugins/draw/src/adapters/maplibre/utils/geometryValidation.js +9 -10
  110. package/plugins/draw/src/adapters/maplibre/utils/geometryValidation.test.js +5 -24
  111. package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.js +10 -7
  112. package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.test.js +12 -7
  113. package/plugins/draw/src/adapters/openlayers/core/OLDrawManager.js +5 -0
  114. package/plugins/draw/src/adapters/openlayers/core/OLDrawManager.test.js +7 -3
  115. package/plugins/draw/src/adapters/openlayers/core/styles.test.js +1 -1
  116. package/plugins/draw/src/adapters/openlayers/draw/DrawMode.js +11 -11
  117. package/plugins/draw/src/adapters/openlayers/draw/DrawMode.test.js +15 -15
  118. package/plugins/draw/src/adapters/openlayers/edit/EditMode.js +21 -28
  119. package/plugins/draw/src/adapters/openlayers/edit/EditMode.test.js +26 -5
  120. package/plugins/draw/src/adapters/openlayers/edit/selectionState.js +5 -6
  121. package/plugins/draw/src/adapters/openlayers/edit/selectionState.test.js +2 -12
  122. package/plugins/draw/src/adapters/openlayers/edit/undoOps.js +9 -0
  123. package/plugins/draw/src/adapters/openlayers/edit/undoOps.test.js +7 -0
  124. package/plugins/draw/src/adapters/openlayers/point/drawPointMode.js +6 -9
  125. package/plugins/draw/src/adapters/openlayers/point/drawPointMode.test.js +3 -3
  126. package/plugins/draw/src/adapters/openlayers/point/editPointMode.js +18 -9
  127. package/plugins/draw/src/adapters/openlayers/point/editPointMode.test.js +29 -4
  128. package/plugins/draw/src/adapters/openlayers/point/pointOps.js +3 -2
  129. package/plugins/draw/src/adapters/openlayers/point/pointOps.test.js +6 -0
  130. package/plugins/draw/src/adapters/openlayers/point/pointSelectionState.js +3 -4
  131. package/plugins/draw/src/adapters/openlayers/point/pointSelectionState.test.js +2 -12
  132. package/plugins/draw/src/adapters/openlayers/point/pointSymbolImages.test.js +1 -1
  133. package/plugins/draw/src/api/createNewShape.js +4 -4
  134. package/plugins/draw/src/api/createNewShape.test.js +1 -1
  135. package/plugins/draw/src/api/editFeature.js +8 -11
  136. package/plugins/draw/src/api/editFeature.test.js +33 -22
  137. package/plugins/draw/src/api/newLine.test.js +3 -3
  138. package/plugins/draw/src/api/newPoint.js +4 -5
  139. package/plugins/draw/src/api/newPoint.test.js +3 -3
  140. package/plugins/draw/src/api/newPolygon.test.js +3 -3
  141. package/plugins/draw/src/api/recheckGeometry.js +32 -0
  142. package/plugins/draw/src/api/recheckGeometry.test.js +55 -0
  143. package/plugins/draw/src/api/setGeometry.js +33 -0
  144. package/plugins/draw/src/api/setGeometry.test.js +48 -0
  145. package/plugins/draw/src/api/split.js +23 -22
  146. package/plugins/draw/src/api/split.test.js +33 -18
  147. package/plugins/draw/src/events.js +265 -77
  148. package/plugins/draw/src/events.test.js +708 -34
  149. package/plugins/draw/src/hooks/useSpatialList.js +10 -11
  150. package/plugins/draw/src/hooks/useSpatialList.test.js +3 -3
  151. package/plugins/draw/src/manifest.js +33 -17
  152. package/plugins/draw/src/manifest.test.js +104 -10
  153. package/plugins/draw/src/reducer.js +31 -9
  154. package/plugins/draw/src/reducer.test.js +35 -3
  155. package/plugins/draw/src/utils/drawModes.js +27 -0
  156. package/plugins/draw/src/utils/drawModes.test.js +27 -0
  157. package/plugins/draw/src/utils/needsDrawTarget.js +18 -0
  158. package/plugins/draw/src/utils/needsDrawTarget.test.js +32 -0
  159. package/plugins/draw/src/utils/touchTarget.js +34 -26
  160. package/plugins/draw/src/utils/touchTarget.test.js +32 -20
  161. package/plugins/draw/src/validation/commitChecks.js +185 -0
  162. package/plugins/draw/src/validation/commitChecks.test.js +205 -0
  163. package/plugins/draw/src/validation/liveDrawChecks.js +11 -11
  164. package/plugins/draw/src/validation/liveDrawChecks.test.js +37 -37
  165. package/plugins/draw/src/validation/liveStroke.js +6 -6
  166. package/plugins/draw/src/validation/liveStroke.test.js +27 -27
  167. package/plugins/draw/src/validation/rules.js +16 -14
  168. package/plugins/draw/src/validation/rules.test.js +5 -5
  169. package/plugins/draw/src/validation/validateGeometry.js +58 -31
  170. package/plugins/draw/src/validation/validateGeometry.test.js +68 -44
  171. package/plugins/draw-es/dist/esm/index.js +1 -0
  172. package/plugins/{beta/draw-es → draw-es}/src/DrawInit.jsx +1 -1
  173. package/plugins/{beta/draw-es → draw-es}/src/events.test.js +1 -1
  174. package/plugins/{beta/draw-es → draw-es}/src/graphic.js +1 -1
  175. package/plugins/frame/dist/esm/index.js +1 -0
  176. package/plugins/{beta/frame → frame}/dist/umd/im-frame-plugin.js +1 -1
  177. package/plugins/{beta/frame → frame}/dist/umd/index.js +1 -1
  178. package/plugins/{beta/frame → frame}/package.json +2 -2
  179. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  180. package/plugins/interact/dist/esm/index.js +1 -1
  181. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  182. package/plugins/interact/dist/umd/index.js +1 -1
  183. package/plugins/interact/src/InteractInit.jsx +3 -3
  184. package/plugins/interact/src/api/enable.test.js +13 -0
  185. package/plugins/interact/src/defaults.js +1 -0
  186. package/plugins/interact/src/hooks/useCrossHairVisibility.js +27 -17
  187. package/plugins/interact/src/hooks/useCrossHairVisibility.test.js +72 -7
  188. package/plugins/interact/src/hooks/useInteractionHandlers.js +3 -5
  189. package/plugins/interact/src/hooks/useInteractionHandlers.test.js +4 -3
  190. package/plugins/interact/src/hooks/useSpatialList.js +16 -17
  191. package/plugins/interact/src/hooks/useSpatialList.test.js +9 -9
  192. package/plugins/interact/src/manifest.js +4 -4
  193. package/plugins/interact/src/manifest.test.js +29 -0
  194. package/plugins/interact/src/reducer.js +7 -2
  195. package/plugins/interact/src/reducer.test.js +12 -2
  196. package/plugins/interact/src/utils/needsTarget.js +20 -0
  197. package/plugins/interact/src/utils/needsTarget.test.js +36 -0
  198. package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
  199. package/plugins/map-key/dist/esm/index.js +1 -1
  200. package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
  201. package/plugins/map-key/dist/umd/index.js +1 -1
  202. package/plugins/map-key/src/components/Key/KeySvgSymbol.jsx +4 -0
  203. package/plugins/map-key/src/components/Key/MapKey.jsx +15 -15
  204. package/plugins/map-key/src/components/Key/MapKey.test.jsx +29 -15
  205. package/plugins/map-key/src/initialise/MapKeyInit.jsx +5 -8
  206. package/plugins/map-key/src/initialise/MapKeyInit.test.jsx +9 -7
  207. package/plugins/map-key/src/manifest.test.js +0 -1
  208. package/plugins/map-key/src/reducers/mergeKeyGroupItems.js +14 -33
  209. package/plugins/map-key/src/reducers/mergeKeyGroupItems.test.js +34 -50
  210. package/plugins/map-key/src/reducers/pluginState.js +6 -1
  211. package/plugins/map-key/src/reducers/pluginState.test.js +13 -4
  212. package/plugins/map-styles/dist/esm/im-map-styles-plugin.js +1 -0
  213. package/plugins/map-styles/dist/esm/index.js +1 -0
  214. package/plugins/map-styles/dist/umd/im-map-styles-plugin.js +1 -0
  215. package/plugins/{beta/map-styles → map-styles}/dist/umd/index.js +1 -1
  216. package/plugins/{beta/map-styles → map-styles}/src/MapStyles.jsx +3 -3
  217. package/plugins/{beta/map-styles → map-styles}/src/MapStylesInit.jsx +1 -1
  218. package/plugins/menu/dist/esm/index.js +1 -1
  219. package/plugins/scale-bar/dist/esm/index.js +1 -0
  220. package/plugins/{beta/scale-bar → scale-bar}/dist/umd/im-scale-bar-plugin.js +1 -1
  221. package/plugins/{beta/scale-bar → scale-bar}/dist/umd/index.js +1 -1
  222. package/plugins/{beta/scale-bar → scale-bar}/package.json +2 -2
  223. package/plugins/search/dist/esm/im-search-plugin.js +1 -1
  224. package/plugins/search/dist/esm/index.js +1 -1
  225. package/plugins/search/dist/umd/im-search-plugin.js +1 -1
  226. package/plugins/search/dist/umd/index.js +1 -1
  227. package/plugins/search/src/components/Suggestions/Suggestions.jsx +3 -1
  228. package/plugins/search/src/components/Suggestions/Suggestions.test.jsx +11 -0
  229. package/plugins/search/src/utils/markedToElements.jsx +25 -0
  230. package/plugins/search/src/utils/markedToElements.test.jsx +49 -0
  231. package/plugins/search/src/utils/parseOsNamesResults.js +6 -4
  232. package/plugins/search/src/utils/parseOsNamesResults.test.js +18 -0
  233. package/plugins/use-location/dist/esm/index.js +1 -0
  234. package/plugins/{beta/use-location → use-location}/dist/umd/im-use-location-plugin.js +1 -1
  235. package/plugins/{beta/use-location → use-location}/dist/umd/index.js +1 -1
  236. package/providers/esri/dist/esm/index.js +1 -0
  237. package/providers/{beta/esri → esri}/src/esriProvider.js +1 -1
  238. package/providers/{beta/esri → esri}/src/mapEvents.js +2 -2
  239. package/providers/maplibre/dist/esm/index.js +1 -1
  240. package/providers/maplibre/dist/umd/index.js +1 -1
  241. package/providers/maplibre/src/index.js +11 -2
  242. package/providers/maplibre/src/index.test.js +23 -1
  243. package/providers/maplibre/src/utils/detectModuleWorker.js +8 -19
  244. package/providers/maplibre/src/utils/detectModuleWorker.test.js +19 -23
  245. package/providers/maplibre/src/utils/workerUrl.js +12 -0
  246. package/providers/maplibre/src/utils/workerUrl.test.js +14 -1
  247. package/providers/open-names/dist/esm/index.js +1 -0
  248. package/providers/{beta/open-names → open-names}/dist/umd/im-reverse-geocode.js +1 -1
  249. package/providers/{beta/open-names → open-names}/dist/umd/index.js +1 -1
  250. package/providers/openlayers/dist/esm/index.js +1 -0
  251. package/providers/openlayers/dist/umd/im-openlayers-provider.js +2 -0
  252. package/providers/{beta/openlayers → openlayers}/dist/umd/index.js +1 -1
  253. package/providers/{beta/openlayers → openlayers}/src/index.js +4 -4
  254. package/providers/{beta/openlayers → openlayers}/src/mapEvents.js +2 -2
  255. package/providers/{beta/openlayers → openlayers}/src/mapEvents.test.js +2 -2
  256. package/providers/{beta/openlayers → openlayers}/src/openlayersProvider.js +3 -3
  257. package/providers/{beta/openlayers → openlayers}/src/utils/highlightFeatures.js +1 -1
  258. package/providers/{beta/openlayers → openlayers}/src/utils/patternImages.js +1 -1
  259. package/providers/{beta/openlayers → openlayers}/src/utils/symbolImages.js +1 -1
  260. package/rollup.esm.mjs +43 -47
  261. package/sonar-project.properties +1 -1
  262. package/src/App/App.jsx +4 -1
  263. package/src/App/App.test.jsx +6 -0
  264. package/src/App/components/MapButton/MapButton.jsx +6 -0
  265. package/src/App/components/MapButton/MapButton.test.jsx +10 -0
  266. package/src/App/components/Markers/Markers.jsx +3 -5
  267. package/src/App/components/Markers/Markers.test.jsx +9 -11
  268. package/src/App/components/Panel/Panel.jsx +2 -9
  269. package/src/App/hooks/useInterfaceAPI.js +16 -4
  270. package/src/App/hooks/useInterfaceAPI.test.js +66 -1
  271. package/src/App/renderer/PluginInits.jsx +8 -7
  272. package/src/App/renderer/PluginInits.test.jsx +20 -5
  273. package/src/App/renderer/SlotItemsProvider.jsx +33 -0
  274. package/src/App/renderer/SlotItemsProvider.test.jsx +59 -0
  275. package/src/App/renderer/SlotRenderer.jsx +3 -14
  276. package/src/App/renderer/SlotRenderer.test.jsx +11 -44
  277. package/src/App/renderer/mapButtons.js +24 -12
  278. package/src/App/renderer/mapButtons.test.js +32 -1
  279. package/src/App/renderer/mapControls.js +6 -8
  280. package/src/App/renderer/mapControls.test.js +10 -0
  281. package/src/App/renderer/mapPanels.js +16 -19
  282. package/src/App/renderer/mapPanels.test.js +37 -9
  283. package/src/App/renderer/pluginWrapper.js +10 -8
  284. package/src/App/renderer/pluginWrapper.test.js +23 -9
  285. package/src/App/renderer/slotAggregator.js +18 -5
  286. package/src/App/renderer/slotAggregator.test.js +68 -25
  287. package/src/App/renderer/slotHelpers.js +13 -0
  288. package/src/App/renderer/slotHelpers.test.js +16 -1
  289. package/src/App/store/AppProvider.jsx +19 -1
  290. package/src/App/store/AppProvider.test.jsx +41 -0
  291. package/src/App/store/MapProvider.jsx +3 -0
  292. package/src/App/store/MapProvider.test.jsx +24 -0
  293. package/src/App/store/appActionsMap.js +10 -1
  294. package/src/App/store/appActionsMap.test.js +21 -0
  295. package/src/App/store/appDispatchMiddleware.js +29 -17
  296. package/src/App/store/appDispatchMiddleware.test.js +31 -0
  297. package/src/InteractiveMap/parseDataProperties.js +4 -4
  298. package/src/InteractiveMap/parseDataProperties.test.js +62 -6
  299. package/src/config/events.js +4 -2
  300. package/src/config/mapSizeScales.js +3 -0
  301. package/src/scss/tools/_govuk-content.scss +4 -3
  302. package/src/types.js +4 -0
  303. package/src/utils/focusAfterPanelClose.js +9 -0
  304. package/src/utils/focusAfterPanelClose.test.js +40 -0
  305. package/webpack.dev.mjs +9 -3
  306. package/webpack.prod.mjs +11 -4
  307. package/webpack.umd.mjs +6 -7
  308. package/plugins/beta/draw-es/dist/esm/index.js +0 -1
  309. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +0 -1
  310. package/plugins/beta/draw-ml/dist/esm/index.js +0 -1
  311. package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +0 -1
  312. package/plugins/beta/draw-ml/dist/umd/index.js +0 -2
  313. package/plugins/beta/draw-ml/src/DrawInit.jsx +0 -85
  314. package/plugins/beta/draw-ml/src/api/addFeature.js +0 -27
  315. package/plugins/beta/draw-ml/src/api/deleteFeature.js +0 -13
  316. package/plugins/beta/draw-ml/src/api/editFeature.js +0 -75
  317. package/plugins/beta/draw-ml/src/api/merge.js +0 -9
  318. package/plugins/beta/draw-ml/src/api/newLine.js +0 -68
  319. package/plugins/beta/draw-ml/src/api/newPolygon.js +0 -68
  320. package/plugins/beta/draw-ml/src/api/split.js +0 -81
  321. package/plugins/beta/draw-ml/src/defaults.js +0 -17
  322. package/plugins/beta/draw-ml/src/draw.scss +0 -26
  323. package/plugins/beta/draw-ml/src/events.js +0 -185
  324. package/plugins/beta/draw-ml/src/index.js +0 -13
  325. package/plugins/beta/draw-ml/src/manifest.js +0 -110
  326. package/plugins/beta/draw-ml/src/mapboxDraw.js +0 -143
  327. package/plugins/beta/draw-ml/src/mapboxSnap.js +0 -321
  328. package/plugins/beta/draw-ml/src/modes/createDrawMode.js +0 -552
  329. package/plugins/beta/draw-ml/src/modes/disabledMode.js +0 -23
  330. package/plugins/beta/draw-ml/src/modes/drawLineMode.js +0 -18
  331. package/plugins/beta/draw-ml/src/modes/drawPolygonMode.js +0 -16
  332. package/plugins/beta/draw-ml/src/modes/editVertex/geometryHelpers.js +0 -135
  333. package/plugins/beta/draw-ml/src/modes/editVertex/helpers.js +0 -2
  334. package/plugins/beta/draw-ml/src/modes/editVertex/touchHandlers.js +0 -142
  335. package/plugins/beta/draw-ml/src/modes/editVertex/undoHandlers.js +0 -133
  336. package/plugins/beta/draw-ml/src/modes/editVertex/vertexOperations.js +0 -142
  337. package/plugins/beta/draw-ml/src/modes/editVertex/vertexQueries.js +0 -121
  338. package/plugins/beta/draw-ml/src/modes/editVertexMode.js +0 -495
  339. package/plugins/beta/draw-ml/src/reducer.js +0 -90
  340. package/plugins/beta/draw-ml/src/styles.js +0 -190
  341. package/plugins/beta/draw-ml/src/undoStack.js +0 -50
  342. package/plugins/beta/draw-ml/src/utils/debounce.js +0 -16
  343. package/plugins/beta/draw-ml/src/utils/flattenStyleProperties.js +0 -49
  344. package/plugins/beta/draw-ml/src/utils/snapHelpers.js +0 -200
  345. package/plugins/beta/draw-ml/src/utils/spatial.js +0 -258
  346. package/plugins/beta/draw-ol/dist/css/index.css +0 -1
  347. package/plugins/beta/draw-ol/dist/esm/DrawMode.js +0 -1
  348. package/plugins/beta/draw-ol/dist/esm/EditMode.js +0 -1
  349. package/plugins/beta/draw-ol/dist/esm/geometryHelpers.js +0 -1
  350. package/plugins/beta/draw-ol/dist/esm/im-draw-ol-plugin.js +0 -1
  351. package/plugins/beta/draw-ol/dist/esm/index.js +0 -1
  352. package/plugins/beta/draw-ol/src/DrawInit.jsx +0 -65
  353. package/plugins/beta/draw-ol/src/api/addFeature.js +0 -29
  354. package/plugins/beta/draw-ol/src/api/deleteFeature.js +0 -11
  355. package/plugins/beta/draw-ol/src/api/editFeature.js +0 -50
  356. package/plugins/beta/draw-ol/src/api/newLine.js +0 -44
  357. package/plugins/beta/draw-ol/src/api/newPolygon.js +0 -44
  358. package/plugins/beta/draw-ol/src/core/OLDrawManager.js +0 -153
  359. package/plugins/beta/draw-ol/src/core/featureStore.js +0 -65
  360. package/plugins/beta/draw-ol/src/core/styles.js +0 -98
  361. package/plugins/beta/draw-ol/src/core/undoStack.js +0 -31
  362. package/plugins/beta/draw-ol/src/defaults.js +0 -16
  363. package/plugins/beta/draw-ol/src/draw/DrawMode.js +0 -121
  364. package/plugins/beta/draw-ol/src/draw/drawInput.js +0 -243
  365. package/plugins/beta/draw-ol/src/draw.scss +0 -17
  366. package/plugins/beta/draw-ol/src/edit/EditMode.js +0 -424
  367. package/plugins/beta/draw-ol/src/edit/keyboardHandler.js +0 -229
  368. package/plugins/beta/draw-ol/src/edit/midpointLayer.js +0 -57
  369. package/plugins/beta/draw-ol/src/edit/touchHandler.js +0 -171
  370. package/plugins/beta/draw-ol/src/edit/undoOps.js +0 -95
  371. package/plugins/beta/draw-ol/src/edit/vertexHitTest.js +0 -72
  372. package/plugins/beta/draw-ol/src/edit/vertexLayer.js +0 -49
  373. package/plugins/beta/draw-ol/src/edit/vertexOps.js +0 -99
  374. package/plugins/beta/draw-ol/src/events.js +0 -114
  375. package/plugins/beta/draw-ol/src/index.js +0 -12
  376. package/plugins/beta/draw-ol/src/manifest.js +0 -125
  377. package/plugins/beta/draw-ol/src/olDraw.js +0 -38
  378. package/plugins/beta/draw-ol/src/reducer.js +0 -41
  379. package/plugins/beta/draw-ol/src/snap/snapEngine.js +0 -153
  380. package/plugins/beta/draw-ol/src/snap/snapGeometry.js +0 -177
  381. package/plugins/beta/draw-ol/src/snap/snapIndicator.js +0 -81
  382. package/plugins/beta/draw-ol/src/snap/snapInteraction.js +0 -57
  383. package/plugins/beta/draw-ol/src/snap/snapManager.js +0 -99
  384. package/plugins/beta/draw-ol/src/utils/flattenStyleProperties.js +0 -47
  385. package/plugins/beta/draw-ol/src/utils/geometryHelpers.js +0 -103
  386. package/plugins/beta/draw-ol/src/utils/olCoords.js +0 -35
  387. package/plugins/beta/draw-ol/src/utils/resolveColors.js +0 -39
  388. package/plugins/beta/draw-ol/src/utils/spatial.js +0 -24
  389. package/plugins/beta/draw-ol/src/utils/touchTarget.js +0 -61
  390. package/plugins/beta/frame/dist/esm/index.js +0 -1
  391. package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +0 -1
  392. package/plugins/beta/map-styles/dist/esm/index.js +0 -1
  393. package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +0 -1
  394. package/plugins/beta/scale-bar/dist/esm/index.js +0 -1
  395. package/plugins/beta/use-location/dist/esm/index.js +0 -1
  396. package/plugins/map-key/src/registry/getDatasetRegistry.js +0 -6
  397. package/plugins/map-key/src/registry/getDatasetRegistry.test.js +0 -23
  398. package/plugins/map-key/src/registry/index.js +0 -1
  399. package/plugins/map-key/src/registry/index.test.js +0 -7
  400. package/providers/beta/esri/dist/esm/index.js +0 -1
  401. package/providers/beta/open-names/dist/esm/index.js +0 -1
  402. package/providers/beta/openlayers/dist/esm/index.js +0 -1
  403. package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +0 -2
  404. package/providers/beta/openlayers/dist/umd/index.js.LICENSE.txt +0 -1
  405. /package/plugins/{beta/draw-es → draw-es}/dist/esm/im-draw-es-plugin.js +0 -0
  406. /package/plugins/{beta/draw-es → draw-es}/src/api/addFeature.js +0 -0
  407. /package/plugins/{beta/draw-es → draw-es}/src/api/deleteFeature.js +0 -0
  408. /package/plugins/{beta/draw-es → draw-es}/src/api/editFeature.js +0 -0
  409. /package/plugins/{beta/draw-es → draw-es}/src/api/newPolygon.js +0 -0
  410. /package/plugins/{beta/draw-es → draw-es}/src/api/removeSafeZone.js +0 -0
  411. /package/plugins/{beta/draw-es → draw-es}/src/events.js +0 -0
  412. /package/plugins/{beta/draw-es → draw-es}/src/index.js +0 -0
  413. /package/plugins/{beta/draw-es → draw-es}/src/manifest.js +0 -0
  414. /package/plugins/{beta/draw-es → draw-es}/src/reducer.js +0 -0
  415. /package/plugins/{beta/draw-es → draw-es}/src/sketchViewModel.js +0 -0
  416. /package/plugins/{beta/frame → frame}/dist/css/index.css +0 -0
  417. /package/plugins/{beta/frame → frame}/dist/esm/im-frame-plugin.js +0 -0
  418. /package/plugins/{beta/draw-ml → frame}/dist/umd/index.js.LICENSE.txt +0 -0
  419. /package/plugins/{beta/frame → frame}/src/Frame.jsx +0 -0
  420. /package/plugins/{beta/frame → frame}/src/FrameInit.jsx +0 -0
  421. /package/plugins/{beta/frame → frame}/src/api/addFrame.js +0 -0
  422. /package/plugins/{beta/frame → frame}/src/api/editFeature.js +0 -0
  423. /package/plugins/{beta/frame → frame}/src/config.js +0 -0
  424. /package/plugins/{beta/frame → frame}/src/frame.scss +0 -0
  425. /package/plugins/{beta/frame → frame}/src/index.js +0 -0
  426. /package/plugins/{beta/frame → frame}/src/manifest.js +0 -0
  427. /package/plugins/{beta/frame → frame}/src/reducer.js +0 -0
  428. /package/plugins/{beta/frame → frame}/src/utils.js +0 -0
  429. /package/plugins/{beta/map-styles → map-styles}/dist/css/index.css +0 -0
  430. /package/plugins/{beta/frame → map-styles}/dist/umd/index.js.LICENSE.txt +0 -0
  431. /package/plugins/{beta/map-styles → map-styles}/src/config.js +0 -0
  432. /package/plugins/{beta/map-styles → map-styles}/src/index.js +0 -0
  433. /package/plugins/{beta/map-styles → map-styles}/src/manifest.js +0 -0
  434. /package/plugins/{beta/map-styles → map-styles}/src/mapStyles.scss +0 -0
  435. /package/plugins/{beta/scale-bar → scale-bar}/dist/css/index.css +0 -0
  436. /package/plugins/{beta/scale-bar → scale-bar}/dist/esm/im-scale-bar-plugin.js +0 -0
  437. /package/plugins/{beta/map-styles → scale-bar}/dist/umd/index.js.LICENSE.txt +0 -0
  438. /package/plugins/{beta/scale-bar → scale-bar}/src/ScaleBar.jsx +0 -0
  439. /package/plugins/{beta/scale-bar → scale-bar}/src/ScaleBar.test.jsx +0 -0
  440. /package/plugins/{beta/scale-bar → scale-bar}/src/index.js +0 -0
  441. /package/plugins/{beta/scale-bar → scale-bar}/src/index.test.js +0 -0
  442. /package/plugins/{beta/scale-bar → scale-bar}/src/manifest.js +0 -0
  443. /package/plugins/{beta/scale-bar → scale-bar}/src/scaleBar.scss +0 -0
  444. /package/plugins/{beta/scale-bar → scale-bar}/src/utils.js +0 -0
  445. /package/plugins/{beta/scale-bar → scale-bar}/src/utils.test.js +0 -0
  446. /package/plugins/{beta/use-location → use-location}/dist/esm/im-use-location-plugin.js +0 -0
  447. /package/plugins/{beta/scale-bar → use-location}/dist/umd/index.js.LICENSE.txt +0 -0
  448. /package/plugins/{beta/use-location → use-location}/src/UseLocation.jsx +0 -0
  449. /package/plugins/{beta/use-location → use-location}/src/UseLocationInit.jsx +0 -0
  450. /package/plugins/{beta/use-location → use-location}/src/defaults.js +0 -0
  451. /package/plugins/{beta/use-location → use-location}/src/events.js +0 -0
  452. /package/plugins/{beta/use-location → use-location}/src/index.js +0 -0
  453. /package/plugins/{beta/use-location → use-location}/src/manifest.js +0 -0
  454. /package/plugins/{beta/use-location → use-location}/src/reducer.js +0 -0
  455. /package/providers/{beta/esri → esri}/dist/css/index.css +0 -0
  456. /package/providers/{beta/esri → esri}/dist/esm/im-esri-provider.js +0 -0
  457. /package/providers/{beta/esri → esri}/src/appEvents.js +0 -0
  458. /package/providers/{beta/esri → esri}/src/defaults.js +0 -0
  459. /package/providers/{beta/esri → esri}/src/esriProvider.scss +0 -0
  460. /package/providers/{beta/esri → esri}/src/index.js +0 -0
  461. /package/providers/{beta/esri → esri}/src/utils/coords.js +0 -0
  462. /package/providers/{beta/esri → esri}/src/utils/coords.test.js +0 -0
  463. /package/providers/{beta/esri → esri}/src/utils/detectWebGL.js +0 -0
  464. /package/providers/{beta/esri → esri}/src/utils/esriFixes.js +0 -0
  465. /package/providers/{beta/esri → esri}/src/utils/query.js +0 -0
  466. /package/providers/{beta/esri → esri}/src/utils/spatial.js +0 -0
  467. /package/providers/{beta/esri → esri}/src/utils/spatial.test.js +0 -0
  468. /package/providers/{beta/open-names → open-names}/dist/esm/im-reverse-geocode.js +0 -0
  469. /package/providers/{beta/open-names → open-names}/dist/umd/im-reverse-geocode.js.LICENSE.txt +0 -0
  470. /package/{plugins/beta/use-location → providers/open-names}/dist/umd/index.js.LICENSE.txt +0 -0
  471. /package/providers/{beta/open-names → open-names}/src/index.js +0 -0
  472. /package/providers/{beta/open-names → open-names}/src/reverseGeocode.js +0 -0
  473. /package/providers/{beta/open-names → open-names}/src/utils/mapToLocationModel.js +0 -0
  474. /package/providers/{beta/open-names → open-names}/src/utils/mapToLocationModel.test.js +0 -0
  475. /package/providers/{beta/openlayers → openlayers}/dist/esm/im-openlayers-provider.js +0 -0
  476. /package/providers/{beta/openlayers → openlayers}/dist/umd/im-openlayers-provider.js.LICENSE.txt +0 -0
  477. /package/providers/{beta/open-names → openlayers}/dist/umd/index.js.LICENSE.txt +0 -0
  478. /package/providers/{beta/openlayers → openlayers}/src/appEvents.js +0 -0
  479. /package/providers/{beta/openlayers → openlayers}/src/appEvents.test.js +0 -0
  480. /package/providers/{beta/openlayers → openlayers}/src/defaults.js +0 -0
  481. /package/providers/{beta/openlayers → openlayers}/src/index.test.js +0 -0
  482. /package/providers/{beta/openlayers → openlayers}/src/openlayersProvider.test.js +0 -0
  483. /package/providers/{beta/openlayers → openlayers}/src/utils/bngProjection.js +0 -0
  484. /package/providers/{beta/openlayers → openlayers}/src/utils/filterEvaluator.js +0 -0
  485. /package/providers/{beta/openlayers → openlayers}/src/utils/filterEvaluator.test.js +0 -0
  486. /package/providers/{beta/openlayers → openlayers}/src/utils/highlightFeatures.test.js +0 -0
  487. /package/providers/{beta/openlayers → openlayers}/src/utils/hoverCursor.js +0 -0
  488. /package/providers/{beta/openlayers → openlayers}/src/utils/hoverCursor.test.js +0 -0
  489. /package/providers/{beta/openlayers → openlayers}/src/utils/openLayersFixes.js +0 -0
  490. /package/providers/{beta/openlayers → openlayers}/src/utils/openLayersFixes.test.js +0 -0
  491. /package/providers/{beta/openlayers → openlayers}/src/utils/patternImages.test.js +0 -0
  492. /package/providers/{beta/openlayers → openlayers}/src/utils/queryFeatures.js +0 -0
  493. /package/providers/{beta/openlayers → openlayers}/src/utils/queryFeatures.test.js +0 -0
  494. /package/providers/{beta/openlayers → openlayers}/src/utils/spatial.js +0 -0
  495. /package/providers/{beta/openlayers → openlayers}/src/utils/spatial.test.js +0 -0
  496. /package/providers/{beta/openlayers → openlayers}/src/utils/symbolImages.test.js +0 -0
  497. /package/providers/{beta/openlayers → openlayers}/src/utils/tileLayers.js +0 -0
  498. /package/providers/{beta/openlayers → openlayers}/src/utils/tileLayers.test.js +0 -0
  499. /package/providers/{beta/openlayers → openlayers}/src/utils/vtTileFragments.js +0 -0
  500. /package/providers/{beta/openlayers → openlayers}/src/utils/vtTileFragments.test.js +0 -0
  501. /package/providers/{beta/openlayers → openlayers}/src/utils/zoom.js +0 -0
  502. /package/providers/{beta/openlayers → openlayers}/src/utils/zoom.test.js +0 -0
@@ -1 +1 @@
1
- import{g as t}from"./layerAdapter.js";import{M as e,a as s}from"./mapboxStyleLayerAdapter.js";import{l as a,d as r}from"./im-datasets-plugin.js";import"preact/compat";import"preact/jsx-runtime";const i=(e,s,a,r,o,y)=>{const{map:l}=e,{sourceId:n,source:h}=s;h&&!l.getSource(n)&&l.addSource(n,h);const m=a.id;return((t,e,s,a,r)=>{const{map:i}=t,{hasSymbol:o,symbolLayerId:y}=e;if(!o||!a||!y||i.getLayer(y))return;const l=a.getSymbolDef(e.style);if(!l)return;const n=a.getSymbolImageId(e.style,s,"normal",r);n&&i.addLayer(e.getSymbolSource(n,t.getSymbolIconLayout(l)))})(e,s,a,r,y),((e,s,a,r,i=1)=>{const{hasFill:o,fillLayerId:y}=s;if(!o||!y||e.getLayer(y))return;const l=r.getPatternImageId(s.style,a,i),n=l?{"fill-pattern":l,"fill-opacity":s.opacity}:{"fill-color":t(s.style.fill,a),"fill-opacity":s.opacity};e.addLayer(s.getFillSource(n))})(l,s,m,o,y),((e,s,a)=>{const{hasStroke:r,strokeLayerId:i}=s;if(!r||e.getLayer(i))return;const o={"line-color":t(s.style.stroke,a),"line-width":s.style.strokeWidth,"line-opacity":s.opacity,...s.style.strokeDashArray?{"line-dasharray":s.style.strokeDashArray}:{}},y=s.getStrokeSource(o);e.addLayer(y)})(l,s,m),s.sublayers?.length?(s.sublayers.forEach(t=>{i(e,t,a,r,o,y)}),n):s.isSublayer?void 0:n};class o extends e{get fillLayerId(){return this.hasSublayers||this.hasSymbol?null:this.hasFill?this.id:null}get strokeLayerId(){return this.hasSublayers||this.hasSymbol?null:this.hasStroke?this.hasFill?`${this.id}-stroke`:this.id:null}get symbolLayerId(){return this.hasSublayers?null:this.hasSymbol?this.id:null}get leafLayerIds(){return[this.symbolLayerId,this.fillLayerId,this.strokeLayerId].filter(Boolean)}_geojsonIdStrategy(){return this.idProperty?{promoteId:this.idProperty}:this.generateIds?{generateId:!0}:(this.geojson?.features?.some(t=>"string"==typeof t.id)&&a.warn(`Dataset "${this.id}" has GeoJSON features with string native IDs. MapLibre only surfaces integer native feature IDs through queryRenderedFeatures. Use idProperty to promote a string property instead.`),{})}get source(){if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.source;if(this.tiles){const t={type:"vector",tiles:this.tiles,minzoom:this.minZoom||0,maxzoom:this.maxZoom||22};return this.idProperty&&this.sourceLayer&&(t.promoteId={[this.sourceLayer]:this.idProperty}),t}return this.geojson?{type:"geojson",data:this.geojson,...this._geojsonIdStrategy()}:null}getSymbolSource(t,e){return{id:this.symbolLayerId,type:"symbol",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility,"icon-image":t,...e,"icon-allow-overlap":!0},...this.filter?{filter:this.filter}:{}}}getFillSource(t){return{id:this.fillLayerId,type:"fill",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility},paint:t,...this.filter?{filter:this.filter}:{}}}getStrokeSource(t){return{id:this.strokeLayerId,type:"line",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility},paint:t,...this.filter?{filter:this.filter}:{}}}}class y extends s{constructor(t,e,s){super(t,e,s),this._datasetSourceMap=new Map,window._datasetSourceMap=this._datasetSourceMap,this._symbolLayerIds=new Set}createDataset(t){return new o(t)}async init(){const{patternConfigs:t,symbolConfigs:e}=r.getPatternAndSymbolConfigs();await this.addPatternsAndSymbolsToMap(t,e),this._symbolLayerIds.clear(),r.forEachDataset(t=>this._addLayers(t)),await new Promise(t=>this._map.once("idle",t))}removeLayer(t){this._map.getLayer(t)&&this._map.removeLayer(t),this._symbolLayerIds.delete(t)}async addPatternsAndSymbolsToMap(t,e){const s=r.mapStyle,a=s.id;return Promise.all([this._mapProvider.addPatternsToMap(t,a,this._patternRegistry),this._mapProvider.addSymbolsToMap(e,s,this._symbolRegistry)])}destroy(){const t=new Set;r.forEachDataset(e=>{const s=e.sourceId;this._getLayersUsingSource(s).forEach(t=>this.removeLayer(t)),!t.has(s)&&this._map.getSource(s)&&(this._map.removeSource(s),t.add(s))}),this._datasetSourceMap.clear()}async onMapStyleChange(){await new Promise(t=>this._map.once("idle",t));const{patternConfigs:t,symbolConfigs:e}=r.getPatternAndSymbolConfigs();await this.addPatternsAndSymbolsToMap(t,e),this._symbolLayerIds.clear(),r.forEachDataset(t=>{this._addLayers(t),this._applyFeatureFilter(t)}),this.dynamicSources.forEach(t=>t.reapply())}async onMapSizeChange(){const{mapStyle:t}=r,e=this._pixelRatio,{patternConfigs:s,symbolConfigs:a}=r.getPatternAndSymbolConfigs();await this.addPatternsAndSymbolsToMap(s,a),this._pixelRatio===e&&r.forEach(s=>{const{fillLayerId:a,symbolLayerId:r}=s;if(r&&this._symbolLayerIds.has(r)&&this._map.getLayer(r)){const a=this._symbolRegistry.getSymbolImageId(s.style,t,"normal",e);return void(a&&this._map.setLayoutProperty(r,"icon-image",a))}if(a&&this._map.getLayer(a)){const r=this._patternRegistry.getPatternImageId(s.style,t.id,e);r&&this._map.setPaintProperty(a,"fill-pattern",r)}})}_registerPatternsAndSymbols(t){return this.addPatternsAndSymbolsToMap(t.patternConfigs,t.symbolConfigs)}removeDataset(t){const e=r.getDataset(t);if(!e)return;const{sourceId:s,layerIds:a}=e;a.forEach(t=>this.removeLayer(t));!r.topLevelDatasets().some(e=>e.id!==t&&e.sourceId===s)&&this._map.getSource(s)&&this._map.removeSource(s),this._datasetSourceMap.delete(t)}applyFeatureFilter(t){const e=r.getDataset(t);e&&this._applyFeatureFilter(e)}async applyStyle(t){const e=r.getDataset(t);e.layerIds.forEach(t=>this.removeLayer(t)),await this._registerPatternsAndSymbols(e),this._addLayers(e)}setData(t,e){const s=this._datasetSourceMap.get(t);if(!s)return;const a=this._map.getSource(s);a&&"function"==typeof a.setData&&a.setData(e)}_addLayers(t){const{mapStyle:e}=r,s=i(this._mapProvider,t,e,this._symbolRegistry,this._patternRegistry,this._pixelRatio);this._datasetSourceMap.set(t.id,s),this._maintainSymbolOrdering(t)}_getFirstSymbolLayerId(){const t=this._map.getStyle();if(!t?.layers)return null;const e=t.layers.find(t=>this._symbolLayerIds.has(t.id));return e?.id??null}_maintainSymbolOrdering(t){const e=(t=t.isSublayer?t.parent:t).layerIds.filter(t=>t&&this._map.getLayer(t));e.forEach(t=>{"symbol"===this._map.getLayer(t)?.type?this._symbolLayerIds.add(t):this._symbolLayerIds.delete(t)});const s=this._getFirstSymbolLayerId();s&&e.forEach(t=>{this._symbolLayerIds.has(t)||this._map.moveLayer(t,s)})}_setLayerVisibility(t,e){this._map.getLayer(t)&&this._map.setLayoutProperty(t,"visibility",e)}_applyFeatureFilter(t){t.getLayersWithFilters().forEach(({layerIds:t,filter:e})=>{t.forEach(t=>{this._map.getLayer(t)&&this._map.setFilter(t,e)})})}_setLayerOpacity(t,e){const s=this._map.getLayer(t);if(!s)return;const a={line:"line-opacity",symbol:"icon-opacity"}[s.type]||"fill-opacity";this._map.setPaintProperty(t,a,e)}_getLayersUsingSource(t){const e=this._map.getStyle();return e?.layers?e.layers.filter(e=>e.source===t).map(t=>t.id):[]}}export{y as default};
1
+ import{g as t}from"./layerAdapter.js";import{M as e,a as s}from"./mapboxStyleLayerAdapter.js";import{l as a}from"./im-datasets-plugin.js";import"preact/compat";import"preact/jsx-runtime";const i=(e,s,a,r,o,y)=>{const{map:l}=e,{sourceId:n,source:h}=s;h&&!l.getSource(n)&&l.addSource(n,h);const d=a.id;return((t,e,s,a,i)=>{const{map:r}=t,{hasSymbol:o,symbolLayerId:y}=e;if(!o||!a||!y||r.getLayer(y))return;const l=a.getSymbolDef(e.style);if(!l)return;const n=a.getSymbolImageId(e.style,s,"normal",i);n&&r.addLayer(e.getSymbolSource(n,t.getSymbolIconLayout(l)))})(e,s,a,r,y),((e,s,a,i,r=1)=>{const{hasFill:o,fillLayerId:y}=s;if(!o||!y||e.getLayer(y))return;const l=i.getPatternImageId(s.style,a,r),n=l?{"fill-pattern":l,"fill-opacity":s.opacity}:{"fill-color":t(s.style.fill,a),"fill-opacity":s.opacity};e.addLayer(s.getFillSource(n))})(l,s,d,o,y),((e,s,a)=>{const{hasStroke:i,strokeLayerId:r}=s;if(!i||e.getLayer(r))return;const o={"line-color":t(s.style.stroke,a),"line-width":s.style.strokeWidth,"line-opacity":s.opacity,...s.style.strokeDashArray?{"line-dasharray":s.style.strokeDashArray}:{}},y=s.getStrokeSource(o);e.addLayer(y)})(l,s,d),s.sublayers?.length?(s.sublayers.forEach(t=>{i(e,t,a,r,o,y)}),n):s.isSublayer?void 0:n};class r extends e{get fillLayerId(){return this.hasSublayers||this.hasSymbol?null:this.hasFill?this.id:null}get strokeLayerId(){return this.hasSublayers||this.hasSymbol?null:this.hasStroke?this.hasFill?`${this.id}-stroke`:this.id:null}get symbolLayerId(){return this.hasSublayers?null:this.hasSymbol?this.id:null}get leafLayerIds(){return[this.symbolLayerId,this.fillLayerId,this.strokeLayerId].filter(Boolean)}_geojsonIdStrategy(){return this.idProperty?{promoteId:this.idProperty}:this.generateIds?{generateId:!0}:(this.geojson?.features?.some(t=>"string"==typeof t.id)&&a.warn(`Dataset "${this.id}" has GeoJSON features with string native IDs. MapLibre only surfaces integer native feature IDs through queryRenderedFeatures. Use idProperty to promote a string property instead.`),{})}get source(){if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.source;if(this.tiles){const t={type:"vector",tiles:this.tiles,minzoom:this.minZoom||0,maxzoom:this.maxZoom||22};return this.idProperty&&this.sourceLayer&&(t.promoteId={[this.sourceLayer]:this.idProperty}),t}return this.geojson?{type:"geojson",data:this.geojson,...this._geojsonIdStrategy()}:null}getSymbolSource(t,e){return{id:this.symbolLayerId,type:"symbol",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility,"icon-image":t,...e,"icon-allow-overlap":!0},...this.filter?{filter:this.filter}:{}}}getFillSource(t){return{id:this.fillLayerId,type:"fill",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility},paint:t,...this.filter?{filter:this.filter}:{}}}getStrokeSource(t){return{id:this.strokeLayerId,type:"line",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility},paint:t,...this.filter?{filter:this.filter}:{}}}}class o extends s{constructor(t,e,s,a){super(t,e,s,a),this._datasetSourceMap=new Map,window._datasetSourceMap=this._datasetSourceMap,this._symbolLayerIds=new Set}createDataset(t,e){return new r(t,e)}async init(){const{patternConfigs:t,symbolConfigs:e}=this._datasetRegistry.getPatternAndSymbolConfigs();await this.addPatternsAndSymbolsToMap(t,e),this._symbolLayerIds.clear(),this._datasetRegistry.forEachDataset(t=>this._addLayers(t)),await new Promise(t=>this._map.once("idle",t))}removeLayer(t){this._map.getLayer(t)&&this._map.removeLayer(t),this._symbolLayerIds.delete(t)}async addPatternsAndSymbolsToMap(t,e){const s=this._datasetRegistry.mapStyle,a=s.id;return Promise.all([this._mapProvider.addPatternsToMap(t,a,this._patternRegistry),this._mapProvider.addSymbolsToMap(e,s,this._symbolRegistry)])}destroy(){const t=new Set;this._datasetRegistry.forEachDataset(e=>{const s=e.sourceId;this._getLayersUsingSource(s).forEach(t=>this.removeLayer(t)),!t.has(s)&&this._map.getSource(s)&&(this._map.removeSource(s),t.add(s))}),this._datasetSourceMap.clear()}async onMapStyleChange(){await new Promise(t=>this._map.once("idle",t));const{patternConfigs:t,symbolConfigs:e}=this._datasetRegistry.getPatternAndSymbolConfigs();await this.addPatternsAndSymbolsToMap(t,e),this._symbolLayerIds.clear(),this._datasetRegistry.forEachDataset(t=>{this._addLayers(t),this._applyFeatureFilter(t)}),this.dynamicSources.forEach(t=>t.reapply())}async onMapSizeChange(){const{mapStyle:t}=this._datasetRegistry,e=this._pixelRatio,{patternConfigs:s,symbolConfigs:a}=this._datasetRegistry.getPatternAndSymbolConfigs();await this.addPatternsAndSymbolsToMap(s,a),this._pixelRatio===e&&this._datasetRegistry.forEach(s=>{const{fillLayerId:a,symbolLayerId:i}=s;if(i&&this._symbolLayerIds.has(i)&&this._map.getLayer(i)){const a=this._symbolRegistry.getSymbolImageId(s.style,t,"normal",e);return void(a&&this._map.setLayoutProperty(i,"icon-image",a))}if(a&&this._map.getLayer(a)){const i=this._patternRegistry.getPatternImageId(s.style,t.id,e);i&&this._map.setPaintProperty(a,"fill-pattern",i)}})}_registerPatternsAndSymbols(t){return this.addPatternsAndSymbolsToMap(t.patternConfigs,t.symbolConfigs)}removeDataset(t){const e=this._datasetRegistry.getDataset(t);if(!e)return;const{sourceId:s,layerIds:a}=e;a.forEach(t=>this.removeLayer(t));!this._datasetRegistry.topLevelDatasets().some(e=>e.id!==t&&e.sourceId===s)&&this._map.getSource(s)&&this._map.removeSource(s),this._datasetSourceMap.delete(t)}applyFeatureFilter(t){const e=this._datasetRegistry.getDataset(t);e&&this._applyFeatureFilter(e)}async applyStyle(t){const e=this._datasetRegistry.getDataset(t);e.layerIds.forEach(t=>this.removeLayer(t)),await this._registerPatternsAndSymbols(e),this._addLayers(e)}setData(t,e){const s=this._datasetSourceMap.get(t);if(!s)return;const a=this._map.getSource(s);a&&"function"==typeof a.setData&&a.setData(e)}_addLayers(t){const{mapStyle:e}=this._datasetRegistry,s=i(this._mapProvider,t,e,this._symbolRegistry,this._patternRegistry,this._pixelRatio);this._datasetSourceMap.set(t.id,s),this._maintainSymbolOrdering(t)}_getFirstSymbolLayerId(){const t=this._map.getStyle();if(!t?.layers)return null;const e=t.layers.find(t=>this._symbolLayerIds.has(t.id));return e?.id??null}_maintainSymbolOrdering(t){const e=(t=t.isSublayer?t.parent:t).layerIds.filter(t=>t&&this._map.getLayer(t));e.forEach(t=>{"symbol"===this._map.getLayer(t)?.type?this._symbolLayerIds.add(t):this._symbolLayerIds.delete(t)});const s=this._getFirstSymbolLayerId();s&&e.forEach(t=>{this._symbolLayerIds.has(t)||this._map.moveLayer(t,s)})}_setLayerVisibility(t,e){this._map.getLayer(t)&&this._map.setLayoutProperty(t,"visibility",e)}_applyFeatureFilter(t){t.getLayersWithFilters().forEach(({layerIds:t,filter:e})=>{t.forEach(t=>{this._map.getLayer(t)&&this._map.setFilter(t,e)})})}_setLayerOpacity(t,e){const s=this._map.getLayer(t);if(!s)return;const a={line:"line-opacity",symbol:"icon-opacity"}[s.type]||"fill-opacity";this._map.setPaintProperty(t,a,e)}_getLayersUsingSource(t){const e=this._map.getStyle();return e?.layers?e.layers.filter(e=>e.source===t).map(t=>t.id):[]}}export{o as default};
@@ -1 +1 @@
1
- import{M as t,a as e}from"./mapboxStyleLayerAdapter.js";import{d as s,l as r}from"./im-datasets-plugin.js";import{g as a}from"./layerAdapter.js";import i from"ol/source/Vector.js";import o from"ol/layer/Vector.js";import l from"ol/source/VectorTile.js";import y from"ol/layer/VectorTile.js";import h from"ol/format/GeoJSON.js";import n from"ol/format/MVT.js";import d from"ol/Feature.js";import c from"ol/tilegrid/TileGrid.js";import m from"ol/style/Style.js";import p from"ol/style/Stroke.js";import"preact/compat";import"preact/jsx-runtime";class u extends t{get leafLayerIds(){return this.hasSublayers?[]:this.hasFill||this.hasStroke||this.hasSymbol?[this.id]:[]}get source(){return this.hasDynamicGeoJSON?{type:"geojson",data:{type:"FeatureCollection",features:[]}}:this.tiles?{type:"vector",tiles:this.tiles,minzoom:this.minZoom||0,maxzoom:this.maxZoom||22}:this.geojson?{type:"geojson",data:this.geojson}:null}get idStrategy(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.idProperty||null:this.idProperty||null}get filter(){const t=super.filter;if(!this.sourceLayer)return t;const e=["==",["get","layer"],this.sourceLayer];return t?"all"===t[0]?[...t,e]:["all",t,e]:e}_wrapWithFilter(t){return this.filter?[{filter:this.filter,style:t}]:t}getSymbolMeta({pixelRatio:t,symbolRegistry:e}){if(!this.hasSymbol)return null;const r=e.getSymbolImageId(this.style,s.mapStyle,"normal",t);return r?{imageId:r,anchor:e.getSymbolDef(this.style).anchor,pixelRatio:t}:null}_symbolStyle(t){const e={},s=this.getSymbolMeta(t),r=s&&t.getSymbolDataUri(s.imageId);return r&&(e["icon-src"]=r,e["icon-anchor"]=s.anchor,e["icon-scale"]=1/t.pixelRatio),this._wrapWithFilter(e)}getFlatStyle(t){if(this.hasSymbol)return this._symbolStyle(t);const e=s.mapStyle?.id,r={};return this.hasFill&&!this.hasPattern&&(r["fill-color"]=a(this.style.fill,e)),this.hasStroke&&(r["stroke-color"]=a(this.style.stroke,e),r["stroke-width"]=this.style.strokeWidth,this.style.strokeDashArray&&(r["stroke-line-dash"]=this.style.strokeDashArray)),this._wrapWithFilter(r)}}const f=(t,e)=>{if(t.hasStroke)return new p({color:a(t.style.stroke,e),width:t.style.strokeWidth,lineDash:t.style.strokeDashArray})},g="EPSG:27700",_=new h({dataProjection:g,featureProjection:g}),S=1e-6,b=13e5,L=[0,0,b,b],I=new c({extent:L,origin:[L[0],L[3]],resolutions:Array.from({length:25},(t,e)=>(L[2]-L[0])/(256*2**e)),tileSize:256}),v=(t,e)=>{if(!e)return _.readFeatures(t);const s={...t,features:t.features.map(t=>({...t,id:t.properties?.[e]??t.id}))};return _.readFeatures(s)},D=t=>{const{source:e,id:s,idStrategy:a}=t;if(!e)return null;if("geojson"===e.type){const t=new i;return"string"==typeof e.data?((t,e,s,a)=>{fetch(e).then(t=>{if(!t.ok)throw new Error(`${t.status} ${t.statusText}`);return t.json()}).then(e=>t.addFeatures(v(e,s))).catch(t=>r.warn(`OpenLayers datasets adapter: failed to fetch geojson for dataset "${a}" — ${t.message}`))})(t,e.data,a,s):e.data?.features?.length&&t.addFeatures(v(e.data,a)),t}if("vector"===e.type){const t=Array.isArray(e.tiles)?e.tiles:[e.tiles];return new l({format:new n({featureClass:d,idProperty:a||void 0}),urls:t,projection:g,tileGrid:I})}return r.warn(`OpenLayers datasets adapter: unsupported source type "${e.type}" (dataset "${s}")`),null},P=(t,e={})=>t.hasPattern?((t,{mapStyleId:e,pixelRatio:s,patternRegistry:r,getPatternFill:a,buildFilterEvaluator:i})=>{const o=r.getPatternImageId(t.style,e,s),l=o&&a(o),y=l?new m({fill:l,stroke:f(t,e)}):void 0,h=i(t.filter);return t=>{if(y&&(!h||h(t)))return y}})(t,e):t.getFlatStyle(e);class w extends e{constructor(t,e,s){super(t,e,s),this._sourcesById=new Map,this._layersById=new Map,this.createDataset=this.createDataset.bind(this)}createDataset(t){return new u(t)}get _styleContext(){return{mapStyleId:s.mapStyle?.id,pixelRatio:this._pixelRatio,patternRegistry:this._patternRegistry,symbolRegistry:this._symbolRegistry,getSymbolDataUri:t=>this._mapProvider.getSymbolDataUri(t),getPatternFill:t=>this._mapProvider.getPatternFill(t),buildFilterEvaluator:t=>this._mapProvider.buildFilterEvaluator(t)}}async init(){await Promise.all([this._registerPatterns(),this._registerSymbols()]),s.forEachDataset(t=>this._addLayers(t))}destroy(){this._layersById.forEach(t=>this._map.removeLayer(t)),this._layersById.clear(),this._sourcesById.clear()}async onMapStyleChange(){await Promise.all([this._registerPatterns(),this._registerSymbols()]),s.forEachDataset(t=>this._forEachLeafDataset(t,t=>{this._setLayerStyle(t)})),this._reapplyHighlights()}async onMapSizeChange(){const t=this._pixelRatio;await Promise.all([this._registerPatterns(),this._registerSymbols()]),this._pixelRatio===t&&(s.forEachDataset(t=>this._forEachLeafDataset(t,t=>{(t.hasPattern||t.hasSymbol)&&this._setLayerStyle(t)})),this._reapplyHighlights())}_reapplyHighlights(){this._mapProvider.reapplyHighlights()}_registerPatternsAndSymbols(t){return Promise.all([this._registerPatterns([t]),this._registerSymbols([t])])}removeDataset(t){const e=s.getDataset(t);if(!e)return;e.layerIds.forEach(t=>{const e=this._layersById.get(t);e&&(this._map.removeLayer(e),this._layersById.delete(t))});const{sourceId:r}=e;s.topLevelDatasets().some(e=>e.id!==t&&e.sourceId===r)||this._sourcesById.delete(r)}async applyStyle(t){const e=s.getDataset(t);e&&(await this._registerPatternsAndSymbols(e),this._forEachLeafDataset(e,t=>{this._layersById.has(t.id)?this._setLayerStyle(t):this._addLayers(t)}))}_setLayerOpacity(t,e){this._layersById.get(t)?.setOpacity(e)}_setLayerVisibility(t,e){this._layersById.get(t)?.setVisible("visible"===e)}applyFeatureFilter(t){const e=s.getDataset(t);e&&this._forEachLeafDataset(e,t=>{this._setLayerStyle(t)})}setData(t,e){const r=s.getDataset(t),a=r&&this._sourcesById.get(r.sourceId);a&&(a.clear(),e?.features?.length&&a.addFeatures(v(e,r.idStrategy)))}async _registerPatterns(t=s.topLevelDatasets()){const e=[];t.forEach(t=>this._forEachLeafDataset(t,t=>{t.hasPattern&&e.push(t.style)})),e.length&&await this._mapProvider.addPatternsToMap(e,s.mapStyle?.id,this._patternRegistry,this._pixelRatio)}async _registerSymbols(t=s.topLevelDatasets()){const e=[];t.forEach(t=>this._forEachLeafDataset(t,t=>{t.hasSymbol&&e.push(t.style)})),e.length&&await this._mapProvider.addSymbolsToMap(e,s.mapStyle,this._symbolRegistry,this._pixelRatio)}_setLayerStyle(t){const e=this._layersById.get(t.id);if(e)try{e.setStyle(P(t,this._styleContext)),t.hasSymbol&&e.set("symbolMeta",t.getSymbolMeta(this._styleContext))}catch(e){r.warn(`OpenLayers datasets adapter: failed to build a style for dataset "${t.id}" — ${e.message}`)}}_forEachLeafDataset(t,e){t.hasSublayers?t.sublayers.forEach(t=>this._forEachLeafDataset(t,e)):e(t)}_getOrCreateSource(t){const{sourceId:e}=t;if(this._sourcesById.has(e))return this._sourcesById.get(e);let s;try{s=D(t)}catch(e){return r.warn(`OpenLayers datasets adapter: failed to build a source for dataset "${t.id}" — ${e.message}`),null}return s&&this._sourcesById.set(e,s),s}_addLayers(t){if(t.hasSublayers)return this._getOrCreateSource(t),void t.sublayers.forEach(t=>this._addLayers(t));if(!t.leafLayerIds.length)return;const e=this._getOrCreateSource(t);if(!e)return;let s;try{s=((t,e,s)=>{const r=e instanceof l,a=new(r?y:o)({source:e,style:P(t,s),opacity:t.opacity,visible:"visible"===t.visibility,minZoom:(h=t.minZoom,void 0===h?void 0:h-S),maxZoom:(i=t.maxZoom,void 0===i?void 0:i-S),zIndex:t.hasSymbol?1:0,...r?{renderMode:"vector"}:{}});var i,h;return a.set("layerType",r?"vectorTile":"vector"),a.set("layerId",t.id),t.filter&&a.set("filter",t.filter),t.hasSymbol&&a.set("symbolMeta",t.getSymbolMeta(s)),a})(t,e,this._styleContext)}catch(e){return void r.warn(`OpenLayers datasets adapter: failed to build a style for dataset "${t.id}" — ${e.message}`)}this._map.addLayer(s),this._layersById.set(t.id,s)}}export{w as default};
1
+ import{M as t,a as e}from"./mapboxStyleLayerAdapter.js";import{g as s}from"./layerAdapter.js";import a from"ol/source/Vector.js";import r from"ol/layer/Vector.js";import i from"ol/source/VectorTile.js";import o from"ol/layer/VectorTile.js";import l from"ol/format/GeoJSON.js";import y from"ol/format/MVT.js";import h from"ol/Feature.js";import n from"ol/tilegrid/TileGrid.js";import{l as d}from"./im-datasets-plugin.js";import c from"ol/style/Style.js";import m from"ol/style/Stroke.js";import"preact/compat";import"preact/jsx-runtime";class p extends t{get leafLayerIds(){return this.hasSublayers?[]:this.hasFill||this.hasStroke||this.hasSymbol?[this.id]:[]}get source(){return this.hasDynamicGeoJSON?{type:"geojson",data:{type:"FeatureCollection",features:[]}}:this.tiles?{type:"vector",tiles:this.tiles,minzoom:this.minZoom||0,maxzoom:this.maxZoom||22}:this.geojson?{type:"geojson",data:this.geojson}:null}get idStrategy(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.idProperty||null:this.idProperty||null}get filter(){const t=super.filter;if(!this.sourceLayer)return t;const e=["==",["get","layer"],this.sourceLayer];return t?"all"===t[0]?[...t,e]:["all",t,e]:e}_wrapWithFilter(t){return this.filter?[{filter:this.filter,style:t}]:t}getSymbolMeta({pixelRatio:t,symbolRegistry:e}){if(!this.hasSymbol)return null;const s=e.getSymbolImageId(this.style,this._datasetRegistry.mapStyle,"normal",t);return s?{imageId:s,anchor:e.getSymbolDef(this.style).anchor,pixelRatio:t}:null}_symbolStyle(t){const e={},s=this.getSymbolMeta(t),a=s&&t.getSymbolDataUri(s.imageId);return a&&(e["icon-src"]=a,e["icon-anchor"]=s.anchor,e["icon-scale"]=1/t.pixelRatio),this._wrapWithFilter(e)}getFlatStyle(t){if(this.hasSymbol)return this._symbolStyle(t);const e=this._datasetRegistry.mapStyle?.id,a={};return this.hasFill&&!this.hasPattern&&(a["fill-color"]=s(this.style.fill,e)),this.hasStroke&&(a["stroke-color"]=s(this.style.stroke,e),a["stroke-width"]=this.style.strokeWidth,this.style.strokeDashArray&&(a["stroke-line-dash"]=this.style.strokeDashArray)),this._wrapWithFilter(a)}}const g=(t,e)=>{if(t.hasStroke)return new m({color:s(t.style.stroke,e),width:t.style.strokeWidth,lineDash:t.style.strokeDashArray})},u="EPSG:27700",_=new l({dataProjection:u,featureProjection:u}),f=1e-6,S=13e5,b=[0,0,S,S],L=new n({extent:b,origin:[b[0],b[3]],resolutions:Array.from({length:25},(t,e)=>(b[2]-b[0])/(256*2**e)),tileSize:256}),I=(t,e)=>{if(!e)return _.readFeatures(t);const s={...t,features:t.features.map(t=>({...t,id:t.properties?.[e]??t.id}))};return _.readFeatures(s)},v=t=>{const{source:e,id:s,idStrategy:r}=t;if(!e)return null;if("geojson"===e.type){const t=new a;return"string"==typeof e.data?((t,e,s,a)=>{fetch(e).then(t=>{if(!t.ok)throw new Error(`${t.status} ${t.statusText}`);return t.json()}).then(e=>t.addFeatures(I(e,s))).catch(t=>d.warn(`OpenLayers datasets adapter: failed to fetch geojson for dataset "${a}" — ${t.message}`))})(t,e.data,r,s):e.data?.features?.length&&t.addFeatures(I(e.data,r)),t}if("vector"===e.type){const t=Array.isArray(e.tiles)?e.tiles:[e.tiles];return new i({format:new y({featureClass:h,idProperty:r||void 0}),urls:t,projection:u,tileGrid:L})}return d.warn(`OpenLayers datasets adapter: unsupported source type "${e.type}" (dataset "${s}")`),null},D=(t,e={})=>t.hasPattern?((t,{mapStyleId:e,pixelRatio:s,patternRegistry:a,getPatternFill:r,buildFilterEvaluator:i})=>{const o=a.getPatternImageId(t.style,e,s),l=o&&r(o),y=l?new c({fill:l,stroke:g(t,e)}):void 0,h=i(t.filter);return t=>{if(y&&(!h||h(t)))return y}})(t,e):t.getFlatStyle(e);class R extends e{constructor(t,e,s,a){super(t,e,s,a),this._sourcesById=new Map,this._layersById=new Map,this.createDataset=this.createDataset.bind(this)}createDataset(t,e){return new p(t,e)}get _styleContext(){return{mapStyleId:this._datasetRegistry.mapStyle?.id,pixelRatio:this._pixelRatio,patternRegistry:this._patternRegistry,symbolRegistry:this._symbolRegistry,getSymbolDataUri:t=>this._mapProvider.getSymbolDataUri(t),getPatternFill:t=>this._mapProvider.getPatternFill(t),buildFilterEvaluator:t=>this._mapProvider.buildFilterEvaluator(t)}}async init(){await Promise.all([this._registerPatterns(),this._registerSymbols()]),this._datasetRegistry.forEachDataset(t=>this._addLayers(t))}destroy(){this._layersById.forEach(t=>this._map.removeLayer(t)),this._layersById.clear(),this._sourcesById.clear()}async onMapStyleChange(){await Promise.all([this._registerPatterns(),this._registerSymbols()]),this._datasetRegistry.forEachDataset(t=>this._forEachLeafDataset(t,t=>{this._setLayerStyle(t)})),this._reapplyHighlights()}async onMapSizeChange(){const t=this._pixelRatio;await Promise.all([this._registerPatterns(),this._registerSymbols()]),this._pixelRatio===t&&(this._datasetRegistry.forEachDataset(t=>this._forEachLeafDataset(t,t=>{(t.hasPattern||t.hasSymbol)&&this._setLayerStyle(t)})),this._reapplyHighlights())}_reapplyHighlights(){this._mapProvider.reapplyHighlights()}_registerPatternsAndSymbols(t){return Promise.all([this._registerPatterns([t]),this._registerSymbols([t])])}removeDataset(t){const e=this._datasetRegistry.getDataset(t);if(!e)return;e.layerIds.forEach(t=>{const e=this._layersById.get(t);e&&(this._map.removeLayer(e),this._layersById.delete(t))});const{sourceId:s}=e;this._datasetRegistry.topLevelDatasets().some(e=>e.id!==t&&e.sourceId===s)||this._sourcesById.delete(s)}async applyStyle(t){const e=this._datasetRegistry.getDataset(t);e&&(await this._registerPatternsAndSymbols(e),this._forEachLeafDataset(e,t=>{this._layersById.has(t.id)?this._setLayerStyle(t):this._addLayers(t)}))}_setLayerOpacity(t,e){this._layersById.get(t)?.setOpacity(e)}_setLayerVisibility(t,e){this._layersById.get(t)?.setVisible("visible"===e)}applyFeatureFilter(t){const e=this._datasetRegistry.getDataset(t);e&&this._forEachLeafDataset(e,t=>{this._setLayerStyle(t)})}setData(t,e){const s=this._datasetRegistry.getDataset(t),a=s&&this._sourcesById.get(s.sourceId);a&&(a.clear(),e?.features?.length&&a.addFeatures(I(e,s.idStrategy)))}async _registerPatterns(t=this._datasetRegistry.topLevelDatasets()){const e=[];t.forEach(t=>this._forEachLeafDataset(t,t=>{t.hasPattern&&e.push(t.style)})),e.length&&await this._mapProvider.addPatternsToMap(e,this._datasetRegistry.mapStyle?.id,this._patternRegistry,this._pixelRatio)}async _registerSymbols(t=this._datasetRegistry.topLevelDatasets()){const e=[];t.forEach(t=>this._forEachLeafDataset(t,t=>{t.hasSymbol&&e.push(t.style)})),e.length&&await this._mapProvider.addSymbolsToMap(e,this._datasetRegistry.mapStyle,this._symbolRegistry,this._pixelRatio)}_setLayerStyle(t){const e=this._layersById.get(t.id);if(e)try{e.setStyle(D(t,this._styleContext)),t.hasSymbol&&e.set("symbolMeta",t.getSymbolMeta(this._styleContext))}catch(e){d.warn(`OpenLayers datasets adapter: failed to build a style for dataset "${t.id}" — ${e.message}`)}}_forEachLeafDataset(t,e){t.hasSublayers?t.sublayers.forEach(t=>this._forEachLeafDataset(t,e)):e(t)}_getOrCreateSource(t){const{sourceId:e}=t;if(this._sourcesById.has(e))return this._sourcesById.get(e);let s;try{s=v(t)}catch(e){return d.warn(`OpenLayers datasets adapter: failed to build a source for dataset "${t.id}" — ${e.message}`),null}return s&&this._sourcesById.set(e,s),s}_addLayers(t){if(t.hasSublayers)return this._getOrCreateSource(t),void t.sublayers.forEach(t=>this._addLayers(t));if(!t.leafLayerIds.length)return;const e=this._getOrCreateSource(t);if(!e)return;let s;try{s=((t,e,s)=>{const a=e instanceof i,l=new(a?o:r)({source:e,style:D(t,s),opacity:t.opacity,visible:"visible"===t.visibility,minZoom:(h=t.minZoom,void 0===h?void 0:h-f),maxZoom:(y=t.maxZoom,void 0===y?void 0:y-f),zIndex:t.hasSymbol?1:0,...a?{renderMode:"vector"}:{}});var y,h;return l.set("layerType",a?"vectorTile":"vector"),l.set("layerId",t.id),t.filter&&l.set("filter",t.filter),t.hasSymbol&&l.set("symbolMeta",t.getSymbolMeta(s)),l})(t,e,this._styleContext)}catch(e){return void d.warn(`OpenLayers datasets adapter: failed to build a style for dataset "${t.id}" — ${e.message}`)}this._map.addLayer(s),this._layersById.set(t.id,s)}}export{R as default};
@@ -1 +1 @@
1
- import{useEffect as e,useRef as t}from"preact/compat";import{jsx as a,jsxs as s,Fragment as i}from"preact/jsx-runtime";const r=e=>{const{datasets:t=[]}=e,a=[],s=t.filter(e=>e.showInMenu||e.sublayers?.some(e=>e.showInMenu)),i=new Map;return s.forEach(e=>{if(e.sublayers?.length){const t=e.sublayers.filter(t=>e.showInMenu?!1!==t.showInMenu:t.showInMenu);if(!1===e.showInMenu&&!t.length)return;const s={id:e.id,groupLabel:e.label,visibleWhen:!0,type:"checkbox",items:t.map(t=>({id:`${e.id}-${t.id}`,label:t.label}))};0===s.items.length&&(delete s.groupLabel,s.items.push({id:e.id,label:e.label})),a.push(s)}else if(e.groupLabel){const t=i.has(e.groupLabel)?i.get(e.groupLabel):{id:e.groupLabel,groupLabel:e.groupLabel,visibleWhen:!0,type:"checkbox",items:[]};i.has(e.groupLabel)||(i.set(e.groupLabel,t),a.push(t)),t.items.push({id:e.id,label:e.label})}else a.push({visibleWhen:!0,type:"checkbox",id:e.id,items:[{id:e.id,label:e.label}]})}),a},n=(e,t)=>e.reduce((e,a)=>{const s=a.items.filter(e=>!t.includes(e.id));return s.length&&e.push({...a,items:s}),e},[]),o={minZoom:6,maxZoom:24,showInKey:!1,showInMenu:!1,visible:!0,style:{stroke:"#d4351c",strokeWidth:2,symbolDescription:"red outline"}},l=["stroke","strokeWidth","strokeDashArray","fill","fillPattern","fillPatternSvgContent","fillPatternForegroundColor","fillPatternBackgroundColor","opacity","symbolDescription","symbol","symbolSvgContent","symbolViewBox","symbolAnchor","symbolSize","symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"],d=["stroke","fill","fillPattern","fillPatternSvgContent","symbol","symbolSvgContent"],p=e=>d.some(t=>t in e),u=(e={})=>p(e)?{strokeWidth:o.style.strokeWidth,...e}:{...o.style,...e},h=(e,t)=>{const{id:a}=t,s=(e=>{!0!==e.visible&&!1!==e.visible&&(e.visible="hidden"!==e.visibility);const t={...o,...e,style:{...e.style}};return l.forEach(e=>delete t[e]),t})(t);t.parentId&&("showInKey"in t||delete s.showInKey,"showInMenu"in t||delete s.showInMenu),e[a]=s;const{orderedDatasets:i}=e;i.push(a);const r=t.sublayers?.map(e=>((e,t)=>{const a=`${e}-${t.id}`,s=t.id;return"hidden"!==t.visibility&&(t.visibility="visible"),{...t,id:a,parentId:e,sublayerId:s}})(a,e));if(r?.length){const t=r?.map(e=>e.id),s=r?.reduce(h,{orderedDatasets:i});return e[a].sublayerIds=t,delete e[a].sublayers,{...e,...s,orderedDatasets:i}}return{...e,orderedDatasets:i}},c=e=>{const t=(e.datasets||[]).reduce(h,{orderedDatasets:[]}),{orderedDatasets:a}=t;return delete t.orderedDatasets,{...e,mappedDatasets:t,orderedDatasets:a}},y="[interactive-map]",m={warn:(...e)=>console.warn(y,...e),error:(...e)=>console.error(y,...e)},b=(e,t,a,s="not found")=>!!e.mappedDatasets[t]||(m.error(`${a}: Dataset with id '${t}' ${s}`),!1);let g=0;const f=(e,t,a)=>(g=a.actionsArray.length?g+1:0,{...a,actionsArray:[...a.actionsArray,{method:e,parameters:t,actionId:g}]}),D={SET_DATASETS:(e,t)=>{const{mappedDatasets:a,orderedDatasets:s}=t;return{...e,mappedDatasets:a,orderedDatasets:s}},ADD_DATASET:(e,t)=>{const{dataset:a,mapStyle:s}=t;if(e.mappedDatasets[a.id])return m.error(`addDataset: Dataset with id '${a.id}' already exists`),e;const{mappedDatasets:i,orderedDatasets:n}=c({datasets:[a]}),o=((e,t)=>{const a=[...e.menu],s=r({datasets:[t]}),i=a.find(e=>e.groupLabel===s[0].groupLabel);return i?i.items.push(...s[0].items):a.push(...s),a})(e,a);return f("addDataset",[a.id,s],{...e,mappedDatasets:{...e.mappedDatasets,...i},orderedDatasets:[...e.orderedDatasets,...n],menu:o})},REMOVE_DATASET:(e,t)=>{const{id:a}=t;if(!b(e,a,"removeDataset"))return e;const s={...e.mappedDatasets},i=[a,...s[a]?.sublayerIds||[]];i.forEach(e=>delete s[e]);const r=e.orderedDatasets.filter(e=>!i.includes(e));return{...e,mappedDatasets:s,orderedDatasets:r,menu:n(e.menu,i)}},SET_DATASET_VISIBILITY:(e,t)=>{const{datasetId:a,visible:s}=t;return b(e,a,"setDatasetVisibility")?e.mappedDatasets[a].visible===s?e:f("applyDatasetVisibility",[a,s],{...e,mappedDatasets:{...e.mappedDatasets,[a]:{...e.mappedDatasets[a],visible:s}}}):e},SET_GLOBAL_VISIBILITY:(e,t)=>{const{visible:a}=t;return f("applyGlobalVisibility",[a],{...e,globals:{...e.globals,visible:a}})},SET_DATASET_STYLE:(e,t)=>{const{datasetId:a,styleChanges:s,mapStyle:i}=t;if(!b(e,a,"setDatasetStyle"))return e;const r={...e.mappedDatasets[a].style,...s},n={...e.mappedDatasets[a],...s,style:r};return f("applyStyle",[a,i],{...e,mappedDatasets:{...e.mappedDatasets,[a]:n}})},SET_OPACITY:(e,t)=>{const{datasetId:a,opacity:s}=t;if(!b(e,a,"setOpacity"))return e;const i={...e.mappedDatasets[a].style,opacity:s},r={...e.mappedDatasets[a],style:i};return f("applyDatasetOpacity",[a],{...e,mappedDatasets:{...e.mappedDatasets,[a]:r}})},SET_GLOBAL_OPACITY:(e,t)=>{const{opacity:a}=t;return f("applyGlobalOpacity",[],{...e,globals:{...e.globals,opacity:a}})},HIDE_FEATURES:(e,t)=>{const{datasetId:a,featureIds:s}=t;if(!b(e,a,"setFeatureVisibility - hideFeatures"))return e;const i={...e.mappedDatasets[a]},r=i.hiddenFeatures||[],n=Array.from(new Set([...r,...s]));return i.hiddenFeatures=n,f("applyFeatureFilter",[a],{...e,mappedDatasets:{...e.mappedDatasets,[a]:i}})},SHOW_FEATURES:(e,t)=>{const{datasetId:a,featureIds:s}=t;if(!b(e,a,"setFeatureVisibility - showFeatures"))return e;const i={...e.mappedDatasets[a]},r=(i.hiddenFeatures||[]).filter(e=>!s.includes(e));return i.hiddenFeatures=r.length?r:[-1],f("applyFeatureFilter",[a],{...e,mappedDatasets:{...e.mappedDatasets,[a]:i}})},REMOVE_ADAPTER_ACTIONS:(e,t)=>t?.length?{...e,actionsArray:e.actionsArray.filter(e=>!t.includes(e))}:e,SET_GLOBAL_STATE:(e,t)=>f("applyGlobalOpacity",[],{...e,globals:{...e.globals,...t}}),SET_MENU:(e,t)=>{const{menu:a}=t;return{...e,menu:a}}},S={APP_TOGGLE_BUTTON_STATE:"app:togglebuttonstate",APP_REMOVE_PANEL:"app:removepanel",MAP_SIZE_CHANGE:"map:sizechange",MAP_DATA_CHANGE:"map:datachange"},_=(e,t)=>!(!e||!t)&&!(e[2]<t[0]||e[0]>t[2]||e[3]<t[1]||e[1]>t[3]),I=e=>{let t=1/0,a=1/0,s=-1/0,i=-1/0;const r=(e,n)=>{var o;0===n?(o=e,t=Math.min(t,o[0]),a=Math.min(a,o[1]),s=Math.max(s,o[0]),i=Math.max(i,o[1])):e.forEach(e=>r(e,n-1))};switch(e.type){case"Point":r(e.coordinates,0);break;case"LineString":case"MultiPoint":r(e.coordinates,1);break;case"Polygon":case"MultiLineString":r(e.coordinates,2);break;case"MultiPolygon":r(e.coordinates,3);break;case"GeometryCollection":e.geometries.forEach(e=>{const r=I(e);t=Math.min(t,r[0]),a=Math.min(a,r[1]),s=Math.max(s,r[2]),i=Math.max(i,r[3])});break;default:throw new Error(`Unsupported geometry type: ${e.type}`)}return[t,a,s,i]},v=e=>({type:"FeatureCollection",features:Array.from(e.values()).map(e=>e.feature)}),A=async(e,{mapProvider:t,dynamicGeoJSON:a,onUpdate:s})=>{const{url:i,idProperty:r,transformRequest:n,maxFeatures:o,minZoom:l=0}=a,d=t.getZoom();if(d<l)return;const p=(e=>e.getBounds())(t);if(!(e.fetchedBbox&&(u=e.fetchedBbox,h=p,u&&h&&h[0]>=u[0]&&h[1]>=u[1]&&h[2]<=u[2]&&h[3]<=u[3]))){var u,h,c,y;e.currentController&&e.currentController.abort(),e.currentController=new AbortController;try{const t={bbox:p,zoom:d},l=await(async(e,t,a,s)=>{const i=a(e,t),r="string"==typeof i?{url:i}:i,{url:n,headers:o={}}=r,l=await fetch(n,{headers:o,signal:s});if(!l.ok)throw new Error(`Failed to fetch GeoJSON: ${l.status} ${l.statusText}`);const d=await l.json();if("FeatureCollection"===d.type)return d;if("Feature"===d.type)return{type:"FeatureCollection",features:[d]};if(Array.isArray(d))return{type:"FeatureCollection",features:d};throw new Error("Invalid GeoJSON response")})(i,t,n,e.currentController.signal);((e,t,a)=>{const s=Date.now();t.features.forEach(t=>{const i=((e,t)=>t?e.properties?.[t]??e.id:e.id)(t,a);null!=i?e.set(i,{feature:t,bbox:I(t.geometry),lastSeenAt:s}):console.warn("Feature missing ID, skipping:",t)})})(e.features,l,r),e.fetchedBbox=(c=e.fetchedBbox,y=p,c?[Math.min(c[0],y[0]),Math.min(c[1],y[1]),Math.max(c[2],y[2]),Math.max(c[3],y[3])]:[...y]);const u=e.features.size;((e,t,a)=>{if(!a||e.size<=1.2*a)return;const s=a,i=[],r=[];for(const[a,s]of e)_(s.bbox,t)?i.push(a):r.push({id:a,lastSeenAt:s.lastSeenAt});r.sort((e,t)=>e.lastSeenAt-t.lastSeenAt);const n=e.size-s;for(let t=0;t<n&&t<r.length;t++)e.delete(r[t].id);if(e.size>s){const t=e.size-s,a=i.map(t=>({id:t,lastSeenAt:e.get(t).lastSeenAt})).sort((e,t)=>e.lastSeenAt-t.lastSeenAt);for(let s=0;s<t&&s<a.length;s++)e.delete(a[s].id)}})(e.features,p,o),e.features.size<u&&(e.fetchedBbox=p),s(a.id,v(e.features))}catch(e){if("AbortError"===e.name)return;console.error(`Failed to fetch dynamic GeoJSON for ${a.id}:`,e)}}},E=({dynamicGeoJSON:e,mapProvider:t,onUpdate:a})=>{const s={features:new Map,fetchedBbox:null,currentController:null},i=()=>A(s,{mapProvider:t,dynamicGeoJSON:e,onUpdate:a}),r=((e,t)=>{let a;const s=(...s)=>{clearTimeout(a),a=setTimeout(()=>e(...s),t)};return s.cancel=()=>{clearTimeout(a),a=null},s})(i,200),n=()=>{r()};return t.map.on("moveend",n),i(),{destroy(){var e,a;e=t.map,a=n,(e.off||e.un).call(e,"moveend",a),r.cancel(),s.currentController&&s.currentController.abort()},clear(){s.features.clear(),s.fetchedBbox=null,a(e.id,{type:"FeatureCollection",features:[]})},refresh(){s.features.clear(),s.fetchedBbox=null,i()},getFeatureCount:()=>s.features.size,reapply(){s.features.size>0&&a(e.id,v(s.features))}}};let M={};const C=e=>{M=e},T=e=>{const t=M?.current?.menuState||{};for(const[a,s]of Object.entries(e)){const e=t[a];if(!s.includes(e))return!1}return!0},w=e=>(Array.isArray(e)?e:[e]).includes(L()),L=()=>B.mapStyle.id;class P{constructor(e){this.id=e.id,this.url=e.url,this.transformRequest=e.transformRequest,this.maxFeatures=e.maxFeatures,this.minZoom=e.minZoom,this.idProperty=e.idProperty,this.hiddenFeaturesIdExpression=["to-string",["get",this.idProperty]],this.sourceId=`geojson-dynamic-${this.id}`,this.source={type:"geojson",data:{type:"FeatureCollection",features:[]},...this.idProperty?{promoteId:this.idProperty}:{generateId:!0}}}}let O={};const k=(e,t)=>{switch(O.opacityMode){case"global":return O.opacity;case"multiply":return((e=1,t=1)=>Math.round(100*(e*t*O.opacity+Number.EPSILON))/100)(e,t);default:return((e,t)=>void 0===e?void 0===t?O.opacity:t:e)(e,t)}},F=()=>O.visible;class G{constructor(e){this._datasetDefinition=e}get id(){return this._datasetDefinition.id}get label(){return this._datasetDefinition.label}get hasSymbol(){return!(this.hasSublayers||(e=this.style,!e?.symbol&&!e?.symbolSvgContent));var e}get hasPattern(){return!(this.hasSublayers||this.hasSymbol||(e=this.style,!e.fillPattern&&!e.fillPatternSvgContent));var e}get hasFill(){return!this.hasSublayers&&!this.hasSymbol&&(this.hasPattern||this.style?.fill&&"transparent"!==this.style?.fill)}get hasStroke(){return!this.hasSublayers&&!this.hasSymbol&&Boolean(this.style?.stroke)}get tiles(){return this._datasetDefinition.tiles}get geojson(){return this._datasetDefinition.geojson}get idProperty(){return this._datasetDefinition.idProperty}get generateIds(){return this._datasetDefinition.generateIds}get parentId(){return this._datasetDefinition.parentId}get minZoom(){return this._datasetDefinition.minZoom||this.parent?.minZoom}get maxZoom(){return this._datasetDefinition.maxZoom||this.parent?.maxZoom}get type(){return this._datasetDefinition.type||this.parent?.type}get showInKey(){const e=this._datasetDefinition.showInKey;return void 0!==e?e:this.parent?.showInKey??!1}get visibleWhen(){return void 0===this._datasetDefinition.visibleWhen?this.parent?.visibleWhen:this._datasetDefinition.visibleWhen}get groupLabel(){return this._datasetDefinition.groupLabel||this.parent?.groupLabel||this.parent?.label}get groupId(){const e=this._datasetDefinition.groupId||this.parent?.groupId;return e||(this.groupLabel?this.groupLabel.toLowerCase().replace(/\s+/g,"-"):null)}get opacity(){const e=this.style?.opacity,t=this.parent?.style?.opacity;return k(e,t)}get hasDynamicGeoJSON(){return Boolean(this._datasetDefinition.dynamicGeoJSON)}get dynamicGeoJSON(){return new P({...this._datasetDefinition.dynamicGeoJSON,id:this.id,minZoom:this.minZoom})}get hiddenFeatures(){return this._datasetDefinition.hiddenFeatures}get hasHiddenFeatures(){return Boolean(this.hiddenFeatures?.length>0||this.parent?.hasHiddenFeatures)}get filter(){return null}get isHiddenByInheritance(){return this.isSublayer?!this.parent?.visible:!F()}get isLocallyVisible(){return!!this.isVisible||this._datasetDefinition.visible}get visible(){return this.isSublayer?this._datasetDefinition.visible&&this.parent?.visible:this._datasetDefinition.visible&&F()}get esriStyleLayerId(){return this._datasetDefinition.esriStyleLayerId}get visibility(){const{visible:e,visibleWhen:t}=this;return e&&t?(e=>{if(null==e)return!0;if("boolean"==typeof e)return e;if("object"==typeof e){for(const[t,a]of Object.entries(e)){if("mapStyleId"===t&&!w(a))return!1;if("menu"===t&&!T(a))return!1}return!0}return!0})(t)?"visible":"none":e?"visible":"none"}get keyVisibility(){return this.showInKey&&"visible"===this.visibility}get symbolAnchor(){return this.style?.symbolAnchor?this.style.symbolAnchor:this.parent?.symbolAnchor}get sourceLayer(){return this.isSublayer?this.parent.sourceLayer:this.tiles?this._datasetDefinition.sourceLayer:void 0}get isSublayer(){return Boolean(this._datasetDefinition.parentId)}get hasSublayers(){return this._datasetDefinition.sublayerIds?.length>0}get sublayerIds(){return this._datasetDefinition.sublayerIds}get sublayers(){const{sublayerIds:e}=this;return e?e.map(e=>B.getDataset(e)):[]}get parent(){if(this._datasetDefinition.parentId)return B.getDataset(this._datasetDefinition.parentId)}get inheritedStyle(){const e=this._datasetDefinition.style||{},t=this.parent;return t?{...t.inheritedStyle,opacity:void 0,...e}:e}get style(){return{...u(this.inheritedStyle),symbolDescription:this.symbolDescription}}get hasCustomVisualStyle(){return p(this._datasetDefinition.style||{})}get symbolDescription(){return this._datasetDefinition.style?.symbolDescription?this._datasetDefinition.style.symbolDescription:this.hasCustomVisualStyle?void 0:this.parent?this.parent.symbolDescription:o.style.symbolDescription}get patternConfigs(){const e=this.hasPattern?[this.style]:[];return this.hasSublayers?[...e,...this.sublayers.flatMap(e=>e.patternConfigs)]:e}get symbolConfigs(){const e=this.hasSymbol?[this.style]:[];return this.hasSublayers?[...e,...this.sublayers.flatMap(e=>e.symbolConfigs)]:e}get keyDefinition(){return{id:this.id,type:"dataset",label:this.label,hasSymbol:this.hasSymbol,hasPattern:this.hasPattern,style:this.style,symbolDescription:this.symbolDescription}}}class x{constructor(){this.idToDefinitionMap=new Map,this.definitionToInstanceMap=new Map}add(e){this.idToDefinitionMap.set(e.id,e._datasetDefinition),this.definitionToInstanceMap.set(e._datasetDefinition,e)}invalidateDataset(e){const t=this.idToDefinitionMap.get(e.id);[t.id,...t?.sublayerIds||[]].forEach(e=>{const t=this.idToDefinitionMap.get(e);this.definitionToInstanceMap.delete(t),this.idToDefinitionMap.delete(e)})}invalidateChangedDatasets(e){e.forEach(e=>{const t=this.idToDefinitionMap.get(e.id);if(t&&t!==e){const e=this.definitionToInstanceMap.get(t);this.invalidateDataset(e.isSublayer&&e.parent?e.parent:e)}})}getByDefinition(e){return this.definitionToInstanceMap.get(e)}}const B={attach(e,t,a){this._datasets=e,this._orderedDatasets=t,this.attachMapStyle(a),this._invalidateChangedDatasets()},_definitionCache:new x,_invalidateCache(){this._definitionCache=new x},_invalidateChangedDatasets(){this._datasets?this._definitionCache.invalidateChangedDatasets(Object.values(this._datasets)):this._invalidateCache()},attachCreateDataset(e){this._createDataset=e},_createDataset:e=>(e=>new G(e))(e),attachMapStyle(e){e&&(this._mapStyle=e)},get mapStyle(){return this._mapStyle},getDataset(e){const t=this.datasets[e];if(!t)return;const a=this._definitionCache.getByDefinition(t);if(a)return a;const s=this._createDataset(t);return this._definitionCache.add(s),s.isSublayer&&this.getDataset(s.parentId),s},forEach(e){this._orderedDatasets.forEach(t=>e(this.getDataset(t)))},forEachDataset(e){Object.values(this.datasets).filter(e=>!e.parentId).forEach(t=>e(this.getDataset(t.id)))},topLevelDatasets(){return Object.values(this.datasets).filter(e=>!e.parentId).map(e=>this.getDataset(e.id))},getPatternAndSymbolConfigs(){return this.topLevelDatasets().reduce((e,t)=>({...e,patternConfigs:[...e.patternConfigs,...t.patternConfigs],symbolConfigs:[...e.symbolConfigs,...t.symbolConfigs]}),{patternConfigs:[],symbolConfigs:[]})},_lastMenuState:{},invalidateKeyItemsOnMenuStateChange(e){e!==this._lastMenuState&&(this._lastMenuState=e,this._lastKeyItemsDatasets=null)},_lastKeyItems:{},keyItems(){if(this.datasets===this._lastKeyItemsDatasets)return this._lastKeyItems;this._lastKeyItemsDatasets=this.datasets;const e=[],t=new Map;this.forEach(a=>{if(!a.keyVisibility)return;if(!(a.hasSublayers||a.groupId||a.groupLabel))return void e.push({type:"flat",id:a.id,keyDefinition:a.keyDefinition});const s=a.groupId,i=((a,s)=>{if(t.has(s))return t.get(s);const i={type:"group",id:s,groupLabel:a,keyDefinitions:[]};return t.set(s,i),e.push(i),i})(a.groupLabel||s||a.label,s);a.hasSublayers||i.keyDefinitions.push(a.keyDefinition)});const a=e.filter(e=>"flat"===e.type||Boolean(e.keyDefinitions?.length)),s=a.some(e=>"group"===e.type);return this._lastKeyItems={items:a,hasGroups:s},this._lastKeyItems}};Object.defineProperty(B,"datasets",{get:()=>B._datasets});let N;const V={},$=async(e,t,a,s={})=>{const i=await(async e=>{switch(e.name){case"MapLibreProvider":{const{default:e}=await import(/* webpackChunkName: "im-datasets-ml-adapter" */ "./im-datasets-ml-adapter.js");return e}case"EsriProvider":{const{default:e}=await import(/* webpackChunkName: "im-datasets-esri-adapter" */ "./im-datasets-esri-adapter.js");return e}case"OpenLayersProvider":{const{default:e}=await import(/* webpackChunkName: "im-datasets-ol-adapter" */ "./im-datasets-ol-adapter.js");return e}default:throw new Error(`No layer adapter available for map provider ${e.name}. Please provide a compatible layer adapter.`)}})(e);return N=new i(e,t,a,s),V.removeDataset=N.removeDataset.bind(N),V.setData=N.setData.bind(N),V.applyStyle=N.applyStyle.bind(N),V.applyDatasetVisibility=N.applyDatasetVisibility.bind(N),V.applyGlobalVisibility=N.applyGlobalVisibility.bind(N),V.applyDatasetOpacity=N.applyDatasetOpacity.bind(N),V.applyGlobalOpacity=N.applyGlobalOpacity.bind(N),V.addDataset=N.addDataset.bind(N),V.applyFeatureFilter=N.applyFeatureFilter.bind(N),V.onMapStyleChange=N.onMapStyleChange?.bind(N),V.onMapSizeChange=N.onMapSizeChange?.bind(N),N};const R=({pluginState:{dispatch:e}},t,a={})=>{const{datasetId:s,sublayerId:i}=a,r=i?`${s}-${i}`:s;e(r?{type:"SET_DATASET_VISIBILITY",payload:{datasetId:r,visible:t}}:{type:"SET_GLOBAL_VISIBILITY",payload:{visible:t}})},W=({menuGroupItem:e,onChange:t})=>{const i=B.getDataset(e.id);if(!i)return null;const r=i.isSublayer?i.parentId:i.id,n=i.isSublayer?i.id:void 0,o="im-c-datasets-layers__item govuk-checkboxes govuk-checkboxes--small"+(i.visible?"":" im-c-datasets-layers__item--checked");return a("div",{className:o,"data-module":"govuk-checkboxes",children:s("div",{className:"govuk-checkboxes__item",children:[a("input",{className:"govuk-checkboxes__input",id:i.id,"data-dataset-id":r,"data-sublayer-id":n,name:"layers",type:"checkbox",value:i.id,checked:i.isLocallyVisible,onChange:t}),a("label",{className:"im-c-datasets-layers__item-label govuk-label govuk-checkboxes__label",htmlFor:i.id,children:i.label})]})},i.id)},j=({menuGroup:e,children:t})=>{if(!e.groupLabel)return a(i,{children:t});return a("div",{className:"govuk-form-group im-c-datasets-layers-group",children:s("fieldset",{className:"im-c-datasets-layers-group__fieldset",children:[a("legend",{className:"im-c-datasets-layers-group__legend",children:a("h3",{children:e.groupLabel})}),t]})},e.id)},Z={InitComponent:function({pluginConfig:a,pluginState:s,mapState:i,mapProvider:n,services:o}){const{dispatch:l}=s,{eventBus:d,symbolRegistry:p,patternRegistry:u}=o,h=Boolean(n?.isBaseMapReady());e(()=>{const e=!1!==a.hasMenu&&(e=>e.datasets.some(e=>e.showInMenu||e.sublayers?.some(e=>e.showInMenu)))(a);e||(d.emitWhenReady(S.APP_REMOVE_PANEL,"datasetsLayers"),d.emitWhenReady(S.APP_TOGGLE_BUTTON_STATE,{id:"datasetsLayers",prop:"hidden",value:!0}))},[a.hasMenu]),t(s).current=s;const y=t(null);return e(()=>{if(!h)return;if(y.current)return;(async()=>{const e=await $(n,p,u);y.current=(({adapter:e,pluginConfig:t,mapStyle:a,mapProvider:s,events:i,dispatch:n,eventBus:o})=>{const{datasets:l}=t,d=new Map;t.globals&&n({type:"SET_GLOBAL_STATE",payload:t.globals});const{mappedDatasets:p,orderedDatasets:u}=c({datasets:l});e.createDataset&&B.attachCreateDataset(e.createDataset),B.attach(p,u,a);const h=r({datasets:l});o.requestOnce("menu:state",C),n({type:"SET_MENU",payload:{menu:h}}),n({type:"SET_DATASETS",payload:{mappedDatasets:p,orderedDatasets:u}}),e.init().then(()=>{B.forEachDataset(t=>{if(!t.hasDynamicGeoJSON)return;const{dynamicGeoJSON:a}=t,i=E({dynamicGeoJSON:a,mapProvider:s,onUpdate:(t,a)=>e.setData(t,a)});d.set(t.id,i)}),e.attachDynamicSources(d),o.emit("datasets:ready")});const y=()=>{e.onMapSizeChange()};o.on(i.MAP_SIZE_CHANGE,y);const m=o.emitWhenRequested("datasets:registry",B);return o.on("menu:changed",t=>{B.invalidateKeyItemsOnMenuStateChange(t),e.applyGlobalVisibility()}),{remove(){o.off(i.MAP_SIZE_CHANGE,y),m(),d.forEach(e=>e.destroy()),d.clear(),e.destroy()},refreshDataset(e){d.get(e)?.refresh()},clearDatasetCache(e){d.get(e)?.clear()},getFeatureCount:e=>d.get(e)?.getFeatureCount()??null}})({adapter:e,pluginConfig:a,mapStyle:i.mapStyle,mapProvider:n,events:S,dispatch:l,eventBus:d})})()},[h]),e(()=>{B.attach(s.mappedDatasets,s.orderedDatasets),d.emit("datasets:changed")},[s.mappedDatasets,s.orderedDatasets]),e(()=>{B.attachMapStyle(i.mapStyle),V?.onMapStyleChange&&Promise.resolve(V.onMapStyleChange()).then(()=>{d.emit(S.MAP_DATA_CHANGE)})},[i.mapStyle]),e(()=>{return e=s.globals,void(O=e);var e},[s.globals]),e(()=>{const{actionsArray:e}=s;e.length&&(e.forEach(({method:e,parameters:t})=>V[e](...t)),l({type:"REMOVE_ADAPTER_ACTIONS",payload:e}))},[s.actionsArray]),e(()=>()=>{y.current&&(y.current.remove(),y.current=null)},[]),null},reducer:{initialState:{globals:{visible:!0,opacity:1,opacityMode:"dataset"},key:{items:[],hasGroups:!1},mappedDatasets:{},orderedDatasets:[],actionsArray:[],menu:[]},actions:D},panels:[{id:"datasetsLayers",label:"Layers",mobile:{slot:"drawer",modal:!0,dismissible:!0},tablet:{slot:"left-top",dismissible:!0,exclusive:!0,width:"260px"},desktop:{slot:"left-top",modal:!1,dismissible:!0,exclusive:!0,width:"280px"},render:({pluginState:e})=>{const{menu:t=[]}=e,i=t=>{const{value:a,checked:s}=t.target;R({pluginState:e},s,{datasetId:a})},r=t.some(e=>e.groupLabel);return a("div",{className:"im-c-datasets-layers"+(r?" im-c-datasets-layers--has-groups":""),children:t.map(e=>s(j,{menuGroup:e,children:[" ",e.items.map(e=>a(W,{menuGroupItem:e,onChange:i},e.id))]},e.id))})}}],buttons:[{id:"datasetsLayers",label:"Layers",panelId:"datasetsLayers",iconId:"layers",mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"layers",svgContent:'<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"></path><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"></path><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"></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:{addDataset:({pluginState:{dispatch:e},mapState:t},a)=>{e({type:"ADD_DATASET",payload:{dataset:a,mapStyle:t.mapStyle}})},removeDataset:({pluginState:{dispatch:e}},t)=>{V.removeDataset(t),e({type:"REMOVE_DATASET",payload:{id:t}})},setDatasetVisibility:R,setFeatureVisibility:({pluginState:{dispatch:e}},t,a,{datasetId:s=null}={})=>{if(s){const e=B.getDataset(s);!e||e.idProperty||e.generateIds||m.warn(`setFeatureVisibility: Dataset "${s}" has no idProperty or generateIds configured. Features may not be matched correctly. Add idProperty to match by a feature property, or add generateIds: true to use auto-generated IDs.`)}e({type:t?"SHOW_FEATURES":"HIDE_FEATURES",payload:{datasetId:s,featureIds:a}})},setStyle:({pluginState:{dispatch:e},mapState:t},a,{datasetId:s,sublayerId:i}={})=>{e({type:"SET_DATASET_STYLE",payload:{datasetId:s=i?`${s}-${i}`:s,styleChanges:a,mapStyle:t.mapStyle}})},getStyle:({_pluginState:e},{datasetId:t,sublayerId:a}={})=>{t=a?`${t}-${a}`:t;const s=B.getDataset(t);return s?s.style:(m.warn(`getStyle: Dataset with id ${t} not found`),null)},setOpacity:({pluginState:{dispatch:e}},t,a={})=>{const{datasetId:s,sublayerId:i}=a,r=i?`${s}-${i}`:s;e(r?{type:"SET_OPACITY",payload:{datasetId:r,opacity:t}}:{type:"SET_GLOBAL_OPACITY",payload:{opacity:t}})},getOpacity:({pluginState:{globals:e}},t={})=>{const{datasetId:a,sublayerId:s}=t,i=s?`${a}-${s}`:a;if(i){const e=B.getDataset(i);return e?e.opacity??null:(m.warn(`getOpacity: Dataset with id ${i} not found`),null)}return e.opacity??null},setData:({_pluginState:e},t,{datasetId:a})=>{const s=B.getDataset(a);s?s?.tiles?m.warn(`setData called on vector tile dataset "${a}" — has no effect`):V.setData(a,t):m.warn(`setData: Dataset with id ${a} not found`)},setGlobals:({pluginState:{dispatch:e}},t)=>{const{opacityMode:a}=t,s={};let i=!1;a&&(["dataset","global","multiply"].includes(a)?(i=!0,s.opacityMode=a):m.warn(`Ignoring invalid opacityMode: ${a}. Must be one of 'dataset', 'global' or 'multiply'.`)),i?e({type:"SET_GLOBAL_STATE",payload:s}):m.warn("setGlobals: requires a valid value for opacityMode to be set")}}};var z=Object.freeze({__proto__:null,manifest:Z});export{G as D,B as d,m as l,z as m};
1
+ import{useRef as t,useEffect as e}from"preact/compat";import{jsx as a,jsxs as s,Fragment as i}from"preact/jsx-runtime";const r=t=>{const{datasets:e=[]}=t,a=[],s=e.filter(t=>t.showInMenu||t.sublayers?.some(t=>t.showInMenu)),i=new Map;return s.forEach(t=>{if(t.sublayers?.length){const e=t.sublayers.filter(e=>t.showInMenu?!1!==e.showInMenu:e.showInMenu);if(!1===t.showInMenu&&!e.length)return;const s={id:t.id,groupLabel:t.label,visibleWhen:!0,type:"checkbox",items:e.map(e=>({id:`${t.id}-${e.id}`,label:e.label}))};0===s.items.length&&(delete s.groupLabel,s.items.push({id:t.id,label:t.label})),a.push(s)}else if(t.groupLabel){const e=i.has(t.groupLabel)?i.get(t.groupLabel):{id:t.groupLabel,groupLabel:t.groupLabel,visibleWhen:!0,type:"checkbox",items:[]};i.has(t.groupLabel)||(i.set(t.groupLabel,e),a.push(e)),e.items.push({id:t.id,label:t.label})}else a.push({visibleWhen:!0,type:"checkbox",id:t.id,items:[{id:t.id,label:t.label}]})}),a},n=(t,e)=>t.reduce((t,a)=>{const s=a.items.filter(t=>!e.includes(t.id));return s.length&&t.push({...a,items:s}),t},[]),o={minZoom:6,maxZoom:24,showInKey:!1,showInMenu:!1,visible:!0,style:{stroke:"#d4351c",strokeWidth:2,symbolDescription:"red outline"}},l=["stroke","strokeWidth","strokeDashArray","fill","fillPattern","fillPatternSvgContent","fillPatternForegroundColor","fillPatternBackgroundColor","opacity","symbolDescription","symbol","symbolSvgContent","symbolViewBox","symbolAnchor","symbolSize","symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"],d=["stroke","fill","fillPattern","fillPatternSvgContent","symbol","symbolSvgContent"],u=t=>d.some(e=>e in t),p=(t={})=>u(t)?{strokeWidth:o.style.strokeWidth,...t}:{...o.style,...t},h=(t,e)=>{const{id:a}=e,s=(t=>{!0!==t.visible&&!1!==t.visible&&(t.visible="hidden"!==t.visibility);const e={...o,...t,style:{...t.style}};return l.forEach(t=>delete e[t]),e})(e);e.parentId&&("showInKey"in e||delete s.showInKey,"showInMenu"in e||delete s.showInMenu),t[a]=s;const{orderedDatasets:i}=t;i.push(a);const r=e.sublayers?.map(t=>((t,e)=>{const a=`${t}-${e.id}`,s=e.id;return"hidden"!==e.visibility&&(e.visibility="visible"),{...e,id:a,parentId:t,sublayerId:s}})(a,t));if(r?.length){const e=r?.map(t=>t.id),s=r?.reduce(h,{orderedDatasets:i});return t[a].sublayerIds=e,delete t[a].sublayers,{...t,...s,orderedDatasets:i}}return{...t,orderedDatasets:i}},c=t=>{const e=(t.datasets||[]).reduce(h,{orderedDatasets:[]}),{orderedDatasets:a}=e;return delete e.orderedDatasets,{...t,mappedDatasets:e,orderedDatasets:a}},y="[interactive-map]",m={warn:(...t)=>console.warn(y,...t),error:(...t)=>console.error(y,...t)},g={globals:{visible:!0,opacity:1,opacityMode:"dataset"},key:{items:[],hasGroups:!1},mappedDatasets:{},orderedDatasets:[],actionsArray:[],menu:[],menuInitialised:!1},b=(t,e,a,s="not found")=>!!t.mappedDatasets[e]||(m.error(`${a}: Dataset with id '${e}' ${s}`),!1),f=(t,e,a)=>({...a,actionsArray:[...a.actionsArray,{method:t,parameters:e}]}),D={SET_DATASETS:(t,e)=>{const{mappedDatasets:a,orderedDatasets:s}=e;return{...t,mappedDatasets:a,orderedDatasets:s}},ADD_DATASET:(t,e)=>{const{dataset:a,mapStyle:s}=e;if(t.mappedDatasets[a.id])return m.error(`addDataset: Dataset with id '${a.id}' already exists`),t;const{mappedDatasets:i,orderedDatasets:n}=c({datasets:[a]}),o=((t,e)=>{const a=[...t.menu],s=r({datasets:[e]}),i=a.find(t=>t.groupLabel===s[0].groupLabel);return i?i.items.push(...s[0].items):a.push(...s),a})(t,a);return f("addDataset",[a.id,s],{...t,mappedDatasets:{...t.mappedDatasets,...i},orderedDatasets:[...t.orderedDatasets,...n],menu:o})},REMOVE_DATASET:(t,e)=>{const{id:a}=e;if(!b(t,a,"removeDataset"))return t;const s={...t.mappedDatasets},i=[a,...s[a]?.sublayerIds||[]];i.forEach(t=>delete s[t]);const r=t.orderedDatasets.filter(t=>!i.includes(t));return{...t,mappedDatasets:s,orderedDatasets:r,menu:n(t.menu,i)}},SET_DATASET_VISIBILITY:(t,e)=>{const{datasetId:a,visible:s}=e;return b(t,a,"setDatasetVisibility")?t.mappedDatasets[a].visible===s?t:f("applyDatasetVisibility",[a,s],{...t,mappedDatasets:{...t.mappedDatasets,[a]:{...t.mappedDatasets[a],visible:s}}}):t},SET_GLOBAL_VISIBILITY:(t,e)=>{const{visible:a}=e;return f("applyGlobalVisibility",[a],{...t,globals:{...t.globals,visible:a}})},SET_DATASET_STYLE:(t,e)=>{const{datasetId:a,styleChanges:s,mapStyle:i}=e;if(!b(t,a,"setDatasetStyle"))return t;const r={...t.mappedDatasets[a].style,...s},n={...t.mappedDatasets[a],...s,style:r};return f("applyStyle",[a,i],{...t,mappedDatasets:{...t.mappedDatasets,[a]:n}})},SET_OPACITY:(t,e)=>{const{datasetId:a,opacity:s}=e;if(!b(t,a,"setOpacity"))return t;const i={...t.mappedDatasets[a].style,opacity:s},r={...t.mappedDatasets[a],style:i};return f("applyDatasetOpacity",[a],{...t,mappedDatasets:{...t.mappedDatasets,[a]:r}})},SET_GLOBAL_OPACITY:(t,e)=>{const{opacity:a}=e;return f("applyGlobalOpacity",[],{...t,globals:{...t.globals,opacity:a}})},HIDE_FEATURES:(t,e)=>{const{datasetId:a,featureIds:s}=e;if(!b(t,a,"setFeatureVisibility - hideFeatures"))return t;const i={...t.mappedDatasets[a]},r=i.hiddenFeatures||[],n=Array.from(new Set([...r,...s]));return i.hiddenFeatures=n,f("applyFeatureFilter",[a],{...t,mappedDatasets:{...t.mappedDatasets,[a]:i}})},SHOW_FEATURES:(t,e)=>{const{datasetId:a,featureIds:s}=e;if(!b(t,a,"setFeatureVisibility - showFeatures"))return t;const i={...t.mappedDatasets[a]},r=(i.hiddenFeatures||[]).filter(t=>!s.includes(t));return i.hiddenFeatures=r.length?r:[-1],f("applyFeatureFilter",[a],{...t,mappedDatasets:{...t.mappedDatasets,[a]:i}})},REMOVE_ADAPTER_ACTIONS:(t,e)=>e?.length?{...t,actionsArray:t.actionsArray.filter(t=>!e.includes(t))}:t,SET_GLOBAL_STATE:(t,e)=>f("applyGlobalOpacity",[],{...t,globals:{...t.globals,...e}}),SET_MENU:(t,e)=>{const{menu:a}=e;return{...t,menu:a,menuInitialised:!0}}},S={APP_HIDE_PANEL:"app:hidepanel",MAP_SIZE_CHANGE:"map:sizechange",MAP_DATA_CHANGE:"map:datachange"},_=(t,e)=>!(!t||!e)&&!(t[2]<e[0]||t[0]>e[2]||t[3]<e[1]||t[1]>e[3]),I=t=>{let e=1/0,a=1/0,s=-1/0,i=-1/0;const r=(t,n)=>{var o;0===n?(o=t,e=Math.min(e,o[0]),a=Math.min(a,o[1]),s=Math.max(s,o[0]),i=Math.max(i,o[1])):t.forEach(t=>r(t,n-1))};switch(t.type){case"Point":r(t.coordinates,0);break;case"LineString":case"MultiPoint":r(t.coordinates,1);break;case"Polygon":case"MultiLineString":r(t.coordinates,2);break;case"MultiPolygon":r(t.coordinates,3);break;case"GeometryCollection":t.geometries.forEach(t=>{const r=I(t);e=Math.min(e,r[0]),a=Math.min(a,r[1]),s=Math.max(s,r[2]),i=Math.max(i,r[3])});break;default:throw new Error(`Unsupported geometry type: ${t.type}`)}return[e,a,s,i]},v=t=>({type:"FeatureCollection",features:Array.from(t.values()).map(t=>t.feature)}),A=async(t,{mapProvider:e,dynamicGeoJSON:a,onUpdate:s})=>{const{url:i,idProperty:r,transformRequest:n,maxFeatures:o,minZoom:l=0}=a,d=e.getZoom();if(d<l)return;const u=(t=>t.getBounds())(e);if(!(t.fetchedBbox&&(p=t.fetchedBbox,h=u,p&&h&&h[0]>=p[0]&&h[1]>=p[1]&&h[2]<=p[2]&&h[3]<=p[3]))){var p,h,c,y;t.currentController&&t.currentController.abort(),t.currentController=new AbortController;try{const e={bbox:u,zoom:d},l=await(async(t,e,a,s)=>{const i=a(t,e),r="string"==typeof i?{url:i}:i,{url:n,headers:o={}}=r,l=await fetch(n,{headers:o,signal:s});if(!l.ok)throw new Error(`Failed to fetch GeoJSON: ${l.status} ${l.statusText}`);const d=await l.json();if("FeatureCollection"===d.type)return d;if("Feature"===d.type)return{type:"FeatureCollection",features:[d]};if(Array.isArray(d))return{type:"FeatureCollection",features:d};throw new Error("Invalid GeoJSON response")})(i,e,n,t.currentController.signal);((t,e,a)=>{const s=Date.now();e.features.forEach(e=>{const i=((t,e)=>e?t.properties?.[e]??t.id:t.id)(e,a);null!=i?t.set(i,{feature:e,bbox:I(e.geometry),lastSeenAt:s}):console.warn("Feature missing ID, skipping:",e)})})(t.features,l,r),t.fetchedBbox=(c=t.fetchedBbox,y=u,c?[Math.min(c[0],y[0]),Math.min(c[1],y[1]),Math.max(c[2],y[2]),Math.max(c[3],y[3])]:[...y]);const p=t.features.size;((t,e,a)=>{if(!a||t.size<=1.2*a)return;const s=a,i=[],r=[];for(const[a,s]of t)_(s.bbox,e)?i.push(a):r.push({id:a,lastSeenAt:s.lastSeenAt});r.sort((t,e)=>t.lastSeenAt-e.lastSeenAt);const n=t.size-s;for(let e=0;e<n&&e<r.length;e++)t.delete(r[e].id);if(t.size>s){const e=t.size-s,a=i.map(e=>({id:e,lastSeenAt:t.get(e).lastSeenAt})).sort((t,e)=>t.lastSeenAt-e.lastSeenAt);for(let s=0;s<e&&s<a.length;s++)t.delete(a[s].id)}})(t.features,u,o),t.features.size<p&&(t.fetchedBbox=u),s(a.id,v(t.features))}catch(t){if("AbortError"===t.name)return;console.error(`Failed to fetch dynamic GeoJSON for ${a.id}:`,t)}}},M=({dynamicGeoJSON:t,mapProvider:e,onUpdate:a})=>{const s={features:new Map,fetchedBbox:null,currentController:null},i=()=>A(s,{mapProvider:e,dynamicGeoJSON:t,onUpdate:a}),r=((t,e)=>{let a;const s=(...s)=>{clearTimeout(a),a=setTimeout(()=>t(...s),e)};return s.cancel=()=>{clearTimeout(a),a=null},s})(i,200),n=()=>{r()};return e.map.on("moveend",n),i(),{destroy(){var t,a;t=e.map,a=n,(t.off||t.un).call(t,"moveend",a),r.cancel(),s.currentController&&s.currentController.abort()},clear(){s.features.clear(),s.fetchedBbox=null,a(t.id,{type:"FeatureCollection",features:[]})},refresh(){s.features.clear(),s.fetchedBbox=null,i()},getFeatureCount:()=>s.features.size,reapply(){s.features.size>0&&a(t.id,v(s.features))}}},E=async(t,e,a,s)=>{const i=await(async t=>{switch(t.name){case"MapLibreProvider":{const{default:t}=await import(/* webpackChunkName: "im-datasets-ml-adapter" */ "./im-datasets-ml-adapter.js");return t}case"EsriProvider":{const{default:t}=await import(/* webpackChunkName: "im-datasets-esri-adapter" */ "./im-datasets-esri-adapter.js");return t}case"OpenLayersProvider":{const{default:t}=await import(/* webpackChunkName: "im-datasets-ol-adapter" */ "./im-datasets-ol-adapter.js");return t}default:throw new Error(`No layer adapter available for map provider ${t.name}. Please provide a compatible layer adapter.`)}})(t);return new i(t,e,a,s)},C=({pluginConfig:t,pluginState:e})=>!1!==t.hasMenu&&(e.menuInitialised?e.menu.length>0:(t.datasets||[]).some(t=>t.showInMenu||t.sublayers?.some(t=>t.showInMenu))),T="datasetsLayers";function w({appState:a,pluginConfig:s,pluginState:i,mapState:n,mapProvider:o,services:l}){const{dispatch:d,datasetRegistry:u}=i,{eventBus:p,symbolRegistry:h,patternRegistry:y}=l,m=Boolean(o?.isBaseMapReady());!function({appState:t,pluginConfig:a,pluginState:s,services:i}){const{eventBus:r}=i,n=C({pluginConfig:a,pluginState:s}),o=Boolean(t.openPanels[T]);e(()=>{!n&&o&&r.emit(S.APP_HIDE_PANEL,T)},[n,o])}({appState:a,pluginConfig:s,pluginState:i,services:l});const g=t(i);g.current=i;const b=t(null),f=t=>{const e=o?.datasets;t.length&&e&&(t.forEach(({method:t,parameters:a})=>e[t](...a)),d({type:"REMOVE_ADAPTER_ACTIONS",payload:t}))};return e(()=>{if(!m)return;if(b.current)return;(async()=>{const t=await E(o,h,y,u);b.current=(({adapter:t,datasetRegistry:e,pluginConfig:a,mapStyle:s,mapProvider:i,events:n,dispatch:o,eventBus:l})=>{const{datasets:d}=a,u=new Map;a.globals&&o({type:"SET_GLOBAL_STATE",payload:a.globals});const{mappedDatasets:p,orderedDatasets:h}=c({datasets:d});t.createDataset&&e.attachCreateDataset(t.createDataset),e.attach(p,h,s);const y=r({datasets:d});l.requestOnce("menu:state",t=>e.attachMenuStateRef(t)),o({type:"SET_MENU",payload:{menu:y}}),o({type:"SET_DATASETS",payload:{mappedDatasets:p,orderedDatasets:h}}),t.init().then(()=>{e.forEachDataset(e=>{if(!e.hasDynamicGeoJSON)return;const{dynamicGeoJSON:a}=e,s=M({dynamicGeoJSON:a,mapProvider:i,onUpdate:(e,a)=>t.setData(e,a)});u.set(e.id,s)}),t.attachDynamicSources(u),l.emit("datasets:ready")});const m=()=>{t.onMapSizeChange()};l.on(n.MAP_SIZE_CHANGE,m);const g=l.emitWhenRequested("datasets:registry",e);return l.on("menu:changed",a=>{e.invalidateKeyItemsOnMenuStateChange(a),t.applyGlobalVisibility()}),{remove(){l.off(n.MAP_SIZE_CHANGE,m),g(),u.forEach(t=>t.destroy()),u.clear(),t.destroy()},refreshDataset(t){u.get(t)?.refresh()},clearDatasetCache(t){u.get(t)?.clear()},getFeatureCount:t=>u.get(t)?.getFeatureCount()??null}})({adapter:t,datasetRegistry:u,pluginConfig:s,mapStyle:n.mapStyle,mapProvider:o,events:S,dispatch:d,eventBus:p}),o.datasets=t,f(g.current.actionsArray)})()},[m]),e(()=>{u.attach(i.mappedDatasets,i.orderedDatasets),p.emit("datasets:changed")},[i.mappedDatasets,i.orderedDatasets]),e(()=>{u.attachMapStyle(n.mapStyle);const t=o?.datasets;t?.onMapStyleChange&&Promise.resolve(t.onMapStyleChange()).then(()=>{p.emit(S.MAP_DATA_CHANGE)})},[n.mapStyle]),e(()=>u.attachGlobals(i.globals),[i.globals]),e(()=>f(i.actionsArray),[i.actionsArray]),e(()=>()=>{b.current&&(b.current.remove(),b.current=null,o.datasets=null)},[]),null}const L=({pluginState:{dispatch:t}},e,a={})=>{const{datasetId:s,sublayerId:i}=a,r=i?`${s}-${i}`:s;t(r?{type:"SET_DATASET_VISIBILITY",payload:{datasetId:r,visible:e}}:{type:"SET_GLOBAL_VISIBILITY",payload:{visible:e}})},P=({menuGroupItem:t,datasetRegistry:e,onChange:i})=>{const r=e.getDataset(t.id);if(!r)return null;const n=r.isSublayer?r.parentId:r.id,o=r.isSublayer?r.id:void 0,l="im-c-datasets-layers__item govuk-checkboxes govuk-checkboxes--small"+(r.visible?"":" im-c-datasets-layers__item--checked");return a("div",{className:l,"data-module":"govuk-checkboxes",children:s("div",{className:"govuk-checkboxes__item",children:[a("input",{className:"govuk-checkboxes__input",id:r.id,"data-dataset-id":n,"data-sublayer-id":o,name:"layers",type:"checkbox",value:r.id,checked:r.isLocallyVisible,onChange:i}),a("label",{className:"im-c-datasets-layers__item-label govuk-label govuk-checkboxes__label",htmlFor:r.id,children:r.label})]})},r.id)},k=({menuGroup:t,children:e})=>{if(!t.groupLabel)return a(i,{children:e});return a("div",{className:"govuk-form-group im-c-datasets-layers-group",children:s("fieldset",{className:"im-c-datasets-layers-group__fieldset",children:[a("legend",{className:"im-c-datasets-layers-group__legend",children:a("h3",{children:t.groupLabel})}),e]})},t.id)},O=({pluginState:{dispatch:t},mapState:e},a)=>{t({type:"ADD_DATASET",payload:{dataset:a,mapStyle:e.mapStyle}})},x=({pluginState:{dispatch:t},mapProvider:e},a)=>{e.datasets?.removeDataset(a),t({type:"REMOVE_DATASET",payload:{id:a}})},F=({pluginState:{dispatch:t,datasetRegistry:e}},a,s,{datasetId:i=null}={})=>{if(i){const t=e.getDataset(i);!t||t.idProperty||t.generateIds||m.warn(`setFeatureVisibility: Dataset "${i}" has no idProperty or generateIds configured. Features may not be matched correctly. Add idProperty to match by a feature property, or add generateIds: true to use auto-generated IDs.`)}t({type:a?"SHOW_FEATURES":"HIDE_FEATURES",payload:{datasetId:i,featureIds:s}})},G=({pluginState:{dispatch:t},mapState:e},a,{datasetId:s,sublayerId:i}={})=>{t({type:"SET_DATASET_STYLE",payload:{datasetId:s=i?`${s}-${i}`:s,styleChanges:a,mapStyle:e.mapStyle}})},R=({pluginState:{datasetRegistry:t}},{datasetId:e,sublayerId:a}={})=>{e=a?`${e}-${a}`:e;const s=t.getDataset(e);return s?s.style:(m.warn(`getStyle: Dataset with id ${e} not found`),null)},B=({pluginState:{dispatch:t}},e,a={})=>{const{datasetId:s,sublayerId:i}=a,r=i?`${s}-${i}`:s;t(r?{type:"SET_OPACITY",payload:{datasetId:r,opacity:e}}:{type:"SET_GLOBAL_OPACITY",payload:{opacity:e}})},N=({pluginState:{globals:t,datasetRegistry:e}},a={})=>{const{datasetId:s,sublayerId:i}=a,r=i?`${s}-${i}`:s;if(r){const t=e.getDataset(r);return t?t.opacity??null:(m.warn(`getOpacity: Dataset with id ${r} not found`),null)}return t.opacity??null},$=({pluginState:{datasetRegistry:t},mapProvider:e},a,{datasetId:s})=>{const i=t.getDataset(s);i?i?.tiles?m.warn(`setData called on vector tile dataset "${s}" — has no effect`):e.datasets?.setData(s,a):m.warn(`setData: Dataset with id ${s} not found`)},V=({pluginState:{dispatch:t}},e)=>{const{opacityMode:a}=e,s={};let i=!1;a&&(["dataset","global","multiply"].includes(a)?(i=!0,s.opacityMode=a):m.warn(`Ignoring invalid opacityMode: ${a}. Must be one of 'dataset', 'global' or 'multiply'.`)),i?t({type:"SET_GLOBAL_STATE",payload:s}):m.warn("setGlobals: requires a valid value for opacityMode to be set")};class W{constructor(t){this.id=t.id,this.url=t.url,this.transformRequest=t.transformRequest,this.maxFeatures=t.maxFeatures,this.minZoom=t.minZoom,this.idProperty=t.idProperty,this.hiddenFeaturesIdExpression=["to-string",["get",this.idProperty]],this.sourceId=`geojson-dynamic-${this.id}`,this.source={type:"geojson",data:{type:"FeatureCollection",features:[]},...this.idProperty?{promoteId:this.idProperty}:{generateId:!0}}}}const j=(t,e,a)=>{switch(t.opacityMode){case"global":return t.opacity;case"multiply":return((t,e=1,a=1)=>Math.round(100*(e*a*t.opacity+Number.EPSILON))/100)(t,e,a);default:return((t,e,a)=>void 0===e?void 0===a?t.opacity:a:e)(t,e,a)}};class Z{constructor(t,e){this._datasetDefinition=t,this._datasetRegistry=e}get id(){return this._datasetDefinition.id}get label(){return this._datasetDefinition.label}get hasSymbol(){return!(this.hasSublayers||(t=this.style,!t?.symbol&&!t?.symbolSvgContent));var t}get hasPattern(){return!(this.hasSublayers||this.hasSymbol||(t=this.style,!t.fillPattern&&!t.fillPatternSvgContent));var t}get hasFill(){return!this.hasSublayers&&!this.hasSymbol&&(this.hasPattern||this.style?.fill&&"transparent"!==this.style?.fill)}get hasStroke(){return!this.hasSublayers&&!this.hasSymbol&&Boolean(this.style?.stroke)}get tiles(){return this._datasetDefinition.tiles}get geojson(){return this._datasetDefinition.geojson}get idProperty(){return this._datasetDefinition.idProperty}get generateIds(){return this._datasetDefinition.generateIds}get parentId(){return this._datasetDefinition.parentId}get minZoom(){return this._datasetDefinition.minZoom||this.parent?.minZoom}get maxZoom(){return this._datasetDefinition.maxZoom||this.parent?.maxZoom}get type(){return this._datasetDefinition.type||this.parent?.type}get showInKey(){const t=this._datasetDefinition.showInKey;return void 0!==t?t:this.parent?.showInKey??!1}get visibleWhen(){return void 0===this._datasetDefinition.visibleWhen?this.parent?.visibleWhen:this._datasetDefinition.visibleWhen}get groupLabel(){return this._datasetDefinition.groupLabel||this.parent?.groupLabel||this.parent?.label}get groupId(){const t=this._datasetDefinition.groupId||this.parent?.groupId;return t||(this.groupLabel?this.groupLabel.toLowerCase().replace(/\s+/g,"-"):null)}get opacity(){const t=this.style?.opacity,e=this.parent?.style?.opacity;return j(this._datasetRegistry.globals,t,e)}get hasDynamicGeoJSON(){return Boolean(this._datasetDefinition.dynamicGeoJSON)}get dynamicGeoJSON(){return new W({...this._datasetDefinition.dynamicGeoJSON,id:this.id,minZoom:this.minZoom})}get hiddenFeatures(){return this._datasetDefinition.hiddenFeatures}get hasHiddenFeatures(){return Boolean(this.hiddenFeatures?.length>0||this.parent?.hasHiddenFeatures)}get filter(){return null}get isHiddenByInheritance(){return this.isSublayer?!this.parent?.visible:!this._datasetRegistry.globals.visible}get isLocallyVisible(){return!!this.isVisible||this._datasetDefinition.visible}get visible(){return this.isSublayer?this._datasetDefinition.visible&&this.parent?.visible:this._datasetDefinition.visible&&this._datasetRegistry.globals.visible}get esriStyleLayerId(){return this._datasetDefinition.esriStyleLayerId}get visibility(){const{visible:t,visibleWhen:e}=this;return t&&e?this._datasetRegistry.isVisibleWhen(e)?"visible":"none":t?"visible":"none"}get keyVisibility(){return this.showInKey&&"visible"===this.visibility}get symbolAnchor(){return this.style?.symbolAnchor?this.style.symbolAnchor:this.parent?.symbolAnchor}get sourceLayer(){return this.isSublayer?this.parent.sourceLayer:this.tiles?this._datasetDefinition.sourceLayer:void 0}get isSublayer(){return Boolean(this._datasetDefinition.parentId)}get hasSublayers(){return this._datasetDefinition.sublayerIds?.length>0}get sublayerIds(){return this._datasetDefinition.sublayerIds}get sublayers(){const{sublayerIds:t}=this;return t?t.map(t=>this._datasetRegistry.getDataset(t)):[]}get parent(){if(this._datasetDefinition.parentId)return this._datasetRegistry.getDataset(this._datasetDefinition.parentId)}get inheritedStyle(){const t=this._datasetDefinition.style||{},e=this.parent;return e?{...e.inheritedStyle,opacity:void 0,...t}:t}get style(){return{...p(this.inheritedStyle),symbolDescription:this.symbolDescription}}get hasCustomVisualStyle(){return u(this._datasetDefinition.style||{})}get symbolDescription(){return this._datasetDefinition.style?.symbolDescription?this._datasetDefinition.style.symbolDescription:this.hasCustomVisualStyle?void 0:this.parent?this.parent.symbolDescription:o.style.symbolDescription}get patternConfigs(){const t=this.hasPattern?[this.style]:[];return this.hasSublayers?[...t,...this.sublayers.flatMap(t=>t.patternConfigs)]:t}get symbolConfigs(){const t=this.hasSymbol?[this.style]:[];return this.hasSublayers?[...t,...this.sublayers.flatMap(t=>t.symbolConfigs)]:t}get keyDefinition(){return{id:this.id,type:"dataset",label:this.label,hasSymbol:this.hasSymbol,hasPattern:this.hasPattern,style:this.style,symbolDescription:this.symbolDescription}}}class K{constructor(){this.idToDefinitionMap=new Map,this.definitionToInstanceMap=new Map}add(t){this.idToDefinitionMap.set(t.id,t._datasetDefinition),this.definitionToInstanceMap.set(t._datasetDefinition,t)}invalidateDataset(t){const e=this.idToDefinitionMap.get(t.id);[e.id,...e?.sublayerIds||[]].forEach(t=>{const e=this.idToDefinitionMap.get(t);this.definitionToInstanceMap.delete(e),this.idToDefinitionMap.delete(t)})}invalidateChangedDatasets(t){t.forEach(t=>{const e=this.idToDefinitionMap.get(t.id);if(e&&e!==t){const t=this.definitionToInstanceMap.get(e);this.invalidateDataset(t.isSublayer&&t.parent?t.parent:t)}})}getByDefinition(t){return this.definitionToInstanceMap.get(t)}}const H=(t,e={})=>{for(const[a,s]of Object.entries(t)){const t=e[a];if(!s.includes(t))return!1}return!0},z=(t,e)=>(Array.isArray(t)?t:[t]).includes(e),J={attach(t,e,a){this._datasets=t,this._orderedDatasets=e,this.attachMapStyle(a),this._invalidateChangedDatasets()},_invalidateCache(){this._definitionCache=new K},_invalidateChangedDatasets(){this._datasets?this._definitionCache.invalidateChangedDatasets(Object.values(this._datasets)):this._invalidateCache()},attachCreateDataset(t){this._createDataset=t},_createDataset:(t,e)=>((t,e)=>new Z(t,e))(t,e),attachMapStyle(t){t&&(this._mapStyle=t)},get mapStyle(){return this._mapStyle},attachGlobals(t){t&&(this._globals=t)},get globals(){return this._globals},attachMenuStateRef(t){this._menuStateRef=t},isVisibleWhen(t){return((t,{mapStyleId:e,menuState:a}={})=>{if(null==t)return!0;if("boolean"==typeof t)return t;if("object"==typeof t){for(const[s,i]of Object.entries(t)){if("mapStyleId"===s&&!z(i,e))return!1;if("menu"===s&&!H(i,a))return!1}return!0}return!0})(t,{mapStyleId:this._mapStyle?.id,menuState:this._menuStateRef?.current?.menuState})},get datasets(){return this._datasets},getDataset(t){const e=this.datasets[t];if(!e)return;const a=this._definitionCache.getByDefinition(e);if(a)return a;const s=this._createDataset(e,this);return this._definitionCache.add(s),s.isSublayer&&this.getDataset(s.parentId),s},forEach(t){this._orderedDatasets.forEach(e=>t(this.getDataset(e)))},forEachDataset(t){Object.values(this.datasets).filter(t=>!t.parentId).forEach(e=>t(this.getDataset(e.id)))},topLevelDatasets(){return Object.values(this.datasets).filter(t=>!t.parentId).map(t=>this.getDataset(t.id))},getPatternAndSymbolConfigs(){return this.topLevelDatasets().reduce((t,e)=>({...t,patternConfigs:[...t.patternConfigs,...e.patternConfigs],symbolConfigs:[...t.symbolConfigs,...e.symbolConfigs]}),{patternConfigs:[],symbolConfigs:[]})},invalidateKeyItemsOnMenuStateChange(t){t!==this._lastMenuState&&(this._lastMenuState=t,this._lastKeyItemsDatasets=null)},keyItems(){if(this.datasets===this._lastKeyItemsDatasets)return this._lastKeyItems;this._lastKeyItemsDatasets=this.datasets;const t=[],e=new Map;this.forEach(a=>{if(!a.keyVisibility)return;if(!(a.hasSublayers||a.groupId||a.groupLabel))return void t.push({type:"flat",id:a.id,keyDefinition:a.keyDefinition});const s=a.groupId,i=((a,s)=>{if(e.has(s))return e.get(s);const i={type:"group",id:s,groupLabel:a,keyDefinitions:[]};return e.set(s,i),t.push(i),i})(a.groupLabel||s||a.label,s);a.hasSublayers||i.keyDefinitions.push(a.keyDefinition)});const a=t.filter(t=>"flat"===t.type||Boolean(t.keyDefinitions?.length)),s=a.some(t=>"group"===t.type);return this._lastKeyItems={items:a,hasGroups:s},this._lastKeyItems}},U={id:"datasetsLayers",label:"Layers",mobile:{slot:"drawer",modal:!0,dismissible:!0},tablet:{slot:"left-top",dismissible:!0,exclusive:!0,width:"260px"},desktop:{slot:"left-top",modal:!1,dismissible:!0,exclusive:!0,width:"280px"},render:({pluginState:t})=>{const{menu:e=[]}=t,i=e=>{const{value:a,checked:s}=e.target;L({pluginState:t},s,{datasetId:a})},r=e.some(t=>t.groupLabel);return a("div",{className:"im-c-datasets-layers"+(r?" im-c-datasets-layers--has-groups":""),children:e.map(e=>s(k,{menuGroup:e,children:[" ",e.items.map(e=>a(P,{menuGroupItem:e,datasetRegistry:t.datasetRegistry,onChange:i},e.id))]},e.id))})}},Y={id:"datasetsLayers",label:"Layers",panelId:"datasetsLayers",excludeWhen:t=>!C(t),iconId:"layers",mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}};var q=Object.freeze({__proto__:null,createManifest:({hasMenu:t}={})=>({InitComponent:w,reducer:{initialState:{...g,datasetRegistry:Object.assign(Object.create(J),{_definitionCache:new K,_globals:{},_menuStateRef:{},_lastMenuState:{},_lastKeyItems:{}})},actions:D},panels:!1===t?[]:[U],buttons:!1===t?[]:[Y],icons:[{id:"layers",svgContent:'<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"></path><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"></path><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"></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:{addDataset:O,removeDataset:x,setDatasetVisibility:L,setFeatureVisibility:F,setStyle:G,getStyle:R,setOpacity:B,getOpacity:N,setData:$,setGlobals:V}})});export{Z as D,m as l,q as m};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/regenerator";function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function o(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function i(){var r,n=o(o({noKeyItemText:"No features displayed"},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"datasets",load:(r=e(t.mark(function e(){var r;return t.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,import(/* webpackChunkName: "im-datasets-plugin" */ "./im-datasets-plugin.js").then(function(e){return e.m});case 1:return r=e.sent.manifest,e.abrupt("return",r);case 2:case"end":return e.stop()}},e)})),function(){return r.apply(this,arguments)})});return n}export{i as default};
1
+ import e from"@babel/runtime/helpers/regenerator";import r from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/helpers/objectSpread2";function n(){var n,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=t(t({noKeyItemText:"No features displayed"},a),{},{id:"datasets",load:(n=r(e().m(function r(){var t,n;return e().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,import(/* webpackChunkName: "im-datasets-plugin" */ "./im-datasets-plugin.js").then(function(e){return e.m});case 1:return t=e.v,n=t.createManifest,e.a(2,n(a))}},r)})),function(){return n.apply(this,arguments)})});return o}export{n as default};
@@ -1 +1 @@
1
- import{D as t,d as i}from"./im-datasets-plugin.js";import{L as s}from"./layerAdapter.js";const e=t=>{let i=0,s=2166136261;for(const e of t){const t=e.codePointAt(0);i=Math.imul(i,31)+t,s=Math.imul(s^t,16777619)}return(i>>>0).toString(36)+(s>>>0).toString(36)};class a extends t{get _hiddenFeaturesIdExpression(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.hiddenFeaturesIdExpression:this.idProperty?["to-string",["get",this.idProperty]]:["to-string",["id"]]}get _hiddenFeaturesFilter(){const t=this.hiddenFeatures?.filter(t=>-1!==t);return t?.length?["!",["in",this._hiddenFeaturesIdExpression,["literal",t.map(String)]]]:null}get filter(){const t=["all"];this.parent?.filter&&t.push(this.parent.filter),this._datasetDefinition.filter&&t.push(this._datasetDefinition.filter);const i=this._hiddenFeaturesFilter;return i&&t.push(i),1===t.length?null:t.length>2?t:t[1]}get leafLayerIds(){return[]}get layerIds(){return this.hasSublayers?this.sublayers.flatMap(t=>t.layerIds).filter(Boolean):this.leafLayerIds}getLayersWithValue(t,i=!1){const s=[];if(!1===i||this[i]){const i=this.leafLayerIds;if(i.length){const e=this[t];s.push({layerIds:i,[t]:e})}}return this.hasSublayers&&this.sublayers.forEach(e=>{if(!1===i||e[i]){const[i]=e.getLayersWithValue(t);i&&s.push(i)}}),s}getLayersWithVisibility(){return this.getLayersWithValue("visibility")}getLayersWithOpacity(){return this.getLayersWithValue("opacity")}getLayersWithFilters(){return this.getLayersWithValue("filter","hasHiddenFeatures")}get sourceId(){if(this.isSublayer)return this.parent.sourceId;if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.sourceId;if(this.tiles){const t=Array.isArray(this.tiles)?this.tiles.join(","):this.tiles;return`tiles-${e(t)}`}return this.geojson?"string"==typeof this.geojson?`geojson-${e(this.geojson)}`:`geojson-${this.id}`:`source-${this.id}`}}class r extends s{constructor(t,i,s){super(),this._mapProvider=t,this._map=t.map,this._symbolRegistry=i,this._patternRegistry=s}get _pixelRatio(){return this._map.getPixelRatio()}async addDataset(t){const s=i.getDataset(t);s&&(await this._registerPatternsAndSymbols(s),this._addLayers(s))}applyDatasetOpacity(t){const s=i.getDataset(t);s&&this._applyRegistryDatasetOpacity(s)}_applyRegistryDatasetOpacity(t){t.getLayersWithOpacity().forEach(({layerIds:t,opacity:i})=>{t.forEach(t=>this._setLayerOpacity(t,i))})}applyGlobalOpacity(){i.forEachDataset(t=>this._applyRegistryDatasetOpacity(t))}applyDatasetVisibility(t){const s=i.getDataset(t);s&&this._applyRegistryDatasetVisibility(s)}_applyRegistryDatasetVisibility(t){t.getLayersWithVisibility().forEach(({layerIds:t,visibility:i})=>{t.forEach(t=>this._setLayerVisibility(t,i))})}applyGlobalVisibility(){i.forEachDataset(t=>this._applyRegistryDatasetVisibility(t))}}export{a as M,r as a};
1
+ import{D as t}from"./im-datasets-plugin.js";import{L as s}from"./layerAdapter.js";const i=t=>{let s=0,i=2166136261;for(const e of t){const t=e.codePointAt(0);s=Math.imul(s,31)+t,i=Math.imul(i^t,16777619)}return(s>>>0).toString(36)+(i>>>0).toString(36)};class e extends t{get _hiddenFeaturesIdExpression(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.hiddenFeaturesIdExpression:this.idProperty?["to-string",["get",this.idProperty]]:["to-string",["id"]]}get _hiddenFeaturesFilter(){const t=this.hiddenFeatures?.filter(t=>-1!==t);return t?.length?["!",["in",this._hiddenFeaturesIdExpression,["literal",t.map(String)]]]:null}get filter(){const t=["all"];this.parent?.filter&&t.push(this.parent.filter),this._datasetDefinition.filter&&t.push(this._datasetDefinition.filter);const s=this._hiddenFeaturesFilter;return s&&t.push(s),1===t.length?null:t.length>2?t:t[1]}get leafLayerIds(){return[]}get layerIds(){return this.hasSublayers?this.sublayers.flatMap(t=>t.layerIds).filter(Boolean):this.leafLayerIds}getLayersWithValue(t,s=!1){const i=[];if(!1===s||this[s]){const s=this.leafLayerIds;if(s.length){const e=this[t];i.push({layerIds:s,[t]:e})}}return this.hasSublayers&&this.sublayers.forEach(e=>{if(!1===s||e[s]){const[s]=e.getLayersWithValue(t);s&&i.push(s)}}),i}getLayersWithVisibility(){return this.getLayersWithValue("visibility")}getLayersWithOpacity(){return this.getLayersWithValue("opacity")}getLayersWithFilters(){return this.getLayersWithValue("filter","hasHiddenFeatures")}get sourceId(){if(this.isSublayer)return this.parent.sourceId;if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.sourceId;if(this.tiles){const t=Array.isArray(this.tiles)?this.tiles.join(","):this.tiles;return`tiles-${i(t)}`}return this.geojson?"string"==typeof this.geojson?`geojson-${i(this.geojson)}`:`geojson-${this.id}`:`source-${this.id}`}}class a extends s{constructor(t,s,i,e){super(),this._mapProvider=t,this._map=t.map,this._symbolRegistry=s,this._patternRegistry=i,this._datasetRegistry=e}get _pixelRatio(){return this._map.getPixelRatio()}async addDataset(t){const s=this._datasetRegistry.getDataset(t);s&&(await this._registerPatternsAndSymbols(s),this._addLayers(s))}applyDatasetOpacity(t){const s=this._datasetRegistry.getDataset(t);s&&this._applyRegistryDatasetOpacity(s)}_applyRegistryDatasetOpacity(t){t.getLayersWithOpacity().forEach(({layerIds:t,opacity:s})=>{t.forEach(t=>this._setLayerOpacity(t,s))})}applyGlobalOpacity(){this._datasetRegistry.forEachDataset(t=>this._applyRegistryDatasetOpacity(t))}applyDatasetVisibility(t){const s=this._datasetRegistry.getDataset(t);s&&this._applyRegistryDatasetVisibility(s)}_applyRegistryDatasetVisibility(t){t.getLayersWithVisibility().forEach(({layerIds:t,visibility:s})=>{t.forEach(t=>this._setLayerVisibility(t,s))})}applyGlobalVisibility(){this._datasetRegistry.forEachDataset(t=>this._applyRegistryDatasetVisibility(t))}}export{e as M,a};
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see im-datasets-ml-adapter.js.LICENSE.txt */
2
- "use strict";(Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap=Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap||[]).push([[563],{913:function(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,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function i(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,{h:function(){return m}});var a=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},(e=[{key:"attachDynamicSources",value:function(t){this._dynamicSources=t}},{key:"dynamicSources",get:function(){return this._dynamicSources}}])&&o(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),u=r(262);function c(t){return c="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},c(t)}function s(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof u?n:u,s=Object.create(c.prototype);return l(s,"_invoke",function(r,n,o){var i,u,c,s=0,l=o||[],f=!1,y={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return i=e,u=0,c=t,y.n=r,a}};function p(r,n){for(u=r,c=n,e=0;!f&&s&&!o&&e<l.length;e++){var o,i=l[e],p=y.p,h=i[2];r>3?(o=h===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=r<2&&p<i[1])?(u=0,y.v=n,y.n=i[1]):p<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,y.n=h,u=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(y.n=-1),p(u,c)):y.n=c:y.v=c);try{if(s=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=y.n<0)?c:r.call(n,y))!==a)break}catch(e){i=t,u=1,c=e}finally{s=1}}return{value:e,done:f}}}(r,o,i),!0),s}var a={};function u(){}function c(){}function f(){}e=Object.getPrototypeOf;var y=[][n]?e(e([][n]())):(l(e={},n,function(){return this}),e),p=f.prototype=u.prototype=Object.create(y);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,l(t,o,"GeneratorFunction")),t.prototype=Object.create(p),t}return c.prototype=f,l(p,"constructor",f),l(f,"constructor",c),c.displayName="GeneratorFunction",l(f,o,"GeneratorFunction"),l(p),l(p,o,"Generator"),l(p,n,function(){return this}),l(p,"toString",function(){return"[object Generator]"}),(s=function(){return{w:i,m:h}})()}function l(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}l=function(t,e,r,n){function i(e,r){l(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))},l(t,e,r,n)}function f(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,p(n.key),n)}}function p(t){var e=function(t){if("object"!=c(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==c(e)?e:e+""}function h(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(h=function(){return!!t})()}function b(t){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},b(t)}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}var m=function(t){function e(t,r,n){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=function(t,e,r){return e=b(e),function(t,e){if(e&&("object"==c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,h()?Reflect.construct(e,r||[],b(t).constructor):e.apply(t,r))}(this,e))._mapProvider=t,o._map=t.map,o._symbolRegistry=r,o._patternRegistry=n,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(e,t),r=e,n=[{key:"_pixelRatio",get:function(){return this._map.getPixelRatio()}},{key:"addDataset",value:(o=s().m(function t(e){var r;return s().w(function(t){for(;;)switch(t.n){case 0:if(r=u.Q.getDataset(e)){t.n=1;break}return t.a(2);case 1:return t.n=2,this._registerPatternsAndSymbols(r);case 2:this._addLayers(r);case 3:return t.a(2)}},t,this)}),i=function(){var t=this,e=arguments;return new Promise(function(r,n){var i=o.apply(t,e);function a(t){f(i,r,n,a,u,"next",t)}function u(t){f(i,r,n,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})},{key:"applyDatasetOpacity",value:function(t){var e=u.Q.getDataset(t);e&&this._applyRegistryDatasetOpacity(e)}},{key:"_applyRegistryDatasetOpacity",value:function(t){var e=this;t.getLayersWithOpacity().forEach(function(t){var r=t.layerIds,n=t.opacity;r.forEach(function(t){return e._setLayerOpacity(t,n)})})}},{key:"applyGlobalOpacity",value:function(){var t=this;u.Q.forEachDataset(function(e){return t._applyRegistryDatasetOpacity(e)})}},{key:"applyDatasetVisibility",value:function(t){var e=u.Q.getDataset(t);e&&this._applyRegistryDatasetVisibility(e)}},{key:"_applyRegistryDatasetVisibility",value:function(t){var e=this;t.getLayersWithVisibility().forEach(function(t){var r=t.layerIds,n=t.visibility;r.forEach(function(t){return e._setLayerVisibility(t,n)})})}},{key:"applyGlobalVisibility",value:function(){var t=this;u.Q.forEachDataset(function(e){return t._applyRegistryDatasetVisibility(e)})}}],n&&y(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o,i}(a)},291:function(t,e,r){r.r(e),r.d(e,{default:function(){return T}});var n=r(247);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(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 a(t,e,r){return(e=function(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var u=function(t,e,r,o,c,s){var l,f=t.map,y=e.sourceId,p=e.source;p&&!f.getSource(y)&&f.addSource(y,p);var h=r.id;return function(t,e,r,n,o){var i=t.map,a=e.hasSymbol,u=e.symbolLayerId;if(a&&n&&u&&!i.getLayer(u)){var c=n.getSymbolDef(e.style);if(c){var s=n.getSymbolImageId(e.style,r,"normal",o);s&&i.addLayer(e.getSymbolSource(s,t.getSymbolIconLayout(c)))}}}(t,e,r,o,s),function(t,e,r,o){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=e.hasFill,u=e.fillLayerId;if(a&&u&&!t.getLayer(u)){var c=o.getPatternImageId(e.style,r,i),s=c?{"fill-pattern":c,"fill-opacity":e.opacity}:{"fill-color":(0,n.o)(e.style.fill,r),"fill-opacity":e.opacity};t.addLayer(e.getFillSource(s))}}(f,e,h,c,s),function(t,e,r){var o=e.hasStroke,u=e.strokeLayerId;if(o&&!t.getLayer(u)){var c=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({"line-color":(0,n.o)(e.style.stroke,r),"line-width":e.style.strokeWidth,"line-opacity":e.opacity},e.style.strokeDashArray?{"line-dasharray":e.style.strokeDashArray}:{}),s=e.getStrokeSource(c);t.addLayer(s)}}(f,e,h),null!==(l=e.sublayers)&&void 0!==l&&l.length?(e.sublayers.forEach(function(e){u(t,e,r,o,c,s)}),y):e.isSublayer?void 0:y},c=r(416),s=r(619);function l(t){return l="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},l(t)}function f(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 y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?f(Object(r),!0).forEach(function(e){p(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function p(t,e,r){return(e=b(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,b(n.key),n)}}function b(t){var e=function(t){if("object"!=l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==l(e)?e:e+""}function d(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(d=function(){return!!t})()}function m(t){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},m(t)}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}var g=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,r){return e=m(e),function(t,e){if(e&&("object"==l(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,d()?Reflect.construct(e,r||[],m(t).constructor):e.apply(t,r))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}(e,t),r=e,(n=[{key:"fillLayerId",get:function(){return this.hasSublayers||this.hasSymbol?null:this.hasFill?this.id:null}},{key:"strokeLayerId",get:function(){return this.hasSublayers||this.hasSymbol?null:this.hasStroke?this.hasFill?"".concat(this.id,"-stroke"):this.id:null}},{key:"symbolLayerId",get:function(){return this.hasSublayers?null:this.hasSymbol?this.id:null}},{key:"leafLayerIds",get:function(){return[this.symbolLayerId,this.fillLayerId,this.strokeLayerId].filter(Boolean)}},{key:"_geojsonIdStrategy",value:function(){var t;return this.idProperty?{promoteId:this.idProperty}:this.generateIds?{generateId:!0}:(null!==(t=this.geojson)&&void 0!==t&&null!==(t=t.features)&&void 0!==t&&t.some(function(t){return"string"==typeof t.id})&&s.v.warn('Dataset "'.concat(this.id,'" has GeoJSON features with string native IDs. MapLibre only surfaces integer native feature IDs through queryRenderedFeatures. Use idProperty to promote a string property instead.')),{})}},{key:"source",get:function(){if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.source;if(this.tiles){var t={type:"vector",tiles:this.tiles,minzoom:this.minZoom||0,maxzoom:this.maxZoom||22};return this.idProperty&&this.sourceLayer&&(t.promoteId=p({},this.sourceLayer,this.idProperty)),t}return this.geojson?y({type:"geojson",data:this.geojson},this._geojsonIdStrategy()):null}},{key:"getSymbolSource",value:function(t,e){return y({id:this.symbolLayerId,type:"symbol",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:y(y({visibility:this.visibility,"icon-image":t},e),{},{"icon-allow-overlap":!0})},this.filter?{filter:this.filter}:{})}},{key:"getFillSource",value:function(t){return y({id:this.fillLayerId,type:"fill",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility},paint:t},this.filter?{filter:this.filter}:{})}},{key:"getStrokeSource",value:function(t){return y({id:this.strokeLayerId,type:"line",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility},paint:t},this.filter?{filter:this.filter}:{})}}])&&h(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(c.f),S=r(262);function O(t){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O(t)}function _(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof u?n:u,s=Object.create(c.prototype);return w(s,"_invoke",function(r,n,o){var i,u,c,s=0,l=o||[],f=!1,y={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return i=e,u=0,c=t,y.n=r,a}};function p(r,n){for(u=r,c=n,e=0;!f&&s&&!o&&e<l.length;e++){var o,i=l[e],p=y.p,h=i[2];r>3?(o=h===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=r<2&&p<i[1])?(u=0,y.v=n,y.n=i[1]):p<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,y.n=h,u=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(y.n=-1),p(u,c)):y.n=c:y.v=c);try{if(s=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=y.n<0)?c:r.call(n,y))!==a)break}catch(e){i=t,u=1,c=e}finally{s=1}}return{value:e,done:f}}}(r,o,i),!0),s}var a={};function u(){}function c(){}function s(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(w(e={},n,function(){return this}),e),f=s.prototype=u.prototype=Object.create(l);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,w(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=s,w(f,"constructor",s),w(s,"constructor",c),c.displayName="GeneratorFunction",w(s,o,"GeneratorFunction"),w(f),w(f,o,"Generator"),w(f,n,function(){return this}),w(f,"toString",function(){return"[object Generator]"}),(_=function(){return{w:i,m:y}})()}function w(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}w=function(t,e,r,n){function i(e,r){w(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))},w(t,e,r,n)}function j(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function P(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){j(i,n,o,a,u,"next",t)}function u(t){j(i,n,o,a,u,"throw",t)}a(void 0)})}}function L(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,k(n.key),n)}}function k(t){var e=function(t){if("object"!=O(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=O(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==O(e)?e:e+""}function I(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(I=function(){return!!t})()}function E(t){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},E(t)}function D(t,e){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},D(t,e)}var T=function(t){function e(t,r,n){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=function(t,e,r){return e=E(e),function(t,e){if(e&&("object"==O(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,I()?Reflect.construct(e,r||[],E(t).constructor):e.apply(t,r))}(this,e,[t,r,n]))._datasetSourceMap=new Map,window._datasetSourceMap=o._datasetSourceMap,o._symbolLayerIds=new Set,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&D(t,e)}(e,t),r=e,n=[{key:"createDataset",value:function(t){return new g(t)}},{key:"init",value:(s=P(_().m(function t(){var e,r,n,o=this;return _().w(function(t){for(;;)switch(t.n){case 0:return e=S.Q.getPatternAndSymbolConfigs(),r=e.patternConfigs,n=e.symbolConfigs,t.n=1,this.addPatternsAndSymbolsToMap(r,n);case 1:return this._symbolLayerIds.clear(),S.Q.forEachDataset(function(t){return o._addLayers(t)}),t.n=2,new Promise(function(t){return o._map.once("idle",t)});case 2:return t.a(2)}},t,this)})),function(){return s.apply(this,arguments)})},{key:"removeLayer",value:function(t){this._map.getLayer(t)&&this._map.removeLayer(t),this._symbolLayerIds.delete(t)}},{key:"addPatternsAndSymbolsToMap",value:(c=P(_().m(function t(e,r){var n,o;return _().w(function(t){for(;;)if(0===t.n)return n=S.Q.mapStyle,o=n.id,t.a(2,Promise.all([this._mapProvider.addPatternsToMap(e,o,this._patternRegistry),this._mapProvider.addSymbolsToMap(r,n,this._symbolRegistry)]))},t,this)})),function(t,e){return c.apply(this,arguments)})},{key:"destroy",value:function(){var t=this,e=new Set;S.Q.forEachDataset(function(r){var n=r.sourceId;t._getLayersUsingSource(n).forEach(function(e){return t.removeLayer(e)}),!e.has(n)&&t._map.getSource(n)&&(t._map.removeSource(n),e.add(n))}),this._datasetSourceMap.clear()}},{key:"onMapStyleChange",value:(a=P(_().m(function t(){var e,r,n,o=this;return _().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,new Promise(function(t){return o._map.once("idle",t)});case 1:return e=S.Q.getPatternAndSymbolConfigs(),r=e.patternConfigs,n=e.symbolConfigs,t.n=2,this.addPatternsAndSymbolsToMap(r,n);case 2:this._symbolLayerIds.clear(),S.Q.forEachDataset(function(t){o._addLayers(t),o._applyFeatureFilter(t)}),this.dynamicSources.forEach(function(t){return t.reapply()});case 3:return t.a(2)}},t,this)})),function(){return a.apply(this,arguments)})},{key:"onMapSizeChange",value:(i=P(_().m(function t(){var e,r,n,o,i,a=this;return _().w(function(t){for(;;)switch(t.n){case 0:return e=S.Q.mapStyle,r=this._pixelRatio,n=S.Q.getPatternAndSymbolConfigs(),o=n.patternConfigs,i=n.symbolConfigs,t.n=1,this.addPatternsAndSymbolsToMap(o,i);case 1:if(this._pixelRatio===r){t.n=2;break}return t.a(2);case 2:S.Q.forEach(function(t){var n=t.fillLayerId,o=t.symbolLayerId;if(o&&a._symbolLayerIds.has(o)&&a._map.getLayer(o)){var i=a._symbolRegistry.getSymbolImageId(t.style,e,"normal",r);i&&a._map.setLayoutProperty(o,"icon-image",i)}else if(n&&a._map.getLayer(n)){var u=a._patternRegistry.getPatternImageId(t.style,e.id,r);u&&a._map.setPaintProperty(n,"fill-pattern",u)}});case 3:return t.a(2)}},t,this)})),function(){return i.apply(this,arguments)})},{key:"_registerPatternsAndSymbols",value:function(t){return this.addPatternsAndSymbolsToMap(t.patternConfigs,t.symbolConfigs)}},{key:"removeDataset",value:function(t){var e=this,r=S.Q.getDataset(t);if(r){var n=r.sourceId;r.layerIds.forEach(function(t){return e.removeLayer(t)}),!S.Q.topLevelDatasets().some(function(e){return e.id!==t&&e.sourceId===n})&&this._map.getSource(n)&&this._map.removeSource(n),this._datasetSourceMap.delete(t)}}},{key:"applyFeatureFilter",value:function(t){var e=S.Q.getDataset(t);e&&this._applyFeatureFilter(e)}},{key:"applyStyle",value:(o=P(_().m(function t(e){var r,n=this;return _().w(function(t){for(;;)switch(t.n){case 0:return(r=S.Q.getDataset(e)).layerIds.forEach(function(t){return n.removeLayer(t)}),t.n=1,this._registerPatternsAndSymbols(r);case 1:this._addLayers(r);case 2:return t.a(2)}},t,this)})),function(t){return o.apply(this,arguments)})},{key:"setData",value:function(t,e){var r=this._datasetSourceMap.get(t);if(r){var n=this._map.getSource(r);n&&"function"==typeof n.setData&&n.setData(e)}}},{key:"_addLayers",value:function(t){var e=S.Q.mapStyle,r=u(this._mapProvider,t,e,this._symbolRegistry,this._patternRegistry,this._pixelRatio);this._datasetSourceMap.set(t.id,r),this._maintainSymbolOrdering(t)}},{key:"_getFirstSymbolLayerId",value:function(){var t,e=this,r=this._map.getStyle();if(null==r||!r.layers)return null;var n=r.layers.find(function(t){return e._symbolLayerIds.has(t.id)});return null!==(t=null==n?void 0:n.id)&&void 0!==t?t:null}},{key:"_maintainSymbolOrdering",value:function(t){var e=this,r=(t=t.isSublayer?t.parent:t).layerIds.filter(function(t){return t&&e._map.getLayer(t)});r.forEach(function(t){var r;"symbol"===(null===(r=e._map.getLayer(t))||void 0===r?void 0:r.type)?e._symbolLayerIds.add(t):e._symbolLayerIds.delete(t)});var n=this._getFirstSymbolLayerId();n&&r.forEach(function(t){e._symbolLayerIds.has(t)||e._map.moveLayer(t,n)})}},{key:"_setLayerVisibility",value:function(t,e){this._map.getLayer(t)&&this._map.setLayoutProperty(t,"visibility",e)}},{key:"_applyFeatureFilter",value:function(t){var e=this;t.getLayersWithFilters().forEach(function(t){var r=t.layerIds,n=t.filter;r.forEach(function(t){e._map.getLayer(t)&&e._map.setFilter(t,n)})})}},{key:"_setLayerOpacity",value:function(t,e){var r=this._map.getLayer(t);if(r){var n={line:"line-opacity",symbol:"icon-opacity"}[r.type]||"fill-opacity";this._map.setPaintProperty(t,n,e)}}},{key:"_getLayersUsingSource",value:function(t){var e=this._map.getStyle();return null!=e&&e.layers?e.layers.filter(function(e){return e.source===t}).map(function(t){return t.id}):[]}}],n&&L(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o,i,a,c,s}(r(913).h)},416:function(t,e,r){r.d(e,{f:function(){return p}});var n=r(228);function o(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 i=function(t){var e,r=0,n=2166136261,i=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 o(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)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}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 a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}(t);try{for(i.s();!(e=i.n()).done;){var a=e.value.codePointAt(0);r=Math.imul(r,31)+a,n=Math.imul(n^a,16777619)}}catch(t){i.e(t)}finally{i.f()}return(r>>>0).toString(36)+(n>>>0).toString(36)};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 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}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function s(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+""}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(l=function(){return!!t})()}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function y(t,e){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},y(t,e)}var p=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,r){return e=f(e),function(t,e){if(e&&("object"==a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,l()?Reflect.construct(e,r||[],f(t).constructor):e.apply(t,r))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&y(t,e)}(e,t),r=e,n=[{key:"_hiddenFeaturesIdExpression",get:function(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.hiddenFeaturesIdExpression:this.idProperty?["to-string",["get",this.idProperty]]:["to-string",["id"]]}},{key:"_hiddenFeaturesFilter",get:function(){var t,e=null===(t=this.hiddenFeatures)||void 0===t?void 0:t.filter(function(t){return-1!==t});return null!=e&&e.length?["!",["in",this._hiddenFeaturesIdExpression,["literal",e.map(String)]]]:null}},{key:"filter",get:function(){var t,e=["all"];null!==(t=this.parent)&&void 0!==t&&t.filter&&e.push(this.parent.filter),this._datasetDefinition.filter&&e.push(this._datasetDefinition.filter);var r=this._hiddenFeaturesFilter;return r&&e.push(r),1===e.length?null:e.length>2?e:e[1]}},{key:"leafLayerIds",get:function(){return[]}},{key:"layerIds",get:function(){return this.hasSublayers?this.sublayers.flatMap(function(t){return t.layerIds}).filter(Boolean):this.leafLayerIds}},{key:"getLayersWithValue",value:function(t){var e,r,n,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];if(!1===o||this[o]){var a=this.leafLayerIds;if(a.length){var c=this[t];i.push((e={layerIds:a},n=c,(r=s(r=t))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e))}}return this.hasSublayers&&this.sublayers.forEach(function(e){if(!1===o||e[o]){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=[],c=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||function(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}}(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.")}()}(e.getLayersWithValue(t),1)[0];r&&i.push(r)}}),i}},{key:"getLayersWithVisibility",value:function(){return this.getLayersWithValue("visibility")}},{key:"getLayersWithOpacity",value:function(){return this.getLayersWithValue("opacity")}},{key:"getLayersWithFilters",value:function(){return this.getLayersWithValue("filter","hasHiddenFeatures")}},{key:"sourceId",get:function(){if(this.isSublayer)return this.parent.sourceId;if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.sourceId;if(this.tiles){var t=Array.isArray(this.tiles)?this.tiles.join(","):this.tiles;return"tiles-".concat(i(t))}return this.geojson?"string"==typeof this.geojson?"geojson-".concat(i(this.geojson)):"geojson-".concat(this.id):"source-".concat(this.id)}}],n&&c(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(n.j)},247:function(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)}r.d(e,{o:function(){return o}});var o=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===n(t)){if(e&&t[e])return t[e];var r=Object.values(t)[0];return null!=r?r:null}return null}}}]);
2
+ "use strict";(Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap=Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap||[]).push([[563],{913:function(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,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function i(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+""}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 u(){var t,e,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 c?n:c,l=Object.create(u.prototype);return s(l,"_invoke",function(r,n,o){var i,u,s,c=0,l=o||[],f=!1,y={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return i=e,u=0,s=t,y.n=r,a}};function p(r,n){for(u=r,s=n,e=0;!f&&c&&!o&&e<l.length;e++){var o,i=l[e],p=y.p,h=i[2];r>3?(o=h===n)&&(s=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=r<2&&p<i[1])?(u=0,y.v=n,y.n=i[1]):p<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,y.n=h,u=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,s=h;(e=u<2?t:s)||!f;){i||(u?u<3?(u>1&&(y.n=-1),p(u,s)):y.n=s:y.v=s);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=y.n<0)?s:r.call(n,y))!==a)break}catch(e){i=t,u=1,s=e}finally{c=1}}return{value:e,done:f}}}(r,o,i),!0),l}var a={};function c(){}function l(){}function f(){}e=Object.getPrototypeOf;var y=[][n]?e(e([][n]())):(s(e={},n,function(){return this}),e),p=f.prototype=c.prototype=Object.create(y);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,s(t,o,"GeneratorFunction")),t.prototype=Object.create(p),t}return l.prototype=f,s(p,"constructor",f),s(f,"constructor",l),l.displayName="GeneratorFunction",s(f,o,"GeneratorFunction"),s(p),s(p,o,"Generator"),s(p,n,function(){return this}),s(p,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:h}})()}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 c(t,e,r,n,o,i,a){try{var u=t[i](a),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,f(n.key),n)}}function f(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+""}function y(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(y=function(){return!!t})()}function p(t){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},p(t)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}r.d(e,{h:function(){return b}});var b=function(t){function e(t,r,n,o){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=function(t,e,r){return e=p(e),function(t,e){if(e&&("object"==a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,y()?Reflect.construct(e,r||[],p(t).constructor):e.apply(t,r))}(this,e))._mapProvider=t,i._map=t.map,i._symbolRegistry=r,i._patternRegistry=n,i._datasetRegistry=o,i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}(e,t),r=e,n=[{key:"_pixelRatio",get:function(){return this._map.getPixelRatio()}},{key:"addDataset",value:(o=u().m(function t(e){var r;return u().w(function(t){for(;;)switch(t.n){case 0:if(r=this._datasetRegistry.getDataset(e)){t.n=1;break}return t.a(2);case 1:return t.n=2,this._registerPatternsAndSymbols(r);case 2:this._addLayers(r);case 3:return t.a(2)}},t,this)}),i=function(){var t=this,e=arguments;return new Promise(function(r,n){var i=o.apply(t,e);function a(t){c(i,r,n,a,u,"next",t)}function u(t){c(i,r,n,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})},{key:"applyDatasetOpacity",value:function(t){var e=this._datasetRegistry.getDataset(t);e&&this._applyRegistryDatasetOpacity(e)}},{key:"_applyRegistryDatasetOpacity",value:function(t){var e=this;t.getLayersWithOpacity().forEach(function(t){var r=t.layerIds,n=t.opacity;r.forEach(function(t){return e._setLayerOpacity(t,n)})})}},{key:"applyGlobalOpacity",value:function(){var t=this;this._datasetRegistry.forEachDataset(function(e){return t._applyRegistryDatasetOpacity(e)})}},{key:"applyDatasetVisibility",value:function(t){var e=this._datasetRegistry.getDataset(t);e&&this._applyRegistryDatasetVisibility(e)}},{key:"_applyRegistryDatasetVisibility",value:function(t){var e=this;t.getLayersWithVisibility().forEach(function(t){var r=t.layerIds,n=t.visibility;r.forEach(function(t){return e._setLayerVisibility(t,n)})})}},{key:"applyGlobalVisibility",value:function(){var t=this;this._datasetRegistry.forEachDataset(function(e){return t._applyRegistryDatasetVisibility(e)})}}],n&&l(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o,i}(function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},(e=[{key:"attachDynamicSources",value:function(t){this._dynamicSources=t}},{key:"dynamicSources",get:function(){return this._dynamicSources}}])&&o(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}())},291:function(t,e,r){r.r(e),r.d(e,{default:function(){return D}});var n=r(247);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(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 a(t,e,r){return(e=function(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var u=function(t,e,r,o,s,c){var l,f=t.map,y=e.sourceId,p=e.source;p&&!f.getSource(y)&&f.addSource(y,p);var h=r.id;return function(t,e,r,n,o){var i=t.map,a=e.hasSymbol,u=e.symbolLayerId;if(a&&n&&u&&!i.getLayer(u)){var s=n.getSymbolDef(e.style);if(s){var c=n.getSymbolImageId(e.style,r,"normal",o);c&&i.addLayer(e.getSymbolSource(c,t.getSymbolIconLayout(s)))}}}(t,e,r,o,c),function(t,e,r,o){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=e.hasFill,u=e.fillLayerId;if(a&&u&&!t.getLayer(u)){var s=o.getPatternImageId(e.style,r,i),c=s?{"fill-pattern":s,"fill-opacity":e.opacity}:{"fill-color":(0,n.o)(e.style.fill,r),"fill-opacity":e.opacity};t.addLayer(e.getFillSource(c))}}(f,e,h,s,c),function(t,e,r){var o=e.hasStroke,u=e.strokeLayerId;if(o&&!t.getLayer(u)){var s=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({"line-color":(0,n.o)(e.style.stroke,r),"line-width":e.style.strokeWidth,"line-opacity":e.opacity},e.style.strokeDashArray?{"line-dasharray":e.style.strokeDashArray}:{}),c=e.getStrokeSource(s);t.addLayer(c)}}(f,e,h),null!==(l=e.sublayers)&&void 0!==l&&l.length?(e.sublayers.forEach(function(e){u(t,e,r,o,s,c)}),y):e.isSublayer?void 0:y},s=r(416),c=r(619);function l(t){return l="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},l(t)}function f(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 y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?f(Object(r),!0).forEach(function(e){p(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function p(t,e,r){return(e=b(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,b(n.key),n)}}function b(t){var e=function(t){if("object"!=l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==l(e)?e:e+""}function d(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(d=function(){return!!t})()}function m(t){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},m(t)}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}var g=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,r){return e=m(e),function(t,e){if(e&&("object"==l(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,d()?Reflect.construct(e,r||[],m(t).constructor):e.apply(t,r))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}(e,t),r=e,(n=[{key:"fillLayerId",get:function(){return this.hasSublayers||this.hasSymbol?null:this.hasFill?this.id:null}},{key:"strokeLayerId",get:function(){return this.hasSublayers||this.hasSymbol?null:this.hasStroke?this.hasFill?"".concat(this.id,"-stroke"):this.id:null}},{key:"symbolLayerId",get:function(){return this.hasSublayers?null:this.hasSymbol?this.id:null}},{key:"leafLayerIds",get:function(){return[this.symbolLayerId,this.fillLayerId,this.strokeLayerId].filter(Boolean)}},{key:"_geojsonIdStrategy",value:function(){var t;return this.idProperty?{promoteId:this.idProperty}:this.generateIds?{generateId:!0}:(null!==(t=this.geojson)&&void 0!==t&&null!==(t=t.features)&&void 0!==t&&t.some(function(t){return"string"==typeof t.id})&&c.v.warn('Dataset "'.concat(this.id,'" has GeoJSON features with string native IDs. MapLibre only surfaces integer native feature IDs through queryRenderedFeatures. Use idProperty to promote a string property instead.')),{})}},{key:"source",get:function(){if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.source;if(this.tiles){var t={type:"vector",tiles:this.tiles,minzoom:this.minZoom||0,maxzoom:this.maxZoom||22};return this.idProperty&&this.sourceLayer&&(t.promoteId=p({},this.sourceLayer,this.idProperty)),t}return this.geojson?y({type:"geojson",data:this.geojson},this._geojsonIdStrategy()):null}},{key:"getSymbolSource",value:function(t,e){return y({id:this.symbolLayerId,type:"symbol",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:y(y({visibility:this.visibility,"icon-image":t},e),{},{"icon-allow-overlap":!0})},this.filter?{filter:this.filter}:{})}},{key:"getFillSource",value:function(t){return y({id:this.fillLayerId,type:"fill",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility},paint:t},this.filter?{filter:this.filter}:{})}},{key:"getStrokeSource",value:function(t){return y({id:this.strokeLayerId,type:"line",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility},paint:t},this.filter?{filter:this.filter}:{})}}])&&h(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(s.f);function S(t){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},S(t)}function _(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var s=n&&n.prototype instanceof u?n:u,c=Object.create(s.prototype);return O(c,"_invoke",function(r,n,o){var i,u,s,c=0,l=o||[],f=!1,y={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return i=e,u=0,s=t,y.n=r,a}};function p(r,n){for(u=r,s=n,e=0;!f&&c&&!o&&e<l.length;e++){var o,i=l[e],p=y.p,h=i[2];r>3?(o=h===n)&&(s=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=r<2&&p<i[1])?(u=0,y.v=n,y.n=i[1]):p<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,y.n=h,u=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,s=h;(e=u<2?t:s)||!f;){i||(u?u<3?(u>1&&(y.n=-1),p(u,s)):y.n=s:y.v=s);try{if(c=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=y.n<0)?s:r.call(n,y))!==a)break}catch(e){i=t,u=1,s=e}finally{c=1}}return{value:e,done:f}}}(r,o,i),!0),c}var a={};function u(){}function s(){}function c(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(O(e={},n,function(){return this}),e),f=c.prototype=u.prototype=Object.create(l);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,O(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=c,O(f,"constructor",c),O(c,"constructor",s),s.displayName="GeneratorFunction",O(c,o,"GeneratorFunction"),O(f),O(f,o,"Generator"),O(f,n,function(){return this}),O(f,"toString",function(){return"[object Generator]"}),(_=function(){return{w:i,m:y}})()}function O(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}O=function(t,e,r,n){function i(e,r){O(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))},O(t,e,r,n)}function w(t,e,r,n,o,i,a){try{var u=t[i](a),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}function j(t){return 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)})}}function P(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,L(n.key),n)}}function L(t){var e=function(t){if("object"!=S(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==S(e)?e:e+""}function k(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(k=function(){return!!t})()}function I(t){return I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},I(t)}function E(t,e){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},E(t,e)}var D=function(t){function e(t,r,n,o){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=function(t,e,r){return e=I(e),function(t,e){if(e&&("object"==S(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,k()?Reflect.construct(e,r||[],I(t).constructor):e.apply(t,r))}(this,e,[t,r,n,o]))._datasetSourceMap=new Map,window._datasetSourceMap=i._datasetSourceMap,i._symbolLayerIds=new Set,i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&E(t,e)}(e,t),r=e,n=[{key:"createDataset",value:function(t,e){return new g(t,e)}},{key:"init",value:(c=j(_().m(function t(){var e,r,n,o=this;return _().w(function(t){for(;;)switch(t.n){case 0:return e=this._datasetRegistry.getPatternAndSymbolConfigs(),r=e.patternConfigs,n=e.symbolConfigs,t.n=1,this.addPatternsAndSymbolsToMap(r,n);case 1:return this._symbolLayerIds.clear(),this._datasetRegistry.forEachDataset(function(t){return o._addLayers(t)}),t.n=2,new Promise(function(t){return o._map.once("idle",t)});case 2:return t.a(2)}},t,this)})),function(){return c.apply(this,arguments)})},{key:"removeLayer",value:function(t){this._map.getLayer(t)&&this._map.removeLayer(t),this._symbolLayerIds.delete(t)}},{key:"addPatternsAndSymbolsToMap",value:(s=j(_().m(function t(e,r){var n,o;return _().w(function(t){for(;;)if(0===t.n)return n=this._datasetRegistry.mapStyle,o=n.id,t.a(2,Promise.all([this._mapProvider.addPatternsToMap(e,o,this._patternRegistry),this._mapProvider.addSymbolsToMap(r,n,this._symbolRegistry)]))},t,this)})),function(t,e){return s.apply(this,arguments)})},{key:"destroy",value:function(){var t=this,e=new Set;this._datasetRegistry.forEachDataset(function(r){var n=r.sourceId;t._getLayersUsingSource(n).forEach(function(e){return t.removeLayer(e)}),!e.has(n)&&t._map.getSource(n)&&(t._map.removeSource(n),e.add(n))}),this._datasetSourceMap.clear()}},{key:"onMapStyleChange",value:(a=j(_().m(function t(){var e,r,n,o=this;return _().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,new Promise(function(t){return o._map.once("idle",t)});case 1:return e=this._datasetRegistry.getPatternAndSymbolConfigs(),r=e.patternConfigs,n=e.symbolConfigs,t.n=2,this.addPatternsAndSymbolsToMap(r,n);case 2:this._symbolLayerIds.clear(),this._datasetRegistry.forEachDataset(function(t){o._addLayers(t),o._applyFeatureFilter(t)}),this.dynamicSources.forEach(function(t){return t.reapply()});case 3:return t.a(2)}},t,this)})),function(){return a.apply(this,arguments)})},{key:"onMapSizeChange",value:(i=j(_().m(function t(){var e,r,n,o,i,a=this;return _().w(function(t){for(;;)switch(t.n){case 0:return e=this._datasetRegistry.mapStyle,r=this._pixelRatio,n=this._datasetRegistry.getPatternAndSymbolConfigs(),o=n.patternConfigs,i=n.symbolConfigs,t.n=1,this.addPatternsAndSymbolsToMap(o,i);case 1:if(this._pixelRatio===r){t.n=2;break}return t.a(2);case 2:this._datasetRegistry.forEach(function(t){var n=t.fillLayerId,o=t.symbolLayerId;if(o&&a._symbolLayerIds.has(o)&&a._map.getLayer(o)){var i=a._symbolRegistry.getSymbolImageId(t.style,e,"normal",r);i&&a._map.setLayoutProperty(o,"icon-image",i)}else if(n&&a._map.getLayer(n)){var u=a._patternRegistry.getPatternImageId(t.style,e.id,r);u&&a._map.setPaintProperty(n,"fill-pattern",u)}});case 3:return t.a(2)}},t,this)})),function(){return i.apply(this,arguments)})},{key:"_registerPatternsAndSymbols",value:function(t){return this.addPatternsAndSymbolsToMap(t.patternConfigs,t.symbolConfigs)}},{key:"removeDataset",value:function(t){var e=this,r=this._datasetRegistry.getDataset(t);if(r){var n=r.sourceId;r.layerIds.forEach(function(t){return e.removeLayer(t)}),!this._datasetRegistry.topLevelDatasets().some(function(e){return e.id!==t&&e.sourceId===n})&&this._map.getSource(n)&&this._map.removeSource(n),this._datasetSourceMap.delete(t)}}},{key:"applyFeatureFilter",value:function(t){var e=this._datasetRegistry.getDataset(t);e&&this._applyFeatureFilter(e)}},{key:"applyStyle",value:(o=j(_().m(function t(e){var r,n=this;return _().w(function(t){for(;;)switch(t.n){case 0:return(r=this._datasetRegistry.getDataset(e)).layerIds.forEach(function(t){return n.removeLayer(t)}),t.n=1,this._registerPatternsAndSymbols(r);case 1:this._addLayers(r);case 2:return t.a(2)}},t,this)})),function(t){return o.apply(this,arguments)})},{key:"setData",value:function(t,e){var r=this._datasetSourceMap.get(t);if(r){var n=this._map.getSource(r);n&&"function"==typeof n.setData&&n.setData(e)}}},{key:"_addLayers",value:function(t){var e=this._datasetRegistry.mapStyle,r=u(this._mapProvider,t,e,this._symbolRegistry,this._patternRegistry,this._pixelRatio);this._datasetSourceMap.set(t.id,r),this._maintainSymbolOrdering(t)}},{key:"_getFirstSymbolLayerId",value:function(){var t,e=this,r=this._map.getStyle();if(null==r||!r.layers)return null;var n=r.layers.find(function(t){return e._symbolLayerIds.has(t.id)});return null!==(t=null==n?void 0:n.id)&&void 0!==t?t:null}},{key:"_maintainSymbolOrdering",value:function(t){var e=this,r=(t=t.isSublayer?t.parent:t).layerIds.filter(function(t){return t&&e._map.getLayer(t)});r.forEach(function(t){var r;"symbol"===(null===(r=e._map.getLayer(t))||void 0===r?void 0:r.type)?e._symbolLayerIds.add(t):e._symbolLayerIds.delete(t)});var n=this._getFirstSymbolLayerId();n&&r.forEach(function(t){e._symbolLayerIds.has(t)||e._map.moveLayer(t,n)})}},{key:"_setLayerVisibility",value:function(t,e){this._map.getLayer(t)&&this._map.setLayoutProperty(t,"visibility",e)}},{key:"_applyFeatureFilter",value:function(t){var e=this;t.getLayersWithFilters().forEach(function(t){var r=t.layerIds,n=t.filter;r.forEach(function(t){e._map.getLayer(t)&&e._map.setFilter(t,n)})})}},{key:"_setLayerOpacity",value:function(t,e){var r=this._map.getLayer(t);if(r){var n={line:"line-opacity",symbol:"icon-opacity"}[r.type]||"fill-opacity";this._map.setPaintProperty(t,n,e)}}},{key:"_getLayersUsingSource",value:function(t){var e=this._map.getStyle();return null!=e&&e.layers?e.layers.filter(function(e){return e.source===t}).map(function(t){return t.id}):[]}}],n&&P(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o,i,a,s,c}(r(913).h)},416:function(t,e,r){r.d(e,{f:function(){return p}});var n=r(428);function o(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 i=function(t){var e,r=0,n=2166136261,i=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 o(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)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}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 a,u=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){s=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(s)throw a}}}}(t);try{for(i.s();!(e=i.n()).done;){var a=e.value.codePointAt(0);r=Math.imul(r,31)+a,n=Math.imul(n^a,16777619)}}catch(t){i.e(t)}finally{i.f()}return(r>>>0).toString(36)+(n>>>0).toString(36)};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 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}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,c(n.key),n)}}function c(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+""}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(l=function(){return!!t})()}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function y(t,e){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},y(t,e)}var p=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,r){return e=f(e),function(t,e){if(e&&("object"==a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,l()?Reflect.construct(e,r||[],f(t).constructor):e.apply(t,r))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&y(t,e)}(e,t),r=e,n=[{key:"_hiddenFeaturesIdExpression",get:function(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.hiddenFeaturesIdExpression:this.idProperty?["to-string",["get",this.idProperty]]:["to-string",["id"]]}},{key:"_hiddenFeaturesFilter",get:function(){var t,e=null===(t=this.hiddenFeatures)||void 0===t?void 0:t.filter(function(t){return-1!==t});return null!=e&&e.length?["!",["in",this._hiddenFeaturesIdExpression,["literal",e.map(String)]]]:null}},{key:"filter",get:function(){var t,e=["all"];null!==(t=this.parent)&&void 0!==t&&t.filter&&e.push(this.parent.filter),this._datasetDefinition.filter&&e.push(this._datasetDefinition.filter);var r=this._hiddenFeaturesFilter;return r&&e.push(r),1===e.length?null:e.length>2?e:e[1]}},{key:"leafLayerIds",get:function(){return[]}},{key:"layerIds",get:function(){return this.hasSublayers?this.sublayers.flatMap(function(t){return t.layerIds}).filter(Boolean):this.leafLayerIds}},{key:"getLayersWithValue",value:function(t){var e,r,n,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];if(!1===o||this[o]){var a=this.leafLayerIds;if(a.length){var s=this[t];i.push((e={layerIds:a},n=s,(r=c(r=t))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e))}}return this.hasSublayers&&this.sublayers.forEach(function(e){if(!1===o||e[o]){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=[],s=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(t){c=!0,o=t}finally{try{if(!s&&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 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}}(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.")}()}(e.getLayersWithValue(t),1)[0];r&&i.push(r)}}),i}},{key:"getLayersWithVisibility",value:function(){return this.getLayersWithValue("visibility")}},{key:"getLayersWithOpacity",value:function(){return this.getLayersWithValue("opacity")}},{key:"getLayersWithFilters",value:function(){return this.getLayersWithValue("filter","hasHiddenFeatures")}},{key:"sourceId",get:function(){if(this.isSublayer)return this.parent.sourceId;if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.sourceId;if(this.tiles){var t=Array.isArray(this.tiles)?this.tiles.join(","):this.tiles;return"tiles-".concat(i(t))}return this.geojson?"string"==typeof this.geojson?"geojson-".concat(i(this.geojson)):"geojson-".concat(this.id):"source-".concat(this.id)}}],n&&s(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(n.j)},247:function(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)}r.d(e,{o:function(){return o}});var o=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===n(t)){if(e&&t[e])return t[e];var r=Object.values(t)[0];return null!=r?r:null}return null}}}]);