@defra/interactive-map 0.0.52-alpha → 0.0.54-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/dist/css/index.css +1 -1
  2. package/dist/esm/im-core.js +1 -1
  3. package/dist/esm/im-shell.js +1 -1
  4. package/dist/umd/im-core.js +1 -1
  5. package/dist/umd/index.js +1 -1
  6. package/docs/api/context.md +30 -12
  7. package/docs/api/marker-config.md +16 -8
  8. package/docs/api/symbol-config.md +24 -9
  9. package/docs/api/symbol-registry.md +49 -14
  10. package/docs/api.md +11 -3
  11. package/docs/plugins/datasets.md +6 -10
  12. package/docs/plugins/draw.md +2 -1
  13. package/docs/plugins/map-key.md +47 -4
  14. package/package.json +1 -1
  15. package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -1
  16. package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -1
  17. package/plugins/beta/map-styles/dist/umd/index.js +1 -1
  18. package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
  19. package/plugins/datasets/dist/esm/im-datasets-ol-adapter.js +1 -1
  20. package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
  21. package/plugins/datasets/dist/esm/mapboxStyleLayerAdapter.js +1 -1
  22. package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
  23. package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
  24. package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
  25. package/plugins/datasets/src/adapters/esri/esriLayerAdapter.js +6 -6
  26. package/plugins/datasets/src/adapters/esri/registry/esriDataset.test.js +1 -1
  27. package/plugins/datasets/src/adapters/maplibre/layerBuilders.js +10 -10
  28. package/plugins/datasets/src/adapters/maplibre/layerBuilders.test.js +22 -6
  29. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +9 -3
  30. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +18 -3
  31. package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.js +3 -3
  32. package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +20 -27
  33. package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.js +16 -70
  34. package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.test.js +30 -115
  35. package/plugins/datasets/src/adapters/openlayers/layerBuilders.js +11 -13
  36. package/plugins/datasets/src/adapters/openlayers/layerBuilders.test.js +11 -3
  37. package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.js +48 -19
  38. package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.test.js +101 -13
  39. package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.js +27 -28
  40. package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.test.js +51 -32
  41. package/plugins/datasets/src/fetch/createDynamicSource.js +2 -2
  42. package/plugins/datasets/src/initialise/DatasetsInit.jsx +2 -2
  43. package/plugins/datasets/src/initialise/defaults.js +16 -27
  44. package/plugins/datasets/src/initialise/defaults.test.js +25 -57
  45. package/plugins/datasets/src/initialise/initialiseDatasets.js +1 -4
  46. package/plugins/datasets/src/reducers/__data__/demoDatasets.js +1 -3
  47. package/plugins/datasets/src/reducers/mappedDatasetsReducer.test.js +1 -1
  48. package/plugins/datasets/src/registry/dataset.js +23 -17
  49. package/plugins/datasets/src/registry/dataset.test.js +114 -11
  50. package/plugins/datasets/src/registry/mapboxStyleDataset.js +1 -1
  51. package/plugins/datasets/src/registry/mapboxStyleDataset.test.js +1 -1
  52. package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
  53. package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
  54. package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
  55. package/plugins/draw/dist/esm/index.js +1 -1
  56. package/plugins/draw/dist/esm/liveDrawChecks.js +1 -1
  57. package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
  58. package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
  59. package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
  60. package/plugins/draw/dist/umd/index.js +1 -1
  61. package/plugins/draw/src/DrawInit.jsx +7 -5
  62. package/plugins/draw/src/DrawInit.test.jsx +18 -2
  63. package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.js +11 -5
  64. package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.test.js +27 -11
  65. package/plugins/draw/src/adapters/maplibre/mapboxDraw.js +12 -9
  66. package/plugins/draw/src/adapters/maplibre/mapboxDraw.test.js +18 -0
  67. package/plugins/draw/src/adapters/maplibre/pointSymbolImages.js +81 -56
  68. package/plugins/draw/src/adapters/maplibre/pointSymbolImages.test.js +149 -80
  69. package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.js +7 -6
  70. package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.test.js +22 -25
  71. package/plugins/draw/src/adapters/openlayers/core/OLDrawManager.js +26 -8
  72. package/plugins/draw/src/adapters/openlayers/core/OLDrawManager.test.js +58 -16
  73. package/plugins/draw/src/adapters/openlayers/core/styles.js +33 -20
  74. package/plugins/draw/src/adapters/openlayers/core/styles.test.js +47 -21
  75. package/plugins/draw/src/adapters/openlayers/olDraw.js +16 -12
  76. package/plugins/draw/src/adapters/openlayers/olDraw.test.js +27 -32
  77. package/plugins/draw/src/adapters/openlayers/point/pointSymbolImages.js +44 -49
  78. package/plugins/draw/src/adapters/openlayers/point/pointSymbolImages.test.js +100 -119
  79. package/plugins/draw/src/defaults.js +2 -6
  80. package/plugins/draw/src/utils/stripInternalProperties.test.js +2 -1
  81. package/plugins/draw/src/utils/symbolKeys.js +3 -4
  82. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  83. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  84. package/plugins/interact/dist/umd/index.js +1 -1
  85. package/plugins/map-key/dist/css/index.css +1 -1
  86. package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
  87. package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -2
  88. package/plugins/map-key/dist/umd/index.js +1 -1
  89. package/plugins/map-key/src/components/Key/Key.jsx +8 -4
  90. package/plugins/map-key/src/components/Key/Key.module.scss +144 -53
  91. package/plugins/map-key/src/components/Key/KeyGroupItem.jsx +36 -3
  92. package/plugins/map-key/src/components/Key/KeyGroupItem.test.jsx +44 -2
  93. package/plugins/map-key/src/components/Key/KeyItem.jsx +2 -2
  94. package/plugins/map-key/src/components/Key/KeySvg.jsx +19 -18
  95. package/plugins/map-key/src/components/Key/KeySvg.test.jsx +25 -18
  96. package/plugins/map-key/src/components/Key/KeySvgPattern.jsx +1 -2
  97. package/plugins/map-key/src/components/Key/KeySvgPattern.test.jsx +3 -1
  98. package/plugins/map-key/src/components/Key/KeySvgRamp.jsx +35 -6
  99. package/plugins/map-key/src/components/Key/KeySvgRamp.test.jsx +56 -16
  100. package/plugins/map-key/src/components/Key/KeySvgSymbol.jsx +26 -12
  101. package/plugins/map-key/src/components/Key/KeySvgSymbol.test.jsx +24 -74
  102. package/plugins/map-key/src/components/Key/MapKey.jsx +3 -1
  103. package/plugins/map-key/src/components/Key/svgProperties.js +8 -2
  104. package/plugins/map-key/src/components/Key/useRampOrientation.js +61 -0
  105. package/plugins/map-key/src/components/Key/useRampOrientation.test.jsx +155 -0
  106. package/plugins/map-key/src/index.js +34 -0
  107. package/plugins/map-key/src/reducers/mergeKeyGroupItems.test.js +15 -0
  108. package/plugins/map-key/src/registry/index.js +0 -2
  109. package/plugins/map-key/src/registry/index.test.js +1 -9
  110. package/plugins/map-key/src/utils/groupStyles.js +5 -2
  111. package/plugins/menu/src/registry/index.js +0 -2
  112. package/plugins/menu/src/registry/index.test.js +1 -9
  113. package/plugins/search/dist/esm/im-search-plugin.js +1 -1
  114. package/plugins/search/dist/umd/im-search-plugin.js +1 -1
  115. package/plugins/search/dist/umd/index.js +1 -1
  116. package/plugins/search/src/Search.jsx +0 -1
  117. package/plugins/search/src/components/Form/Form.jsx +3 -3
  118. package/plugins/search/src/components/Suggestions/Suggestions.jsx +2 -0
  119. package/plugins/search/src/components/Suggestions/Suggestions.test.jsx +6 -0
  120. package/plugins/search/src/defaults.js +3 -0
  121. package/plugins/search/src/events/formHandlers.js +3 -9
  122. package/plugins/search/src/events/formHandlers.test.js +6 -9
  123. package/plugins/search/src/events/inputHandlers.js +8 -2
  124. package/plugins/search/src/events/inputHandlers.test.js +20 -0
  125. package/plugins/search/src/events/suggestionHandlers.js +3 -5
  126. package/plugins/search/src/events/suggestionHandlers.test.js +5 -8
  127. package/plugins/search/src/utils/showResult.js +9 -0
  128. package/plugins/search/src/utils/showResult.test.js +16 -0
  129. package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
  130. package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
  131. package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
  132. package/providers/beta/openlayers/dist/umd/index.js +1 -1
  133. package/providers/beta/openlayers/src/openlayersProvider.js +102 -2
  134. package/providers/beta/openlayers/src/openlayersProvider.test.js +95 -0
  135. package/providers/beta/openlayers/src/utils/highlightFeatures.js +20 -25
  136. package/providers/beta/openlayers/src/utils/highlightFeatures.test.js +73 -38
  137. package/providers/beta/openlayers/src/utils/patternImages.js +61 -0
  138. package/providers/beta/openlayers/src/utils/patternImages.test.js +74 -0
  139. package/providers/beta/openlayers/src/utils/symbolImages.js +103 -95
  140. package/providers/beta/openlayers/src/utils/symbolImages.test.js +136 -85
  141. package/providers/mapProvider.js +53 -1
  142. package/providers/mapProvider.test.js +6 -0
  143. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  144. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  145. package/providers/maplibre/dist/umd/index.js +1 -1
  146. package/providers/maplibre/src/maplibreProvider.js +50 -17
  147. package/providers/maplibre/src/maplibreProvider.test.js +74 -20
  148. package/providers/maplibre/src/utils/highlightFeatures.js +19 -14
  149. package/providers/maplibre/src/utils/highlightFeatures.test.js +20 -14
  150. package/providers/maplibre/src/utils/patternImages.js +46 -29
  151. package/providers/maplibre/src/utils/patternImages.test.js +52 -4
  152. package/providers/maplibre/src/utils/symbolImages.js +80 -39
  153. package/providers/maplibre/src/utils/symbolImages.test.js +157 -54
  154. package/src/App/components/Hints/Hints.module.scss +1 -1
  155. package/src/App/components/Markers/Markers.jsx +16 -25
  156. package/src/App/components/Markers/Markers.test.jsx +34 -48
  157. package/src/App/components/Markers/SymbolLabelMarker.jsx +1 -1
  158. package/src/App/components/Markers/SymbolMarker.jsx +1 -1
  159. package/src/App/components/Viewport/Viewport.jsx +6 -4
  160. package/src/App/components/Viewport/Viewport.test.jsx +18 -1
  161. package/src/App/hooks/useMapAnnouncements.js +7 -2
  162. package/src/App/hooks/useMapAnnouncements.test.js +13 -2
  163. package/src/App/hooks/useModalPanelBehaviour.js +3 -1
  164. package/src/App/initialiseApp.js +1 -1
  165. package/src/App/store/ServiceProvider.jsx +12 -3
  166. package/src/App/store/ServiceProvider.test.jsx +39 -0
  167. package/src/InteractiveMap/InteractiveMap.js +3 -3
  168. package/src/config/appConfig.js +1 -5
  169. package/src/config/mapSizeScales.js +8 -0
  170. package/src/config/symbolConfig.js +101 -25
  171. package/src/services/mapFocus.js +64 -0
  172. package/src/services/mapFocus.test.js +76 -0
  173. package/src/services/patternRegistry.js +97 -76
  174. package/src/services/patternRegistry.test.js +19 -1
  175. package/src/services/symbolComposer.js +184 -0
  176. package/src/services/symbolComposer.test.js +132 -0
  177. package/src/services/symbolRegistry.js +326 -155
  178. package/src/services/symbolRegistry.test.js +334 -32
  179. package/src/types.js +11 -5
  180. package/src/utils/detectInterfaceType.js +16 -5
  181. package/src/utils/detectInterfaceType.test.js +32 -0
  182. package/src/utils/hashString.js +23 -0
  183. package/src/utils/hashString.test.js +29 -0
  184. package/src/utils/imageDataCache.js +43 -0
  185. package/src/utils/imageDataCache.test.js +38 -0
  186. package/src/utils/pathBounds.js +330 -0
  187. package/src/utils/pathBounds.test.js +145 -0
  188. package/src/utils/patternUtils.js +0 -8
  189. package/src/utils/patternUtils.test.js +0 -25
  190. package/src/utils/recentImageSets.js +35 -0
  191. package/src/utils/recentImageSets.test.js +46 -0
  192. package/src/utils/symbolUtils.js +26 -29
  193. package/src/utils/symbolUtils.test.js +27 -41
  194. package/plugins/map-key/dist/umd/im-map-key-plugin.js.LICENSE.txt +0 -1
@@ -1 +1 @@
1
- import{useState as e,useEffect as t,useRef as r}from"preact/compat";import{jsx as o,jsxs as n}from"preact/jsx-runtime";import i from"@babel/runtime/helpers/defineProperty";import l from"@babel/runtime/helpers/asyncToGenerator";var a=null,c=e=>a=e,s={"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}}"/>'},p=(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},u=e=>Math.max(2,2*e),f=(e,t,r)=>e.replace(/\{\{foregroundColor\}\}/g,t||"black").replace(/\{\{backgroundColor\}\}/g,r||"transparent"),d=(e,t,r)=>new Promise((o,n)=>{var i="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(e)),l=new Image(t,r);l.onload=()=>{var e=document.createElement("canvas");e.width=t,e.height=r;var n=e.getContext("2d");n.drawImage(l,0,0,t,r),o(n.getImageData(0,0,t,r))},l.onerror=()=>{n(new Error("Failed to rasterise SVG: ".concat(e.slice(0,80))))},l.src=i}),y=new Map,g=new Map,h={register(e,t){y.set(e,{id:e,svgContent:t})},get:e=>y.get(e),list:()=>[...y.values()],clear(){y.clear()},initialise(){Object.entries(s).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=p(e.fillPatternForegroundColor,t)||"black",n=p(e.fillPatternBackgroundColor,t)||"transparent",i=p(e.stroke,t)||o;return{border:f('<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,n),content:f(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=p(e.fillPatternForegroundColor,t)||"black",i=p(e.fillPatternBackgroundColor,t)||"transparent",l=u(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+i),"-").concat(l,"x")},rasterisePatternImage(e,t){var r=arguments,o=this;return l(function*(){var n=r.length>2&&void 0!==r[2]?r[2]:1,i=o.getPatternInnerContent(e);if(!i)return null;var l=o.getPatternImageId(e,t,n);if(!l)return null;var a=g.get(l);if(!a){var c=p(e.fillPatternForegroundColor,t)||"black",s=p(e.fillPatternBackgroundColor,t)||"transparent",y=f(i,c,s),h='<rect width="16" height="16" fill="'.concat(s,'"/>'),v=u(n),m=Math.round(8*v),b='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(m,'" height="').concat(m,'" viewBox="0 0 16 16">').concat(h).concat(y,"</svg>");a=yield d(b,m,m),g.set(l,a)}return{imageId:l,imageData:a}})()}};h.initialise();var v={symbol:"pin",backgroundColor:"#ca3535",foregroundColor:"#ffffff"},m={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"},b={id:"pin",viewBox:"0 0 44 44",anchor:[.5,.9],graphic:m.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>'},O={id:"circle",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:m.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>'},j={id:"square",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:m.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>'},k=new Set(["symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"]),w=e=>{if(!(e=>!(!e.symbol&&!e.symbolSvgContent))(e))return{};var t={};return k.forEach(r=>{if(null!=e[r]){var o=r.charAt(6).toLowerCase()+r.slice(7);t[o]=e[r]}}),t},P=(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"},S={light:{haloColor:"#ffffff",selectedColor:"#0b0c0c",activeColor:"#ffdd00",foregroundColor:"#0b0c0c"},dark:{haloColor:"#0b0c0c",selectedColor:"#ffffff",activeColor:"#ffdd00",foregroundColor:"#ffffff"}};function D(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?D(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):D(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var M=new Map,L=new Map,x={},I=e=>{var t=0;for(var r of e)t=Math.trunc((t<<5)-t+r.codePointAt(0));return Math.abs(t).toString(36)},E=new Set(["id","svg","viewBox","anchor","symbol","symbolSvgContent"]);function _(e,t,r){var o,n,i,l,a=null==r?void 0:r.id,c=Object.fromEntries(Object.entries(e||{}).filter(e=>{var[t]=e;return!E.has(t)})),s=Object.fromEntries(Object.entries(x).filter(e=>{var[t]=e;return!E.has(t)})),u=Object.fromEntries(Object.entries(t).filter(e=>{var[,t]=e;return null!=t})),f=C(C(C(C({},v),s),c),u),d=null!==(o=S[null==r?void 0:r.mapColorScheme])&&void 0!==o?o:S.light;return f.haloColor=null!==(n=null==r?void 0:r.haloColor)&&void 0!==n?n:d.haloColor,f.selectedColor=null!==(i=null==r?void 0:r.selectedColor)&&void 0!==i?i:d.selectedColor,f.activeColor=null!==(l=null==r?void 0:r.activeColor)&&void 0!==l?l:d.activeColor,"string"==typeof f.graphic&&m[f.graphic]&&(f.graphic=m[f.graphic]),Object.fromEntries(Object.entries(f).map(e=>{var[t,r]=e;return[t,p(r,a)||""]}))}function z(e,t){return Object.entries(t).reduce((e,t)=>{var[r,o]=t;return e.replaceAll("{{".concat(r,"}}"),o)},e)}var H={setDefaults(e){x=e||{}},getDefaults:()=>C(C({},v),x),register(e){M.set(e.id,e)},get:e=>M.get(e),list:()=>[...M.values()],clear(){M.clear()},initialise(){this.register(b),this.register(O),this.register(j)},resolve(e,t,r){var o=_(e,t||{},r);return e?(o.selectedColor="none",o.activeColor="none",z(e.svg,o)):""},resolveActive(e,t,r){var o=_(e,t||{},r);return e?z(e.svg,o):""},resolveSelected(e,t,r){var o=_(e,t||{},r);return e?(o.activeColor="none",z(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 i=w(e),l=r?this.resolveActive(n,i,t):this.resolve(n,i,t);return"symbol-".concat(r?"act-":"").concat(I(l),"-").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 i=n.getSymbolDef(e);if(!i)return null;var l,a,c=w(e);"active"===r?(l=n.resolveActive(i,c,t),a="act-"):"selected"===r?(l=n.resolveSelected(i,c,t),a="sel-"):(l=n.resolve(i,c,t),a="");var s="symbol-".concat(a).concat(I(l),"-").concat(o,"x"),p=L.get(s);if(!p){var u=P(e,i),[,,f,y]=u.split(" ").map(Number),g='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(f*o,'" height="').concat(y*o,'" viewBox="').concat(u,'">').concat(l,"</svg>");p=yield d(g,f*o,y*o),L.set(s,p)}return{imageId:s,imageData:p}})()}};function V(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 B(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}H.initialise();var A={},K=null,N=[],G=()=>{var e;if(null===(e=A)||void 0===e||!e.current)return[];if(K===A.current)return N;K=A.current;var{groups:t=[],keyDefinitions:r=[]}=A.current;return N=t.map(e=>"flat"===e.type?B(B({},e),{},{keyDefinition:r.find(t=>t.id===e.id)}):B(B({},e),{},{keyDefinitions:r.filter(t=>t.groupId===e.id)}))},Y=e=>{var{text:t}=e;return o("div",{className:"im-c-map-key",children:o("p",{className:"im-c-map-key__empty-message",children:t})})};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 T(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(Object(r),!0).forEach(function(t){i(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 W=20,F={xmlns:"http://www.w3.org/2000/svg",width:W,height:W,viewBox:"0 0 ".concat(W," ").concat(W),className:"im-c-map-key-symbol","aria-hidden":"true",focusable:"false"},q=T(T({},F),{},{width:44,height:44,className:"im-c-map-key-symbol im-c-map-key-symbol--point"});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){i(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{keyDefinition:t,mapStyle:r}=e,{style:i}=t,l=h.getKeyPatternPaths(i,r.id);return l?n("svg",U(U({},F),{},{children:[o("g",{dangerouslySetInnerHTML:{__html:l.border}}),o("g",{transform:"translate(".concat(2,", ").concat(2,")"),dangerouslySetInnerHTML:{__html:l.content}})]})):null};function Q(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 X(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Q(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var $=e=>{var t,{keyDefinition:r,mapStyle:n,symbolDef:i}=e,{style:l}=r,a=null!==(t=null==n?void 0:n.appColorScheme)&&void 0!==t?t:"light",c=X(X({},n),{},{mapColorScheme:a}),s=H.resolve(i,w(l),c),p=P(l,i);return s&&p?o("svg",X(X({},q),{},{viewBox:p,children:o("g",{dangerouslySetInnerHTML:{__html:s}})})):null};function ee(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 te(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ee(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var re=e=>{var{mapStyle:t,keyDefinition:r}=e,{style:n}=r,i=n.strokeWidth,l=p(n.stroke,t.id);return o("svg",te(te({},F),{},{children:o("line",{x1:i/2,y1:10,x2:W-i/2,y2:10,stroke:l,strokeWidth:i,strokeLinecap:"round"})}))};function oe(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 ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oe(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var ie=e=>{var{mapStyle:t,keyDefinition:r}=e,{style:n}=r,i=n.strokeWidth,l=p(n.fill,t.id),a=p(n.stroke,t.id);return o("svg",ne(ne({},F),{},{children:o("rect",{x:i/2,y:i/2,width:W-i,height:W-i,rx:i,ry:i,fill:l,stroke:a,strokeWidth:i,strokeLinejoin:"round"})}))},le=e=>{var{mapStyle:t,keyDefinition:r}=e,{style:n}=r,i=p(n.fill,t.id),l=p(n.fill,t.id);return o("svg",{viewBox:"0 0 5 5",preserveAspectRatio:"none",fill:i,stroke:l,strokeWidth:"1",children:o("path",{d:"M0 0h5v5H0z"})})},ae="horizontal-ramp",ce=e=>{var{keyDefinition:t,groupStyle:r,mapStyle:n}=e,{symbolShape:i,symbolDef:l}=((e,t)=>{if(!e)return{symbolShape:null,symbolDef:null};var{hasSymbol:r,hasPattern:o,style:n}=e;if(t===ae)return{symbolShape:ae,symbolDef:null};if(r){var i=H.getSymbolDef(n);return{symbolShape:i?"symbol":"rect",symbolDef:i}}return o?{symbolShape:"pattern",symbolDef:null}:"line"===n.keySymbolShape?{symbolShape:"line",symbolDef:null}:{symbolShape:"rect",symbolDef:null}})(t,r);return i?"symbol"===i?o($,{mapStyle:n,keyDefinition:t,symbolDef:l}):o("pattern"===i?J:"line"===i?re:i===ae?le:ie,{mapStyle:n,keyDefinition:t}):null},se=e=>{var{keyDefinition:t,groupStyle:r,mapStyle:i}=e,l=t.label,a=p(t.symbolDescription,i.id);return n("div",{className:"im-c-map-key-list__item",children:[o("dt",{className:"im-c-map-key-list__item-symbol",children:o(ce,{keyDefinition:t,groupStyle:r,mapStyle:i})}),n("dd",{className:"im-c-map-key-list__item-label",children:[l,a&&n("span",{className:"govuk-visually-hidden",children:["(",a,")"]})]})]})},pe=e=>{var{headingId:t,label:r,groupStyle:i,keyDefinitions:l,mapStyle:a}=e,c="im-c-map-key-list"+(i?" im-c-map-key-list-".concat(i):"");return n("section",{className:"im-c-map-key__group","aria-labelledby":t,children:[o("h3",{id:t,className:"im-c-map-key__group-heading",children:r}),o("dl",{className:c,children:l.map(e=>o(se,{keyDefinition:e,mapStyle:a,groupStyle:i},"".concat(e.id)))})]})},ue="im-c-map-key",fe=e=>{var{item:t,groupStyle:r,mapStyle:n}=e;return"group"===t.type?o(pe,{headingId:"key-heading-".concat(t.id),label:t.groupLabel,groupStyle:r,keyDefinitions:t.keyDefinitions,mapStyle:n}):o(se,{keyDefinition:t.keyDefinition,mapStyle:n})},de=e=>{var{noKeyItemText:t,keyGroups:r,hasGroups:n,mapStyle:i}=e;if(null==r||!r.length)return o(Y,{text:t});var l=n?"".concat(ue," ").concat("im-c-map-key--has-groups"):ue;return o("div",{className:l,children:r.map(e=>o(fe,{item:e,mapStyle:i,groupStyle:e.groupStyle},e.id))})};function ye(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 ge(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ye(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function he(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 ve(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?he(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):he(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var me={InitComponent:function(e){var{pluginConfig:o,pluginState:n,mapState:i,services:l}=e,{dispatch:a}=n,{eventBus:s}=l,p=r(n);p.current=n,t(()=>{i.isMapReady&&((e=>{A=e})(p),s.requestOnce("datasets:registry",c),s.emit("map-key:ready"))},[i.isMapReady]),t(()=>{if(o.groups){var e=Object.entries(o.groups).map(e=>{var[t,r]=e;return ge(ge({},r),{},{id:t,label:r.groupLabel})});a({type:"ADD_KEY_GROUPS",payload:e})}},[o.groups])},reducer:{initialState:{keyDefinitions:[],groups:[]},actions:{ADD_KEY_SYMBOL:(e,t)=>{var r,{id:o,groupLabel:n}=t,i=t.groupId||((r=n)?r.toLowerCase().replace(/\s+/g,"-"):null),l=((e,t,r)=>e.groups.find(e=>"group"===e.type&&e.id===r||"flat"===e.type&&e.id===t))(e,o,i),a=l?null:((e,t,r)=>t?{id:t,type:"group",groupLabel:r}:{id:e,type:"flat"})(o,i,n),c=a?[...e.groups,a]:e.groups,s=[...e.keyDefinitions,ve(ve({},t),{},{type:"manual"},i?{groupId:i}:{})];return ve(ve({},e),{},{keyDefinitions:s,groups:c})},REMOVE_KEY_SYMBOL:(e,t)=>{var{id:r}=t;return ve(ve({},e),{},{keyDefinitions:e.keyDefinitions.filter(e=>e.id!==r)})},ADD_KEY_GROUPS:(e,t)=>ve(ve({},e),{},{groups:[...e.groups,...t]})}},panels:[{id:"mapKey",label:"Key",mobile:{slot:"drawer",modal:!0},tablet:{slot:"left-top",width:"260px"},desktop:{slot:"left-top",width:"280px"},render:function(r){var{mapState:{mapStyle:n},pluginConfig:{noKeyItemText:i},pluginState:l,services:{eventBus:c}}=r,[s,p]=e(a),[u,f]=e(()=>{var e;return null!==(e=null==s?void 0:s.keyItems().items)&&void 0!==e?e:[]}),[d,y]=e(()=>{var e;return null!==(e=null==s?void 0:s.keyItems().hasGroups)&&void 0!==e&&e}),g=()=>{var{items:e,hasGroups:t}=s.keyItems(),r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[...G()];return 0===t.length?e:[...e.map(e=>{var r=t.findIndex(t=>t.id===e.id);if(-1===r)return e;var o=t.splice(r,1)[0];return B(B(B({},e),o),{},{keyDefinitions:[...o.keyDefinitions||[],...e.keyDefinitions||[]]})}),...t].filter(e=>{var t;return"flat"===e.type&&e.keyDefinition||"group"===e.type&&(null===(t=e.keyDefinitions)||void 0===t?void 0:t.length)})}(e);f(r),y(t)},h=e=>{s.invalidateKeyItemsOnMenuStateChange(e),g()};return t(()=>s?(g(),c.on("menu:changed",h).on("datasets:changed",g),()=>c.off("menu:changed",h).off("datasets:changed",g)):(c.requestOnce("datasets:registry",p),()=>{}),[s]),t(()=>{s&&g()},[l]),o(de,{noKeyItemText:i,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"/>'}],api:{addSymbol:(e,t)=>{var{pluginState:{dispatch:r}}=e;r({type:"ADD_KEY_SYMBOL",payload:t})},removeSymbol:(e,t)=>{var{pluginState:{dispatch:r}}=e;r({type:"REMOVE_KEY_SYMBOL",payload:t})}}};export{me as manifest};
1
+ import{useId as e,useState as t,useLayoutEffect as r,useRef as n,useEffect as i}from"preact/compat";import{jsx as o,jsxs as a}from"preact/jsx-runtime";import l from"@babel/runtime/helpers/defineProperty";var s=null,c=e=>s=e;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 y(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){l(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}var u={},m=null,f=[],b=()=>{var e;if(null===(e=u)||void 0===e||!e.current)return[];if(m===u.current)return f;m=u.current;var{groups:t=[],keyDefinitions:r=[]}=u.current;return f=t.map(e=>"flat"===e.type?y(y({},e),{},{keyDefinition:r.find(t=>t.id===e.id)}):y(y({},e),{},{keyDefinitions:r.filter(t=>t.groupId===e.id)}))},g=e=>{var{text:t}=e;return o("div",{className:"im-c-map-key",children:o("p",{className:"im-c-map-key__empty-message",children:t})})},d=(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};function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach(function(t){l(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var v=20,k=44,j={xmlns:"http://www.w3.org/2000/svg",width:v,height:v,viewBox:"0 0 ".concat(v," ").concat(v),className:"im-c-map-key-symbol","aria-hidden":"true",focusable:"false"},S=h(h({},j),{},{width:k,height:k,viewBox:"0 0 ".concat(k," ").concat(k),className:"im-c-map-key-symbol im-c-map-key-symbol--point"});function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function P(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w(Object(r),!0).forEach(function(t){l(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 D=e=>{var{keyDefinition:t,mapStyle:r,patternRegistry:n}=e,{style:i}=t,l=n.getKeyPatternPaths(i,r.id);return l?a("svg",P(P({},j),{},{children:[o("g",{dangerouslySetInnerHTML:{__html:l.border}}),o("g",{transform:"translate(".concat(2,", ").concat(2,")"),dangerouslySetInnerHTML:{__html:l.content}})]})):null};function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _(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){l(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 E=e=>{var{keySymbol:t}=e,{svg:r,viewBox:n}=null!=t?t:{};if(!r||!n)return null;var[,,i,a]=n.split(" ").map(Number),l=Math.min(1,56/Math.max(i,a)),s=i*l,c=a*l;return o("svg",_(_({},S),{},{overflow:"visible",children:o("svg",{x:.5*(k-s),y:.5*(k-c),width:s,height:c,viewBox:n,overflow:"hidden",children:o("g",{dangerouslySetInnerHTML:{__html:r}})})}))};function x(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 M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?x(Object(r),!0).forEach(function(t){l(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var I=e=>{var{mapStyle:t,keyDefinition:r}=e,{style:n}=r,i=n.strokeWidth,a=d(n.stroke,t.id);return o("svg",M(M({},j),{},{children:o("line",{x1:i/2,y1:10,x2:v-i/2,y2:10,stroke:a,strokeWidth:i,strokeLinecap:"round"})}))};function L(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 K(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach(function(t){l(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var N,B=e=>{var{mapStyle:t,keyDefinition:r}=e,{style:n}=r,i=n.strokeWidth,a=d(n.fill,t.id),l=d(n.stroke,t.id);return o("svg",K(K({},j),{},{children:o("rect",{x:i/2,y:i/2,width:v-i,height:v-i,rx:i,ry:i,fill:a,stroke:l,strokeWidth:i,strokeLinejoin:"round"})}))},C=t=>{var{mapStyle:r,keyDefinition:n,patternRegistry:i}=t,{style:l,hasPattern:s}=n,c="im-c-map-key-ramp-"+e().replace(/[^\w-]/g,""),p=s?i.getKeyPatternPaths(l,r.id):null,y=d(l.stroke,r.id),u=p?"url(#".concat(c,")"):d(l.fill,r.id);return a("svg",{xmlns:"http://www.w3.org/2000/svg",className:"im-c-map-key-symbol","aria-hidden":"true",focusable:"false",children:[p&&o("defs",{children:o("pattern",{id:c,patternUnits:"userSpaceOnUse",x:2,y:2,width:16,height:16,dangerouslySetInnerHTML:{__html:p.content}})}),o("rect",{width:"100%",height:"100%",fill:u||"none",stroke:y,strokeWidth:y?4:void 0})]})},Y="ramp",G=e=>{var{keyDefinition:t,groupStyle:r,mapStyle:n,symbolRegistry:i,patternRegistry:a}=e,{symbolShape:l,keySymbol:s}=((e,t,r,n)=>{if(!e)return{symbolShape:null,keySymbol:null};var{hasSymbol:i,hasPattern:o,style:a}=e;if(t===Y)return{symbolShape:Y,keySymbol:null};if(i){var l=n.getKeySymbol(a,r);return{symbolShape:l?"symbol":"rect",keySymbol:l}}return o?{symbolShape:"pattern",keySymbol:null}:null==a.fill&&a.stroke?{symbolShape:"line",keySymbol:null}:{symbolShape:"rect",keySymbol:null}})(t,r,n,i);return l?"symbol"===l?o(E,{keySymbol:s}):"pattern"===l?o(D,{mapStyle:n,keyDefinition:t,patternRegistry:a}):"line"===l?o(I,{mapStyle:n,keyDefinition:t}):l===Y?o(C,{mapStyle:n,keyDefinition:t,patternRegistry:a}):o(B,{mapStyle:n,keyDefinition:t}):null},T=e=>{var{keyDefinition:t,groupStyle:r,mapStyle:n,symbolRegistry:i,patternRegistry:l}=e,s=t.label,c=d(t.symbolDescription,n.id);return a("div",{className:"im-c-map-key-list__item",children:[o("dt",{className:"im-c-map-key-list__item-symbol",children:o(G,{keyDefinition:t,groupStyle:r,mapStyle:n,symbolRegistry:i,patternRegistry:l})}),a("dd",{className:"im-c-map-key-list__item-label",children:[s,c&&a("span",{className:"govuk-visually-hidden",children:["(",c,")"]})]})]})},W=(e,t)=>{var r,n=e.querySelector(".im-c-map-key-list__item-label"),i=(void 0===N&&(N=null!==(r=document.createElement("canvas").getContext("2d"))&&void 0!==r?r:null),N);if(!n||!i||!e.clientWidth)return null;var{fontStyle:o,fontWeight:a,fontSize:l,fontFamily:s}=getComputedStyle(n);i.font="".concat(o," ").concat(a," ").concat(l," ").concat(s);var c=getComputedStyle(e),p=Number.parseFloat(c.columnGap)||0,y=(Number.parseFloat(c.paddingLeft)||0)+(Number.parseFloat(c.paddingRight)||0),u=(e.clientWidth-y-p*(t.length-1))/t.length;return t.every(e=>i.measureText(e).width<=u)},z=e=>{var{headingId:i,label:l,groupStyle:s,keyDefinitions:c,mapStyle:p,symbolRegistry:y,patternRegistry:u}=e,m=n(null),f=((e,t)=>e===Y&&t.some(e=>{return!!(null!=(t=e.style)&&t.symbol||null!=t&&t.symbolSvgContent);var t})?void 0:e)(s,c),b=f===Y,g=b&&c.some(e=>{var t;return d(null===(t=e.style)||void 0===t?void 0:t.stroke,p.id)}),O=((e,n,i,o)=>{var[a,l]=t(!0),s=n.join("\n");return r(()=>{var t,r=e.current;if(i&&r){var o=!0,a=()=>{var e=o?W(r,n):null;null!==e&&l(e)};a();var s="function"==typeof ResizeObserver?new ResizeObserver(a):null;return null==s||s.observe(r),null===(t=document.fonts)||void 0===t||t.ready.then(a,()=>{}),()=>{o=!1,null==s||s.disconnect()}}},[i,o,s]),a?"horizontal":"vertical"})(m,c.map(e=>{var t;return null!==(t=e.label)&&void 0!==t?t:""}),b,g),h=((e,t,r)=>{if(!e)return"im-c-map-key-list";var n="im-c-map-key-list im-c-map-key-list--".concat(e);if(e!==Y)return n;var i="".concat(n," im-c-map-key-list--ramp-").concat(t);return r?"".concat(i," im-c-map-key-list--has-stroke"):i})(f,O,g);return a("section",{className:"im-c-map-key__group","aria-labelledby":i,children:[o("h3",{id:i,className:"im-c-map-key__group-heading",children:l}),o("dl",{ref:m,className:h,children:c.map(e=>o(T,{keyDefinition:e,mapStyle:p,symbolRegistry:y,patternRegistry:u,groupStyle:f},"".concat(e.id)))})]})},A="im-c-map-key",F=e=>{var{item:t,groupStyle:r,mapStyle:n,symbolRegistry:i,patternRegistry:a}=e;return"group"===t.type?o(z,{headingId:"key-heading-".concat(t.id),label:t.groupLabel,groupStyle:r,keyDefinitions:t.keyDefinitions,mapStyle:n,symbolRegistry:i,patternRegistry:a}):o(T,{keyDefinition:t.keyDefinition,mapStyle:n,symbolRegistry:i,patternRegistry:a})},H=e=>{var{noKeyItemText:t,keyGroups:r,hasGroups:n,mapStyle:i,symbolRegistry:a,patternRegistry:l}=e;if(null==r||!r.length)return o(g,{text:t});var s=n?"".concat(A," ").concat("im-c-map-key--has-groups"):A;return o("div",{className:s,children:r.map(e=>o(F,{item:e,mapStyle:i,symbolRegistry:a,patternRegistry:l,groupStyle:e.groupStyle},e.id))})};function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function q(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?U(Object(r),!0).forEach(function(t){l(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function J(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach(function(t){l(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Q={InitComponent:function(e){var{pluginConfig:t,pluginState:r,mapState:o,services:a}=e,{dispatch:l}=r,{eventBus:s}=a,p=n(r);p.current=r,i(()=>{o.isMapReady&&((e=>{u=e})(p),s.requestOnce("datasets:registry",c),s.emit("map-key:ready"))},[o.isMapReady]),i(()=>{if(t.groups){var e=Object.entries(t.groups).map(e=>{var[t,r]=e;return q(q({},r),{},{id:t,label:r.groupLabel})});l({type:"ADD_KEY_GROUPS",payload:e})}},[t.groups])},reducer:{initialState:{keyDefinitions:[],groups:[]},actions:{ADD_KEY_SYMBOL:(e,t)=>{var r,{id:n,groupLabel:i}=t,o=t.groupId||((r=i)?r.toLowerCase().replace(/\s+/g,"-"):null),a=((e,t,r)=>e.groups.find(e=>"group"===e.type&&e.id===r||"flat"===e.type&&e.id===t))(e,n,o),l=a?null:((e,t,r)=>t?{id:t,type:"group",groupLabel:r}:{id:e,type:"flat"})(n,o,i),s=l?[...e.groups,l]:e.groups,c=[...e.keyDefinitions,J(J({},t),{},{type:"manual"},o?{groupId:o}:{})];return J(J({},e),{},{keyDefinitions:c,groups:s})},REMOVE_KEY_SYMBOL:(e,t)=>{var{id:r}=t;return J(J({},e),{},{keyDefinitions:e.keyDefinitions.filter(e=>e.id!==r)})},ADD_KEY_GROUPS:(e,t)=>J(J({},e),{},{groups:[...e.groups,...t]})}},panels:[{id:"mapKey",label:"Key",mobile:{slot:"drawer",modal:!0},tablet:{slot:"left-top",width:"260px"},desktop:{slot:"left-top",width:"280px"},render:function(e){var{mapState:{mapStyle:r},pluginConfig:{noKeyItemText:n},pluginState:a,services:{eventBus:l,symbolRegistry:c,patternRegistry:p}}=e,[u,m]=t(s),[f,g]=t(()=>{var e;return null!==(e=null==u?void 0:u.keyItems().items)&&void 0!==e?e:[]}),[d,O]=t(()=>{var e;return null!==(e=null==u?void 0:u.keyItems().hasGroups)&&void 0!==e&&e}),h=()=>{var{items:e,hasGroups:t}=u.keyItems(),r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[...b()];return 0===t.length?e:[...e.map(e=>{var r=t.findIndex(t=>t.id===e.id);if(-1===r)return e;var n=t.splice(r,1)[0];return y(y(y({},e),n),{},{keyDefinitions:[...n.keyDefinitions||[],...e.keyDefinitions||[]]})}),...t].filter(e=>{var t;return"flat"===e.type&&e.keyDefinition||"group"===e.type&&(null===(t=e.keyDefinitions)||void 0===t?void 0:t.length)})}(e);g(r),O(t)},v=e=>{u.invalidateKeyItemsOnMenuStateChange(e),h()};return i(()=>u?(h(),l.on("menu:changed",v).on("datasets:changed",h),()=>l.off("menu:changed",v).off("datasets:changed",h)):(l.requestOnce("datasets:registry",m),()=>{}),[u]),i(()=>{u&&h()},[a]),o(H,{noKeyItemText:n,keyGroups:f,hasGroups:d,mapStyle:r,symbolRegistry:c,patternRegistry:p})}}],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"/>'}],api:{addSymbol:(e,t)=>{var{pluginState:{dispatch:r}}=e;r({type:"ADD_KEY_SYMBOL",payload:t})},removeSymbol:(e,t)=>{var{pluginState:{dispatch:r}}=e;r({type:"REMOVE_KEY_SYMBOL",payload:t})}}};export{Q as manifest};
@@ -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],{64(t,r,e){e.r(r),e.d(r,{manifest:()=>Xt});var n=e(738),o=null,i=function(t){return o=t};function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function l(t){return function(t){if(Array.isArray(t))return u(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,r){if(t){if("string"==typeof t)return u(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?u(t,r):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function c(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function f(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?c(Object(e),!0).forEach(function(r){s(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):c(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function s(t,r,e){return(r=function(t){var r=function(t){if("object"!=a(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=a(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var y={},p=null,b=[],m=e(287),v=function(t){var r=t.text;return(0,m.jsx)("div",{className:"im-c-map-key",children:(0,m.jsx)("p",{className:"im-c-map-key__empty-message",children:r})})};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)}var h=function(t,r){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===d(t)){if(r&&t[r])return t[r];var e=Object.values(t)[0];return null!=e?e:null}return null};function g(t){return g="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},g(t)}function S(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function O(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?S(Object(e),!0).forEach(function(r){j(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):S(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function j(t,r,e){return(r=function(t){var r=function(t){if("object"!=g(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=g(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==g(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var w=20,P={xmlns:"http://www.w3.org/2000/svg",width:w,height:w,viewBox:"0 0 ".concat(w," ").concat(w),className:"im-c-map-key-symbol","aria-hidden":"true",focusable:"false"},k=O(O({},P),{},{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 C(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var x=function(t){return Math.max(2,2*t)},A=function(t,r,e){return t.replace(/\{\{foregroundColor\}\}/g,r||"black").replace(/\{\{backgroundColor\}\}/g,e||"transparent")},E=function(t,r,e){return new Promise(function(n,o){var i="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(t)),a=new Image(r,e);a.onload=function(){var t=document.createElement("canvas");t.width=r,t.height=e;var o=t.getContext("2d");o.drawImage(a,0,0,r,e),n(o.getImageData(0,0,r,e))},a.onerror=function(){o(new Error("Failed to rasterise SVG: ".concat(t.slice(0,80))))},a.src=i})};function I(){var t,r,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,n,o,i){var u=n&&n.prototype instanceof l?n:l,c=Object.create(u.prototype);return M(c,"_invoke",function(e,n,o){var i,l,u,c=0,f=o||[],s=!1,y={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(r,e){return i=r,l=0,u=t,y.n=e,a}};function p(e,n){for(l=e,u=n,r=0;!s&&c&&!o&&r<f.length;r++){var o,i=f[r],p=y.p,b=i[2];e>3?(o=b===n)&&(u=i[(l=i[4])?5:(l=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=e<2&&p<i[1])?(l=0,y.v=n,y.n=i[1]):p<b&&(o=e<3||i[0]>n||n>b)&&(i[4]=e,i[5]=n,y.n=b,l=0))}if(o||e>1)return a;throw s=!0,n}return function(o,f,b){if(c>1)throw TypeError("Generator is already running");for(s&&1===f&&p(f,b),l=f,u=b;(r=l<2?t:u)||!s;){i||(l?l<3?(l>1&&(y.n=-1),p(l,u)):y.n=u:y.v=u);try{if(c=2,i){if(l||(o="next"),r=i[o]){if(!(r=r.call(i,u)))throw TypeError("iterator result is not an object");if(!r.done)return r;u=r.value,l<2&&(l=0)}else 1===l&&(r=i.return)&&r.call(i),l<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),l=1);i=t}else if((r=(s=y.n<0)?u:e.call(n,y))!==a)break}catch(r){i=t,l=1,u=r}finally{c=1}}return{value:r,done:s}}}(e,o,i),!0),c}var a={};function l(){}function u(){}function c(){}r=Object.getPrototypeOf;var f=[][n]?r(r([][n]())):(M(r={},n,function(){return this}),r),s=c.prototype=l.prototype=Object.create(f);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,M(t,o,"GeneratorFunction")),t.prototype=Object.create(s),t}return u.prototype=c,M(s,"constructor",c),M(c,"constructor",u),u.displayName="GeneratorFunction",M(c,o,"GeneratorFunction"),M(s),M(s,o,"Generator"),M(s,n,function(){return this}),M(s,"toString",function(){return"[object Generator]"}),(I=function(){return{w:i,m:y}})()}function M(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}M=function(t,r,e,n){function i(r,e){M(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},M(t,r,e,n)}function _(t,r,e,n,o,i,a){try{var l=t[i](a),u=l.value}catch(t){return void e(t)}l.done?r(u):Promise.resolve(u).then(n,o)}function L(t,r){if(t){if("string"==typeof t)return T(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?T(t,r):void 0}}function T(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var z=new Map,H=new Map,V={register:function(t,r){z.set(t,{id:t,svgContent:r})},get:function(t){return z.get(t)},list:function(){return function(t){if(Array.isArray(t))return T(t)}(t=z.values())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||L(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(){z.clear()},initialise:function(){var t=this;Object.entries(D).forEach(function(r){var e,n,o=(n=2,function(t){if(Array.isArray(t))return t}(e=r)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,n)||L(e,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!==(r=null===(e=this.get(t.fillPattern))||void 0===e?void 0:e.svgContent)&&void 0!==r?r:null;var r,e},getKeyPatternPaths:function(t,r){var e=this.getPatternInnerContent(t);if(!e)return null;var n=h(t.fillPatternForegroundColor,r)||"black",o=h(t.fillPatternBackgroundColor,r)||"transparent",i=h(t.stroke,r)||n;return{border:A('<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:A(e,n,o)}},getPatternImageId:function(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this.getPatternInnerContent(t);if(!n)return null;var o=h(t.fillPatternForegroundColor,r)||"black",i=h(t.fillPatternBackgroundColor,r)||"transparent",a=x(e);return"pattern-".concat(function(t){var r,e=0,n=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return C(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?C(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);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(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(l)throw i}}}}(t);try{for(n.s();!(r=n.n()).done;){var o=r.value;e=Math.trunc((e<<5)-e+o.codePointAt(0))}}catch(t){n.e(t)}finally{n.f()}return Math.abs(e).toString(36)}(n+o+i),"-").concat(a,"x")},rasterisePatternImage:function(t,r){var e,n=arguments,o=this;return(e=I().m(function e(){var i,a,l,u,c,f,s,y,p,b,m;return I().w(function(e){for(;;)switch(e.n){case 0:if(i=n.length>2&&void 0!==n[2]?n[2]:1,a=o.getPatternInnerContent(t)){e.n=1;break}return e.a(2,null);case 1:if(l=o.getPatternImageId(t,r,i)){e.n=2;break}return e.a(2,null);case 2:if(u=H.get(l)){e.n=4;break}return c=h(t.fillPatternForegroundColor,r)||"black",f=h(t.fillPatternBackgroundColor,r)||"transparent",s=A(a,c,f),y='<rect width="16" height="16" fill="'.concat(f,'"/>'),p=x(i),b=Math.round(8*p),m='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(b,'" height="').concat(b,'" viewBox="0 0 16 16">').concat(y).concat(s,"</svg>"),e.n=3,E(m,b,b);case 3:u=e.v,H.set(l,u);case 4:return e.a(2,{imageId:l,imageData:u})}},e)}),function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(t){_(i,n,o,a,l,"next",t)}function l(t){_(i,n,o,a,l,"throw",t)}a(void 0)})})()}};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(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function K(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?G(Object(e),!0).forEach(function(r){N(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):G(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function N(t,r,e){return(r=function(t){var r=function(t){if("object"!=B(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=B(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==B(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}V.initialise();var F=function(t){var r=t.keyDefinition,e=t.mapStyle,n=r.style,o=V.getKeyPatternPaths(n,e.id);return o?(0,m.jsxs)("svg",K(K({},P),{},{children:[(0,m.jsx)("g",{dangerouslySetInnerHTML:{__html:o.border}}),(0,m.jsx)("g",{transform:"translate(".concat(2,", ").concat(2,")"),dangerouslySetInnerHTML:{__html:o.content}})]})):null},U=new Set(["symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"]),Y=function(t){if(!function(t){return!(!t.symbol&&!t.symbolSvgContent)}(t))return{};var r={};return U.forEach(function(e){if(null!=t[e]){var n=e.charAt(6).toLowerCase()+e.slice(7);r[n]=t[e]}}),r},R=function(t,r){var e;return t.symbolViewBox?t.symbolViewBox:null!==(e=null==r?void 0:r.viewBox)&&void 0!==e?e:"0 0 38 38"},$={symbol:"pin",backgroundColor:"#ca3535",foregroundColor:"#ffffff"},W={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"},q={id:"pin",viewBox:"0 0 44 44",anchor:[.5,.9],graphic:W.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>'},Z={id:"circle",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:W.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>'},J={id:"square",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:W.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>'},Q={light:{haloColor:"#ffffff",selectedColor:"#0b0c0c",activeColor:"#ffdd00",foregroundColor:"#0b0c0c"},dark:{haloColor:"#0b0c0c",selectedColor:"#ffffff",activeColor:"#ffdd00",foregroundColor:"#ffffff"}};function X(t){return X="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},X(t)}function tt(){var t,r,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,n,o,i){var u=n&&n.prototype instanceof l?n:l,c=Object.create(u.prototype);return rt(c,"_invoke",function(e,n,o){var i,l,u,c=0,f=o||[],s=!1,y={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(r,e){return i=r,l=0,u=t,y.n=e,a}};function p(e,n){for(l=e,u=n,r=0;!s&&c&&!o&&r<f.length;r++){var o,i=f[r],p=y.p,b=i[2];e>3?(o=b===n)&&(u=i[(l=i[4])?5:(l=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=e<2&&p<i[1])?(l=0,y.v=n,y.n=i[1]):p<b&&(o=e<3||i[0]>n||n>b)&&(i[4]=e,i[5]=n,y.n=b,l=0))}if(o||e>1)return a;throw s=!0,n}return function(o,f,b){if(c>1)throw TypeError("Generator is already running");for(s&&1===f&&p(f,b),l=f,u=b;(r=l<2?t:u)||!s;){i||(l?l<3?(l>1&&(y.n=-1),p(l,u)):y.n=u:y.v=u);try{if(c=2,i){if(l||(o="next"),r=i[o]){if(!(r=r.call(i,u)))throw TypeError("iterator result is not an object");if(!r.done)return r;u=r.value,l<2&&(l=0)}else 1===l&&(r=i.return)&&r.call(i),l<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),l=1);i=t}else if((r=(s=y.n<0)?u:e.call(n,y))!==a)break}catch(r){i=t,l=1,u=r}finally{c=1}}return{value:r,done:s}}}(e,o,i),!0),c}var a={};function l(){}function u(){}function c(){}r=Object.getPrototypeOf;var f=[][n]?r(r([][n]())):(rt(r={},n,function(){return this}),r),s=c.prototype=l.prototype=Object.create(f);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,rt(t,o,"GeneratorFunction")),t.prototype=Object.create(s),t}return u.prototype=c,rt(s,"constructor",c),rt(c,"constructor",u),u.displayName="GeneratorFunction",rt(c,o,"GeneratorFunction"),rt(s),rt(s,o,"Generator"),rt(s,n,function(){return this}),rt(s,"toString",function(){return"[object Generator]"}),(tt=function(){return{w:i,m:y}})()}function rt(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}rt=function(t,r,e,n){function i(r,e){rt(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},rt(t,r,e,n)}function et(t,r,e,n,o,i,a){try{var l=t[i](a),u=l.value}catch(t){return void e(t)}l.done?r(u):Promise.resolve(u).then(n,o)}function nt(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function ot(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?nt(Object(e),!0).forEach(function(r){it(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):nt(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function it(t,r,e){return(r=function(t){var r=function(t){if("object"!=X(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=X(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==X(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function at(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,r)||lt(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lt(t,r){if(t){if("string"==typeof t)return ut(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?ut(t,r):void 0}}function ut(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var ct=new Map,ft=new Map,st={},yt=function(t){var r,e=0,n=function(t){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=lt(t))){r&&(t=r);var e=0,n=function(){};return{s:n,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},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(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw o}}}}(t);try{for(n.s();!(r=n.n()).done;){var o=r.value;e=Math.trunc((e<<5)-e+o.codePointAt(0))}}catch(t){n.e(t)}finally{n.f()}return Math.abs(e).toString(36)},pt=new Set(["id","svg","viewBox","anchor","symbol","symbolSvgContent"]);function bt(t,r,e){var n,o,i,a,l=null==e?void 0:e.id,u=Object.fromEntries(Object.entries(t||{}).filter(function(t){var r=at(t,1)[0];return!pt.has(r)})),c=Object.fromEntries(Object.entries(st).filter(function(t){var r=at(t,1)[0];return!pt.has(r)})),f=Object.fromEntries(Object.entries(r).filter(function(t){return null!=at(t,2)[1]})),s=ot(ot(ot(ot({},$),c),u),f),y=null!==(n=Q[null==e?void 0:e.mapColorScheme])&&void 0!==n?n:Q.light;return s.haloColor=null!==(o=null==e?void 0:e.haloColor)&&void 0!==o?o:y.haloColor,s.selectedColor=null!==(i=null==e?void 0:e.selectedColor)&&void 0!==i?i:y.selectedColor,s.activeColor=null!==(a=null==e?void 0:e.activeColor)&&void 0!==a?a:y.activeColor,"string"==typeof s.graphic&&W[s.graphic]&&(s.graphic=W[s.graphic]),Object.fromEntries(Object.entries(s).map(function(t){var r=at(t,2),e=r[0],n=r[1];return[e,h(n,l)||""]}))}function mt(t,r){return Object.entries(r).reduce(function(t,r){var e=at(r,2),n=e[0],o=e[1];return t.replaceAll("{{".concat(n,"}}"),o)},t)}var vt={setDefaults:function(t){st=t||{}},getDefaults:function(){return ot(ot({},$),st)},register:function(t){ct.set(t.id,t)},get:function(t){return ct.get(t)},list:function(){return function(t){if(Array.isArray(t))return ut(t)}(t=ct.values())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||lt(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(){ct.clear()},initialise:function(){this.register(q),this.register(Z),this.register(J)},resolve:function(t,r,e){var n=bt(t,r||{},e);return t?(n.selectedColor="none",n.activeColor="none",mt(t.svg,n)):""},resolveActive:function(t,r,e){var n=bt(t,r||{},e);return t?mt(t.svg,n):""},resolveSelected:function(t,r,e){var n=bt(t,r||{},e);return t?(n.activeColor="none",mt(t.svg,n)):""},getSymbolImageId:function(t,r){var e=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=Y(t),a=e?this.resolveActive(o,i,r):this.resolve(o,i,r);return"symbol-".concat(e?"act-":"").concat(yt(a),"-").concat(n,"x")},getSymbolDef:function(t){return t.symbolSvgContent?{svg:t.symbolSvgContent}:t.symbol?this.get(t.symbol):void 0},rasteriseSymbolImage:function(t,r,e,n){var o,i=this;return(o=tt().m(function o(){var a,l,u,c,f,s,y,p,b,m,v,d;return tt().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=Y(t),"active"===e?(u=i.resolveActive(a,l,r),c="act-"):"selected"===e?(u=i.resolveSelected(a,l,r),c="sel-"):(u=i.resolve(a,l,r),c=""),f="symbol-".concat(c).concat(yt(u),"-").concat(n,"x"),s=ft.get(f)){o.n=3;break}return y=R(t,a),p=y.split(" ").map(Number),b=at(p,4),m=b[2],v=b[3],d='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(m*n,'" height="').concat(v*n,'" viewBox="').concat(y,'">').concat(u,"</svg>"),o.n=2,E(d,m*n,v*n);case 2:s=o.v,ft.set(f,s);case 3:return o.a(2,{imageId:f,imageData:s})}},o)}),function(){var t=this,r=arguments;return new Promise(function(e,n){var i=o.apply(t,r);function a(t){et(i,e,n,a,l,"next",t)}function l(t){et(i,e,n,a,l,"throw",t)}a(void 0)})})()}};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,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function gt(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?ht(Object(e),!0).forEach(function(r){St(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ht(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function St(t,r,e){return(r=function(t){var r=function(t){if("object"!=dt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=dt(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dt(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}vt.initialise();var Ot=function(t){var r,e=t.keyDefinition,n=t.mapStyle,o=t.symbolDef,i=e.style,a=null!==(r=null==n?void 0:n.appColorScheme)&&void 0!==r?r:"light",l=gt(gt({},n),{},{mapColorScheme:a}),u=vt.resolve(o,Y(i),l),c=R(i,o);return u&&c?(0,m.jsx)("svg",gt(gt({},k),{},{viewBox:c,children:(0,m.jsx)("g",{dangerouslySetInnerHTML:{__html:u}})})):null};function jt(t){return jt="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},jt(t)}function wt(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function Pt(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?wt(Object(e),!0).forEach(function(r){kt(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):wt(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function kt(t,r,e){return(r=function(t){var r=function(t){if("object"!=jt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=jt(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==jt(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var Dt=function(t){var r=t.mapStyle,e=t.keyDefinition.style,n=e.strokeWidth,o=h(e.stroke,r.id);return(0,m.jsx)("svg",Pt(Pt({},P),{},{children:(0,m.jsx)("line",{x1:n/2,y1:10,x2:w-n/2,y2:10,stroke:o,strokeWidth:n,strokeLinecap:"round"})}))};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 xt(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function At(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?xt(Object(e),!0).forEach(function(r){Et(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):xt(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function Et(t,r,e){return(r=function(t){var r=function(t){if("object"!=Ct(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=Ct(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ct(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var It=function(t){var r=t.mapStyle,e=t.keyDefinition.style,n=e.strokeWidth,o=h(e.fill,r.id),i=h(e.stroke,r.id);return(0,m.jsx)("svg",At(At({},P),{},{children:(0,m.jsx)("rect",{x:n/2,y:n/2,width:w-n,height:w-n,rx:n,ry:n,fill:o,stroke:i,strokeWidth:n,strokeLinejoin:"round"})}))},Mt=function(t){var r=t.mapStyle,e=t.keyDefinition.style,n=h(e.fill,r.id),o=h(e.fill,r.id);return(0,m.jsx)("svg",{viewBox:"0 0 5 5",preserveAspectRatio:"none",fill:n,stroke:o,strokeWidth:"1",children:(0,m.jsx)("path",{d:"M0 0h5v5H0z"})})},_t="horizontal-ramp",Lt=function(t){var r=t.keyDefinition,e=t.groupStyle,n=t.mapStyle,o=function(t,r){if(!t)return{symbolShape:null,symbolDef:null};var e=t.hasSymbol,n=t.hasPattern,o=t.style;if(r===_t)return{symbolShape:_t,symbolDef:null};if(e){var i=vt.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}}(r,e),i=o.symbolShape,a=o.symbolDef;return i?"symbol"===i?(0,m.jsx)(Ot,{mapStyle:n,keyDefinition:r,symbolDef:a}):"pattern"===i?(0,m.jsx)(F,{mapStyle:n,keyDefinition:r}):"line"===i?(0,m.jsx)(Dt,{mapStyle:n,keyDefinition:r}):i===_t?(0,m.jsx)(Mt,{mapStyle:n,keyDefinition:r}):(0,m.jsx)(It,{mapStyle:n,keyDefinition:r}):null},Tt=function(t){var r=t.keyDefinition,e=t.groupStyle,n=t.mapStyle,o=r.label,i=h(r.symbolDescription,n.id);return(0,m.jsxs)("div",{className:"im-c-map-key-list__item",children:[(0,m.jsx)("dt",{className:"im-c-map-key-list__item-symbol",children:(0,m.jsx)(Lt,{keyDefinition:r,groupStyle:e,mapStyle:n})}),(0,m.jsxs)("dd",{className:"im-c-map-key-list__item-label",children:[o,i&&(0,m.jsxs)("span",{className:"govuk-visually-hidden",children:["(",i,")"]})]})]})},zt=function(t){var r=t.headingId,e=t.label,n=t.groupStyle,o=t.keyDefinitions,i=t.mapStyle,a="im-c-map-key-list"+(n?" im-c-map-key-list-".concat(n):"");return(0,m.jsxs)("section",{className:"im-c-map-key__group","aria-labelledby":r,children:[(0,m.jsx)("h3",{id:r,className:"im-c-map-key__group-heading",children:e}),(0,m.jsx)("dl",{className:a,children:o.map(function(t){return(0,m.jsx)(Tt,{keyDefinition:t,mapStyle:i,groupStyle:n},"".concat(t.id))})})]})},Ht="im-c-map-key",Vt=function(t){var r=t.item,e=t.groupStyle,n=t.mapStyle;return"group"===r.type?(0,m.jsx)(zt,{headingId:"key-heading-".concat(r.id),label:r.groupLabel,groupStyle:e,keyDefinitions:r.keyDefinitions,mapStyle:n}):(0,m.jsx)(Tt,{keyDefinition:r.keyDefinition,mapStyle:n})},Bt=function(t){var r=t.noKeyItemText,e=t.keyGroups,n=t.hasGroups,o=t.mapStyle;if(null==e||!e.length)return(0,m.jsx)(v,{text:r});var i=n?"".concat(Ht," ").concat("im-c-map-key--has-groups"):Ht;return(0,m.jsx)("div",{className:i,children:e.map(function(t){return(0,m.jsx)(Vt,{item:t,mapStyle:o,groupStyle:t.groupStyle},t.id)})})};function Gt(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,r)||function(t,r){if(t){if("string"==typeof t)return Kt(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Kt(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kt(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}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 Ft(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function Ut(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?Ft(Object(e),!0).forEach(function(r){Yt(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Ft(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function Yt(t,r,e){return(r=function(t){var r=function(t){if("object"!=Nt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=Nt(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Nt(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Rt(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function $t(t){return $t="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},$t(t)}function Wt(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function qt(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?Wt(Object(e),!0).forEach(function(r){Zt(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Wt(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function Zt(t,r,e){return(r=function(t){var r=function(t){if("object"!=$t(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=$t(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$t(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function Jt(t){return function(t){if(Array.isArray(t))return Qt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,r){if(t){if("string"==typeof t)return Qt(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Qt(t,r):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qt(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}var Xt={InitComponent:function(t){var r=t.pluginConfig,e=t.pluginState,o=t.mapState,a=t.services,l=e.dispatch,u=a.eventBus,c=(0,n.useRef)(e);c.current=e,(0,n.useEffect)(function(){o.isMapReady&&(function(t){y=t}(c),u.requestOnce("datasets:registry",i),u.emit("map-key:ready"))},[o.isMapReady]),(0,n.useEffect)(function(){if(r.groups){var t=Object.entries(r.groups).map(function(t){var r,e,n=(e=2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,l=[],u=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(r,e)||function(t,r){if(t){if("string"==typeof t)return Rt(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Rt(t,r):void 0}}(r,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.")}()),o=n[0],i=n[1];return Ut(Ut({},i),{},{id:o,label:i.groupLabel})});l({type:"ADD_KEY_GROUPS",payload:t})}},[r.groups])},reducer:{initialState:{keyDefinitions:[],groups:[]},actions:{ADD_KEY_SYMBOL:function(t,r){var e,n=r.id,o=r.groupLabel,i=r.groupId||((e=o)?e.toLowerCase().replace(/\s+/g,"-"):null),a=function(t,r,e){return t.groups.find(function(t){return"group"===t.type&&t.id===e||"flat"===t.type&&t.id===r})}(t,n,i),l=a?null:function(t,r,e){return r?{id:r,type:"group",groupLabel:e}:{id:t,type:"flat"}}(n,i,o),u=l?[].concat(Jt(t.groups),[l]):t.groups,c=[].concat(Jt(t.keyDefinitions),[qt(qt({},r),{},{type:"manual"},i?{groupId:i}:{})]);return qt(qt({},t),{},{keyDefinitions:c,groups:u})},REMOVE_KEY_SYMBOL:function(t,r){var e=r.id;return qt(qt({},t),{},{keyDefinitions:t.keyDefinitions.filter(function(t){return t.id!==e})})},ADD_KEY_GROUPS:function(t,r){return qt(qt({},t),{},{groups:[].concat(Jt(t.groups),Jt(r))})}}},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 r=t.mapState.mapStyle,e=t.pluginConfig.noKeyItemText,i=t.pluginState,a=t.services.eventBus,u=Gt((0,n.useState)(o),2),c=u[0],s=u[1],v=Gt((0,n.useState)(function(){var t;return null!==(t=null==c?void 0:c.keyItems().items)&&void 0!==t?t:[]}),2),d=v[0],h=v[1],g=Gt((0,n.useState)(function(){var t;return null!==(t=null==c?void 0:c.keyItems().hasGroups)&&void 0!==t&&t}),2),S=g[0],O=g[1],j=function(){var t=c.keyItems(),r=t.items,e=t.hasGroups,n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=l(function(){var t;if(null===(t=y)||void 0===t||!t.current)return[];if(p===y.current)return b;p=y.current;var r=y.current,e=r.groups,n=void 0===e?[]:e,o=r.keyDefinitions,i=void 0===o?[]:o;return b=n.map(function(t){return"flat"===t.type?f(f({},t),{},{keyDefinition:i.find(function(r){return r.id===t.id})}):f(f({},t),{},{keyDefinitions:i.filter(function(r){return r.groupId===t.id})})})}());if(0===r.length)return t;var e=t.map(function(t){var e=r.findIndex(function(r){return r.id===t.id});if(-1===e)return t;var n=r.splice(e,1)[0];return f(f(f({},t),n),{},{keyDefinitions:[].concat(l(n.keyDefinitions||[]),l(t.keyDefinitions||[]))})});return[].concat(l(e),l(r)).filter(function(t){var r;return"flat"===t.type&&t.keyDefinition||"group"===t.type&&(null===(r=t.keyDefinitions)||void 0===r?void 0:r.length)})}(r);h(n),O(e)},w=function(t){c.invalidateKeyItemsOnMenuStateChange(t),j()};return(0,n.useEffect)(function(){return c?(j(),a.on("menu:changed",w).on("datasets:changed",j),function(){return a.off("menu:changed",w).off("datasets:changed",j)}):(a.requestOnce("datasets:registry",s),function(){})},[c]),(0,n.useEffect)(function(){c&&j()},[i]),(0,m.jsx)(Bt,{noKeyItemText:e,keyGroups:d,hasGroups:S,mapStyle:r})}}],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"/>'}],api:{addSymbol:function(t,r){(0,t.pluginState.dispatch)({type:"ADD_KEY_SYMBOL",payload:r})},removeSymbol:function(t,r){(0,t.pluginState.dispatch)({type:"REMOVE_KEY_SYMBOL",payload:r})}}}}}]);
1
+ "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[414],{718(t,e,r){r.r(e),r.d(e,{manifest:()=>gt});var n=r(738),o=null,i=function(t){return o=t};function u(t){return u="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},u(t)}function l(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return a(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function c(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?c(Object(r),!0).forEach(function(e){f(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function f(t,e,r){return(e=function(t){var e=function(t){if("object"!=u(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==u(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var s={},p=null,m=[],b=r(287),d=function(t){var e=t.text;return(0,b.jsx)("div",{className:"im-c-map-key",children:(0,b.jsx)("p",{className:"im-c-map-key__empty-message",children:e})})};function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}var g=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===v(t)){if(e&&t[e])return t[e];var r=Object.values(t)[0];return null!=r?r:null}return null};function h(t){return h="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},h(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 O(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){j(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 j(t,e,r){return(e=function(t){var e=function(t){if("object"!=h(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==h(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var w=20,k=44,P={xmlns:"http://www.w3.org/2000/svg",width:w,height:w,viewBox:"0 0 ".concat(w," ").concat(w),className:"im-c-map-key-symbol","aria-hidden":"true",focusable:"false"},D=O(O({},P),{},{width:k,height:k,viewBox:"0 0 ".concat(k," ").concat(k),className:"im-c-map-key-symbol im-c-map-key-symbol--point"});function x(t){return x="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},x(t)}function E(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function A(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?E(Object(r),!0).forEach(function(e){I(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):E(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"!=x(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=x(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==x(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var R=function(t){var e=t.keyDefinition,r=t.mapStyle,n=t.patternRegistry,o=e.style,i=n.getKeyPatternPaths(o,r.id);return i?(0,b.jsxs)("svg",A(A({},P),{},{children:[(0,b.jsx)("g",{dangerouslySetInnerHTML:{__html:i.border}}),(0,b.jsx)("g",{transform:"translate(".concat(2,", ").concat(2,")"),dangerouslySetInnerHTML:{__html:i.content}})]})):null};function _(t){return _="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},_(t)}function M(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function T(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?M(Object(r),!0).forEach(function(e){C(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function C(t,e,r){return(e=function(t){var e=function(t){if("object"!=_(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var K=function(t){var e=t.keySymbol,r=null!=e?e:{},n=r.svg,o=r.viewBox;if(!n||!o)return null;var i,u,l=(i=o.split(" ").map(Number),u=4,function(t){if(Array.isArray(t))return t}(i)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,l=[],a=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;a=!1}else for(;!(a=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{if(!a&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(c)throw o}}return l}}(i,u)||function(t,e){if(t){if("string"==typeof t)return L(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?L(t,e):void 0}}(i,u)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=l[2],c=l[3],y=Math.min(1,56/Math.max(a,c)),f=a*y,s=c*y;return(0,b.jsx)("svg",T(T({},D),{},{overflow:"visible",children:(0,b.jsx)("svg",{x:.5*(k-f),y:.5*(k-s),width:f,height:s,viewBox:o,overflow:"hidden",children:(0,b.jsx)("g",{dangerouslySetInnerHTML:{__html:n}})})}))};function N(t){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(t)}function 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 G(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){U(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 U(t,e,r){return(e=function(t){var e=function(t){if("object"!=N(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==N(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Y=function(t){var e=t.mapStyle,r=t.keyDefinition.style,n=r.strokeWidth,o=g(r.stroke,e.id);return(0,b.jsx)("svg",G(G({},P),{},{children:(0,b.jsx)("line",{x1:n/2,y1:10,x2:w-n/2,y2:10,stroke:o,strokeWidth:n,strokeLinecap:"round"})}))};function W(t){return W="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},W(t)}function $(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function F(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?$(Object(r),!0).forEach(function(e){H(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function H(t,e,r){return(e=function(t){var e=function(t){if("object"!=W(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=W(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==W(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var z=function(t){var e=t.mapStyle,r=t.keyDefinition.style,n=r.strokeWidth,o=g(r.fill,e.id),i=g(r.stroke,e.id);return(0,b.jsx)("svg",F(F({},P),{},{children:(0,b.jsx)("rect",{x:n/2,y:n/2,width:w-n,height:w-n,rx:n,ry:n,fill:o,stroke:i,strokeWidth:n,strokeLinejoin:"round"})}))},q=function(t){var e=t.mapStyle,r=t.keyDefinition,o=t.patternRegistry,i=r.style,u=r.hasPattern,l="im-c-map-key-ramp-"+(0,n.useId)().replace(/[^\w-]/g,""),a=u?o.getKeyPatternPaths(i,e.id):null,c=g(i.stroke,e.id),y=a?"url(#".concat(l,")"):g(i.fill,e.id);return(0,b.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"im-c-map-key-symbol","aria-hidden":"true",focusable:"false",children:[a&&(0,b.jsx)("defs",{children:(0,b.jsx)("pattern",{id:l,patternUnits:"userSpaceOnUse",x:2,y:2,width:16,height:16,dangerouslySetInnerHTML:{__html:a.content}})}),(0,b.jsx)("rect",{width:"100%",height:"100%",fill:y||"none",stroke:c,strokeWidth:c?4:void 0})]})},V="ramp",J=function(t){var e=t.keyDefinition,r=t.groupStyle,n=t.mapStyle,o=t.symbolRegistry,i=t.patternRegistry,u=function(t,e,r,n){if(!t)return{symbolShape:null,keySymbol:null};var o=t.hasSymbol,i=t.hasPattern,u=t.style;if(e===V)return{symbolShape:V,keySymbol:null};if(o){var l=n.getKeySymbol(u,r);return{symbolShape:l?"symbol":"rect",keySymbol:l}}return i?{symbolShape:"pattern",keySymbol:null}:null==u.fill&&u.stroke?{symbolShape:"line",keySymbol:null}:{symbolShape:"rect",keySymbol:null}}(e,r,n,o),l=u.symbolShape,a=u.keySymbol;return l?"symbol"===l?(0,b.jsx)(K,{keySymbol:a}):"pattern"===l?(0,b.jsx)(R,{mapStyle:n,keyDefinition:e,patternRegistry:i}):"line"===l?(0,b.jsx)(Y,{mapStyle:n,keyDefinition:e}):l===V?(0,b.jsx)(q,{mapStyle:n,keyDefinition:e,patternRegistry:i}):(0,b.jsx)(z,{mapStyle:n,keyDefinition:e}):null},Q=function(t){var e=t.keyDefinition,r=t.groupStyle,n=t.mapStyle,o=t.symbolRegistry,i=t.patternRegistry,u=e.label,l=g(e.symbolDescription,n.id);return(0,b.jsxs)("div",{className:"im-c-map-key-list__item",children:[(0,b.jsx)("dt",{className:"im-c-map-key-list__item-symbol",children:(0,b.jsx)(J,{keyDefinition:e,groupStyle:r,mapStyle:n,symbolRegistry:o,patternRegistry:i})}),(0,b.jsxs)("dd",{className:"im-c-map-key-list__item-label",children:[u,l&&(0,b.jsxs)("span",{className:"govuk-visually-hidden",children:["(",l,")"]})]})]})},X=(new Set,new Set(["symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"]),function(t){return!!(null!=t&&t.symbol||null!=t&&t.symbolSvgContent)});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 tt,et=function(t){var e=t.headingId,r=t.label,o=t.groupStyle,i=t.keyDefinitions,u=t.mapStyle,l=t.symbolRegistry,a=t.patternRegistry,c=(0,n.useRef)(null),y=function(t,e){return t===V&&e.some(function(t){return X(t.style)})?void 0:t}(o,i),f=y===V,s=f&&i.some(function(t){var e;return g(null===(e=t.style)||void 0===e?void 0:e.stroke,u.id)}),p=function(t,e,r,o){var i,u,l=(i=(0,n.useState)(!0),u=2,function(t){if(Array.isArray(t))return t}(i)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,l=[],a=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;a=!1}else for(;!(a=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{if(!a&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(c)throw o}}return l}}(i,u)||function(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}}(i,u)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=l[0],c=l[1],y=e.join("\n");return(0,n.useLayoutEffect)(function(){var n,o=t.current;if(r&&o){var i=!0,u=function(){var t=i?function(t,e){var r,n=t.querySelector(".im-c-map-key-list__item-label"),o=(void 0===tt&&(tt=null!==(r=document.createElement("canvas").getContext("2d"))&&void 0!==r?r:null),tt);if(!n||!o||!t.clientWidth)return null;var i=getComputedStyle(n),u=i.fontStyle,l=i.fontWeight,a=i.fontSize,c=i.fontFamily;o.font="".concat(u," ").concat(l," ").concat(a," ").concat(c);var y=getComputedStyle(t),f=Number.parseFloat(y.columnGap)||0,s=(Number.parseFloat(y.paddingLeft)||0)+(Number.parseFloat(y.paddingRight)||0),p=(t.clientWidth-s-f*(e.length-1))/e.length;return e.every(function(t){return o.measureText(t).width<=p})}(o,e):null;null!==t&&c(t)};u();var l="function"==typeof ResizeObserver?new ResizeObserver(u):null;return null==l||l.observe(o),null===(n=document.fonts)||void 0===n||n.ready.then(u,function(){}),function(){i=!1,null==l||l.disconnect()}}},[r,o,y]),a?"horizontal":"vertical"}(c,i.map(function(t){var e;return null!==(e=t.label)&&void 0!==e?e:""}),f,s),m=function(t,e,r){if(!t)return"im-c-map-key-list";var n="im-c-map-key-list im-c-map-key-list--".concat(t);if(t!==V)return n;var o="".concat(n," im-c-map-key-list--ramp-").concat(e);return r?"".concat(o," im-c-map-key-list--has-stroke"):o}(y,p,s);return(0,b.jsxs)("section",{className:"im-c-map-key__group","aria-labelledby":e,children:[(0,b.jsx)("h3",{id:e,className:"im-c-map-key__group-heading",children:r}),(0,b.jsx)("dl",{ref:c,className:m,children:i.map(function(t){return(0,b.jsx)(Q,{keyDefinition:t,mapStyle:u,symbolRegistry:l,patternRegistry:a,groupStyle:y},"".concat(t.id))})})]})},rt="im-c-map-key",nt=function(t){var e=t.item,r=t.groupStyle,n=t.mapStyle,o=t.symbolRegistry,i=t.patternRegistry;return"group"===e.type?(0,b.jsx)(et,{headingId:"key-heading-".concat(e.id),label:e.groupLabel,groupStyle:r,keyDefinitions:e.keyDefinitions,mapStyle:n,symbolRegistry:o,patternRegistry:i}):(0,b.jsx)(Q,{keyDefinition:e.keyDefinition,mapStyle:n,symbolRegistry:o,patternRegistry:i})},ot=function(t){var e=t.noKeyItemText,r=t.keyGroups,n=t.hasGroups,o=t.mapStyle,i=t.symbolRegistry,u=t.patternRegistry;if(null==r||!r.length)return(0,b.jsx)(d,{text:e});var l=n?"".concat(rt," ").concat("im-c-map-key--has-groups"):rt;return(0,b.jsx)("div",{className:l,children:r.map(function(t){return(0,b.jsx)(nt,{item:t,mapStyle:o,symbolRegistry:i,patternRegistry:u,groupStyle:t.groupStyle},t.id)})})};function it(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,u,l=[],a=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;a=!1}else for(;!(a=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{if(!a&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(c)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ut(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)?ut(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 ut(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function lt(t){return lt="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},lt(t)}function at(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 ct(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?at(Object(r),!0).forEach(function(e){yt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):at(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function yt(t,e,r){return(e=function(t){var e=function(t){if("object"!=lt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=lt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==lt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ft(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function st(t){return st="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},st(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"!=st(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=st(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==st(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dt(t){return function(t){if(Array.isArray(t))return vt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return vt(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)?vt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vt(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 gt={InitComponent:function(t){var e=t.pluginConfig,r=t.pluginState,o=t.mapState,u=t.services,l=r.dispatch,a=u.eventBus,c=(0,n.useRef)(r);c.current=r,(0,n.useEffect)(function(){o.isMapReady&&(function(t){s=t}(c),a.requestOnce("datasets:registry",i),a.emit("map-key:ready"))},[o.isMapReady]),(0,n.useEffect)(function(){if(e.groups){var t=Object.entries(e.groups).map(function(t){var e,r,n=(r=2,function(t){if(Array.isArray(t))return t}(e=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,l=[],a=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;a=!1}else for(;!(a=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{if(!a&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(c)throw o}}return l}}(e,r)||function(t,e){if(t){if("string"==typeof t)return ft(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)?ft(t,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=n[0],i=n[1];return ct(ct({},i),{},{id:o,label:i.groupLabel})});l({type:"ADD_KEY_GROUPS",payload:t})}},[e.groups])},reducer:{initialState:{keyDefinitions:[],groups:[]},actions:{ADD_KEY_SYMBOL:function(t,e){var r,n=e.id,o=e.groupLabel,i=e.groupId||((r=o)?r.toLowerCase().replace(/\s+/g,"-"):null),u=function(t,e,r){return t.groups.find(function(t){return"group"===t.type&&t.id===r||"flat"===t.type&&t.id===e})}(t,n,i),l=u?null:function(t,e,r){return e?{id:e,type:"group",groupLabel:r}:{id:t,type:"flat"}}(n,i,o),a=l?[].concat(dt(t.groups),[l]):t.groups,c=[].concat(dt(t.keyDefinitions),[mt(mt({},e),{},{type:"manual"},i?{groupId:i}:{})]);return mt(mt({},t),{},{keyDefinitions:c,groups:a})},REMOVE_KEY_SYMBOL:function(t,e){var r=e.id;return mt(mt({},t),{},{keyDefinitions:t.keyDefinitions.filter(function(t){return t.id!==r})})},ADD_KEY_GROUPS:function(t,e){return mt(mt({},t),{},{groups:[].concat(dt(t.groups),dt(e))})}}},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.pluginState,u=t.services,a=u.eventBus,c=u.symbolRegistry,f=u.patternRegistry,d=it((0,n.useState)(o),2),v=d[0],g=d[1],h=it((0,n.useState)(function(){var t;return null!==(t=null==v?void 0:v.keyItems().items)&&void 0!==t?t:[]}),2),S=h[0],O=h[1],j=it((0,n.useState)(function(){var t;return null!==(t=null==v?void 0:v.keyItems().hasGroups)&&void 0!==t&&t}),2),w=j[0],k=j[1],P=function(){var t=v.keyItems(),e=t.items,r=t.hasGroups,n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=l(function(){var t;if(null===(t=s)||void 0===t||!t.current)return[];if(p===s.current)return m;p=s.current;var e=s.current,r=e.groups,n=void 0===r?[]:r,o=e.keyDefinitions,i=void 0===o?[]:o;return m=n.map(function(t){return"flat"===t.type?y(y({},t),{},{keyDefinition:i.find(function(e){return e.id===t.id})}):y(y({},t),{},{keyDefinitions:i.filter(function(e){return e.groupId===t.id})})})}());if(0===e.length)return t;var r=t.map(function(t){var r=e.findIndex(function(e){return e.id===t.id});if(-1===r)return t;var n=e.splice(r,1)[0];return y(y(y({},t),n),{},{keyDefinitions:[].concat(l(n.keyDefinitions||[]),l(t.keyDefinitions||[]))})});return[].concat(l(r),l(e)).filter(function(t){var e;return"flat"===t.type&&t.keyDefinition||"group"===t.type&&(null===(e=t.keyDefinitions)||void 0===e?void 0:e.length)})}(e);O(n),k(r)},D=function(t){v.invalidateKeyItemsOnMenuStateChange(t),P()};return(0,n.useEffect)(function(){return v?(P(),a.on("menu:changed",D).on("datasets:changed",P),function(){return a.off("menu:changed",D).off("datasets:changed",P)}):(a.requestOnce("datasets:registry",g),function(){})},[v]),(0,n.useEffect)(function(){v&&P()},[i]),(0,b.jsx)(ot,{noKeyItemText:r,keyGroups:S,hasGroups:w,mapStyle:e,symbolRegistry:c,patternRegistry:f})}}],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"/>'}],api:{addSymbol:function(t,e){(0,t.pluginState.dispatch)({type:"ADD_KEY_SYMBOL",payload:e})},removeSymbol:function(t,e){(0,t.pluginState.dispatch)({type:"REMOVE_KEY_SYMBOL",payload:e})}}}}}]);
@@ -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,64));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})());
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,718));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,7 +6,7 @@ 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, groupStyle, mapStyle }) => {
9
+ const KeyItemWrapper = ({ item, groupStyle, mapStyle, symbolRegistry, patternRegistry }) => {
10
10
  if (item.type === 'group') {
11
11
  return (
12
12
  <KeyGroupItem
@@ -15,10 +15,12 @@ const KeyItemWrapper = ({ item, groupStyle, mapStyle }) => {
15
15
  groupStyle={groupStyle}
16
16
  keyDefinitions={item.keyDefinitions}
17
17
  mapStyle={mapStyle}
18
+ symbolRegistry={symbolRegistry}
19
+ patternRegistry={patternRegistry}
18
20
  />
19
21
  )
20
22
  } else {
21
- return (<KeyItem keyDefinition={item.keyDefinition} mapStyle={mapStyle} />)
23
+ return (<KeyItem keyDefinition={item.keyDefinition} mapStyle={mapStyle} symbolRegistry={symbolRegistry} patternRegistry={patternRegistry} />)
22
24
  }
23
25
  }
24
26
 
@@ -26,7 +28,9 @@ export const Key = ({
26
28
  noKeyItemText,
27
29
  keyGroups,
28
30
  hasGroups,
29
- mapStyle
31
+ mapStyle,
32
+ symbolRegistry,
33
+ patternRegistry
30
34
  }) => {
31
35
  if (!keyGroups?.length) {
32
36
  return (<EmptyKey text={noKeyItemText} />)
@@ -37,7 +41,7 @@ export const Key = ({
37
41
  const className = hasGroups ? `${keyClassName} ${keyGroupsClassName}` : keyClassName
38
42
  return (
39
43
  <div className={className}>
40
- {keyGroups.map(item => <KeyItemWrapper key={item.id} item={item} mapStyle={mapStyle} groupStyle={item.groupStyle} />)}
44
+ {keyGroups.map(item => <KeyItemWrapper key={item.id} item={item} mapStyle={mapStyle} symbolRegistry={symbolRegistry} patternRegistry={patternRegistry} groupStyle={item.groupStyle} />)}
41
45
  </div>
42
46
  )
43
47
  }
@@ -47,9 +47,11 @@
47
47
  padding-bottom: 15px;
48
48
  }
49
49
 
50
+ $map-key-item-padding: 10px;
51
+
50
52
  .im-c-map-key__group > .im-c-map-key-list .im-c-map-key-list__item {
51
- padding-top: 10px;
52
- padding-bottom: 10px;
53
+ padding-top: $map-key-item-padding;
54
+ padding-bottom: $map-key-item-padding;
53
55
  }
54
56
 
55
57
  // Last item in all scenarios — flat or inside the last group
@@ -60,66 +62,155 @@
60
62
 
61
63
  // Symbol
62
64
 
65
+ $map-key-symbol-inset: 3px;
66
+ $map-key-symbol-label-gap: 13px;
67
+
68
+ // Block, not inline, so the symbol cell is exactly the symbol's height, with no space below
69
+ // it for the text baseline
63
70
  .im-c-map-key-symbol {
71
+ display: block;
64
72
  position: relative;
65
73
  flex-shrink: 0;
66
- margin: 0 13px 0 3px;
74
+ margin: 0 $map-key-symbol-label-gap 0 $map-key-symbol-inset;
67
75
  }
68
76
 
69
77
  .im-c-map-key-symbol--point {
70
78
  margin: -12px 1px -12px -9px;
71
79
  }
72
80
 
73
- .im-c-map-key-list-horizontal-ramp {
74
- display: grid;
75
- grid-auto-flow: column;
76
- grid-auto-columns: 1fr;
77
- direction: rtl;
78
- margin-bottom: 10px;
81
+ // Ramp: bands butt up to each other unless any band has a stroke, then they're separated by a
82
+ // gap. Horizontal when every label fits on one line under its band (see useRampOrientation.js),
83
+ // otherwise vertical.
84
+
85
+ $map-key-symbol-size: 20px;
86
+ $map-key-ramp-gap: 2px;
87
+ $map-key-ramp-radius: 3px;
88
+
89
+ // Inset on both sides by the standard symbol's left margin, so the ramp lines up with the
90
+ // symbols in other groups. Both orientations share this padding and gap, so the available
91
+ // width measured for the labels is the same whichever orientation is rendered.
92
+ .im-c-map-key-list--ramp {
93
+ display: flex;
94
+ padding: 0 $map-key-symbol-inset;
95
+
96
+ &.im-c-map-key-list--has-stroke {
97
+ gap: $map-key-ramp-gap;
98
+ }
99
+
100
+ .im-c-map-key-symbol {
101
+ margin: 0;
102
+ overflow: hidden;
103
+ }
104
+ }
105
+
106
+ // Horizontal: each item is an equal-width band in a row, with its label centred below
107
+
108
+ .im-c-map-key-list--ramp-horizontal {
109
+ padding-bottom: 10px;
110
+
79
111
  .im-c-map-key-list__item {
80
- padding: 0 !important;
81
- position: relative !important;
82
- display: flex;
112
+ flex: 1 1 0;
83
113
  flex-direction: column;
114
+ align-items: stretch;
115
+ min-width: 0;
116
+ }
117
+
118
+ .im-c-map-key-symbol {
119
+ display: block;
120
+ width: 100%;
121
+ height: $map-key-symbol-size;
122
+ }
123
+
124
+ // Butted bands sit at fractional pixel positions, and each svg anti-aliases its own edges,
125
+ // so the panel shows through as a hairline at each seam. Extending every band but the last
126
+ // 1px under the next one puts a band, not the panel, behind each seam.
127
+ &:not(.im-c-map-key-list--has-stroke) .im-c-map-key-list__item:not(:last-child) .im-c-map-key-symbol {
128
+ width: calc(100% + 1px);
129
+ }
130
+
131
+ .im-c-map-key-list__item:first-child .im-c-map-key-symbol {
132
+ border-top-left-radius: $map-key-ramp-radius;
133
+ border-bottom-left-radius: $map-key-ramp-radius;
134
+ }
135
+
136
+ .im-c-map-key-list__item:last-child .im-c-map-key-symbol {
137
+ border-top-right-radius: $map-key-ramp-radius;
138
+ border-bottom-right-radius: $map-key-ramp-radius;
139
+ }
140
+
141
+ .im-c-map-key-list__item-label {
142
+ margin-top: 4px;
143
+ text-align: center;
144
+ white-space: nowrap;
145
+ }
146
+ }
84
147
 
85
- .im-c-map-key-list__item-symbol {
86
- margin: 0 !important;
87
- width: 100%;
88
- max-height: var(--line-height);
89
- direction: ltr;
90
- overflow-y: hidden;
91
- svg {
92
- display: block;
93
- }
94
-
95
- }
96
- .im-c-map-key-list__item-label {
97
- width: 100%;
98
- direction: ltr;
99
- margin-top: 10px;
100
- // Offset the label, so it sits below the border with the next box
101
- white-space: nowrap;
102
- text-align: center;
103
- }
104
-
105
- &:first-child { // rightmost visual cell (rtl) - add a curved corner
106
- .im-c-map-key-list__item-symbol {
107
- border-top-right-radius: 4px;
108
- border-bottom-right-radius: 4px;
109
- overflow: hidden;
110
- }
111
- }
112
-
113
- &:last-child { // leftmost visual cell (rtl)
114
- .im-c-map-key-list__item-symbol { // add a curved corner
115
- border-top-left-radius: 4px;
116
- border-bottom-left-radius: 4px;
117
- overflow: hidden;
118
- }
119
- }
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;
125
- }
148
+ // Same specificity as the standard list item rules above, so horizontal items have no padding
149
+ .im-c-map-key__group > .im-c-map-key-list--ramp-horizontal .im-c-map-key-list__item,
150
+ .im-c-map-key__group:last-child > .im-c-map-key-list--ramp-horizontal .im-c-map-key-list__item:last-child {
151
+ padding-top: 0;
152
+ padding-bottom: 0;
153
+ }
154
+
155
+ .im-c-map-key__group:last-child > .im-c-map-key-list--ramp-horizontal {
156
+ padding-bottom: 5px;
157
+ }
158
+
159
+ // Vertical: bands the width of a standard symbol, stacked, with the label beside each one.
160
+ // Rows have the standard item padding, so labels sit where they would in other groups, and
161
+ // each band is drawn over its whole item, padding included.
162
+
163
+ .im-c-map-key-list--ramp-vertical {
164
+ flex-direction: column;
165
+
166
+ .im-c-map-key-list__item {
167
+ position: relative;
168
+ }
169
+
170
+ .im-c-map-key-list__item-symbol {
171
+ flex-shrink: 0;
172
+ width: $map-key-symbol-size;
173
+ height: $map-key-symbol-size;
174
+ margin-right: $map-key-symbol-label-gap;
175
+ }
176
+
177
+ .im-c-map-key-symbol {
178
+ position: absolute;
179
+ top: 0;
180
+ left: 0;
181
+ width: $map-key-symbol-size;
182
+ height: 100%;
183
+ }
184
+
185
+ // As for horizontal, extend every band but the last 1px under the next one
186
+ &:not(.im-c-map-key-list--has-stroke) .im-c-map-key-list__item:not(:last-child) .im-c-map-key-symbol {
187
+ height: calc(100% + 1px);
188
+ }
189
+
190
+ .im-c-map-key-list__item:first-child .im-c-map-key-symbol {
191
+ border-top-left-radius: $map-key-ramp-radius;
192
+ border-top-right-radius: $map-key-ramp-radius;
193
+ }
194
+
195
+ .im-c-map-key-list__item:last-child .im-c-map-key-symbol {
196
+ border-bottom-left-radius: $map-key-ramp-radius;
197
+ border-bottom-right-radius: $map-key-ramp-radius;
198
+ }
199
+ }
200
+
201
+ // Same specificity as the standard last item rule above, so the last band is full height
202
+ .im-c-map-key__group:last-child > .im-c-map-key-list--ramp-vertical .im-c-map-key-list__item:last-child {
203
+ padding-bottom: $map-key-item-padding;
204
+ }
205
+
206
+ // Stroked bands are separated by the gap, so the padding either side of it gives up half the
207
+ // gap each, keeping the label spacing the same as in other groups
208
+ .im-c-map-key__group > .im-c-map-key-list--ramp-vertical.im-c-map-key-list--has-stroke .im-c-map-key-list__item {
209
+ &:not(:first-child) {
210
+ padding-top: $map-key-item-padding - $map-key-ramp-gap * 0.5;
211
+ }
212
+
213
+ &:not(:last-child) {
214
+ padding-bottom: $map-key-item-padding - $map-key-ramp-gap * 0.5;
215
+ }
216
+ }