@defra/interactive-map 0.0.29-alpha → 0.0.31-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/dist/css/index.css +1 -1
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/im-shell.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api/context.md +4 -4
- package/docs/api.md +111 -37
- package/docs/assets/css/docusaurus.scss +20 -4
- package/docs/assets/images/basic-map.jpg +0 -0
- package/docs/assets/images/button-first.jpg +0 -0
- package/docs/assets/images/deuteranopia-ozs-map-thumb.jpg +0 -0
- package/docs/assets/images/draw.jpg +0 -0
- package/docs/assets/images/marker-panel.jpg +0 -0
- package/docs/assets/images/night-ozs-map-thumb.jpg +0 -0
- package/docs/assets/images/outdoor-ozs-map-thumb.jpg +0 -0
- package/docs/assets/images/search.jpg +0 -0
- package/docs/assets/images/select-feature.jpg +0 -0
- package/docs/assets/images/style-switcher.jpg +0 -0
- package/docs/assets/images/toggle-marker-label.jpg +0 -0
- package/docs/assets/images/tritanopia-ozs-map-thumb.jpg +0 -0
- package/docs/examples/add-marker-with-panel.mdx +2 -2
- package/docs/examples/basic-map.mdx +2 -2
- package/docs/examples/draw.mdx +271 -0
- package/docs/examples/index.mdx +58 -10
- package/docs/examples/search-control.mdx +71 -0
- package/docs/examples/select-feature.mdx +146 -0
- package/docs/examples/style-switcher.mdx +135 -0
- package/docs/examples/toggle-marker-label.mdx +3 -3
- package/docs/plugins/datasets.md +15 -28
- package/docusaurus.config.cjs +5 -1
- package/package.json +1 -1
- package/plugins/beta/datasets/dist/css/index.css +4 -0
- package/plugins/beta/datasets/dist/esm/im-datasets-ml-adapter.js +1 -0
- package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -1
- package/plugins/beta/datasets/dist/esm/index.js +1 -1
- package/plugins/beta/datasets/dist/umd/im-datasets-ml-adapter.js +2 -0
- package/plugins/beta/datasets/dist/umd/im-datasets-plugin.js +2 -0
- package/plugins/beta/datasets/dist/umd/index.js +2 -0
- package/plugins/beta/datasets/src/adapters/loadLayerAdapter.js +33 -0
- package/plugins/beta/datasets/src/adapters/maplibre/layerBuilders.js +44 -120
- package/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +145 -245
- package/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +516 -0
- package/plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.js +191 -0
- package/plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +441 -0
- package/plugins/beta/datasets/src/api/addDataset.js +2 -5
- package/plugins/beta/datasets/src/api/addDataset.test.js +16 -0
- package/plugins/beta/datasets/src/api/getOpacity.js +14 -14
- package/plugins/beta/datasets/src/api/getOpacity.test.js +72 -0
- package/plugins/beta/datasets/src/api/getStyle.js +8 -9
- package/plugins/beta/datasets/src/api/getStyle.test.js +42 -0
- package/plugins/beta/datasets/src/api/removeDataset.js +7 -7
- package/plugins/beta/datasets/src/api/removeDataset.test.js +45 -0
- package/plugins/beta/datasets/src/api/setData.js +9 -3
- package/plugins/beta/datasets/src/api/setData.test.js +62 -0
- package/plugins/beta/datasets/src/api/setDatasetVisibility.js +5 -30
- package/plugins/beta/datasets/src/api/setDatasetVisibility.test.js +31 -0
- package/plugins/beta/datasets/src/api/setFeatureVisibility.js +3 -21
- package/plugins/beta/datasets/src/api/setFeatureVisibility.test.js +32 -0
- package/plugins/beta/datasets/src/api/setGlobals.js +20 -0
- package/plugins/beta/datasets/src/api/setGlobals.test.js +63 -0
- package/plugins/beta/datasets/src/api/setOpacity.js +8 -27
- package/plugins/beta/datasets/src/api/setOpacity.test.js +31 -0
- package/plugins/beta/datasets/src/api/setStyle.js +5 -21
- package/plugins/beta/datasets/src/api/setStyle.test.js +53 -0
- package/plugins/beta/datasets/src/components/Key/Key.jsx +51 -0
- package/plugins/beta/datasets/src/components/Key/KeyGroupItem.jsx +18 -0
- package/plugins/beta/datasets/src/components/Key/KeyItem.jsx +20 -0
- package/plugins/beta/datasets/src/components/Key/KeySvg.jsx +22 -0
- package/plugins/beta/datasets/src/components/Key/KeySvg.test.jsx +87 -0
- package/plugins/beta/datasets/src/components/Key/KeySvgLine.jsx +19 -0
- package/plugins/beta/datasets/src/components/Key/KeySvgLine.test.jsx +71 -0
- package/plugins/beta/datasets/src/components/{KeySvgPattern.jsx → Key/KeySvgPattern.jsx} +3 -4
- package/plugins/beta/datasets/src/components/Key/KeySvgPattern.test.jsx +55 -0
- package/plugins/beta/datasets/src/components/Key/KeySvgRect.jsx +22 -0
- package/plugins/beta/datasets/src/components/Key/KeySvgRect.test.jsx +85 -0
- package/plugins/beta/datasets/src/components/{KeySvgSymbol.jsx → Key/KeySvgSymbol.jsx} +5 -5
- package/plugins/beta/datasets/src/components/Key/KeySvgSymbol.test.jsx +80 -0
- package/plugins/beta/datasets/src/components/Key/svgProperties.test.js +61 -0
- package/plugins/beta/datasets/src/{panels → components/LayersMenu}/Layers.module.scss +4 -0
- package/plugins/beta/datasets/src/components/LayersMenu/LayersMenu.jsx +33 -0
- package/plugins/beta/datasets/src/components/LayersMenu/LayersMenuCheckbox.jsx +31 -0
- package/plugins/beta/datasets/src/components/LayersMenu/LayersMenuGroupWrapper.jsx +19 -0
- package/plugins/beta/datasets/src/datasets.scss +2 -2
- package/plugins/beta/datasets/src/fetch/createDynamicSource.js +8 -8
- package/plugins/beta/datasets/src/{DatasetsInit.jsx → initialise/DatasetsInit.jsx} +19 -21
- package/plugins/beta/datasets/src/{defaults.js → initialise/defaults.js} +17 -2
- package/plugins/beta/datasets/src/initialise/defaults.test.js +127 -0
- package/plugins/beta/datasets/src/{datasets.js → initialise/initialiseDatasets.js} +30 -26
- package/plugins/beta/datasets/src/initialise/initialiseDatasets.test.js +273 -0
- package/plugins/beta/datasets/src/manifest.js +8 -6
- package/plugins/beta/datasets/src/reducers/__data__/demoDatasets.js +253 -0
- package/plugins/beta/datasets/src/reducers/datasetsToMenu.js +78 -0
- package/plugins/beta/datasets/src/reducers/datasetsToMenu.test.js +35 -0
- package/plugins/beta/datasets/src/reducers/mappedDatasetsReducer.js +34 -0
- package/plugins/beta/datasets/src/reducers/mappedDatasetsReducer.test.js +117 -0
- package/plugins/beta/datasets/src/reducers/pluginState.js +206 -0
- package/plugins/beta/datasets/src/reducers/pluginState.test.js +386 -0
- package/plugins/beta/datasets/src/registry/__mocks__/datasetRegistry.js +29 -0
- package/plugins/beta/datasets/src/registry/createDataset.js +5 -0
- package/plugins/beta/datasets/src/registry/dataset.js +172 -0
- package/plugins/beta/datasets/src/registry/dataset.test.js +483 -0
- package/plugins/beta/datasets/src/registry/datasetDefinitionCache.js +35 -0
- package/plugins/beta/datasets/src/registry/datasetRegistry.js +116 -0
- package/plugins/beta/datasets/src/registry/datasetRegistry.test.js +335 -0
- package/plugins/beta/datasets/src/registry/dynamicGeoJson.js +17 -0
- package/plugins/beta/datasets/src/registry/globalDataset.js +36 -0
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/src/events.js +13 -1
- package/plugins/beta/draw-ml/src/index.js +1 -1
- package/plugins/beta/draw-ml/src/manifest.js +3 -0
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/src/InteractInit.jsx +2 -2
- package/plugins/interact/src/InteractInit.test.js +1 -1
- package/plugins/interact/src/events.js +2 -29
- package/plugins/interact/src/events.test.js +4 -102
- package/plugins/interact/src/hooks/useAttachEvents.js +3 -4
- package/plugins/interact/src/hooks/useAttachEvents.test.js +1 -3
- package/plugins/interact/src/hooks/useInteractionHandlers.js +10 -1
- package/plugins/interact/src/hooks/useInteractionHandlers.test.js +23 -4
- package/plugins/interact/src/manifest.js +0 -35
- package/plugins/interact/src/manifest.test.js +3 -43
- package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
- package/providers/beta/esri/src/esriProvider.js +4 -0
- package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/src/openlayersProvider.js +4 -0
- package/providers/beta/openlayers/src/openlayersProvider.test.js +5 -0
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/src/maplibreProvider.js +6 -4
- package/providers/maplibre/src/maplibreProvider.test.js +5 -0
- package/providers/maplibre/src/utils/highlightFeatures.js +74 -25
- package/providers/maplibre/src/utils/highlightFeatures.test.js +132 -0
- package/providers/maplibre/src/utils/patternImages.js +2 -4
- package/providers/maplibre/src/utils/symbolImages.js +1 -4
- package/rollup.esm.mjs +2 -8
- package/src/App/components/MapButton/MapButton.jsx +16 -1
- package/src/App/components/MapButton/MapButton.module.scss +12 -1
- package/src/App/components/MapButton/MapButton.test.jsx +40 -1
- package/src/App/components/Tooltip/getTooltipPosition.js +2 -2
- package/src/App/hooks/useContinueEnabledEvaluator.js +31 -0
- package/src/App/hooks/useContinueEnabledEvaluator.test.js +118 -0
- package/src/App/hooks/useEvaluateProp.js +15 -15
- package/src/App/hooks/useEvaluateProp.test.js +80 -76
- package/src/App/hooks/useLayoutMeasurements.js +1 -3
- package/src/App/hooks/useResizeObserver.js +12 -1
- package/src/App/hooks/useResizeObserver.test.js +1 -0
- package/src/App/renderer/PluginInits.jsx +2 -0
- package/src/App/renderer/mapButtons.js +21 -1
- package/src/App/renderer/mapButtons.test.js +46 -1
- package/src/App/store/appReducer.js +1 -1
- package/src/App/store/appReducer.test.js +37 -0
- package/src/InteractiveMap/InteractiveMap.js +10 -0
- package/src/InteractiveMap/InteractiveMap.test.js +8 -0
- package/src/InteractiveMap/polyfills.js +37 -6
- package/src/InteractiveMap/polyfills.test.js +132 -101
- package/src/config/appConfig.js +25 -0
- package/src/config/appConfig.test.js +50 -0
- package/src/config/defaults.js +1 -0
- package/src/scss/settings/_dimensions.scss +1 -0
- package/src/services/patternRegistry.js +8 -4
- package/src/types.js +7 -0
- package/src/utils/patternUtils.js +1 -2
- package/src/utils/patternUtils.test.js +9 -0
- package/webpack.dev.mjs +10 -0
- package/webpack.umd.mjs +1 -1
- package/plugins/beta/datasets/dist/adapters/maplibre/esm/im-datasets-ml-adapter.js +0 -1
- package/plugins/beta/datasets/dist/adapters/maplibre/esm/index.js +0 -1
- package/plugins/beta/datasets/dist/umd/maplibre/im-datasets-maplibre-adapter.js +0 -2
- package/plugins/beta/datasets/dist/umd/maplibre/im-datasets-plugin.js +0 -2
- package/plugins/beta/datasets/dist/umd/maplibre/index.js +0 -2
- package/plugins/beta/datasets/src/adapters/maplibre/index.js +0 -18
- package/plugins/beta/datasets/src/adapters/maplibre/layerIds.js +0 -75
- package/plugins/beta/datasets/src/adapters/maplibre/patternImages.js +0 -27
- package/plugins/beta/datasets/src/adapters/maplibre/symbolImages.js +0 -31
- package/plugins/beta/datasets/src/components/KeySvg.jsx +0 -24
- package/plugins/beta/datasets/src/components/KeySvgLine.jsx +0 -19
- package/plugins/beta/datasets/src/components/KeySvgRect.jsx +0 -22
- package/plugins/beta/datasets/src/index.maplibre.umd.js +0 -23
- package/plugins/beta/datasets/src/panels/Key.jsx +0 -62
- package/plugins/beta/datasets/src/panels/Layers.jsx +0 -141
- package/plugins/beta/datasets/src/reducer.js +0 -219
- package/plugins/beta/datasets/src/reducers/keyReducer.js +0 -34
- package/plugins/beta/datasets/src/utils/filters.js +0 -34
- package/plugins/beta/datasets/src/utils/mergeSublayer.js +0 -86
- package/plugins/beta/draw-ml/dist/css/index.css +0 -21
- /package/plugins/beta/datasets/dist/umd/{maplibre/im-datasets-maplibre-adapter.js.LICENSE.txt → im-datasets-ml-adapter.js.LICENSE.txt} +0 -0
- /package/plugins/beta/datasets/dist/umd/{maplibre/im-datasets-plugin.js.LICENSE.txt → im-datasets-plugin.js.LICENSE.txt} +0 -0
- /package/plugins/beta/datasets/dist/umd/{maplibre/index.js.LICENSE.txt → index.js.LICENSE.txt} +0 -0
- /package/plugins/beta/datasets/src/components/{EmptyKey.jsx → Key/EmptyKey.jsx} +0 -0
- /package/plugins/beta/datasets/src/components/{EmptyKey.test.jsx → Key/EmptyKey.test.jsx} +0 -0
- /package/plugins/beta/datasets/src/{panels → components/Key}/Key.module.scss +0 -0
- /package/plugins/beta/datasets/src/components/{svgProperties.js → Key/svgProperties.js} +0 -0
|
@@ -1,127 +1,158 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/
|
|
2
|
+
const originalCryptoUUID = crypto.randomUUID
|
|
3
|
+
const originalCreateObjectURL = URL.createObjectURL
|
|
4
|
+
const originalHasOwn = Object.hasOwn
|
|
5
|
+
const originalWorker = globalThis.Worker
|
|
6
|
+
const signalProto = Object.getPrototypeOf(new AbortController().signal)
|
|
7
|
+
const originalThrowIfAborted = signalProto.throwIfAborted
|
|
8
|
+
|
|
9
|
+
beforeEach(() => { jest.resetModules() })
|
|
10
|
+
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
Object.defineProperty(crypto, 'randomUUID', { value: originalCryptoUUID, configurable: true, writable: true })
|
|
13
|
+
URL.createObjectURL = originalCreateObjectURL
|
|
14
|
+
Object.hasOwn = originalHasOwn
|
|
15
|
+
globalThis.Worker = originalWorker
|
|
16
|
+
if (originalThrowIfAborted) {
|
|
17
|
+
signalProto.throwIfAborted = originalThrowIfAborted
|
|
18
|
+
} else {
|
|
19
|
+
delete signalProto.throwIfAborted
|
|
20
|
+
}
|
|
21
|
+
})
|
|
3
22
|
|
|
4
|
-
|
|
5
|
-
const originalCreateObjectURL = URL.createObjectURL
|
|
6
|
-
const signalProto = Object.getPrototypeOf(new AbortController().signal)
|
|
7
|
-
const originalThrowIfAborted = signalProto.throwIfAborted
|
|
23
|
+
const load = () => jest.isolateModules(() => require('./polyfills.js'))
|
|
8
24
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
25
|
+
const readBlobText = (blob) => new Promise((resolve) => {
|
|
26
|
+
const reader = new FileReader()
|
|
27
|
+
reader.onload = () => resolve(reader.result)
|
|
28
|
+
reader.readAsText(blob) // NOSONAR: Blob#text() is not available in this jsdom version
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
// ─── crypto.randomUUID ───────────────────────────────────────────────────────
|
|
12
32
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
value: originalCryptoUUID,
|
|
16
|
-
configurable: true,
|
|
17
|
-
writable: true
|
|
18
|
-
})
|
|
33
|
+
describe('crypto.randomUUID', () => {
|
|
34
|
+
const nullifyUUID = () => Object.defineProperty(crypto, 'randomUUID', { value: null, configurable: true, writable: true })
|
|
19
35
|
|
|
20
|
-
|
|
36
|
+
test('polyfills crypto.randomUUID when missing', () => {
|
|
37
|
+
nullifyUUID()
|
|
38
|
+
load()
|
|
39
|
+
expect(typeof crypto.randomUUID).toBe('function')
|
|
40
|
+
expect(crypto.randomUUID()).toMatch(UUID_RE)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test('generates unique UUIDs', () => {
|
|
44
|
+
nullifyUUID()
|
|
45
|
+
load()
|
|
46
|
+
const ids = new Set(Array.from({ length: 100 }, () => crypto.randomUUID()))
|
|
47
|
+
expect(ids.size).toBe(100)
|
|
48
|
+
})
|
|
21
49
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
delete signalProto.throwIfAborted
|
|
26
|
-
}
|
|
50
|
+
test('does not overwrite existing crypto.randomUUID', () => {
|
|
51
|
+
load()
|
|
52
|
+
expect(crypto.randomUUID).toBe(originalCryptoUUID)
|
|
27
53
|
})
|
|
54
|
+
})
|
|
28
55
|
|
|
29
|
-
|
|
56
|
+
// ─── Object.hasOwn ───────────────────────────────────────────────────────────
|
|
30
57
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
58
|
+
describe('Object.hasOwn', () => {
|
|
59
|
+
test('polyfills Object.hasOwn when missing', () => {
|
|
60
|
+
delete Object.hasOwn
|
|
61
|
+
load()
|
|
62
|
+
expect(typeof Object.hasOwn).toBe('function')
|
|
63
|
+
expect(Object.hasOwn({ a: 1 }, 'a')).toBe(true)
|
|
64
|
+
expect(Object.hasOwn({ a: 1 }, 'b')).toBe(false)
|
|
36
65
|
})
|
|
37
66
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
value: undefined,
|
|
42
|
-
configurable: true,
|
|
43
|
-
writable: true
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
load()
|
|
47
|
-
|
|
48
|
-
expect(typeof crypto.randomUUID).toBe('function')
|
|
49
|
-
expect(crypto.randomUUID()).toMatch(UUID_RE)
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
test('crypto.randomUUID generates unique UUIDs', () => {
|
|
53
|
-
Object.defineProperty(crypto, 'randomUUID', {
|
|
54
|
-
value: undefined,
|
|
55
|
-
configurable: true,
|
|
56
|
-
writable: true
|
|
57
|
-
})
|
|
58
|
-
load()
|
|
59
|
-
const ids = new Set(Array.from({ length: 100 }, () => crypto.randomUUID()))
|
|
60
|
-
expect(ids.size).toBe(100)
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
test('does not overwrite existing crypto.randomUUID', () => {
|
|
64
|
-
const fake = jest.fn(() => 'fake')
|
|
65
|
-
Object.defineProperty(crypto, 'randomUUID', {
|
|
66
|
-
value: fake,
|
|
67
|
-
configurable: true,
|
|
68
|
-
writable: true
|
|
69
|
-
})
|
|
70
|
-
load()
|
|
71
|
-
expect(crypto.randomUUID).toBe(fake)
|
|
72
|
-
})
|
|
67
|
+
test('does not overwrite existing Object.hasOwn', () => {
|
|
68
|
+
load()
|
|
69
|
+
expect(Object.hasOwn).toBe(originalHasOwn)
|
|
73
70
|
})
|
|
71
|
+
})
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
test('throws AbortError when aborted (True branch)', () => {
|
|
77
|
-
delete signalProto.throwIfAborted
|
|
78
|
-
load()
|
|
79
|
-
const ac = new AbortController()
|
|
80
|
-
ac.abort()
|
|
81
|
-
expect(() => ac.signal.throwIfAborted()).toThrow('The operation was aborted.')
|
|
82
|
-
})
|
|
73
|
+
// ─── AbortSignal.throwIfAborted ───────────────────────────────────────────────
|
|
83
74
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
load()
|
|
87
|
-
const ac = new AbortController()
|
|
88
|
-
// This call should execute line 20, see that aborted is false, and return undefined
|
|
89
|
-
expect(() => ac.signal.throwIfAborted()).not.toThrow()
|
|
90
|
-
})
|
|
75
|
+
describe('AbortSignal.throwIfAborted', () => {
|
|
76
|
+
beforeEach(() => { delete signalProto.throwIfAborted })
|
|
91
77
|
|
|
92
|
-
|
|
93
|
-
|
|
78
|
+
test('throws AbortError when aborted', () => {
|
|
79
|
+
load()
|
|
80
|
+
const ac = new AbortController()
|
|
81
|
+
ac.abort()
|
|
82
|
+
expect(() => ac.signal.throwIfAborted()).toThrow('The operation was aborted.')
|
|
83
|
+
})
|
|
94
84
|
|
|
95
|
-
|
|
96
|
-
|
|
85
|
+
test('does nothing when not aborted', () => {
|
|
86
|
+
load()
|
|
87
|
+
expect(() => new AbortController().signal.throwIfAborted()).not.toThrow()
|
|
88
|
+
})
|
|
97
89
|
|
|
98
|
-
|
|
90
|
+
test('wraps URL.createObjectURL for JS blobs', async () => {
|
|
91
|
+
const mockCreate = jest.fn(() => 'blob:mock')
|
|
92
|
+
URL.createObjectURL = mockCreate
|
|
93
|
+
load()
|
|
99
94
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
URL.createObjectURL(new Blob(['console.log(1)'], { type: 'text/javascript' }))
|
|
96
|
+
const text = await readBlobText(mockCreate.mock.calls[0][0])
|
|
97
|
+
expect(text).toContain('throwIfAborted')
|
|
98
|
+
expect(text).toContain('console.log(1)')
|
|
99
|
+
})
|
|
103
100
|
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
test('does not wrap URL.createObjectURL for non-JS blobs', () => {
|
|
102
|
+
const mockCreate = jest.fn(() => 'blob:mock')
|
|
103
|
+
URL.createObjectURL = mockCreate
|
|
104
|
+
load()
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
const blob = new Blob(['{}'], { type: 'application/json' })
|
|
107
|
+
URL.createObjectURL(blob)
|
|
108
|
+
expect(mockCreate).toHaveBeenCalledWith(blob)
|
|
109
|
+
})
|
|
110
|
+
})
|
|
109
111
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
// ─── Worker constructor (string workerUrl) ────────────────────────────────────
|
|
113
|
+
|
|
114
|
+
describe('Worker constructor (string workerUrl)', () => {
|
|
115
|
+
beforeEach(() => { delete Object.hasOwn })
|
|
116
|
+
|
|
117
|
+
const setupWorkerMock = () => {
|
|
118
|
+
const MockWorker = jest.fn()
|
|
119
|
+
MockWorker.prototype = {}
|
|
120
|
+
globalThis.Worker = MockWorker
|
|
121
|
+
return MockWorker
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
test('wraps Worker with string URL to inject polyfill via importScripts', async () => {
|
|
125
|
+
const MockWorker = setupWorkerMock()
|
|
126
|
+
const mockCreate = jest.fn(() => 'blob:injected')
|
|
127
|
+
URL.createObjectURL = mockCreate
|
|
128
|
+
load()
|
|
129
|
+
|
|
130
|
+
// eslint-disable-next-line no-new
|
|
131
|
+
new Worker('/worker.js') // NOSONAR
|
|
132
|
+
const text = await readBlobText(mockCreate.mock.calls[0][0])
|
|
133
|
+
expect(text).toContain('Object.hasOwn')
|
|
134
|
+
expect(text).toContain('importScripts("/worker.js")')
|
|
135
|
+
expect(MockWorker).toHaveBeenCalledWith('blob:injected', undefined)
|
|
136
|
+
})
|
|
113
137
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
138
|
+
test('passes blob URLs through without wrapping', () => {
|
|
139
|
+
const MockWorker = setupWorkerMock()
|
|
140
|
+
const mockCreate = jest.fn(() => 'blob:new')
|
|
141
|
+
URL.createObjectURL = mockCreate
|
|
142
|
+
load()
|
|
118
143
|
|
|
119
|
-
|
|
144
|
+
// eslint-disable-next-line no-new
|
|
145
|
+
new Worker('blob:http://localhost/existing') // NOSONAR
|
|
146
|
+
expect(mockCreate).not.toHaveBeenCalled()
|
|
147
|
+
expect(MockWorker).toHaveBeenCalledWith('blob:http://localhost/existing', undefined)
|
|
148
|
+
})
|
|
120
149
|
|
|
121
|
-
|
|
122
|
-
|
|
150
|
+
test('preserves the Worker prototype', () => {
|
|
151
|
+
const MockWorker = setupWorkerMock()
|
|
152
|
+
const mockProto = { foo: 'bar' }
|
|
153
|
+
MockWorker.prototype = mockProto
|
|
154
|
+
load()
|
|
123
155
|
|
|
124
|
-
|
|
125
|
-
})
|
|
156
|
+
expect(Worker.prototype).toBe(mockProto)
|
|
126
157
|
})
|
|
127
158
|
})
|
package/src/config/appConfig.js
CHANGED
|
@@ -17,9 +17,34 @@ const exitButtonSlots = {
|
|
|
17
17
|
showLabel: false
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
const journeyBackSlots = { slot: 'actions', showLabel: true }
|
|
21
|
+
const journeyContinueSlots = { slot: 'actions', showLabel: true, order: 10 }
|
|
22
|
+
|
|
20
23
|
// Default app buttons, panels and icons
|
|
21
24
|
export const defaultAppConfig = {
|
|
22
25
|
buttons: [{
|
|
26
|
+
id: 'journeyBack',
|
|
27
|
+
label: ({ appConfig }) => appConfig.backAndContinue?.backLabel,
|
|
28
|
+
variant: 'tertiary',
|
|
29
|
+
onClick: (_e, { appConfig, services }) =>
|
|
30
|
+
appConfig.behaviour === 'mapOnly' ? globalThis.history.back() : services.closeApp(),
|
|
31
|
+
excludeWhen: ({ appConfig, appState }) =>
|
|
32
|
+
!appConfig.backAndContinue?.backLabel ||
|
|
33
|
+
!appState.isFullscreen ||
|
|
34
|
+
(appConfig.behaviour === 'mapOnly' && globalThis.history.length <= 1),
|
|
35
|
+
mobile: journeyBackSlots,
|
|
36
|
+
tablet: journeyBackSlots,
|
|
37
|
+
desktop: journeyBackSlots
|
|
38
|
+
}, {
|
|
39
|
+
id: 'journeyContinue',
|
|
40
|
+
label: ({ appConfig }) => appConfig.backAndContinue?.continueLabel,
|
|
41
|
+
variant: 'primary',
|
|
42
|
+
onClick: (_e, { services, pluginStates, mapState }) => services.eventBus.emit('app:continue', { pluginStates, mapState }),
|
|
43
|
+
excludeWhen: ({ appConfig, appState }) => !appConfig.backAndContinue?.continueLabel || !appState.isFullscreen,
|
|
44
|
+
mobile: journeyContinueSlots,
|
|
45
|
+
tablet: journeyContinueSlots,
|
|
46
|
+
desktop: journeyContinueSlots
|
|
47
|
+
}, {
|
|
23
48
|
id: 'exit',
|
|
24
49
|
label: 'Exit',
|
|
25
50
|
iconId: 'close',
|
|
@@ -15,6 +15,8 @@ describe('defaultAppConfig', () => {
|
|
|
15
15
|
const buttons = defaultAppConfig.buttons
|
|
16
16
|
const fullscreenBtn = buttons.find(b => b.id === 'fullscreen')
|
|
17
17
|
const exitBtn = buttons.find(b => b.id === 'exit')
|
|
18
|
+
const journeyBackBtn = buttons.find(b => b.id === 'journeyBack')
|
|
19
|
+
const journeyContinueBtn = buttons.find(b => b.id === 'journeyContinue')
|
|
18
20
|
const zoomInBtn = buttons.find(b => b.id === 'zoomIn')
|
|
19
21
|
const zoomOutBtn = buttons.find(b => b.id === 'zoomOut')
|
|
20
22
|
|
|
@@ -49,6 +51,54 @@ describe('defaultAppConfig', () => {
|
|
|
49
51
|
expect(servicesMock.closeApp).toHaveBeenCalled()
|
|
50
52
|
})
|
|
51
53
|
|
|
54
|
+
// --- JOURNEY BACK BUTTON ---
|
|
55
|
+
it('covers all branches of journeyBack excludeWhen', () => {
|
|
56
|
+
const base = { appConfig: { backAndContinue: { backLabel: 'Back' }, behaviour: 'buttonFirst' }, appState: { isFullscreen: true } }
|
|
57
|
+
expect(journeyBackBtn.excludeWhen({ appConfig: { backAndContinue: null, behaviour: 'buttonFirst' }, appState: { isFullscreen: true } })).toBe(true)
|
|
58
|
+
expect(journeyBackBtn.excludeWhen({ appConfig: { backAndContinue: { backLabel: 'Back' }, behaviour: 'buttonFirst' }, appState: { isFullscreen: false } })).toBe(true)
|
|
59
|
+
expect(journeyBackBtn.excludeWhen({ appConfig: { backAndContinue: { backLabel: 'Back' }, behaviour: 'mapOnly' }, appState: { isFullscreen: true } })).toBe(globalThis.history.length <= 1)
|
|
60
|
+
expect(journeyBackBtn.excludeWhen(base)).toBe(false)
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it('journeyBack onClick calls history.back for mapOnly and closeApp otherwise', () => {
|
|
64
|
+
const historySpy = jest.spyOn(globalThis.history, 'back').mockImplementation(() => {})
|
|
65
|
+
const servicesMock = { closeApp: jest.fn() }
|
|
66
|
+
|
|
67
|
+
journeyBackBtn.onClick({}, { appConfig: { behaviour: 'mapOnly' }, services: servicesMock })
|
|
68
|
+
expect(historySpy).toHaveBeenCalled()
|
|
69
|
+
expect(servicesMock.closeApp).not.toHaveBeenCalled()
|
|
70
|
+
|
|
71
|
+
journeyBackBtn.onClick({}, { appConfig: { behaviour: 'buttonFirst' }, services: servicesMock })
|
|
72
|
+
expect(servicesMock.closeApp).toHaveBeenCalled()
|
|
73
|
+
|
|
74
|
+
historySpy.mockRestore()
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
// --- JOURNEY CONTINUE BUTTON ---
|
|
78
|
+
it('covers all branches of journeyContinue excludeWhen', () => {
|
|
79
|
+
expect(journeyContinueBtn.excludeWhen({ appConfig: { backAndContinue: null }, appState: { isFullscreen: true } })).toBe(true)
|
|
80
|
+
expect(journeyContinueBtn.excludeWhen({ appConfig: { backAndContinue: { continueLabel: 'Continue' } }, appState: { isFullscreen: false } })).toBe(true)
|
|
81
|
+
expect(journeyContinueBtn.excludeWhen({ appConfig: { backAndContinue: { continueLabel: 'Continue' } }, appState: { isFullscreen: true } })).toBe(false)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it('journeyBack label returns backLabel from config', () => {
|
|
85
|
+
expect(journeyBackBtn.label({ appConfig: { backAndContinue: { backLabel: 'Back' } } })).toBe('Back')
|
|
86
|
+
expect(journeyBackBtn.label({ appConfig: { backAndContinue: null } })).toBeUndefined()
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it('journeyContinue label returns continueLabel from config', () => {
|
|
90
|
+
expect(journeyContinueBtn.label({ appConfig: { backAndContinue: { continueLabel: 'Continue' } } })).toBe('Continue')
|
|
91
|
+
expect(journeyContinueBtn.label({ appConfig: { backAndContinue: null } })).toBeUndefined()
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it('journeyContinue onClick emits app:continue with pluginStates and mapState', () => {
|
|
95
|
+
const eventBusMock = { emit: jest.fn() }
|
|
96
|
+
const pluginStates = { interact: { selectedFeatures: [] } }
|
|
97
|
+
const mapState = { zoom: 12, center: [-1.5, 53.0] }
|
|
98
|
+
journeyContinueBtn.onClick({}, { services: { eventBus: eventBusMock }, pluginStates, mapState })
|
|
99
|
+
expect(eventBusMock.emit).toHaveBeenCalledWith('app:continue', { pluginStates, mapState })
|
|
100
|
+
})
|
|
101
|
+
|
|
52
102
|
// --- FULLSCREEN BUTTON (Line 39 Coverage) ---
|
|
53
103
|
it('evaluates fullscreen label and icon states', () => {
|
|
54
104
|
const containerMock = { requestFullscreen: jest.fn() }
|
package/src/config/defaults.js
CHANGED
|
@@ -19,6 +19,7 @@ const defaults = {
|
|
|
19
19
|
enableZoomControls: true,
|
|
20
20
|
genericErrorText: 'There was a problem loading the map. Please try again later.',
|
|
21
21
|
hasExitButton: false,
|
|
22
|
+
backAndContinue: null,
|
|
22
23
|
hybridWidth: null, // Defaults to maxMobileWidth if not set
|
|
23
24
|
keyboardHintText: '<span class="im-u-visually-hidden">Press </span><kbd>Shift</kbd> + <kbd>?</kbd> <span class="im-u-visually-hidden">to view </span>keyboard shortcuts',
|
|
24
25
|
mapLabel: 'Interactive map application',
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
|
|
44
44
|
// Action bar (Needs to fit evently if tools are in right hand column)
|
|
45
45
|
--action-bar-max-width: calc(100% - (var(--button-size) * 2) - (var(--primary-gap) * 4));
|
|
46
|
+
--action-button-min-width: 120px;
|
|
46
47
|
|
|
47
48
|
// Attributions
|
|
48
49
|
--attributions-padding: 2px 5px;
|
|
@@ -41,6 +41,13 @@ export const patternRegistry = {
|
|
|
41
41
|
patterns.clear()
|
|
42
42
|
},
|
|
43
43
|
|
|
44
|
+
initialise () {
|
|
45
|
+
// Seed built-in patterns
|
|
46
|
+
Object.entries(BUILT_IN_PATTERNS).forEach(([id, svgContent]) => {
|
|
47
|
+
this.register(id, svgContent)
|
|
48
|
+
})
|
|
49
|
+
},
|
|
50
|
+
|
|
44
51
|
/**
|
|
45
52
|
* Returns the raw (un-coloured) inner SVG content for a style's pattern.
|
|
46
53
|
* Precedence: inline fillPatternSvgContent → named fillPattern from registry.
|
|
@@ -102,7 +109,4 @@ export const patternRegistry = {
|
|
|
102
109
|
}
|
|
103
110
|
}
|
|
104
111
|
|
|
105
|
-
// Seed built-in patterns
|
|
106
|
-
Object.entries(BUILT_IN_PATTERNS).forEach(([id, svgContent]) => {
|
|
107
|
-
patternRegistry.register(id, svgContent)
|
|
108
|
-
})
|
|
112
|
+
patternRegistry.initialise() // Seed built-in patterns
|
package/src/types.js
CHANGED
|
@@ -680,6 +680,13 @@
|
|
|
680
680
|
* @property {string} [genericErrorText]
|
|
681
681
|
* Fallback error message shown when the map fails to load.
|
|
682
682
|
*
|
|
683
|
+
* @property {{ backLabel?: string, continueLabel?: string, continueEnabledWhen?: function }} [backAndContinue=null]
|
|
684
|
+
* When set, shows Back and/or Continue buttons in the actions bar when the map is fullscreen.
|
|
685
|
+
* Omit `backLabel` to suppress the Back button; omit `continueLabel` to suppress the Continue button.
|
|
686
|
+
* `continueEnabledWhen({ pluginStates, mapState })` is a reactive predicate that controls the enabled
|
|
687
|
+
* state of the Continue button — use this instead of `setContinueEnabled()` for declarative control.
|
|
688
|
+
* In `mapOnly` behaviour the Back button is hidden when there is no browser history to go back to.
|
|
689
|
+
*
|
|
683
690
|
* @property {boolean} [hasExitButton=false]
|
|
684
691
|
* Whether an exit map button is displayed when the app is fullscreen.
|
|
685
692
|
*
|
|
@@ -8,8 +8,7 @@ export const getEffectivePixelRatio = (pixelRatio) => Math.max(PATTERN_MIN_PIXEL
|
|
|
8
8
|
export const hashString = (str) => {
|
|
9
9
|
let hash = 0
|
|
10
10
|
for (const ch of str) {
|
|
11
|
-
hash = ((hash << 5) - hash) + ch.codePointAt(0)
|
|
12
|
-
hash = hash & hash
|
|
11
|
+
hash = Math.trunc(((hash << 5) - hash) + ch.codePointAt(0))
|
|
13
12
|
}
|
|
14
13
|
return Math.abs(hash).toString(36) // NOSONAR: base36 encoding for compact alphanumeric hash string
|
|
15
14
|
}
|
|
@@ -14,9 +14,18 @@ describe('hashString', () => {
|
|
|
14
14
|
expect(hashString('hello')).toBe(hashString('hello'))
|
|
15
15
|
})
|
|
16
16
|
|
|
17
|
+
it('returns the same hash for the same input', () => {
|
|
18
|
+
expect(hashString('https://tiles.example.com/{z}/{x}/{y}'))
|
|
19
|
+
.toBe(hashString('https://tiles.example.com/{z}/{x}/{y}'))
|
|
20
|
+
})
|
|
21
|
+
|
|
17
22
|
test('produces different values for different inputs', () => {
|
|
18
23
|
expect(hashString('a')).not.toBe(hashString('b'))
|
|
19
24
|
})
|
|
25
|
+
|
|
26
|
+
it('handles an empty string without throwing', () => {
|
|
27
|
+
expect(() => hashString('')).not.toThrow()
|
|
28
|
+
})
|
|
20
29
|
})
|
|
21
30
|
|
|
22
31
|
describe('injectColors', () => {
|
package/webpack.dev.mjs
CHANGED
|
@@ -24,6 +24,8 @@ export default {
|
|
|
24
24
|
planning: path.join(__dirname, 'demo/js/planning.js'),
|
|
25
25
|
'planning-ol': path.join(__dirname, 'demo/js/planning-ol.js'),
|
|
26
26
|
gep: path.join(__dirname, 'demo/js/gep.js'),
|
|
27
|
+
'ml-datasets': path.join(__dirname, 'demo/js/ml-datasets.js'),
|
|
28
|
+
esm: path.join(__dirname, 'demo/js/esm.js'),
|
|
27
29
|
multimap: path.join(__dirname, 'demo/js/multimap.js')
|
|
28
30
|
},
|
|
29
31
|
output: {
|
|
@@ -34,6 +36,14 @@ export default {
|
|
|
34
36
|
resolve: {
|
|
35
37
|
extensions: ['.tsx', '.ts', '.jsx', '.js'],
|
|
36
38
|
alias: {
|
|
39
|
+
// Redirect react imports to preact/compat so the dev build is consistent
|
|
40
|
+
// with the ESM dist, which externalises preact and aliases react at build time.
|
|
41
|
+
// Without this, the ESM dist chunks run on preact while the rest of the app
|
|
42
|
+
// runs on React — two incompatible reconcilers sharing one component tree.
|
|
43
|
+
react: path.resolve(__dirname, 'node_modules/preact/compat'),
|
|
44
|
+
'react-dom/client': path.resolve(__dirname, 'node_modules/preact/compat/client'),
|
|
45
|
+
'react-dom': path.resolve(__dirname, 'node_modules/preact/compat'),
|
|
46
|
+
'react/jsx-runtime': path.resolve(__dirname, 'node_modules/preact/jsx-runtime'),
|
|
37
47
|
// Force these to resolve from root node_modules, preventing nested copies
|
|
38
48
|
// inside geojson-rbush and mapbox-gl-snap from being bundled separately.
|
|
39
49
|
'@turf/meta': path.resolve(__dirname, 'node_modules/@turf/meta'),
|
package/webpack.umd.mjs
CHANGED
|
@@ -144,7 +144,7 @@ const ALL_BUILDS = [
|
|
|
144
144
|
{ entryPath: './plugins/beta/use-location/src/index.js', libraryPath: 'useLocationPlugin', outDir: 'plugins/beta/use-location/dist/umd' },
|
|
145
145
|
{ entryPath: './plugins/search/src/index.js', libraryPath: 'searchPlugin', outDir: 'plugins/search/dist/umd' },
|
|
146
146
|
{ entryPath: './plugins/interact/src/index.js', libraryPath: 'interactPlugin', outDir: 'plugins/interact/dist/umd' },
|
|
147
|
-
{ entryPath: './plugins/beta/datasets/src/index.
|
|
147
|
+
{ entryPath: './plugins/beta/datasets/src/index.js', libraryPath: 'datasetsPlugin', outDir: 'plugins/beta/datasets/dist/umd', cssOutDir: 'plugins/beta/datasets/dist' },
|
|
148
148
|
{ entryPath: './plugins/beta/map-styles/src/index.js', libraryPath: 'mapStylesPlugin', outDir: 'plugins/beta/map-styles/dist/umd' },
|
|
149
149
|
{ entryPath: './plugins/beta/draw-ml/src/index.js', libraryPath: 'drawMLPlugin', outDir: 'plugins/beta/draw-ml/dist/umd' },
|
|
150
150
|
{ entryPath: './plugins/beta/frame/src/index.js', libraryPath: 'framePlugin', outDir: 'plugins/beta/frame/dist/umd' }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/helpers/defineProperty";var r=(e,t,r,a,i)=>{if(e.getLayer(t)){var o=((e,t,r)=>{if(!r||0===r.length)return e;var a=["!",["in",t?["to-string",["get",t]]:["to-string",["id"]],["literal",r.map(String)]]];return e?["all",e,a]:a})(r,a,i);e.setFilter(t,o)}},a=e=>!(!e.fillPattern&&!e.fillPatternSvgContent),i=e=>"string"==typeof e.geojson&&!!e.idProperty&&"function"==typeof e.transformRequest,o=e=>{var t=0;for(var r of e)t=Math.trunc((t<<5)-t+r.codePointAt(0));return Math.abs(t).toString(36)},l=e=>{if(e.tiles){var t=Array.isArray(e.tiles)?e.tiles.join(","):e.tiles;return"tiles-".concat(o(t))}return e.geojson?i(e)?"geojson-dynamic-".concat(e.id):"string"==typeof e.geojson?"geojson-".concat(o(e.geojson)):"geojson-".concat(e.id):"source-".concat(e.id)},s=e=>{if((e=>!!e.symbol)(e))return{fillLayerId:null,strokeLayerId:null,symbolLayerId:e.id};var t=!!e.fill&&"transparent"!==e.fill||a(e),r=!!e.stroke,i=t?e.id:null,o=null;return r&&(o=t?"".concat(e.id,"-stroke"):e.id),{fillLayerId:i,strokeLayerId:o,symbolLayerId:null}},n=(e,t)=>({fillLayerId:"".concat(e,"-").concat(t),strokeLayerId:"".concat(e,"-").concat(t,"-stroke"),symbolLayerId:"".concat(e,"-").concat(t,"-symbol")}),y=e=>{var t;if(null!==(t=e.sublayers)&&void 0!==t&&t.length)return e.sublayers.flatMap(t=>{var{fillLayerId:r,strokeLayerId:a,symbolLayerId:i}=n(e.id,t.id);return[a,r,i]});var{fillLayerId:r,strokeLayerId:a,symbolLayerId:i}=s(e);return[a,r,i].filter(Boolean)},d=(e,t)=>{if(!e)return null;if("string"==typeof e)return e.trim();if("object"==typeof e){if(t&&e[t])return e[t];var r=Object.values(e)[0];return null!=r?r:null}return null},m=["stroke","fill","fillPattern","fillPatternSvgContent","symbol","symbolSvgContent"];function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}var u=(e,t)=>{return"symbolDescription"in t?t.symbolDescription:(r=t,m.some(e=>e in r)?void 0:e.symbolDescription);var r},c=(e,r)=>{var a,i,o,l,s,n,y,d,m,c,f,b,v,g,h,_,L,P=r.style||{},S=(_=e.filter,L=r.filter,_&&L?["all",_,L]:L||_||null);return function(e){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?p(Object(a),!0).forEach(function(r){t(e,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):p(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}({id:r.id,label:r.label,stroke:null!==(a=P.stroke)&&void 0!==a?a:e.stroke,strokeWidth:null!==(i=P.strokeWidth)&&void 0!==i?i:e.strokeWidth,strokeDashArray:null!==(o=P.strokeDashArray)&&void 0!==o?o:e.strokeDashArray,opacity:null!==(l=P.opacity)&&void 0!==l?l:e.opacity,keySymbolShape:null!==(s=P.keySymbolShape)&&void 0!==s?s:e.keySymbolShape,symbolDescription:u(e,P),showInKey:null!==(n=r.showInKey)&&void 0!==n?n:e.showInKey,showInMenu:null!==(y=r.showInMenu)&&void 0!==y&&y,filter:S,minZoom:e.minZoom,maxZoom:e.maxZoom,symbol:null!==(d=P.symbol)&&void 0!==d?d:e.symbol,symbolSvgContent:null!==(m=P.symbolSvgContent)&&void 0!==m?m:e.symbolSvgContent,symbolViewBox:null!==(c=P.symbolViewBox)&&void 0!==c?c:e.symbolViewBox,symbolAnchor:null!==(f=P.symbolAnchor)&&void 0!==f?f:e.symbolAnchor,symbolBackgroundColor:null!==(b=P.symbolBackgroundColor)&&void 0!==b?b:e.symbolBackgroundColor,symbolForegroundColor:null!==(v=P.symbolForegroundColor)&&void 0!==v?v:e.symbolForegroundColor,symbolHaloWidth:null!==(g=P.symbolHaloWidth)&&void 0!==g?g:e.symbolHaloWidth,symbolGraphic:null!==(h=P.symbolGraphic)&&void 0!==h?h:e.symbolGraphic},((e,t)=>{var r,a;return t.fillPattern||t.fillPatternSvgContent?{fillPattern:t.fillPattern,fillPatternSvgContent:t.fillPatternSvgContent,fillPatternForegroundColor:null!==(r=t.fillPatternForegroundColor)&&void 0!==r?r:e.fillPatternForegroundColor,fillPatternBackgroundColor:null!==(a=t.fillPatternBackgroundColor)&&void 0!==a?a:e.fillPatternBackgroundColor}:"fill"in t?{fill:t.fill}:{fill:e.fill,fillPattern:e.fillPattern,fillPatternSvgContent:e.fillPatternSvgContent,fillPatternForegroundColor:e.fillPatternForegroundColor,fillPatternBackgroundColor:e.fillPatternBackgroundColor}})(e,P))},f=(e,t)=>e.flatMap(e=>{var t,r=a(e)?[e]:[];return null!==(t=e.sublayers)&&void 0!==t&&t.length&&e.sublayers.forEach(t=>{var i=c(e,t);a(i)&&r.push(i)}),r}),b=e=>!(!e.symbol&&!e.symbolSvgContent),v=e=>{var[t,r]=e,a=(e=>e<=.25?"left":e>=.75?"right":"")(t),i=(e=>e<=.25?"top":e>=.75?"bottom":"")(r);return i+(a&&i?"-":"")+a||"center"},g=e=>e.flatMap(e=>{var t,r=b(e)?[e]:[];return null!==(t=e.sublayers)&&void 0!==t&&t.length&&e.sublayers.forEach(t=>{var a=c(e,t);b(a)&&r.push(a)}),r});function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function _(e){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?h(Object(a),!0).forEach(function(r){t(e,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):h(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var L=(e,t,r,i,o,l,s)=>{var{mapStyleId:n,patternRegistry:y,pixelRatio:m=1}=s;if(r&&!e.getLayer(r)&&(t.fill||a(t))){var p=a(t)?y.getPatternImageId(t,n,m):null,u=p?{"fill-pattern":p,"fill-opacity":t.opacity||1}:{"fill-color":d(t.fill,n),"fill-opacity":t.opacity||1};e.addLayer(_({id:r,type:"fill",source:i,"source-layer":o,minzoom:t.minZoom,maxzoom:t.maxZoom,layout:{visibility:l},paint:u},t.filter?{filter:t.filter}:{}))}},P=(e,t,r,a,i,o,l)=>{r&&t.stroke&&!e.getLayer(r)&&e.addLayer(_({id:r,type:"line",source:a,"source-layer":i,minzoom:t.minZoom,maxzoom:t.maxZoom,layout:{visibility:o},paint:_({"line-color":d(t.stroke,l),"line-width":t.strokeWidth||1,"line-opacity":t.opacity||1},t.strokeDashArray?{"line-dasharray":t.strokeDashArray}:{})},t.filter?{filter:t.filter}:{}))},S=(e,t,r,a,i,o,l)=>{var{mapStyle:s,symbolRegistry:n,pixelRatio:y}=l;if(r&&!e.getLayer(r)){var d=n.getSymbolDef(t);if(d){var m=n.getSymbolImageId(t,s,!1,y);if(m){var p=((e,t)=>{var r;return e.symbolAnchor?e.symbolAnchor:null!==(r=null==t?void 0:t.anchor)&&void 0!==r?r:[.5,.5]})(t,d);e.addLayer(_({id:r,type:"symbol",source:a,"source-layer":i,minzoom:t.minZoom,maxzoom:t.maxZoom,layout:{visibility:o,"icon-image":m,"icon-anchor":v(p),"icon-allow-overlap":!0}},t.filter?{filter:t.filter}:{}))}}}},I=(e,t,r,a,i,o)=>{var l,{mapStyle:s,symbolRegistry:y,patternRegistry:d,pixelRatio:m}=o,p=s.id,u=c(t,r),{fillLayerId:f,strokeLayerId:v,symbolLayerId:g}=n(t.id,r.id),h="hidden"===t.visibility,_="hidden"===(null===(l=t.sublayerVisibility)||void 0===l?void 0:l[r.id]),I=h||_?"none":"visible";b(u)&&y?S(e,u,g,a,i,I,{mapStyle:s,symbolRegistry:y,pixelRatio:m}):(L(e,u,f,a,i,I,{mapStyleId:p,patternRegistry:d,pixelRatio:m}),P(e,u,v,a,i,I,p))},R=(e,t,r,a,o,n)=>{var y,d,m=r.id,p=l(t);((e,t,r)=>{if(!e.getSource(r))if(t.tiles)e.addSource(r,{type:"vector",tiles:t.tiles,minzoom:t.minZoom||0,maxzoom:t.maxZoom||22});else if(t.geojson){var a=i(t)?{type:"FeatureCollection",features:[]}:t.geojson;e.addSource(r,{type:"geojson",data:a,generateId:!0})}})(e,t,p);var u=null!==(y=t.tiles)&&void 0!==y&&y.length?t.sourceLayer:void 0;if(null!==(d=t.sublayers)&&void 0!==d&&d.length)return t.sublayers.forEach(i=>{I(e,t,i,p,u,{mapStyle:r,symbolRegistry:a,patternRegistry:o,pixelRatio:n})}),p;var{fillLayerId:c,strokeLayerId:f,symbolLayerId:v}=s(t),g="hidden"===t.visibility?"none":"visible";return b(t)&&a?(S(e,t,v,p,u,g,{mapStyle:r,symbolRegistry:a,pixelRatio:n}),p):(L(e,t,c,p,u,g,{mapStyleId:m,patternRegistry:o,pixelRatio:n}),P(e,t,f,p,u,g,m),p)};class O{constructor(e,t,r){this._mapProvider=e,this._map=e.map,this._symbolRegistry=t,this._patternRegistry=r,this._datasetSourceMap=new Map,this._symbolLayerIds=new Set}init(t,r){var a=this;return e(function*(){var e=r.id;yield Promise.all([a._mapProvider.addPatternsToMap(f(t,a._patternRegistry),e,a._patternRegistry),a._mapProvider.addSymbolsToMap(g(t),r,a._symbolRegistry)]),a._symbolLayerIds.clear(),t.forEach(e=>a._addLayers(e,r)),yield new Promise(e=>a._map.once("idle",e))})()}destroy(e){var t=new Set;e.forEach(e=>{var r=l(e);this._getLayersUsingSource(r).forEach(e=>{this._map.getLayer(e)&&this._map.removeLayer(e)}),!t.has(r)&&this._map.getSource(r)&&(this._map.removeSource(r),t.add(r))}),this._datasetSourceMap.clear()}onStyleChange(t,r,a,i){var o=this;return e(function*(){yield new Promise(e=>o._map.once("idle",e));var e=r.id;yield Promise.all([o._mapProvider.addPatternsToMap(f(t,o._patternRegistry),e,o._patternRegistry),o._mapProvider.addSymbolsToMap(g(t),r,o._symbolRegistry)]),o._symbolLayerIds.clear(),t.forEach(e=>o._addLayers(e,r)),i.forEach(e=>e.reapply()),Object.entries(a).forEach(e=>{var[r,{idProperty:a,ids:i}]=e,l=t.find(e=>e.id===r);l&&o._applyFeatureFilter(l,a,i)})})()}onSizeChange(t,r){var i=this;return e(function*(){yield Promise.all([i._mapProvider.addSymbolsToMap(g(t),r,i._symbolRegistry),i._mapProvider.addPatternsToMap(f(t,i._patternRegistry),r.id,i._patternRegistry)]),t.forEach(e=>{var t;if(y(e).forEach(t=>{if(i._symbolLayerIds.has(t)&&i._map.getLayer(t)){var a=i._symbolRegistry.getSymbolImageId(e,r,!1,i._pixelRatio);a&&i._map.setLayoutProperty(t,"icon-image",a)}}),a(e)){var{fillLayerId:o}=s(e);if(i._map.getLayer(o)){var l=i._patternRegistry.getPatternImageId(e,r.id,i._pixelRatio);l&&i._map.setPaintProperty(o,"fill-pattern",l)}}null===(t=e.sublayers)||void 0===t||t.forEach(t=>{var o=c(e,t),{symbolLayerId:l,fillLayerId:s}=n(e.id,t.id);if(i._map.getLayer(l)){var y=i._symbolRegistry.getSymbolImageId(o,r,!1,i._pixelRatio);y&&i._map.setLayoutProperty(l,"icon-image",y)}if(a(o)&&i._map.getLayer(s)){var d=i._patternRegistry.getPatternImageId(o,r.id,i._pixelRatio);d&&i._map.setPaintProperty(s,"fill-pattern",d)}})})})()}addDataset(e,t){this._addLayers(e,t)}removeDataset(e,t){var r=l(e);y(e).forEach(e=>{this._map.getLayer(e)&&this._map.removeLayer(e),this._symbolLayerIds.delete(e)}),!t.some(t=>t.id!==e.id&&l(t)===r)&&this._map.getSource(r)&&this._map.removeSource(r),this._datasetSourceMap.delete(e.id)}showDataset(e){this._setDatasetVisibility(e,"visible")}hideDataset(e){this._setDatasetVisibility(e,"none")}showSublayer(e,t){var{fillLayerId:r,strokeLayerId:a,symbolLayerId:i}=n(e,t);[r,a,i].forEach(e=>{this._map.getLayer(e)&&this._map.setLayoutProperty(e,"visibility","visible")})}hideSublayer(e,t){var{fillLayerId:r,strokeLayerId:a,symbolLayerId:i}=n(e,t);[r,a,i].forEach(e=>{this._map.getLayer(e)&&this._map.setLayoutProperty(e,"visibility","none")})}showFeatures(e,t,r){this._applyFeatureFilter(e,t,r)}hideFeatures(e,t,r){this._applyFeatureFilter(e,t,r)}setStyle(t,r){var a=this;return e(function*(){var e=r.id;y(t).forEach(e=>{a._map.getLayer(e)&&a._map.removeLayer(e),a._symbolLayerIds.delete(e)}),yield Promise.all([a._mapProvider.addPatternsToMap(f([t],a._patternRegistry),e,a._patternRegistry),a._mapProvider.addSymbolsToMap(g([t]),r,a._symbolRegistry)]),a._addLayers(t,r)})()}setSublayerStyle(t,r,a){var i=this;return e(function*(){var e,o,l=a.id,s=i._pixelRatio,{fillLayerId:y,strokeLayerId:d,symbolLayerId:m}=n(t.id,r);[y,d,m].forEach(e=>{i._map.getLayer(e)&&i._map.removeLayer(e),i._symbolLayerIds.delete(e)});var p=null===(e=t.sublayers)||void 0===e?void 0:e.find(e=>e.id===r);if(p){yield Promise.all([i._mapProvider.addPatternsToMap(f([t],i._patternRegistry),l,i._patternRegistry),i._mapProvider.addSymbolsToMap(g([t]),a,i._symbolRegistry)]);var u=i._datasetSourceMap.get(t.id),c=null!==(o=t.tiles)&&void 0!==o&&o.length?t.sourceLayer:void 0;I(i._map,t,p,u,c,{mapStyle:a,symbolRegistry:i._symbolRegistry,patternRegistry:i._patternRegistry,pixelRatio:s}),i._maintainSymbolOrdering(t)}})()}setOpacity(e,t){var r=this._map.getStyle();null!=r&&r.layers&&r.layers.filter(t=>t.id===e||t.id.startsWith("".concat(e,"-"))).forEach(e=>this._setPaintOpacity(e.id,t))}setSublayerOpacity(e,t,r){var{fillLayerId:a,strokeLayerId:i}=n(e,t);this._setPaintOpacity(a,r),this._setPaintOpacity(i,r)}setData(e,t){var r=this._datasetSourceMap.get(e);if(r){var a=this._map.getSource(r);a&&"function"==typeof a.setData&&a.setData(t)}}get _pixelRatio(){return this._mapProvider.map.getPixelRatio()}_addLayers(e,t){var r=R(this._map,e,t,this._symbolRegistry,this._patternRegistry,this._pixelRatio);this._datasetSourceMap.set(e.id,r),this._maintainSymbolOrdering(e)}_getFirstSymbolLayerId(){var e,t=this._map.getStyle();if(null==t||!t.layers)return null;var r=t.layers.find(e=>this._symbolLayerIds.has(e.id));return null!==(e=null==r?void 0:r.id)&&void 0!==e?e:null}_maintainSymbolOrdering(e){var t=y(e).filter(e=>e&&this._map.getLayer(e));t.forEach(e=>{var t;"symbol"===(null===(t=this._map.getLayer(e))||void 0===t?void 0:t.type)?this._symbolLayerIds.add(e):this._symbolLayerIds.delete(e)});var r=this._getFirstSymbolLayerId();r&&t.forEach(e=>{this._symbolLayerIds.has(e)||this._map.moveLayer(e,r)})}_setDatasetVisibility(e,t){var r=this._map.getStyle();null!=r&&r.layers&&r.layers.filter(t=>t.id===e||t.id.startsWith("".concat(e,"-"))).forEach(e=>this._map.setLayoutProperty(e.id,"visibility",t))}_applyFeatureFilter(e,t,a){var i;if(null!==(i=e.sublayers)&&void 0!==i&&i.length)e.sublayers.forEach(i=>{var{fillLayerId:o,strokeLayerId:l}=n(e.id,i.id),s=e.filter&&i.filter?["all",e.filter,i.filter]:i.filter||e.filter||null;r(this._map,o,s,t,a),r(this._map,l,s,t,a)});else{var{fillLayerId:o,strokeLayerId:l,symbolLayerId:y}=s(e),d=e.filter||null;[o,l,y].filter(Boolean).forEach(e=>{r(this._map,e,d,t,a)})}}_setPaintOpacity(e,t){var r=this._map.getLayer(e);if(r){var a={line:"line-opacity",symbol:"icon-opacity"}[r.type]||"fill-opacity";this._map.setPaintProperty(e,a,t)}}_getLayersUsingSource(e){var t=this._map.getStyle();return null!=t&&t.layers?t.layers.filter(t=>t.source===e).map(e=>e.id):[]}}export{O as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var a={load:()=>import(/* webpackChunkName: "im-datasets-ml-adapter" */ "./im-datasets-ml-adapter.js")};export{a as maplibreLayerAdapter};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see im-datasets-maplibre-adapter.js.LICENSE.txt */
|
|
2
|
-
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[580],{132(t,r,e){e.r(r),e.d(r,{default:()=>F});var o=function(t,r,e,o,n){if(t.getLayer(r)){var i=function(t,r,e){if(!e||0===e.length)return t;var o=["!",["in",r?["to-string",["get",r]]:["to-string",["id"]],["literal",e.map(String)]]];return t?["all",t,o]:o}(e,o,n);t.setFilter(r,i)}},n=e(449);function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,o=Array(r);e<r;e++)o[e]=t[e];return o}var a=function(t){return"string"==typeof t.geojson&&!!t.idProperty&&"function"==typeof t.transformRequest},l=function(t){var r,e=0,o=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return i(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var o=0,n=function(){};return{s:n,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,u=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return l=t.done,t},e:function(t){u=!0,a=t},f:function(){try{l||null==e.return||e.return()}finally{if(u)throw a}}}}(t);try{for(o.s();!(r=o.n()).done;){var n=r.value;e=Math.trunc((e<<5)-e+n.codePointAt(0))}}catch(t){o.e(t)}finally{o.f()}return Math.abs(e).toString(36)},u=function(t){if(t.tiles){var r=Array.isArray(t.tiles)?t.tiles.join(","):t.tiles;return"tiles-".concat(l(r))}return t.geojson?a(t)?"geojson-dynamic-".concat(t.id):"string"==typeof t.geojson?"geojson-".concat(l(t.geojson)):"geojson-".concat(t.id):"source-".concat(t.id)},s=function(t){if(function(t){return!!t.symbol}(t))return{fillLayerId:null,strokeLayerId:null,symbolLayerId:t.id};var r=!!t.fill&&"transparent"!==t.fill||(0,n.vY)(t),e=!!t.stroke,o=r?t.id:null,i=null;return e&&(i=r?"".concat(t.id,"-stroke"):t.id),{fillLayerId:o,strokeLayerId:i,symbolLayerId:null}},y=function(t,r){return{fillLayerId:"".concat(t,"-").concat(r),strokeLayerId:"".concat(t,"-").concat(r,"-stroke"),symbolLayerId:"".concat(t,"-").concat(r,"-symbol")}},c=function(t){var r;if(null!==(r=t.sublayers)&&void 0!==r&&r.length)return t.sublayers.flatMap(function(r){var e=y(t.id,r.id),o=e.fillLayerId;return[e.strokeLayerId,o,e.symbolLayerId]});var e=s(t),o=e.fillLayerId;return[e.strokeLayerId,o,e.symbolLayerId].filter(Boolean)},f=e(247),m=e(933),p=e(121);function d(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,o=Array(r);e<r;e++)o[e]=t[e];return o}var b=function(t){var r,e,o=(e=2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var o,n,i,a,l=[],u=!0,s=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(o=i.call(e)).done)&&(l.push(o.value),l.length!==r);u=!0);}catch(t){s=!0,n=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(s)throw n}}return l}}(r,e)||function(t,r){if(t){if("string"==typeof t)return d(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?d(t,r):void 0}}(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),n=o[0],i=o[1],a=function(t){return t<=.25?"left":t>=.75?"right":""}(n),l=function(t){return t<=.25?"top":t>=.75?"bottom":""}(i);return l+(a&&l?"-":"")+a||"center"};function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function h(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,o)}return e}function g(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?h(Object(e),!0).forEach(function(r){S(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):h(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function S(t,r,e){return(r=function(t){var r=function(t){if("object"!=v(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=v(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==v(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var _=function(t,r,e,o,i,a,l){var u=l.mapStyleId,s=l.patternRegistry,y=l.pixelRatio,c=void 0===y?1:y;if(e&&!t.getLayer(e)&&(r.fill||(0,n.vY)(r))){var m=(0,n.vY)(r)?s.getPatternImageId(r,u,c):null,p=m?{"fill-pattern":m,"fill-opacity":r.opacity||1}:{"fill-color":(0,f.o)(r.fill,u),"fill-opacity":r.opacity||1};t.addLayer(g({id:e,type:"fill",source:o,"source-layer":i,minzoom:r.minZoom,maxzoom:r.maxZoom,layout:{visibility:a},paint:p},r.filter?{filter:r.filter}:{}))}},P=function(t,r,e,o,n,i,a){e&&r.stroke&&!t.getLayer(e)&&t.addLayer(g({id:e,type:"line",source:o,"source-layer":n,minzoom:r.minZoom,maxzoom:r.maxZoom,layout:{visibility:i},paint:g({"line-color":(0,f.o)(r.stroke,a),"line-width":r.strokeWidth||1,"line-opacity":r.opacity||1},r.strokeDashArray?{"line-dasharray":r.strokeDashArray}:{})},r.filter?{filter:r.filter}:{}))},L=function(t,r,e,o,n,i,a){var l=a.mapStyle,u=a.symbolRegistry,s=a.pixelRatio;if(e&&!t.getLayer(e)){var y=u.getSymbolDef(r);if(y){var c=u.getSymbolImageId(r,l,!1,s);if(c){var f=(0,p.Op)(r,y);t.addLayer(g({id:e,type:"symbol",source:o,"source-layer":n,minzoom:r.minZoom,maxzoom:r.maxZoom,layout:{visibility:i,"icon-image":c,"icon-anchor":b(f),"icon-allow-overlap":!0}},r.filter?{filter:r.filter}:{}))}}}},w=function(t,r,e,o,n,i){var a,l=i.mapStyle,u=i.symbolRegistry,s=i.patternRegistry,c=i.pixelRatio,f=l.id,d=(0,m.m)(r,e),b=y(r.id,e.id),v=b.fillLayerId,h=b.strokeLayerId,g=b.symbolLayerId,S="hidden"===r.visibility,w="hidden"===(null===(a=r.sublayerVisibility)||void 0===a?void 0:a[e.id]),k=S||w?"none":"visible";(0,p.Lo)(d)&&u?L(t,d,g,o,n,k,{mapStyle:l,symbolRegistry:u,pixelRatio:c}):(_(t,d,v,o,n,k,{mapStyleId:f,patternRegistry:s,pixelRatio:c}),P(t,d,h,o,n,k,f))},k=function(t,r){return t.flatMap(function(t){var r,e=(0,n.vY)(t)?[t]:[];return null!==(r=t.sublayers)&&void 0!==r&&r.length&&t.sublayers.forEach(function(r){var o=(0,m.m)(t,r);(0,n.vY)(o)&&e.push(o)}),e})},O=function(t){return t.flatMap(function(t){var r,e=(0,p.Lo)(t)?[t]:[];return null!==(r=t.sublayers)&&void 0!==r&&r.length&&t.sublayers.forEach(function(r){var o=(0,m.m)(t,r);(0,p.Lo)(o)&&e.push(o)}),e})};function I(t){return I="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},I(t)}function j(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var o,n,i,a,l=[],u=!0,s=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(o=i.call(e)).done)&&(l.push(o.value),l.length!==r);u=!0);}catch(t){s=!0,n=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(s)throw n}}return l}}(t,r)||function(t,r){if(t){if("string"==typeof t)return R(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?R(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,o=Array(r);e<r;e++)o[e]=t[e];return o}function C(){var t,r,e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",n=e.toStringTag||"@@toStringTag";function i(e,o,n,i){var u=o&&o.prototype instanceof l?o:l,s=Object.create(u.prototype);return E(s,"_invoke",function(e,o,n){var i,l,u,s=0,y=n||[],c=!1,f={p:0,n:0,v:t,a:m,f:m.bind(t,4),d:function(r,e){return i=r,l=0,u=t,f.n=e,a}};function m(e,o){for(l=e,u=o,r=0;!c&&s&&!n&&r<y.length;r++){var n,i=y[r],m=f.p,p=i[2];e>3?(n=p===o)&&(u=i[(l=i[4])?5:(l=3,3)],i[4]=i[5]=t):i[0]<=m&&((n=e<2&&m<i[1])?(l=0,f.v=o,f.n=i[1]):m<p&&(n=e<3||i[0]>o||o>p)&&(i[4]=e,i[5]=o,f.n=p,l=0))}if(n||e>1)return a;throw c=!0,o}return function(n,y,p){if(s>1)throw TypeError("Generator is already running");for(c&&1===y&&m(y,p),l=y,u=p;(r=l<2?t:u)||!c;){i||(l?l<3?(l>1&&(f.n=-1),m(l,u)):f.n=u:f.v=u);try{if(s=2,i){if(l||(n="next"),r=i[n]){if(!(r=r.call(i,u)))throw TypeError("iterator result is not an object");if(!r.done)return r;u=r.value,l<2&&(l=0)}else 1===l&&(r=i.return)&&r.call(i),l<2&&(u=TypeError("The iterator does not provide a '"+n+"' method"),l=1);i=t}else if((r=(c=f.n<0)?u:e.call(o,f))!==a)break}catch(r){i=t,l=1,u=r}finally{s=1}}return{value:r,done:c}}}(e,n,i),!0),s}var a={};function l(){}function u(){}function s(){}r=Object.getPrototypeOf;var y=[][o]?r(r([][o]())):(E(r={},o,function(){return this}),r),c=s.prototype=l.prototype=Object.create(y);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,E(t,n,"GeneratorFunction")),t.prototype=Object.create(c),t}return u.prototype=s,E(c,"constructor",s),E(s,"constructor",u),u.displayName="GeneratorFunction",E(s,n,"GeneratorFunction"),E(c),E(c,n,"Generator"),E(c,o,function(){return this}),E(c,"toString",function(){return"[object Generator]"}),(C=function(){return{w:i,m:f}})()}function E(t,r,e,o){var n=Object.defineProperty;try{n({},"",{})}catch(t){n=0}E=function(t,r,e,o){function i(r,e){E(t,r,function(t){return this._invoke(r,e,t)})}r?n?n(t,r,{value:e,enumerable:!o,configurable:!o,writable:!o}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},E(t,r,e,o)}function x(t,r,e,o,n,i,a){try{var l=t[i](a),u=l.value}catch(t){return void e(t)}l.done?r(u):Promise.resolve(u).then(o,n)}function D(t){return function(){var r=this,e=arguments;return new Promise(function(o,n){var i=t.apply(r,e);function a(t){x(i,o,n,a,l,"next",t)}function l(t){x(i,o,n,a,l,"throw",t)}a(void 0)})}}function A(t,r){for(var e=0;e<r.length;e++){var o=r[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,M(o.key),o)}}function M(t){var r=function(t){if("object"!=I(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=I(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==I(r)?r:r+""}var F=function(){return t=function t(r,e,o){!function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t),this._mapProvider=r,this._map=r.map,this._symbolRegistry=e,this._patternRegistry=o,this._datasetSourceMap=new Map,this._symbolLayerIds=new Set},r=[{key:"init",value:(d=D(C().m(function t(r,e){var o,n=this;return C().w(function(t){for(;;)switch(t.n){case 0:return o=e.id,t.n=1,Promise.all([this._mapProvider.addPatternsToMap(k(r,this._patternRegistry),o,this._patternRegistry),this._mapProvider.addSymbolsToMap(O(r),e,this._symbolRegistry)]);case 1:return this._symbolLayerIds.clear(),r.forEach(function(t){return n._addLayers(t,e)}),t.n=2,new Promise(function(t){return n._map.once("idle",t)});case 2:return t.a(2)}},t,this)})),function(t,r){return d.apply(this,arguments)})},{key:"destroy",value:function(t){var r=this,e=new Set;t.forEach(function(t){var o=u(t);r._getLayersUsingSource(o).forEach(function(t){r._map.getLayer(t)&&r._map.removeLayer(t)}),!e.has(o)&&r._map.getSource(o)&&(r._map.removeSource(o),e.add(o))}),this._datasetSourceMap.clear()}},{key:"onStyleChange",value:(f=D(C().m(function t(r,e,o,n){var i,a=this;return C().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,new Promise(function(t){return a._map.once("idle",t)});case 1:return i=e.id,t.n=2,Promise.all([this._mapProvider.addPatternsToMap(k(r,this._patternRegistry),i,this._patternRegistry),this._mapProvider.addSymbolsToMap(O(r),e,this._symbolRegistry)]);case 2:this._symbolLayerIds.clear(),r.forEach(function(t){return a._addLayers(t,e)}),n.forEach(function(t){return t.reapply()}),Object.entries(o).forEach(function(t){var e=j(t,2),o=e[0],n=e[1],i=n.idProperty,l=n.ids,u=r.find(function(t){return t.id===o});u&&a._applyFeatureFilter(u,i,l)});case 3:return t.a(2)}},t,this)})),function(t,r,e,o){return f.apply(this,arguments)})},{key:"onSizeChange",value:(l=D(C().m(function t(r,e){var o=this;return C().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Promise.all([this._mapProvider.addSymbolsToMap(O(r),e,this._symbolRegistry),this._mapProvider.addPatternsToMap(k(r,this._patternRegistry),e.id,this._patternRegistry)]);case 1:r.forEach(function(t){var r;if(c(t).forEach(function(r){if(o._symbolLayerIds.has(r)&&o._map.getLayer(r)){var n=o._symbolRegistry.getSymbolImageId(t,e,!1,o._pixelRatio);n&&o._map.setLayoutProperty(r,"icon-image",n)}}),(0,n.vY)(t)){var i=s(t).fillLayerId;if(o._map.getLayer(i)){var a=o._patternRegistry.getPatternImageId(t,e.id,o._pixelRatio);a&&o._map.setPaintProperty(i,"fill-pattern",a)}}null===(r=t.sublayers)||void 0===r||r.forEach(function(r){var i=(0,m.m)(t,r),a=y(t.id,r.id),l=a.symbolLayerId,u=a.fillLayerId;if(o._map.getLayer(l)){var s=o._symbolRegistry.getSymbolImageId(i,e,!1,o._pixelRatio);s&&o._map.setLayoutProperty(l,"icon-image",s)}if((0,n.vY)(i)&&o._map.getLayer(u)){var c=o._patternRegistry.getPatternImageId(i,e.id,o._pixelRatio);c&&o._map.setPaintProperty(u,"fill-pattern",c)}})});case 2:return t.a(2)}},t,this)})),function(t,r){return l.apply(this,arguments)})},{key:"addDataset",value:function(t,r){this._addLayers(t,r)}},{key:"removeDataset",value:function(t,r){var e=this,o=u(t);c(t).forEach(function(t){e._map.getLayer(t)&&e._map.removeLayer(t),e._symbolLayerIds.delete(t)}),!r.some(function(r){return r.id!==t.id&&u(r)===o})&&this._map.getSource(o)&&this._map.removeSource(o),this._datasetSourceMap.delete(t.id)}},{key:"showDataset",value:function(t){this._setDatasetVisibility(t,"visible")}},{key:"hideDataset",value:function(t){this._setDatasetVisibility(t,"none")}},{key:"showSublayer",value:function(t,r){var e=this,o=y(t,r);[o.fillLayerId,o.strokeLayerId,o.symbolLayerId].forEach(function(t){e._map.getLayer(t)&&e._map.setLayoutProperty(t,"visibility","visible")})}},{key:"hideSublayer",value:function(t,r){var e=this,o=y(t,r);[o.fillLayerId,o.strokeLayerId,o.symbolLayerId].forEach(function(t){e._map.getLayer(t)&&e._map.setLayoutProperty(t,"visibility","none")})}},{key:"showFeatures",value:function(t,r,e){this._applyFeatureFilter(t,r,e)}},{key:"hideFeatures",value:function(t,r,e){this._applyFeatureFilter(t,r,e)}},{key:"setStyle",value:(i=D(C().m(function t(r,e){var o,n=this;return C().w(function(t){for(;;)switch(t.n){case 0:return o=e.id,c(r).forEach(function(t){n._map.getLayer(t)&&n._map.removeLayer(t),n._symbolLayerIds.delete(t)}),t.n=1,Promise.all([this._mapProvider.addPatternsToMap(k([r],this._patternRegistry),o,this._patternRegistry),this._mapProvider.addSymbolsToMap(O([r]),e,this._symbolRegistry)]);case 1:this._addLayers(r,e);case 2:return t.a(2)}},t,this)})),function(t,r){return i.apply(this,arguments)})},{key:"setSublayerStyle",value:(e=D(C().m(function t(r,e,o){var n,i,a,l,u,s,c,f,m,p,d,b=this;return C().w(function(t){for(;;)switch(t.n){case 0:if(a=o.id,l=this._pixelRatio,u=y(r.id,e),s=u.fillLayerId,c=u.strokeLayerId,f=u.symbolLayerId,[s,c,f].forEach(function(t){b._map.getLayer(t)&&b._map.removeLayer(t),b._symbolLayerIds.delete(t)}),m=null===(n=r.sublayers)||void 0===n?void 0:n.find(function(t){return t.id===e})){t.n=1;break}return t.a(2);case 1:return t.n=2,Promise.all([this._mapProvider.addPatternsToMap(k([r],this._patternRegistry),a,this._patternRegistry),this._mapProvider.addSymbolsToMap(O([r]),o,this._symbolRegistry)]);case 2:p=this._datasetSourceMap.get(r.id),d=null!==(i=r.tiles)&&void 0!==i&&i.length?r.sourceLayer:void 0,w(this._map,r,m,p,d,{mapStyle:o,symbolRegistry:this._symbolRegistry,patternRegistry:this._patternRegistry,pixelRatio:l}),this._maintainSymbolOrdering(r);case 3:return t.a(2)}},t,this)})),function(t,r,o){return e.apply(this,arguments)})},{key:"setOpacity",value:function(t,r){var e=this,o=this._map.getStyle();null!=o&&o.layers&&o.layers.filter(function(r){return r.id===t||r.id.startsWith("".concat(t,"-"))}).forEach(function(t){return e._setPaintOpacity(t.id,r)})}},{key:"setSublayerOpacity",value:function(t,r,e){var o=y(t,r),n=o.fillLayerId,i=o.strokeLayerId;this._setPaintOpacity(n,e),this._setPaintOpacity(i,e)}},{key:"setData",value:function(t,r){var e=this._datasetSourceMap.get(t);if(e){var o=this._map.getSource(e);o&&"function"==typeof o.setData&&o.setData(r)}}},{key:"_pixelRatio",get:function(){return this._mapProvider.map.getPixelRatio()}},{key:"_addLayers",value:function(t,r){var e=function(t,r,e,o,n,i){var l,y,c=e.id,f=u(r);!function(t,r,e){if(!t.getSource(e))if(r.tiles)t.addSource(e,{type:"vector",tiles:r.tiles,minzoom:r.minZoom||0,maxzoom:r.maxZoom||22});else if(r.geojson){var o=a(r)?{type:"FeatureCollection",features:[]}:r.geojson;t.addSource(e,{type:"geojson",data:o,generateId:!0})}}(t,r,f);var m=null!==(l=r.tiles)&&void 0!==l&&l.length?r.sourceLayer:void 0;if(null!==(y=r.sublayers)&&void 0!==y&&y.length)return r.sublayers.forEach(function(a){w(t,r,a,f,m,{mapStyle:e,symbolRegistry:o,patternRegistry:n,pixelRatio:i})}),f;var d=s(r),b=d.fillLayerId,v=d.strokeLayerId,h=d.symbolLayerId,g="hidden"===r.visibility?"none":"visible";return(0,p.Lo)(r)&&o?(L(t,r,h,f,m,g,{mapStyle:e,symbolRegistry:o,pixelRatio:i}),f):(_(t,r,b,f,m,g,{mapStyleId:c,patternRegistry:n,pixelRatio:i}),P(t,r,v,f,m,g,c),f)}(this._map,t,r,this._symbolRegistry,this._patternRegistry,this._pixelRatio);this._datasetSourceMap.set(t.id,e),this._maintainSymbolOrdering(t)}},{key:"_getFirstSymbolLayerId",value:function(){var t,r=this,e=this._map.getStyle();if(null==e||!e.layers)return null;var o=e.layers.find(function(t){return r._symbolLayerIds.has(t.id)});return null!==(t=null==o?void 0:o.id)&&void 0!==t?t:null}},{key:"_maintainSymbolOrdering",value:function(t){var r=this,e=c(t).filter(function(t){return t&&r._map.getLayer(t)});e.forEach(function(t){var e;"symbol"===(null===(e=r._map.getLayer(t))||void 0===e?void 0:e.type)?r._symbolLayerIds.add(t):r._symbolLayerIds.delete(t)});var o=this._getFirstSymbolLayerId();o&&e.forEach(function(t){r._symbolLayerIds.has(t)||r._map.moveLayer(t,o)})}},{key:"_setDatasetVisibility",value:function(t,r){var e=this,o=this._map.getStyle();null!=o&&o.layers&&o.layers.filter(function(r){return r.id===t||r.id.startsWith("".concat(t,"-"))}).forEach(function(t){return e._map.setLayoutProperty(t.id,"visibility",r)})}},{key:"_applyFeatureFilter",value:function(t,r,e){var n,i=this;if(null!==(n=t.sublayers)&&void 0!==n&&n.length)t.sublayers.forEach(function(n){var a=y(t.id,n.id),l=a.fillLayerId,u=a.strokeLayerId,s=t.filter&&n.filter?["all",t.filter,n.filter]:n.filter||t.filter||null;o(i._map,l,s,r,e),o(i._map,u,s,r,e)});else{var a=s(t),l=a.fillLayerId,u=a.strokeLayerId,c=a.symbolLayerId,f=t.filter||null;[l,u,c].filter(Boolean).forEach(function(t){o(i._map,t,f,r,e)})}}},{key:"_setPaintOpacity",value:function(t,r){var e=this._map.getLayer(t);if(e){var o={line:"line-opacity",symbol:"icon-opacity"}[e.type]||"fill-opacity";this._map.setPaintProperty(t,o,r)}}},{key:"_getLayersUsingSource",value:function(t){var r=this._map.getStyle();return null!=r&&r.layers?r.layers.filter(function(r){return r.source===t}).map(function(t){return t.id}):[]}}],r&&A(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,e,i,l,f,d}()},772(t,r,e){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 n(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,o)}return e}function i(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?n(Object(e),!0).forEach(function(r){a(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):n(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function a(t,r,e){return(r=function(t){var r=function(t){if("object"!=o(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=o(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}e.d(r,{V:()=>l,ns:()=>c,p_:()=>y});var l={minZoom:6,maxZoom:24,showInKey:!1,showInMenu:!1,visibility:"visible",style:{stroke:"#d4351c",strokeWidth:2,fill:"transparent",symbolDescription:"red outline"}},u=["stroke","strokeWidth","strokeDashArray","fill","fillPattern","fillPatternSvgContent","fillPatternForegroundColor","fillPatternBackgroundColor","opacity","symbolDescription","keySymbolShape","symbol","symbolSvgContent","symbolViewBox","symbolAnchor","symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"],s=["stroke","fill","fillPattern","fillPatternSvgContent","symbol","symbolSvgContent"],y=function(t){return s.some(function(r){return r in t})},c=function(t,r){var e=t.style||{},o=i(i({},r.style),e);!("symbolDescription"in e)&&y(e)&&delete o.symbolDescription;var n=i({},t);delete n.style,u.forEach(function(t){return delete n[t]});var a=i({},r);return delete a.style,i(i(i({},a),n),o)}},933(t,r,e){e.d(r,{m:()=>u});var o=e(772);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 i(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,o)}return e}function a(t,r,e){return(r=function(t){var r=function(t){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var e=r.call(t,"string");if("object"!=n(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var l=function(t,r){return"symbolDescription"in r?r.symbolDescription:(0,o.p_)(r)?void 0:t.symbolDescription},u=function(t,r){var e,o,n,u,s,y,c,f,m,p,d,b,v,h,g,S,_,P=r.style||{},L=(S=t.filter,_=r.filter,S&&_?["all",S,_]:_||S||null);return function(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?i(Object(e),!0).forEach(function(r){a(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):i(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}({id:r.id,label:r.label,stroke:null!==(e=P.stroke)&&void 0!==e?e:t.stroke,strokeWidth:null!==(o=P.strokeWidth)&&void 0!==o?o:t.strokeWidth,strokeDashArray:null!==(n=P.strokeDashArray)&&void 0!==n?n:t.strokeDashArray,opacity:null!==(u=P.opacity)&&void 0!==u?u:t.opacity,keySymbolShape:null!==(s=P.keySymbolShape)&&void 0!==s?s:t.keySymbolShape,symbolDescription:l(t,P),showInKey:null!==(y=r.showInKey)&&void 0!==y?y:t.showInKey,showInMenu:null!==(c=r.showInMenu)&&void 0!==c&&c,filter:L,minZoom:t.minZoom,maxZoom:t.maxZoom,symbol:null!==(f=P.symbol)&&void 0!==f?f:t.symbol,symbolSvgContent:null!==(m=P.symbolSvgContent)&&void 0!==m?m:t.symbolSvgContent,symbolViewBox:null!==(p=P.symbolViewBox)&&void 0!==p?p:t.symbolViewBox,symbolAnchor:null!==(d=P.symbolAnchor)&&void 0!==d?d:t.symbolAnchor,symbolBackgroundColor:null!==(b=P.symbolBackgroundColor)&&void 0!==b?b:t.symbolBackgroundColor,symbolForegroundColor:null!==(v=P.symbolForegroundColor)&&void 0!==v?v:t.symbolForegroundColor,symbolHaloWidth:null!==(h=P.symbolHaloWidth)&&void 0!==h?h:t.symbolHaloWidth,symbolGraphic:null!==(g=P.symbolGraphic)&&void 0!==g?g:t.symbolGraphic},function(t,r){var e,o;return r.fillPattern||r.fillPatternSvgContent?{fillPattern:r.fillPattern,fillPatternSvgContent:r.fillPatternSvgContent,fillPatternForegroundColor:null!==(e=r.fillPatternForegroundColor)&&void 0!==e?e:t.fillPatternForegroundColor,fillPatternBackgroundColor:null!==(o=r.fillPatternBackgroundColor)&&void 0!==o?o:t.fillPatternBackgroundColor}:"fill"in r?{fill:r.fill}:{fill:t.fill,fillPattern:t.fillPattern,fillPatternSvgContent:t.fillPatternSvgContent,fillPatternForegroundColor:t.fillPatternForegroundColor,fillPatternBackgroundColor:t.fillPatternBackgroundColor}}(t,P))}},247(t,r,e){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)}e.d(r,{o:()=>n});var n=function(t,r){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===o(t)){if(r&&t[r])return t[r];var e=Object.values(t)[0];return null!=e?e:null}return null}},449(t,r,e){e.d(r,{vY:()=>o});var o=function(t){return!(!t.fillPattern&&!t.fillPatternSvgContent)}},121(t,r,e){e.d(r,{Lo:()=>n,Op:()=>l,n8:()=>a,sR:()=>i});var o=new Set(["symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"]),n=function(t){return!(!t.symbol&&!t.symbolSvgContent)},i=function(t){if(!n(t))return{};var r={};return o.forEach(function(e){if(null!=t[e]){var o=e.charAt(6).toLowerCase()+e.slice(7);r[o]=t[e]}}),r},a=function(t,r){var e;return t.symbolViewBox?t.symbolViewBox:null!==(e=null==r?void 0:r.viewBox)&&void 0!==e?e:"0 0 38 38"},l=function(t,r){var e;return t.symbolAnchor?t.symbolAnchor:null!==(e=null==r?void 0:r.anchor)&&void 0!==e?e:[.5,.5]}}}]);
|