@defra/interactive-map 0.0.54-alpha → 0.0.56-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 (472) hide show
  1. package/assets/templates/add-polygons.njk +1 -1
  2. package/assets/templates/add-symbols.njk +4 -4
  3. package/assets/templates/draw-tools.njk +7 -7
  4. package/assets/templates/marker-panel.njk +5 -5
  5. package/assets/templates/place-marker.njk +8 -8
  6. package/assets/templates/search-control.njk +1 -1
  7. package/assets/templates/select-feature.njk +7 -7
  8. package/assets/templates/style-switcher.njk +6 -6
  9. package/assets/templates/toggle-marker-label.njk +3 -3
  10. package/dist/esm/im-core.js +1 -1
  11. package/dist/esm/im-shell.js +1 -1
  12. package/dist/esm/index.js +1 -1
  13. package/dist/umd/im-core.js +1 -1
  14. package/dist/umd/im-core.js.LICENSE.txt +0 -30
  15. package/dist/umd/index.js +1 -1
  16. package/dist/umd/index.js.LICENSE.txt +0 -20
  17. package/docs/api/context.md +2 -0
  18. package/docs/api.md +20 -14
  19. package/docs/architecture/interactive-map.likec4 +4 -4
  20. package/docs/building-a-plugin.md +2 -2
  21. package/docs/examples/add-marker-with-panel.mdx +46 -44
  22. package/docs/examples/add-polygons.mdx +100 -98
  23. package/docs/examples/add-symbols.mdx +75 -73
  24. package/docs/examples/basic-map.mdx +16 -14
  25. package/docs/examples/button-map.mdx +16 -14
  26. package/docs/examples/draw-tools.mdx +119 -117
  27. package/docs/examples/place-marker.mdx +51 -49
  28. package/docs/examples/search-control.mdx +22 -20
  29. package/docs/examples/select-feature.mdx +107 -105
  30. package/docs/examples/style-switcher.mdx +47 -45
  31. package/docs/examples/toggle-marker-label.mdx +30 -28
  32. package/docs/getting-started.md +26 -24
  33. package/docs/plugins/datasets.md +11 -0
  34. package/docs/plugins/draw.md +18 -12
  35. package/docs/plugins/interact.md +33 -10
  36. package/docs/plugins/plugin-descriptor.md +1 -1
  37. package/docs/plugins/search.md +5 -5
  38. package/docusaurus.config.cjs +48 -3
  39. package/govuk-prototype-kit.config.json +6 -7
  40. package/package.json +22 -29
  41. package/plugins/datasets/dist/esm/im-datasets-esri-adapter.js +1 -1
  42. package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
  43. package/plugins/datasets/dist/esm/im-datasets-ol-adapter.js +1 -1
  44. package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
  45. package/plugins/datasets/dist/esm/index.js +1 -1
  46. package/plugins/datasets/dist/esm/layerAdapter.js +1 -1
  47. package/plugins/datasets/dist/esm/mapboxStyleLayerAdapter.js +1 -1
  48. package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
  49. package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
  50. package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
  51. package/plugins/datasets/dist/umd/index.js +1 -1
  52. package/plugins/datasets/src/adapters/esri/esriLayerAdapter.js +18 -16
  53. package/plugins/datasets/src/adapters/esri/esriLayerAdapter.test.js +2 -2
  54. package/plugins/datasets/src/adapters/esri/registry/esriDataset.js +2 -3
  55. package/plugins/datasets/src/adapters/esri/registry/esriDataset.test.js +1 -1
  56. package/plugins/datasets/src/adapters/loadLayerAdapter.js +2 -20
  57. package/plugins/datasets/src/adapters/loadLayerAdapter.test.js +9 -9
  58. package/plugins/datasets/src/adapters/mapboxStyleLayerAdapter.js +7 -7
  59. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +19 -19
  60. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +1 -1
  61. package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +1 -1
  62. package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.test.js +2 -2
  63. package/plugins/datasets/src/adapters/openlayers/layerBuilders.test.js +1 -1
  64. package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.js +21 -21
  65. package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.test.js +5 -5
  66. package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.js +2 -3
  67. package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.test.js +2 -2
  68. package/plugins/datasets/src/api/getOpacity.js +1 -2
  69. package/plugins/datasets/src/api/getOpacity.test.js +9 -12
  70. package/plugins/datasets/src/api/getStyle.js +1 -2
  71. package/plugins/datasets/src/api/getStyle.test.js +5 -8
  72. package/plugins/datasets/src/api/removeDataset.js +2 -4
  73. package/plugins/datasets/src/api/removeDataset.test.js +5 -10
  74. package/plugins/datasets/src/api/setData.js +2 -4
  75. package/plugins/datasets/src/api/setData.test.js +6 -14
  76. package/plugins/datasets/src/api/setFeatureVisibility.js +1 -2
  77. package/plugins/datasets/src/api/setFeatureVisibility.test.js +8 -11
  78. package/plugins/datasets/src/components/LayersMenu/LayersMenu.jsx +1 -0
  79. package/plugins/datasets/src/components/LayersMenu/LayersMenuCheckbox.jsx +1 -3
  80. package/plugins/datasets/src/components/LayersMenu/LayersMenuCheckbox.test.jsx +13 -18
  81. package/plugins/datasets/src/index.js +2 -2
  82. package/plugins/datasets/src/index.test.js +8 -1
  83. package/plugins/datasets/src/initialise/DatasetsInit.jsx +48 -26
  84. package/plugins/datasets/src/initialise/DatasetsInit.test.jsx +160 -89
  85. package/plugins/datasets/src/initialise/initialiseDatasets.js +2 -3
  86. package/plugins/datasets/src/initialise/initialiseDatasets.test.js +23 -10
  87. package/plugins/datasets/src/manifest.js +53 -44
  88. package/plugins/datasets/src/manifest.test.js +36 -4
  89. package/plugins/datasets/src/reducers/pluginState.js +5 -5
  90. package/plugins/datasets/src/reducers/pluginState.test.js +21 -20
  91. package/plugins/datasets/src/registry/__mocks__/datasetRegistry.js +7 -6
  92. package/plugins/datasets/src/registry/createDataset.js +2 -2
  93. package/plugins/datasets/src/registry/dataset.js +9 -10
  94. package/plugins/datasets/src/registry/dataset.test.js +63 -64
  95. package/plugins/datasets/src/registry/datasetRegistry.js +39 -10
  96. package/plugins/datasets/src/registry/datasetRegistry.test.js +83 -1
  97. package/plugins/datasets/src/registry/globalDataset.js +9 -17
  98. package/plugins/datasets/src/registry/isVisibleWhen.js +9 -17
  99. package/plugins/datasets/src/registry/isVisibleWhen.test.js +27 -20
  100. package/plugins/datasets/src/registry/mapboxStyleDataset.test.js +26 -27
  101. package/plugins/datasets/src/utils/hasLayersMenu.js +13 -0
  102. package/plugins/datasets/src/utils/hasLayersMenu.test.js +25 -0
  103. package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
  104. package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
  105. package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
  106. package/plugins/draw/dist/esm/index.js +1 -1
  107. package/plugins/draw/dist/esm/liveDrawChecks.js +1 -1
  108. package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
  109. package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
  110. package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
  111. package/plugins/draw/dist/umd/index.js +1 -1
  112. package/plugins/draw/src/DrawInit.jsx +47 -26
  113. package/plugins/draw/src/DrawInit.test.jsx +90 -2
  114. package/plugins/draw/src/adapters/maplibre/styles.js +3 -2
  115. package/plugins/draw/src/adapters/maplibre/styles.test.js +3 -3
  116. package/plugins/draw/src/adapters/openlayers/core/styles.test.js +1 -1
  117. package/plugins/draw/src/adapters/openlayers/point/pointSymbolImages.test.js +1 -1
  118. package/plugins/draw/src/manifest.js +3 -2
  119. package/plugins/draw/src/manifest.test.js +13 -1
  120. package/plugins/draw/src/utils/needsDrawTarget.js +22 -0
  121. package/plugins/draw/src/utils/needsDrawTarget.test.js +42 -0
  122. package/plugins/draw-es/dist/esm/im-draw-es-plugin.js +1 -0
  123. package/plugins/draw-es/dist/esm/index.js +1 -0
  124. package/plugins/{beta/draw-es → draw-es}/src/DrawInit.jsx +1 -1
  125. package/plugins/{beta/draw-es → draw-es}/src/events.test.js +1 -1
  126. package/plugins/{beta/draw-es → draw-es}/src/graphic.js +1 -1
  127. package/plugins/frame/dist/esm/im-frame-plugin.js +1 -0
  128. package/plugins/frame/dist/esm/index.js +1 -0
  129. package/plugins/frame/dist/umd/im-frame-plugin.js +1 -0
  130. package/plugins/frame/dist/umd/index.js +2 -0
  131. package/plugins/{beta/frame → frame}/package.json +2 -2
  132. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  133. package/plugins/interact/dist/esm/index.js +1 -1
  134. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  135. package/plugins/interact/dist/umd/index.js +1 -1
  136. package/plugins/interact/src/InteractInit.jsx +3 -3
  137. package/plugins/interact/src/api/enable.test.js +13 -0
  138. package/plugins/interact/src/defaults.js +1 -0
  139. package/plugins/interact/src/hooks/useCrossHairVisibility.js +27 -17
  140. package/plugins/interact/src/hooks/useCrossHairVisibility.test.js +72 -7
  141. package/plugins/interact/src/manifest.js +4 -4
  142. package/plugins/interact/src/manifest.test.js +29 -0
  143. package/plugins/interact/src/reducer.js +7 -2
  144. package/plugins/interact/src/reducer.test.js +12 -2
  145. package/plugins/interact/src/utils/needsTarget.js +20 -0
  146. package/plugins/interact/src/utils/needsTarget.test.js +36 -0
  147. package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
  148. package/plugins/map-key/dist/esm/index.js +1 -1
  149. package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
  150. package/plugins/map-key/dist/umd/index.js +1 -1
  151. package/plugins/map-key/src/components/Key/KeySvgSymbol.jsx +4 -0
  152. package/plugins/map-key/src/components/Key/MapKey.jsx +15 -15
  153. package/plugins/map-key/src/components/Key/MapKey.test.jsx +29 -15
  154. package/plugins/map-key/src/initialise/MapKeyInit.jsx +5 -8
  155. package/plugins/map-key/src/initialise/MapKeyInit.test.jsx +9 -7
  156. package/plugins/map-key/src/manifest.test.js +0 -1
  157. package/plugins/map-key/src/reducers/mergeKeyGroupItems.js +14 -33
  158. package/plugins/map-key/src/reducers/mergeKeyGroupItems.test.js +34 -50
  159. package/plugins/map-key/src/reducers/pluginState.js +6 -1
  160. package/plugins/map-key/src/reducers/pluginState.test.js +13 -4
  161. package/plugins/map-styles/dist/esm/im-map-styles-plugin.js +1 -0
  162. package/plugins/map-styles/dist/esm/index.js +1 -0
  163. package/plugins/map-styles/dist/umd/im-map-styles-plugin.js +1 -0
  164. package/plugins/map-styles/dist/umd/index.js +2 -0
  165. package/plugins/{beta/map-styles → map-styles}/src/MapStyles.jsx +2 -2
  166. package/plugins/{beta/map-styles → map-styles}/src/MapStylesInit.jsx +1 -1
  167. package/plugins/menu/dist/esm/im-menu-plugin.js +1 -1
  168. package/plugins/menu/dist/esm/index.js +1 -1
  169. package/plugins/menu/dist/umd/im-menu-plugin.js +1 -1
  170. package/plugins/menu/dist/umd/index.js +1 -1
  171. package/plugins/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -0
  172. package/plugins/scale-bar/dist/esm/index.js +1 -0
  173. package/plugins/scale-bar/dist/umd/im-scale-bar-plugin.js +1 -0
  174. package/plugins/scale-bar/dist/umd/index.js +2 -0
  175. package/plugins/{beta/scale-bar → scale-bar}/package.json +2 -2
  176. package/plugins/search/dist/esm/im-search-plugin.js +1 -1
  177. package/plugins/search/dist/esm/index.js +1 -1
  178. package/plugins/search/dist/umd/im-search-plugin.js +1 -1
  179. package/plugins/search/dist/umd/index.js +1 -1
  180. package/plugins/search/src/components/Suggestions/Suggestions.jsx +3 -1
  181. package/plugins/search/src/components/Suggestions/Suggestions.test.jsx +11 -0
  182. package/plugins/search/src/utils/markedToElements.jsx +25 -0
  183. package/plugins/search/src/utils/markedToElements.test.jsx +49 -0
  184. package/plugins/search/src/utils/parseOsNamesResults.js +6 -4
  185. package/plugins/search/src/utils/parseOsNamesResults.test.js +18 -0
  186. package/plugins/use-location/dist/esm/im-use-location-plugin.js +1 -0
  187. package/plugins/use-location/dist/esm/index.js +1 -0
  188. package/plugins/use-location/dist/umd/im-use-location-plugin.js +1 -0
  189. package/plugins/use-location/dist/umd/index.js +2 -0
  190. package/providers/esri/dist/esm/im-esri-provider.js +1 -0
  191. package/providers/esri/dist/esm/index.js +1 -0
  192. package/providers/{beta/esri → esri}/src/esriProvider.js +1 -1
  193. package/providers/{beta/esri → esri}/src/mapEvents.js +2 -2
  194. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  195. package/providers/maplibre/dist/esm/index.js +1 -1
  196. package/providers/maplibre/dist/umd/im-maplibre-framework.js +1 -1
  197. package/providers/maplibre/dist/umd/im-maplibre-framework.js.LICENSE.txt +3 -3
  198. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  199. package/providers/maplibre/dist/umd/im-maplibre-worker.js +2 -0
  200. package/providers/maplibre/dist/umd/im-maplibre-worker.js.LICENSE.txt +4 -0
  201. package/providers/maplibre/dist/umd/index.js +1 -1
  202. package/providers/maplibre/src/index.js +41 -12
  203. package/providers/maplibre/src/index.test.js +43 -12
  204. package/providers/maplibre/src/utils/detectModuleWorker.js +25 -0
  205. package/providers/maplibre/src/utils/detectModuleWorker.test.js +40 -0
  206. package/providers/maplibre/src/utils/spatial.js +22 -12
  207. package/providers/maplibre/src/utils/spatial.test.js +6 -6
  208. package/providers/maplibre/src/utils/workerUrl.js +15 -0
  209. package/providers/maplibre/src/utils/workerUrl.test.js +14 -0
  210. package/providers/open-names/dist/esm/im-reverse-geocode.js +1 -0
  211. package/providers/open-names/dist/esm/index.js +1 -0
  212. package/providers/open-names/dist/umd/im-reverse-geocode.js +2 -0
  213. package/providers/open-names/dist/umd/index.js +2 -0
  214. package/providers/openlayers/dist/esm/im-openlayers-provider.js +1 -0
  215. package/providers/openlayers/dist/esm/index.js +1 -0
  216. package/providers/openlayers/dist/umd/im-openlayers-provider.js +2 -0
  217. package/providers/openlayers/dist/umd/index.js +2 -0
  218. package/providers/openlayers/src/index.js +60 -0
  219. package/providers/openlayers/src/index.test.js +47 -0
  220. package/providers/{beta/openlayers → openlayers}/src/mapEvents.js +2 -2
  221. package/providers/{beta/openlayers → openlayers}/src/mapEvents.test.js +2 -2
  222. package/providers/{beta/openlayers → openlayers}/src/openlayersProvider.js +3 -3
  223. package/providers/{beta/openlayers → openlayers}/src/utils/highlightFeatures.js +1 -1
  224. package/providers/{beta/openlayers → openlayers}/src/utils/patternImages.js +1 -1
  225. package/providers/{beta/openlayers → openlayers}/src/utils/symbolImages.js +1 -1
  226. package/rollup.esm.mjs +79 -46
  227. package/sonar-project.properties +1 -1
  228. package/src/App/App.jsx +4 -1
  229. package/src/App/App.test.jsx +6 -0
  230. package/src/App/renderer/PluginInits.jsx +8 -7
  231. package/src/App/renderer/PluginInits.test.jsx +20 -5
  232. package/src/App/renderer/SlotItemsProvider.jsx +33 -0
  233. package/src/App/renderer/SlotItemsProvider.test.jsx +59 -0
  234. package/src/App/renderer/SlotRenderer.jsx +3 -14
  235. package/src/App/renderer/SlotRenderer.test.jsx +11 -44
  236. package/src/App/renderer/mapButtons.js +22 -11
  237. package/src/App/renderer/mapButtons.test.js +23 -1
  238. package/src/App/renderer/mapControls.js +6 -8
  239. package/src/App/renderer/mapControls.test.js +10 -0
  240. package/src/App/renderer/mapPanels.js +16 -19
  241. package/src/App/renderer/mapPanels.test.js +37 -9
  242. package/src/App/renderer/pluginWrapper.js +10 -8
  243. package/src/App/renderer/pluginWrapper.test.js +23 -9
  244. package/src/App/renderer/slotAggregator.js +18 -5
  245. package/src/App/renderer/slotAggregator.test.js +68 -25
  246. package/src/App/renderer/slotHelpers.js +13 -0
  247. package/src/App/renderer/slotHelpers.test.js +16 -1
  248. package/src/App/store/AppProvider.jsx +19 -1
  249. package/src/App/store/AppProvider.test.jsx +41 -0
  250. package/src/App/store/appActionsMap.js +10 -1
  251. package/src/App/store/appActionsMap.test.js +21 -0
  252. package/src/App/store/appDispatchMiddleware.js +29 -17
  253. package/src/App/store/appDispatchMiddleware.test.js +31 -0
  254. package/src/InteractiveMap/InteractiveMap.js +2 -1
  255. package/src/InteractiveMap/InteractiveMap.test.js +9 -2
  256. package/src/InteractiveMap/domStateManager.js +21 -1
  257. package/src/InteractiveMap/domStateManager.test.js +48 -1
  258. package/src/InteractiveMap/parseDataProperties.js +4 -4
  259. package/src/InteractiveMap/parseDataProperties.test.js +62 -6
  260. package/src/InteractiveMap/polyfills.js +4 -3
  261. package/src/InteractiveMap/polyfills.test.js +12 -0
  262. package/src/config/events.js +4 -2
  263. package/src/scss/tools/_govuk-content.scss +4 -3
  264. package/src/types.js +3 -5
  265. package/webpack.dev.mjs +11 -3
  266. package/webpack.prod.mjs +11 -4
  267. package/webpack.umd.mjs +34 -14
  268. package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +0 -1
  269. package/plugins/beta/draw-es/dist/esm/index.js +0 -1
  270. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +0 -1
  271. package/plugins/beta/draw-ml/dist/esm/index.js +0 -1
  272. package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +0 -1
  273. package/plugins/beta/draw-ml/dist/umd/index.js +0 -2
  274. package/plugins/beta/draw-ml/src/DrawInit.jsx +0 -85
  275. package/plugins/beta/draw-ml/src/api/addFeature.js +0 -27
  276. package/plugins/beta/draw-ml/src/api/deleteFeature.js +0 -13
  277. package/plugins/beta/draw-ml/src/api/editFeature.js +0 -75
  278. package/plugins/beta/draw-ml/src/api/merge.js +0 -9
  279. package/plugins/beta/draw-ml/src/api/newLine.js +0 -68
  280. package/plugins/beta/draw-ml/src/api/newPolygon.js +0 -68
  281. package/plugins/beta/draw-ml/src/api/split.js +0 -81
  282. package/plugins/beta/draw-ml/src/defaults.js +0 -17
  283. package/plugins/beta/draw-ml/src/draw.scss +0 -26
  284. package/plugins/beta/draw-ml/src/events.js +0 -185
  285. package/plugins/beta/draw-ml/src/index.js +0 -13
  286. package/plugins/beta/draw-ml/src/manifest.js +0 -110
  287. package/plugins/beta/draw-ml/src/mapboxDraw.js +0 -143
  288. package/plugins/beta/draw-ml/src/mapboxSnap.js +0 -321
  289. package/plugins/beta/draw-ml/src/modes/createDrawMode.js +0 -552
  290. package/plugins/beta/draw-ml/src/modes/disabledMode.js +0 -23
  291. package/plugins/beta/draw-ml/src/modes/drawLineMode.js +0 -18
  292. package/plugins/beta/draw-ml/src/modes/drawPolygonMode.js +0 -16
  293. package/plugins/beta/draw-ml/src/modes/editVertex/geometryHelpers.js +0 -135
  294. package/plugins/beta/draw-ml/src/modes/editVertex/helpers.js +0 -2
  295. package/plugins/beta/draw-ml/src/modes/editVertex/touchHandlers.js +0 -142
  296. package/plugins/beta/draw-ml/src/modes/editVertex/undoHandlers.js +0 -133
  297. package/plugins/beta/draw-ml/src/modes/editVertex/vertexOperations.js +0 -142
  298. package/plugins/beta/draw-ml/src/modes/editVertex/vertexQueries.js +0 -121
  299. package/plugins/beta/draw-ml/src/modes/editVertexMode.js +0 -495
  300. package/plugins/beta/draw-ml/src/reducer.js +0 -90
  301. package/plugins/beta/draw-ml/src/styles.js +0 -190
  302. package/plugins/beta/draw-ml/src/undoStack.js +0 -50
  303. package/plugins/beta/draw-ml/src/utils/debounce.js +0 -16
  304. package/plugins/beta/draw-ml/src/utils/flattenStyleProperties.js +0 -49
  305. package/plugins/beta/draw-ml/src/utils/snapHelpers.js +0 -200
  306. package/plugins/beta/draw-ml/src/utils/spatial.js +0 -258
  307. package/plugins/beta/draw-ol/dist/css/index.css +0 -1
  308. package/plugins/beta/draw-ol/dist/esm/DrawMode.js +0 -1
  309. package/plugins/beta/draw-ol/dist/esm/EditMode.js +0 -1
  310. package/plugins/beta/draw-ol/dist/esm/geometryHelpers.js +0 -1
  311. package/plugins/beta/draw-ol/dist/esm/im-draw-ol-plugin.js +0 -1
  312. package/plugins/beta/draw-ol/dist/esm/index.js +0 -1
  313. package/plugins/beta/draw-ol/src/DrawInit.jsx +0 -65
  314. package/plugins/beta/draw-ol/src/api/addFeature.js +0 -29
  315. package/plugins/beta/draw-ol/src/api/deleteFeature.js +0 -11
  316. package/plugins/beta/draw-ol/src/api/editFeature.js +0 -50
  317. package/plugins/beta/draw-ol/src/api/newLine.js +0 -44
  318. package/plugins/beta/draw-ol/src/api/newPolygon.js +0 -44
  319. package/plugins/beta/draw-ol/src/core/OLDrawManager.js +0 -153
  320. package/plugins/beta/draw-ol/src/core/featureStore.js +0 -65
  321. package/plugins/beta/draw-ol/src/core/styles.js +0 -98
  322. package/plugins/beta/draw-ol/src/core/undoStack.js +0 -31
  323. package/plugins/beta/draw-ol/src/defaults.js +0 -16
  324. package/plugins/beta/draw-ol/src/draw/DrawMode.js +0 -121
  325. package/plugins/beta/draw-ol/src/draw/drawInput.js +0 -243
  326. package/plugins/beta/draw-ol/src/draw.scss +0 -17
  327. package/plugins/beta/draw-ol/src/edit/EditMode.js +0 -424
  328. package/plugins/beta/draw-ol/src/edit/keyboardHandler.js +0 -229
  329. package/plugins/beta/draw-ol/src/edit/midpointLayer.js +0 -57
  330. package/plugins/beta/draw-ol/src/edit/touchHandler.js +0 -171
  331. package/plugins/beta/draw-ol/src/edit/undoOps.js +0 -95
  332. package/plugins/beta/draw-ol/src/edit/vertexHitTest.js +0 -72
  333. package/plugins/beta/draw-ol/src/edit/vertexLayer.js +0 -49
  334. package/plugins/beta/draw-ol/src/edit/vertexOps.js +0 -99
  335. package/plugins/beta/draw-ol/src/events.js +0 -114
  336. package/plugins/beta/draw-ol/src/index.js +0 -12
  337. package/plugins/beta/draw-ol/src/manifest.js +0 -125
  338. package/plugins/beta/draw-ol/src/olDraw.js +0 -38
  339. package/plugins/beta/draw-ol/src/reducer.js +0 -41
  340. package/plugins/beta/draw-ol/src/snap/snapEngine.js +0 -153
  341. package/plugins/beta/draw-ol/src/snap/snapGeometry.js +0 -177
  342. package/plugins/beta/draw-ol/src/snap/snapIndicator.js +0 -81
  343. package/plugins/beta/draw-ol/src/snap/snapInteraction.js +0 -57
  344. package/plugins/beta/draw-ol/src/snap/snapManager.js +0 -99
  345. package/plugins/beta/draw-ol/src/utils/flattenStyleProperties.js +0 -47
  346. package/plugins/beta/draw-ol/src/utils/geometryHelpers.js +0 -103
  347. package/plugins/beta/draw-ol/src/utils/olCoords.js +0 -35
  348. package/plugins/beta/draw-ol/src/utils/resolveColors.js +0 -39
  349. package/plugins/beta/draw-ol/src/utils/spatial.js +0 -24
  350. package/plugins/beta/draw-ol/src/utils/touchTarget.js +0 -61
  351. package/plugins/beta/frame/dist/esm/im-frame-plugin.js +0 -1
  352. package/plugins/beta/frame/dist/esm/index.js +0 -1
  353. package/plugins/beta/frame/dist/umd/im-frame-plugin.js +0 -1
  354. package/plugins/beta/frame/dist/umd/index.js +0 -2
  355. package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +0 -1
  356. package/plugins/beta/map-styles/dist/esm/index.js +0 -1
  357. package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +0 -1
  358. package/plugins/beta/map-styles/dist/umd/index.js +0 -2
  359. package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +0 -1
  360. package/plugins/beta/scale-bar/dist/esm/index.js +0 -1
  361. package/plugins/beta/scale-bar/dist/umd/im-scale-bar-plugin.js +0 -1
  362. package/plugins/beta/scale-bar/dist/umd/index.js +0 -2
  363. package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +0 -1
  364. package/plugins/beta/use-location/dist/esm/index.js +0 -1
  365. package/plugins/beta/use-location/dist/umd/im-use-location-plugin.js +0 -1
  366. package/plugins/beta/use-location/dist/umd/index.js +0 -2
  367. package/plugins/map-key/src/registry/getDatasetRegistry.js +0 -6
  368. package/plugins/map-key/src/registry/getDatasetRegistry.test.js +0 -23
  369. package/plugins/map-key/src/registry/index.js +0 -1
  370. package/plugins/map-key/src/registry/index.test.js +0 -7
  371. package/providers/beta/esri/dist/esm/im-esri-provider.js +0 -1
  372. package/providers/beta/esri/dist/esm/index.js +0 -1
  373. package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +0 -1
  374. package/providers/beta/open-names/dist/esm/index.js +0 -1
  375. package/providers/beta/open-names/dist/umd/im-reverse-geocode.js +0 -2
  376. package/providers/beta/open-names/dist/umd/index.js +0 -2
  377. package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +0 -1
  378. package/providers/beta/openlayers/dist/esm/index.js +0 -1
  379. package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +0 -2
  380. package/providers/beta/openlayers/dist/umd/index.js +0 -2
  381. package/providers/beta/openlayers/dist/umd/index.js.LICENSE.txt +0 -1
  382. package/providers/beta/openlayers/src/index.js +0 -37
  383. /package/plugins/{beta/draw-es → draw-es}/src/api/addFeature.js +0 -0
  384. /package/plugins/{beta/draw-es → draw-es}/src/api/deleteFeature.js +0 -0
  385. /package/plugins/{beta/draw-es → draw-es}/src/api/editFeature.js +0 -0
  386. /package/plugins/{beta/draw-es → draw-es}/src/api/newPolygon.js +0 -0
  387. /package/plugins/{beta/draw-es → draw-es}/src/api/removeSafeZone.js +0 -0
  388. /package/plugins/{beta/draw-es → draw-es}/src/events.js +0 -0
  389. /package/plugins/{beta/draw-es → draw-es}/src/index.js +0 -0
  390. /package/plugins/{beta/draw-es → draw-es}/src/manifest.js +0 -0
  391. /package/plugins/{beta/draw-es → draw-es}/src/reducer.js +0 -0
  392. /package/plugins/{beta/draw-es → draw-es}/src/sketchViewModel.js +0 -0
  393. /package/plugins/{beta/frame → frame}/dist/css/index.css +0 -0
  394. /package/plugins/{beta/draw-ml → frame}/dist/umd/index.js.LICENSE.txt +0 -0
  395. /package/plugins/{beta/frame → frame}/src/Frame.jsx +0 -0
  396. /package/plugins/{beta/frame → frame}/src/FrameInit.jsx +0 -0
  397. /package/plugins/{beta/frame → frame}/src/api/addFrame.js +0 -0
  398. /package/plugins/{beta/frame → frame}/src/api/editFeature.js +0 -0
  399. /package/plugins/{beta/frame → frame}/src/config.js +0 -0
  400. /package/plugins/{beta/frame → frame}/src/frame.scss +0 -0
  401. /package/plugins/{beta/frame → frame}/src/index.js +0 -0
  402. /package/plugins/{beta/frame → frame}/src/manifest.js +0 -0
  403. /package/plugins/{beta/frame → frame}/src/reducer.js +0 -0
  404. /package/plugins/{beta/frame → frame}/src/utils.js +0 -0
  405. /package/plugins/{beta/map-styles → map-styles}/dist/css/index.css +0 -0
  406. /package/plugins/{beta/frame → map-styles}/dist/umd/index.js.LICENSE.txt +0 -0
  407. /package/plugins/{beta/map-styles → map-styles}/src/config.js +0 -0
  408. /package/plugins/{beta/map-styles → map-styles}/src/index.js +0 -0
  409. /package/plugins/{beta/map-styles → map-styles}/src/manifest.js +0 -0
  410. /package/plugins/{beta/map-styles → map-styles}/src/mapStyles.scss +0 -0
  411. /package/plugins/{beta/scale-bar → scale-bar}/dist/css/index.css +0 -0
  412. /package/plugins/{beta/map-styles → scale-bar}/dist/umd/index.js.LICENSE.txt +0 -0
  413. /package/plugins/{beta/scale-bar → scale-bar}/src/ScaleBar.jsx +0 -0
  414. /package/plugins/{beta/scale-bar → scale-bar}/src/ScaleBar.test.jsx +0 -0
  415. /package/plugins/{beta/scale-bar → scale-bar}/src/index.js +0 -0
  416. /package/plugins/{beta/scale-bar → scale-bar}/src/index.test.js +0 -0
  417. /package/plugins/{beta/scale-bar → scale-bar}/src/manifest.js +0 -0
  418. /package/plugins/{beta/scale-bar → scale-bar}/src/scaleBar.scss +0 -0
  419. /package/plugins/{beta/scale-bar → scale-bar}/src/utils.js +0 -0
  420. /package/plugins/{beta/scale-bar → scale-bar}/src/utils.test.js +0 -0
  421. /package/plugins/{beta/scale-bar → use-location}/dist/umd/index.js.LICENSE.txt +0 -0
  422. /package/plugins/{beta/use-location → use-location}/src/UseLocation.jsx +0 -0
  423. /package/plugins/{beta/use-location → use-location}/src/UseLocationInit.jsx +0 -0
  424. /package/plugins/{beta/use-location → use-location}/src/defaults.js +0 -0
  425. /package/plugins/{beta/use-location → use-location}/src/events.js +0 -0
  426. /package/plugins/{beta/use-location → use-location}/src/index.js +0 -0
  427. /package/plugins/{beta/use-location → use-location}/src/manifest.js +0 -0
  428. /package/plugins/{beta/use-location → use-location}/src/reducer.js +0 -0
  429. /package/providers/{beta/esri → esri}/dist/css/index.css +0 -0
  430. /package/providers/{beta/esri → esri}/src/appEvents.js +0 -0
  431. /package/providers/{beta/esri → esri}/src/defaults.js +0 -0
  432. /package/providers/{beta/esri → esri}/src/esriProvider.scss +0 -0
  433. /package/providers/{beta/esri → esri}/src/index.js +0 -0
  434. /package/providers/{beta/esri → esri}/src/utils/coords.js +0 -0
  435. /package/providers/{beta/esri → esri}/src/utils/coords.test.js +0 -0
  436. /package/providers/{beta/esri → esri}/src/utils/detectWebGL.js +0 -0
  437. /package/providers/{beta/esri → esri}/src/utils/esriFixes.js +0 -0
  438. /package/providers/{beta/esri → esri}/src/utils/query.js +0 -0
  439. /package/providers/{beta/esri → esri}/src/utils/spatial.js +0 -0
  440. /package/providers/{beta/esri → esri}/src/utils/spatial.test.js +0 -0
  441. /package/providers/{beta/open-names → open-names}/dist/umd/im-reverse-geocode.js.LICENSE.txt +0 -0
  442. /package/{plugins/beta/use-location → providers/open-names}/dist/umd/index.js.LICENSE.txt +0 -0
  443. /package/providers/{beta/open-names → open-names}/src/index.js +0 -0
  444. /package/providers/{beta/open-names → open-names}/src/reverseGeocode.js +0 -0
  445. /package/providers/{beta/open-names → open-names}/src/utils/mapToLocationModel.js +0 -0
  446. /package/providers/{beta/open-names → open-names}/src/utils/mapToLocationModel.test.js +0 -0
  447. /package/providers/{beta/openlayers → openlayers}/dist/umd/im-openlayers-provider.js.LICENSE.txt +0 -0
  448. /package/providers/{beta/open-names → openlayers}/dist/umd/index.js.LICENSE.txt +0 -0
  449. /package/providers/{beta/openlayers → openlayers}/src/appEvents.js +0 -0
  450. /package/providers/{beta/openlayers → openlayers}/src/appEvents.test.js +0 -0
  451. /package/providers/{beta/openlayers → openlayers}/src/defaults.js +0 -0
  452. /package/providers/{beta/openlayers → openlayers}/src/openlayersProvider.test.js +0 -0
  453. /package/providers/{beta/openlayers → openlayers}/src/utils/bngProjection.js +0 -0
  454. /package/providers/{beta/openlayers → openlayers}/src/utils/filterEvaluator.js +0 -0
  455. /package/providers/{beta/openlayers → openlayers}/src/utils/filterEvaluator.test.js +0 -0
  456. /package/providers/{beta/openlayers → openlayers}/src/utils/highlightFeatures.test.js +0 -0
  457. /package/providers/{beta/openlayers → openlayers}/src/utils/hoverCursor.js +0 -0
  458. /package/providers/{beta/openlayers → openlayers}/src/utils/hoverCursor.test.js +0 -0
  459. /package/providers/{beta/openlayers → openlayers}/src/utils/openLayersFixes.js +0 -0
  460. /package/providers/{beta/openlayers → openlayers}/src/utils/openLayersFixes.test.js +0 -0
  461. /package/providers/{beta/openlayers → openlayers}/src/utils/patternImages.test.js +0 -0
  462. /package/providers/{beta/openlayers → openlayers}/src/utils/queryFeatures.js +0 -0
  463. /package/providers/{beta/openlayers → openlayers}/src/utils/queryFeatures.test.js +0 -0
  464. /package/providers/{beta/openlayers → openlayers}/src/utils/spatial.js +0 -0
  465. /package/providers/{beta/openlayers → openlayers}/src/utils/spatial.test.js +0 -0
  466. /package/providers/{beta/openlayers → openlayers}/src/utils/symbolImages.test.js +0 -0
  467. /package/providers/{beta/openlayers → openlayers}/src/utils/tileLayers.js +0 -0
  468. /package/providers/{beta/openlayers → openlayers}/src/utils/tileLayers.test.js +0 -0
  469. /package/providers/{beta/openlayers → openlayers}/src/utils/vtTileFragments.js +0 -0
  470. /package/providers/{beta/openlayers → openlayers}/src/utils/vtTileFragments.test.js +0 -0
  471. /package/providers/{beta/openlayers → openlayers}/src/utils/zoom.js +0 -0
  472. /package/providers/{beta/openlayers → openlayers}/src/utils/zoom.test.js +0 -0
@@ -1,61 +0,0 @@
1
- /**
2
- * SVG offset vertex target — shown below the finger in touch edit mode
3
- * so the user can accurately reposition a vertex without finger occlusion.
4
- * This module handles DOM management only; drag logic lives in touchHandler.js.
5
- *
6
- * The SVG uses CSS custom properties so colors update when the map style changes:
7
- * --draw-halo outer ring (black on light, white on dark)
8
- * --draw-bg inner background (white on light, near-black on dark)
9
- * --draw-primary arrow icons and centre dot (blue on light, white on dark)
10
- */
11
-
12
- const SVG_HTML = `
13
- <svg width='48' height='48' viewBox='0 0 48 48' fill-rule='evenodd'
14
- style='display:none;position:absolute;top:0;left:0;margin:24px 0 0 -24px;cursor:grab'
15
- class='im-draw-touch-target' data-im-draw-touch-target>
16
- <circle cx='24' cy='24' r='24' fill='var(--draw-halo, #000)'/>
17
- <path d="M37.543 25H34a1 1 0 1 1 0-2h3.629l-.836-.837a1 1 0 0 1 1.414-1.414l2.5 2.501A1 1 0 0 1 41 24a1 1 0 0 1-.487.858l-2.306 2.306a1 1 0 0 1-1.414-1.414l.75-.75zM23 10.414l-.793.793a1 1 0 0 1-1.414-1.414l2.5-2.5C23.481 7.105 23.734 7 24 7s.519.105.707.293l2.5 2.5a1 1 0 0 1-1.414 1.414L25 10.414V14a1 1 0 1 1-2 0v-3.586zM7 24a1 1 0 0 1 .293-.75l2.5-2.501a1 1 0 0 1 1.414 1.414l-.836.837H14a1 1 0 1 1 0 2h-3.543l.75.75a1 1 0 0 1-1.414 1.414l-2.306-2.306A1 1 0 0 1 7 24zm16.293 16.707l-2.5-2.5a1 1 0 0 1 1.414-1.414l.793.793V34a1 1 0 1 1 2 0v3.586l.793-.793a1 1 0 0 1 1.414 1.414l-2.5 2.5c-.188.188-.441.293-.707.293s-.519-.105-.707-.293zM24 20c2.208 0 4 1.792 4 4s-1.792 4-4 4-4-1.792-4-4 1.792-4 4-4z" fill='var(--draw-bg, #fff)'/>
18
- </svg>
19
- `
20
-
21
- export const createTouchTarget = (container) => {
22
- let el = container.querySelector('[data-im-draw-touch-target]')
23
- if (!el) {
24
- container.insertAdjacentHTML('beforeend', SVG_HTML)
25
- el = container.querySelector('[data-im-draw-touch-target]')
26
- }
27
- return el
28
- }
29
-
30
- export const applyTouchTargetColors = (el, colors) => {
31
- if (!el) {
32
- return
33
- }
34
- el.style.setProperty('--draw-halo', colors.editActive)
35
- el.style.setProperty('--draw-bg', colors.editHalo)
36
- el.style.setProperty('--draw-primary', colors.editVertex)
37
- }
38
-
39
- export const showTouchTarget = (el, pixel) => {
40
- if (!pixel || !el) {
41
- return
42
- }
43
- el.style.left = `${pixel.x}px`
44
- el.style.top = `${pixel.y}px`
45
- el.style.display = 'block'
46
- }
47
-
48
- export const hideTouchTarget = (el) => {
49
- if (el) {
50
- el.style.display = 'none'
51
- }
52
- }
53
-
54
- /** True when the event target is part of the SVG touch target element. */
55
- export const isOnTouchTarget = (el) => {
56
- if (!el) {
57
- return false
58
- }
59
- const parent = el.parentNode
60
- return (parent instanceof globalThis.SVGElement) || (parent?.ownerSVGElement != null)
61
- }
@@ -1 +0,0 @@
1
- import{useEffect as e,useRef as t,useState as r}from"preact/compat";import{jsxs as n,Fragment as o,jsx as a}from"preact/jsx-runtime";import i from"@babel/runtime/helpers/defineProperty";function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function l(e){var{frameEl:t,viewportEl:r,mapProvider:n,featureId:o,scale:a}=e,i=t.getBoundingClientRect(),c=r.getBoundingClientRect(),p={x:(i.left-c.left)/a,y:(i.top-c.top)/a},l={x:(i.right-c.left)/a,y:(i.top-c.top)/a},f={x:(i.right-c.left)/a,y:(i.bottom-c.top)/a},u={x:(i.left-c.left)/a,y:(i.bottom-c.top)/a},s={type:"Feature",geometry:{type:"Polygon",coordinates:[[n.screenToMap(p),n.screenToMap(l),n.screenToMap(f),n.screenToMap(u),n.screenToMap(p)]]},properties:{}};return o&&(s.id=o),s}function f(e){var t;if(null==e||null===(t=e.geometry)||void 0===t||null===(t=t.coordinates)||void 0===t||!t[0])return null;var r=e.geometry.coordinates[0],n=1/0,o=1/0,a=-1/0,i=-1/0;return r.forEach(e=>{var[t,r]=e;t<n&&(n=t),t>a&&(a=t),r<o&&(o=r),r>i&&(i=r)}),[n,o,a,i]}function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var m={aspectRatio:1,mobileWidth:"300px",tabletWidth:"360px",desktopWidth:"400px"};function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var h={mobile:{slot:"actions",showLabel:!0},tablet:{slot:"actions",showLabel:!0},desktop:{slot:"actions",showLabel:!0}},j={reducer:{initialState:{frame:null,frameRefs:null},actions:{SET_FRAME:(e,t)=>p(p({},e),{},{frame:t}),SET_FRAME_REFS:(e,t)=>p(p({},e),{},{frameRefs:t})}},InitComponent:t=>{var{appState:r,mapState:n,mapProvider:o,pluginConfig:a,pluginState:i,services:c,buttonConfig:p}=t,{breakpoint:f,layoutRefs:u}=r,{eventBus:s}=c,{frameDone:m,frameCancel:d}=p,{dispatch:b,frameRefs:y,frame:O}=i,v=n.isMapReady;e(()=>{if(v)return m.onClick=()=>{var e=l({frameEl:y.displayRef.current,viewportEl:u.viewportRef.current,featureId:null==O?void 0:O.featureId,scale:{small:1,medium:1.5,large:2}[n.mapSize],mapProvider:o});b({type:"SET_FRAME",payload:null}),s.emit("frame:done",e)},d.onClick=()=>{b({type:"SET_FRAME",payload:null}),s.emit("frame:cancel")},()=>{m.onClick=null,d.onClick=null}},[n.isMapReady,f,O,y,u,o,b,s,m,d])},controls:[{id:"frame",label:"Frame",mobile:{slot:"middle"},tablet:{slot:"middle"},desktop:{slot:"middle"},render:function(i){var c,{appState:p,mapState:f,pluginState:u,mapProvider:m,services:d}=i,{actionsRef:b,mainRef:y,bottomRef:O,viewportRef:v}=p.layoutRefs,{dispatch:g}=u,h=t(null),j=t(null),P=t(null),[w,S]=r("65px"),[E,R]=r(null),{eventBus:D}=d;e(()=>{g({type:"SET_FRAME_REFS",payload:{displayRef:j}})},[]),e(()=>{if(u.frame&&h.current){var e=h.current,t=()=>{if(b.current&&y.current&&O.current){var t=y.current.offsetHeight,r=O.current.offsetTop,n=b.current.offsetTop,o=t-Math.min(n,r)+10;S("65px 65px ".concat(o,"px 65px"));var{offsetWidth:a,offsetHeight:i}=e;if(t-o-e.offsetTop===e.offsetHeight){var{top:c,left:l,width:f,height:s}=function(e,t,r,n){var o=Number.parseInt(r["".concat(n,"Width")]||e,10),a=Math.min(o,e),i=a/r.aspectRatio;return i>t&&(a=(i=t)*r.aspectRatio),{top:(t-i)/2,left:(e-a)/2,width:a,height:i}}(a,i,u.frame,p.breakpoint),m=c+e.offsetTop,d=l+e.offsetLeft;R({top:"".concat(m,"px"),left:"".concat(d,"px"),width:"".concat(f,"px"),height:"".concat(s,"px")})}}},r=new window.ResizeObserver(t);return r.observe(e),t(),()=>r.disconnect()}P.current=null},[u.frame,p.breakpoint,b,y,O]),e(()=>{var e;if(null!==(e=u.frame)&&void 0!==e&&e.bounds&&j.current&&v.current&&E){var t=j.current,r=v.current,n=t.getBoundingClientRect(),o=r.getBoundingClientRect(),a={small:1,medium:1.5,large:2}[f.mapSize],i={top:(n.top-o.top)/a,right:(o.right-n.right)/a,bottom:(o.bottom-n.bottom)/a,left:(n.left-o.left)/a};m.setPadding(i),m.fitToBounds(u.frame.bounds,!0)}},[null===(c=u.frame)||void 0===c?void 0:c.bounds,E,m,j,v]);var x=t(null);return e(()=>{var e;if(u.frame&&j.current){var t=l({frameEl:j.current,viewportEl:v.current,featureId:null==u||null===(e=u.frame)||void 0===e?void 0:e.featureId,scale:{small:1,medium:1.5,large:2}[f.mapSize],mapProvider:m}),r=JSON.stringify(t.geometry.coordinates);r!==x.current&&(x.current=r,D.emit("frame:updated",t))}},[u.frame,E,f.center,f.mapSize,f.zoom]),u.frame?n(o,{children:[a("div",{className:"im-c-frame-spacer",style:{inset:w},ref:h}),E&&a("div",{ref:j,className:"im-c-frame-display",style:s({},E)})]}):null}}],buttons:[g({id:"frameDone",label:"Done",variant:"primary",hiddenWhen:e=>{var{pluginState:t}=e;return!t.frame}},h),g({id:"frameCancel",label:"Cancel",variant:"tertiary",hiddenWhen:e=>{var{pluginState:t}=e;return!t.frame}},h)],api:{addFrame:function(e,t){var{pluginConfig:r,pluginState:n,services:o}=e,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{dispatch:i}=n,{eventBus:c}=o;i({type:"SET_FRAME",payload:b(b(b(b({},m),r),a),{},{featureId:t})}),c.emit("frame:add")},editFeature:function(e,t){var{pluginConfig:r,pluginState:n,mapProvider:o,services:a}=e,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{dispatch:c}=n,{eventBus:p}=a,l=f(t),u=function(e,t){var r=f(e);if(!r)return null;var[n,o,a,i]=r,c=t.mapToScreen([n,i]),p=t.mapToScreen([a,o]),l=Math.abs(p.x-c.x),u=Math.abs(p.y-c.y);return 0===u?null:Math.round(l/u*1e6)/1e6}(t,o),s=O(O(O(O({},m),r),i),{},{aspectRatio:u,featureId:(null==t?void 0:t.id)||t.properties.id});c({type:"SET_FRAME",payload:O(O({},s),{},{bounds:l})}),p.emit("frame:edit")}}};export{j as manifest};
@@ -1 +0,0 @@
1
- import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/defineProperty";function t(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 n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function o(){var r;return n(n({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"frame",load:(r=e(function*(){return(yield import(/* webpackChunkName: "im-frame-plugin" */ "./im-frame-plugin.js")).manifest}),function(){return r.apply(this,arguments)})})}export{o as default};
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[191],{397(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){u(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function u(e,t,r){return(t=function(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.r(t),r.d(t,{manifest:()=>I});var a={SET_FRAME:function(e,t){return i(i({},e),{},{frame:t})},SET_FRAME_REFS:function(e,t){return i(i({},e),{},{frameRefs:t})}},c=r(738);function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){f=!0,o=e}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function p(e){var t=e.frameEl,r=e.viewportEl,n=e.mapProvider,o=e.featureId,i=e.scale,u=t.getBoundingClientRect(),a=r.getBoundingClientRect(),c={x:(u.left-a.left)/i,y:(u.top-a.top)/i},f={x:(u.right-a.left)/i,y:(u.top-a.top)/i},l={x:(u.right-a.left)/i,y:(u.bottom-a.top)/i},p={x:(u.left-a.left)/i,y:(u.bottom-a.top)/i},s={type:"Feature",geometry:{type:"Polygon",coordinates:[[n.screenToMap(c),n.screenToMap(f),n.screenToMap(l),n.screenToMap(p),n.screenToMap(c)]]},properties:{}};return o&&(s.id=o),s}function s(e){var t;if(null==e||null===(t=e.geometry)||void 0===t||null===(t=t.coordinates)||void 0===t||!t[0])return null;var r=e.geometry.coordinates[0],n=1/0,o=1/0,i=-1/0,u=-1/0;return r.forEach(function(e){var t=f(e,2),r=t[0],a=t[1];r<n&&(n=r),r>i&&(i=r),a<o&&(o=a),a>u&&(u=a)}),[n,o,i,u]}var y=r(287);function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach(function(t){d(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function d(e,t,r){return(t=function(e){var t=function(e){if("object"!=b(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==b(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){f=!0,o=e}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return O(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?O(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var h={aspectRatio:1,mobileWidth:"300px",tabletWidth:"360px",desktopWidth:"400px"};function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach(function(t){P(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function P(e,t,r){return(t=function(e){var t=function(e){if("object"!=S(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==S(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function T(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(Object(r),!0).forEach(function(t){D(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function D(e,t,r){return(t=function(e){var t=function(e){if("object"!=E(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==E(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function C(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach(function(t){k(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function k(e,t,r){return(t=function(e){var t=function(e){if("object"!=x(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=x(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==x(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var A={mobile:{slot:"actions",showLabel:!0},tablet:{slot:"actions",showLabel:!0},desktop:{slot:"actions",showLabel:!0}},I={reducer:{initialState:{frame:null,frameRefs:null},actions:a},InitComponent:function(e){var t=e.appState,r=e.mapState,n=e.mapProvider,o=(e.pluginConfig,e.pluginState),i=e.services,u=e.buttonConfig,a=t.breakpoint,f=t.layoutRefs,l=i.eventBus,s=u.frameDone,y=u.frameCancel,b=o.dispatch,m=o.frameRefs,v=o.frame,d=r.isMapReady;(0,c.useEffect)(function(){if(d)return s.onClick=function(){var e=p({frameEl:m.displayRef.current,viewportEl:f.viewportRef.current,featureId:null==v?void 0:v.featureId,scale:{small:1,medium:1.5,large:2}[r.mapSize],mapProvider:n});b({type:"SET_FRAME",payload:null}),l.emit("frame:done",e)},y.onClick=function(){b({type:"SET_FRAME",payload:null}),l.emit("frame:cancel")},function(){s.onClick=null,y.onClick=null}},[r.isMapReady,a,v,m,f,n,b,l,s,y])},controls:[{id:"frame",label:"Frame",mobile:{slot:"middle"},tablet:{slot:"middle"},desktop:{slot:"middle"},render:function(e){var t,r=e.appState,n=e.mapState,o=e.pluginState,i=e.mapProvider,u=e.services,a=r.layoutRefs,f=a.actionsRef,l=a.mainRef,s=a.bottomRef,b=a.viewportRef,m=o.dispatch,d=(0,c.useRef)(null),O=(0,c.useRef)(null),h=(0,c.useRef)(null),S=g((0,c.useState)("65px"),2),j=S[0],w=S[1],P=g((0,c.useState)(null),2),E=P[0],R=P[1],T=u.eventBus;(0,c.useEffect)(function(){m({type:"SET_FRAME_REFS",payload:{displayRef:O}})},[]),(0,c.useEffect)(function(){if(o.frame&&d.current){var e=d.current,t=function(){if(f.current&&l.current&&s.current){var t=l.current.offsetHeight,n=s.current.offsetTop,i=f.current.offsetTop,u=t-Math.min(i,n)+10;w("65px 65px ".concat(u,"px 65px"));var a=e.offsetWidth,c=e.offsetHeight;if(t-u-e.offsetTop===e.offsetHeight){var p=function(e,t,r,n){var o=Number.parseInt(r["".concat(n,"Width")]||e,10),i=Math.min(o,e),u=i/r.aspectRatio;return u>t&&(i=(u=t)*r.aspectRatio),{top:(t-u)/2,left:(e-i)/2,width:i,height:u}}(a,c,o.frame,r.breakpoint),y=p.top,b=p.left,m=p.width,v=p.height,d=y+e.offsetTop,g=b+e.offsetLeft;R({top:"".concat(d,"px"),left:"".concat(g,"px"),width:"".concat(m,"px"),height:"".concat(v,"px")})}}},n=new window.ResizeObserver(t);return n.observe(e),t(),function(){return n.disconnect()}}h.current=null},[o.frame,r.breakpoint,f,l,s]),(0,c.useEffect)(function(){var e;if(null!==(e=o.frame)&&void 0!==e&&e.bounds&&O.current&&b.current&&E){var t=O.current,r=b.current,u=t.getBoundingClientRect(),a=r.getBoundingClientRect(),c={small:1,medium:1.5,large:2}[n.mapSize],f={top:(u.top-a.top)/c,right:(a.right-u.right)/c,bottom:(a.bottom-u.bottom)/c,left:(u.left-a.left)/c};i.setPadding(f),i.fitToBounds(o.frame.bounds,!0)}},[null===(t=o.frame)||void 0===t?void 0:t.bounds,E,i,O,b]);var D=(0,c.useRef)(null);return(0,c.useEffect)(function(){var e;if(o.frame&&O.current){var t=p({frameEl:O.current,viewportEl:b.current,featureId:null==o||null===(e=o.frame)||void 0===e?void 0:e.featureId,scale:{small:1,medium:1.5,large:2}[n.mapSize],mapProvider:i}),r=JSON.stringify(t.geometry.coordinates);r!==D.current&&(D.current=r,T.emit("frame:updated",t))}},[o.frame,E,n.center,n.mapSize,n.zoom]),o.frame?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"im-c-frame-spacer",style:{inset:j},ref:d}),E&&(0,y.jsx)("div",{ref:O,className:"im-c-frame-display",style:v({},E)})]}):null}}],buttons:[C({id:"frameDone",label:"Done",variant:"primary",hiddenWhen:function(e){return!e.pluginState.frame}},A),C({id:"frameCancel",label:"Cancel",variant:"tertiary",hiddenWhen:function(e){return!e.pluginState.frame}},A)],api:{addFrame:function(e,t){var r=e.pluginConfig,n=e.pluginState,o=e.services,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=n.dispatch,a=o.eventBus;u({type:"SET_FRAME",payload:w(w(w(w({},h),r),i),{},{featureId:t})}),a.emit("frame:add")},editFeature:function(e,t){var r=e.pluginConfig,n=e.pluginState,o=e.mapProvider,i=e.services,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=n.dispatch,c=i.eventBus,l=s(t),p=function(e,t){var r=s(e);if(!r)return null;var n=f(r,4),o=n[0],i=n[1],u=n[2],a=n[3],c=t.mapToScreen([o,a]),l=t.mapToScreen([u,i]),p=Math.abs(l.x-c.x),y=Math.abs(l.y-c.y);return 0===y?null:Math.round(p/y*1e6)/1e6}(t,o),y=T(T(T(T({},h),r),u),{},{aspectRatio:p,featureId:(null==t?void 0:t.id)||t.properties.id});a({type:"SET_FRAME",payload:T(T({},y),{},{bounds:l})}),c.emit("frame:edit")}}}}}]);
@@ -1,2 +0,0 @@
1
- /*! For license information please see index.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.framePlugin=t())}(this,()=>(()=>{"use strict";var e,t,r={738(e){e.exports=preactCompat},287(e){e.exports=preactJsxRuntime}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.m=r,o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>"im-frame-plugin.js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="defra.framePlugin:",o.l=(r,n,i,a)=>{if(e[r])e[r].push(n);else{var u,c;if(void 0!==i)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var l=f[p];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+i){u=l;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+i),u.src=r),e[r]=[n];var s=(t,n)=>{u.onerror=u.onload=null,clearTimeout(b);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),t)return t(n)},b=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),c&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=i);var a=o.p+o.u(t),u=new Error;o.l(a,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",u.name="ChunkLoadError",u.type=i,u.request=a,n[1](u)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,i,[a,u,c]=r,f=0;if(a.some(t=>0!==e[t])){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);c&&c(o)}for(t&&t(r);f<a.length;f++)i=a[f],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function u(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof f?n:f,p=Object.create(u.prototype);return c(p,"_invoke",function(r,n,o){var i,u,c,f=0,p=o||[],l=!1,s={p:0,n:0,v:e,a:b,f:b.bind(e,4),d:function(t,r){return i=t,u=0,c=e,s.n=r,a}};function b(r,n){for(u=r,c=n,t=0;!l&&f&&!o&&t<p.length;t++){var o,i=p[t],b=s.p,d=i[2];r>3?(o=d===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=b&&((o=r<2&&b<i[1])?(u=0,s.v=n,s.n=i[1]):b<d&&(o=r<3||i[0]>n||n>d)&&(i[4]=r,i[5]=n,s.n=d,u=0))}if(o||r>1)return a;throw l=!0,n}return function(o,p,d){if(f>1)throw TypeError("Generator is already running");for(l&&1===p&&b(p,d),u=p,c=d;(t=u<2?e:c)||!l;){i||(u?u<3?(u>1&&(s.n=-1),b(u,c)):s.n=c:s.v=c);try{if(f=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(l=s.n<0)?c:r.call(n,s))!==a)break}catch(t){i=e,u=1,c=t}finally{f=1}}return{value:t,done:l}}}(r,o,i),!0),p}var a={};function f(){}function p(){}function l(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(c(t={},n,function(){return this}),t),b=l.prototype=f.prototype=Object.create(s);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,c(e,o,"GeneratorFunction")),e.prototype=Object.create(b),e}return p.prototype=l,c(b,"constructor",l),c(l,"constructor",p),p.displayName="GeneratorFunction",c(l,o,"GeneratorFunction"),c(b),c(b,o,"Generator"),c(b,n,function(){return this}),c(b,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:d}})()}function c(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,r,n){function i(t,r){c(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},c(e,t,r,n)}function f(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,t,r){return(t=function(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(){var e,t;return l(l({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"frame",load:(e=u().m(function e(){var t;return u().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.e(191).then(o.bind(o,397));case 1:return t=e.v.manifest,e.a(2,t)}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){f(i,n,o,a,u,"next",e)}function u(e){f(i,n,o,a,u,"throw",e)}a(void 0)})},function(){return t.apply(this,arguments)})})}return o.d(i,{default:()=>b}),i.default})());
@@ -1 +0,0 @@
1
- import{useEffect as e}from"preact/compat";import{jsx as i,Fragment as a,jsxs as s}from"preact/jsx-runtime";import"@babel/runtime/helpers/defineProperty";import"@babel/runtime/helpers/objectWithoutProperties";import"@babel/runtime/helpers/asyncToGenerator";var t="app:ready",l="map:setstyle",m="map:setsize",r="map:setpixelratio",p="map:initmapstyles";var o={small:1,medium:1.5,large:2},c={InitComponent:function(s){var{pluginConfig:l,services:m}=s,{eventBus:r}=m,o=()=>{r.emit(p,l.mapStyles)};return e(()=>(r.on(t,o),()=>r.off(t,o)),[]),i(a,{})},panels:[{id:"mapStyles",label:"Map styles",mobile:{slot:"drawer",modal:!0,dismissible:!0},tablet:{slot:"left-top",modal:!0,width:"400px",dismissible:!0},desktop:{slot:"left-top",modal:!0,width:"400px",dismissible:!0},render:e=>{var{mapState:a,pluginConfig:t,services:p,mapProvider:c}=e,{mapStyle:d,mapSize:n}=a,{mapStyles:h}=t,{eventBus:v}=p,{supportsMapSizes:b}=c.capabilities;return s("div",{className:"im-c-map-styles",children:[i("div",{className:"im-c-map-styles__group",children:i("div",{className:"im-c-map-styles__inner",children:h.filter(e=>e.url).map(e=>i("div",{className:"im-c-map-styles__item",children:s("button",{className:"im-c-map-styles__button","aria-pressed":e.id===d.id,onClick:()=>{return i=e,void v.emit(l,i);var i},children:[i("div",{className:"im-c-map-styles__image",children:i("img",{src:e.thumbnail||void 0,alt:"",height:"60",width:"60"})}),e.label]})},e.id))})}),b&&s("div",{className:"im-c-map-styles__group",children:[i("h3",{className:"im-c-map-styles__heading",id:"map-text-sizes",children:"Map size"}),i("div",{className:"im-c-map-styles__inner",children:["small","medium","large"].map(e=>i("div",{className:"im-c-map-styles__item",children:s("button",{className:"im-c-map-styles__button",onClick:()=>{return i=e,v.emit(m,i),void v.emit(r,window.devicePixelRatio*o[i]);var i},"aria-pressed":e===n,children:[i("div",{className:"im-c-map-styles__image",children:s("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fillRule:"evenodd",children:[i("rect",{className:"im-c-map-styles__image-bg",width:"100%",height:"100%"}),i("g",{style:{transform:"scale(".concat(o[e],")"),transformOrigin:"8px 52px"},children:i("path",{d:"M8 51.785L12.948 38.9h1.837l5.274 12.885h-1.943l-1.503-3.903h-5.387l-1.415 3.903H8zm3.718-5.291h4.368l-1.345-3.569-.914-2.671c-.164.826-.395 1.646-.694 2.46l-1.415 3.78zm15.592 4.139c-3.698 3.143-7.836.271-6.315-2.562.963-1.794 5.529-1.982 6.183-2.21.022-.825.052-2.27-2.241-2.312-1.751-.031-2.242 1.025-2.435 1.776l-1.547-.211c.234-1.102.963-2.856 4.21-2.874 4.037-.022 3.612 2.962 3.612 3.524v2.11c0 .315 0 3.012.501 3.911h-1.652c-.164-.328-.27-.712-.316-1.152zm-.132-3.533c-.907.37-3.444.694-3.964.914-1.293.548-.911 2.399.225 2.637.639.134 3.739.476 3.739-2.971v-.58z"})})]})}),e[0].toUpperCase()+e.slice(1)]})},e))})]})]})}}],buttons:[{id:"mapStyles",label:"Styles",panelId:"mapStyles",iconId:"map",mobile:{slot:"top-left",showLabel:!1},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"map",svgContent:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>'}]};export{c as manifest};
@@ -1 +0,0 @@
1
- import e from"@babel/runtime/helpers/asyncToGenerator";function t(){var t,{manifest:a,mapStyles:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:"mapStyles",manifest:a,mapStyles:n,load:(t=e(function*(){return(yield import(/* webpackChunkName: "im-map-styles-plugin" */ "./im-map-styles-plugin.js")).manifest}),function(){return t.apply(this,arguments)}),handlesMapStyle:!0,api:{}}}export{t as default};
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[657],{790(e,s,i){i.r(s),i.d(s,{manifest:()=>n});var a=i(738),t="app:ready",l=i(287),m={small:1,medium:1.5,large:2},n={InitComponent:function(e){var s=e.pluginConfig,i=e.services.eventBus,m=function(){i.emit("map:initmapstyles",s.mapStyles)};return(0,a.useEffect)(function(){return i.on(t,m),function(){return i.off(t,m)}},[]),(0,l.jsx)(l.Fragment,{})},panels:[{id:"mapStyles",label:"Map styles",mobile:{slot:"drawer",modal:!0,dismissible:!0},tablet:{slot:"left-top",modal:!0,width:"400px",dismissible:!0},desktop:{slot:"left-top",modal:!0,width:"400px",dismissible:!0},render:function(e){var s=e.mapState,i=e.pluginConfig,a=e.services,t=e.mapProvider,n=s.mapStyle,r=s.mapSize,c=i.mapStyles,p=a.eventBus,d=t.capabilities.supportsMapSizes;return(0,l.jsxs)("div",{className:"im-c-map-styles",children:[(0,l.jsx)("div",{className:"im-c-map-styles__group",children:(0,l.jsx)("div",{className:"im-c-map-styles__inner",children:c.filter(function(e){return e.url}).map(function(e){return(0,l.jsx)("div",{className:"im-c-map-styles__item",children:(0,l.jsxs)("button",{className:"im-c-map-styles__button","aria-pressed":e.id===n.id,onClick:function(){return s=e,void p.emit("map:setstyle",s);var s},children:[(0,l.jsx)("div",{className:"im-c-map-styles__image",children:(0,l.jsx)("img",{src:e.thumbnail||void 0,alt:"",height:"60",width:"60"})}),e.label]})},e.id)})})}),d&&(0,l.jsxs)("div",{className:"im-c-map-styles__group",children:[(0,l.jsx)("h3",{className:"im-c-map-styles__heading",id:"map-text-sizes",children:"Map size"}),(0,l.jsx)("div",{className:"im-c-map-styles__inner",children:["small","medium","large"].map(function(e){return(0,l.jsx)("div",{className:"im-c-map-styles__item",children:(0,l.jsxs)("button",{className:"im-c-map-styles__button",onClick:function(){return s=e,p.emit("map:setsize",s),void p.emit("map:setpixelratio",window.devicePixelRatio*m[s]);var s},"aria-pressed":e===r,children:[(0,l.jsx)("div",{className:"im-c-map-styles__image",children:(0,l.jsxs)("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fillRule:"evenodd",children:[(0,l.jsx)("rect",{className:"im-c-map-styles__image-bg",width:"100%",height:"100%"}),(0,l.jsx)("g",{style:{transform:"scale(".concat(m[e],")"),transformOrigin:"8px 52px"},children:(0,l.jsx)("path",{d:"M8 51.785L12.948 38.9h1.837l5.274 12.885h-1.943l-1.503-3.903h-5.387l-1.415 3.903H8zm3.718-5.291h4.368l-1.345-3.569-.914-2.671c-.164.826-.395 1.646-.694 2.46l-1.415 3.78zm15.592 4.139c-3.698 3.143-7.836.271-6.315-2.562.963-1.794 5.529-1.982 6.183-2.21.022-.825.052-2.27-2.241-2.312-1.751-.031-2.242 1.025-2.435 1.776l-1.547-.211c.234-1.102.963-2.856 4.21-2.874 4.037-.022 3.612 2.962 3.612 3.524v2.11c0 .315 0 3.012.501 3.911h-1.652c-.164-.328-.27-.712-.316-1.152zm-.132-3.533c-.907.37-3.444.694-3.964.914-1.293.548-.911 2.399.225 2.637.639.134 3.739.476 3.739-2.971v-.58z"})})]})}),e[0].toUpperCase()+e.slice(1)]})},e)})})]})]})}}],buttons:[{id:"mapStyles",label:"Styles",panelId:"mapStyles",iconId:"map",mobile:{slot:"top-left",showLabel:!1},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"map",svgContent:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>'}]}}}]);
@@ -1,2 +0,0 @@
1
- /*! For license information please see index.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.mapStylesPlugin=t())}(this,()=>(()=>{"use strict";var e,t,r={738(e){e.exports=preactCompat},287(e){e.exports=preactJsxRuntime}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.m=r,o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>"im-map-styles-plugin.js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="defra.mapStylesPlugin:",o.l=(r,n,a,i)=>{if(e[r])e[r].push(n);else{var u,c;if(void 0!==a)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var l=f[p];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+a){u=l;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+a),u.src=r),e[r]=[n];var s=(t,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),t)return t(n)},d=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),c&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=a);var i=o.p+o.u(t),u=new Error;o.l(i,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",u.name="ChunkLoadError",u.type=a,u.request=i,n[1](u)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,a,[i,u,c]=r,f=0;if(i.some(t=>0!==e[t])){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);c&&c(o)}for(t&&t(r);f<i.length;f++)a=i[f],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};function i(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var i=n&&n.prototype instanceof f?n:f,p=Object.create(i.prototype);return u(p,"_invoke",function(r,n,o){var a,i,u,f=0,p=o||[],l=!1,s={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,i=0,u=e,s.n=r,c}};function d(r,n){for(i=r,u=n,t=0;!l&&f&&!o&&t<p.length;t++){var o,a=p[t],d=s.p,v=a[2];r>3?(o=v===n)&&(u=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=r<2&&d<a[1])?(i=0,s.v=n,s.n=a[1]):d<v&&(o=r<3||a[0]>n||n>v)&&(a[4]=r,a[5]=n,s.n=v,i=0))}if(o||r>1)return c;throw l=!0,n}return function(o,p,v){if(f>1)throw TypeError("Generator is already running");for(l&&1===p&&d(p,v),i=p,u=v;(t=i<2?e:u)||!l;){a||(i?i<3?(i>1&&(s.n=-1),d(i,u)):s.n=u:s.v=u);try{if(f=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(l=s.n<0)?u:r.call(n,s))!==c)break}catch(t){a=e,i=1,u=t}finally{f=1}}return{value:t,done:l}}}(r,o,a),!0),p}var c={};function f(){}function p(){}function l(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(u(t={},n,function(){return this}),t),d=l.prototype=f.prototype=Object.create(s);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,u(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return p.prototype=l,u(d,"constructor",l),u(l,"constructor",p),p.displayName="GeneratorFunction",u(l,o,"GeneratorFunction"),u(d),u(d,o,"Generator"),u(d,n,function(){return this}),u(d,"toString",function(){return"[object Generator]"}),(i=function(){return{w:a,m:v}})()}function u(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}u=function(e,t,r,n){function a(t,r){u(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},u(e,t,r,n)}function c(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function f(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:"mapStyles",manifest:r.manifest,mapStyles:r.mapStyles,load:(e=i().m(function e(){var t;return i().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.e(657).then(o.bind(o,790));case 1:return t=e.v.manifest,e.a(2,t)}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){c(a,n,o,i,u,"next",e)}function u(e){c(a,n,o,i,u,"throw",e)}i(void 0)})},function(){return t.apply(this,arguments)}),handlesMapStyle:!0,api:{}}}return o.d(a,{default:()=>f}),a.default})());
@@ -1 +0,0 @@
1
- import{useRef as r,useMemo as a}from"preact/compat";import{jsx as l,jsxs as t}from"preact/jsx-runtime";var e={small:1,medium:1.5,large:2},i={metric:[{threshold:1,abbr:"m",abbrPlural:"m",unit:"metre",unitPlural:"metres",factor:1},{threshold:1e3,abbr:"km",abbrPlural:"km",unit:"kilometre",unitPlural:"kilometres",factor:.001}],imperial:[{threshold:1609.344,abbr:"mi",abbrPlural:"mi",unit:"mile",unitPlural:"miles",factor:1/1609.344},{threshold:.9144,abbr:"yd",abbrPlural:"yds",unit:"yard",unitPlural:"yards",factor:1/.9144},{threshold:.3048,abbr:"ft",abbrPlural:"ft",unit:"foot",unitPlural:"feet",factor:1/.3048}]},b=r=>{var a=Math.pow(10,Math.floor(Math.log10(r))),l=r/a;return(l>=10?10:l>=5?5:l>=3?3:l>=2?2:1)*a};var o={controls:[{id:"scaleBar",label:"Scale bar",mobile:{slot:"right-bottom"},tablet:{slot:"right-bottom"},desktop:{slot:"right-bottom"},render:function(o){var{mapState:u,pluginConfig:n}=o,{resolution:s,mapSize:m}=u,c=r(null),d=a(()=>s?((r,a,l,t)=>{var o=r/e[t],u=o*a,n=i[l];for(var{abbr:s,abbrPlural:m,unit:c,unitPlural:d,factor:h}of n){var f=b(u*h);if(f>=1&&f<1e3){var p=f/h/o;if(p<=a)return{label:f,abbr:f>1?m:s,width:p,unit:f>1?d:c}}}var P=n[n.length-1],v=u*P.factor,g=b(v),y=g>1?P.abbrPlural:P.abbr,w=g>1?P.abbrPlural:P.abbr;return{label:g,abbr:y,width:g/P.factor/o,unit:w}})(s/1,120,n.units,m):{width:0,label:"",abbr:"",unit:""},[s,m,n.units]);return l("div",{className:"im-c-scale-bar",ref:c,style:{width:"".concat(d.width,"px")},children:t("span",{className:"im-c-scale-bar__label",children:[l("span",{className:"im-u-visually-hidden",children:"Scale bar: "}),d.label,l("span",{"aria-hidden":"true",children:d.abbr}),l("span",{className:"im-u-visually-hidden",children:d.unit})]})})}}]};export{o as manifest};
@@ -1 +0,0 @@
1
- import t from"@babel/runtime/helpers/asyncToGenerator";function e(){var e,{manifest:n,units:i="metric"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:"scaleBar",manifest:n,units:i,load:(e=t(function*(){return(yield import(/* webpackChunkName: "im-scale-bar-plugin" */ "./im-scale-bar-plugin.js")).manifest}),function(){return e.apply(this,arguments)})}}export{e as default};
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[996],{405(r,t,a){a.r(t),a.d(t,{manifest:()=>b});var e=a(738);function n(r,t){(null==t||t>r.length)&&(t=r.length);for(var a=0,e=Array(t);a<t;a++)e[a]=r[a];return e}var l={small:1,medium:1.5,large:2},i={metric:[{threshold:1,abbr:"m",abbrPlural:"m",unit:"metre",unitPlural:"metres",factor:1},{threshold:1e3,abbr:"km",abbrPlural:"km",unit:"kilometre",unitPlural:"kilometres",factor:.001}],imperial:[{threshold:1609.344,abbr:"mi",abbrPlural:"mi",unit:"mile",unitPlural:"miles",factor:1/1609.344},{threshold:.9144,abbr:"yd",abbrPlural:"yds",unit:"yard",unitPlural:"yards",factor:1/.9144},{threshold:.3048,abbr:"ft",abbrPlural:"ft",unit:"foot",unitPlural:"feet",factor:1/.3048}]},o=function(r){var t=Math.pow(10,Math.floor(Math.log10(r))),a=r/t;return(a>=10?10:a>=5?5:a>=3?3:a>=2?2:1)*t},u=a(287),b={controls:[{id:"scaleBar",label:"Scale bar",mobile:{slot:"right-bottom"},tablet:{slot:"right-bottom"},desktop:{slot:"right-bottom"},render:function(r){var t=r.mapState,a=r.pluginConfig,b=t.resolution,s=t.mapSize,c=(0,e.useRef)(null),f=(0,e.useMemo)(function(){return b?function(r,t,a,e){var u,b=r/l[e],s=120*b,c=i[a],f=function(r,t){var a="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!a){if(Array.isArray(r)||(a=function(r,t){if(r){if("string"==typeof r)return n(r,t);var a={}.toString.call(r).slice(8,-1);return"Object"===a&&r.constructor&&(a=r.constructor.name),"Map"===a||"Set"===a?Array.from(r):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?n(r,t):void 0}}(r))||t&&r&&"number"==typeof r.length){a&&(r=a);var e=0,l=function(){};return{s:l,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:l}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,u=!1;return{s:function(){a=a.call(r)},n:function(){var r=a.next();return o=r.done,r},e:function(r){u=!0,i=r},f:function(){try{o||null==a.return||a.return()}finally{if(u)throw i}}}}(c);try{for(f.s();!(u=f.n()).done;){var h=u.value,d=h.abbr,m=h.abbrPlural,y=h.unit,p=h.unitPlural,v=h.factor,g=o(s*v);if(g>=1&&g<1e3){var P=g/v/b;if(P<=120)return{label:g,abbr:g>1?m:d,width:P,unit:g>1?p:y}}}}catch(r){f.e(r)}finally{f.f()}var w=c[c.length-1],k=s*w.factor,S=o(k),j=S>1?w.abbrPlural:w.abbr,x=S>1?w.abbrPlural:w.abbr;return{label:S,abbr:j,width:S/w.factor/b,unit:x}}(b/1,0,a.units,s):{width:0,label:"",abbr:"",unit:""}},[b,s,a.units]);return(0,u.jsx)("div",{className:"im-c-scale-bar",ref:c,style:{width:"".concat(f.width,"px")},children:(0,u.jsxs)("span",{className:"im-c-scale-bar__label",children:[(0,u.jsx)("span",{className:"im-u-visually-hidden",children:"Scale bar: "}),f.label,(0,u.jsx)("span",{"aria-hidden":"true",children:f.abbr}),(0,u.jsx)("span",{className:"im-u-visually-hidden",children:f.unit})]})})}}]}}}]);
@@ -1,2 +0,0 @@
1
- /*! For license information please see index.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.scaleBarPlugin=t())}(this,()=>(()=>{"use strict";var e,t,r={738(e){e.exports=preactCompat},287(e){e.exports=preactJsxRuntime}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.m=r,o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>"im-scale-bar-plugin.js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="defra.scaleBarPlugin:",o.l=(r,n,i,a)=>{if(e[r])e[r].push(n);else{var u,c;if(void 0!==i)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var s=f[p];if(s.getAttribute("src")==r||s.getAttribute("data-webpack")==t+i){u=s;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+i),u.src=r),e[r]=[n];var l=(t,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),t)return t(n)},d=setTimeout(l.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=l.bind(null,u.onerror),u.onload=l.bind(null,u.onload),c&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=i);var a=o.p+o.u(t),u=new Error;o.l(a,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",u.name="ChunkLoadError",u.type=i,u.request=a,n[1](u)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,i,[a,u,c]=r,f=0;if(a.some(t=>0!==e[t])){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);c&&c(o)}for(t&&t(r);f<a.length;f++)i=a[f],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};function a(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var a=n&&n.prototype instanceof f?n:f,p=Object.create(a.prototype);return u(p,"_invoke",function(r,n,o){var i,a,u,f=0,p=o||[],s=!1,l={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,u=e,l.n=r,c}};function d(r,n){for(a=r,u=n,t=0;!s&&f&&!o&&t<p.length;t++){var o,i=p[t],d=l.p,v=i[2];r>3?(o=v===n)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,l.v=n,l.n=i[1]):d<v&&(o=r<3||i[0]>n||n>v)&&(i[4]=r,i[5]=n,l.n=v,a=0))}if(o||r>1)return c;throw s=!0,n}return function(o,p,v){if(f>1)throw TypeError("Generator is already running");for(s&&1===p&&d(p,v),a=p,u=v;(t=a<2?e:u)||!s;){i||(a?a<3?(a>1&&(l.n=-1),d(a,u)):l.n=u:l.v=u);try{if(f=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(s=l.n<0)?u:r.call(n,l))!==c)break}catch(t){i=e,a=1,u=t}finally{f=1}}return{value:t,done:s}}}(r,o,i),!0),p}var c={};function f(){}function p(){}function s(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(u(t={},n,function(){return this}),t),d=s.prototype=f.prototype=Object.create(l);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,u(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return p.prototype=s,u(d,"constructor",s),u(s,"constructor",p),p.displayName="GeneratorFunction",u(s,o,"GeneratorFunction"),u(d),u(d,o,"Generator"),u(d,n,function(){return this}),u(d,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:v}})()}function u(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}u=function(e,t,r,n){function i(t,r){u(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},u(e,t,r,n)}function c(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function f(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.manifest,i=r.units;return{id:"scaleBar",manifest:n,units:void 0===i?"metric":i,load:(e=a().m(function e(){var t;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.e(996).then(o.bind(o,405));case 1:return t=e.v.manifest,e.a(2,t)}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){c(i,n,o,a,u,"next",e)}function u(e){c(i,n,o,a,u,"throw",e)}a(void 0)})},function(){return t.apply(this,arguments)})}}return o.d(i,{default:()=>f}),i.default})());
@@ -1 +0,0 @@
1
- import{useEffect as e}from"preact/compat";import{jsx as t}from"preact/jsx-runtime";import o from"@babel/runtime/helpers/defineProperty";function r(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var i={PERMISSION_DENIED:"Location permission denied. Please enable it in your browser settings.",POSITION_UNAVAILABLE:"Location information is unavailable.",TIMEOUT:"The location request timed out. Please try again.",FALLBACK:"Unable to get your location."};var a={slot:"right-top",showLabel:!1},l={InitComponent:function(t){var{appConfig:o,appState:r,pluginState:n,mapState:a,mapProvider:l,buttonConfig:c}=t,{useLocation:s}=c;return e(()=>{if(a.isMapReady)return function(e){var{appState:t,pluginState:o,mapProvider:r,useLocationButton:n}=e,{dispatch:a,buttonRefs:l}=t,{dispatch:c}=o,s=e=>e&&"number"==typeof e.code&&i[e.code]||i.FALLBACK;n.onClick=()=>{navigator.geolocation.getCurrentPosition(e=>{var{latitude:t,longitude:o}=e.coords;try{r.setView({center:[o,t],zoom:12})}catch(e){console.log("Map provider failed to pan:",e)}},e=>{var t=s(e),o=l.current[n.id];c({type:"SET_ERROR_MESSAGE",payload:t}),a({type:"OPEN_PANEL",payload:{panelId:"useLocation",props:{triggeringElement:o}}})},{enableHighAccuracy:!0,maximumAge:0,timeout:1e4})};var p=null}({appState:r,pluginState:n,mapProvider:l,useLocationButton:s}),()=>{s.onClick=null}},[a.isMapReady]),null},reducer:{initialState:{errorMessage:null},actions:{SET_ERROR_MESSAGE:(e,t)=>n(n({},e),{},{errorMessage:t})}},buttons:[{id:"useLocation",group:{label:"Location",slotOrder:0},label:"Use your location",iconId:"locateFixed",keepFocus:!0,hiddenWhen:()=>!navigator.geolocation,mobile:a,tablet:a,desktop:a}],panels:[{id:"useLocation",label:"Problem getting your location",mobile:{slot:"banner",open:!1,dismissible:!0,modal:!0},tablet:{slot:"banner",open:!1,dismissible:!0,modal:!0},desktop:{slot:"banner",open:!1,dismissible:!0,modal:!0},render:e=>{var{pluginState:o}=e,{errorMessage:r}=o;return t("div",{className:"im-c-use-location",children:t("p",{children:r})})}}],icons:[{id:"locateFixed",svgContent:'<line x1="2" x2="5" y1="12" y2="12"/><line x1="19" x2="22" y1="12" y2="12"/><line x1="12" x2="12" y1="2" y2="5"/><line x1="12" x2="12" y1="19" y2="22"/><circle cx="12" cy="12" r="7"/><circle cx="12" cy="12" r="3"/>'}]};export{l as manifest};
@@ -1 +0,0 @@
1
- import n from"@babel/runtime/helpers/asyncToGenerator";function t(){return{id:"useLocation",load:(t=n(function*(){return(yield import(/* webpackChunkName: "im-use-location-plugin" */ "./im-use-location-plugin.js")).manifest}),function(){return t.apply(this,arguments)})};var t}export{t as default};
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[419],{528(e,t,o){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function i(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?r(Object(o),!0).forEach(function(t){a(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function a(e,t,o){return(t=function(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}o.r(t),o.d(t,{manifest:()=>b});var c={SET_ERROR_MESSAGE:function(e,t){return i(i({},e),{},{errorMessage:t})}},l=o(738),u={PERMISSION_DENIED:"Location permission denied. Please enable it in your browser settings.",POSITION_UNAVAILABLE:"Location information is unavailable.",TIMEOUT:"The location request timed out. Please try again.",FALLBACK:"Unable to get your location."},s=o(287),p={slot:"right-top",showLabel:!1},b={InitComponent:function(e){e.appConfig;var t=e.appState,o=e.pluginState,n=e.mapState,r=e.mapProvider,i=e.buttonConfig.useLocation;return(0,l.useEffect)(function(){if(n.isMapReady)return function(e){var t=e.appState,o=e.pluginState,n=e.mapProvider,r=e.useLocationButton,i=t.dispatch,a=t.buttonRefs,c=o.dispatch;r.onClick=function(){navigator.geolocation.getCurrentPosition(function(e){var t=e.coords,o=t.latitude,r=t.longitude;try{n.setView({center:[r,o],zoom:12})}catch(e){console.log("Map provider failed to pan:",e)}},function(e){var t=function(e){return e&&"number"==typeof e.code&&u[e.code]||u.FALLBACK}(e),o=a.current[r.id];c({type:"SET_ERROR_MESSAGE",payload:t}),i({type:"OPEN_PANEL",payload:{panelId:"useLocation",props:{triggeringElement:o}}})},{enableHighAccuracy:!0,maximumAge:0,timeout:1e4})}}({appState:t,pluginState:o,mapProvider:r,useLocationButton:i}),function(){i.onClick=null}},[n.isMapReady]),null},reducer:{initialState:{errorMessage:null},actions:c},buttons:[{id:"useLocation",group:{label:"Location",slotOrder:0},label:"Use your location",iconId:"locateFixed",keepFocus:!0,hiddenWhen:function(){return!navigator.geolocation},mobile:p,tablet:p,desktop:p}],panels:[{id:"useLocation",label:"Problem getting your location",mobile:{slot:"banner",open:!1,dismissible:!0,modal:!0},tablet:{slot:"banner",open:!1,dismissible:!0,modal:!0},desktop:{slot:"banner",open:!1,dismissible:!0,modal:!0},render:function(e){var t=e.pluginState.errorMessage;return(0,s.jsx)("div",{className:"im-c-use-location",children:(0,s.jsx)("p",{children:t})})}}],icons:[{id:"locateFixed",svgContent:'<line x1="2" x2="5" y1="12" y2="12"/><line x1="19" x2="22" y1="12" y2="12"/><line x1="12" x2="12" y1="2" y2="5"/><line x1="12" x2="12" y1="19" y2="22"/><circle cx="12" cy="12" r="7"/><circle cx="12" cy="12" r="3"/>'}]}}}]);
@@ -1,2 +0,0 @@
1
- /*! For license information please see index.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.useLocationPlugin=t())}(this,()=>(()=>{"use strict";var e,t,r={738(e){e.exports=preactCompat},287(e){e.exports=preactJsxRuntime}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.m=r,o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>"im-use-location-plugin.js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="defra.useLocationPlugin:",o.l=(r,n,i,a)=>{if(e[r])e[r].push(n);else{var u,c;if(void 0!==i)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var s=f[p];if(s.getAttribute("src")==r||s.getAttribute("data-webpack")==t+i){u=s;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+i),u.src=r),e[r]=[n];var l=(t,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),t)return t(n)},d=setTimeout(l.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=l.bind(null,u.onerror),u.onload=l.bind(null,u.onload),c&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=i);var a=o.p+o.u(t),u=new Error;o.l(a,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",u.name="ChunkLoadError",u.type=i,u.request=a,n[1](u)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,i,[a,u,c]=r,f=0;if(a.some(t=>0!==e[t])){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);c&&c(o)}for(t&&t(r);f<a.length;f++)i=a[f],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};function a(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var a=n&&n.prototype instanceof f?n:f,p=Object.create(a.prototype);return u(p,"_invoke",function(r,n,o){var i,a,u,f=0,p=o||[],s=!1,l={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,u=e,l.n=r,c}};function d(r,n){for(a=r,u=n,t=0;!s&&f&&!o&&t<p.length;t++){var o,i=p[t],d=l.p,v=i[2];r>3?(o=v===n)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,l.v=n,l.n=i[1]):d<v&&(o=r<3||i[0]>n||n>v)&&(i[4]=r,i[5]=n,l.n=v,a=0))}if(o||r>1)return c;throw s=!0,n}return function(o,p,v){if(f>1)throw TypeError("Generator is already running");for(s&&1===p&&d(p,v),a=p,u=v;(t=a<2?e:u)||!s;){i||(a?a<3?(a>1&&(l.n=-1),d(a,u)):l.n=u:l.v=u);try{if(f=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(s=l.n<0)?u:r.call(n,l))!==c)break}catch(t){i=e,a=1,u=t}finally{f=1}}return{value:t,done:s}}}(r,o,i),!0),p}var c={};function f(){}function p(){}function s(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(u(t={},n,function(){return this}),t),d=s.prototype=f.prototype=Object.create(l);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,u(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return p.prototype=s,u(d,"constructor",s),u(s,"constructor",p),p.displayName="GeneratorFunction",u(s,o,"GeneratorFunction"),u(d),u(d,o,"Generator"),u(d,n,function(){return this}),u(d,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:v}})()}function u(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}u=function(e,t,r,n){function i(t,r){u(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},u(e,t,r,n)}function c(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function f(){return{id:"useLocation",load:(e=a().m(function e(){var t;return a().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.e(419).then(o.bind(o,528));case 1:return t=e.v.manifest,e.a(2,t)}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){c(i,n,o,a,u,"next",e)}function u(e){c(i,n,o,a,u,"throw",e)}a(void 0)})},function(){return t.apply(this,arguments)})};var e,t}return o.d(i,{default:()=>f}),i.default})());
@@ -1,6 +0,0 @@
1
- // the local _datasetRegistry will only be initialised if the datasets plugin is in use,
2
- // otherwise it will remain null.
3
- let _datasetRegistry = null
4
-
5
- export const getDatasetRegistry = () => _datasetRegistry
6
- export const setDatasetRegistry = (datasetRegistry) => (_datasetRegistry = datasetRegistry)
@@ -1,23 +0,0 @@
1
- import { getDatasetRegistry, setDatasetRegistry } from './getDatasetRegistry.js'
2
-
3
- afterEach(() => {
4
- setDatasetRegistry(null)
5
- })
6
-
7
- describe('getDatasetRegistry', () => {
8
- it('returns null before any registry is set', () => {
9
- expect(getDatasetRegistry()).toBeNull()
10
- })
11
-
12
- it('returns the registry after setDatasetRegistry is called', () => {
13
- const registry = { keyItems: jest.fn() }
14
- setDatasetRegistry(registry)
15
- expect(getDatasetRegistry()).toBe(registry)
16
- })
17
-
18
- it('returns null after being reset to null', () => {
19
- setDatasetRegistry({ keyItems: jest.fn() })
20
- setDatasetRegistry(null)
21
- expect(getDatasetRegistry()).toBeNull()
22
- })
23
- })
@@ -1 +0,0 @@
1
- export { getDatasetRegistry } from './getDatasetRegistry.js'
@@ -1,7 +0,0 @@
1
- import { getDatasetRegistry } from './index.js'
2
-
3
- describe('registry/index', () => {
4
- it('exports getDatasetRegistry as a function', () => {
5
- expect(typeof getDatasetRegistry).toBe('function')
6
- })
7
- })
@@ -1 +0,0 @@
1
- import e from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/helpers/defineProperty";import r from"@arcgis/core/config.js";import n from"@arcgis/core/layers/support/TileInfo.js";import a from"@arcgis/core/Map.js";import o from"@arcgis/core/views/MapView.js";import i from"@arcgis/core/layers/VectorTileLayer.js";import s from"@arcgis/core/geometry/Point.js";import{when as m,once as l,watch as p}from"@arcgis/core/core/reactiveUtils.js";import c from"@arcgis/core/geometry/Extent.js";class u{_notImplemented(e){throw new Error("".concat(this.name," must implement ").concat(e,"()"))}isBaseMapReady(){this._notImplemented("isBaseMapReady")}addSymbolsToMap(){this._notImplemented("addSymbolsToMap")}addPatternsToMap(){this._notImplemented("addPatternsToMap")}getActiveSymbolImageId(){this._notImplemented("getActiveSymbolImageId")}getSelectedSymbolImageId(){this._notImplemented("getSelectedSymbolImageId")}}var v={animationDuration:200},d=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];var y=(e,t)=>{var r=null,n=function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];clearTimeout(r),r=setTimeout(()=>{e(...a)},t)};return n.cancel=()=>{r&&(clearTimeout(r),r=null)},n};function h(e){var{mapProvider:t,view:r,baseTileLayer:n,events:a,eventBus:o,getZoom:i,getCenter:s,getBounds:c,getResolution:u}=e,v=!1,d=[],h=[],f=e=>{var t=(()=>{if(v||!r||r.destroyed||!r.extent)return null;var{maxZoom:e,minZoom:t}=r.constraints;return{center:s(),bounds:c(),resolution:u(),zoom:i(),isAtMaxZoom:r.zoom+.01>=e,isAtMinZoom:r.zoom-.01<=t}})();t&&o.emit(e,t)};m(()=>n.loaded&&r.resolution>0,()=>f(a.MAP_LOADED)),l(()=>r.ready).then(()=>{v||(t.setBaseMapReady(!0),o.emit(a.MAP_READY,{map:t.map,view:t.view,mapStyleId:t.mapStyleId,mapSize:t.mapSize,crs:t.crs}))}),l(()=>r.stationary).then(()=>f(a.MAP_FIRST_IDLE));var g=y(()=>f(a.MAP_MOVE_END),500);h.push(g),d.push(p(()=>[r.interacting,r.animation],e=>{var[t,r]=e;(t||r)&&o.emit(a.MAP_MOVE_START),t||r||g()}));var w,x,b,M=(w=()=>f(a.MAP_MOVE),x=10,b=0,function(){var e=Date.now();e-b>=x&&(b=e,w(...arguments))});h.push(M),d.push(p(()=>r.zoom,M)),d.push(p(()=>r.extent,()=>o.emit(a.MAP_RENDER),{initial:!1}));var E=y(()=>f(a.MAP_DATA_CHANGE),500);h.push(E),d.push(p(()=>r.updating,e=>!e&&E()));var S=null,T=null;return d.push(r.on("pointer-down",e=>{S=e.x,T=e.y})),d.push(r.on("pointer-up",e=>{var n;if(0===e.button&&!(Math.hypot(e.x-S,e.y-T)>6)&&"active"!==(null===(n=t.sketchViewModel)||void 0===n?void 0:n.state)){var i={x:e.x,y:e.y},s=r.toMap(i);s&&o.emit(a.MAP_CLICK,{point:i,coords:[s.x,s.y]})}})),{remove(){v=!0,h.forEach(e=>e.cancel()),d.forEach(e=>e.remove())}}}var f=e=>e?new c({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:{wkid:27700}}):void 0,g=e=>e?new s({x:e[0],y:e[1],spatialReference:{wkid:27700}}):void 0,w=(e,t)=>{if(e)if("FeatureCollection"===e.type)e.features.forEach(e=>w(e,t));else if("Feature"===e.type)w(e.geometry,t);else if("GeometryCollection"===e.type)e.geometries.forEach(e=>w(e,t));else{var r=e=>{Array.isArray(e)&&("number"==typeof e[0]?t.push(e):e.forEach(r))};r(e.coordinates)}},x=e=>{var t=[];w(e,t);var r=t.map(e=>e[0]),n=t.map(e=>e[1]);return f([Math.min(...r),Math.min(...n),Math.max(...r),Math.max(...n)])},b=e=>{var t=1609.344,r=e/t;if(r<.5/t){var n=Math.round(e),a=1===n?"metre":"metres";return"".concat(n," ").concat(a)}if(r<10){var o=Number.parseFloat(r.toFixed(1)),i=1===o?"mile":"miles";return"".concat(o," ").concat(i)}var s=Math.round(r),m=1===s?"mile":"miles";return"".concat(s," ").concat(m)};var M={top:0,right:0,bottom:0,left:0};function E(){return(E=e(function*(e,t){if(!e||!t)return[];var r=e.map.layers.filter(e=>e instanceof i);return r.length?(yield e.hitTest(t,{include:r.toArray()})).results.map(e=>({layerId:e.layer.id,layerTitle:e.layer.title||e.layer.id,type:e.layer.type,geometry:e.graphic.geometry,symbol:e.graphic.symbol})):[]})).apply(this,arguments)}function S(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function T(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?S(Object(n),!0).forEach(function(r){t(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}class A extends u{constructor(e){var{mapProviderConfig:r={},events:n,eventBus:a}=e;super(),t(this,"_isBaseMapReady",!1),this.events=n,this.eventBus=a,this.capabilities={supportedShortcuts:d,supportsMapSizes:!1},Object.assign(this,r),this.mapEventHandles=[],this.appEventHandles=[]}get name(){return"EsriProvider"}initMap(t){var s=this;return e(function*(){var{container:e,padding:m,mapStyle:l,mapSize:p,maxExtent:c}=t;s.mapStyleId=null==l?void 0:l.id,s.mapSize=p;var{events:u,eventBus:v}=s;s.setupConfig&&(yield s.setupConfig(r));var d=new i({id:"baselayer",url:l.url,visible:!0}),y=new a({layers:[d]}),w=c?f(c):null,x=new o({spatialReference:27700,container:e,map:y,zoom:t.zoom,center:g(t.center),maxExtent:c,constraints:{lods:n.create({spatialReference:{wkid:27700}}).lods,snapToZoom:!1,minZoom:t.minZoom,maxZoom:t.maxZoom,maxScale:0,geometry:w,rotationEnabled:!1},ui:{components:[]},popupEnabled:!1});(e=>{if(e){var t=e.querySelector(".esri-view-surface");t.removeAttribute("role"),t.tabIndex=-1,t.style["outline-color"]="transparent",t.style.touchAction="none"}})(x.container),x.padding=m,t.bounds&&x.when(()=>x.goTo(f(t.bounds),{duration:0})),s.mapEventHandles=h({mapProvider:s,view:x,baseTileLayer:d,events:u,eventBus:v,getZoom:s.getZoom.bind(s),getCenter:s.getCenter.bind(s),getBounds:s.getBounds.bind(s),getResolution:s.getResolution.bind(s)}),s.appEventHandles=function(e){var{baseTileLayer:t,events:r,eventBus:n}=e,a=e=>{t.loadStyle(e.url).then(()=>{n.emit(r.MAP_STYLE_CHANGE,{mapStyleId:e.id})})};return n.on(r.MAP_SET_STYLE,a),{remove(){n.off(r.MAP_SET_STYLE,a)}}}({baseTileLayer:d,events:u,eventBus:v})||[],s.map=y,s.view=x,s.baseTileLayer=d})()}setBaseMapReady(e){this._isBaseMapReady=e}isBaseMapReady(){return this._isBaseMapReady}destroyMap(){var e,t;null===(e=this.mapEvents)||void 0===e||e.remove(),null===(t=this.appEvents)||void 0===t||t.remove(),this.mapEvents=null,this.appEvents=null,this.view&&(this.view.container=null,this.view.destroy(),this.view=null),this.map&&(this.map.removeAll(),this.map=null)}setView(e){var t,{center:r,zoom:n}=e;null===(t=this.view.animation)||void 0===t||t.destroy();var a={center:r?new s({x:r[0],y:r[1],spatialReference:{wkid:27700}}):this.view.center,zoom:null!=n?n:this.view.zoom};this.view.goTo(T(T({},a),{},{duration:v.animationDuration}))}zoomIn(e){var t;null===(t=this.view.animation)||void 0===t||t.destroy(),this.view.goTo({zoom:this.view.zoom+e,duration:v.animationDuration})}zoomOut(e){var t;null===(t=this.view.animation)||void 0===t||t.destroy(),this.view.goTo({zoom:this.view.zoom-e,duration:v.animationDuration})}panBy(e){var{x:t,y:r}=this.view.toScreen(this.view.center),n={x:t+e[0],y:r+e[1]},a=this.view.toMap(n);this.view.goTo({center:a,duration:v.animationDuration})}fitToBounds(e){var t=Array.isArray(e)?f(e):x(e);this.view.goTo(t,{duration:v.DELAY})}setPadding(e){this.view.padding=e}getCenter(){var e=this.view.center;return[e.x,e.y].map(e=>Math.round(100*e)/100)}getZoom(){return this.view.zoom}getBounds(){var{xmin:e,ymin:t,xmax:r,ymax:n}=this.view.extent;return[e,t,r,n].map(e=>Math.round(100*e)/100)}getFeaturesAtPoint(e,t){return function(e,t){return E.apply(this,arguments)}(this.view,e)}getVisibleFeatures(e){return[]}getAreaDimensions(){return(e=>{if(!(e&&e instanceof c))return"";var t=e.xmin,r=e.ymin,n=e.xmax,a=e.ymax-r,o=b(n-t),i=b(a);return"".concat(i," by ").concat(o)})(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:M;if(!e.container)return null;var{width:r,height:n}=e.container.getBoundingClientRect(),a={x:t.left,y:n-t.bottom},o={x:r-t.right,y:t.top},i=e.toMap(a),s=e.toMap(o);return new c({xmin:i.x,ymin:i.y,xmax:s.x,ymax:s.y,spatialReference:i.spatialReference})}(this.view))}getCardinalMove(e,t){return function(e,t){var[r,n]=e,[a,o]=t,i=a-r,s=o-n,m=[];return Math.abs(s)>.1&&m.push("".concat(s>0?"north":"south"," ").concat(b(Math.abs(s)))),Math.abs(i)>.1&&m.push("".concat(i>0?"east":"west"," ").concat(b(Math.abs(i)))),m.join(", ")}(e,t)}getResolution(){return this.view.resolution}mapToScreen(e){var t=g(e),r=this.view.toScreen(t);return{x:r.x,y:r.y}}screenToMap(e){var t=this.view.toMap(e);return[t.x,t.y]}isGeometryObscured(e,t){return((e,t,r)=>{if(null==r||!r.container)return!1;var n=r.container.getBoundingClientRect(),a=x(e),o=[r.toScreen(new s({x:a.xmin,y:a.ymin,spatialReference:a.spatialReference})),r.toScreen(new s({x:a.xmin,y:a.ymax,spatialReference:a.spatialReference})),r.toScreen(new s({x:a.xmax,y:a.ymin,spatialReference:a.spatialReference})),r.toScreen(new s({x:a.xmax,y:a.ymax,spatialReference:a.spatialReference}))],i=Math.min(...o.map(e=>e.x)),m=Math.max(...o.map(e=>e.x)),l=Math.min(...o.map(e=>e.y)),p=Math.max(...o.map(e=>e.y)),c=t.left-n.left,u=t.top-n.top,v=t.right-n.left,d=t.bottom-n.top;return i<v&&m>c&&l<d&&p>u})(e,t,this.view)}}export{A as default};
@@ -1 +0,0 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/asyncToGenerator";function t(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function o(r){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?t(Object(n),!0).forEach(function(t){e(r,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))})}return r}var n=document.documentMode,i="Internet Explorer is not supported",p={isSupported:!!Array.prototype.findLast},a=(e=>{if(!window.WebGLRenderingContext)return{isEnabled:!1,error:"WebGL is not supported"};var r=document.createElement("canvas"),t=!1;for(var o of e)try{if((t=r.getContext(o))&&"function"==typeof t.getParameter)return{isEnabled:!0}}catch(e){}return{isEnabled:!1,error:"WebGL is supported, but disabled"}})(["webgl2","webgl1"]);function c(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{checkDeviceCapabilities:()=>({isSupported:p.isSupported&&a.isEnabled&&!n,error:i}),load:(e=r(function*(){var e=o(o({},t),{},{crs:"EPSG:27700"});try{return{MapProvider:(yield import(/* webpackChunkName: "im-esri-provider" */ "./im-esri-provider.js")).default,mapProviderConfig:e}}catch(e){throw console.error("Failed to load map provider",e),e}}),function(){return e.apply(this,arguments)})}}export{c as default};
@@ -1 +0,0 @@
1
- import t from"@babel/runtime/helpers/asyncToGenerator";let e=" ";class r{static get separator(){return e}static set separator(t){e=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let r=null;switch(e.length){case 3:r=e[0]/1+e[1]/60+e[2]/3600;break;case 2:r=e[0]/1+e[1]/60;break;case 1:r=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(r=-r),Number(r)}static toDms(t,e="d",i=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===i)switch(e){case"d":case"deg":i=4;break;case"dm":case"deg+min":i=2;break;case"dms":case"deg+min+sec":i=0;break;default:e="d",i=4}t=Math.abs(t);let a=null,o=null,n=null,s=null;switch(e){default:case"d":case"deg":o=t.toFixed(i),o<100&&(o="0"+o),o<10&&(o="0"+o),a=o+"°";break;case"dm":case"deg+min":o=Math.floor(t),n=(60*t%60).toFixed(i),60==n&&(n=(0).toFixed(i),o++),o=("000"+o).slice(-3),n<10&&(n="0"+n),a=o+"°"+r.separator+n+"′";break;case"dms":case"deg+min+sec":o=Math.floor(t),n=Math.floor(3600*t/60)%60,s=(3600*t%60).toFixed(i),60==s&&(s=(0).toFixed(i),n++),60==n&&(n=0,o++),o=("000"+o).slice(-3),n=("00"+n).slice(-2),s<10&&(s="0"+s),a=o+"°"+r.separator+n+"′"+r.separator+s+"″"}return a}static toLat(t,e,i){const a=r.toDms(r.wrap90(t),e,i);return null===a?"–":a.slice(1)+r.separator+(t<0?"S":"N")}static toLon(t,e,i){const a=r.toDms(r.wrap180(t),e,i);return null===a?"–":a+r.separator+(t<0?"W":"E")}static toBrng(t,e,i){const a=r.toDms(r.wrap360(t),e,i);return null===a?"–":a.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(r.thousands,"⁜").replace(r.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",r.decimal).replace("⁜",r.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=r.wrap360(t);const i=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*i/360)%i*16/i]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t,r=360;return 1*Math.abs(((e-90)%r+r)%r-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};class i{constructor(t,e,r){if(isNaN(t)||isNaN(e)||isNaN(r))throw new TypeError(`invalid vector [${t},${e},${r}]`);this.x=Number(t),this.y=Number(e),this.z=Number(r)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(t){if(!(t instanceof i))throw new TypeError("v is not Vector3d object");return new i(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof i))throw new TypeError("v is not Vector3d object");return new i(this.x-t.x,this.y-t.y,this.z-t.z)}times(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new i(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new i(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof i))throw new TypeError("v is not Vector3d object");return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){if(!(t instanceof i))throw new TypeError("v is not Vector3d object");const e=this.y*t.z-this.z*t.y,r=this.z*t.x-this.x*t.z,a=this.x*t.y-this.y*t.x;return new i(e,r,a)}negate(){return new i(-this.x,-this.y,-this.z)}unit(){const t=this.length;if(1==t)return this;if(0==t)return this;const e=this.x/t,r=this.y/t,a=this.z/t;return new i(e,r,a)}angleTo(t,e=void 0){if(!(t instanceof i))throw new TypeError("v is not Vector3d object");if(!(e instanceof i||null==e))throw new TypeError("n is not Vector3d object");const r=null==e||this.cross(t).dot(e)>=0?1:-1,a=this.cross(t).length*r,o=this.dot(t);return Math.atan2(a,o)}rotateAround(t,e){if(!(t instanceof i))throw new TypeError("axis is not Vector3d object");const r=e.toRadians(),a=this.unit(),o=t.unit(),n=Math.sin(r),s=Math.cos(r),l=1-s,c=o.x,h=o.y,u=o.z,d=[[l*c*c+s,l*c*h-n*u,l*c*u+n*h],[l*c*h+n*u,l*h*h+s,l*h*u-n*c],[l*c*u-n*h,l*h*u+n*c,l*u*u+s]],p=[d[0][0]*a.x+d[0][1]*a.y+d[0][2]*a.z,d[1][0]*a.x+d[1][1]*a.y+d[1][2]*a.z,d[2][0]*a.x+d[2][1]*a.y+d[2][2]*a.z];return new i(p[0],p[1],p[2])}toString(t=3){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const a={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},o={WGS84:{ellipsoid:a.WGS84}};Object.freeze(a.WGS84),Object.freeze(o.WGS84);class n{constructor(t,e,i=0){if(isNaN(t)||null==t)throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e)||null==e)throw new TypeError(`invalid lon ‘${e}’`);if(isNaN(i)||null==i)throw new TypeError(`invalid height ‘${i}’`);this._lat=r.wrap90(Number(t)),this._lon=r.wrap180(Number(e)),this._height=Number(i)}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?r.wrap90(r.parse(t)):r.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?r.wrap90(r.parse(t)):r.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?r.wrap180(r.parse(t)):r.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?r.wrap180(r.parse(t)):r.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?r.wrap180(r.parse(t)):r.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}get height(){return this._height}set height(t){if(this._height=Number(t),isNaN(this._height))throw new TypeError(`invalid height ‘${t}’`)}get datum(){return this._datum}set datum(t){this._datum=t}static get ellipsoids(){return a}static get datums(){return o}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");let e,i,a;if("object"==typeof t[0]&&(1==t.length||!isNaN(parseFloat(t[1])))){const o=t[0];if("Point"==o.type&&Array.isArray(o.coordinates)?([i,e,a]=o.coordinates,a=a||0):(null!=o.latitude&&(e=o.latitude),null!=o.lat&&(e=o.lat),null!=o.longitude&&(i=o.longitude),null!=o.lng&&(i=o.lng),null!=o.lon&&(i=o.lon),null!=o.height&&(a=o.height),e=r.wrap90(r.parse(e)),i=r.wrap180(r.parse(i))),null!=t[1]&&(a=t[1]),isNaN(e)||isNaN(i))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if("string"==typeof t[0]&&2==t[0].split(",").length&&([e,i]=t[0].split(","),e=r.wrap90(r.parse(e)),i=r.wrap180(r.parse(i)),a=t[1]||0,isNaN(e)||isNaN(i)))throw new TypeError(`invalid point ‘${t[0]}’`);if(null==e&&null==i&&([e,i]=t,e=r.wrap90(r.parse(e)),i=r.wrap180(r.parse(i)),a=t[2]||0,isNaN(e)||isNaN(i)))throw new TypeError(`invalid point ‘${t.toString()}’`);return new this(e,i,a)}toCartesian(){const t=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:a.WGS84,e=this.lat.toRadians(),r=this.lon.toRadians(),i=this.height,{a:o,f:n}=t,l=Math.sin(e),c=Math.cos(e),h=Math.sin(r),u=Math.cos(r),d=2*n-n*n,p=o/Math.sqrt(1-d*l*l);return new s((p+i)*c*u,(p+i)*c*h,(p*(1-d)+i)*l)}equals(t){if(!(t instanceof n))throw new TypeError(`invalid point ‘${t}’`);return!(Math.abs(this.lat-t.lat)>Number.EPSILON)&&(!(Math.abs(this.lon-t.lon)>Number.EPSILON)&&(!(Math.abs(this.height-t.height)>Number.EPSILON)&&(this.datum==t.datum&&(this.referenceFrame==t.referenceFrame&&this.epoch==t.epoch))))}toString(t="d",e=void 0,i=null){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);const a=(this.height>=0?" +":" ")+this.height.toFixed(i)+"m";if("n"==t){null==e&&(e=4);return`${this.lat.toFixed(e)}, ${this.lon.toFixed(e)}${null==i?"":a}`}return`${r.toLat(this.lat,t,e)}, ${r.toLon(this.lon,t,e)}${null==i?"":a}`}}class s extends i{constructor(t,e,r){super(t,e,r)}toLatLon(t=a.WGS84){if(!t||!t.a)throw new TypeError(`invalid ellipsoid ‘${t}’`);const{x:e,y:r,z:i}=this,{a:o,b:s,f:l}=t,c=2*l-l*l,h=c/(1-c),u=Math.sqrt(e*e+r*r),d=s*i/(o*u)*(1+h*s/Math.sqrt(u*u+i*i)),p=d/Math.sqrt(1+d*d),m=p/d,f=isNaN(m)?0:Math.atan2(i+h*s*p*p*p,u-c*o*m*m*m),g=Math.atan2(r,e),y=Math.sin(f),w=u*Math.cos(f)+i*y-o*o/(o/Math.sqrt(1-c*y*y));return new n(f.toDegrees(),g.toDegrees(),w)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const l={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},c={ED50:{ellipsoid:l.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:l.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:l.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:l.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:l.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:l.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:l.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:l.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:l.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:l.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:l.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(l).forEach(t=>Object.freeze(l[t])),Object.keys(c).forEach(t=>{Object.freeze(c[t]),Object.freeze(c[t].transform)});class h extends n{constructor(t,e,r=0,i=c.WGS84){if(!i||null==i.ellipsoid)throw new TypeError(`unrecognised datum ‘${i}’`);super(t,e,r),this._datum=i}get datum(){return this._datum}static get ellipsoids(){return l}static get datums(){return c}static parse(...t){let e=c.WGS84;if((4==t.length||3==t.length&&"object"==typeof t[2])&&(e=t.pop()),!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.parse(...t);return r._datum=e,r}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);return this.toCartesian().convertDatum(t).toLatLon()}toCartesian(){const t=super.toCartesian();return new u(t.x,t.y,t.z,this.datum)}}class u extends s{constructor(t,e,r,i=void 0){if(i&&null==i.ellipsoid)throw new TypeError(`unrecognised datum ‘${i}’`);super(t,e,r),i&&(this._datum=i)}get datum(){return this._datum}set datum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);this._datum=t}toLatLon(t=void 0){t&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=t);const e=this.datum||c.WGS84;if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.toLatLon(e.ellipsoid);return new h(r.lat,r.lon,r.height,this.datum)}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);if(!this.datum)throw new TypeError("cartesian coordinate has no datum");let e=null,r=null;null!=this.datum&&this.datum!=c.WGS84||(e=this,r=t.transform),t==c.WGS84&&(e=this,r=this.datum.transform.map(t=>-t)),null==r&&(e=this.convertDatum(c.WGS84),r=t.transform);const i=e.applyTransform(r);return i.datum=t,i}applyTransform(t){const{x:e,y:r,z:i}=this,a=t[0],o=t[1],n=t[2],s=t[3]/1e6+1,l=(t[4]/3600).toRadians(),c=(t[5]/3600).toRadians(),h=(t[6]/3600).toRadians();return new u(a+e*s-r*h+i*c,o+e*h+r*s-i*l,n-e*c+r*l+i*s)}}const d={trueOrigin:{lat:49,lon:-2},scaleFactor:.9996012717,ellipsoid:h.ellipsoids.Airy1830};class p{constructor(t,e){if(this.easting=Number(t),this.northing=Number(e),isNaN(t)||this.easting<0||this.easting>7e5)throw new RangeError(`invalid easting ‘${t}’`);if(isNaN(e)||this.northing<0||this.northing>13e5)throw new RangeError(`invalid northing ‘${e}’`)}toLatLon(t=h.datums.WGS84){const{easting:e,northing:r}=this,{a:i,b:a}=d.ellipsoid,o=d.trueOrigin.lat.toRadians(),n=d.trueOrigin.lon.toRadians(),s=-1e5,l=d.scaleFactor,c=1-a*a/(i*i),u=(i-a)/(i+a),p=u*u,f=u*u*u;let g=o,y=0;do{g=(r-s-y)/(i*l)+g;y=a*l*((1+u+5/4*p+5/4*f)*(g-o)-(3*u+3*u*u+21/8*f)*Math.sin(g-o)*Math.cos(g+o)+(15/8*p+15/8*f)*Math.sin(2*(g-o))*Math.cos(2*(g+o))-35/24*f*Math.sin(3*(g-o))*Math.cos(3*(g+o)))}while(Math.abs(r-s-y)>=1e-5);const w=Math.cos(g),N=Math.sin(g),_=i*l/Math.sqrt(1-c*N*N),E=i*l*(1-c)/Math.pow(1-c*N*N,1.5),b=_/E-1,S=Math.tan(g),M=S*S,v=M*M,$=1/w,T=_*_*_,x=T*_*_,G=e-4e5,R=G*G,W=R*G,F=R*R,O=W*R;g=g-S/(2*E*_)*R+S/(24*E*T)*(5+3*M+b-9*M*b)*F-S/(720*E*x)*(61+90*M+45*v)*(F*R);const L=n+$/_*G-$/(6*T)*(_/E+2*M)*W+$/(120*x)*(5+28*M+24*v)*O-$/(5040*(x*_*_))*(61+662*M+1320*v+720*(v*M))*(O*R);let z=new m(g.toDegrees(),L.toDegrees(),0,h.datums.OSGB36);return t!=h.datums.OSGB36&&(z=z.convertDatum(t),z=new m(z.lat,z.lon,z.height,z.datum)),z}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new p(e[1],e[2]);if(e=t.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i),!e)throw new Error(`invalid grid reference ‘${t}’`);let r=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),i=t.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);r>7&&r--,i>7&&i--;const a=(r-2)%5*5+i%5,o=19-5*Math.floor(r/5)-Math.floor(i/5);let n=t.slice(2).trim().split(/\s+/);if(1==n.length&&(n=[n[0].slice(0,n[0].length/2),n[0].slice(n[0].length/2)]),n[0].length!=n[1].length)throw new Error(`invalid grid reference ‘${t}’`);n[0]=n[0].padEnd(5,"0"),n[1]=n[1].padEnd(5,"0");const s=a+n[0],l=o+n[1];return new p(s,l)}toString(t=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(t)))throw new RangeError(`invalid precision ‘${t}’`);let{easting:e,northing:r}=this;if(0==t){const t={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3};return`${e.toLocaleString("en",t)},${r.toLocaleString("en",t)}`}const i=Math.floor(e/1e5),a=Math.floor(r/1e5);let o=19-a-(19-a)%5+Math.floor((i+10)/5),n=5*(19-a)%25+i%5;o>7&&o++,n>7&&n++;const s=String.fromCharCode(o+"A".charCodeAt(0),n+"A".charCodeAt(0));return e=Math.floor(e%1e5/Math.pow(10,5-t/2)),r=Math.floor(r%1e5/Math.pow(10,5-t/2)),e=e.toString().padStart(t/2,"0"),r=r.toString().padStart(t/2,"0"),`${s} ${e} ${r}`}}class m extends h{toOsGrid(){const t=this.datum==h.datums.OSGB36?this:this.convertDatum(h.datums.OSGB36),e=t.lat.toRadians(),r=t.lon.toRadians(),{a:i,b:a}=d.ellipsoid,o=d.trueOrigin.lat.toRadians(),n=d.trueOrigin.lon.toRadians(),s=d.scaleFactor,l=1-a*a/(i*i),c=(i-a)/(i+a),u=c*c,m=c*c*c,f=Math.cos(e),g=Math.sin(e),y=i*s/Math.sqrt(1-l*g*g),w=i*s*(1-l)/Math.pow(1-l*g*g,1.5),N=y/w-1,_=a*s*((1+c+5/4*u+5/4*m)*(e-o)-(3*c+3*c*c+21/8*m)*Math.sin(e-o)*Math.cos(e+o)+(15/8*u+15/8*m)*Math.sin(2*(e-o))*Math.cos(2*(e+o))-35/24*m*Math.sin(3*(e-o))*Math.cos(3*(e+o))),E=f*f*f,b=E*f*f,S=Math.tan(e)*Math.tan(e),M=S*S,v=r-n,$=v*v,T=$*v,x=T*v,G=x*v;let R=_+-1e5+y/2*g*f*$+y/24*g*E*(5-S+9*N)*x+y/720*g*b*(61-58*S+M)*(G*v),W=4e5+y*f*v+y/6*E*(y/w-S)*T+y/120*b*(5-18*S+M+14*N-58*S*N)*G;R=Number(R.toFixed(3)),W=Number(W.toFixed(3));try{return new p(W,R)}catch(e){throw new Error(`${e.message} from (${t.lat.toFixed(6)},${t.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(t){const e=super.convertDatum(t);return new m(e.lat,e.lon,e.height,e.datum)}}var f=function(){var e=t(function*(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://api.os.uk/search/names/v1/nearest?point={easting},{northing}&radius=1000&fq=local_type:Airfield%20local_type:Airport%20local_type:Bus_Station%20local_type:Chemical_Works%20local_type:City%20local_type:Coach_Station%20local_type:Electricity_Distribution%20local_type:Electricity_Production%20local_type:Further_Education%20local_type:Gas_Distribution_or_Storage%20local_type:Hamlet%20local_type:Harbour%20local_type:Helicopter_Station%20local_type:Heliport%20local_type:Higher_or_University_Education%20local_type:Hill_Or_Mountain%20local_type:Hospice%20local_type:Hospital%20local_type:Medical_Care_Accommodation%20local_type:Named_Road%20local_type:Non_State_Primary_Education%20local_type:Non_State_Secondary_Education%20local_type:Other_Settlement%20local_type:Passenger_Ferry_Terminal%20local_type:Port_Consisting_of_Docks_and_Nautical_Berthing%20local_type:Postcode%20local_type:Primary_Education%20local_type:Railway_Station%20local_type:Road_User_Services%20local_type:Secondary_Education%20local_type:Section_Of_Named_Road%20local_type:Section_Of_Numbered_Road%20local_type:Special_Needs_Education%20local_type:Suburban_Area%20local_type:Town%20local_type:Urban_Greenspace%20local_type:Vehicular_Ferry_Terminal%20local_type:Vehicular_Rail_Terminal%20local_type:Village%20local_type:Waterfall%20",e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>4?arguments[4]:void 0,a=i;if("EPSG:4326"===r)try{a=[(a=new m(i[1],i[0]).toOsGrid()).easting,a.northing].map(t=>Math.round(t))}catch(t){return console.log(t),null}t=t.replace("{easting}",Math.round(a[0])).replace("{northing}",Math.round(a[1]));var o=new Request(t,{method:"GET"});if(e)try{o=yield e(o)}catch(t){return console.log("Error transforming request:",t),null}var n=yield fetch(o),s=yield n.json(),l=function(t){var{ID:e,NAME1:r,POPULATED_PLACE:i,COUNTY_UNITARY:a,REGION:o,GEOMETRY_X:n,GEOMETRY_Y:s}=t;return{id:e||"",place:"".concat(r).concat(i?", "+i:"").concat(a?", "+a:"",", ").concat(o),county:a||"",coordinates:[n,s]}}(s.results[0].GAZETTEER_ENTRY);if("EPSG:4326"===r){var c=new p(l.coordinates[0],l.coordinates[1]).toLatLon();l.coordinates=[c.lat,c.lon]}var h="Approximate centre ".concat(null==l?void 0:l.place);return s.results?h:null});return function(){return e.apply(this,arguments)}}();export{f as reverseGeocode};
@@ -1 +0,0 @@
1
- import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/defineProperty";function t(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function o(e){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?t(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function n(){var r;return o(o({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{load:(r=e(function*(){return(yield import(/* webpackChunkName: "im-reverse-geocode" */ "./im-reverse-geocode.js")).reverseGeocode}),function(){return r.apply(this,arguments)})})}export{n as default};
@@ -1,2 +0,0 @@
1
- /*! For license information please see im-reverse-geocode.js.LICENSE.txt */
2
- "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[627],{863(t,e,r){r.r(e),r.d(e,{reverseGeocode:()=>v});let n=" ";class i{static get separator(){return n}static set separator(t){n=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let r=null;switch(e.length){case 3:r=e[0]/1+e[1]/60+e[2]/3600;break;case 2:r=e[0]/1+e[1]/60;break;case 1:r=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(r=-r),Number(r)}static toDms(t,e="d",r=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===r)switch(e){case"d":case"deg":r=4;break;case"dm":case"deg+min":r=2;break;case"dms":case"deg+min+sec":r=0;break;default:e="d",r=4}t=Math.abs(t);let n=null,a=null,o=null,s=null;switch(e){default:case"d":case"deg":a=t.toFixed(r),a<100&&(a="0"+a),a<10&&(a="0"+a),n=a+"°";break;case"dm":case"deg+min":a=Math.floor(t),o=(60*t%60).toFixed(r),60==o&&(o=(0).toFixed(r),a++),a=("000"+a).slice(-3),o<10&&(o="0"+o),n=a+"°"+i.separator+o+"′";break;case"dms":case"deg+min+sec":a=Math.floor(t),o=Math.floor(3600*t/60)%60,s=(3600*t%60).toFixed(r),60==s&&(s=(0).toFixed(r),o++),60==o&&(o=0,a++),a=("000"+a).slice(-3),o=("00"+o).slice(-2),s<10&&(s="0"+s),n=a+"°"+i.separator+o+"′"+i.separator+s+"″"}return n}static toLat(t,e,r){const n=i.toDms(i.wrap90(t),e,r);return null===n?"–":n.slice(1)+i.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=i.toDms(i.wrap180(t),e,r);return null===n?"–":n+i.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=i.toDms(i.wrap360(t),e,r);return null===n?"–":n.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(r.thousands,"⁜").replace(r.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",r.decimal).replace("⁜",r.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=i.wrap360(t);const r=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*r/360)%r*16/r]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t;return 1*Math.abs(((e-90)%360+360)%360-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const a=i;class o{constructor(t,e,r){if(isNaN(t)||isNaN(e)||isNaN(r))throw new TypeError(`invalid vector [${t},${e},${r}]`);this.x=Number(t),this.y=Number(e),this.z=Number(r)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(t){if(!(t instanceof o))throw new TypeError("v is not Vector3d object");return new o(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof o))throw new TypeError("v is not Vector3d object");return new o(this.x-t.x,this.y-t.y,this.z-t.z)}times(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new o(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new o(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof o))throw new TypeError("v is not Vector3d object");return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){if(!(t instanceof o))throw new TypeError("v is not Vector3d object");const e=this.y*t.z-this.z*t.y,r=this.z*t.x-this.x*t.z,n=this.x*t.y-this.y*t.x;return new o(e,r,n)}negate(){return new o(-this.x,-this.y,-this.z)}unit(){const t=this.length;if(1==t)return this;if(0==t)return this;const e=this.x/t,r=this.y/t,n=this.z/t;return new o(e,r,n)}angleTo(t,e=void 0){if(!(t instanceof o))throw new TypeError("v is not Vector3d object");if(!(e instanceof o||null==e))throw new TypeError("n is not Vector3d object");const r=null==e||this.cross(t).dot(e)>=0?1:-1,n=this.cross(t).length*r,i=this.dot(t);return Math.atan2(n,i)}rotateAround(t,e){if(!(t instanceof o))throw new TypeError("axis is not Vector3d object");const r=e.toRadians(),n=this.unit(),i=t.unit(),a=Math.sin(r),s=Math.cos(r),l=1-s,c=i.x,u=i.y,h=i.z,d=[[l*c*c+s,l*c*u-a*h,l*c*h+a*u],[l*c*u+a*h,l*u*u+s,l*u*h-a*c],[l*c*h-a*u,l*u*h+a*c,l*h*h+s]],p=[d[0][0]*n.x+d[0][1]*n.y+d[0][2]*n.z,d[1][0]*n.x+d[1][1]*n.y+d[1][2]*n.z,d[2][0]*n.x+d[2][1]*n.y+d[2][2]*n.z];return new o(p[0],p[1],p[2])}toString(t=3){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const s=o,l={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},c={WGS84:{ellipsoid:l.WGS84}};Object.freeze(l.WGS84),Object.freeze(c.WGS84);class u{constructor(t,e,r=0){if(isNaN(t)||null==t)throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e)||null==e)throw new TypeError(`invalid lon ‘${e}’`);if(isNaN(r)||null==r)throw new TypeError(`invalid height ‘${r}’`);this._lat=a.wrap90(Number(t)),this._lon=a.wrap180(Number(e)),this._height=Number(r)}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?a.wrap90(a.parse(t)):a.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?a.wrap90(a.parse(t)):a.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?a.wrap180(a.parse(t)):a.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?a.wrap180(a.parse(t)):a.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?a.wrap180(a.parse(t)):a.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}get height(){return this._height}set height(t){if(this._height=Number(t),isNaN(this._height))throw new TypeError(`invalid height ‘${t}’`)}get datum(){return this._datum}set datum(t){this._datum=t}static get ellipsoids(){return l}static get datums(){return c}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");let e,r,n;if("object"==typeof t[0]&&(1==t.length||!isNaN(parseFloat(t[1])))){const i=t[0];if("Point"==i.type&&Array.isArray(i.coordinates)?([r,e,n]=i.coordinates,n=n||0):(null!=i.latitude&&(e=i.latitude),null!=i.lat&&(e=i.lat),null!=i.longitude&&(r=i.longitude),null!=i.lng&&(r=i.lng),null!=i.lon&&(r=i.lon),null!=i.height&&(n=i.height),e=a.wrap90(a.parse(e)),r=a.wrap180(a.parse(r))),null!=t[1]&&(n=t[1]),isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if("string"==typeof t[0]&&2==t[0].split(",").length&&([e,r]=t[0].split(","),e=a.wrap90(a.parse(e)),r=a.wrap180(a.parse(r)),n=t[1]||0,isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t[0]}’`);if(null==e&&null==r&&([e,r]=t,e=a.wrap90(a.parse(e)),r=a.wrap180(a.parse(r)),n=t[2]||0,isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t.toString()}’`);return new this(e,r,n)}toCartesian(){const t=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:l.WGS84,e=this.lat.toRadians(),r=this.lon.toRadians(),n=this.height,{a:i,f:a}=t,o=Math.sin(e),s=Math.cos(e),c=Math.sin(r),u=Math.cos(r),d=2*a-a*a,p=i/Math.sqrt(1-d*o*o);return new h((p+n)*s*u,(p+n)*s*c,(p*(1-d)+n)*o)}equals(t){if(!(t instanceof u))throw new TypeError(`invalid point ‘${t}’`);return!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON||Math.abs(this.height-t.height)>Number.EPSILON||this.datum!=t.datum||this.referenceFrame!=t.referenceFrame||this.epoch!=t.epoch)}toString(t="d",e=void 0,r=null){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);const n=(this.height>=0?" +":" ")+this.height.toFixed(r)+"m";return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)}, ${this.lon.toFixed(e)}${null==r?"":n}`):`${a.toLat(this.lat,t,e)}, ${a.toLon(this.lon,t,e)}${null==r?"":n}`}}class h extends s{constructor(t,e,r){super(t,e,r)}toLatLon(t=l.WGS84){if(!t||!t.a)throw new TypeError(`invalid ellipsoid ‘${t}’`);const{x:e,y:r,z:n}=this,{a:i,b:a,f:o}=t,s=2*o-o*o,c=s/(1-s),h=Math.sqrt(e*e+r*r),d=a*n/(i*h)*(1+c*a/Math.sqrt(h*h+n*n)),p=d/Math.sqrt(1+d*d),f=p/d,m=isNaN(f)?0:Math.atan2(n+c*a*p*p*p,h-s*i*f*f*f),g=Math.atan2(r,e),y=Math.sin(m),w=h*Math.cos(m)+n*y-i*i/(i/Math.sqrt(1-s*y*y));return new u(m.toDegrees(),g.toDegrees(),w)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const d={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},p={ED50:{ellipsoid:d.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:d.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:d.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:d.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:d.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:d.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:d.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:d.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:d.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:d.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:d.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(d).forEach(t=>Object.freeze(d[t])),Object.keys(p).forEach(t=>{Object.freeze(p[t]),Object.freeze(p[t].transform)});class f extends u{constructor(t,e,r=0,n=p.WGS84){if(!n||null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(t,e,r),this._datum=n}get datum(){return this._datum}static get ellipsoids(){return d}static get datums(){return p}static parse(...t){let e=p.WGS84;if((4==t.length||3==t.length&&"object"==typeof t[2])&&(e=t.pop()),!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.parse(...t);return r._datum=e,r}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);return this.toCartesian().convertDatum(t).toLatLon()}toCartesian(){const t=super.toCartesian();return new m(t.x,t.y,t.z,this.datum)}}class m extends h{constructor(t,e,r,n=void 0){if(n&&null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(t,e,r),n&&(this._datum=n)}get datum(){return this._datum}set datum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);this._datum=t}toLatLon(t=void 0){t&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=t);const e=this.datum||p.WGS84;if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.toLatLon(e.ellipsoid);return new f(r.lat,r.lon,r.height,this.datum)}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);if(!this.datum)throw new TypeError("cartesian coordinate has no datum");let e=null,r=null;null!=this.datum&&this.datum!=p.WGS84||(e=this,r=t.transform),t==p.WGS84&&(e=this,r=this.datum.transform.map(t=>-t)),null==r&&(e=this.convertDatum(p.WGS84),r=t.transform);const n=e.applyTransform(r);return n.datum=t,n}applyTransform(t){const{x:e,y:r,z:n}=this,i=t[0],a=t[1],o=t[2],s=t[3]/1e6+1,l=(t[4]/3600).toRadians(),c=(t[5]/3600).toRadians(),u=(t[6]/3600).toRadians();return new m(i+e*s-r*u+n*c,a+e*u+r*s-n*l,o-e*c+r*l+n*s)}}const g={trueOrigin:{lat:49,lon:-2},falseOrigin:{easting:-4e5,northing:1e5},scaleFactor:.9996012717,ellipsoid:f.ellipsoids.Airy1830};class y{constructor(t,e){if(this.easting=Number(t),this.northing=Number(e),isNaN(t)||this.easting<0||this.easting>7e5)throw new RangeError(`invalid easting ‘${t}’`);if(isNaN(e)||this.northing<0||this.northing>13e5)throw new RangeError(`invalid northing ‘${e}’`)}toLatLon(t=f.datums.WGS84){const{easting:e,northing:r}=this,{a:n,b:i}=g.ellipsoid,a=g.trueOrigin.lat.toRadians(),o=g.trueOrigin.lon.toRadians(),s=-g.falseOrigin.easting,l=-g.falseOrigin.northing,c=g.scaleFactor,u=1-i*i/(n*n),h=(n-i)/(n+i),d=h*h,p=h*h*h;let m=a,y=0;do{m=(r-l-y)/(n*c)+m,y=i*c*((1+h+5/4*d+5/4*p)*(m-a)-(3*h+3*h*h+21/8*p)*Math.sin(m-a)*Math.cos(m+a)+(15/8*d+15/8*p)*Math.sin(2*(m-a))*Math.cos(2*(m+a))-35/24*p*Math.sin(3*(m-a))*Math.cos(3*(m+a)))}while(Math.abs(r-l-y)>=1e-5);const _=Math.cos(m),N=Math.sin(m),b=n*c/Math.sqrt(1-u*N*N),E=n*c*(1-u)/Math.pow(1-u*N*N,1.5),v=b/E-1,S=Math.tan(m),M=S*S,T=M*M,$=1/_,x=b*b*b,G=x*b*b,O=e-s,F=O*O,R=F*O,W=F*F,D=R*F;m=m-S/(2*E*b)*F+S/(24*E*x)*(5+3*M+v-9*M*v)*W-S/(720*E*G)*(61+90*M+45*T)*(W*F);const L=o+$/b*O-$/(6*x)*(b/E+2*M)*R+$/(120*G)*(5+28*M+24*T)*D-$/(G*b*b*5040)*(61+662*M+1320*T+T*M*720)*(D*F);let z=new w(m.toDegrees(),L.toDegrees(),0,f.datums.OSGB36);return t!=f.datums.OSGB36&&(z=z.convertDatum(t),z=new w(z.lat,z.lon,z.height,z.datum)),z}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new y(e[1],e[2]);if(e=t.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i),!e)throw new Error(`invalid grid reference ‘${t}’`);let r=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),n=t.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);r>7&&r--,n>7&&n--;const i=(r-2)%5*5+n%5,a=19-5*Math.floor(r/5)-Math.floor(n/5);let o=t.slice(2).trim().split(/\s+/);if(1==o.length&&(o=[o[0].slice(0,o[0].length/2),o[0].slice(o[0].length/2)]),o[0].length!=o[1].length)throw new Error(`invalid grid reference ‘${t}’`);o[0]=o[0].padEnd(5,"0"),o[1]=o[1].padEnd(5,"0");const s=i+o[0],l=a+o[1];return new y(s,l)}toString(t=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(t)))throw new RangeError(`invalid precision ‘${t}’`);let{easting:e,northing:r}=this;if(0==t){const t={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3};return`${e.toLocaleString("en",t)},${r.toLocaleString("en",t)}`}const n=Math.floor(e/1e5),i=Math.floor(r/1e5);let a=19-i-(19-i)%5+Math.floor((n+10)/5),o=5*(19-i)%25+n%5;a>7&&a++,o>7&&o++;const s=String.fromCharCode(a+"A".charCodeAt(0),o+"A".charCodeAt(0));return e=Math.floor(e%1e5/Math.pow(10,5-t/2)),r=Math.floor(r%1e5/Math.pow(10,5-t/2)),e=e.toString().padStart(t/2,"0"),r=r.toString().padStart(t/2,"0"),`${s} ${e} ${r}`}}class w extends f{toOsGrid(){const t=this.datum==f.datums.OSGB36?this:this.convertDatum(f.datums.OSGB36),e=t.lat.toRadians(),r=t.lon.toRadians(),{a:n,b:i}=g.ellipsoid,a=g.trueOrigin.lat.toRadians(),o=g.trueOrigin.lon.toRadians(),s=-g.falseOrigin.easting,l=-g.falseOrigin.northing,c=g.scaleFactor,u=1-i*i/(n*n),h=(n-i)/(n+i),d=h*h,p=h*h*h,m=Math.cos(e),w=Math.sin(e),_=n*c/Math.sqrt(1-u*w*w),N=n*c*(1-u)/Math.pow(1-u*w*w,1.5),b=_/N-1,E=i*c*((1+h+5/4*d+5/4*p)*(e-a)-(3*h+3*h*h+21/8*p)*Math.sin(e-a)*Math.cos(e+a)+(15/8*d+15/8*p)*Math.sin(2*(e-a))*Math.cos(2*(e+a))-35/24*p*Math.sin(3*(e-a))*Math.cos(3*(e+a))),v=m*m*m,S=v*m*m,M=Math.tan(e)*Math.tan(e),T=M*M,$=r-o,x=$*$,G=x*$,O=G*$,F=O*$;let R=E+l+_/2*w*m*x+_/24*w*v*(5-M+9*b)*O+_/720*w*S*(61-58*M+T)*(F*$),W=s+_*m*$+_/6*v*(_/N-M)*G+_/120*S*(5-18*M+T+14*b-58*M*b)*F;R=Number(R.toFixed(3)),W=Number(W.toFixed(3));try{return new y(W,R)}catch(e){throw new Error(`${e.message} from (${t.lat.toFixed(6)},${t.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(t){const e=super.convertDatum(t);return new w(e.lat,e.lon,e.height,e.datum)}}function _(t){var e=t.ID,r=t.NAME1,n=t.POPULATED_PLACE,i=t.COUNTY_UNITARY,a=t.REGION,o=t.GEOMETRY_X,s=t.GEOMETRY_Y;return{id:e||"",place:"".concat(r).concat(n?", "+n:"").concat(i?", "+i:"",", ").concat(a),county:i||"",coordinates:[o,s]}}function N(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function a(r,n,i,a){var l=n&&n.prototype instanceof s?n:s,c=Object.create(l.prototype);return b(c,"_invoke",function(r,n,i){var a,s,l,c=0,u=i||[],h=!1,d={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return a=e,s=0,l=t,d.n=r,o}};function p(r,n){for(s=r,l=n,e=0;!h&&c&&!i&&e<u.length;e++){var i,a=u[e],p=d.p,f=a[2];r>3?(i=f===n)&&(l=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=t):a[0]<=p&&((i=r<2&&p<a[1])?(s=0,d.v=n,d.n=a[1]):p<f&&(i=r<3||a[0]>n||n>f)&&(a[4]=r,a[5]=n,d.n=f,s=0))}if(i||r>1)return o;throw h=!0,n}return function(i,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),s=u,l=f;(e=s<2?t:l)||!h;){a||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(c=2,a){if(s||(i="next"),e=a[i]){if(!(e=e.call(a,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=a.return)&&e.call(a),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=t}else if((e=(h=d.n<0)?l:r.call(n,d))!==o)break}catch(e){a=t,s=1,l=e}finally{c=1}}return{value:e,done:h}}}(r,i,a),!0),c}var o={};function s(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(b(e={},n,function(){return this}),e),h=c.prototype=s.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,b(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=c,b(h,"constructor",c),b(c,"constructor",l),l.displayName="GeneratorFunction",b(c,i,"GeneratorFunction"),b(h),b(h,i,"Generator"),b(h,n,function(){return this}),b(h,"toString",function(){return"[object Generator]"}),(N=function(){return{w:a,m:d}})()}function b(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}b=function(t,e,r,n){function a(e,r){b(t,e,function(t){return this._invoke(e,r,t)})}e?i?i(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},b(t,e,r,n)}function E(t,e,r,n,i,a,o){try{var s=t[a](o),l=s.value}catch(t){return void r(t)}s.done?e(l):Promise.resolve(l).then(n,i)}var v=function(){var t,e=(t=N().m(function t(){var e,r,n,i,a,o,s,l,c,u,h,d,p,f,m=arguments;return N().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e=m.length>0&&void 0!==m[0]?m[0]:"https://api.os.uk/search/names/v1/nearest?point={easting},{northing}&radius=1000&fq=local_type:Airfield%20local_type:Airport%20local_type:Bus_Station%20local_type:Chemical_Works%20local_type:City%20local_type:Coach_Station%20local_type:Electricity_Distribution%20local_type:Electricity_Production%20local_type:Further_Education%20local_type:Gas_Distribution_or_Storage%20local_type:Hamlet%20local_type:Harbour%20local_type:Helicopter_Station%20local_type:Heliport%20local_type:Higher_or_University_Education%20local_type:Hill_Or_Mountain%20local_type:Hospice%20local_type:Hospital%20local_type:Medical_Care_Accommodation%20local_type:Named_Road%20local_type:Non_State_Primary_Education%20local_type:Non_State_Secondary_Education%20local_type:Other_Settlement%20local_type:Passenger_Ferry_Terminal%20local_type:Port_Consisting_of_Docks_and_Nautical_Berthing%20local_type:Postcode%20local_type:Primary_Education%20local_type:Railway_Station%20local_type:Road_User_Services%20local_type:Secondary_Education%20local_type:Section_Of_Named_Road%20local_type:Section_Of_Numbered_Road%20local_type:Special_Needs_Education%20local_type:Suburban_Area%20local_type:Town%20local_type:Urban_Greenspace%20local_type:Vehicular_Ferry_Terminal%20local_type:Vehicular_Rail_Terminal%20local_type:Village%20local_type:Waterfall%20",r=m.length>1?m[1]:void 0,a=i=m.length>4?m[4]:void 0,"EPSG:4326"!==(n=m.length>2?m[2]:void 0)){t.n=3;break}t.p=1,a=[(a=new w(i[1],i[0]).toOsGrid()).easting,a.northing].map(function(t){return Math.round(t)}),t.n=3;break;case 2:return t.p=2,p=t.v,console.log(p),t.a(2,null);case 3:if(e=e.replace("{easting}",Math.round(a[0])).replace("{northing}",Math.round(a[1])),o=new Request(e,{method:"GET"}),!r){t.n=7;break}return t.p=4,t.n=5,r(o);case 5:o=t.v,t.n=7;break;case 6:return t.p=6,f=t.v,console.log("Error transforming request:",f),t.a(2,null);case 7:return t.n=8,fetch(o);case 8:return s=t.v,t.n=9,s.json();case 9:return l=t.v,c=_(l.results[0].GAZETTEER_ENTRY),"EPSG:4326"===n&&(u=new y(c.coordinates[0],c.coordinates[1]),h=u.toLatLon(),c.coordinates=[h.lat,h.lon]),d="Approximate centre ".concat(null==c?void 0:c.place),t.a(2,l.results?d:null)}},t,null,[[4,6],[1,2]])}),function(){var e=this,r=arguments;return new Promise(function(n,i){var a=t.apply(e,r);function o(t){E(a,n,i,o,s,"next",t)}function s(t){E(a,n,i,o,s,"throw",t)}o(void 0)})});return function(){return e.apply(this,arguments)}}()}}]);
@@ -1,2 +0,0 @@
1
- /*! For license information please see index.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.openNamesProvider=t())}(this,()=>(()=>{"use strict";var e,t,r={},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.m=r,o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>"im-reverse-geocode.js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="defra.openNamesProvider:",o.l=(r,n,i,a)=>{if(e[r])e[r].push(n);else{var c,u;if(void 0!==i)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var l=f[p];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+i){c=l;break}}c||(u=!0,(c=document.createElement("script")).charset="utf-8",o.nc&&c.setAttribute("nonce",o.nc),c.setAttribute("data-webpack",t+i),c.src=r),e[r]=[n];var s=(t,n)=>{c.onerror=c.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],c.parentNode&&c.parentNode.removeChild(c),o&&o.forEach(e=>e(n)),t)return t(n)},d=setTimeout(s.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=s.bind(null,c.onerror),c.onload=s.bind(null,c.onload),u&&document.head.appendChild(c)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=i);var a=o.p+o.u(t),c=new Error;o.l(a,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;c.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",c.name="ChunkLoadError",c.type=i,c.request=a,n[1](c)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,i,[a,c,u]=r,f=0;if(a.some(t=>0!==e[t])){for(n in c)o.o(c,n)&&(o.m[n]=c[n]);u&&u(o)}for(t&&t(r);f<a.length;f++)i=a[f],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function c(){var e,t,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 f?n:f,p=Object.create(c.prototype);return u(p,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],l=!1,s={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,c=0,u=e,s.n=r,a}};function d(r,n){for(c=r,u=n,t=0;!l&&f&&!o&&t<p.length;t++){var o,i=p[t],d=s.p,b=i[2];r>3?(o=b===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,s.v=n,s.n=i[1]):d<b&&(o=r<3||i[0]>n||n>b)&&(i[4]=r,i[5]=n,s.n=b,c=0))}if(o||r>1)return a;throw l=!0,n}return function(o,p,b){if(f>1)throw TypeError("Generator is already running");for(l&&1===p&&d(p,b),c=p,u=b;(t=c<2?e:u)||!l;){i||(c?c<3?(c>1&&(s.n=-1),d(c,u)):s.n=u:s.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(l=s.n<0)?u:r.call(n,s))!==a)break}catch(t){i=e,c=1,u=t}finally{f=1}}return{value:t,done:l}}}(r,o,i),!0),p}var a={};function f(){}function p(){}function l(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(u(t={},n,function(){return this}),t),d=l.prototype=f.prototype=Object.create(s);function b(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,u(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return p.prototype=l,u(d,"constructor",l),u(l,"constructor",p),p.displayName="GeneratorFunction",u(l,o,"GeneratorFunction"),u(d),u(d,o,"Generator"),u(d,n,function(){return this}),u(d,"toString",function(){return"[object Generator]"}),(c=function(){return{w:i,m:b}})()}function u(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}u=function(e,t,r,n){function i(t,r){u(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},u(e,t,r,n)}function f(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,t,r){return(t=function(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(){var e,t;return l(l({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{load:(e=c().m(function e(){var t;return c().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.e(627).then(o.bind(o,863));case 1:return t=e.v,e.a(2,t.reverseGeocode)}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){f(i,n,o,a,c,"next",e)}function c(e){f(i,n,o,a,c,"throw",e)}a(void 0)})},function(){return t.apply(this,arguments)})})}return o.d(i,{default:()=>d}),i.default})());