@defra/interactive-map 0.0.43-fmp-experimental → 0.0.44-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/templates/add-polygons.njk +5 -1
- package/assets/templates/add-symbols.njk +5 -1
- package/dist/css/index.css +1 -1
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/im-shell.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api/context.md +24 -0
- package/docs/api/keyboard-shortcut-definition.md +102 -0
- package/docs/api.md +18 -8
- package/docs/building-a-plugin.md +1 -0
- package/docs/plugins/draw.md +2 -2
- package/docs/plugins/plugin-manifest.md +9 -0
- package/package.json +4 -2
- package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -1
- package/plugins/beta/draw-es/src/api/newPolygon.js +1 -0
- package/plugins/beta/draw-es/src/events.js +17 -8
- package/plugins/beta/draw-es/src/reducer.js +8 -1
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ol/dist/css/index.css +1 -13
- package/plugins/beta/draw-ol/dist/esm/im-draw-ol-plugin.js +1 -1
- package/plugins/beta/frame/dist/css/index.css +1 -11
- package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -1
- package/plugins/beta/frame/dist/umd/im-frame-plugin.js +1 -1
- package/plugins/beta/frame/src/Frame.jsx +28 -2
- package/plugins/beta/map-styles/dist/css/index.css +1 -1
- package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/umd/index.js +1 -1
- package/plugins/beta/scale-bar/dist/css/index.css +1 -8
- package/plugins/datasets/dist/css/5648.index.css +1 -5
- package/plugins/datasets/dist/css/index.css +1 -1
- package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
- package/plugins/datasets/src/components/LayersMenu/Layers.module.scss +1 -0
- package/plugins/datasets/src/initialise/DatasetsInit.jsx +2 -2
- package/plugins/datasets/src/initialise/DatasetsInit.test.jsx +6 -5
- package/plugins/datasets/src/registry/dataset.js +8 -12
- package/plugins/datasets/src/registry/dataset.test.js +17 -0
- package/plugins/datasets/src/registry/datasetRegistry.js +4 -5
- package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/esm/index.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/umd/index.js +1 -1
- package/plugins/draw/src/DrawInit.jsx +41 -26
- package/plugins/draw/src/DrawInit.test.jsx +55 -12
- package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.js +113 -114
- package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.test.js +82 -9
- package/plugins/draw/src/adapters/maplibre/drawEvents.js +3 -1
- package/plugins/draw/src/adapters/maplibre/modes/createDrawMode.test.js +1 -1
- package/plugins/draw/src/adapters/maplibre/modes/drawMode/__helpers__/harness.js +18 -9
- package/plugins/draw/src/adapters/maplibre/modes/drawMode/clickHandlers.js +9 -1
- package/plugins/draw/src/adapters/maplibre/modes/drawMode/clickHandlers.test.js +11 -1
- package/plugins/draw/src/adapters/maplibre/modes/drawMode/lifecycle.js +23 -2
- package/plugins/draw/src/adapters/maplibre/modes/drawMode/lifecycle.test.js +53 -0
- package/plugins/draw/src/adapters/maplibre/modes/drawMode/pointerHandlers.js +29 -19
- package/plugins/draw/src/adapters/maplibre/modes/drawMode/pointerHandlers.test.js +17 -2
- package/plugins/draw/src/adapters/maplibre/modes/drawMode/undoHandlers.test.js +1 -1
- package/plugins/draw/src/adapters/maplibre/modes/drawPointMode.js +35 -29
- package/plugins/draw/src/adapters/maplibre/modes/drawPointMode.test.js +24 -6
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/keyboardHandlers.js +22 -20
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode/pointOperations.js +1 -1
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode.js +2 -2
- package/plugins/draw/src/adapters/maplibre/modes/editPointMode.test.js +3 -3
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/geometryHelpers.js +31 -0
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/geometryHelpers.test.js +8 -1
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/keyboardHandlers.js +38 -30
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/keyboardHandlers.test.js +20 -3
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/pointerHandlers.js +5 -5
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/touchHandlers.js +2 -2
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/touchHandlers.test.js +2 -2
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/undoHandlers.js +3 -3
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/undoHandlers.test.js +7 -7
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/vertexOperations.js +4 -4
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/vertexOperations.test.js +14 -14
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/vertexQueries.js +12 -32
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode/vertexQueries.test.js +10 -10
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode.js +48 -22
- package/plugins/draw/src/adapters/maplibre/modes/editVertexMode.test.js +74 -6
- package/plugins/draw/src/adapters/maplibre/utils/snapMovement.js +2 -2
- package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.js +6 -0
- package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.test.js +9 -0
- package/plugins/draw/src/adapters/openlayers/core/OLDrawManager.js +15 -2
- package/plugins/draw/src/adapters/openlayers/core/OLDrawManager.test.js +27 -1
- package/plugins/draw/src/adapters/openlayers/draw/DrawMode.test.js +1 -1
- package/plugins/draw/src/adapters/openlayers/draw/drawInput.js +40 -17
- package/plugins/draw/src/adapters/openlayers/draw/drawInput.test.js +55 -1
- package/plugins/draw/src/adapters/openlayers/draw/vertexPlacement.js +13 -7
- package/plugins/draw/src/adapters/openlayers/draw/vertexPlacement.test.js +7 -15
- package/plugins/draw/src/adapters/openlayers/edit/EditMode.js +36 -4
- package/plugins/draw/src/adapters/openlayers/edit/EditMode.test.js +41 -1
- package/plugins/draw/src/adapters/openlayers/edit/keyboardHandler.js +35 -25
- package/plugins/draw/src/adapters/openlayers/edit/keyboardHandler.test.js +40 -2
- package/plugins/draw/src/adapters/openlayers/edit/nudge.js +2 -2
- package/plugins/draw/src/adapters/openlayers/edit/nudge.test.js +2 -2
- package/plugins/draw/src/adapters/openlayers/point/drawPointMode.js +40 -54
- package/plugins/draw/src/adapters/openlayers/point/drawPointMode.test.js +32 -13
- package/plugins/draw/src/adapters/openlayers/point/editPointMode.js +1 -1
- package/plugins/draw/src/adapters/openlayers/point/editPointMode.test.js +17 -1
- package/plugins/draw/src/events.js +4 -4
- package/plugins/draw/src/events.test.js +1 -1
- package/plugins/draw/src/hooks/useSpatialList.js +180 -0
- package/plugins/draw/src/hooks/useSpatialList.test.js +339 -0
- package/plugins/draw/src/manifest.js +4 -1
- package/plugins/draw/src/manifest.test.js +19 -7
- package/plugins/draw/src/utils/spatial.js +1 -31
- package/plugins/draw/src/utils/spatial.test.js +1 -24
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/index.js +1 -1
- package/plugins/interact/src/InteractInit.jsx +2 -2
- package/plugins/interact/src/InteractInit.test.js +3 -3
- package/plugins/interact/src/events.js +11 -2
- package/plugins/interact/src/events.test.js +32 -0
- package/plugins/interact/src/hooks/useAttachEvents.js +20 -0
- package/plugins/interact/src/hooks/useAttachEvents.test.js +44 -1
- package/plugins/interact/src/hooks/useCrossHairVisibility.js +9 -4
- package/plugins/interact/src/hooks/useCrossHairVisibility.test.js +7 -7
- package/plugins/interact/src/hooks/useSpatialList.js +251 -0
- package/plugins/interact/src/hooks/{useMapItemList.test.js → useSpatialList.test.js} +216 -70
- package/plugins/interact/src/manifest.js +12 -1
- package/plugins/interact/src/manifest.test.js +20 -0
- package/plugins/interact/src/utils/spatial.js +24 -1
- package/plugins/interact/src/utils/spatial.test.js +26 -1
- package/plugins/map-key/dist/css/index.css +1 -106
- package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/umd/index.js +1 -1
- package/plugins/map-key/src/components/Key/Key.jsx +3 -4
- package/plugins/map-key/src/components/Key/Key.module.scss +10 -8
- package/plugins/map-key/src/components/Key/KeyGroupItem.test.jsx +2 -2
- package/plugins/map-key/src/components/Key/KeyItem.jsx +2 -2
- package/plugins/map-key/src/components/Key/KeySvg.jsx +9 -7
- package/plugins/map-key/src/components/Key/KeySvg.test.jsx +4 -4
- package/plugins/map-key/src/components/Key/MapKey.jsx +5 -3
- package/plugins/map-key/src/manifest.js +1 -1
- package/plugins/map-key/src/utils/groupStyles.js +7 -0
- package/plugins/map-key/src/utils/mergeKeyGroupItems.js +12 -0
- package/plugins/map-key/src/utils/mergeKeyGroupItems.test.js +53 -0
- package/plugins/menu/dist/css/index.css +1 -80
- package/plugins/menu/dist/esm/im-menu-plugin.js +1 -1
- package/plugins/menu/dist/umd/im-menu-plugin.js +1 -1
- package/plugins/menu/dist/umd/index.js +1 -1
- package/plugins/menu/src/initialise/MenuInit.jsx +15 -3
- package/plugins/menu/src/initialise/MenuInit.test.jsx +25 -0
- package/plugins/menu/src/initialise/createMenu.js +3 -1
- package/plugins/menu/src/initialise/createMenu.test.js +20 -5
- package/plugins/menu/src/initialise/updateUrl.js +44 -0
- package/plugins/menu/src/initialise/updateUrl.test.js +91 -0
- package/plugins/menu/src/reducers/menuStateReducer.js +19 -1
- package/plugins/menu/src/reducers/menuStateReducer.test.js +53 -20
- package/plugins/menu/src/reducers/pluginState.js +1 -6
- package/plugins/menu/src/reducers/pluginState.test.js +0 -25
- package/plugins/search/dist/css/index.css +1 -1
- package/plugins/search/dist/esm/im-search-plugin.js +1 -1
- package/plugins/search/dist/umd/im-search-plugin.js +1 -1
- package/plugins/search/src/manifest.js +5 -9
- package/plugins/search/src/manifest.test.js +5 -0
- package/providers/beta/esri/dist/css/index.css +1 -34
- package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/src/openlayersProvider.js +3 -3
- package/providers/beta/openlayers/src/openlayersProvider.test.js +6 -3
- package/providers/beta/openlayers/src/utils/queryFeatures.js +72 -0
- package/providers/beta/openlayers/src/utils/queryFeatures.test.js +122 -1
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/index.js +1 -1
- package/providers/maplibre/src/defaults.test.js +26 -0
- package/providers/maplibre/src/utils/labels.js +2 -2
- package/providers/maplibre/src/utils/labels.test.js +5 -5
- package/providers/maplibre/src/utils/spatial.js +0 -57
- package/providers/maplibre/src/utils/spatial.test.js +0 -27
- package/rollup.esm.mjs +2 -1
- package/scripts/publish-package.sh +36 -0
- package/src/App/App.jsx +1 -1
- package/src/App/App.test.jsx +6 -1
- package/src/App/components/CrossHair/CrossHair.jsx +25 -11
- package/src/App/components/CrossHair/CrossHair.module.scss +37 -12
- package/src/App/components/CrossHair/CrossHair.test.jsx +40 -11
- package/src/App/components/Hints/Hints.jsx +3 -3
- package/src/App/components/Hints/Hints.test.jsx +3 -3
- package/src/App/components/KeyboardHelp/KeyboardHelp.jsx +4 -1
- package/src/App/components/KeyboardHelp/KeyboardHelp.test.jsx +17 -0
- package/src/App/components/MapButton/MapButton.jsx +19 -7
- package/src/App/components/MapButton/MapButton.module.scss +1 -2
- package/src/App/components/MapButton/MapButton.test.jsx +42 -4
- package/src/App/components/{MoveControls/MoveControls.jsx → MapControls/MapControls.jsx} +10 -10
- package/src/App/components/{MoveControls/MoveControls.module.scss → MapControls/MapControls.module.scss} +25 -25
- package/src/App/components/{MoveControls/MoveControls.test.jsx → MapControls/MapControls.test.jsx} +48 -48
- package/src/App/components/Markers/Markers.jsx +2 -2
- package/src/App/components/Markers/Markers.test.jsx +3 -3
- package/src/App/components/Markers/SymbolMarker.jsx +2 -3
- package/src/App/components/Markers/SymbolMarker.test.jsx +8 -9
- package/src/App/components/Panel/Panel.jsx +19 -20
- package/src/App/components/Panel/Panel.module.scss +5 -0
- package/src/App/components/Panel/Panel.test.jsx +69 -4
- package/src/App/components/PopupMenu/PopupMenu.jsx +7 -3
- package/src/App/components/PopupMenu/PopupMenu.test.jsx +71 -0
- package/src/App/components/PopupMenu/usePopupMenu.js +10 -9
- package/src/App/components/Viewport/MapStatus.jsx +1 -1
- package/src/App/components/Viewport/SpatialList.jsx +47 -0
- package/src/App/components/Viewport/{Features.module.scss → SpatialList.module.scss} +6 -6
- package/src/App/components/Viewport/SpatialList.test.jsx +285 -0
- package/src/App/components/Viewport/Viewport.jsx +21 -11
- package/src/App/components/Viewport/Viewport.test.jsx +18 -2
- package/src/App/controls/keyboardMappings.js +7 -2
- package/src/App/controls/keyboardMappings.test.js +21 -0
- package/src/App/controls/keyboardShortcuts.js +16 -2
- package/src/App/controls/keyboardShortcuts.test.js +21 -0
- package/src/App/hooks/useCrossHairAPI.js +29 -1
- package/src/App/hooks/useCrossHairAPI.test.js +17 -1
- package/src/App/hooks/useHintsAPI.js +5 -5
- package/src/App/hooks/useInterfaceAPI.js +2 -1
- package/src/App/hooks/useInterfaceAPI.test.js +9 -0
- package/src/App/hooks/useKeyboardShortcuts.js +66 -35
- package/src/App/hooks/useKeyboardShortcuts.test.js +52 -0
- package/src/App/hooks/useModalPanelBehaviour.js +48 -34
- package/src/App/hooks/useModalPanelBehaviour.test.js +59 -0
- package/src/App/hooks/useSpatialListFocus.js +296 -0
- package/src/App/hooks/useSpatialListFocus.test.js +957 -0
- package/src/App/hooks/useSpatialListItems.js +51 -0
- package/src/App/hooks/useSpatialListItems.test.js +217 -0
- package/src/App/initialiseApp.js +6 -3
- package/src/App/initialiseApp.test.js +11 -0
- package/src/App/layout/Layout.jsx +4 -2
- package/src/App/layout/Layout.test.jsx +21 -0
- package/src/App/layout/layout.module.scss +7 -1
- package/src/App/registry/keyboardShortcutRegistry.js +2 -2
- package/src/App/registry/keyboardShortcutRegistry.test.js +16 -0
- package/src/App/registry/pluginRegistry.js +13 -0
- package/src/App/registry/pluginRegistry.test.js +15 -0
- package/src/App/registry/spatialListRegistry.js +104 -0
- package/src/App/registry/spatialListRegistry.test.js +218 -0
- package/src/App/renderer/HtmlElementHost.jsx +12 -32
- package/src/App/renderer/mapButtons.js +4 -0
- package/src/App/renderer/mapButtons.test.js +20 -0
- package/src/App/renderer/mapPanels.js +33 -53
- package/src/App/renderer/mapPanels.test.js +29 -4
- package/src/App/renderer/slotHelpers.js +33 -0
- package/src/App/renderer/slotHelpers.test.js +79 -2
- package/src/App/store/AppProvider.jsx +3 -2
- package/src/App/store/ServiceProvider.jsx +5 -3
- package/src/App/store/ServiceProvider.test.jsx +20 -1
- package/src/InteractiveMap/InteractiveMap.js +13 -2
- package/src/InteractiveMap/InteractiveMap.test.js +33 -0
- package/src/config/appConfig.js +16 -16
- package/src/config/appConfig.test.js +19 -19
- package/src/config/defaults.js +2 -2
- package/src/config/events.js +8 -8
- package/src/scss/main.scss +2 -2
- package/src/test-utils.js +8 -0
- package/src/types.js +51 -9
- package/src/utils/findNearestItemInDirection.js +29 -0
- package/src/utils/findNearestItemInDirection.test.js +67 -0
- package/src/utils/getPanelElementId.js +4 -0
- package/src/utils/getPanelElementId.test.js +11 -0
- package/src/utils/getPanelRole.js +22 -0
- package/src/utils/getPanelRole.test.js +56 -0
- package/src/utils/globalAltShortcuts.js +12 -0
- package/src/utils/globalAltShortcuts.test.js +27 -0
- package/src/utils/spatialNavigate.js +49 -0
- package/src/utils/spatialNavigate.test.js +42 -0
- package/webpack.umd.mjs +6 -1
- package/plugins/interact/src/hooks/useMapItemList.js +0 -187
- package/src/App/components/Viewport/Features.jsx +0 -35
- package/src/App/components/Viewport/Features.test.jsx +0 -124
- package/src/App/hooks/useFeatureFocus.js +0 -199
- package/src/App/hooks/useFeatureFocus.test.js +0 -635
- package/src/App/hooks/useFeatureItems.js +0 -39
- package/src/App/hooks/useFeatureItems.test.js +0 -155
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { polygon, multiPolygon, lineString, multiLineString, point, multiPoint } from '@turf/helpers'
|
|
2
2
|
import booleanDisjoint from '@turf/boolean-disjoint'
|
|
3
|
+
import bbox from '@turf/bbox'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Convert a GeoJSON Feature or geometry-like object into a Turf geometry.
|
|
@@ -41,6 +42,27 @@ function isContiguousWithAny (feature, features) {
|
|
|
41
42
|
return features.some(f => !booleanDisjoint(toTurfGeometry(f), toTurfGeometry(feature)))
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
/**
|
|
46
|
+
* A representative [lng, lat] centre point for a feature's geometry — the centre of its bounding
|
|
47
|
+
* box. Used to position a polygon/line feature's entry in the accessible Features list (see
|
|
48
|
+
* useSpatialList.js) so coordinate-based AT overlays (e.g. macOS Voice Control's Show Numbers)
|
|
49
|
+
* land somewhere on the feature rather than off in a corner of the viewport. Deliberately a
|
|
50
|
+
* bbox centre, not a true centroid/centre-of-mass — works uniformly for polygons and lines with
|
|
51
|
+
* no extra dependency beyond what this file already uses, at the cost of being able to land
|
|
52
|
+
* outside a very concave shape (same trade-off a true centroid has anyway).
|
|
53
|
+
*
|
|
54
|
+
* @param {Object} featureOrGeom - Either a Feature with a `.geometry` property or a raw GeoJSON geometry object.
|
|
55
|
+
* @returns {[number, number]|null} [lng, lat], or null if the geometry is missing/unsupported.
|
|
56
|
+
*/
|
|
57
|
+
function getGeometryCenter (featureOrGeom) {
|
|
58
|
+
try {
|
|
59
|
+
const [minX, minY, maxX, maxY] = bbox(toTurfGeometry(featureOrGeom))
|
|
60
|
+
return [(minX + maxX) / 2, (minY + maxY) / 2]
|
|
61
|
+
} catch {
|
|
62
|
+
return null
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
44
66
|
const isPolygonal = (type) => type === 'Polygon' || type === 'MultiPolygon'
|
|
45
67
|
|
|
46
68
|
/**
|
|
@@ -86,5 +108,6 @@ function areAllContiguous (features) {
|
|
|
86
108
|
export {
|
|
87
109
|
toTurfGeometry,
|
|
88
110
|
isContiguousWithAny,
|
|
89
|
-
areAllContiguous
|
|
111
|
+
areAllContiguous,
|
|
112
|
+
getGeometryCenter
|
|
90
113
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toTurfGeometry, isContiguousWithAny, areAllContiguous } from './spatial.js'
|
|
1
|
+
import { toTurfGeometry, isContiguousWithAny, areAllContiguous, getGeometryCenter } from './spatial.js'
|
|
2
2
|
import { polygon, multiPolygon, lineString, multiLineString, point, multiPoint } from '@turf/helpers'
|
|
3
3
|
|
|
4
4
|
describe('toTurfGeometry', () => {
|
|
@@ -97,3 +97,28 @@ describe('areAllContiguous', () => {
|
|
|
97
97
|
expect(areAllContiguous([A, lineThroughA])).toBe(false)
|
|
98
98
|
})
|
|
99
99
|
})
|
|
100
|
+
|
|
101
|
+
describe('getGeometryCenter', () => {
|
|
102
|
+
it('returns the bbox centre of a polygon', () => {
|
|
103
|
+
const feature = { geometry: { type: 'Polygon', coordinates: [[[0, 0], [4, 0], [4, 2], [0, 2], [0, 0]]] } }
|
|
104
|
+
expect(getGeometryCenter(feature)).toEqual([2, 1])
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it('returns the bbox centre of a line', () => {
|
|
108
|
+
const feature = { geometry: { type: 'LineString', coordinates: [[0, 0], [4, 2]] } }
|
|
109
|
+
expect(getGeometryCenter(feature)).toEqual([2, 1])
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
it('accepts a raw geometry object, not just a Feature', () => {
|
|
113
|
+
const geom = { type: 'Polygon', coordinates: [[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]] }
|
|
114
|
+
expect(getGeometryCenter(geom)).toEqual([1, 1])
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
it('returns null when geometry is missing', () => {
|
|
118
|
+
expect(getGeometryCenter({})).toBeNull()
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
it('returns null for an unsupported geometry type', () => {
|
|
122
|
+
expect(getGeometryCenter({ geometry: { type: 'Circle', coordinates: [] } })).toBeNull()
|
|
123
|
+
})
|
|
124
|
+
})
|
|
@@ -1,106 +1 @@
|
|
|
1
|
-
.im-c-map-key
|
|
2
|
-
padding-top: 5px;
|
|
3
|
-
}
|
|
4
|
-
.im-c-map-key > *:first-child .im-c-map-key__group-heading {
|
|
5
|
-
padding-top: 0;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.im-c-map-key--has-groups > *:not(:first-child) {
|
|
9
|
-
border-top: 1px solid var(--button-hover-color);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.im-c-map-key__group:not(:last-child) {
|
|
13
|
-
padding-bottom: 5px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.im-c-map-key__empty-message {
|
|
17
|
-
margin: 0;
|
|
18
|
-
font-size: 1rem;
|
|
19
|
-
color: var(--foreground-color);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.im-c-map-key__group-heading {
|
|
23
|
-
padding-top: 15px;
|
|
24
|
-
padding-bottom: 10px;
|
|
25
|
-
margin: 0;
|
|
26
|
-
font-size: 1rem;
|
|
27
|
-
font-weight: bold;
|
|
28
|
-
color: var(--foreground-color);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.im-c-map-key-list__item {
|
|
32
|
-
display: flex;
|
|
33
|
-
align-items: start;
|
|
34
|
-
padding-top: 10px;
|
|
35
|
-
padding-bottom: 10px;
|
|
36
|
-
font-size: 1rem;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.im-c-map-key--has-groups > .im-c-map-key-list__item:not(:first-child) {
|
|
40
|
-
padding-top: 15px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.im-c-map-key--has-groups > .im-c-map-key-list__item {
|
|
44
|
-
padding-bottom: 15px;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.im-c-map-key__group > .im-c-map-key-list .im-c-map-key-list__item {
|
|
48
|
-
padding-top: 10px;
|
|
49
|
-
padding-bottom: 10px;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.im-c-map-key > .im-c-map-key-list__item:last-child,
|
|
53
|
-
.im-c-map-key__group:last-child > .im-c-map-key-list .im-c-map-key-list__item:last-child {
|
|
54
|
-
padding-bottom: 5px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.im-c-map-key-symbol {
|
|
58
|
-
position: relative;
|
|
59
|
-
flex-shrink: 0;
|
|
60
|
-
margin: 0 13px 0 3px;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.im-c-map-key-symbol--point {
|
|
64
|
-
margin: -12px 1px -12px -9px;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.im-c-map-key-list-ramp {
|
|
68
|
-
display: grid;
|
|
69
|
-
grid-template-columns: repeat(auto-fit, minmax(47px, auto));
|
|
70
|
-
direction: rtl;
|
|
71
|
-
}
|
|
72
|
-
.im-c-map-key-list-ramp .im-c-map-key-list__item {
|
|
73
|
-
padding: 0 !important;
|
|
74
|
-
position: relative !important;
|
|
75
|
-
display: flex;
|
|
76
|
-
flex-direction: column;
|
|
77
|
-
}
|
|
78
|
-
.im-c-map-key-list-ramp .im-c-map-key-list__item .im-c-map-key-list__item-symbol {
|
|
79
|
-
margin: 0 !important;
|
|
80
|
-
width: 100%;
|
|
81
|
-
direction: ltr;
|
|
82
|
-
}
|
|
83
|
-
.im-c-map-key-list-ramp .im-c-map-key-list__item .im-c-map-key-list__item-symbol svg {
|
|
84
|
-
display: block;
|
|
85
|
-
}
|
|
86
|
-
.im-c-map-key-list-ramp .im-c-map-key-list__item .im-c-map-key-list__item-label {
|
|
87
|
-
width: 100%;
|
|
88
|
-
direction: ltr;
|
|
89
|
-
margin-top: 10px;
|
|
90
|
-
white-space: nowrap;
|
|
91
|
-
text-align: center;
|
|
92
|
-
transform: translateX(-50%);
|
|
93
|
-
}
|
|
94
|
-
.im-c-map-key-list-ramp .im-c-map-key-list__item:first-child .im-c-map-key-list__item-symbol {
|
|
95
|
-
border-top-right-radius: 4px;
|
|
96
|
-
border-bottom-right-radius: 4px;
|
|
97
|
-
overflow: hidden;
|
|
98
|
-
}
|
|
99
|
-
.im-c-map-key-list-ramp .im-c-map-key-list__item:last-child .im-c-map-key-list__item-label {
|
|
100
|
-
display: none;
|
|
101
|
-
}
|
|
102
|
-
.im-c-map-key-list-ramp .im-c-map-key-list__item:last-child .im-c-map-key-list__item-symbol {
|
|
103
|
-
border-top-left-radius: 4px;
|
|
104
|
-
border-bottom-left-radius: 4px;
|
|
105
|
-
overflow: hidden;
|
|
106
|
-
}
|
|
1
|
+
.im-c-map-key>:first-child{padding-top:5px}.im-c-map-key>:first-child .im-c-map-key__group-heading{padding-top:0}.im-c-map-key--has-groups>:not(:first-child){border-top:1px solid var(--button-hover-color)}.im-c-map-key__group:not(:last-child){padding-bottom:5px}.im-c-map-key__empty-message,.im-c-map-key__group-heading{color:var(--foreground-color);font-size:1rem;margin:0}.im-c-map-key__group-heading{font-weight:700;padding-bottom:10px;padding-top:15px}.im-c-map-key-list__item{align-items:start;display:flex;font-size:1rem;padding-bottom:10px;padding-top:10px}.im-c-map-key--has-groups>.im-c-map-key-list__item:not(:first-child){padding-top:15px}.im-c-map-key--has-groups>.im-c-map-key-list__item{padding-bottom:15px}.im-c-map-key__group>.im-c-map-key-list .im-c-map-key-list__item{padding-bottom:10px;padding-top:10px}.im-c-map-key>.im-c-map-key-list__item:last-child,.im-c-map-key__group:last-child>.im-c-map-key-list .im-c-map-key-list__item:last-child{padding-bottom:5px}.im-c-map-key-symbol{flex-shrink:0;margin:0 13px 0 3px;position:relative}.im-c-map-key-symbol--point{margin:-12px 1px -12px -9px}.im-c-map-key-list-horizontal-ramp{direction:rtl;display:grid;grid-auto-columns:1fr;grid-auto-flow:column;margin-bottom:10px}.im-c-map-key-list-horizontal-ramp .im-c-map-key-list__item{display:flex;flex-direction:column;padding:0!important;position:relative!important}.im-c-map-key-list-horizontal-ramp .im-c-map-key-list__item .im-c-map-key-list__item-symbol{direction:ltr;margin:0!important;max-height:var(--line-height);overflow-y:hidden;width:100%}.im-c-map-key-list-horizontal-ramp .im-c-map-key-list__item .im-c-map-key-list__item-symbol svg{display:block}.im-c-map-key-list-horizontal-ramp .im-c-map-key-list__item .im-c-map-key-list__item-label{direction:ltr;margin-top:10px;text-align:center;white-space:nowrap;width:100%}.im-c-map-key-list-horizontal-ramp .im-c-map-key-list__item:first-child .im-c-map-key-list__item-symbol{border-bottom-right-radius:4px;border-top-right-radius:4px;overflow:hidden}.im-c-map-key-list-horizontal-ramp .im-c-map-key-list__item:last-child .im-c-map-key-list__item-symbol{border-bottom-left-radius:4px;border-top-left-radius:4px;overflow:hidden}.im-c-map-key .im-c-map-key__group:last-child .im-c-map-key-list-horizontal-ramp{margin-bottom:0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as e,useEffect as t}from"preact/compat";import{jsx as r,jsxs as o}from"preact/jsx-runtime";import n from"@babel/runtime/helpers/defineProperty";import l from"@babel/runtime/helpers/asyncToGenerator";var a=null,i=e=>a=e,c={"cross-hatch":'<path d="M0 4.486V3.485h3.5V.001h1v3.484h7.002V.001h1v3.484h3.5v1.001h-3.5v7h3.5v.999h-3.5v3.516h-1v-3.516H4.499v3.516h-1v-3.516H0v-.999h3.5v-7H0zm11.501 0H4.499v7h7.002v-7z" fill="{{foregroundColor}}"/>',"diagonal-cross-hatch":'<path d="M0 8.707V7.293L7.293 0h1.414L16 7.293v1.414L8.707 16H7.293L0 8.707zM.707 8L8 15.293 15.293 8 8 .707.707 8z" fill="{{foregroundColor}}"/>',"forward-diagonal-hatch":'<path d="M16 8.707V7.293L7.293 16h1.414L16 8.707zm-16 0L8.707 0H7.293L0 7.293v1.414z" fill="{{foregroundColor}}"/>',"backward-diagonal-hatch":'<path d="M0 8.707V7.293L8.707 16H7.293L0 8.707zm16 0L7.293 0h1.414L16 7.293v1.414z" fill="{{foregroundColor}}"/>',"horizontal-hatch":'<path d="M0 4.5V3.499h15.999V4.5H0zm0 7h15.999V12.5H0v-1.001z" fill="{{foregroundColor}}"/>',"vertical-hatch":'<path d="M3.501 16.001V0h1v16.001h-1zm7.998 0V0h1v16.001h-1z" fill="{{foregroundColor}}"/>',dot:'<path d="M3.999 2A2 2 0 0 1 6 3.999C6 5.103 5.103 6 3.999 6a2 2 0 0 1-1.999-2.001A2 2 0 0 1 3.999 2zm0 7.999C5.103 10 6 10.897 6 12.001A2 2 0 0 1 3.999 14a2 2 0 0 1-1.999-1.999A2 2 0 0 1 3.999 10zM11.999 2A2 2 0 0 1 14 3.999C14 5.103 13.103 6 11.999 6S10 5.103 10 3.999A2 2 0 0 1 11.999 2zm0 7.999c1.104 0 2.001.897 2.001 2.001A2 2 0 0 1 11.999 14 2 2 0 0 1 10 12.001c0-1.104.897-2.001 1.999-2.001z" fill="{{foregroundColor}}"/>',diamond:'<path d="M4 .465L7.535 4 4 7.535.465 4 4 .465zm0 7.999l3.535 3.535L4 15.535.465 11.999 4 8.464zm8-8l3.535 3.535-3.536 3.536L8.464 4 12 .464zm0 8.001L15.536 12 12 15.536 8.465 12 12 8.465z" fill="{{foregroundColor}}"/>'},s=(e,t)=>{if(!e)return null;if("string"==typeof e)return e.trim();if("object"==typeof e){if(t&&e[t])return e[t];var r=Object.values(e)[0];return null!=r?r:null}return null},p=(e,t,r)=>e.replace(/\{\{foregroundColor\}\}/g,t||"black").replace(/\{\{backgroundColor\}\}/g,r),f=new Map,u={register(e,t){f.set(e,{id:e,svgContent:t})},get:e=>f.get(e),list:()=>[...f.values()],clear(){f.clear()},initialise(){Object.entries(c).forEach(e=>{var[t,r]=e;this.register(t,r)})},getPatternInnerContent(e){return e.fillPatternSvgContent?e.fillPatternSvgContent:e.fillPattern&&null!==(t=null===(r=this.get(e.fillPattern))||void 0===r?void 0:r.svgContent)&&void 0!==t?t:null;var t,r},getKeyPatternPaths(e,t){var r=this.getPatternInnerContent(e);if(!r)return null;var o=s(e.fillPatternForegroundColor,t)||"black",n=s(e.fillPatternBackgroundColor,t)||"transparent",l=s(e.stroke,t)||o;return{border:p('<path d="M19 2.862v14.275c0 1.028-.835 1.862-1.862 1.862H2.863c-1.028 0-1.862-.835-1.862-1.862V2.862C1.001 1.834 1.836 1 2.863 1h14.275C18.166 1 19 1.835 19 2.862z" fill="{{backgroundColor}}" stroke="{{foregroundColor}}" stroke-width="2"/>',l,n),content:p(r,o,n)}},getPatternImageId(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=this.getPatternInnerContent(e);if(!o)return null;var n=s(e.fillPatternForegroundColor,t)||"black",l=s(e.fillPatternBackgroundColor,t)||"transparent",a=(e=>Math.max(2,2*e))(r);return"pattern-".concat((e=>{var t=0;for(var r of e)t=Math.trunc((t<<5)-t+r.codePointAt(0));return Math.abs(t).toString(36)})(o+n+l),"-").concat(a,"x")}};u.initialise();var d={symbol:"pin",backgroundColor:"#ca3535",foregroundColor:"#ffffff"},h={dot:"M8 3c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.241 5-5-2.24-5-5-5z",cross:"M6 3H10V6H13V10H10V13H6V10H3V6H6Z",diamond:"M8 2L14 8L8 14L2 8Z",triangle:"M8 2L14 14H2Z",square:"M3 3H13V13H3Z"},m={id:"pin",viewBox:"0 0 44 44",anchor:[.5,.9],graphic:h.dot,svg:'<path d="M22 40.999c-3.621 0-8.306-5.864-10.258-8.3C9.02 29.302 6 23.66 6 19.002a16.01 16.01 0 0 1 16-16 16.01 16.01 0 0 1 16 16c0 4.658-3.02 10.3-5.742 13.697-1.952 2.437-6.637 8.3-10.258 8.3z" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M22 7.001a12.01 12.01 0 0 1 12 12c0 7.623-10.377 17.998-12 17.998S10 26.624 10 19.001a12.01 12.01 0 0 1 12-12z" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 19) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},y={id:"circle",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:h.dot,svg:'<circle cx="22" cy="22" r="16" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <circle cx="22" cy="22" r="12" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},v={id:"square",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:h.dot,svg:'<path d="M13 6h18c3.863 0 7 3.137 7 7v18c0 3.863-3.137 7-7 7H13c-3.863 0-7-3.137-7-7V13c0-3.863 3.137-7 7-7" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M13 34a3 3 0 0 1-3-3V13a3 3 0 0 1 3-3h18a3 3 0 0 1 3 3v18a3 3 0 0 1-3 3H13z" fill-rule="nonzero" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},g=new Set(["symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"]),b=e=>{if(!(e=>!(!e.symbol&&!e.symbolSvgContent))(e))return{};var t={};return g.forEach(r=>{if(null!=e[r]){var o=r.charAt(6).toLowerCase()+r.slice(7);t[o]=e[r]}}),t},O=(e,t)=>{var r;return e.symbolViewBox?e.symbolViewBox:null!==(r=null==t?void 0:t.viewBox)&&void 0!==r?r:"0 0 38 38"},k={light:{haloColor:"#ffffff",selectedColor:"#0b0c0c",activeColor:"#ffdd00",foregroundColor:"#0b0c0c"},dark:{haloColor:"#0b0c0c",selectedColor:"#ffffff",activeColor:"#ffdd00",foregroundColor:"#ffffff"}};function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function C(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var j=new Map,S=new Map,P={},D=e=>{var t=0;for(var r of e)t=Math.trunc((t<<5)-t+r.codePointAt(0));return Math.abs(t).toString(36)},M=new Set(["id","svg","viewBox","anchor","symbol","symbolSvgContent"]);function x(e,t,r){var o,n,l,a,i=null==r?void 0:r.id,c=Object.fromEntries(Object.entries(e||{}).filter(e=>{var[t]=e;return!M.has(t)})),p=Object.fromEntries(Object.entries(P).filter(e=>{var[t]=e;return!M.has(t)})),f=Object.fromEntries(Object.entries(t).filter(e=>{var[,t]=e;return null!=t})),u=C(C(C(C({},d),p),c),f),m=null!==(o=k[null==r?void 0:r.mapColorScheme])&&void 0!==o?o:k.light;return u.haloColor=null!==(n=null==r?void 0:r.haloColor)&&void 0!==n?n:m.haloColor,u.selectedColor=null!==(l=null==r?void 0:r.selectedColor)&&void 0!==l?l:m.selectedColor,u.activeColor=null!==(a=null==r?void 0:r.activeColor)&&void 0!==a?a:m.activeColor,"string"==typeof u.graphic&&h[u.graphic]&&(u.graphic=h[u.graphic]),Object.fromEntries(Object.entries(u).map(e=>{var[t,r]=e;return[t,s(r,i)||""]}))}function L(e,t){return Object.entries(t).reduce((e,t)=>{var[r,o]=t;return e.replaceAll("{{".concat(r,"}}"),o)},e)}var z={setDefaults(e){P=e||{}},getDefaults:()=>C(C({},d),P),register(e){j.set(e.id,e)},get:e=>j.get(e),list:()=>[...j.values()],clear(){j.clear()},initialise(){this.register(m),this.register(y),this.register(v)},resolve(e,t,r){var o=x(e,t||{},r);return e?(o.selectedColor="none",o.activeColor="none",L(e.svg,o)):""},resolveActive(e,t,r){var o=x(e,t||{},r);return e?L(e.svg,o):""},resolveSelected(e,t,r){var o=x(e,t||{},r);return e?(o.activeColor="none",L(e.svg,o)):""},getSymbolImageId(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,n=this.getSymbolDef(e);if(!n)return null;var l=b(e),a=r?this.resolveActive(n,l,t):this.resolve(n,l,t);return"symbol-".concat(r?"act-":"").concat(D(a),"-").concat(o,"x")},getSymbolDef(e){return e.symbolSvgContent?{svg:e.symbolSvgContent}:e.symbol?this.get(e.symbol):void 0},rasteriseSymbolImage(e,t,r,o){var n=this;return l(function*(){var l=n.getSymbolDef(e);if(!l)return null;var a,i,c=b(e);"active"===r?(a=n.resolveActive(l,c,t),i="act-"):"selected"===r?(a=n.resolveSelected(l,c,t),i="sel-"):(a=n.resolve(l,c,t),i="");var s="symbol-".concat(i).concat(D(a),"-").concat(o,"x"),p=S.get(s);if(!p){var f=O(e,l),[,,u,d]=f.split(" ").map(Number),h='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(u*o,'" height="').concat(d*o,'" viewBox="').concat(f,'">').concat(a,"</svg>");p=yield((e,t,r)=>new Promise((o,n)=>{var l="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(e)),a=new Image(t,r);a.onload=()=>{var e=document.createElement("canvas");e.width=t,e.height=r;var n=e.getContext("2d");n.drawImage(a,0,0,t,r),o(n.getImageData(0,0,t,r))},a.onerror=()=>{n(new Error("Failed to rasterise SVG: ".concat(e.slice(0,80))))},a.src=l}))(h,u*o,d*o),S.set(s,p)}return{imageId:s,imageData:p}})()}};z.initialise();var I=e=>{var{text:t}=e;return r("div",{className:"im-c-map-key",children:r("p",{className:"im-c-map-key__empty-message",children:t})})};function H(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function V(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?H(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var E=20,_={xmlns:"http://www.w3.org/2000/svg",width:E,height:E,viewBox:"0 0 ".concat(E," ").concat(E),className:"im-c-map-key-symbol","aria-hidden":"true",focusable:"false"},B=V(V({},_),{},{width:44,height:44,className:"im-c-map-key-symbol im-c-map-key-symbol--point"});function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function N(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var K=e=>{var{keyDefinition:t,mapStyle:n}=e,{style:l}=t,a=u.getKeyPatternPaths(l,n.id);return a?o("svg",N(N({},_),{},{children:[r("g",{dangerouslySetInnerHTML:{__html:a.border}}),r("g",{transform:"translate(".concat(2,", ").concat(2,")"),dangerouslySetInnerHTML:{__html:a.content}})]})):null};function G(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function T(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?G(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var W=e=>{var t,{keyDefinition:o,mapStyle:n,symbolDef:l}=e,{style:a}=o,i=null!==(t=null==n?void 0:n.appColorScheme)&&void 0!==t?t:"light",c=T(T({},n),{},{mapColorScheme:i}),s=z.resolve(l,b(a),c),p=O(a,l);return s&&p?r("svg",T(T({},B),{},{viewBox:p,children:r("g",{dangerouslySetInnerHTML:{__html:s}})})):null};function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function q(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){n(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}var F=e=>{var{mapStyle:t,keyDefinition:o}=e,{style:n}=o,l=n.strokeWidth,a=s(n.stroke,t.id);return r("svg",q(q({},_),{},{children:r("line",{x1:l/2,y1:10,x2:E-l/2,y2:10,stroke:a,strokeWidth:l,strokeLinecap:"round"})}))};function Z(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function U(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Z(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var J=e=>{var{mapStyle:t,keyDefinition:o}=e,{style:n}=o,l=n.strokeWidth,a=s(n.fill,t.id),i=s(n.stroke,t.id);return r("svg",U(U({},_),{},{children:r("rect",{x:l/2,y:l/2,width:E-l,height:E-l,rx:l,ry:l,fill:a,stroke:i,strokeWidth:l,strokeLinejoin:"round"})}))},Q=e=>{var{mapStyle:t,keyDefinition:o}=e,{style:n}=o,l=s(n.fill,t.id),a=s(n.fill,t.id);return r("svg",{viewBox:"0 0 5 5",preserveAspectRatio:"none",fill:l,stroke:a,strokeWidth:"1",children:r("path",{d:"M0 0h5v5H0z"})})},X=e=>{var{keyDefinition:t,mapStyle:o}=e,{symbolShape:n,symbolDef:l}=(e=>{if(!e)return{symbolShape:null,symbolDef:null};var{hasSymbol:t,hasPattern:r,hasRampStyleKey:o,style:n}=e;if(o)return{symbolShape:"ramp",symbolDef:null};if(t){var l=z.getSymbolDef(n);return{symbolShape:l?"symbol":"rect",symbolDef:l}}return r?{symbolShape:"pattern",symbolDef:null}:"line"===n.keySymbolShape?{symbolShape:"line",symbolDef:null}:{symbolShape:"rect",symbolDef:null}})(t);return n?"symbol"===n?r(W,{mapStyle:o,keyDefinition:t,symbolDef:l}):r("pattern"===n?K:"line"===n?F:"ramp"===n?Q:J,{mapStyle:o,keyDefinition:t}):null},Y=e=>{var{keyDefinition:t,mapStyle:n}=e,l=t.label,a=s(t.symbolDescription,n.id);return o("div",{className:"im-c-map-key-list__item",children:[r("dt",{className:"im-c-map-key-list__item-symbol",children:r(X,{keyDefinition:t,mapStyle:n})}),o("dd",{className:"im-c-map-key-list__item-label",children:[l,a&&o("span",{className:"govuk-visually-hidden",children:["(",a,")"]})]})]})},$=e=>{var{headingId:t,label:n,groupStyle:l,keyDefinitions:a,mapStyle:i}=e,c="im-c-map-key-list"+(l?" im-c-map-key-list-".concat(l):"");return o("section",{className:"im-c-map-key__group","aria-labelledby":t,children:[r("h3",{id:t,className:"im-c-map-key__group-heading",children:n}),r("dl",{className:c,children:a.map(e=>r(Y,{keyDefinition:e,mapStyle:i,groupStyle:l},"".concat(e.id)))})]})},ee="im-c-map-key",te=e=>{var{item:t,mapStyle:o}=e;return"group"===t.type?r($,{headingId:"key-heading-".concat(t.id),label:t.groupLabel,groupStyle:t.groupStyle,keyDefinitions:t.keyDefinitions,mapStyle:o}):r(Y,{keyDefinition:t.keyDefinition,mapStyle:o})},re=e=>{var{noKeyItemText:t,keyGroups:o,hasGroups:n,mapStyle:l}=e;if(null==o||!o.length)return r(I,{text:t});var a=n?"".concat(ee," ").concat("im-c-map-key--has-groups"):ee;return r("div",{className:a,children:o.map(e=>r(te,{item:e,mapStyle:l},e.id))})};var oe={InitComponent:function(e){var{mapState:r,services:o}=e,{eventBus:n}=o;t(()=>{r.isMapReady&&n.requestOnce("datasets:registry",i)},[r.isMapReady])},panels:[{id:"mapKey",label:"Key",mobile:{slot:"drawer",modal:!0},tablet:{slot:"left-top",width:"260px"},desktop:{slot:"left-top",width:"280px"},render:function(o){var{mapState:{mapStyle:n},pluginConfig:{noKeyItemText:l},services:{eventBus:i}}=o,[c,s]=e(a),[p,f]=e(()=>{var e;return null!==(e=null==c?void 0:c.keyItems().items)&&void 0!==e?e:[]}),[u,d]=e(()=>{var e;return null!==(e=null==c?void 0:c.keyItems().hasGroups)&&void 0!==e&&e}),h=()=>{var{items:e,hasGroups:t}=c.keyItems();f(e),d(t)},m=e=>{c.invalidateKeyItemsOnMenuStateChange(e),h()};return t(()=>c?(h(),i.on("menu:changed",m).on("datasets:changed",h),()=>i.off("menu:changed",m).off("datasets:changed",h)):(i.requestOnce("datasets:registry",s),()=>{}),[c]),r(re,{noKeyItemText:l,keyGroups:p,hasGroups:u,mapStyle:n})}}],buttons:[{id:"mapKey",panelId:"mapKey",label:"Key",iconId:"key",mobile:{slot:"top-left",showLabel:!1},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"key",svgContent:'<path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/>'}]};export{oe as manifest};
|
|
1
|
+
import{useState as e,useEffect as t}from"preact/compat";import{jsx as r,jsxs as o}from"preact/jsx-runtime";import n from"@babel/runtime/helpers/defineProperty";import l from"@babel/runtime/helpers/asyncToGenerator";var a=null,i=e=>a=e,c={"cross-hatch":'<path d="M0 4.486V3.485h3.5V.001h1v3.484h7.002V.001h1v3.484h3.5v1.001h-3.5v7h3.5v.999h-3.5v3.516h-1v-3.516H4.499v3.516h-1v-3.516H0v-.999h3.5v-7H0zm11.501 0H4.499v7h7.002v-7z" fill="{{foregroundColor}}"/>',"diagonal-cross-hatch":'<path d="M0 8.707V7.293L7.293 0h1.414L16 7.293v1.414L8.707 16H7.293L0 8.707zM.707 8L8 15.293 15.293 8 8 .707.707 8z" fill="{{foregroundColor}}"/>',"forward-diagonal-hatch":'<path d="M16 8.707V7.293L7.293 16h1.414L16 8.707zm-16 0L8.707 0H7.293L0 7.293v1.414z" fill="{{foregroundColor}}"/>',"backward-diagonal-hatch":'<path d="M0 8.707V7.293L8.707 16H7.293L0 8.707zm16 0L7.293 0h1.414L16 7.293v1.414z" fill="{{foregroundColor}}"/>',"horizontal-hatch":'<path d="M0 4.5V3.499h15.999V4.5H0zm0 7h15.999V12.5H0v-1.001z" fill="{{foregroundColor}}"/>',"vertical-hatch":'<path d="M3.501 16.001V0h1v16.001h-1zm7.998 0V0h1v16.001h-1z" fill="{{foregroundColor}}"/>',dot:'<path d="M3.999 2A2 2 0 0 1 6 3.999C6 5.103 5.103 6 3.999 6a2 2 0 0 1-1.999-2.001A2 2 0 0 1 3.999 2zm0 7.999C5.103 10 6 10.897 6 12.001A2 2 0 0 1 3.999 14a2 2 0 0 1-1.999-1.999A2 2 0 0 1 3.999 10zM11.999 2A2 2 0 0 1 14 3.999C14 5.103 13.103 6 11.999 6S10 5.103 10 3.999A2 2 0 0 1 11.999 2zm0 7.999c1.104 0 2.001.897 2.001 2.001A2 2 0 0 1 11.999 14 2 2 0 0 1 10 12.001c0-1.104.897-2.001 1.999-2.001z" fill="{{foregroundColor}}"/>',diamond:'<path d="M4 .465L7.535 4 4 7.535.465 4 4 .465zm0 7.999l3.535 3.535L4 15.535.465 11.999 4 8.464zm8-8l3.535 3.535-3.536 3.536L8.464 4 12 .464zm0 8.001L15.536 12 12 15.536 8.465 12 12 8.465z" fill="{{foregroundColor}}"/>'},s=(e,t)=>{if(!e)return null;if("string"==typeof e)return e.trim();if("object"==typeof e){if(t&&e[t])return e[t];var r=Object.values(e)[0];return null!=r?r:null}return null},p=(e,t,r)=>e.replace(/\{\{foregroundColor\}\}/g,t||"black").replace(/\{\{backgroundColor\}\}/g,r),u=new Map,f={register(e,t){u.set(e,{id:e,svgContent:t})},get:e=>u.get(e),list:()=>[...u.values()],clear(){u.clear()},initialise(){Object.entries(c).forEach(e=>{var[t,r]=e;this.register(t,r)})},getPatternInnerContent(e){return e.fillPatternSvgContent?e.fillPatternSvgContent:e.fillPattern&&null!==(t=null===(r=this.get(e.fillPattern))||void 0===r?void 0:r.svgContent)&&void 0!==t?t:null;var t,r},getKeyPatternPaths(e,t){var r=this.getPatternInnerContent(e);if(!r)return null;var o=s(e.fillPatternForegroundColor,t)||"black",n=s(e.fillPatternBackgroundColor,t)||"transparent",l=s(e.stroke,t)||o;return{border:p('<path d="M19 2.862v14.275c0 1.028-.835 1.862-1.862 1.862H2.863c-1.028 0-1.862-.835-1.862-1.862V2.862C1.001 1.834 1.836 1 2.863 1h14.275C18.166 1 19 1.835 19 2.862z" fill="{{backgroundColor}}" stroke="{{foregroundColor}}" stroke-width="2"/>',l,n),content:p(r,o,n)}},getPatternImageId(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=this.getPatternInnerContent(e);if(!o)return null;var n=s(e.fillPatternForegroundColor,t)||"black",l=s(e.fillPatternBackgroundColor,t)||"transparent",a=(e=>Math.max(2,2*e))(r);return"pattern-".concat((e=>{var t=0;for(var r of e)t=Math.trunc((t<<5)-t+r.codePointAt(0));return Math.abs(t).toString(36)})(o+n+l),"-").concat(a,"x")}};f.initialise();var d={symbol:"pin",backgroundColor:"#ca3535",foregroundColor:"#ffffff"},h={dot:"M8 3c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.241 5-5-2.24-5-5-5z",cross:"M6 3H10V6H13V10H10V13H6V10H3V6H6Z",diamond:"M8 2L14 8L8 14L2 8Z",triangle:"M8 2L14 14H2Z",square:"M3 3H13V13H3Z"},y={id:"pin",viewBox:"0 0 44 44",anchor:[.5,.9],graphic:h.dot,svg:'<path d="M22 40.999c-3.621 0-8.306-5.864-10.258-8.3C9.02 29.302 6 23.66 6 19.002a16.01 16.01 0 0 1 16-16 16.01 16.01 0 0 1 16 16c0 4.658-3.02 10.3-5.742 13.697-1.952 2.437-6.637 8.3-10.258 8.3z" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M22 7.001a12.01 12.01 0 0 1 12 12c0 7.623-10.377 17.998-12 17.998S10 26.624 10 19.001a12.01 12.01 0 0 1 12-12z" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 19) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},m={id:"circle",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:h.dot,svg:'<circle cx="22" cy="22" r="16" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <circle cx="22" cy="22" r="12" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},g={id:"square",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:h.dot,svg:'<path d="M13 6h18c3.863 0 7 3.137 7 7v18c0 3.863-3.137 7-7 7H13c-3.863 0-7-3.137-7-7V13c0-3.863 3.137-7 7-7" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M13 34a3 3 0 0 1-3-3V13a3 3 0 0 1 3-3h18a3 3 0 0 1 3 3v18a3 3 0 0 1-3 3H13z" fill-rule="nonzero" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},v=new Set(["symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"]),b=e=>{if(!(e=>!(!e.symbol&&!e.symbolSvgContent))(e))return{};var t={};return v.forEach(r=>{if(null!=e[r]){var o=r.charAt(6).toLowerCase()+r.slice(7);t[o]=e[r]}}),t},O=(e,t)=>{var r;return e.symbolViewBox?e.symbolViewBox:null!==(r=null==t?void 0:t.viewBox)&&void 0!==r?r:"0 0 38 38"},k={light:{haloColor:"#ffffff",selectedColor:"#0b0c0c",activeColor:"#ffdd00",foregroundColor:"#0b0c0c"},dark:{haloColor:"#0b0c0c",selectedColor:"#ffffff",activeColor:"#ffdd00",foregroundColor:"#ffffff"}};function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}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){n(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}var C=new Map,S=new Map,P={},D=e=>{var t=0;for(var r of e)t=Math.trunc((t<<5)-t+r.codePointAt(0));return Math.abs(t).toString(36)},M=new Set(["id","svg","viewBox","anchor","symbol","symbolSvgContent"]);function x(e,t,r){var o,n,l,a,i=null==r?void 0:r.id,c=Object.fromEntries(Object.entries(e||{}).filter(e=>{var[t]=e;return!M.has(t)})),p=Object.fromEntries(Object.entries(P).filter(e=>{var[t]=e;return!M.has(t)})),u=Object.fromEntries(Object.entries(t).filter(e=>{var[,t]=e;return null!=t})),f=w(w(w(w({},d),p),c),u),y=null!==(o=k[null==r?void 0:r.mapColorScheme])&&void 0!==o?o:k.light;return f.haloColor=null!==(n=null==r?void 0:r.haloColor)&&void 0!==n?n:y.haloColor,f.selectedColor=null!==(l=null==r?void 0:r.selectedColor)&&void 0!==l?l:y.selectedColor,f.activeColor=null!==(a=null==r?void 0:r.activeColor)&&void 0!==a?a:y.activeColor,"string"==typeof f.graphic&&h[f.graphic]&&(f.graphic=h[f.graphic]),Object.fromEntries(Object.entries(f).map(e=>{var[t,r]=e;return[t,s(r,i)||""]}))}function L(e,t){return Object.entries(t).reduce((e,t)=>{var[r,o]=t;return e.replaceAll("{{".concat(r,"}}"),o)},e)}var z={setDefaults(e){P=e||{}},getDefaults:()=>w(w({},d),P),register(e){C.set(e.id,e)},get:e=>C.get(e),list:()=>[...C.values()],clear(){C.clear()},initialise(){this.register(y),this.register(m),this.register(g)},resolve(e,t,r){var o=x(e,t||{},r);return e?(o.selectedColor="none",o.activeColor="none",L(e.svg,o)):""},resolveActive(e,t,r){var o=x(e,t||{},r);return e?L(e.svg,o):""},resolveSelected(e,t,r){var o=x(e,t||{},r);return e?(o.activeColor="none",L(e.svg,o)):""},getSymbolImageId(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,n=this.getSymbolDef(e);if(!n)return null;var l=b(e),a=r?this.resolveActive(n,l,t):this.resolve(n,l,t);return"symbol-".concat(r?"act-":"").concat(D(a),"-").concat(o,"x")},getSymbolDef(e){return e.symbolSvgContent?{svg:e.symbolSvgContent}:e.symbol?this.get(e.symbol):void 0},rasteriseSymbolImage(e,t,r,o){var n=this;return l(function*(){var l=n.getSymbolDef(e);if(!l)return null;var a,i,c=b(e);"active"===r?(a=n.resolveActive(l,c,t),i="act-"):"selected"===r?(a=n.resolveSelected(l,c,t),i="sel-"):(a=n.resolve(l,c,t),i="");var s="symbol-".concat(i).concat(D(a),"-").concat(o,"x"),p=S.get(s);if(!p){var u=O(e,l),[,,f,d]=u.split(" ").map(Number),h='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(f*o,'" height="').concat(d*o,'" viewBox="').concat(u,'">').concat(a,"</svg>");p=yield((e,t,r)=>new Promise((o,n)=>{var l="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(e)),a=new Image(t,r);a.onload=()=>{var e=document.createElement("canvas");e.width=t,e.height=r;var n=e.getContext("2d");n.drawImage(a,0,0,t,r),o(n.getImageData(0,0,t,r))},a.onerror=()=>{n(new Error("Failed to rasterise SVG: ".concat(e.slice(0,80))))},a.src=l}))(h,f*o,d*o),S.set(s,p)}return{imageId:s,imageData:p}})()}};function I(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function H(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?I(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}z.initialise();var V=e=>{var{text:t}=e;return r("div",{className:"im-c-map-key",children:r("p",{className:"im-c-map-key__empty-message",children:t})})};function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function _(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var B=20,A={xmlns:"http://www.w3.org/2000/svg",width:B,height:B,viewBox:"0 0 ".concat(B," ").concat(B),className:"im-c-map-key-symbol","aria-hidden":"true",focusable:"false"},N=_(_({},A),{},{width:44,height:44,className:"im-c-map-key-symbol im-c-map-key-symbol--point"});function K(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function G(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?K(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):K(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var T=e=>{var{keyDefinition:t,mapStyle:n}=e,{style:l}=t,a=f.getKeyPatternPaths(l,n.id);return a?o("svg",G(G({},A),{},{children:[r("g",{dangerouslySetInnerHTML:{__html:a.border}}),r("g",{transform:"translate(".concat(2,", ").concat(2,")"),dangerouslySetInnerHTML:{__html:a.content}})]})):null};function W(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function q(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?W(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):W(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var F=e=>{var t,{keyDefinition:o,mapStyle:n,symbolDef:l}=e,{style:a}=o,i=null!==(t=null==n?void 0:n.appColorScheme)&&void 0!==t?t:"light",c=q(q({},n),{},{mapColorScheme:i}),s=z.resolve(l,b(a),c),p=O(a,l);return s&&p?r("svg",q(q({},N),{},{viewBox:p,children:r("g",{dangerouslySetInnerHTML:{__html:s}})})):null};function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function Z(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){n(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}var U=e=>{var{mapStyle:t,keyDefinition:o}=e,{style:n}=o,l=n.strokeWidth,a=s(n.stroke,t.id);return r("svg",Z(Z({},A),{},{children:r("line",{x1:l/2,y1:10,x2:B-l/2,y2:10,stroke:a,strokeWidth:l,strokeLinecap:"round"})}))};function J(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function Q(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){n(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}var X=e=>{var{mapStyle:t,keyDefinition:o}=e,{style:n}=o,l=n.strokeWidth,a=s(n.fill,t.id),i=s(n.stroke,t.id);return r("svg",Q(Q({},A),{},{children:r("rect",{x:l/2,y:l/2,width:B-l,height:B-l,rx:l,ry:l,fill:a,stroke:i,strokeWidth:l,strokeLinejoin:"round"})}))},Y=e=>{var{mapStyle:t,keyDefinition:o}=e,{style:n}=o,l=s(n.fill,t.id),a=s(n.fill,t.id);return r("svg",{viewBox:"0 0 5 5",preserveAspectRatio:"none",fill:l,stroke:a,strokeWidth:"1",children:r("path",{d:"M0 0h5v5H0z"})})},$="horizontal-ramp",ee=e=>{var{keyDefinition:t,groupStyle:o,mapStyle:n}=e,{symbolShape:l,symbolDef:a}=((e,t)=>{if(!e)return{symbolShape:null,symbolDef:null};var{hasSymbol:r,hasPattern:o,style:n}=e;if(t===$)return{symbolShape:$,symbolDef:null};if(r){var l=z.getSymbolDef(n);return{symbolShape:l?"symbol":"rect",symbolDef:l}}return o?{symbolShape:"pattern",symbolDef:null}:"line"===n.keySymbolShape?{symbolShape:"line",symbolDef:null}:{symbolShape:"rect",symbolDef:null}})(t,o);return l?"symbol"===l?r(F,{mapStyle:n,keyDefinition:t,symbolDef:a}):r("pattern"===l?T:"line"===l?U:l===$?Y:X,{mapStyle:n,keyDefinition:t}):null},te=e=>{var{keyDefinition:t,groupStyle:n,mapStyle:l}=e,a=t.label,i=s(t.symbolDescription,l.id);return o("div",{className:"im-c-map-key-list__item",children:[r("dt",{className:"im-c-map-key-list__item-symbol",children:r(ee,{keyDefinition:t,groupStyle:n,mapStyle:l})}),o("dd",{className:"im-c-map-key-list__item-label",children:[a,i&&o("span",{className:"govuk-visually-hidden",children:["(",i,")"]})]})]})},re=e=>{var{headingId:t,label:n,groupStyle:l,keyDefinitions:a,mapStyle:i}=e,c="im-c-map-key-list"+(l?" im-c-map-key-list-".concat(l):"");return o("section",{className:"im-c-map-key__group","aria-labelledby":t,children:[r("h3",{id:t,className:"im-c-map-key__group-heading",children:n}),r("dl",{className:c,children:a.map(e=>r(te,{keyDefinition:e,mapStyle:i,groupStyle:l},"".concat(e.id)))})]})},oe="im-c-map-key",ne=e=>{var{item:t,groupStyle:o,mapStyle:n}=e;return"group"===t.type?r(re,{headingId:"key-heading-".concat(t.id),label:t.groupLabel,groupStyle:o,keyDefinitions:t.keyDefinitions,mapStyle:n}):r(te,{keyDefinition:t.keyDefinition,mapStyle:n})},le=e=>{var{noKeyItemText:t,keyGroups:o,hasGroups:n,mapStyle:l}=e;if(null==o||!o.length)return r(V,{text:t});var a=n?"".concat(oe," ").concat("im-c-map-key--has-groups"):oe;return r("div",{className:a,children:o.map(e=>r(ne,{item:e,mapStyle:l,groupStyle:e.groupStyle},e.id))})};var ae={InitComponent:function(e){var{mapState:r,services:o}=e,{eventBus:n}=o;t(()=>{r.isMapReady&&n.requestOnce("datasets:registry",i)},[r.isMapReady])},panels:[{id:"mapKey",label:"Key",mobile:{slot:"drawer",modal:!0},tablet:{slot:"left-top",width:"260px"},desktop:{slot:"left-top",width:"280px"},render:function(o){var{mapState:{mapStyle:n},pluginConfig:{noKeyItemText:l,groups:i},services:{eventBus:c}}=o,[s,p]=e(a),[u,f]=e(()=>{var e;return null!==(e=null==s?void 0:s.keyItems().items)&&void 0!==e?e:[]}),[d,h]=e(()=>{var e;return null!==(e=null==s?void 0:s.keyItems().hasGroups)&&void 0!==e&&e}),y=()=>{var{items:e,hasGroups:t}=s.keyItems(),r=((e,t)=>e?t.map(t=>{var{id:r}=t;return e[r]?H(H({},t),e[r]):t}):t)(i,e);f(r),h(t)},m=e=>{s.invalidateKeyItemsOnMenuStateChange(e),y()};return t(()=>s?(y(),c.on("menu:changed",m).on("datasets:changed",y),()=>c.off("menu:changed",m).off("datasets:changed",y)):(c.requestOnce("datasets:registry",p),()=>{}),[s]),r(le,{noKeyItemText:l,keyGroups:u,hasGroups:d,mapStyle:n})}}],buttons:[{id:"mapKey",panelId:"mapKey",label:"Key",iconId:"key",mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"key",svgContent:'<path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/>'}]};export{ae as manifest};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see im-map-key-plugin.js.LICENSE.txt */
|
|
2
|
-
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[414],{413(t,e,r){r.r(e),r.d(e,{manifest:()=>xt});var n=r(738),o=null,i=function(t){return o=t},a=r(287),l=function(t){var e=t.text;return(0,a.jsx)("div",{className:"im-c-map-key",children:(0,a.jsx)("p",{className:"im-c-map-key__empty-message",children:e})})};function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}var u=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===c(t)){if(e&&t[e])return t[e];var r=Object.values(t)[0];return null!=r?r:null}return null};function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function s(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?s(Object(r),!0).forEach(function(e){p(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function p(t,e,r){return(e=function(t){var e=function(t){if("object"!=f(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==f(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var m=20,b={xmlns:"http://www.w3.org/2000/svg",width:m,height:m,viewBox:"0 0 ".concat(m," ").concat(m),className:"im-c-map-key-symbol","aria-hidden":"true",focusable:"false"},v=y(y({},b),{},{width:44,height:44,className:"im-c-map-key-symbol im-c-map-key-symbol--point"}),d={"cross-hatch":'<path d="M0 4.486V3.485h3.5V.001h1v3.484h7.002V.001h1v3.484h3.5v1.001h-3.5v7h3.5v.999h-3.5v3.516h-1v-3.516H4.499v3.516h-1v-3.516H0v-.999h3.5v-7H0zm11.501 0H4.499v7h7.002v-7z" fill="{{foregroundColor}}"/>',"diagonal-cross-hatch":'<path d="M0 8.707V7.293L7.293 0h1.414L16 7.293v1.414L8.707 16H7.293L0 8.707zM.707 8L8 15.293 15.293 8 8 .707.707 8z" fill="{{foregroundColor}}"/>',"forward-diagonal-hatch":'<path d="M16 8.707V7.293L7.293 16h1.414L16 8.707zm-16 0L8.707 0H7.293L0 7.293v1.414z" fill="{{foregroundColor}}"/>',"backward-diagonal-hatch":'<path d="M0 8.707V7.293L8.707 16H7.293L0 8.707zm16 0L7.293 0h1.414L16 7.293v1.414z" fill="{{foregroundColor}}"/>',"horizontal-hatch":'<path d="M0 4.5V3.499h15.999V4.5H0zm0 7h15.999V12.5H0v-1.001z" fill="{{foregroundColor}}"/>',"vertical-hatch":'<path d="M3.501 16.001V0h1v16.001h-1zm7.998 0V0h1v16.001h-1z" fill="{{foregroundColor}}"/>',dot:'<path d="M3.999 2A2 2 0 0 1 6 3.999C6 5.103 5.103 6 3.999 6a2 2 0 0 1-1.999-2.001A2 2 0 0 1 3.999 2zm0 7.999C5.103 10 6 10.897 6 12.001A2 2 0 0 1 3.999 14a2 2 0 0 1-1.999-1.999A2 2 0 0 1 3.999 10zM11.999 2A2 2 0 0 1 14 3.999C14 5.103 13.103 6 11.999 6S10 5.103 10 3.999A2 2 0 0 1 11.999 2zm0 7.999c1.104 0 2.001.897 2.001 2.001A2 2 0 0 1 11.999 14 2 2 0 0 1 10 12.001c0-1.104.897-2.001 1.999-2.001z" fill="{{foregroundColor}}"/>',diamond:'<path d="M4 .465L7.535 4 4 7.535.465 4 4 .465zm0 7.999l3.535 3.535L4 15.535.465 11.999 4 8.464zm8-8l3.535 3.535-3.536 3.536L8.464 4 12 .464zm0 8.001L15.536 12 12 15.536 8.465 12 12 8.465z" fill="{{foregroundColor}}"/>'};function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var g=function(t,e,r){return t.replace(/\{\{foregroundColor\}\}/g,e||"black").replace(/\{\{backgroundColor\}\}/g,r||"transparent")};function S(t,e){if(t){if("string"==typeof t)return j(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?j(t,e):void 0}}function j(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var O=new Map,w={register:function(t,e){O.set(t,{id:t,svgContent:e})},get:function(t){return O.get(t)},list:function(){return function(t){if(Array.isArray(t))return j(t)}(t=O.values())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||S(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var t},clear:function(){O.clear()},initialise:function(){var t=this;Object.entries(d).forEach(function(e){var r,n,o=(n=2,function(t){if(Array.isArray(t))return t}(r=e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(r,n)||S(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],a=o[1];t.register(i,a)})},getPatternInnerContent:function(t){return t.fillPatternSvgContent?t.fillPatternSvgContent:t.fillPattern&&null!==(e=null===(r=this.get(t.fillPattern))||void 0===r?void 0:r.svgContent)&&void 0!==e?e:null;var e,r},getKeyPatternPaths:function(t,e){var r=this.getPatternInnerContent(t);if(!r)return null;var n=u(t.fillPatternForegroundColor,e)||"black",o=u(t.fillPatternBackgroundColor,e)||"transparent",i=u(t.stroke,e)||n;return{border:g('<path d="M19 2.862v14.275c0 1.028-.835 1.862-1.862 1.862H2.863c-1.028 0-1.862-.835-1.862-1.862V2.862C1.001 1.834 1.836 1 2.863 1h14.275C18.166 1 19 1.835 19 2.862z" fill="{{backgroundColor}}" stroke="{{foregroundColor}}" stroke-width="2"/>',i,o),content:g(r,n,o)}},getPatternImageId:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this.getPatternInnerContent(t);if(!n)return null;var o=u(t.fillPatternForegroundColor,e)||"black",i=u(t.fillPatternBackgroundColor,e)||"transparent",a=function(t){return Math.max(2,2*t)}(r);return"pattern-".concat(function(t){var e,r=0,n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return h(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}(t);try{for(n.s();!(e=n.n()).done;){var o=e.value;r=Math.trunc((r<<5)-r+o.codePointAt(0))}}catch(t){n.e(t)}finally{n.f()}return Math.abs(r).toString(36)}(n+o+i),"-").concat(a,"x")}};function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function P(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?P(Object(r),!0).forEach(function(e){x(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function x(t,e,r){return(e=function(t){var e=function(t){if("object"!=k(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==k(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}w.initialise();var D=function(t){var e=t.keyDefinition,r=t.mapStyle,n=e.style,o=w.getKeyPatternPaths(n,r.id);return o?(0,a.jsxs)("svg",C(C({},b),{},{children:[(0,a.jsx)("g",{dangerouslySetInnerHTML:{__html:o.border}}),(0,a.jsx)("g",{transform:"translate(".concat(2,", ").concat(2,")"),dangerouslySetInnerHTML:{__html:o.content}})]})):null},A=new Set(["symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"]),M=function(t){if(!function(t){return!(!t.symbol&&!t.symbolSvgContent)}(t))return{};var e={};return A.forEach(function(r){if(null!=t[r]){var n=r.charAt(6).toLowerCase()+r.slice(7);e[n]=t[r]}}),e},I=function(t,e){var r;return t.symbolViewBox?t.symbolViewBox:null!==(r=null==e?void 0:e.viewBox)&&void 0!==r?r:"0 0 38 38"},E={symbol:"pin",backgroundColor:"#ca3535",foregroundColor:"#ffffff"},L={dot:"M8 3c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.241 5-5-2.24-5-5-5z",cross:"M6 3H10V6H13V10H10V13H6V10H3V6H6Z",diamond:"M8 2L14 8L8 14L2 8Z",triangle:"M8 2L14 14H2Z",square:"M3 3H13V13H3Z"},z={id:"pin",viewBox:"0 0 44 44",anchor:[.5,.9],graphic:L.dot,svg:'<path d="M22 40.999c-3.621 0-8.306-5.864-10.258-8.3C9.02 29.302 6 23.66 6 19.002a16.01 16.01 0 0 1 16-16 16.01 16.01 0 0 1 16 16c0 4.658-3.02 10.3-5.742 13.697-1.952 2.437-6.637 8.3-10.258 8.3z" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M22 7.001a12.01 12.01 0 0 1 12 12c0 7.623-10.377 17.998-12 17.998S10 26.624 10 19.001a12.01 12.01 0 0 1 12-12z" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 19) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},H={id:"circle",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:L.dot,svg:'<circle cx="22" cy="22" r="16" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <circle cx="22" cy="22" r="12" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},_={id:"square",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:L.dot,svg:'<path d="M13 6h18c3.863 0 7 3.137 7 7v18c0 3.863-3.137 7-7 7H13c-3.863 0-7-3.137-7-7V13c0-3.863 3.137-7 7-7" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M13 34a3 3 0 0 1-3-3V13a3 3 0 0 1 3-3h18a3 3 0 0 1 3 3v18a3 3 0 0 1-3 3H13z" fill-rule="nonzero" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},T={light:{haloColor:"#ffffff",selectedColor:"#0b0c0c",activeColor:"#ffdd00",foregroundColor:"#0b0c0c"},dark:{haloColor:"#0b0c0c",selectedColor:"#ffffff",activeColor:"#ffdd00",foregroundColor:"#ffffff"}},V=function(t,e,r){return new Promise(function(n,o){var i="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(t)),a=new Image(e,r);a.onload=function(){var t=document.createElement("canvas");t.width=e,t.height=r;var o=t.getContext("2d");o.drawImage(a,0,0,e,r),n(o.getImageData(0,0,e,r))},a.onerror=function(){o(new Error("Failed to rasterise SVG: ".concat(t.slice(0,80))))},a.src=i})};function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function G(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof l?n:l,u=Object.create(c.prototype);return N(u,"_invoke",function(r,n,o){var i,l,c,u=0,f=o||[],s=!1,y={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return i=e,l=0,c=t,y.n=r,a}};function p(r,n){for(l=r,c=n,e=0;!s&&u&&!o&&e<f.length;e++){var o,i=f[e],p=y.p,m=i[2];r>3?(o=m===n)&&(c=i[(l=i[4])?5:(l=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=r<2&&p<i[1])?(l=0,y.v=n,y.n=i[1]):p<m&&(o=r<3||i[0]>n||n>m)&&(i[4]=r,i[5]=n,y.n=m,l=0))}if(o||r>1)return a;throw s=!0,n}return function(o,f,m){if(u>1)throw TypeError("Generator is already running");for(s&&1===f&&p(f,m),l=f,c=m;(e=l<2?t:c)||!s;){i||(l?l<3?(l>1&&(y.n=-1),p(l,c)):y.n=c:y.v=c);try{if(u=2,i){if(l||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,l<2&&(l=0)}else 1===l&&(e=i.return)&&e.call(i),l<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),l=1);i=t}else if((e=(s=y.n<0)?c:r.call(n,y))!==a)break}catch(e){i=t,l=1,c=e}finally{u=1}}return{value:e,done:s}}}(r,o,i),!0),u}var a={};function l(){}function c(){}function u(){}e=Object.getPrototypeOf;var f=[][n]?e(e([][n]())):(N(e={},n,function(){return this}),e),s=u.prototype=l.prototype=Object.create(f);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,N(t,o,"GeneratorFunction")),t.prototype=Object.create(s),t}return c.prototype=u,N(s,"constructor",u),N(u,"constructor",c),c.displayName="GeneratorFunction",N(u,o,"GeneratorFunction"),N(s),N(s,o,"Generator"),N(s,n,function(){return this}),N(s,"toString",function(){return"[object Generator]"}),(G=function(){return{w:i,m:y}})()}function N(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}N=function(t,e,r,n){function i(e,r){N(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},N(t,e,r,n)}function K(t,e,r,n,o,i,a){try{var l=t[i](a),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function F(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function W(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?F(Object(r),!0).forEach(function(e){R(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function R(t,e,r){return(e=function(t){var e=function(t){if("object"!=B(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=B(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==B(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function U(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(t,e)||q(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(t,e){if(t){if("string"==typeof t)return Z(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Z(t,e):void 0}}function Z(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var $=new Map,J=new Map,Q={},X=function(t){var e,r=0,n=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=q(t))){e&&(t=e);var r=0,n=function(){};return{s:n,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==e.return||e.return()}finally{if(a)throw o}}}}(t);try{for(n.s();!(e=n.n()).done;){var o=e.value;r=Math.trunc((r<<5)-r+o.codePointAt(0))}}catch(t){n.e(t)}finally{n.f()}return Math.abs(r).toString(36)},Y=new Set(["id","svg","viewBox","anchor","symbol","symbolSvgContent"]);function tt(t,e,r){var n,o,i,a,l=null==r?void 0:r.id,c=Object.fromEntries(Object.entries(t||{}).filter(function(t){var e=U(t,1)[0];return!Y.has(e)})),f=Object.fromEntries(Object.entries(Q).filter(function(t){var e=U(t,1)[0];return!Y.has(e)})),s=Object.fromEntries(Object.entries(e).filter(function(t){return null!=U(t,2)[1]})),y=W(W(W(W({},E),f),c),s),p=null!==(n=T[null==r?void 0:r.mapColorScheme])&&void 0!==n?n:T.light;return y.haloColor=null!==(o=null==r?void 0:r.haloColor)&&void 0!==o?o:p.haloColor,y.selectedColor=null!==(i=null==r?void 0:r.selectedColor)&&void 0!==i?i:p.selectedColor,y.activeColor=null!==(a=null==r?void 0:r.activeColor)&&void 0!==a?a:p.activeColor,"string"==typeof y.graphic&&L[y.graphic]&&(y.graphic=L[y.graphic]),Object.fromEntries(Object.entries(y).map(function(t){var e=U(t,2),r=e[0],n=e[1];return[r,u(n,l)||""]}))}function et(t,e){return Object.entries(e).reduce(function(t,e){var r=U(e,2),n=r[0],o=r[1];return t.replaceAll("{{".concat(n,"}}"),o)},t)}var rt={setDefaults:function(t){Q=t||{}},getDefaults:function(){return W(W({},E),Q)},register:function(t){$.set(t.id,t)},get:function(t){return $.get(t)},list:function(){return function(t){if(Array.isArray(t))return Z(t)}(t=$.values())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||q(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var t},clear:function(){$.clear()},initialise:function(){this.register(z),this.register(H),this.register(_)},resolve:function(t,e,r){var n=tt(t,e||{},r);return t?(n.selectedColor="none",n.activeColor="none",et(t.svg,n)):""},resolveActive:function(t,e,r){var n=tt(t,e||{},r);return t?et(t.svg,n):""},resolveSelected:function(t,e,r){var n=tt(t,e||{},r);return t?(n.activeColor="none",et(t.svg,n)):""},getSymbolImageId:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,o=this.getSymbolDef(t);if(!o)return null;var i=M(t),a=r?this.resolveActive(o,i,e):this.resolve(o,i,e);return"symbol-".concat(r?"act-":"").concat(X(a),"-").concat(n,"x")},getSymbolDef:function(t){return t.symbolSvgContent?{svg:t.symbolSvgContent}:t.symbol?this.get(t.symbol):void 0},rasteriseSymbolImage:function(t,e,r,n){var o,i=this;return(o=G().m(function o(){var a,l,c,u,f,s,y,p,m,b,v,d;return G().w(function(o){for(;;)switch(o.n){case 0:if(a=i.getSymbolDef(t)){o.n=1;break}return o.a(2,null);case 1:if(l=M(t),"active"===r?(c=i.resolveActive(a,l,e),u="act-"):"selected"===r?(c=i.resolveSelected(a,l,e),u="sel-"):(c=i.resolve(a,l,e),u=""),f="symbol-".concat(u).concat(X(c),"-").concat(n,"x"),s=J.get(f)){o.n=3;break}return y=I(t,a),p=y.split(" ").map(Number),m=U(p,4),b=m[2],v=m[3],d='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(b*n,'" height="').concat(v*n,'" viewBox="').concat(y,'">').concat(c,"</svg>"),o.n=2,V(d,b*n,v*n);case 2:s=o.v,J.set(f,s);case 3:return o.a(2,{imageId:f,imageData:s})}},o)}),function(){var t=this,e=arguments;return new Promise(function(r,n){var i=o.apply(t,e);function a(t){K(i,r,n,a,l,"next",t)}function l(t){K(i,r,n,a,l,"throw",t)}a(void 0)})})()}};function nt(t){return nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nt(t)}function ot(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function it(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ot(Object(r),!0).forEach(function(e){at(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ot(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function at(t,e,r){return(e=function(t){var e=function(t){if("object"!=nt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=nt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==nt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}rt.initialise();var lt=function(t){var e,r=t.keyDefinition,n=t.mapStyle,o=t.symbolDef,i=r.style,l=null!==(e=null==n?void 0:n.appColorScheme)&&void 0!==e?e:"light",c=it(it({},n),{},{mapColorScheme:l}),u=rt.resolve(o,M(i),c),f=I(i,o);return u&&f?(0,a.jsx)("svg",it(it({},v),{},{viewBox:f,children:(0,a.jsx)("g",{dangerouslySetInnerHTML:{__html:u}})})):null};function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ut(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function ft(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ut(Object(r),!0).forEach(function(e){st(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ut(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function st(t,e,r){return(e=function(t){var e=function(t){if("object"!=ct(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=ct(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ct(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var yt=function(t){var e=t.mapStyle,r=t.keyDefinition.style,n=r.strokeWidth,o=u(r.stroke,e.id);return(0,a.jsx)("svg",ft(ft({},b),{},{children:(0,a.jsx)("line",{x1:n/2,y1:10,x2:m-n/2,y2:10,stroke:o,strokeWidth:n,strokeLinecap:"round"})}))};function pt(t){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt(t)}function mt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function bt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?mt(Object(r),!0).forEach(function(e){vt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):mt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function vt(t,e,r){return(e=function(t){var e=function(t){if("object"!=pt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=pt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var dt=function(t){var e=t.mapStyle,r=t.keyDefinition.style,n=r.strokeWidth,o=u(r.fill,e.id),i=u(r.stroke,e.id);return(0,a.jsx)("svg",bt(bt({},b),{},{children:(0,a.jsx)("rect",{x:n/2,y:n/2,width:m-n,height:m-n,rx:n,ry:n,fill:o,stroke:i,strokeWidth:n,strokeLinejoin:"round"})}))},ht=function(t){var e=t.mapStyle,r=t.keyDefinition.style,n=u(r.fill,e.id),o=u(r.fill,e.id);return(0,a.jsx)("svg",{viewBox:"0 0 5 5",preserveAspectRatio:"none",fill:n,stroke:o,strokeWidth:"1",children:(0,a.jsx)("path",{d:"M0 0h5v5H0z"})})},gt=function(t){var e=t.keyDefinition,r=t.mapStyle,n=function(t){if(!t)return{symbolShape:null,symbolDef:null};var e=t.hasSymbol,r=t.hasPattern,n=t.hasRampStyleKey,o=t.style;if(n)return{symbolShape:"ramp",symbolDef:null};if(e){var i=rt.getSymbolDef(o);return{symbolShape:i?"symbol":"rect",symbolDef:i}}return r?{symbolShape:"pattern",symbolDef:null}:"line"===o.keySymbolShape?{symbolShape:"line",symbolDef:null}:{symbolShape:"rect",symbolDef:null}}(e),o=n.symbolShape,i=n.symbolDef;return o?"symbol"===o?(0,a.jsx)(lt,{mapStyle:r,keyDefinition:e,symbolDef:i}):"pattern"===o?(0,a.jsx)(D,{mapStyle:r,keyDefinition:e}):"line"===o?(0,a.jsx)(yt,{mapStyle:r,keyDefinition:e}):"ramp"===o?(0,a.jsx)(ht,{mapStyle:r,keyDefinition:e}):(0,a.jsx)(dt,{mapStyle:r,keyDefinition:e}):null},St=function(t){var e=t.keyDefinition,r=t.mapStyle,n=e.label,o=u(e.symbolDescription,r.id);return(0,a.jsxs)("div",{className:"im-c-map-key-list__item",children:[(0,a.jsx)("dt",{className:"im-c-map-key-list__item-symbol",children:(0,a.jsx)(gt,{keyDefinition:e,mapStyle:r})}),(0,a.jsxs)("dd",{className:"im-c-map-key-list__item-label",children:[n,o&&(0,a.jsxs)("span",{className:"govuk-visually-hidden",children:["(",o,")"]})]})]})},jt=function(t){var e=t.headingId,r=t.label,n=t.groupStyle,o=t.keyDefinitions,i=t.mapStyle,l="im-c-map-key-list"+(n?" im-c-map-key-list-".concat(n):"");return(0,a.jsxs)("section",{className:"im-c-map-key__group","aria-labelledby":e,children:[(0,a.jsx)("h3",{id:e,className:"im-c-map-key__group-heading",children:r}),(0,a.jsx)("dl",{className:l,children:o.map(function(t){return(0,a.jsx)(St,{keyDefinition:t,mapStyle:i,groupStyle:n},"".concat(t.id))})})]})},Ot="im-c-map-key",wt=function(t){var e=t.item,r=t.mapStyle;return"group"===e.type?(0,a.jsx)(jt,{headingId:"key-heading-".concat(e.id),label:e.groupLabel,groupStyle:e.groupStyle,keyDefinitions:e.keyDefinitions,mapStyle:r}):(0,a.jsx)(St,{keyDefinition:e.keyDefinition,mapStyle:r})},kt=function(t){var e=t.noKeyItemText,r=t.keyGroups,n=t.hasGroups,o=t.mapStyle;if(null==r||!r.length)return(0,a.jsx)(l,{text:e});var i=n?"".concat(Ot," ").concat("im-c-map-key--has-groups"):Ot;return(0,a.jsx)("div",{className:i,children:r.map(function(t){return(0,a.jsx)(wt,{item:t,mapStyle:o},t.id)})})};function Pt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ct(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ct(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var xt={InitComponent:function(t){var e=t.mapState,r=t.services.eventBus;(0,n.useEffect)(function(){e.isMapReady&&r.requestOnce("datasets:registry",i)},[e.isMapReady])},panels:[{id:"mapKey",label:"Key",mobile:{slot:"drawer",modal:!0},tablet:{slot:"left-top",width:"260px"},desktop:{slot:"left-top",width:"280px"},render:function(t){var e=t.mapState.mapStyle,r=t.pluginConfig.noKeyItemText,i=t.services.eventBus,l=Pt((0,n.useState)(o),2),c=l[0],u=l[1],f=Pt((0,n.useState)(function(){var t;return null!==(t=null==c?void 0:c.keyItems().items)&&void 0!==t?t:[]}),2),s=f[0],y=f[1],p=Pt((0,n.useState)(function(){var t;return null!==(t=null==c?void 0:c.keyItems().hasGroups)&&void 0!==t&&t}),2),m=p[0],b=p[1],v=function(){var t=c.keyItems(),e=t.items,r=t.hasGroups;y(e),b(r)},d=function(t){c.invalidateKeyItemsOnMenuStateChange(t),v()};return(0,n.useEffect)(function(){return c?(v(),i.on("menu:changed",d).on("datasets:changed",v),function(){return i.off("menu:changed",d).off("datasets:changed",v)}):(i.requestOnce("datasets:registry",u),function(){})},[c]),(0,a.jsx)(kt,{noKeyItemText:r,keyGroups:s,hasGroups:m,mapStyle:e})}}],buttons:[{id:"mapKey",panelId:"mapKey",label:"Key",iconId:"key",mobile:{slot:"top-left",showLabel:!1},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"key",svgContent:'<path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/>'}]}}}]);
|
|
2
|
+
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[414],{249(t,e,r){r.r(e),r.d(e,{manifest:()=>Et});var n=r(738),o=null,i=function(t){return o=t};function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach(function(e){u(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function u(t,e,r){return(e=function(t){var e=function(t){if("object"!=l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==l(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var f=r(287),s=function(t){var e=t.text;return(0,f.jsx)("div",{className:"im-c-map-key",children:(0,f.jsx)("p",{className:"im-c-map-key__empty-message",children:e})})};function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}var p=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===y(t)){if(e&&t[e])return t[e];var r=Object.values(t)[0];return null!=r?r:null}return null};function m(t){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},m(t)}function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function v(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach(function(e){d(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function d(t,e,r){return(e=function(t){var e=function(t){if("object"!=m(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==m(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var h=20,g={xmlns:"http://www.w3.org/2000/svg",width:h,height:h,viewBox:"0 0 ".concat(h," ").concat(h),className:"im-c-map-key-symbol","aria-hidden":"true",focusable:"false"},S=v(v({},g),{},{width:44,height:44,className:"im-c-map-key-symbol im-c-map-key-symbol--point"}),j={"cross-hatch":'<path d="M0 4.486V3.485h3.5V.001h1v3.484h7.002V.001h1v3.484h3.5v1.001h-3.5v7h3.5v.999h-3.5v3.516h-1v-3.516H4.499v3.516h-1v-3.516H0v-.999h3.5v-7H0zm11.501 0H4.499v7h7.002v-7z" fill="{{foregroundColor}}"/>',"diagonal-cross-hatch":'<path d="M0 8.707V7.293L7.293 0h1.414L16 7.293v1.414L8.707 16H7.293L0 8.707zM.707 8L8 15.293 15.293 8 8 .707.707 8z" fill="{{foregroundColor}}"/>',"forward-diagonal-hatch":'<path d="M16 8.707V7.293L7.293 16h1.414L16 8.707zm-16 0L8.707 0H7.293L0 7.293v1.414z" fill="{{foregroundColor}}"/>',"backward-diagonal-hatch":'<path d="M0 8.707V7.293L8.707 16H7.293L0 8.707zm16 0L7.293 0h1.414L16 7.293v1.414z" fill="{{foregroundColor}}"/>',"horizontal-hatch":'<path d="M0 4.5V3.499h15.999V4.5H0zm0 7h15.999V12.5H0v-1.001z" fill="{{foregroundColor}}"/>',"vertical-hatch":'<path d="M3.501 16.001V0h1v16.001h-1zm7.998 0V0h1v16.001h-1z" fill="{{foregroundColor}}"/>',dot:'<path d="M3.999 2A2 2 0 0 1 6 3.999C6 5.103 5.103 6 3.999 6a2 2 0 0 1-1.999-2.001A2 2 0 0 1 3.999 2zm0 7.999C5.103 10 6 10.897 6 12.001A2 2 0 0 1 3.999 14a2 2 0 0 1-1.999-1.999A2 2 0 0 1 3.999 10zM11.999 2A2 2 0 0 1 14 3.999C14 5.103 13.103 6 11.999 6S10 5.103 10 3.999A2 2 0 0 1 11.999 2zm0 7.999c1.104 0 2.001.897 2.001 2.001A2 2 0 0 1 11.999 14 2 2 0 0 1 10 12.001c0-1.104.897-2.001 1.999-2.001z" fill="{{foregroundColor}}"/>',diamond:'<path d="M4 .465L7.535 4 4 7.535.465 4 4 .465zm0 7.999l3.535 3.535L4 15.535.465 11.999 4 8.464zm8-8l3.535 3.535-3.536 3.536L8.464 4 12 .464zm0 8.001L15.536 12 12 15.536 8.465 12 12 8.465z" fill="{{foregroundColor}}"/>'};function O(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var w=function(t,e,r){return t.replace(/\{\{foregroundColor\}\}/g,e||"black").replace(/\{\{backgroundColor\}\}/g,r||"transparent")};function k(t,e){if(t){if("string"==typeof t)return P(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?P(t,e):void 0}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var C=new Map,x={register:function(t,e){C.set(t,{id:t,svgContent:e})},get:function(t){return C.get(t)},list:function(){return function(t){if(Array.isArray(t))return P(t)}(t=C.values())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||k(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var t},clear:function(){C.clear()},initialise:function(){var t=this;Object.entries(j).forEach(function(e){var r,n,o=(n=2,function(t){if(Array.isArray(t))return t}(r=e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,l,a=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(u)throw o}}return a}}(r,n)||k(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],l=o[1];t.register(i,l)})},getPatternInnerContent:function(t){return t.fillPatternSvgContent?t.fillPatternSvgContent:t.fillPattern&&null!==(e=null===(r=this.get(t.fillPattern))||void 0===r?void 0:r.svgContent)&&void 0!==e?e:null;var e,r},getKeyPatternPaths:function(t,e){var r=this.getPatternInnerContent(t);if(!r)return null;var n=p(t.fillPatternForegroundColor,e)||"black",o=p(t.fillPatternBackgroundColor,e)||"transparent",i=p(t.stroke,e)||n;return{border:w('<path d="M19 2.862v14.275c0 1.028-.835 1.862-1.862 1.862H2.863c-1.028 0-1.862-.835-1.862-1.862V2.862C1.001 1.834 1.836 1 2.863 1h14.275C18.166 1 19 1.835 19 2.862z" fill="{{backgroundColor}}" stroke="{{foregroundColor}}" stroke-width="2"/>',i,o),content:w(r,n,o)}},getPatternImageId:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this.getPatternInnerContent(t);if(!n)return null;var o=p(t.fillPatternForegroundColor,e)||"black",i=p(t.fillPatternBackgroundColor,e)||"transparent",l=function(t){return Math.max(2,2*t)}(r);return"pattern-".concat(function(t){var e,r=0,n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return O(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?O(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return l=t.done,t},e:function(t){a=!0,i=t},f:function(){try{l||null==r.return||r.return()}finally{if(a)throw i}}}}(t);try{for(n.s();!(e=n.n()).done;){var o=e.value;r=Math.trunc((r<<5)-r+o.codePointAt(0))}}catch(t){n.e(t)}finally{n.f()}return Math.abs(r).toString(36)}(n+o+i),"-").concat(l,"x")}};function D(t){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D(t)}function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function M(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach(function(e){I(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function I(t,e,r){return(e=function(t){var e=function(t){if("object"!=D(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=D(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==D(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}x.initialise();var E=function(t){var e=t.keyDefinition,r=t.mapStyle,n=e.style,o=x.getKeyPatternPaths(n,r.id);return o?(0,f.jsxs)("svg",M(M({},g),{},{children:[(0,f.jsx)("g",{dangerouslySetInnerHTML:{__html:o.border}}),(0,f.jsx)("g",{transform:"translate(".concat(2,", ").concat(2,")"),dangerouslySetInnerHTML:{__html:o.content}})]})):null},L=new Set(["symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"]),z=function(t){if(!function(t){return!(!t.symbol&&!t.symbolSvgContent)}(t))return{};var e={};return L.forEach(function(r){if(null!=t[r]){var n=r.charAt(6).toLowerCase()+r.slice(7);e[n]=t[r]}}),e},H=function(t,e){var r;return t.symbolViewBox?t.symbolViewBox:null!==(r=null==e?void 0:e.viewBox)&&void 0!==r?r:"0 0 38 38"},T={symbol:"pin",backgroundColor:"#ca3535",foregroundColor:"#ffffff"},_={dot:"M8 3c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.241 5-5-2.24-5-5-5z",cross:"M6 3H10V6H13V10H10V13H6V10H3V6H6Z",diamond:"M8 2L14 8L8 14L2 8Z",triangle:"M8 2L14 14H2Z",square:"M3 3H13V13H3Z"},V={id:"pin",viewBox:"0 0 44 44",anchor:[.5,.9],graphic:_.dot,svg:'<path d="M22 40.999c-3.621 0-8.306-5.864-10.258-8.3C9.02 29.302 6 23.66 6 19.002a16.01 16.01 0 0 1 16-16 16.01 16.01 0 0 1 16 16c0 4.658-3.02 10.3-5.742 13.697-1.952 2.437-6.637 8.3-10.258 8.3z" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M22 7.001a12.01 12.01 0 0 1 12 12c0 7.623-10.377 17.998-12 17.998S10 26.624 10 19.001a12.01 12.01 0 0 1 12-12z" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 19) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},B={id:"circle",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:_.dot,svg:'<circle cx="22" cy="22" r="16" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <circle cx="22" cy="22" r="12" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},G={id:"square",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:_.dot,svg:'<path d="M13 6h18c3.863 0 7 3.137 7 7v18c0 3.863-3.137 7-7 7H13c-3.863 0-7-3.137-7-7V13c0-3.863 3.137-7 7-7" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M13 34a3 3 0 0 1-3-3V13a3 3 0 0 1 3-3h18a3 3 0 0 1 3 3v18a3 3 0 0 1-3 3H13z" fill-rule="nonzero" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},N={light:{haloColor:"#ffffff",selectedColor:"#0b0c0c",activeColor:"#ffdd00",foregroundColor:"#0b0c0c"},dark:{haloColor:"#0b0c0c",selectedColor:"#ffffff",activeColor:"#ffdd00",foregroundColor:"#ffffff"}},K=function(t,e,r){return new Promise(function(n,o){var i="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(t)),l=new Image(e,r);l.onload=function(){var t=document.createElement("canvas");t.width=e,t.height=r;var o=t.getContext("2d");o.drawImage(l,0,0,e,r),n(o.getImageData(0,0,e,r))},l.onerror=function(){o(new Error("Failed to rasterise SVG: ".concat(t.slice(0,80))))},l.src=i})};function F(t){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},F(t)}function W(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return U(u,"_invoke",function(r,n,o){var i,a,c,u=0,f=o||[],s=!1,y={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return i=e,a=0,c=t,y.n=r,l}};function p(r,n){for(a=r,c=n,e=0;!s&&u&&!o&&e<f.length;e++){var o,i=f[e],p=y.p,m=i[2];r>3?(o=m===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=r<2&&p<i[1])?(a=0,y.v=n,y.n=i[1]):p<m&&(o=r<3||i[0]>n||n>m)&&(i[4]=r,i[5]=n,y.n=m,a=0))}if(o||r>1)return l;throw s=!0,n}return function(o,f,m){if(u>1)throw TypeError("Generator is already running");for(s&&1===f&&p(f,m),a=f,c=m;(e=a<2?t:c)||!s;){i||(a?a<3?(a>1&&(y.n=-1),p(a,c)):y.n=c:y.v=c);try{if(u=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((e=(s=y.n<0)?c:r.call(n,y))!==l)break}catch(e){i=t,a=1,c=e}finally{u=1}}return{value:e,done:s}}}(r,o,i),!0),u}var l={};function a(){}function c(){}function u(){}e=Object.getPrototypeOf;var f=[][n]?e(e([][n]())):(U(e={},n,function(){return this}),e),s=u.prototype=a.prototype=Object.create(f);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,U(t,o,"GeneratorFunction")),t.prototype=Object.create(s),t}return c.prototype=u,U(s,"constructor",u),U(u,"constructor",c),c.displayName="GeneratorFunction",U(u,o,"GeneratorFunction"),U(s),U(s,o,"Generator"),U(s,n,function(){return this}),U(s,"toString",function(){return"[object Generator]"}),(W=function(){return{w:i,m:y}})()}function U(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}U=function(t,e,r,n){function i(e,r){U(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},U(t,e,r,n)}function q(t,e,r,n,o,i,l){try{var a=t[i](l),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function R(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function Z(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?R(Object(r),!0).forEach(function(e){$(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function $(t,e,r){return(e=function(t){var e=function(t){if("object"!=F(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=F(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==F(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function J(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,l,a=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(u)throw o}}return a}}(t,e)||Q(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Q(t,e){if(t){if("string"==typeof t)return X(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?X(t,e):void 0}}function X(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Y=new Map,tt=new Map,et={},rt=function(t){var e,r=0,n=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Q(t))){e&&(t=e);var r=0,n=function(){};return{s:n,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return i=t.done,t},e:function(t){l=!0,o=t},f:function(){try{i||null==e.return||e.return()}finally{if(l)throw o}}}}(t);try{for(n.s();!(e=n.n()).done;){var o=e.value;r=Math.trunc((r<<5)-r+o.codePointAt(0))}}catch(t){n.e(t)}finally{n.f()}return Math.abs(r).toString(36)},nt=new Set(["id","svg","viewBox","anchor","symbol","symbolSvgContent"]);function ot(t,e,r){var n,o,i,l,a=null==r?void 0:r.id,c=Object.fromEntries(Object.entries(t||{}).filter(function(t){var e=J(t,1)[0];return!nt.has(e)})),u=Object.fromEntries(Object.entries(et).filter(function(t){var e=J(t,1)[0];return!nt.has(e)})),f=Object.fromEntries(Object.entries(e).filter(function(t){return null!=J(t,2)[1]})),s=Z(Z(Z(Z({},T),u),c),f),y=null!==(n=N[null==r?void 0:r.mapColorScheme])&&void 0!==n?n:N.light;return s.haloColor=null!==(o=null==r?void 0:r.haloColor)&&void 0!==o?o:y.haloColor,s.selectedColor=null!==(i=null==r?void 0:r.selectedColor)&&void 0!==i?i:y.selectedColor,s.activeColor=null!==(l=null==r?void 0:r.activeColor)&&void 0!==l?l:y.activeColor,"string"==typeof s.graphic&&_[s.graphic]&&(s.graphic=_[s.graphic]),Object.fromEntries(Object.entries(s).map(function(t){var e=J(t,2),r=e[0],n=e[1];return[r,p(n,a)||""]}))}function it(t,e){return Object.entries(e).reduce(function(t,e){var r=J(e,2),n=r[0],o=r[1];return t.replaceAll("{{".concat(n,"}}"),o)},t)}var lt={setDefaults:function(t){et=t||{}},getDefaults:function(){return Z(Z({},T),et)},register:function(t){Y.set(t.id,t)},get:function(t){return Y.get(t)},list:function(){return function(t){if(Array.isArray(t))return X(t)}(t=Y.values())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Q(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var t},clear:function(){Y.clear()},initialise:function(){this.register(V),this.register(B),this.register(G)},resolve:function(t,e,r){var n=ot(t,e||{},r);return t?(n.selectedColor="none",n.activeColor="none",it(t.svg,n)):""},resolveActive:function(t,e,r){var n=ot(t,e||{},r);return t?it(t.svg,n):""},resolveSelected:function(t,e,r){var n=ot(t,e||{},r);return t?(n.activeColor="none",it(t.svg,n)):""},getSymbolImageId:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,o=this.getSymbolDef(t);if(!o)return null;var i=z(t),l=r?this.resolveActive(o,i,e):this.resolve(o,i,e);return"symbol-".concat(r?"act-":"").concat(rt(l),"-").concat(n,"x")},getSymbolDef:function(t){return t.symbolSvgContent?{svg:t.symbolSvgContent}:t.symbol?this.get(t.symbol):void 0},rasteriseSymbolImage:function(t,e,r,n){var o,i=this;return(o=W().m(function o(){var l,a,c,u,f,s,y,p,m,b,v,d;return W().w(function(o){for(;;)switch(o.n){case 0:if(l=i.getSymbolDef(t)){o.n=1;break}return o.a(2,null);case 1:if(a=z(t),"active"===r?(c=i.resolveActive(l,a,e),u="act-"):"selected"===r?(c=i.resolveSelected(l,a,e),u="sel-"):(c=i.resolve(l,a,e),u=""),f="symbol-".concat(u).concat(rt(c),"-").concat(n,"x"),s=tt.get(f)){o.n=3;break}return y=H(t,l),p=y.split(" ").map(Number),m=J(p,4),b=m[2],v=m[3],d='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(b*n,'" height="').concat(v*n,'" viewBox="').concat(y,'">').concat(c,"</svg>"),o.n=2,K(d,b*n,v*n);case 2:s=o.v,tt.set(f,s);case 3:return o.a(2,{imageId:f,imageData:s})}},o)}),function(){var t=this,e=arguments;return new Promise(function(r,n){var i=o.apply(t,e);function l(t){q(i,r,n,l,a,"next",t)}function a(t){q(i,r,n,l,a,"throw",t)}l(void 0)})})()}};function at(t){return at="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},at(t)}function ct(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function ut(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ct(Object(r),!0).forEach(function(e){ft(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ct(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function ft(t,e,r){return(e=function(t){var e=function(t){if("object"!=at(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=at(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==at(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}lt.initialise();var st=function(t){var e,r=t.keyDefinition,n=t.mapStyle,o=t.symbolDef,i=r.style,l=null!==(e=null==n?void 0:n.appColorScheme)&&void 0!==e?e:"light",a=ut(ut({},n),{},{mapColorScheme:l}),c=lt.resolve(o,z(i),a),u=H(i,o);return c&&u?(0,f.jsx)("svg",ut(ut({},S),{},{viewBox:u,children:(0,f.jsx)("g",{dangerouslySetInnerHTML:{__html:c}})})):null};function yt(t){return yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yt(t)}function pt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function mt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?pt(Object(r),!0).forEach(function(e){bt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function bt(t,e,r){return(e=function(t){var e=function(t){if("object"!=yt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=yt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var vt=function(t){var e=t.mapStyle,r=t.keyDefinition.style,n=r.strokeWidth,o=p(r.stroke,e.id);return(0,f.jsx)("svg",mt(mt({},g),{},{children:(0,f.jsx)("line",{x1:n/2,y1:10,x2:h-n/2,y2:10,stroke:o,strokeWidth:n,strokeLinecap:"round"})}))};function dt(t){return dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dt(t)}function ht(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function gt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ht(Object(r),!0).forEach(function(e){St(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ht(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function St(t,e,r){return(e=function(t){var e=function(t){if("object"!=dt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=dt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var jt=function(t){var e=t.mapStyle,r=t.keyDefinition.style,n=r.strokeWidth,o=p(r.fill,e.id),i=p(r.stroke,e.id);return(0,f.jsx)("svg",gt(gt({},g),{},{children:(0,f.jsx)("rect",{x:n/2,y:n/2,width:h-n,height:h-n,rx:n,ry:n,fill:o,stroke:i,strokeWidth:n,strokeLinejoin:"round"})}))},Ot=function(t){var e=t.mapStyle,r=t.keyDefinition.style,n=p(r.fill,e.id),o=p(r.fill,e.id);return(0,f.jsx)("svg",{viewBox:"0 0 5 5",preserveAspectRatio:"none",fill:n,stroke:o,strokeWidth:"1",children:(0,f.jsx)("path",{d:"M0 0h5v5H0z"})})},wt="horizontal-ramp",kt=function(t){var e=t.keyDefinition,r=t.groupStyle,n=t.mapStyle,o=function(t,e){if(!t)return{symbolShape:null,symbolDef:null};var r=t.hasSymbol,n=t.hasPattern,o=t.style;if(e===wt)return{symbolShape:wt,symbolDef:null};if(r){var i=lt.getSymbolDef(o);return{symbolShape:i?"symbol":"rect",symbolDef:i}}return n?{symbolShape:"pattern",symbolDef:null}:"line"===o.keySymbolShape?{symbolShape:"line",symbolDef:null}:{symbolShape:"rect",symbolDef:null}}(e,r),i=o.symbolShape,l=o.symbolDef;return i?"symbol"===i?(0,f.jsx)(st,{mapStyle:n,keyDefinition:e,symbolDef:l}):"pattern"===i?(0,f.jsx)(E,{mapStyle:n,keyDefinition:e}):"line"===i?(0,f.jsx)(vt,{mapStyle:n,keyDefinition:e}):i===wt?(0,f.jsx)(Ot,{mapStyle:n,keyDefinition:e}):(0,f.jsx)(jt,{mapStyle:n,keyDefinition:e}):null},Pt=function(t){var e=t.keyDefinition,r=t.groupStyle,n=t.mapStyle,o=e.label,i=p(e.symbolDescription,n.id);return(0,f.jsxs)("div",{className:"im-c-map-key-list__item",children:[(0,f.jsx)("dt",{className:"im-c-map-key-list__item-symbol",children:(0,f.jsx)(kt,{keyDefinition:e,groupStyle:r,mapStyle:n})}),(0,f.jsxs)("dd",{className:"im-c-map-key-list__item-label",children:[o,i&&(0,f.jsxs)("span",{className:"govuk-visually-hidden",children:["(",i,")"]})]})]})},Ct=function(t){var e=t.headingId,r=t.label,n=t.groupStyle,o=t.keyDefinitions,i=t.mapStyle,l="im-c-map-key-list"+(n?" im-c-map-key-list-".concat(n):"");return(0,f.jsxs)("section",{className:"im-c-map-key__group","aria-labelledby":e,children:[(0,f.jsx)("h3",{id:e,className:"im-c-map-key__group-heading",children:r}),(0,f.jsx)("dl",{className:l,children:o.map(function(t){return(0,f.jsx)(Pt,{keyDefinition:t,mapStyle:i,groupStyle:n},"".concat(t.id))})})]})},xt="im-c-map-key",Dt=function(t){var e=t.item,r=t.groupStyle,n=t.mapStyle;return"group"===e.type?(0,f.jsx)(Ct,{headingId:"key-heading-".concat(e.id),label:e.groupLabel,groupStyle:r,keyDefinitions:e.keyDefinitions,mapStyle:n}):(0,f.jsx)(Pt,{keyDefinition:e.keyDefinition,mapStyle:n})},At=function(t){var e=t.noKeyItemText,r=t.keyGroups,n=t.hasGroups,o=t.mapStyle;if(null==r||!r.length)return(0,f.jsx)(s,{text:e});var i=n?"".concat(xt," ").concat("im-c-map-key--has-groups"):xt;return(0,f.jsx)("div",{className:i,children:r.map(function(t){return(0,f.jsx)(Dt,{item:t,mapStyle:o,groupStyle:t.groupStyle},t.id)})})};function Mt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,l,a=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(u)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return It(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?It(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function It(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Et={InitComponent:function(t){var e=t.mapState,r=t.services.eventBus;(0,n.useEffect)(function(){e.isMapReady&&r.requestOnce("datasets:registry",i)},[e.isMapReady])},panels:[{id:"mapKey",label:"Key",mobile:{slot:"drawer",modal:!0},tablet:{slot:"left-top",width:"260px"},desktop:{slot:"left-top",width:"280px"},render:function(t){var e=t.mapState.mapStyle,r=t.pluginConfig,i=r.noKeyItemText,l=r.groups,a=t.services.eventBus,u=Mt((0,n.useState)(o),2),s=u[0],y=u[1],p=Mt((0,n.useState)(function(){var t;return null!==(t=null==s?void 0:s.keyItems().items)&&void 0!==t?t:[]}),2),m=p[0],b=p[1],v=Mt((0,n.useState)(function(){var t;return null!==(t=null==s?void 0:s.keyItems().hasGroups)&&void 0!==t&&t}),2),d=v[0],h=v[1],g=function(){var t=s.keyItems(),e=t.items,r=t.hasGroups,n=function(t,e){return t?e.map(function(e){var r=e.id;return t[r]?c(c({},e),t[r]):e}):e}(l,e);b(n),h(r)},S=function(t){s.invalidateKeyItemsOnMenuStateChange(t),g()};return(0,n.useEffect)(function(){return s?(g(),a.on("menu:changed",S).on("datasets:changed",g),function(){return a.off("menu:changed",S).off("datasets:changed",g)}):(a.requestOnce("datasets:registry",y),function(){})},[s]),(0,f.jsx)(At,{noKeyItemText:i,keyGroups:m,hasGroups:d,mapStyle:e})}}],buttons:[{id:"mapKey",panelId:"mapKey",label:"Key",iconId:"key",mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"key",svgContent:'<path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/>'}]}}}]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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.mapKeyPlugin=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-map-key-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.mapKeyPlugin:",o.l=(r,n,i,a)=>{if(e[r])e[r].push(n);else{var u,c;if(void 0!==i)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var l=f[p];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+i){u=l;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+i),u.src=r),e[r]=[n];var s=(t,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),t)return t(n)},d=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),c&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=i);var a=o.p+o.u(t),u=new Error;o.l(a,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",u.name="ChunkLoadError",u.type=i,u.request=a,n[1](u)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,i,[a,u,c]=r,f=0;if(a.some(t=>0!==e[t])){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);c&&c(o)}for(t&&t(r);f<a.length;f++)i=a[f],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function u(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof f?n:f,p=Object.create(u.prototype);return c(p,"_invoke",function(r,n,o){var i,u,c,f=0,p=o||[],l=!1,s={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,u=0,c=e,s.n=r,a}};function d(r,n){for(u=r,c=n,t=0;!l&&f&&!o&&t<p.length;t++){var o,i=p[t],d=s.p,b=i[2];r>3?(o=b===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(u=0,s.v=n,s.n=i[1]):d<b&&(o=r<3||i[0]>n||n>b)&&(i[4]=r,i[5]=n,s.n=b,u=0))}if(o||r>1)return a;throw l=!0,n}return function(o,p,b){if(f>1)throw TypeError("Generator is already running");for(l&&1===p&&d(p,b),u=p,c=b;(t=u<2?e:c)||!l;){i||(u?u<3?(u>1&&(s.n=-1),d(u,c)):s.n=c:s.v=c);try{if(f=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(l=s.n<0)?c:r.call(n,s))!==a)break}catch(t){i=e,u=1,c=t}finally{f=1}}return{value:t,done:l}}}(r,o,i),!0),p}var a={};function f(){}function p(){}function l(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(c(t={},n,function(){return this}),t),d=l.prototype=f.prototype=Object.create(s);function b(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,c(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return p.prototype=l,c(d,"constructor",l),c(l,"constructor",p),p.displayName="GeneratorFunction",c(l,o,"GeneratorFunction"),c(d),c(d,o,"Generator"),c(d,n,function(){return this}),c(d,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:b}})()}function c(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,r,n){function i(t,r){c(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},c(e,t,r,n)}function f(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,t,r){return(t=function(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(){var e,t;return l(l({noKeyItemText:"No features displayed"},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"mapKey",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(414).then(o.bind(o,
|
|
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.mapKeyPlugin=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-map-key-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.mapKeyPlugin:",o.l=(r,n,i,a)=>{if(e[r])e[r].push(n);else{var u,c;if(void 0!==i)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var l=f[p];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+i){u=l;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+i),u.src=r),e[r]=[n];var s=(t,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),t)return t(n)},d=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),c&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=i);var a=o.p+o.u(t),u=new Error;o.l(a,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",u.name="ChunkLoadError",u.type=i,u.request=a,n[1](u)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,i,[a,u,c]=r,f=0;if(a.some(t=>0!==e[t])){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);c&&c(o)}for(t&&t(r);f<a.length;f++)i=a[f],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function u(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof f?n:f,p=Object.create(u.prototype);return c(p,"_invoke",function(r,n,o){var i,u,c,f=0,p=o||[],l=!1,s={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,u=0,c=e,s.n=r,a}};function d(r,n){for(u=r,c=n,t=0;!l&&f&&!o&&t<p.length;t++){var o,i=p[t],d=s.p,b=i[2];r>3?(o=b===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(u=0,s.v=n,s.n=i[1]):d<b&&(o=r<3||i[0]>n||n>b)&&(i[4]=r,i[5]=n,s.n=b,u=0))}if(o||r>1)return a;throw l=!0,n}return function(o,p,b){if(f>1)throw TypeError("Generator is already running");for(l&&1===p&&d(p,b),u=p,c=b;(t=u<2?e:c)||!l;){i||(u?u<3?(u>1&&(s.n=-1),d(u,c)):s.n=c:s.v=c);try{if(f=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(l=s.n<0)?c:r.call(n,s))!==a)break}catch(t){i=e,u=1,c=t}finally{f=1}}return{value:t,done:l}}}(r,o,i),!0),p}var a={};function f(){}function p(){}function l(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(c(t={},n,function(){return this}),t),d=l.prototype=f.prototype=Object.create(s);function b(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,c(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return p.prototype=l,c(d,"constructor",l),c(l,"constructor",p),p.displayName="GeneratorFunction",c(l,o,"GeneratorFunction"),c(d),c(d,o,"Generator"),c(d,n,function(){return this}),c(d,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:b}})()}function c(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,r,n){function i(t,r){c(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},c(e,t,r,n)}function f(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,t,r){return(t=function(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(){var e,t;return l(l({noKeyItemText:"No features displayed"},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"mapKey",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(414).then(o.bind(o,249));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:()=>d}),i.default})());
|
|
@@ -6,13 +6,13 @@ import { KeyGroupItem } from './KeyGroupItem.jsx'
|
|
|
6
6
|
const keyClassName = 'im-c-map-key'
|
|
7
7
|
const keyGroupsClassName = 'im-c-map-key--has-groups'
|
|
8
8
|
|
|
9
|
-
const KeyItemWrapper = ({ item, mapStyle }) => {
|
|
9
|
+
const KeyItemWrapper = ({ item, groupStyle, mapStyle }) => {
|
|
10
10
|
if (item.type === 'group') {
|
|
11
11
|
return (
|
|
12
12
|
<KeyGroupItem
|
|
13
13
|
headingId={`key-heading-${item.id}`}
|
|
14
14
|
label={item.groupLabel}
|
|
15
|
-
groupStyle={
|
|
15
|
+
groupStyle={groupStyle}
|
|
16
16
|
keyDefinitions={item.keyDefinitions}
|
|
17
17
|
mapStyle={mapStyle}
|
|
18
18
|
/>
|
|
@@ -35,10 +35,9 @@ export const Key = ({
|
|
|
35
35
|
// staging this through useState/useEffect meant a mount with groups briefly rendered without
|
|
36
36
|
// the --has-groups modifier, using flat spacing before the effect corrected it).
|
|
37
37
|
const className = hasGroups ? `${keyClassName} ${keyGroupsClassName}` : keyClassName
|
|
38
|
-
|
|
39
38
|
return (
|
|
40
39
|
<div className={className}>
|
|
41
|
-
{keyGroups.map(item => <KeyItemWrapper key={item.id} item={item} mapStyle={mapStyle} />)}
|
|
40
|
+
{keyGroups.map(item => <KeyItemWrapper key={item.id} item={item} mapStyle={mapStyle} groupStyle={item.groupStyle} />)}
|
|
42
41
|
</div>
|
|
43
42
|
)
|
|
44
43
|
}
|
|
@@ -70,10 +70,12 @@
|
|
|
70
70
|
margin: -12px 1px -12px -9px;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
.im-c-map-key-list-ramp {
|
|
73
|
+
.im-c-map-key-list-horizontal-ramp {
|
|
74
74
|
display: grid;
|
|
75
|
-
grid-
|
|
75
|
+
grid-auto-flow: column;
|
|
76
|
+
grid-auto-columns: 1fr;
|
|
76
77
|
direction: rtl;
|
|
78
|
+
margin-bottom: 10px;
|
|
77
79
|
.im-c-map-key-list__item {
|
|
78
80
|
padding: 0 !important;
|
|
79
81
|
position: relative !important;
|
|
@@ -83,7 +85,9 @@
|
|
|
83
85
|
.im-c-map-key-list__item-symbol {
|
|
84
86
|
margin: 0 !important;
|
|
85
87
|
width: 100%;
|
|
88
|
+
max-height: var(--line-height);
|
|
86
89
|
direction: ltr;
|
|
90
|
+
overflow-y: hidden;
|
|
87
91
|
svg {
|
|
88
92
|
display: block;
|
|
89
93
|
}
|
|
@@ -96,7 +100,6 @@
|
|
|
96
100
|
// Offset the label, so it sits below the border with the next box
|
|
97
101
|
white-space: nowrap;
|
|
98
102
|
text-align: center;
|
|
99
|
-
transform: translateX(-50%);
|
|
100
103
|
}
|
|
101
104
|
|
|
102
105
|
&:first-child { // rightmost visual cell (rtl) - add a curved corner
|
|
@@ -108,11 +111,6 @@
|
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
&:last-child { // leftmost visual cell (rtl)
|
|
111
|
-
// Hide the last child's label (ie the left-most one as the order is rtl)
|
|
112
|
-
.im-c-map-key-list__item-label {
|
|
113
|
-
display: none;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
114
|
.im-c-map-key-list__item-symbol { // add a curved corner
|
|
117
115
|
border-top-left-radius: 4px;
|
|
118
116
|
border-bottom-left-radius: 4px;
|
|
@@ -120,4 +118,8 @@
|
|
|
120
118
|
}
|
|
121
119
|
}
|
|
122
120
|
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.im-c-map-key .im-c-map-key__group:last-child .im-c-map-key-list-horizontal-ramp {
|
|
124
|
+
margin-bottom: 0;
|
|
123
125
|
}
|
|
@@ -52,8 +52,8 @@ describe('KeyGroupItem', () => {
|
|
|
52
52
|
})
|
|
53
53
|
|
|
54
54
|
it('appends the groupStyle modifier class to the dl when groupStyle is provided', () => {
|
|
55
|
-
const { container } = render(<KeyGroupItem {...baseProps} groupStyle='ramp' />)
|
|
56
|
-
expect(container.querySelector('dl').className).toBe('im-c-map-key-list im-c-map-key-list-ramp')
|
|
55
|
+
const { container } = render(<KeyGroupItem {...baseProps} groupStyle='horizontal-ramp' />)
|
|
56
|
+
expect(container.querySelector('dl').className).toBe('im-c-map-key-list im-c-map-key-list-horizontal-ramp')
|
|
57
57
|
})
|
|
58
58
|
|
|
59
59
|
it('uses the base dl class when groupStyle is not provided', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getValueForStyle } from '../../../../../src/utils/getValueForStyle.js'
|
|
2
2
|
import { KeySvg } from './KeySvg.jsx'
|
|
3
3
|
|
|
4
|
-
export const KeyItem = ({ keyDefinition, mapStyle }) => {
|
|
4
|
+
export const KeyItem = ({ keyDefinition, groupStyle, mapStyle }) => {
|
|
5
5
|
// Pure derivations of props — computed directly on every render rather than staged through
|
|
6
6
|
// useState/useEffect, so there's no post-mount frame where the label/description are blank
|
|
7
7
|
// (every panel reopen mounts this fresh, so that frame was visible as a flicker).
|
|
@@ -11,7 +11,7 @@ export const KeyItem = ({ keyDefinition, mapStyle }) => {
|
|
|
11
11
|
return (
|
|
12
12
|
<div className='im-c-map-key-list__item'>
|
|
13
13
|
<dt className='im-c-map-key-list__item-symbol'>
|
|
14
|
-
<KeySvg keyDefinition={keyDefinition} mapStyle={mapStyle} />
|
|
14
|
+
<KeySvg keyDefinition={keyDefinition} groupStyle={groupStyle} mapStyle={mapStyle} />
|
|
15
15
|
</dt>
|
|
16
16
|
<dd className='im-c-map-key-list__item-label'>
|
|
17
17
|
{label}
|