@defra/interactive-map 0.0.54-alpha → 0.0.55-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/templates/add-polygons.njk +1 -1
- package/assets/templates/add-symbols.njk +4 -4
- package/assets/templates/draw-tools.njk +7 -7
- package/assets/templates/marker-panel.njk +5 -5
- package/assets/templates/place-marker.njk +8 -8
- package/assets/templates/search-control.njk +1 -1
- package/assets/templates/select-feature.njk +7 -7
- package/assets/templates/style-switcher.njk +4 -4
- package/assets/templates/toggle-marker-label.njk +3 -3
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/im-shell.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/im-core.js.LICENSE.txt +0 -30
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.LICENSE.txt +0 -20
- package/docs/api.md +3 -13
- package/docs/building-a-plugin.md +2 -2
- package/docs/examples/add-marker-with-panel.mdx +46 -44
- package/docs/examples/add-polygons.mdx +100 -98
- package/docs/examples/add-symbols.mdx +75 -73
- package/docs/examples/basic-map.mdx +16 -14
- package/docs/examples/button-map.mdx +16 -14
- package/docs/examples/draw-tools.mdx +119 -117
- package/docs/examples/place-marker.mdx +51 -49
- package/docs/examples/search-control.mdx +22 -20
- package/docs/examples/select-feature.mdx +107 -105
- package/docs/examples/style-switcher.mdx +47 -45
- package/docs/examples/toggle-marker-label.mdx +30 -28
- package/docs/getting-started.md +26 -24
- package/docs/plugins/draw.md +10 -10
- package/docs/plugins/interact.md +9 -9
- package/docs/plugins/plugin-descriptor.md +1 -1
- package/docs/plugins/search.md +3 -3
- package/docusaurus.config.cjs +23 -0
- package/package.json +3 -7
- package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -1
- package/plugins/beta/draw-es/dist/esm/index.js +1 -1
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/dist/esm/index.js +1 -1
- package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/dist/umd/index.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/DrawMode.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/EditMode.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/geometryHelpers.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/im-draw-ol-plugin.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/index.js +1 -1
- package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -1
- package/plugins/beta/frame/dist/esm/index.js +1 -1
- package/plugins/beta/frame/dist/umd/im-frame-plugin.js +1 -1
- package/plugins/beta/frame/dist/umd/index.js +1 -1
- package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/esm/index.js +1 -1
- package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/umd/index.js +1 -1
- package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -1
- package/plugins/beta/scale-bar/dist/esm/index.js +1 -1
- package/plugins/beta/scale-bar/dist/umd/im-scale-bar-plugin.js +1 -1
- package/plugins/beta/scale-bar/dist/umd/index.js +1 -1
- package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -1
- package/plugins/beta/use-location/dist/esm/index.js +1 -1
- package/plugins/beta/use-location/dist/umd/im-use-location-plugin.js +1 -1
- package/plugins/beta/use-location/dist/umd/index.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-esri-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ol-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/esm/index.js +1 -1
- package/plugins/datasets/dist/esm/layerAdapter.js +1 -1
- package/plugins/datasets/dist/esm/mapboxStyleLayerAdapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/umd/index.js +1 -1
- package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/esm/index.js +1 -1
- package/plugins/draw/dist/esm/liveDrawChecks.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/umd/index.js +1 -1
- package/plugins/draw/src/adapters/maplibre/styles.js +3 -2
- package/plugins/draw/src/adapters/maplibre/styles.test.js +3 -3
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/esm/index.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/index.js +1 -1
- package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/esm/index.js +1 -1
- package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/umd/index.js +1 -1
- package/plugins/menu/dist/esm/im-menu-plugin.js +1 -1
- package/plugins/menu/dist/esm/index.js +1 -1
- package/plugins/menu/dist/umd/im-menu-plugin.js +1 -1
- package/plugins/menu/dist/umd/index.js +1 -1
- package/plugins/search/dist/esm/im-search-plugin.js +1 -1
- package/plugins/search/dist/esm/index.js +1 -1
- package/plugins/search/dist/umd/im-search-plugin.js +1 -1
- package/plugins/search/dist/umd/index.js +1 -1
- package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
- package/providers/beta/esri/dist/esm/index.js +1 -1
- package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +1 -1
- package/providers/beta/open-names/dist/esm/index.js +1 -1
- package/providers/beta/open-names/dist/umd/im-reverse-geocode.js +1 -1
- package/providers/beta/open-names/dist/umd/index.js +1 -1
- package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/esm/index.js +1 -1
- package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/umd/index.js +1 -1
- package/providers/beta/openlayers/src/index.js +27 -4
- package/providers/beta/openlayers/src/index.test.js +47 -0
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/esm/index.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-framework.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-framework.js.LICENSE.txt +3 -3
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-worker.js +2 -0
- package/providers/maplibre/dist/umd/im-maplibre-worker.js.LICENSE.txt +4 -0
- package/providers/maplibre/dist/umd/index.js +1 -1
- package/providers/maplibre/src/index.js +41 -12
- package/providers/maplibre/src/index.test.js +43 -12
- package/providers/maplibre/src/utils/detectModuleWorker.js +25 -0
- package/providers/maplibre/src/utils/detectModuleWorker.test.js +40 -0
- package/providers/maplibre/src/utils/spatial.js +22 -12
- package/providers/maplibre/src/utils/spatial.test.js +6 -6
- package/providers/maplibre/src/utils/workerUrl.js +15 -0
- package/providers/maplibre/src/utils/workerUrl.test.js +14 -0
- package/rollup.esm.mjs +38 -1
- package/src/InteractiveMap/InteractiveMap.js +2 -1
- package/src/InteractiveMap/InteractiveMap.test.js +9 -2
- package/src/InteractiveMap/domStateManager.js +21 -1
- package/src/InteractiveMap/domStateManager.test.js +48 -1
- package/src/InteractiveMap/polyfills.js +4 -3
- package/src/InteractiveMap/polyfills.test.js +12 -0
- package/src/types.js +3 -5
- package/webpack.dev.mjs +2 -0
- package/webpack.umd.mjs +28 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect as e,useRef as t}from"preact/compat";import{jsx as a,jsxs as r,Fragment as i}from"preact/jsx-runtime";import s from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/helpers/asyncToGenerator";function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}function l(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach(function(t){s(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var d=e=>{var{datasets:t=[]}=e,a=[],r=t.filter(e=>{var t;return e.showInMenu||(null===(t=e.sublayers)||void 0===t?void 0:t.some(e=>e.showInMenu))}),i=new Map;return r.forEach(e=>{var t;if(null!==(t=e.sublayers)&&void 0!==t&&t.length){var r=e.sublayers.filter(t=>e.showInMenu?!1!==t.showInMenu:t.showInMenu);if(!1===e.showInMenu&&!r.length)return;var s={id:e.id,groupLabel:e.label,visibleWhen:!0,type:"checkbox",items:r.map(t=>({id:"".concat(e.id,"-").concat(t.id),label:t.label}))};0===s.items.length&&(delete s.groupLabel,s.items.push({id:e.id,label:e.label})),a.push(s)}else if(e.groupLabel){var n=i.has(e.groupLabel)?i.get(e.groupLabel):{id:e.groupLabel,groupLabel:e.groupLabel,visibleWhen:!0,type:"checkbox",items:[]};i.has(e.groupLabel)||(i.set(e.groupLabel,n),a.push(n)),n.items.push({id:e.id,label:e.label})}else a.push({visibleWhen:!0,type:"checkbox",id:e.id,items:[{id:e.id,label:e.label}]})}),a},p=(e,t)=>e.reduce((e,a)=>{var r=a.items.filter(e=>!t.includes(e.id));return r.length&&e.push(l(l({},a),{},{items:r})),e},[]);function u(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}function c(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?u(Object(a),!0).forEach(function(t){s(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):u(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var y={minZoom:6,maxZoom:24,showInKey:!1,showInMenu:!1,visible:!0,style:{stroke:"#d4351c",strokeWidth:2,symbolDescription:"red outline"}},h=["stroke","strokeWidth","strokeDashArray","fill","fillPattern","fillPatternSvgContent","fillPatternForegroundColor","fillPatternBackgroundColor","opacity","symbolDescription","symbol","symbolSvgContent","symbolViewBox","symbolAnchor","symbolSize","symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"],v=["stroke","fill","fillPattern","fillPatternSvgContent","symbol","symbolSvgContent"],b=e=>v.some(t=>t in e);function m(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}function f(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?m(Object(a),!0).forEach(function(t){s(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):m(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var g=(e,t)=>{var a,{id:r}=t,i=(e=>{!0!==e.visible&&!1!==e.visible&&(e.visible="hidden"!==e.visibility);var t=c(c(c({},y),e),{},{style:c({},e.style)});return h.forEach(e=>delete t[e]),t})(t);t.parentId&&("showInKey"in t||delete i.showInKey,"showInMenu"in t||delete i.showInMenu),e[r]=i;var{orderedDatasets:s}=e;s.push(r);var n=null===(a=t.sublayers)||void 0===a?void 0:a.map(e=>((e,t)=>{var a="".concat(e,"-").concat(t.id),r=t.id;return"hidden"!==t.visibility&&(t.visibility="visible"),f(f({},t),{},{id:a,parentId:e,sublayerId:r})})(r,e));if(null!=n&&n.length){var o=null==n?void 0:n.map(e=>e.id),l=null==n?void 0:n.reduce(g,{orderedDatasets:s});return e[r].sublayerIds=o,delete e[r].sublayers,f(f(f({},e),l),{},{orderedDatasets:s})}return f(f({},e),{},{orderedDatasets:s})},D=e=>{var t=(e.datasets||[]).reduce(g,{orderedDatasets:[]}),{orderedDatasets:a}=t;return delete t.orderedDatasets,f(f({},e),{},{mappedDatasets:t,orderedDatasets:a})},_="[interactive-map]",S={warn:function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return console.warn(_,...t)},error:function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return console.error(_,...t)}};function O(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}function P(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?O(Object(a),!0).forEach(function(t){s(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):O(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var A=function(e,t,a){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"not found";return!!e.mappedDatasets[t]||(S.error("".concat(a,": Dataset with id '").concat(t,"' ").concat(r)),!1)},E=0,I=(e,t,a)=>(E=a.actionsArray.length?E+1:0,P(P({},a),{},{actionsArray:[...a.actionsArray,{method:e,parameters:t,actionId:E}]})),M={SET_DATASETS:(e,t)=>{var{mappedDatasets:a,orderedDatasets:r}=t;return P(P({},e),{},{mappedDatasets:a,orderedDatasets:r})},ADD_DATASET:(e,t)=>{var{dataset:a,mapStyle:r}=t;if(e.mappedDatasets[a.id])return S.error("addDataset: Dataset with id '".concat(a.id,"' already exists")),e;var{mappedDatasets:i,orderedDatasets:s}=D({datasets:[a]}),n=((e,t)=>{var a=[...e.menu],r=d({datasets:[t]}),i=a.find(e=>e.groupLabel===r[0].groupLabel);return i?i.items.push(...r[0].items):a.push(...r),a})(e,a);return I("addDataset",[a.id,r],P(P({},e),{},{mappedDatasets:P(P({},e.mappedDatasets),i),orderedDatasets:[...e.orderedDatasets,...s],menu:n}))},REMOVE_DATASET:(e,t)=>{var a,{id:r}=t;if(!A(e,r,"removeDataset"))return e;var i=P({},e.mappedDatasets),s=[r,...(null===(a=i[r])||void 0===a?void 0:a.sublayerIds)||[]];s.forEach(e=>delete i[e]);var n=e.orderedDatasets.filter(e=>!s.includes(e));return P(P({},e),{},{mappedDatasets:i,orderedDatasets:n,menu:p(e.menu,s)})},SET_DATASET_VISIBILITY:(e,t)=>{var{datasetId:a,visible:r}=t;return A(e,a,"setDatasetVisibility")?e.mappedDatasets[a].visible===r?e:I("applyDatasetVisibility",[a,r],P(P({},e),{},{mappedDatasets:P(P({},e.mappedDatasets),{},{[a]:P(P({},e.mappedDatasets[a]),{},{visible:r})})})):e},SET_GLOBAL_VISIBILITY:(e,t)=>{var{visible:a}=t;return I("applyGlobalVisibility",[a],P(P({},e),{},{globals:P(P({},e.globals),{},{visible:a})}))},SET_DATASET_STYLE:(e,t)=>{var{datasetId:a,styleChanges:r,mapStyle:i}=t;if(!A(e,a,"setDatasetStyle"))return e;var s=P(P({},e.mappedDatasets[a].style),r),n=P(P(P({},e.mappedDatasets[a]),r),{},{style:s});return I("applyStyle",[a,i],P(P({},e),{},{mappedDatasets:P(P({},e.mappedDatasets),{},{[a]:n})}))},SET_OPACITY:(e,t)=>{var{datasetId:a,opacity:r}=t;if(!A(e,a,"setOpacity"))return e;var i=P(P({},e.mappedDatasets[a].style),{},{opacity:r}),s=P(P({},e.mappedDatasets[a]),{},{style:i});return I("applyDatasetOpacity",[a],P(P({},e),{},{mappedDatasets:P(P({},e.mappedDatasets),{},{[a]:s})}))},SET_GLOBAL_OPACITY:(e,t)=>{var{opacity:a}=t;return I("applyGlobalOpacity",[],P(P({},e),{},{globals:P(P({},e.globals),{},{opacity:a})}))},HIDE_FEATURES:(e,t)=>{var{datasetId:a,featureIds:r}=t;if(!A(e,a,"setFeatureVisibility - hideFeatures"))return e;var i=P({},e.mappedDatasets[a]),s=i.hiddenFeatures||[],n=Array.from(new Set([...s,...r]));return i.hiddenFeatures=n,I("applyFeatureFilter",[a],P(P({},e),{},{mappedDatasets:P(P({},e.mappedDatasets),{},{[a]:i})}))},SHOW_FEATURES:(e,t)=>{var{datasetId:a,featureIds:r}=t;if(!A(e,a,"setFeatureVisibility - showFeatures"))return e;var i=P({},e.mappedDatasets[a]),s=(i.hiddenFeatures||[]).filter(e=>!r.includes(e));return i.hiddenFeatures=s.length?s:[-1],I("applyFeatureFilter",[a],P(P({},e),{},{mappedDatasets:P(P({},e.mappedDatasets),{},{[a]:i})}))},REMOVE_ADAPTER_ACTIONS:(e,t)=>null!=t&&t.length?P(P({},e),{},{actionsArray:e.actionsArray.filter(e=>!t.includes(e))}):e,SET_GLOBAL_STATE:(e,t)=>I("applyGlobalOpacity",[],P(P({},e),{},{globals:P(P({},e.globals),t)})),SET_MENU:(e,t)=>{var{menu:a}=t;return P(P({},e),{},{menu:a})}},T={APP_ADD_MARKER:"app:addmarker",APP_UPDATE_MARKER:"app:updatemarker",APP_REMOVE_MARKER:"app:removemarker",APP_ADD_BUTTON:"app:addbutton",APP_TOGGLE_BUTTON_STATE:"app:togglebuttonstate",APP_ADD_PANEL:"app:addpanel",APP_REMOVE_PANEL:"app:removepanel",APP_SHOW_PANEL:"app:showpanel",APP_HIDE_PANEL:"app:hidepanel",APP_ADD_CONTROL:"app:addcontrol",APP_SET_APPLICATION_MODE:"app:setapplicationmode",APP_CLEAR_APPLICATION_MODE:"app:clearapplicationmode",APP_SHOW_HINT:"app:showhint",APP_DISMISS_HINT:"app:dismisshint",APP_READY:"app:ready",APP_OPENED:"app:opened",APP_CLOSED:"app:closed",APP_FULLSCREEN_CHANGE:"app:fullscreenchange",APP_PANEL_OPENED:"app:panelopened",APP_PANEL_CLOSED:"app:panelclosed",MAP_SET_STYLE:"map:setstyle",MAP_SET_SIZE:"map:setsize",MAP_SET_SPATIAL_LIST:"map:setspatiallist",MAP_SET_SPATIAL_LIST_SUPPRESSED:"map:setspatiallistsuppressed",MAP_SET_ACTIVE_ITEM:"map:setactiveitem",MAP_SELECT_ITEM:"map:selectitem",MAP_SET_PIXEL_RATIO:"map:setpixelratio",MAP_FIT_TO_BOUNDS:"map:fittobounds",MAP_SET_VIEW:"map:setview",MAP_INIT_MAP_STYLES:"map:initmapstyles",MAP_STYLE_CHANGE:"map:stylechange",MAP_LOADED:"map:loaded",MAP_READY:"map:ready",MAP_SIZE_CHANGE:"map:sizechange",MAP_FIRST_IDLE:"map:firstidle",MAP_MOVE_START:"map:movestart",MAP_MOVE:"map:move",MAP_MOVE_END:"map:moveend",MAP_STATE_UPDATED:"map:stateupdated",MAP_DATA_CHANGE:"map:datachange",MAP_RENDER:"map:render",MAP_CLICK:"map:click",MAP_DESTROY:"map:destroy"},w=function(){var e=n(function*(e,t,a,r){var i=a(e,t),s="string"==typeof i?{url:i}:i,{url:n,headers:o={}}=s,l=yield fetch(n,{headers:o,signal:r});if(!l.ok)throw new Error("Failed to fetch GeoJSON: ".concat(l.status," ").concat(l.statusText));var d=yield l.json();if("FeatureCollection"===d.type)return d;if("Feature"===d.type)return{type:"FeatureCollection",features:[d]};if(Array.isArray(d))return{type:"FeatureCollection",features:d};throw new Error("Invalid GeoJSON response")});return function(t,a,r,i){return e.apply(this,arguments)}}(),C=(e,t)=>!(!e||!t)&&!(e[2]<t[0]||e[0]>t[2]||e[3]<t[1]||e[1]>t[3]),L=e=>{var t=1/0,a=1/0,r=-1/0,i=-1/0,s=(e,n)=>{var o;0===n?(o=e,t=Math.min(t,o[0]),a=Math.min(a,o[1]),r=Math.max(r,o[0]),i=Math.max(i,o[1])):e.forEach(e=>s(e,n-1))};switch(e.type){case"Point":s(e.coordinates,0);break;case"LineString":case"MultiPoint":s(e.coordinates,1);break;case"Polygon":case"MultiLineString":s(e.coordinates,2);break;case"MultiPolygon":s(e.coordinates,3);break;case"GeometryCollection":e.geometries.forEach(e=>{var s=L(e);t=Math.min(t,s[0]),a=Math.min(a,s[1]),r=Math.max(r,s[2]),i=Math.max(i,s[3])});break;default:throw new Error("Unsupported geometry type: ".concat(e.type))}return[t,a,r,i]},j=e=>({type:"FeatureCollection",features:Array.from(e.values()).map(e=>e.feature)}),k=function(){var e=n(function*(e,t){var{mapProvider:a,dynamicGeoJSON:r,onUpdate:i}=t,{url:s,idProperty:n,transformRequest:o,maxFeatures:l,minZoom:d=0}=r,p=a.getZoom();if(!(p<d)){var u=(e=>e.getBounds())(a);if(!(e.fetchedBbox&&(c=e.fetchedBbox,y=u,c&&y&&y[0]>=c[0]&&y[1]>=c[1]&&y[2]<=c[2]&&y[3]<=c[3]))){var c,y,h,v;e.currentController&&e.currentController.abort(),e.currentController=new AbortController;try{var b={bbox:u,zoom:p},m=yield w(s,b,o,e.currentController.signal);((e,t,a)=>{var r=Date.now();t.features.forEach(t=>{var i=((e,t)=>{var a,r;return t&&null!==(a=null===(r=e.properties)||void 0===r?void 0:r[t])&&void 0!==a?a:e.id})(t,a);null!=i?e.set(i,{feature:t,bbox:L(t.geometry),lastSeenAt:r}):console.warn("Feature missing ID, skipping:",t)})})(e.features,m,n),e.fetchedBbox=(h=e.fetchedBbox,v=u,h?[Math.min(h[0],v[0]),Math.min(h[1],v[1]),Math.max(h[2],v[2]),Math.max(h[3],v[3])]:[...v]);var f=e.features.size;((e,t,a)=>{if(a&&!(e.size<=1.2*a)){var r=a,i=[],s=[];for(var[n,o]of e)C(o.bbox,t)?i.push(n):s.push({id:n,lastSeenAt:o.lastSeenAt});s.sort((e,t)=>e.lastSeenAt-t.lastSeenAt);for(var l=e.size-r,d=0;d<l&&d<s.length;d++)e.delete(s[d].id);if(e.size>r)for(var p=e.size-r,u=i.map(t=>({id:t,lastSeenAt:e.get(t).lastSeenAt})).sort((e,t)=>e.lastSeenAt-t.lastSeenAt),c=0;c<p&&c<u.length;c++)e.delete(u[c].id)}})(e.features,u,l),e.features.size<f&&(e.fetchedBbox=u),i(r.id,j(e.features))}catch(e){if("AbortError"===e.name)return;console.error("Failed to fetch dynamic GeoJSON for ".concat(r.id,":"),e)}}}});return function(t,a){return e.apply(this,arguments)}}(),N=e=>{var t,a,r,i,{dynamicGeoJSON:s,mapProvider:n,onUpdate:o}=e,l={features:new Map,fetchedBbox:null,currentController:null},d=()=>k(l,{mapProvider:n,dynamicGeoJSON:s,onUpdate:o}),p=(t=d,a=200,(i=function(){for(var e=arguments.length,i=new Array(e),s=0;s<e;s++)i[s]=arguments[s];clearTimeout(r),r=setTimeout(()=>t(...i),a)}).cancel=()=>{clearTimeout(r),r=null},i),u=()=>{p()};return n.map.on("moveend",u),d(),{destroy(){var e,t;e=n.map,t=u,(e.off||e.un).call(e,"moveend",t),p.cancel(),l.currentController&&l.currentController.abort()},clear(){l.features.clear(),l.fetchedBbox=null,o(s.id,{type:"FeatureCollection",features:[]})},refresh(){l.features.clear(),l.fetchedBbox=null,d()},getFeatureCount:()=>l.features.size,reapply(){l.features.size>0&&o(s.id,j(l.features))}}},F={},G=e=>{F=e},x=e=>{var t,a=(null===(t=F)||void 0===t||null===(t=t.current)||void 0===t?void 0:t.menuState)||{};for(var[r,i]of Object.entries(e)){var s=a[r];if(!i.includes(s))return!1}return!0},B=e=>(Array.isArray(e)?e:[e]).includes(R()),R=()=>Q.mapStyle.id;function V(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}class W{constructor(e){this.id=e.id,this.url=e.url,this.transformRequest=e.transformRequest,this.maxFeatures=e.maxFeatures,this.minZoom=e.minZoom,this.idProperty=e.idProperty,this.hiddenFeaturesIdExpression=["to-string",["get",this.idProperty]],this.sourceId="geojson-dynamic-".concat(this.id),this.source=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?V(Object(a),!0).forEach(function(t){s(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):V(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}({type:"geojson",data:{type:"FeatureCollection",features:[]}},this.idProperty?{promoteId:this.idProperty}:{generateId:!0})}}var H={},K=(e,t)=>{switch(H.opacityMode){case"global":return H.opacity;case"multiply":return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Math.round(100*(e*t*H.opacity+Number.EPSILON))/100}(e,t);default:return((e,t)=>void 0===e?void 0===t?H.opacity:t:e)(e,t)}},U=()=>H.visible;function Z(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}function z(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(a),!0).forEach(function(t){s(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Z(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}class Y{constructor(e){this._datasetDefinition=e}get id(){return this._datasetDefinition.id}get label(){return this._datasetDefinition.label}get hasSymbol(){return!this.hasSublayers&&!!(null!=(e=this.style)&&e.symbol||null!=e&&e.symbolSvgContent);var e}get hasPattern(){return!(this.hasSublayers||this.hasSymbol||(e=this.style,!e.fillPattern&&!e.fillPatternSvgContent));var e}get hasFill(){var e,t;return!this.hasSublayers&&!this.hasSymbol&&(this.hasPattern||(null===(e=this.style)||void 0===e?void 0:e.fill)&&"transparent"!==(null===(t=this.style)||void 0===t?void 0:t.fill))}get hasStroke(){var e;return!this.hasSublayers&&!this.hasSymbol&&Boolean(null===(e=this.style)||void 0===e?void 0:e.stroke)}get tiles(){return this._datasetDefinition.tiles}get geojson(){return this._datasetDefinition.geojson}get idProperty(){return this._datasetDefinition.idProperty}get generateIds(){return this._datasetDefinition.generateIds}get parentId(){return this._datasetDefinition.parentId}get minZoom(){var e;return this._datasetDefinition.minZoom||(null===(e=this.parent)||void 0===e?void 0:e.minZoom)}get maxZoom(){var e;return this._datasetDefinition.maxZoom||(null===(e=this.parent)||void 0===e?void 0:e.maxZoom)}get type(){var e;return this._datasetDefinition.type||(null===(e=this.parent)||void 0===e?void 0:e.type)}get showInKey(){var e,t,a=this._datasetDefinition.showInKey;return void 0!==a?a:null!==(e=null===(t=this.parent)||void 0===t?void 0:t.showInKey)&&void 0!==e&&e}get visibleWhen(){var e;return void 0===this._datasetDefinition.visibleWhen?null===(e=this.parent)||void 0===e?void 0:e.visibleWhen:this._datasetDefinition.visibleWhen}get groupLabel(){var e,t;return this._datasetDefinition.groupLabel||(null===(e=this.parent)||void 0===e?void 0:e.groupLabel)||(null===(t=this.parent)||void 0===t?void 0:t.label)}get groupId(){var e,t=this._datasetDefinition.groupId||(null===(e=this.parent)||void 0===e?void 0:e.groupId);return t||(this.groupLabel?this.groupLabel.toLowerCase().replace(/\s+/g,"-"):null)}get opacity(){var e,t,a=null===(e=this.style)||void 0===e?void 0:e.opacity,r=null===(t=this.parent)||void 0===t||null===(t=t.style)||void 0===t?void 0:t.opacity;return K(a,r)}get hasDynamicGeoJSON(){return Boolean(this._datasetDefinition.dynamicGeoJSON)}get dynamicGeoJSON(){return new W(z(z({},this._datasetDefinition.dynamicGeoJSON),{},{id:this.id,minZoom:this.minZoom}))}get hiddenFeatures(){return this._datasetDefinition.hiddenFeatures}get hasHiddenFeatures(){var e,t;return Boolean((null===(e=this.hiddenFeatures)||void 0===e?void 0:e.length)>0||(null===(t=this.parent)||void 0===t?void 0:t.hasHiddenFeatures))}get filter(){return null}get isHiddenByInheritance(){var e;return this.isSublayer?!(null!==(e=this.parent)&&void 0!==e&&e.visible):!U()}get isLocallyVisible(){return!!this.isVisible||this._datasetDefinition.visible}get visible(){var e;return this.isSublayer?this._datasetDefinition.visible&&(null===(e=this.parent)||void 0===e?void 0:e.visible):this._datasetDefinition.visible&&U()}get esriStyleLayerId(){return this._datasetDefinition.esriStyleLayerId}get visibility(){var{visible:e,visibleWhen:t}=this;return e&&t?(e=>{if(null==e)return!0;if("boolean"==typeof e)return e;if("object"==typeof e){for(var[t,a]of Object.entries(e)){if("mapStyleId"===t&&!B(a))return!1;if("menu"===t&&!x(a))return!1}return!0}return!0})(t)?"visible":"none":e?"visible":"none"}get keyVisibility(){return this.showInKey&&"visible"===this.visibility}get symbolAnchor(){var e,t;return null!==(e=this.style)&&void 0!==e&&e.symbolAnchor?this.style.symbolAnchor:null===(t=this.parent)||void 0===t?void 0:t.symbolAnchor}get sourceLayer(){return this.isSublayer?this.parent.sourceLayer:this.tiles?this._datasetDefinition.sourceLayer:void 0}get isSublayer(){return Boolean(this._datasetDefinition.parentId)}get hasSublayers(){var e;return(null===(e=this._datasetDefinition.sublayerIds)||void 0===e?void 0:e.length)>0}get sublayerIds(){return this._datasetDefinition.sublayerIds}get sublayers(){var{sublayerIds:e}=this;return e?e.map(e=>Q.getDataset(e)):[]}get parent(){if(this._datasetDefinition.parentId)return Q.getDataset(this._datasetDefinition.parentId)}get inheritedStyle(){var e=this._datasetDefinition.style||{},t=this.parent;return t?z(z({},t.inheritedStyle),{},{opacity:void 0},e):e}get style(){return z(z({},function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return b(e)?c({strokeWidth:y.style.strokeWidth},e):c(c({},y.style),e)}(this.inheritedStyle)),{},{symbolDescription:this.symbolDescription})}get hasCustomVisualStyle(){return b(this._datasetDefinition.style||{})}get symbolDescription(){var e;return null!==(e=this._datasetDefinition.style)&&void 0!==e&&e.symbolDescription?this._datasetDefinition.style.symbolDescription:this.hasCustomVisualStyle?void 0:this.parent?this.parent.symbolDescription:y.style.symbolDescription}get patternConfigs(){var e=this.hasPattern?[this.style]:[];return this.hasSublayers?[...e,...this.sublayers.flatMap(e=>e.patternConfigs)]:e}get symbolConfigs(){var e=this.hasSymbol?[this.style]:[];return this.hasSublayers?[...e,...this.sublayers.flatMap(e=>e.symbolConfigs)]:e}get keyDefinition(){return{id:this.id,type:"dataset",label:this.label,hasSymbol:this.hasSymbol,hasPattern:this.hasPattern,style:this.style,symbolDescription:this.symbolDescription}}}class J{constructor(){this.idToDefinitionMap=new Map,this.definitionToInstanceMap=new Map}add(e){this.idToDefinitionMap.set(e.id,e._datasetDefinition),this.definitionToInstanceMap.set(e._datasetDefinition,e)}invalidateDataset(e){var t=this.idToDefinitionMap.get(e.id);[t.id,...(null==t?void 0:t.sublayerIds)||[]].forEach(e=>{var t=this.idToDefinitionMap.get(e);this.definitionToInstanceMap.delete(t),this.idToDefinitionMap.delete(e)})}invalidateChangedDatasets(e){e.forEach(e=>{var t=this.idToDefinitionMap.get(e.id);if(t&&t!==e){var a=this.definitionToInstanceMap.get(t);this.invalidateDataset(a.isSublayer&&a.parent?a.parent:a)}})}getByDefinition(e){return this.definitionToInstanceMap.get(e)}}function q(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}function X(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?q(Object(a),!0).forEach(function(t){s(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):q(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var Q={attach(e,t,a){this._datasets=e,this._orderedDatasets=t,this.attachMapStyle(a),this._invalidateChangedDatasets()},_definitionCache:new J,_invalidateCache(){this._definitionCache=new J},_invalidateChangedDatasets(){this._datasets?this._definitionCache.invalidateChangedDatasets(Object.values(this._datasets)):this._invalidateCache()},attachCreateDataset(e){this._createDataset=e},_createDataset:e=>(e=>new Y(e))(e),attachMapStyle(e){e&&(this._mapStyle=e)},get mapStyle(){return this._mapStyle},getDataset(e){var t=this.datasets[e];if(t){var a=this._definitionCache.getByDefinition(t);if(a)return a;var r=this._createDataset(t);return this._definitionCache.add(r),r.isSublayer&&this.getDataset(r.parentId),r}},forEach(e){this._orderedDatasets.forEach(t=>e(this.getDataset(t)))},forEachDataset(e){Object.values(this.datasets).filter(e=>!e.parentId).forEach(t=>e(this.getDataset(t.id)))},topLevelDatasets(){return Object.values(this.datasets).filter(e=>!e.parentId).map(e=>this.getDataset(e.id))},getPatternAndSymbolConfigs(){return this.topLevelDatasets().reduce((e,t)=>X(X({},e),{},{patternConfigs:[...e.patternConfigs,...t.patternConfigs],symbolConfigs:[...e.symbolConfigs,...t.symbolConfigs]}),{patternConfigs:[],symbolConfigs:[]})},_lastMenuState:{},invalidateKeyItemsOnMenuStateChange(e){e!==this._lastMenuState&&(this._lastMenuState=e,this._lastKeyItemsDatasets=null)},_lastKeyItems:{},keyItems(){if(this.datasets===this._lastKeyItemsDatasets)return this._lastKeyItems;this._lastKeyItemsDatasets=this.datasets;var e=[],t=new Map;this.forEach(a=>{if(a.keyVisibility)if(a.hasSublayers||a.groupId||a.groupLabel){var r=a.groupId,i=((a,r)=>{if(t.has(r))return t.get(r);var i={type:"group",id:r,groupLabel:a,keyDefinitions:[]};return t.set(r,i),e.push(i),i})(a.groupLabel||r||a.label,r);a.hasSublayers||i.keyDefinitions.push(a.keyDefinition)}else e.push({type:"flat",id:a.id,keyDefinition:a.keyDefinition})});var a=e.filter(e=>{var t;return"flat"===e.type||Boolean(null===(t=e.keyDefinitions)||void 0===t?void 0:t.length)}),r=a.some(e=>"group"===e.type);return this._lastKeyItems={items:a,hasGroups:r},this._lastKeyItems}};Object.defineProperty(Q,"datasets",{get:()=>Q._datasets});var $,ee=function(){var e=n(function*(e){switch(e.name){case"MapLibreProvider":var{default:t}=yield import(/* webpackChunkName: "im-datasets-ml-adapter" */ "./im-datasets-ml-adapter.js");return t;case"EsriProvider":var{default:a}=yield import(/* webpackChunkName: "im-datasets-esri-adapter" */ "./im-datasets-esri-adapter.js");return a;case"OpenLayersProvider":var{default:r}=yield import(/* webpackChunkName: "im-datasets-ol-adapter" */ "./im-datasets-ol-adapter.js");return r;default:throw new Error("No layer adapter available for map provider ".concat(e.name,". Please provide a compatible layer adapter."))}});return function(t){return e.apply(this,arguments)}}(),te={},ae=function(){var e=n(function*(e,t,a){var r,i,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=yield ee(e);return $=new n(e,t,a,s),te.removeDataset=$.removeDataset.bind($),te.setData=$.setData.bind($),te.applyStyle=$.applyStyle.bind($),te.applyDatasetVisibility=$.applyDatasetVisibility.bind($),te.applyGlobalVisibility=$.applyGlobalVisibility.bind($),te.applyDatasetOpacity=$.applyDatasetOpacity.bind($),te.applyGlobalOpacity=$.applyGlobalOpacity.bind($),te.addDataset=$.addDataset.bind($),te.applyFeatureFilter=$.applyFeatureFilter.bind($),te.onMapStyleChange=null===(r=$.onMapStyleChange)||void 0===r?void 0:r.bind($),te.onMapSizeChange=null===(i=$.onMapSizeChange)||void 0===i?void 0:i.bind($),$});return function(t,a,r){return e.apply(this,arguments)}}();var re=function(e,t){var{pluginState:{dispatch:a}}=e,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{datasetId:i,sublayerId:s}=r,n=s?"".concat(i,"-").concat(s):i;a(n?{type:"SET_DATASET_VISIBILITY",payload:{datasetId:n,visible:t}}:{type:"SET_GLOBAL_VISIBILITY",payload:{visible:t}})},ie=e=>{var{menuGroupItem:t,onChange:i}=e,s=Q.getDataset(t.id);if(!s)return null;var n=s.isSublayer?s.parentId:s.id,o=s.isSublayer?s.id:void 0,l="im-c-datasets-layers__item govuk-checkboxes govuk-checkboxes--small".concat(s.visible?"":" im-c-datasets-layers__item--checked");return a("div",{className:l,"data-module":"govuk-checkboxes",children:r("div",{className:"govuk-checkboxes__item",children:[a("input",{className:"govuk-checkboxes__input",id:s.id,"data-dataset-id":n,"data-sublayer-id":o,name:"layers",type:"checkbox",value:s.id,checked:s.isLocallyVisible,onChange:i}),a("label",{className:"im-c-datasets-layers__item-label govuk-label govuk-checkboxes__label",htmlFor:s.id,children:s.label})]})},s.id)},se=e=>{var{menuGroup:t,children:s}=e;if(!t.groupLabel)return a(i,{children:s});return a("div",{className:"govuk-form-group im-c-datasets-layers-group",children:r("fieldset",{className:"im-c-datasets-layers-group__fieldset",children:[a("legend",{className:"im-c-datasets-layers-group__legend",children:a("h3",{children:t.groupLabel})}),s]})},t.id)},ne={InitComponent:function(a){var{pluginConfig:r,pluginState:i,mapState:s,mapProvider:o,services:l}=a,{dispatch:p}=i,{eventBus:u,symbolRegistry:c,patternRegistry:y}=l,h=Boolean(null==o?void 0:o.isBaseMapReady());e(()=>{var e=!1!==r.hasMenu&&(e=>e.datasets.some(e=>{var t;return e.showInMenu||(null===(t=e.sublayers)||void 0===t?void 0:t.some(e=>e.showInMenu))}))(r);e||(u.emitWhenReady(T.APP_REMOVE_PANEL,"datasetsLayers"),u.emitWhenReady(T.APP_TOGGLE_BUTTON_STATE,{id:"datasetsLayers",prop:"hidden",value:!0}))},[r.hasMenu]),t(i).current=i;var v=t(null);return e(()=>{if(h&&!v.current){var e=function(){var e=n(function*(){var e=yield ae(o,c,y);v.current=(e=>{var{adapter:t,pluginConfig:a,mapStyle:r,mapProvider:i,events:s,dispatch:n,eventBus:o}=e,{datasets:l}=a,p=new Map;a.globals&&n({type:"SET_GLOBAL_STATE",payload:a.globals});var{mappedDatasets:u,orderedDatasets:c}=D({datasets:l});t.createDataset&&Q.attachCreateDataset(t.createDataset),Q.attach(u,c,r);var y=d({datasets:l});o.requestOnce("menu:state",G),n({type:"SET_MENU",payload:{menu:y}}),n({type:"SET_DATASETS",payload:{mappedDatasets:u,orderedDatasets:c}}),t.init().then(()=>{Q.forEachDataset(e=>{if(e.hasDynamicGeoJSON){var{dynamicGeoJSON:a}=e,r=N({dynamicGeoJSON:a,mapProvider:i,onUpdate:(e,a)=>t.setData(e,a)});p.set(e.id,r)}}),t.attachDynamicSources(p),o.emit("datasets:ready")});var h=()=>{t.onMapSizeChange()};o.on(s.MAP_SIZE_CHANGE,h);var v=o.emitWhenRequested("datasets:registry",Q);return o.on("menu:changed",e=>{Q.invalidateKeyItemsOnMenuStateChange(e),t.applyGlobalVisibility()}),{remove(){o.off(s.MAP_SIZE_CHANGE,h),v(),p.forEach(e=>e.destroy()),p.clear(),t.destroy()},refreshDataset(e){var t;null===(t=p.get(e))||void 0===t||t.refresh()},clearDatasetCache(e){var t;null===(t=p.get(e))||void 0===t||t.clear()},getFeatureCount(e){var t,a;return null!==(t=null===(a=p.get(e))||void 0===a?void 0:a.getFeatureCount())&&void 0!==t?t:null}}})({adapter:e,pluginConfig:r,mapStyle:s.mapStyle,mapProvider:o,events:T,dispatch:p,eventBus:u})});return function(){return e.apply(this,arguments)}}();e()}},[h]),e(()=>{Q.attach(i.mappedDatasets,i.orderedDatasets),u.emit("datasets:changed")},[i.mappedDatasets,i.orderedDatasets]),e(()=>{Q.attachMapStyle(s.mapStyle),null!=te&&te.onMapStyleChange&&Promise.resolve(te.onMapStyleChange()).then(()=>{u.emit(T.MAP_DATA_CHANGE)})},[s.mapStyle]),e(()=>{return e=i.globals,void(H=e);var e},[i.globals]),e(()=>{var{actionsArray:e}=i;e.length&&(e.forEach(e=>{var{method:t,parameters:a}=e;return te[t](...a)}),p({type:"REMOVE_ADAPTER_ACTIONS",payload:e}))},[i.actionsArray]),e(()=>()=>{v.current&&(v.current.remove(),v.current=null)},[]),null},reducer:{initialState:{globals:{visible:!0,opacity:1,opacityMode:"dataset"},key:{items:[],hasGroups:!1},mappedDatasets:{},orderedDatasets:[],actionsArray:[],menu:[]},actions:M},panels:[{id:"datasetsLayers",label:"Layers",mobile:{slot:"drawer",modal:!0,dismissible:!0},tablet:{slot:"left-top",dismissible:!0,exclusive:!0,width:"260px"},desktop:{slot:"left-top",modal:!1,dismissible:!0,exclusive:!0,width:"280px"},render:e=>{var{pluginState:t}=e,{menu:i=[]}=t,s=e=>{var{value:a,checked:r}=e.target;re({pluginState:t},r,{datasetId:a})},n=i.some(e=>e.groupLabel),o="im-c-datasets-layers".concat(n?" im-c-datasets-layers--has-groups":"");return a("div",{className:o,children:i.map(e=>r(se,{menuGroup:e,children:[" ",e.items.map(e=>a(ie,{menuGroupItem:e,onChange:s},e.id))]},e.id))})}}],buttons:[{id:"datasetsLayers",label:"Layers",panelId:"datasetsLayers",iconId:"layers",mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"layers",svgContent:'<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"></path><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"></path><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"></path>'},{id:"key",svgContent:'<path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/>'}],api:{addDataset:(e,t)=>{var{pluginState:{dispatch:a},mapState:r}=e;a({type:"ADD_DATASET",payload:{dataset:t,mapStyle:r.mapStyle}})},removeDataset:(e,t)=>{var{pluginState:{dispatch:a}}=e;te.removeDataset(t),a({type:"REMOVE_DATASET",payload:{id:t}})},setDatasetVisibility:re,setFeatureVisibility:function(e,t,a){var{pluginState:{dispatch:r}}=e,{datasetId:i=null}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(i){var s=Q.getDataset(i);!s||s.idProperty||s.generateIds||S.warn('setFeatureVisibility: Dataset "'.concat(i,'" has no idProperty or generateIds configured. Features may not be matched correctly. Add idProperty to match by a feature property, or add generateIds: true to use auto-generated IDs.'))}r({type:t?"SHOW_FEATURES":"HIDE_FEATURES",payload:{datasetId:i,featureIds:a}})},setStyle:function(e,t){var{pluginState:{dispatch:a},mapState:r}=e,{datasetId:i,sublayerId:s}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};a({type:"SET_DATASET_STYLE",payload:{datasetId:i=s?"".concat(i,"-").concat(s):i,styleChanges:t,mapStyle:r.mapStyle}})},getStyle:function(e){var{_pluginState:t}=e,{datasetId:a,sublayerId:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a=r?"".concat(a,"-").concat(r):a;var i=Q.getDataset(a);return i?i.style:(S.warn("getStyle: Dataset with id ".concat(a," not found")),null)},setOpacity:function(e,t){var{pluginState:{dispatch:a}}=e,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{datasetId:i,sublayerId:s}=r,n=s?"".concat(i,"-").concat(s):i;a(n?{type:"SET_OPACITY",payload:{datasetId:n,opacity:t}}:{type:"SET_GLOBAL_OPACITY",payload:{opacity:t}})},getOpacity:function(e){var t,{pluginState:{globals:a}}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{datasetId:i,sublayerId:s}=r,n=s?"".concat(i,"-").concat(s):i;if(n){var o,l=Q.getDataset(n);return l?null!==(o=l.opacity)&&void 0!==o?o:null:(S.warn("getOpacity: Dataset with id ".concat(n," not found")),null)}return null!==(t=a.opacity)&&void 0!==t?t:null},setData:(e,t,a)=>{var{_pluginState:r}=e,{datasetId:i}=a,s=Q.getDataset(i);s?null!=s&&s.tiles?S.warn('setData called on vector tile dataset "'.concat(i,'" — has no effect')):te.setData(i,t):S.warn("setData: Dataset with id ".concat(i," not found"))},setGlobals:(e,t)=>{var{pluginState:{dispatch:a}}=e,{opacityMode:r}=t,i={},s=!1;r&&(["dataset","global","multiply"].includes(r)?(s=!0,i.opacityMode=r):S.warn("Ignoring invalid opacityMode: ".concat(r,". Must be one of 'dataset', 'global' or 'multiply'."))),s?a({type:"SET_GLOBAL_STATE",payload:i}):S.warn("setGlobals: requires a valid value for opacityMode to be set")}}},oe=Object.freeze({__proto__:null,manifest:ne});export{Y as D,Q as d,S as l,oe as m};
|
|
1
|
+
import{useEffect as e,useRef as t}from"preact/compat";import{jsx as a,jsxs as s,Fragment as i}from"preact/jsx-runtime";const r=e=>{const{datasets:t=[]}=e,a=[],s=t.filter(e=>e.showInMenu||e.sublayers?.some(e=>e.showInMenu)),i=new Map;return s.forEach(e=>{if(e.sublayers?.length){const t=e.sublayers.filter(t=>e.showInMenu?!1!==t.showInMenu:t.showInMenu);if(!1===e.showInMenu&&!t.length)return;const s={id:e.id,groupLabel:e.label,visibleWhen:!0,type:"checkbox",items:t.map(t=>({id:`${e.id}-${t.id}`,label:t.label}))};0===s.items.length&&(delete s.groupLabel,s.items.push({id:e.id,label:e.label})),a.push(s)}else if(e.groupLabel){const t=i.has(e.groupLabel)?i.get(e.groupLabel):{id:e.groupLabel,groupLabel:e.groupLabel,visibleWhen:!0,type:"checkbox",items:[]};i.has(e.groupLabel)||(i.set(e.groupLabel,t),a.push(t)),t.items.push({id:e.id,label:e.label})}else a.push({visibleWhen:!0,type:"checkbox",id:e.id,items:[{id:e.id,label:e.label}]})}),a},n=(e,t)=>e.reduce((e,a)=>{const s=a.items.filter(e=>!t.includes(e.id));return s.length&&e.push({...a,items:s}),e},[]),o={minZoom:6,maxZoom:24,showInKey:!1,showInMenu:!1,visible:!0,style:{stroke:"#d4351c",strokeWidth:2,symbolDescription:"red outline"}},l=["stroke","strokeWidth","strokeDashArray","fill","fillPattern","fillPatternSvgContent","fillPatternForegroundColor","fillPatternBackgroundColor","opacity","symbolDescription","symbol","symbolSvgContent","symbolViewBox","symbolAnchor","symbolSize","symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"],d=["stroke","fill","fillPattern","fillPatternSvgContent","symbol","symbolSvgContent"],p=e=>d.some(t=>t in e),u=(e={})=>p(e)?{strokeWidth:o.style.strokeWidth,...e}:{...o.style,...e},h=(e,t)=>{const{id:a}=t,s=(e=>{!0!==e.visible&&!1!==e.visible&&(e.visible="hidden"!==e.visibility);const t={...o,...e,style:{...e.style}};return l.forEach(e=>delete t[e]),t})(t);t.parentId&&("showInKey"in t||delete s.showInKey,"showInMenu"in t||delete s.showInMenu),e[a]=s;const{orderedDatasets:i}=e;i.push(a);const r=t.sublayers?.map(e=>((e,t)=>{const a=`${e}-${t.id}`,s=t.id;return"hidden"!==t.visibility&&(t.visibility="visible"),{...t,id:a,parentId:e,sublayerId:s}})(a,e));if(r?.length){const t=r?.map(e=>e.id),s=r?.reduce(h,{orderedDatasets:i});return e[a].sublayerIds=t,delete e[a].sublayers,{...e,...s,orderedDatasets:i}}return{...e,orderedDatasets:i}},c=e=>{const t=(e.datasets||[]).reduce(h,{orderedDatasets:[]}),{orderedDatasets:a}=t;return delete t.orderedDatasets,{...e,mappedDatasets:t,orderedDatasets:a}},y="[interactive-map]",m={warn:(...e)=>console.warn(y,...e),error:(...e)=>console.error(y,...e)},b=(e,t,a,s="not found")=>!!e.mappedDatasets[t]||(m.error(`${a}: Dataset with id '${t}' ${s}`),!1);let g=0;const f=(e,t,a)=>(g=a.actionsArray.length?g+1:0,{...a,actionsArray:[...a.actionsArray,{method:e,parameters:t,actionId:g}]}),D={SET_DATASETS:(e,t)=>{const{mappedDatasets:a,orderedDatasets:s}=t;return{...e,mappedDatasets:a,orderedDatasets:s}},ADD_DATASET:(e,t)=>{const{dataset:a,mapStyle:s}=t;if(e.mappedDatasets[a.id])return m.error(`addDataset: Dataset with id '${a.id}' already exists`),e;const{mappedDatasets:i,orderedDatasets:n}=c({datasets:[a]}),o=((e,t)=>{const a=[...e.menu],s=r({datasets:[t]}),i=a.find(e=>e.groupLabel===s[0].groupLabel);return i?i.items.push(...s[0].items):a.push(...s),a})(e,a);return f("addDataset",[a.id,s],{...e,mappedDatasets:{...e.mappedDatasets,...i},orderedDatasets:[...e.orderedDatasets,...n],menu:o})},REMOVE_DATASET:(e,t)=>{const{id:a}=t;if(!b(e,a,"removeDataset"))return e;const s={...e.mappedDatasets},i=[a,...s[a]?.sublayerIds||[]];i.forEach(e=>delete s[e]);const r=e.orderedDatasets.filter(e=>!i.includes(e));return{...e,mappedDatasets:s,orderedDatasets:r,menu:n(e.menu,i)}},SET_DATASET_VISIBILITY:(e,t)=>{const{datasetId:a,visible:s}=t;return b(e,a,"setDatasetVisibility")?e.mappedDatasets[a].visible===s?e:f("applyDatasetVisibility",[a,s],{...e,mappedDatasets:{...e.mappedDatasets,[a]:{...e.mappedDatasets[a],visible:s}}}):e},SET_GLOBAL_VISIBILITY:(e,t)=>{const{visible:a}=t;return f("applyGlobalVisibility",[a],{...e,globals:{...e.globals,visible:a}})},SET_DATASET_STYLE:(e,t)=>{const{datasetId:a,styleChanges:s,mapStyle:i}=t;if(!b(e,a,"setDatasetStyle"))return e;const r={...e.mappedDatasets[a].style,...s},n={...e.mappedDatasets[a],...s,style:r};return f("applyStyle",[a,i],{...e,mappedDatasets:{...e.mappedDatasets,[a]:n}})},SET_OPACITY:(e,t)=>{const{datasetId:a,opacity:s}=t;if(!b(e,a,"setOpacity"))return e;const i={...e.mappedDatasets[a].style,opacity:s},r={...e.mappedDatasets[a],style:i};return f("applyDatasetOpacity",[a],{...e,mappedDatasets:{...e.mappedDatasets,[a]:r}})},SET_GLOBAL_OPACITY:(e,t)=>{const{opacity:a}=t;return f("applyGlobalOpacity",[],{...e,globals:{...e.globals,opacity:a}})},HIDE_FEATURES:(e,t)=>{const{datasetId:a,featureIds:s}=t;if(!b(e,a,"setFeatureVisibility - hideFeatures"))return e;const i={...e.mappedDatasets[a]},r=i.hiddenFeatures||[],n=Array.from(new Set([...r,...s]));return i.hiddenFeatures=n,f("applyFeatureFilter",[a],{...e,mappedDatasets:{...e.mappedDatasets,[a]:i}})},SHOW_FEATURES:(e,t)=>{const{datasetId:a,featureIds:s}=t;if(!b(e,a,"setFeatureVisibility - showFeatures"))return e;const i={...e.mappedDatasets[a]},r=(i.hiddenFeatures||[]).filter(e=>!s.includes(e));return i.hiddenFeatures=r.length?r:[-1],f("applyFeatureFilter",[a],{...e,mappedDatasets:{...e.mappedDatasets,[a]:i}})},REMOVE_ADAPTER_ACTIONS:(e,t)=>t?.length?{...e,actionsArray:e.actionsArray.filter(e=>!t.includes(e))}:e,SET_GLOBAL_STATE:(e,t)=>f("applyGlobalOpacity",[],{...e,globals:{...e.globals,...t}}),SET_MENU:(e,t)=>{const{menu:a}=t;return{...e,menu:a}}},S={APP_TOGGLE_BUTTON_STATE:"app:togglebuttonstate",APP_REMOVE_PANEL:"app:removepanel",MAP_SIZE_CHANGE:"map:sizechange",MAP_DATA_CHANGE:"map:datachange"},_=(e,t)=>!(!e||!t)&&!(e[2]<t[0]||e[0]>t[2]||e[3]<t[1]||e[1]>t[3]),I=e=>{let t=1/0,a=1/0,s=-1/0,i=-1/0;const r=(e,n)=>{var o;0===n?(o=e,t=Math.min(t,o[0]),a=Math.min(a,o[1]),s=Math.max(s,o[0]),i=Math.max(i,o[1])):e.forEach(e=>r(e,n-1))};switch(e.type){case"Point":r(e.coordinates,0);break;case"LineString":case"MultiPoint":r(e.coordinates,1);break;case"Polygon":case"MultiLineString":r(e.coordinates,2);break;case"MultiPolygon":r(e.coordinates,3);break;case"GeometryCollection":e.geometries.forEach(e=>{const r=I(e);t=Math.min(t,r[0]),a=Math.min(a,r[1]),s=Math.max(s,r[2]),i=Math.max(i,r[3])});break;default:throw new Error(`Unsupported geometry type: ${e.type}`)}return[t,a,s,i]},v=e=>({type:"FeatureCollection",features:Array.from(e.values()).map(e=>e.feature)}),A=async(e,{mapProvider:t,dynamicGeoJSON:a,onUpdate:s})=>{const{url:i,idProperty:r,transformRequest:n,maxFeatures:o,minZoom:l=0}=a,d=t.getZoom();if(d<l)return;const p=(e=>e.getBounds())(t);if(!(e.fetchedBbox&&(u=e.fetchedBbox,h=p,u&&h&&h[0]>=u[0]&&h[1]>=u[1]&&h[2]<=u[2]&&h[3]<=u[3]))){var u,h,c,y;e.currentController&&e.currentController.abort(),e.currentController=new AbortController;try{const t={bbox:p,zoom:d},l=await(async(e,t,a,s)=>{const i=a(e,t),r="string"==typeof i?{url:i}:i,{url:n,headers:o={}}=r,l=await fetch(n,{headers:o,signal:s});if(!l.ok)throw new Error(`Failed to fetch GeoJSON: ${l.status} ${l.statusText}`);const d=await l.json();if("FeatureCollection"===d.type)return d;if("Feature"===d.type)return{type:"FeatureCollection",features:[d]};if(Array.isArray(d))return{type:"FeatureCollection",features:d};throw new Error("Invalid GeoJSON response")})(i,t,n,e.currentController.signal);((e,t,a)=>{const s=Date.now();t.features.forEach(t=>{const i=((e,t)=>t?e.properties?.[t]??e.id:e.id)(t,a);null!=i?e.set(i,{feature:t,bbox:I(t.geometry),lastSeenAt:s}):console.warn("Feature missing ID, skipping:",t)})})(e.features,l,r),e.fetchedBbox=(c=e.fetchedBbox,y=p,c?[Math.min(c[0],y[0]),Math.min(c[1],y[1]),Math.max(c[2],y[2]),Math.max(c[3],y[3])]:[...y]);const u=e.features.size;((e,t,a)=>{if(!a||e.size<=1.2*a)return;const s=a,i=[],r=[];for(const[a,s]of e)_(s.bbox,t)?i.push(a):r.push({id:a,lastSeenAt:s.lastSeenAt});r.sort((e,t)=>e.lastSeenAt-t.lastSeenAt);const n=e.size-s;for(let t=0;t<n&&t<r.length;t++)e.delete(r[t].id);if(e.size>s){const t=e.size-s,a=i.map(t=>({id:t,lastSeenAt:e.get(t).lastSeenAt})).sort((e,t)=>e.lastSeenAt-t.lastSeenAt);for(let s=0;s<t&&s<a.length;s++)e.delete(a[s].id)}})(e.features,p,o),e.features.size<u&&(e.fetchedBbox=p),s(a.id,v(e.features))}catch(e){if("AbortError"===e.name)return;console.error(`Failed to fetch dynamic GeoJSON for ${a.id}:`,e)}}},E=({dynamicGeoJSON:e,mapProvider:t,onUpdate:a})=>{const s={features:new Map,fetchedBbox:null,currentController:null},i=()=>A(s,{mapProvider:t,dynamicGeoJSON:e,onUpdate:a}),r=((e,t)=>{let a;const s=(...s)=>{clearTimeout(a),a=setTimeout(()=>e(...s),t)};return s.cancel=()=>{clearTimeout(a),a=null},s})(i,200),n=()=>{r()};return t.map.on("moveend",n),i(),{destroy(){var e,a;e=t.map,a=n,(e.off||e.un).call(e,"moveend",a),r.cancel(),s.currentController&&s.currentController.abort()},clear(){s.features.clear(),s.fetchedBbox=null,a(e.id,{type:"FeatureCollection",features:[]})},refresh(){s.features.clear(),s.fetchedBbox=null,i()},getFeatureCount:()=>s.features.size,reapply(){s.features.size>0&&a(e.id,v(s.features))}}};let M={};const C=e=>{M=e},T=e=>{const t=M?.current?.menuState||{};for(const[a,s]of Object.entries(e)){const e=t[a];if(!s.includes(e))return!1}return!0},w=e=>(Array.isArray(e)?e:[e]).includes(L()),L=()=>B.mapStyle.id;class P{constructor(e){this.id=e.id,this.url=e.url,this.transformRequest=e.transformRequest,this.maxFeatures=e.maxFeatures,this.minZoom=e.minZoom,this.idProperty=e.idProperty,this.hiddenFeaturesIdExpression=["to-string",["get",this.idProperty]],this.sourceId=`geojson-dynamic-${this.id}`,this.source={type:"geojson",data:{type:"FeatureCollection",features:[]},...this.idProperty?{promoteId:this.idProperty}:{generateId:!0}}}}let O={};const k=(e,t)=>{switch(O.opacityMode){case"global":return O.opacity;case"multiply":return((e=1,t=1)=>Math.round(100*(e*t*O.opacity+Number.EPSILON))/100)(e,t);default:return((e,t)=>void 0===e?void 0===t?O.opacity:t:e)(e,t)}},F=()=>O.visible;class G{constructor(e){this._datasetDefinition=e}get id(){return this._datasetDefinition.id}get label(){return this._datasetDefinition.label}get hasSymbol(){return!(this.hasSublayers||(e=this.style,!e?.symbol&&!e?.symbolSvgContent));var e}get hasPattern(){return!(this.hasSublayers||this.hasSymbol||(e=this.style,!e.fillPattern&&!e.fillPatternSvgContent));var e}get hasFill(){return!this.hasSublayers&&!this.hasSymbol&&(this.hasPattern||this.style?.fill&&"transparent"!==this.style?.fill)}get hasStroke(){return!this.hasSublayers&&!this.hasSymbol&&Boolean(this.style?.stroke)}get tiles(){return this._datasetDefinition.tiles}get geojson(){return this._datasetDefinition.geojson}get idProperty(){return this._datasetDefinition.idProperty}get generateIds(){return this._datasetDefinition.generateIds}get parentId(){return this._datasetDefinition.parentId}get minZoom(){return this._datasetDefinition.minZoom||this.parent?.minZoom}get maxZoom(){return this._datasetDefinition.maxZoom||this.parent?.maxZoom}get type(){return this._datasetDefinition.type||this.parent?.type}get showInKey(){const e=this._datasetDefinition.showInKey;return void 0!==e?e:this.parent?.showInKey??!1}get visibleWhen(){return void 0===this._datasetDefinition.visibleWhen?this.parent?.visibleWhen:this._datasetDefinition.visibleWhen}get groupLabel(){return this._datasetDefinition.groupLabel||this.parent?.groupLabel||this.parent?.label}get groupId(){const e=this._datasetDefinition.groupId||this.parent?.groupId;return e||(this.groupLabel?this.groupLabel.toLowerCase().replace(/\s+/g,"-"):null)}get opacity(){const e=this.style?.opacity,t=this.parent?.style?.opacity;return k(e,t)}get hasDynamicGeoJSON(){return Boolean(this._datasetDefinition.dynamicGeoJSON)}get dynamicGeoJSON(){return new P({...this._datasetDefinition.dynamicGeoJSON,id:this.id,minZoom:this.minZoom})}get hiddenFeatures(){return this._datasetDefinition.hiddenFeatures}get hasHiddenFeatures(){return Boolean(this.hiddenFeatures?.length>0||this.parent?.hasHiddenFeatures)}get filter(){return null}get isHiddenByInheritance(){return this.isSublayer?!this.parent?.visible:!F()}get isLocallyVisible(){return!!this.isVisible||this._datasetDefinition.visible}get visible(){return this.isSublayer?this._datasetDefinition.visible&&this.parent?.visible:this._datasetDefinition.visible&&F()}get esriStyleLayerId(){return this._datasetDefinition.esriStyleLayerId}get visibility(){const{visible:e,visibleWhen:t}=this;return e&&t?(e=>{if(null==e)return!0;if("boolean"==typeof e)return e;if("object"==typeof e){for(const[t,a]of Object.entries(e)){if("mapStyleId"===t&&!w(a))return!1;if("menu"===t&&!T(a))return!1}return!0}return!0})(t)?"visible":"none":e?"visible":"none"}get keyVisibility(){return this.showInKey&&"visible"===this.visibility}get symbolAnchor(){return this.style?.symbolAnchor?this.style.symbolAnchor:this.parent?.symbolAnchor}get sourceLayer(){return this.isSublayer?this.parent.sourceLayer:this.tiles?this._datasetDefinition.sourceLayer:void 0}get isSublayer(){return Boolean(this._datasetDefinition.parentId)}get hasSublayers(){return this._datasetDefinition.sublayerIds?.length>0}get sublayerIds(){return this._datasetDefinition.sublayerIds}get sublayers(){const{sublayerIds:e}=this;return e?e.map(e=>B.getDataset(e)):[]}get parent(){if(this._datasetDefinition.parentId)return B.getDataset(this._datasetDefinition.parentId)}get inheritedStyle(){const e=this._datasetDefinition.style||{},t=this.parent;return t?{...t.inheritedStyle,opacity:void 0,...e}:e}get style(){return{...u(this.inheritedStyle),symbolDescription:this.symbolDescription}}get hasCustomVisualStyle(){return p(this._datasetDefinition.style||{})}get symbolDescription(){return this._datasetDefinition.style?.symbolDescription?this._datasetDefinition.style.symbolDescription:this.hasCustomVisualStyle?void 0:this.parent?this.parent.symbolDescription:o.style.symbolDescription}get patternConfigs(){const e=this.hasPattern?[this.style]:[];return this.hasSublayers?[...e,...this.sublayers.flatMap(e=>e.patternConfigs)]:e}get symbolConfigs(){const e=this.hasSymbol?[this.style]:[];return this.hasSublayers?[...e,...this.sublayers.flatMap(e=>e.symbolConfigs)]:e}get keyDefinition(){return{id:this.id,type:"dataset",label:this.label,hasSymbol:this.hasSymbol,hasPattern:this.hasPattern,style:this.style,symbolDescription:this.symbolDescription}}}class x{constructor(){this.idToDefinitionMap=new Map,this.definitionToInstanceMap=new Map}add(e){this.idToDefinitionMap.set(e.id,e._datasetDefinition),this.definitionToInstanceMap.set(e._datasetDefinition,e)}invalidateDataset(e){const t=this.idToDefinitionMap.get(e.id);[t.id,...t?.sublayerIds||[]].forEach(e=>{const t=this.idToDefinitionMap.get(e);this.definitionToInstanceMap.delete(t),this.idToDefinitionMap.delete(e)})}invalidateChangedDatasets(e){e.forEach(e=>{const t=this.idToDefinitionMap.get(e.id);if(t&&t!==e){const e=this.definitionToInstanceMap.get(t);this.invalidateDataset(e.isSublayer&&e.parent?e.parent:e)}})}getByDefinition(e){return this.definitionToInstanceMap.get(e)}}const B={attach(e,t,a){this._datasets=e,this._orderedDatasets=t,this.attachMapStyle(a),this._invalidateChangedDatasets()},_definitionCache:new x,_invalidateCache(){this._definitionCache=new x},_invalidateChangedDatasets(){this._datasets?this._definitionCache.invalidateChangedDatasets(Object.values(this._datasets)):this._invalidateCache()},attachCreateDataset(e){this._createDataset=e},_createDataset:e=>(e=>new G(e))(e),attachMapStyle(e){e&&(this._mapStyle=e)},get mapStyle(){return this._mapStyle},getDataset(e){const t=this.datasets[e];if(!t)return;const a=this._definitionCache.getByDefinition(t);if(a)return a;const s=this._createDataset(t);return this._definitionCache.add(s),s.isSublayer&&this.getDataset(s.parentId),s},forEach(e){this._orderedDatasets.forEach(t=>e(this.getDataset(t)))},forEachDataset(e){Object.values(this.datasets).filter(e=>!e.parentId).forEach(t=>e(this.getDataset(t.id)))},topLevelDatasets(){return Object.values(this.datasets).filter(e=>!e.parentId).map(e=>this.getDataset(e.id))},getPatternAndSymbolConfigs(){return this.topLevelDatasets().reduce((e,t)=>({...e,patternConfigs:[...e.patternConfigs,...t.patternConfigs],symbolConfigs:[...e.symbolConfigs,...t.symbolConfigs]}),{patternConfigs:[],symbolConfigs:[]})},_lastMenuState:{},invalidateKeyItemsOnMenuStateChange(e){e!==this._lastMenuState&&(this._lastMenuState=e,this._lastKeyItemsDatasets=null)},_lastKeyItems:{},keyItems(){if(this.datasets===this._lastKeyItemsDatasets)return this._lastKeyItems;this._lastKeyItemsDatasets=this.datasets;const e=[],t=new Map;this.forEach(a=>{if(!a.keyVisibility)return;if(!(a.hasSublayers||a.groupId||a.groupLabel))return void e.push({type:"flat",id:a.id,keyDefinition:a.keyDefinition});const s=a.groupId,i=((a,s)=>{if(t.has(s))return t.get(s);const i={type:"group",id:s,groupLabel:a,keyDefinitions:[]};return t.set(s,i),e.push(i),i})(a.groupLabel||s||a.label,s);a.hasSublayers||i.keyDefinitions.push(a.keyDefinition)});const a=e.filter(e=>"flat"===e.type||Boolean(e.keyDefinitions?.length)),s=a.some(e=>"group"===e.type);return this._lastKeyItems={items:a,hasGroups:s},this._lastKeyItems}};Object.defineProperty(B,"datasets",{get:()=>B._datasets});let N;const V={},$=async(e,t,a,s={})=>{const i=await(async e=>{switch(e.name){case"MapLibreProvider":{const{default:e}=await import(/* webpackChunkName: "im-datasets-ml-adapter" */ "./im-datasets-ml-adapter.js");return e}case"EsriProvider":{const{default:e}=await import(/* webpackChunkName: "im-datasets-esri-adapter" */ "./im-datasets-esri-adapter.js");return e}case"OpenLayersProvider":{const{default:e}=await import(/* webpackChunkName: "im-datasets-ol-adapter" */ "./im-datasets-ol-adapter.js");return e}default:throw new Error(`No layer adapter available for map provider ${e.name}. Please provide a compatible layer adapter.`)}})(e);return N=new i(e,t,a,s),V.removeDataset=N.removeDataset.bind(N),V.setData=N.setData.bind(N),V.applyStyle=N.applyStyle.bind(N),V.applyDatasetVisibility=N.applyDatasetVisibility.bind(N),V.applyGlobalVisibility=N.applyGlobalVisibility.bind(N),V.applyDatasetOpacity=N.applyDatasetOpacity.bind(N),V.applyGlobalOpacity=N.applyGlobalOpacity.bind(N),V.addDataset=N.addDataset.bind(N),V.applyFeatureFilter=N.applyFeatureFilter.bind(N),V.onMapStyleChange=N.onMapStyleChange?.bind(N),V.onMapSizeChange=N.onMapSizeChange?.bind(N),N};const R=({pluginState:{dispatch:e}},t,a={})=>{const{datasetId:s,sublayerId:i}=a,r=i?`${s}-${i}`:s;e(r?{type:"SET_DATASET_VISIBILITY",payload:{datasetId:r,visible:t}}:{type:"SET_GLOBAL_VISIBILITY",payload:{visible:t}})},W=({menuGroupItem:e,onChange:t})=>{const i=B.getDataset(e.id);if(!i)return null;const r=i.isSublayer?i.parentId:i.id,n=i.isSublayer?i.id:void 0,o="im-c-datasets-layers__item govuk-checkboxes govuk-checkboxes--small"+(i.visible?"":" im-c-datasets-layers__item--checked");return a("div",{className:o,"data-module":"govuk-checkboxes",children:s("div",{className:"govuk-checkboxes__item",children:[a("input",{className:"govuk-checkboxes__input",id:i.id,"data-dataset-id":r,"data-sublayer-id":n,name:"layers",type:"checkbox",value:i.id,checked:i.isLocallyVisible,onChange:t}),a("label",{className:"im-c-datasets-layers__item-label govuk-label govuk-checkboxes__label",htmlFor:i.id,children:i.label})]})},i.id)},j=({menuGroup:e,children:t})=>{if(!e.groupLabel)return a(i,{children:t});return a("div",{className:"govuk-form-group im-c-datasets-layers-group",children:s("fieldset",{className:"im-c-datasets-layers-group__fieldset",children:[a("legend",{className:"im-c-datasets-layers-group__legend",children:a("h3",{children:e.groupLabel})}),t]})},e.id)},Z={InitComponent:function({pluginConfig:a,pluginState:s,mapState:i,mapProvider:n,services:o}){const{dispatch:l}=s,{eventBus:d,symbolRegistry:p,patternRegistry:u}=o,h=Boolean(n?.isBaseMapReady());e(()=>{const e=!1!==a.hasMenu&&(e=>e.datasets.some(e=>e.showInMenu||e.sublayers?.some(e=>e.showInMenu)))(a);e||(d.emitWhenReady(S.APP_REMOVE_PANEL,"datasetsLayers"),d.emitWhenReady(S.APP_TOGGLE_BUTTON_STATE,{id:"datasetsLayers",prop:"hidden",value:!0}))},[a.hasMenu]),t(s).current=s;const y=t(null);return e(()=>{if(!h)return;if(y.current)return;(async()=>{const e=await $(n,p,u);y.current=(({adapter:e,pluginConfig:t,mapStyle:a,mapProvider:s,events:i,dispatch:n,eventBus:o})=>{const{datasets:l}=t,d=new Map;t.globals&&n({type:"SET_GLOBAL_STATE",payload:t.globals});const{mappedDatasets:p,orderedDatasets:u}=c({datasets:l});e.createDataset&&B.attachCreateDataset(e.createDataset),B.attach(p,u,a);const h=r({datasets:l});o.requestOnce("menu:state",C),n({type:"SET_MENU",payload:{menu:h}}),n({type:"SET_DATASETS",payload:{mappedDatasets:p,orderedDatasets:u}}),e.init().then(()=>{B.forEachDataset(t=>{if(!t.hasDynamicGeoJSON)return;const{dynamicGeoJSON:a}=t,i=E({dynamicGeoJSON:a,mapProvider:s,onUpdate:(t,a)=>e.setData(t,a)});d.set(t.id,i)}),e.attachDynamicSources(d),o.emit("datasets:ready")});const y=()=>{e.onMapSizeChange()};o.on(i.MAP_SIZE_CHANGE,y);const m=o.emitWhenRequested("datasets:registry",B);return o.on("menu:changed",t=>{B.invalidateKeyItemsOnMenuStateChange(t),e.applyGlobalVisibility()}),{remove(){o.off(i.MAP_SIZE_CHANGE,y),m(),d.forEach(e=>e.destroy()),d.clear(),e.destroy()},refreshDataset(e){d.get(e)?.refresh()},clearDatasetCache(e){d.get(e)?.clear()},getFeatureCount:e=>d.get(e)?.getFeatureCount()??null}})({adapter:e,pluginConfig:a,mapStyle:i.mapStyle,mapProvider:n,events:S,dispatch:l,eventBus:d})})()},[h]),e(()=>{B.attach(s.mappedDatasets,s.orderedDatasets),d.emit("datasets:changed")},[s.mappedDatasets,s.orderedDatasets]),e(()=>{B.attachMapStyle(i.mapStyle),V?.onMapStyleChange&&Promise.resolve(V.onMapStyleChange()).then(()=>{d.emit(S.MAP_DATA_CHANGE)})},[i.mapStyle]),e(()=>{return e=s.globals,void(O=e);var e},[s.globals]),e(()=>{const{actionsArray:e}=s;e.length&&(e.forEach(({method:e,parameters:t})=>V[e](...t)),l({type:"REMOVE_ADAPTER_ACTIONS",payload:e}))},[s.actionsArray]),e(()=>()=>{y.current&&(y.current.remove(),y.current=null)},[]),null},reducer:{initialState:{globals:{visible:!0,opacity:1,opacityMode:"dataset"},key:{items:[],hasGroups:!1},mappedDatasets:{},orderedDatasets:[],actionsArray:[],menu:[]},actions:D},panels:[{id:"datasetsLayers",label:"Layers",mobile:{slot:"drawer",modal:!0,dismissible:!0},tablet:{slot:"left-top",dismissible:!0,exclusive:!0,width:"260px"},desktop:{slot:"left-top",modal:!1,dismissible:!0,exclusive:!0,width:"280px"},render:({pluginState:e})=>{const{menu:t=[]}=e,i=t=>{const{value:a,checked:s}=t.target;R({pluginState:e},s,{datasetId:a})},r=t.some(e=>e.groupLabel);return a("div",{className:"im-c-datasets-layers"+(r?" im-c-datasets-layers--has-groups":""),children:t.map(e=>s(j,{menuGroup:e,children:[" ",e.items.map(e=>a(W,{menuGroupItem:e,onChange:i},e.id))]},e.id))})}}],buttons:[{id:"datasetsLayers",label:"Layers",panelId:"datasetsLayers",iconId:"layers",mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"layers",svgContent:'<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"></path><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"></path><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"></path>'},{id:"key",svgContent:'<path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/>'}],api:{addDataset:({pluginState:{dispatch:e},mapState:t},a)=>{e({type:"ADD_DATASET",payload:{dataset:a,mapStyle:t.mapStyle}})},removeDataset:({pluginState:{dispatch:e}},t)=>{V.removeDataset(t),e({type:"REMOVE_DATASET",payload:{id:t}})},setDatasetVisibility:R,setFeatureVisibility:({pluginState:{dispatch:e}},t,a,{datasetId:s=null}={})=>{if(s){const e=B.getDataset(s);!e||e.idProperty||e.generateIds||m.warn(`setFeatureVisibility: Dataset "${s}" has no idProperty or generateIds configured. Features may not be matched correctly. Add idProperty to match by a feature property, or add generateIds: true to use auto-generated IDs.`)}e({type:t?"SHOW_FEATURES":"HIDE_FEATURES",payload:{datasetId:s,featureIds:a}})},setStyle:({pluginState:{dispatch:e},mapState:t},a,{datasetId:s,sublayerId:i}={})=>{e({type:"SET_DATASET_STYLE",payload:{datasetId:s=i?`${s}-${i}`:s,styleChanges:a,mapStyle:t.mapStyle}})},getStyle:({_pluginState:e},{datasetId:t,sublayerId:a}={})=>{t=a?`${t}-${a}`:t;const s=B.getDataset(t);return s?s.style:(m.warn(`getStyle: Dataset with id ${t} not found`),null)},setOpacity:({pluginState:{dispatch:e}},t,a={})=>{const{datasetId:s,sublayerId:i}=a,r=i?`${s}-${i}`:s;e(r?{type:"SET_OPACITY",payload:{datasetId:r,opacity:t}}:{type:"SET_GLOBAL_OPACITY",payload:{opacity:t}})},getOpacity:({pluginState:{globals:e}},t={})=>{const{datasetId:a,sublayerId:s}=t,i=s?`${a}-${s}`:a;if(i){const e=B.getDataset(i);return e?e.opacity??null:(m.warn(`getOpacity: Dataset with id ${i} not found`),null)}return e.opacity??null},setData:({_pluginState:e},t,{datasetId:a})=>{const s=B.getDataset(a);s?s?.tiles?m.warn(`setData called on vector tile dataset "${a}" — has no effect`):V.setData(a,t):m.warn(`setData: Dataset with id ${a} not found`)},setGlobals:({pluginState:{dispatch:e}},t)=>{const{opacityMode:a}=t,s={};let i=!1;a&&(["dataset","global","multiply"].includes(a)?(i=!0,s.opacityMode=a):m.warn(`Ignoring invalid opacityMode: ${a}. Must be one of 'dataset', 'global' or 'multiply'.`)),i?e({type:"SET_GLOBAL_STATE",payload:s}):m.warn("setGlobals: requires a valid value for opacityMode to be set")}}};var z=Object.freeze({__proto__:null,manifest:Z});export{G as D,B as d,m as l,z as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/asyncToGenerator";import
|
|
1
|
+
import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/regenerator";function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function o(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function i(){var r,n=o(o({noKeyItemText:"No features displayed"},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"datasets",load:(r=e(t.mark(function e(){var r;return t.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,import(/* webpackChunkName: "im-datasets-plugin" */ "./im-datasets-plugin.js").then(function(e){return e.m});case 1:return r=e.sent.manifest,e.abrupt("return",r);case 2:case"end":return e.stop()}},e)})),function(){return r.apply(this,arguments)})});return n}export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const r=(r,t)=>{if(!r)return null;if("string"==typeof r)return r.trim();if("object"==typeof r){if(t&&r[t])return r[t];return Object.values(r)[0]??null}return null};class t{attachDynamicSources(r){this._dynamicSources=r}get dynamicSources(){return this._dynamicSources}}export{t as L,r as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as t,d as i}from"./im-datasets-plugin.js";import
|
|
1
|
+
import{D as t,d as i}from"./im-datasets-plugin.js";import{L as s}from"./layerAdapter.js";const e=t=>{let i=0,s=2166136261;for(const e of t){const t=e.codePointAt(0);i=Math.imul(i,31)+t,s=Math.imul(s^t,16777619)}return(i>>>0).toString(36)+(s>>>0).toString(36)};class a extends t{get _hiddenFeaturesIdExpression(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.hiddenFeaturesIdExpression:this.idProperty?["to-string",["get",this.idProperty]]:["to-string",["id"]]}get _hiddenFeaturesFilter(){const t=this.hiddenFeatures?.filter(t=>-1!==t);return t?.length?["!",["in",this._hiddenFeaturesIdExpression,["literal",t.map(String)]]]:null}get filter(){const t=["all"];this.parent?.filter&&t.push(this.parent.filter),this._datasetDefinition.filter&&t.push(this._datasetDefinition.filter);const i=this._hiddenFeaturesFilter;return i&&t.push(i),1===t.length?null:t.length>2?t:t[1]}get leafLayerIds(){return[]}get layerIds(){return this.hasSublayers?this.sublayers.flatMap(t=>t.layerIds).filter(Boolean):this.leafLayerIds}getLayersWithValue(t,i=!1){const s=[];if(!1===i||this[i]){const i=this.leafLayerIds;if(i.length){const e=this[t];s.push({layerIds:i,[t]:e})}}return this.hasSublayers&&this.sublayers.forEach(e=>{if(!1===i||e[i]){const[i]=e.getLayersWithValue(t);i&&s.push(i)}}),s}getLayersWithVisibility(){return this.getLayersWithValue("visibility")}getLayersWithOpacity(){return this.getLayersWithValue("opacity")}getLayersWithFilters(){return this.getLayersWithValue("filter","hasHiddenFeatures")}get sourceId(){if(this.isSublayer)return this.parent.sourceId;if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.sourceId;if(this.tiles){const t=Array.isArray(this.tiles)?this.tiles.join(","):this.tiles;return`tiles-${e(t)}`}return this.geojson?"string"==typeof this.geojson?`geojson-${e(this.geojson)}`:`geojson-${this.id}`:`source-${this.id}`}}class r extends s{constructor(t,i,s){super(),this._mapProvider=t,this._map=t.map,this._symbolRegistry=i,this._patternRegistry=s}get _pixelRatio(){return this._map.getPixelRatio()}async addDataset(t){const s=i.getDataset(t);s&&(await this._registerPatternsAndSymbols(s),this._addLayers(s))}applyDatasetOpacity(t){const s=i.getDataset(t);s&&this._applyRegistryDatasetOpacity(s)}_applyRegistryDatasetOpacity(t){t.getLayersWithOpacity().forEach(({layerIds:t,opacity:i})=>{t.forEach(t=>this._setLayerOpacity(t,i))})}applyGlobalOpacity(){i.forEachDataset(t=>this._applyRegistryDatasetOpacity(t))}applyDatasetVisibility(t){const s=i.getDataset(t);s&&this._applyRegistryDatasetVisibility(s)}_applyRegistryDatasetVisibility(t){t.getLayersWithVisibility().forEach(({layerIds:t,visibility:i})=>{t.forEach(t=>this._setLayerVisibility(t,i))})}applyGlobalVisibility(){i.forEachDataset(t=>this._applyRegistryDatasetVisibility(t))}}export{a as M,r as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see im-datasets-ml-adapter.js.LICENSE.txt */
|
|
2
|
-
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[563],{913(t,e,r){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function i(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}r.d(e,{h:()=>v});var a=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},(e=[{key:"attachDynamicSources",value:function(t){this._dynamicSources=t}},{key:"dynamicSources",get:function(){return this._dynamicSources}}])&&o(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),u=r(262);function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function s(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof u?n:u,s=Object.create(c.prototype);return l(s,"_invoke",function(r,n,o){var i,u,c,s=0,l=o||[],f=!1,y={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return i=e,u=0,c=t,y.n=r,a}};function p(r,n){for(u=r,c=n,e=0;!f&&s&&!o&&e<l.length;e++){var o,i=l[e],p=y.p,h=i[2];r>3?(o=h===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=r<2&&p<i[1])?(u=0,y.v=n,y.n=i[1]):p<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,y.n=h,u=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(y.n=-1),p(u,c)):y.n=c:y.v=c);try{if(s=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=y.n<0)?c:r.call(n,y))!==a)break}catch(e){i=t,u=1,c=e}finally{s=1}}return{value:e,done:f}}}(r,o,i),!0),s}var a={};function u(){}function c(){}function f(){}e=Object.getPrototypeOf;var y=[][n]?e(e([][n]())):(l(e={},n,function(){return this}),e),p=f.prototype=u.prototype=Object.create(y);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,l(t,o,"GeneratorFunction")),t.prototype=Object.create(p),t}return c.prototype=f,l(p,"constructor",f),l(f,"constructor",c),c.displayName="GeneratorFunction",l(f,o,"GeneratorFunction"),l(p),l(p,o,"Generator"),l(p,n,function(){return this}),l(p,"toString",function(){return"[object Generator]"}),(s=function(){return{w:i,m:h}})()}function l(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}l=function(t,e,r,n){function i(e,r){l(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},l(t,e,r,n)}function f(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,p(n.key),n)}}function p(t){var e=function(t){if("object"!=c(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==c(e)?e:e+""}function h(t,e,r){return e=d(e),function(t,e){if(e&&("object"==c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,b()?Reflect.construct(e,r||[],d(t).constructor):e.apply(t,r))}function b(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(b=function(){return!!t})()}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function m(t,e){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},m(t,e)}var v=function(t){function e(t,r,n){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=h(this,e))._mapProvider=t,o._map=t.map,o._symbolRegistry=r,o._patternRegistry=n,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&m(t,e)}(e,t),r=e,n=[{key:"_pixelRatio",get:function(){return this._map.getPixelRatio()}},{key:"addDataset",value:(o=s().m(function t(e){var r;return s().w(function(t){for(;;)switch(t.n){case 0:if(r=u.Q.getDataset(e)){t.n=1;break}return t.a(2);case 1:return t.n=2,this._registerPatternsAndSymbols(r);case 2:this._addLayers(r);case 3:return t.a(2)}},t,this)}),i=function(){var t=this,e=arguments;return new Promise(function(r,n){var i=o.apply(t,e);function a(t){f(i,r,n,a,u,"next",t)}function u(t){f(i,r,n,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})},{key:"applyDatasetOpacity",value:function(t){var e=u.Q.getDataset(t);e&&this._applyRegistryDatasetOpacity(e)}},{key:"_applyRegistryDatasetOpacity",value:function(t){var e=this;t.getLayersWithOpacity().forEach(function(t){var r=t.layerIds,n=t.opacity;r.forEach(function(t){return e._setLayerOpacity(t,n)})})}},{key:"applyGlobalOpacity",value:function(){var t=this;u.Q.forEachDataset(function(e){return t._applyRegistryDatasetOpacity(e)})}},{key:"applyDatasetVisibility",value:function(t){var e=u.Q.getDataset(t);e&&this._applyRegistryDatasetVisibility(e)}},{key:"_applyRegistryDatasetVisibility",value:function(t){var e=this;t.getLayersWithVisibility().forEach(function(t){var r=t.layerIds,n=t.visibility;r.forEach(function(t){return e._setLayerVisibility(t,n)})})}},{key:"applyGlobalVisibility",value:function(){var t=this;u.Q.forEachDataset(function(e){return t._applyRegistryDatasetVisibility(e)})}}],n&&y(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o,i}(a)},291(t,e,r){r.r(e),r.d(e,{default:()=>R});var n=r(247);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function a(t,e,r){return(e=function(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var u=function(t,e,r,o,c,s){var l,f=t.map,y=e.sourceId,p=e.source;p&&!f.getSource(y)&&f.addSource(y,p);var h=r.id;return function(t,e,r,n,o){var i=t.map,a=e.hasSymbol,u=e.symbolLayerId;if(a&&n&&u&&!i.getLayer(u)){var c=n.getSymbolDef(e.style);if(c){var s=n.getSymbolImageId(e.style,r,"normal",o);s&&i.addLayer(e.getSymbolSource(s,t.getSymbolIconLayout(c)))}}}(t,e,r,o,s),function(t,e,r,o){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=e.hasFill,u=e.fillLayerId;if(a&&u&&!t.getLayer(u)){var c=o.getPatternImageId(e.style,r,i),s=c?{"fill-pattern":c,"fill-opacity":e.opacity}:{"fill-color":(0,n.o)(e.style.fill,r),"fill-opacity":e.opacity};t.addLayer(e.getFillSource(s))}}(f,e,h,c,s),function(t,e,r){var o=e.hasStroke,u=e.strokeLayerId;if(o&&!t.getLayer(u)){var c=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({"line-color":(0,n.o)(e.style.stroke,r),"line-width":e.style.strokeWidth,"line-opacity":e.opacity},e.style.strokeDashArray?{"line-dasharray":e.style.strokeDashArray}:{}),s=e.getStrokeSource(c);t.addLayer(s)}}(f,e,h),null!==(l=e.sublayers)&&void 0!==l&&l.length?(e.sublayers.forEach(function(e){u(t,e,r,o,c,s)}),y):e.isSublayer?void 0:y},c=r(416),s=r(619);function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function f(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?f(Object(r),!0).forEach(function(e){p(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function p(t,e,r){return(e=b(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,b(n.key),n)}}function b(t){var e=function(t){if("object"!=l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==l(e)?e:e+""}function d(t,e,r){return e=v(e),function(t,e){if(e&&("object"==l(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,m()?Reflect.construct(e,r||[],v(t).constructor):e.apply(t,r))}function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(m=function(){return!!t})()}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},g(t,e)}var S=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}(e,t),r=e,(n=[{key:"fillLayerId",get:function(){return this.hasSublayers||this.hasSymbol?null:this.hasFill?this.id:null}},{key:"strokeLayerId",get:function(){return this.hasSublayers||this.hasSymbol?null:this.hasStroke?this.hasFill?"".concat(this.id,"-stroke"):this.id:null}},{key:"symbolLayerId",get:function(){return this.hasSublayers?null:this.hasSymbol?this.id:null}},{key:"leafLayerIds",get:function(){return[this.symbolLayerId,this.fillLayerId,this.strokeLayerId].filter(Boolean)}},{key:"_geojsonIdStrategy",value:function(){var t;return this.idProperty?{promoteId:this.idProperty}:this.generateIds?{generateId:!0}:(null!==(t=this.geojson)&&void 0!==t&&null!==(t=t.features)&&void 0!==t&&t.some(function(t){return"string"==typeof t.id})&&s.v.warn('Dataset "'.concat(this.id,'" has GeoJSON features with string native IDs. MapLibre only surfaces integer native feature IDs through queryRenderedFeatures. Use idProperty to promote a string property instead.')),{})}},{key:"source",get:function(){if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.source;if(this.tiles){var t={type:"vector",tiles:this.tiles,minzoom:this.minZoom||0,maxzoom:this.maxZoom||22};return this.idProperty&&this.sourceLayer&&(t.promoteId=p({},this.sourceLayer,this.idProperty)),t}return this.geojson?y({type:"geojson",data:this.geojson},this._geojsonIdStrategy()):null}},{key:"getSymbolSource",value:function(t,e){return y({id:this.symbolLayerId,type:"symbol",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:y(y({visibility:this.visibility,"icon-image":t},e),{},{"icon-allow-overlap":!0})},this.filter?{filter:this.filter}:{})}},{key:"getFillSource",value:function(t){return y({id:this.fillLayerId,type:"fill",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility},paint:t},this.filter?{filter:this.filter}:{})}},{key:"getStrokeSource",value:function(t){return y({id:this.strokeLayerId,type:"line",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility},paint:t},this.filter?{filter:this.filter}:{})}}])&&h(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(c.f),O=r(262);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 w(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof u?n:u,s=Object.create(c.prototype);return j(s,"_invoke",function(r,n,o){var i,u,c,s=0,l=o||[],f=!1,y={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return i=e,u=0,c=t,y.n=r,a}};function p(r,n){for(u=r,c=n,e=0;!f&&s&&!o&&e<l.length;e++){var o,i=l[e],p=y.p,h=i[2];r>3?(o=h===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=r<2&&p<i[1])?(u=0,y.v=n,y.n=i[1]):p<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,y.n=h,u=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(y.n=-1),p(u,c)):y.n=c:y.v=c);try{if(s=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=y.n<0)?c:r.call(n,y))!==a)break}catch(e){i=t,u=1,c=e}finally{s=1}}return{value:e,done:f}}}(r,o,i),!0),s}var a={};function u(){}function c(){}function s(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(j(e={},n,function(){return this}),e),f=s.prototype=u.prototype=Object.create(l);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,j(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=s,j(f,"constructor",s),j(s,"constructor",c),c.displayName="GeneratorFunction",j(s,o,"GeneratorFunction"),j(f),j(f,o,"Generator"),j(f,n,function(){return this}),j(f,"toString",function(){return"[object Generator]"}),(w=function(){return{w:i,m:y}})()}function j(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}j=function(t,e,r,n){function i(e,r){j(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},j(t,e,r,n)}function P(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function L(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){P(i,n,o,a,u,"next",t)}function u(t){P(i,n,o,a,u,"throw",t)}a(void 0)})}}function k(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,I(n.key),n)}}function I(t){var e=function(t){if("object"!=_(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+""}function E(t,e,r){return e=T(e),function(t,e){if(e&&("object"==_(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,D()?Reflect.construct(e,r||[],T(t).constructor):e.apply(t,r))}function D(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(D=function(){return!!t})()}function T(t){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},T(t)}function F(t,e){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},F(t,e)}var R=function(t){function e(t,r,n){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=E(this,e,[t,r,n]))._datasetSourceMap=new Map,window._datasetSourceMap=o._datasetSourceMap,o._symbolLayerIds=new Set,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&F(t,e)}(e,t),r=e,n=[{key:"createDataset",value:function(t){return new S(t)}},{key:"init",value:(s=L(w().m(function t(){var e,r,n,o=this;return w().w(function(t){for(;;)switch(t.n){case 0:return e=O.Q.getPatternAndSymbolConfigs(),r=e.patternConfigs,n=e.symbolConfigs,t.n=1,this.addPatternsAndSymbolsToMap(r,n);case 1:return this._symbolLayerIds.clear(),O.Q.forEachDataset(function(t){return o._addLayers(t)}),t.n=2,new Promise(function(t){return o._map.once("idle",t)});case 2:return t.a(2)}},t,this)})),function(){return s.apply(this,arguments)})},{key:"removeLayer",value:function(t){this._map.getLayer(t)&&this._map.removeLayer(t),this._symbolLayerIds.delete(t)}},{key:"addPatternsAndSymbolsToMap",value:(c=L(w().m(function t(e,r){var n,o;return w().w(function(t){for(;;)if(0===t.n)return n=O.Q.mapStyle,o=n.id,t.a(2,Promise.all([this._mapProvider.addPatternsToMap(e,o,this._patternRegistry),this._mapProvider.addSymbolsToMap(r,n,this._symbolRegistry)]))},t,this)})),function(t,e){return c.apply(this,arguments)})},{key:"destroy",value:function(){var t=this,e=new Set;O.Q.forEachDataset(function(r){var n=r.sourceId;t._getLayersUsingSource(n).forEach(function(e){return t.removeLayer(e)}),!e.has(n)&&t._map.getSource(n)&&(t._map.removeSource(n),e.add(n))}),this._datasetSourceMap.clear()}},{key:"onMapStyleChange",value:(a=L(w().m(function t(){var e,r,n,o=this;return w().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,new Promise(function(t){return o._map.once("idle",t)});case 1:return e=O.Q.getPatternAndSymbolConfigs(),r=e.patternConfigs,n=e.symbolConfigs,t.n=2,this.addPatternsAndSymbolsToMap(r,n);case 2:this._symbolLayerIds.clear(),O.Q.forEachDataset(function(t){o._addLayers(t),o._applyFeatureFilter(t)}),this.dynamicSources.forEach(function(t){return t.reapply()});case 3:return t.a(2)}},t,this)})),function(){return a.apply(this,arguments)})},{key:"onMapSizeChange",value:(i=L(w().m(function t(){var e,r,n,o,i,a=this;return w().w(function(t){for(;;)switch(t.n){case 0:return e=O.Q.mapStyle,r=this._pixelRatio,n=O.Q.getPatternAndSymbolConfigs(),o=n.patternConfigs,i=n.symbolConfigs,t.n=1,this.addPatternsAndSymbolsToMap(o,i);case 1:if(this._pixelRatio===r){t.n=2;break}return t.a(2);case 2:O.Q.forEach(function(t){var n=t.fillLayerId,o=t.symbolLayerId;if(o&&a._symbolLayerIds.has(o)&&a._map.getLayer(o)){var i=a._symbolRegistry.getSymbolImageId(t.style,e,"normal",r);i&&a._map.setLayoutProperty(o,"icon-image",i)}else if(n&&a._map.getLayer(n)){var u=a._patternRegistry.getPatternImageId(t.style,e.id,r);u&&a._map.setPaintProperty(n,"fill-pattern",u)}});case 3:return t.a(2)}},t,this)})),function(){return i.apply(this,arguments)})},{key:"_registerPatternsAndSymbols",value:function(t){return this.addPatternsAndSymbolsToMap(t.patternConfigs,t.symbolConfigs)}},{key:"removeDataset",value:function(t){var e=this,r=O.Q.getDataset(t);if(r){var n=r.sourceId;r.layerIds.forEach(function(t){return e.removeLayer(t)}),!O.Q.topLevelDatasets().some(function(e){return e.id!==t&&e.sourceId===n})&&this._map.getSource(n)&&this._map.removeSource(n),this._datasetSourceMap.delete(t)}}},{key:"applyFeatureFilter",value:function(t){var e=O.Q.getDataset(t);e&&this._applyFeatureFilter(e)}},{key:"applyStyle",value:(o=L(w().m(function t(e){var r,n=this;return w().w(function(t){for(;;)switch(t.n){case 0:return(r=O.Q.getDataset(e)).layerIds.forEach(function(t){return n.removeLayer(t)}),t.n=1,this._registerPatternsAndSymbols(r);case 1:this._addLayers(r);case 2:return t.a(2)}},t,this)})),function(t){return o.apply(this,arguments)})},{key:"setData",value:function(t,e){var r=this._datasetSourceMap.get(t);if(r){var n=this._map.getSource(r);n&&"function"==typeof n.setData&&n.setData(e)}}},{key:"_addLayers",value:function(t){var e=O.Q.mapStyle,r=u(this._mapProvider,t,e,this._symbolRegistry,this._patternRegistry,this._pixelRatio);this._datasetSourceMap.set(t.id,r),this._maintainSymbolOrdering(t)}},{key:"_getFirstSymbolLayerId",value:function(){var t,e=this,r=this._map.getStyle();if(null==r||!r.layers)return null;var n=r.layers.find(function(t){return e._symbolLayerIds.has(t.id)});return null!==(t=null==n?void 0:n.id)&&void 0!==t?t:null}},{key:"_maintainSymbolOrdering",value:function(t){var e=this,r=(t=t.isSublayer?t.parent:t).layerIds.filter(function(t){return t&&e._map.getLayer(t)});r.forEach(function(t){var r;"symbol"===(null===(r=e._map.getLayer(t))||void 0===r?void 0:r.type)?e._symbolLayerIds.add(t):e._symbolLayerIds.delete(t)});var n=this._getFirstSymbolLayerId();n&&r.forEach(function(t){e._symbolLayerIds.has(t)||e._map.moveLayer(t,n)})}},{key:"_setLayerVisibility",value:function(t,e){this._map.getLayer(t)&&this._map.setLayoutProperty(t,"visibility",e)}},{key:"_applyFeatureFilter",value:function(t){var e=this;t.getLayersWithFilters().forEach(function(t){var r=t.layerIds,n=t.filter;r.forEach(function(t){e._map.getLayer(t)&&e._map.setFilter(t,n)})})}},{key:"_setLayerOpacity",value:function(t,e){var r=this._map.getLayer(t);if(r){var n={line:"line-opacity",symbol:"icon-opacity"}[r.type]||"fill-opacity";this._map.setPaintProperty(t,n,e)}}},{key:"_getLayersUsingSource",value:function(t){var e=this._map.getStyle();return null!=e&&e.layers?e.layers.filter(function(e){return e.source===t}).map(function(t){return t.id}):[]}}],n&&k(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o,i,a,c,s}(r(913).h)},416(t,e,r){r.d(e,{f:()=>h});var n=r(228);function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var i=function(t){var e,r=0,n=2166136261,i=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}(t);try{for(i.s();!(e=i.n()).done;){var a=e.value.codePointAt(0);r=Math.imul(r,31)+a,n=Math.imul(n^a,16777619)}}catch(t){i.e(t)}finally{i.f()}return(r>>>0).toString(36)+(n>>>0).toString(36)};function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function s(t){var e=function(t){if("object"!=a(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:e+""}function l(t,e,r){return e=y(e),function(t,e){if(e&&("object"==a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,f()?Reflect.construct(e,r||[],y(t).constructor):e.apply(t,r))}function f(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(f=function(){return!!t})()}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}var h=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),l(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}(e,t),r=e,n=[{key:"_hiddenFeaturesIdExpression",get:function(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.hiddenFeaturesIdExpression:this.idProperty?["to-string",["get",this.idProperty]]:["to-string",["id"]]}},{key:"_hiddenFeaturesFilter",get:function(){var t,e=null===(t=this.hiddenFeatures)||void 0===t?void 0:t.filter(function(t){return-1!==t});return null!=e&&e.length?["!",["in",this._hiddenFeaturesIdExpression,["literal",e.map(String)]]]:null}},{key:"filter",get:function(){var t,e=["all"];null!==(t=this.parent)&&void 0!==t&&t.filter&&e.push(this.parent.filter),this._datasetDefinition.filter&&e.push(this._datasetDefinition.filter);var r=this._hiddenFeaturesFilter;return r&&e.push(r),1===e.length?null:e.length>2?e:e[1]}},{key:"leafLayerIds",get:function(){return[]}},{key:"layerIds",get:function(){return this.hasSublayers?this.sublayers.flatMap(function(t){return t.layerIds}).filter(Boolean):this.leafLayerIds}},{key:"getLayersWithValue",value:function(t){var e,r,n,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];if(!1===o||this[o]){var a=this.leafLayerIds;if(a.length){var c=this[t];i.push((e={layerIds:a},n=c,(r=s(r=t))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e))}}return this.hasSublayers&&this.sublayers.forEach(function(e){if(!1===o||e[o]){var r=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e.getLayersWithValue(t),1)[0];r&&i.push(r)}}),i}},{key:"getLayersWithVisibility",value:function(){return this.getLayersWithValue("visibility")}},{key:"getLayersWithOpacity",value:function(){return this.getLayersWithValue("opacity")}},{key:"getLayersWithFilters",value:function(){return this.getLayersWithValue("filter","hasHiddenFeatures")}},{key:"sourceId",get:function(){if(this.isSublayer)return this.parent.sourceId;if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.sourceId;if(this.tiles){var t=Array.isArray(this.tiles)?this.tiles.join(","):this.tiles;return"tiles-".concat(i(t))}return this.geojson?"string"==typeof this.geojson?"geojson-".concat(i(this.geojson)):"geojson-".concat(this.id):"source-".concat(this.id)}}],n&&c(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(n.j)},247(t,e,r){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}r.d(e,{o:()=>o});var o=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===n(t)){if(e&&t[e])return t[e];var r=Object.values(t)[0];return null!=r?r:null}return null}}}]);
|
|
2
|
+
"use strict";(Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap=Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap||[]).push([[563],{913:function(t,e,r){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function i(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}r.d(e,{h:function(){return m}});var a=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},(e=[{key:"attachDynamicSources",value:function(t){this._dynamicSources=t}},{key:"dynamicSources",get:function(){return this._dynamicSources}}])&&o(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),u=r(262);function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function s(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof u?n:u,s=Object.create(c.prototype);return l(s,"_invoke",function(r,n,o){var i,u,c,s=0,l=o||[],f=!1,y={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return i=e,u=0,c=t,y.n=r,a}};function p(r,n){for(u=r,c=n,e=0;!f&&s&&!o&&e<l.length;e++){var o,i=l[e],p=y.p,h=i[2];r>3?(o=h===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=r<2&&p<i[1])?(u=0,y.v=n,y.n=i[1]):p<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,y.n=h,u=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(y.n=-1),p(u,c)):y.n=c:y.v=c);try{if(s=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=y.n<0)?c:r.call(n,y))!==a)break}catch(e){i=t,u=1,c=e}finally{s=1}}return{value:e,done:f}}}(r,o,i),!0),s}var a={};function u(){}function c(){}function f(){}e=Object.getPrototypeOf;var y=[][n]?e(e([][n]())):(l(e={},n,function(){return this}),e),p=f.prototype=u.prototype=Object.create(y);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,l(t,o,"GeneratorFunction")),t.prototype=Object.create(p),t}return c.prototype=f,l(p,"constructor",f),l(f,"constructor",c),c.displayName="GeneratorFunction",l(f,o,"GeneratorFunction"),l(p),l(p,o,"Generator"),l(p,n,function(){return this}),l(p,"toString",function(){return"[object Generator]"}),(s=function(){return{w:i,m:h}})()}function l(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}l=function(t,e,r,n){function i(e,r){l(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},l(t,e,r,n)}function f(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,p(n.key),n)}}function p(t){var e=function(t){if("object"!=c(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==c(e)?e:e+""}function h(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(h=function(){return!!t})()}function b(t){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},b(t)}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}var m=function(t){function e(t,r,n){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=function(t,e,r){return e=b(e),function(t,e){if(e&&("object"==c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,h()?Reflect.construct(e,r||[],b(t).constructor):e.apply(t,r))}(this,e))._mapProvider=t,o._map=t.map,o._symbolRegistry=r,o._patternRegistry=n,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(e,t),r=e,n=[{key:"_pixelRatio",get:function(){return this._map.getPixelRatio()}},{key:"addDataset",value:(o=s().m(function t(e){var r;return s().w(function(t){for(;;)switch(t.n){case 0:if(r=u.Q.getDataset(e)){t.n=1;break}return t.a(2);case 1:return t.n=2,this._registerPatternsAndSymbols(r);case 2:this._addLayers(r);case 3:return t.a(2)}},t,this)}),i=function(){var t=this,e=arguments;return new Promise(function(r,n){var i=o.apply(t,e);function a(t){f(i,r,n,a,u,"next",t)}function u(t){f(i,r,n,a,u,"throw",t)}a(void 0)})},function(t){return i.apply(this,arguments)})},{key:"applyDatasetOpacity",value:function(t){var e=u.Q.getDataset(t);e&&this._applyRegistryDatasetOpacity(e)}},{key:"_applyRegistryDatasetOpacity",value:function(t){var e=this;t.getLayersWithOpacity().forEach(function(t){var r=t.layerIds,n=t.opacity;r.forEach(function(t){return e._setLayerOpacity(t,n)})})}},{key:"applyGlobalOpacity",value:function(){var t=this;u.Q.forEachDataset(function(e){return t._applyRegistryDatasetOpacity(e)})}},{key:"applyDatasetVisibility",value:function(t){var e=u.Q.getDataset(t);e&&this._applyRegistryDatasetVisibility(e)}},{key:"_applyRegistryDatasetVisibility",value:function(t){var e=this;t.getLayersWithVisibility().forEach(function(t){var r=t.layerIds,n=t.visibility;r.forEach(function(t){return e._setLayerVisibility(t,n)})})}},{key:"applyGlobalVisibility",value:function(){var t=this;u.Q.forEachDataset(function(e){return t._applyRegistryDatasetVisibility(e)})}}],n&&y(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o,i}(a)},291:function(t,e,r){r.r(e),r.d(e,{default:function(){return T}});var n=r(247);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function a(t,e,r){return(e=function(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var u=function(t,e,r,o,c,s){var l,f=t.map,y=e.sourceId,p=e.source;p&&!f.getSource(y)&&f.addSource(y,p);var h=r.id;return function(t,e,r,n,o){var i=t.map,a=e.hasSymbol,u=e.symbolLayerId;if(a&&n&&u&&!i.getLayer(u)){var c=n.getSymbolDef(e.style);if(c){var s=n.getSymbolImageId(e.style,r,"normal",o);s&&i.addLayer(e.getSymbolSource(s,t.getSymbolIconLayout(c)))}}}(t,e,r,o,s),function(t,e,r,o){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=e.hasFill,u=e.fillLayerId;if(a&&u&&!t.getLayer(u)){var c=o.getPatternImageId(e.style,r,i),s=c?{"fill-pattern":c,"fill-opacity":e.opacity}:{"fill-color":(0,n.o)(e.style.fill,r),"fill-opacity":e.opacity};t.addLayer(e.getFillSource(s))}}(f,e,h,c,s),function(t,e,r){var o=e.hasStroke,u=e.strokeLayerId;if(o&&!t.getLayer(u)){var c=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({"line-color":(0,n.o)(e.style.stroke,r),"line-width":e.style.strokeWidth,"line-opacity":e.opacity},e.style.strokeDashArray?{"line-dasharray":e.style.strokeDashArray}:{}),s=e.getStrokeSource(c);t.addLayer(s)}}(f,e,h),null!==(l=e.sublayers)&&void 0!==l&&l.length?(e.sublayers.forEach(function(e){u(t,e,r,o,c,s)}),y):e.isSublayer?void 0:y},c=r(416),s=r(619);function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function f(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?f(Object(r),!0).forEach(function(e){p(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function p(t,e,r){return(e=b(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,b(n.key),n)}}function b(t){var e=function(t){if("object"!=l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==l(e)?e:e+""}function d(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(d=function(){return!!t})()}function m(t){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},m(t)}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}var g=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,r){return e=m(e),function(t,e){if(e&&("object"==l(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,d()?Reflect.construct(e,r||[],m(t).constructor):e.apply(t,r))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}(e,t),r=e,(n=[{key:"fillLayerId",get:function(){return this.hasSublayers||this.hasSymbol?null:this.hasFill?this.id:null}},{key:"strokeLayerId",get:function(){return this.hasSublayers||this.hasSymbol?null:this.hasStroke?this.hasFill?"".concat(this.id,"-stroke"):this.id:null}},{key:"symbolLayerId",get:function(){return this.hasSublayers?null:this.hasSymbol?this.id:null}},{key:"leafLayerIds",get:function(){return[this.symbolLayerId,this.fillLayerId,this.strokeLayerId].filter(Boolean)}},{key:"_geojsonIdStrategy",value:function(){var t;return this.idProperty?{promoteId:this.idProperty}:this.generateIds?{generateId:!0}:(null!==(t=this.geojson)&&void 0!==t&&null!==(t=t.features)&&void 0!==t&&t.some(function(t){return"string"==typeof t.id})&&s.v.warn('Dataset "'.concat(this.id,'" has GeoJSON features with string native IDs. MapLibre only surfaces integer native feature IDs through queryRenderedFeatures. Use idProperty to promote a string property instead.')),{})}},{key:"source",get:function(){if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.source;if(this.tiles){var t={type:"vector",tiles:this.tiles,minzoom:this.minZoom||0,maxzoom:this.maxZoom||22};return this.idProperty&&this.sourceLayer&&(t.promoteId=p({},this.sourceLayer,this.idProperty)),t}return this.geojson?y({type:"geojson",data:this.geojson},this._geojsonIdStrategy()):null}},{key:"getSymbolSource",value:function(t,e){return y({id:this.symbolLayerId,type:"symbol",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:y(y({visibility:this.visibility,"icon-image":t},e),{},{"icon-allow-overlap":!0})},this.filter?{filter:this.filter}:{})}},{key:"getFillSource",value:function(t){return y({id:this.fillLayerId,type:"fill",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility},paint:t},this.filter?{filter:this.filter}:{})}},{key:"getStrokeSource",value:function(t){return y({id:this.strokeLayerId,type:"line",source:this.sourceId,"source-layer":this.sourceLayer,minzoom:this.minZoom,maxzoom:this.maxZoom,layout:{visibility:this.visibility},paint:t},this.filter?{filter:this.filter}:{})}}])&&h(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(c.f),S=r(262);function O(t){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O(t)}function _(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof u?n:u,s=Object.create(c.prototype);return w(s,"_invoke",function(r,n,o){var i,u,c,s=0,l=o||[],f=!1,y={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return i=e,u=0,c=t,y.n=r,a}};function p(r,n){for(u=r,c=n,e=0;!f&&s&&!o&&e<l.length;e++){var o,i=l[e],p=y.p,h=i[2];r>3?(o=h===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=r<2&&p<i[1])?(u=0,y.v=n,y.n=i[1]):p<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,y.n=h,u=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,h),u=l,c=h;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(y.n=-1),p(u,c)):y.n=c:y.v=c);try{if(s=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=y.n<0)?c:r.call(n,y))!==a)break}catch(e){i=t,u=1,c=e}finally{s=1}}return{value:e,done:f}}}(r,o,i),!0),s}var a={};function u(){}function c(){}function s(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(w(e={},n,function(){return this}),e),f=s.prototype=u.prototype=Object.create(l);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,w(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=s,w(f,"constructor",s),w(s,"constructor",c),c.displayName="GeneratorFunction",w(s,o,"GeneratorFunction"),w(f),w(f,o,"Generator"),w(f,n,function(){return this}),w(f,"toString",function(){return"[object Generator]"}),(_=function(){return{w:i,m:y}})()}function w(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}w=function(t,e,r,n){function i(e,r){w(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},w(t,e,r,n)}function j(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function P(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){j(i,n,o,a,u,"next",t)}function u(t){j(i,n,o,a,u,"throw",t)}a(void 0)})}}function L(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,k(n.key),n)}}function k(t){var e=function(t){if("object"!=O(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=O(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==O(e)?e:e+""}function I(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(I=function(){return!!t})()}function E(t){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},E(t)}function D(t,e){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},D(t,e)}var T=function(t){function e(t,r,n){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=function(t,e,r){return e=E(e),function(t,e){if(e&&("object"==O(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,I()?Reflect.construct(e,r||[],E(t).constructor):e.apply(t,r))}(this,e,[t,r,n]))._datasetSourceMap=new Map,window._datasetSourceMap=o._datasetSourceMap,o._symbolLayerIds=new Set,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&D(t,e)}(e,t),r=e,n=[{key:"createDataset",value:function(t){return new g(t)}},{key:"init",value:(s=P(_().m(function t(){var e,r,n,o=this;return _().w(function(t){for(;;)switch(t.n){case 0:return e=S.Q.getPatternAndSymbolConfigs(),r=e.patternConfigs,n=e.symbolConfigs,t.n=1,this.addPatternsAndSymbolsToMap(r,n);case 1:return this._symbolLayerIds.clear(),S.Q.forEachDataset(function(t){return o._addLayers(t)}),t.n=2,new Promise(function(t){return o._map.once("idle",t)});case 2:return t.a(2)}},t,this)})),function(){return s.apply(this,arguments)})},{key:"removeLayer",value:function(t){this._map.getLayer(t)&&this._map.removeLayer(t),this._symbolLayerIds.delete(t)}},{key:"addPatternsAndSymbolsToMap",value:(c=P(_().m(function t(e,r){var n,o;return _().w(function(t){for(;;)if(0===t.n)return n=S.Q.mapStyle,o=n.id,t.a(2,Promise.all([this._mapProvider.addPatternsToMap(e,o,this._patternRegistry),this._mapProvider.addSymbolsToMap(r,n,this._symbolRegistry)]))},t,this)})),function(t,e){return c.apply(this,arguments)})},{key:"destroy",value:function(){var t=this,e=new Set;S.Q.forEachDataset(function(r){var n=r.sourceId;t._getLayersUsingSource(n).forEach(function(e){return t.removeLayer(e)}),!e.has(n)&&t._map.getSource(n)&&(t._map.removeSource(n),e.add(n))}),this._datasetSourceMap.clear()}},{key:"onMapStyleChange",value:(a=P(_().m(function t(){var e,r,n,o=this;return _().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,new Promise(function(t){return o._map.once("idle",t)});case 1:return e=S.Q.getPatternAndSymbolConfigs(),r=e.patternConfigs,n=e.symbolConfigs,t.n=2,this.addPatternsAndSymbolsToMap(r,n);case 2:this._symbolLayerIds.clear(),S.Q.forEachDataset(function(t){o._addLayers(t),o._applyFeatureFilter(t)}),this.dynamicSources.forEach(function(t){return t.reapply()});case 3:return t.a(2)}},t,this)})),function(){return a.apply(this,arguments)})},{key:"onMapSizeChange",value:(i=P(_().m(function t(){var e,r,n,o,i,a=this;return _().w(function(t){for(;;)switch(t.n){case 0:return e=S.Q.mapStyle,r=this._pixelRatio,n=S.Q.getPatternAndSymbolConfigs(),o=n.patternConfigs,i=n.symbolConfigs,t.n=1,this.addPatternsAndSymbolsToMap(o,i);case 1:if(this._pixelRatio===r){t.n=2;break}return t.a(2);case 2:S.Q.forEach(function(t){var n=t.fillLayerId,o=t.symbolLayerId;if(o&&a._symbolLayerIds.has(o)&&a._map.getLayer(o)){var i=a._symbolRegistry.getSymbolImageId(t.style,e,"normal",r);i&&a._map.setLayoutProperty(o,"icon-image",i)}else if(n&&a._map.getLayer(n)){var u=a._patternRegistry.getPatternImageId(t.style,e.id,r);u&&a._map.setPaintProperty(n,"fill-pattern",u)}});case 3:return t.a(2)}},t,this)})),function(){return i.apply(this,arguments)})},{key:"_registerPatternsAndSymbols",value:function(t){return this.addPatternsAndSymbolsToMap(t.patternConfigs,t.symbolConfigs)}},{key:"removeDataset",value:function(t){var e=this,r=S.Q.getDataset(t);if(r){var n=r.sourceId;r.layerIds.forEach(function(t){return e.removeLayer(t)}),!S.Q.topLevelDatasets().some(function(e){return e.id!==t&&e.sourceId===n})&&this._map.getSource(n)&&this._map.removeSource(n),this._datasetSourceMap.delete(t)}}},{key:"applyFeatureFilter",value:function(t){var e=S.Q.getDataset(t);e&&this._applyFeatureFilter(e)}},{key:"applyStyle",value:(o=P(_().m(function t(e){var r,n=this;return _().w(function(t){for(;;)switch(t.n){case 0:return(r=S.Q.getDataset(e)).layerIds.forEach(function(t){return n.removeLayer(t)}),t.n=1,this._registerPatternsAndSymbols(r);case 1:this._addLayers(r);case 2:return t.a(2)}},t,this)})),function(t){return o.apply(this,arguments)})},{key:"setData",value:function(t,e){var r=this._datasetSourceMap.get(t);if(r){var n=this._map.getSource(r);n&&"function"==typeof n.setData&&n.setData(e)}}},{key:"_addLayers",value:function(t){var e=S.Q.mapStyle,r=u(this._mapProvider,t,e,this._symbolRegistry,this._patternRegistry,this._pixelRatio);this._datasetSourceMap.set(t.id,r),this._maintainSymbolOrdering(t)}},{key:"_getFirstSymbolLayerId",value:function(){var t,e=this,r=this._map.getStyle();if(null==r||!r.layers)return null;var n=r.layers.find(function(t){return e._symbolLayerIds.has(t.id)});return null!==(t=null==n?void 0:n.id)&&void 0!==t?t:null}},{key:"_maintainSymbolOrdering",value:function(t){var e=this,r=(t=t.isSublayer?t.parent:t).layerIds.filter(function(t){return t&&e._map.getLayer(t)});r.forEach(function(t){var r;"symbol"===(null===(r=e._map.getLayer(t))||void 0===r?void 0:r.type)?e._symbolLayerIds.add(t):e._symbolLayerIds.delete(t)});var n=this._getFirstSymbolLayerId();n&&r.forEach(function(t){e._symbolLayerIds.has(t)||e._map.moveLayer(t,n)})}},{key:"_setLayerVisibility",value:function(t,e){this._map.getLayer(t)&&this._map.setLayoutProperty(t,"visibility",e)}},{key:"_applyFeatureFilter",value:function(t){var e=this;t.getLayersWithFilters().forEach(function(t){var r=t.layerIds,n=t.filter;r.forEach(function(t){e._map.getLayer(t)&&e._map.setFilter(t,n)})})}},{key:"_setLayerOpacity",value:function(t,e){var r=this._map.getLayer(t);if(r){var n={line:"line-opacity",symbol:"icon-opacity"}[r.type]||"fill-opacity";this._map.setPaintProperty(t,n,e)}}},{key:"_getLayersUsingSource",value:function(t){var e=this._map.getStyle();return null!=e&&e.layers?e.layers.filter(function(e){return e.source===t}).map(function(t){return t.id}):[]}}],n&&L(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o,i,a,c,s}(r(913).h)},416:function(t,e,r){r.d(e,{f:function(){return p}});var n=r(228);function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var i=function(t){var e,r=0,n=2166136261,i=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}(t);try{for(i.s();!(e=i.n()).done;){var a=e.value.codePointAt(0);r=Math.imul(r,31)+a,n=Math.imul(n^a,16777619)}}catch(t){i.e(t)}finally{i.f()}return(r>>>0).toString(36)+(n>>>0).toString(36)};function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function s(t){var e=function(t){if("object"!=a(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:e+""}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(l=function(){return!!t})()}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function y(t,e){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},y(t,e)}var p=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,r){return e=f(e),function(t,e){if(e&&("object"==a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,l()?Reflect.construct(e,r||[],f(t).constructor):e.apply(t,r))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&y(t,e)}(e,t),r=e,n=[{key:"_hiddenFeaturesIdExpression",get:function(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.hiddenFeaturesIdExpression:this.idProperty?["to-string",["get",this.idProperty]]:["to-string",["id"]]}},{key:"_hiddenFeaturesFilter",get:function(){var t,e=null===(t=this.hiddenFeatures)||void 0===t?void 0:t.filter(function(t){return-1!==t});return null!=e&&e.length?["!",["in",this._hiddenFeaturesIdExpression,["literal",e.map(String)]]]:null}},{key:"filter",get:function(){var t,e=["all"];null!==(t=this.parent)&&void 0!==t&&t.filter&&e.push(this.parent.filter),this._datasetDefinition.filter&&e.push(this._datasetDefinition.filter);var r=this._hiddenFeaturesFilter;return r&&e.push(r),1===e.length?null:e.length>2?e:e[1]}},{key:"leafLayerIds",get:function(){return[]}},{key:"layerIds",get:function(){return this.hasSublayers?this.sublayers.flatMap(function(t){return t.layerIds}).filter(Boolean):this.leafLayerIds}},{key:"getLayersWithValue",value:function(t){var e,r,n,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];if(!1===o||this[o]){var a=this.leafLayerIds;if(a.length){var c=this[t];i.push((e={layerIds:a},n=c,(r=s(r=t))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e))}}return this.hasSublayers&&this.sublayers.forEach(function(e){if(!1===o||e[o]){var r=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e.getLayersWithValue(t),1)[0];r&&i.push(r)}}),i}},{key:"getLayersWithVisibility",value:function(){return this.getLayersWithValue("visibility")}},{key:"getLayersWithOpacity",value:function(){return this.getLayersWithValue("opacity")}},{key:"getLayersWithFilters",value:function(){return this.getLayersWithValue("filter","hasHiddenFeatures")}},{key:"sourceId",get:function(){if(this.isSublayer)return this.parent.sourceId;if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.sourceId;if(this.tiles){var t=Array.isArray(this.tiles)?this.tiles.join(","):this.tiles;return"tiles-".concat(i(t))}return this.geojson?"string"==typeof this.geojson?"geojson-".concat(i(this.geojson)):"geojson-".concat(this.id):"source-".concat(this.id)}}],n&&c(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(n.j)},247:function(t,e,r){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}r.d(e,{o:function(){return o}});var o=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===n(t)){if(e&&t[e])return t[e];var r=Object.values(t)[0];return null!=r?r:null}return null}}}]);
|