@defra/interactive-map 0.0.6-alpha → 0.0.8-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/map.njk +2 -2
- package/dist/css/index.css +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/docs/api.md +10 -5
- package/package.json +56 -4
- package/plugins/beta/datasets/dist/esm/index.js +1 -1
- package/plugins/beta/draw-es/dist/esm/index.js +2 -0
- package/plugins/beta/draw-ml/dist/css/index.css +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/src/DrawInit.jsx +15 -0
- package/plugins/beta/draw-ml/src/api/deleteFeature.js +4 -4
- package/plugins/beta/draw-ml/src/api/editFeature.js +10 -5
- package/plugins/beta/draw-ml/src/draw.scss +1 -0
- package/plugins/beta/draw-ml/src/events.js +2 -0
- package/plugins/beta/draw-ml/src/manifest.js +18 -43
- package/plugins/beta/draw-ml/src/modes/createDrawMode.js +35 -1
- package/plugins/beta/draw-ml/src/modes/editVertexMode.js +17 -1
- package/plugins/beta/frame/dist/esm/index.js +1 -1
- package/plugins/beta/map-styles/dist/esm/index.js +1 -1
- package/plugins/beta/scale-bar/dist/esm/index.js +1 -1
- package/plugins/beta/use-location/dist/esm/index.js +1 -1
- package/plugins/interact/dist/css/index.css +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/src/defaults.js +1 -0
- package/plugins/interact/src/events.js +6 -1
- package/plugins/interact/src/events.test.js +19 -5
- package/plugins/interact/src/hooks/useInteractionHandlers.js +7 -2
- package/plugins/interact/src/hooks/useInteractionHandlers.test.js +28 -0
- package/plugins/interact/src/interact.scss +1 -0
- package/plugins/interact/src/manifest.js +22 -16
- package/plugins/interact/src/manifest.test.js +1 -1
- package/plugins/interact/src/reducer.js +1 -0
- package/plugins/interact/src/reducer.test.js +1 -0
- package/plugins/search/dist/esm/index.js +1 -1
- package/providers/beta/esri/dist/css/index.css +1 -0
- package/providers/beta/esri/dist/esm/index.js +2 -0
- package/providers/beta/esri/src/esriProvider.js +12 -0
- package/providers/beta/esri/src/mapEvents.js +2 -2
- package/providers/beta/open-names/dist/esm/index.js +1 -1
- package/providers/maplibre/dist/esm/index.js +1 -1
- package/providers/maplibre/dist/esm/index.js.LICENSE.txt +5 -0
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/src/maplibreProvider.js +11 -1
- package/providers/maplibre/src/utils/highlightFeatures.js +6 -2
- package/src/App/components/Actions/Actions.jsx +2 -1
- package/src/App/components/Actions/Actions.module.scss +14 -0
- package/src/App/components/Actions/Actions.test.jsx +2 -2
- package/src/App/components/MapButton/MapButton.module.scss +19 -6
- package/src/App/components/PopupMenu/PopupMenu.jsx +69 -14
- package/src/App/components/PopupMenu/PopupMenu.module.scss +70 -7
- package/src/App/components/PopupMenu/PopupMenu.test.jsx +102 -16
- package/src/App/hooks/useButtonStateEvaluator.js +2 -2
- package/src/App/hooks/useInterfaceAPI.js +26 -32
- package/src/App/registry/pluginRegistry.js +2 -2
- package/src/App/renderer/mapButtons.js +6 -1
- package/src/App/renderer/mapButtons.test.js +20 -0
- package/src/App/store/MapProvider.jsx +2 -2
- package/src/App/store/mapActionsMap.js +3 -2
- package/src/App/store/mapReducer.js +1 -0
- package/src/scss/settings/_dimensions.scss +1 -0
- package/webpack.esm.mjs +21 -11
- package/webpack.umd.mjs +0 -1
- package/dist/esm/im-core.js +0 -2
- package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +0 -2
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +0 -1
- package/plugins/beta/frame/dist/esm/im-frame-plugin.js +0 -1
- package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +0 -1
- package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +0 -1
- package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +0 -1
- package/plugins/interact/dist/esm/im-interact-plugin.js +0 -1
- package/plugins/search/dist/esm/im-search-plugin.js +0 -2
- package/plugins/search/dist/esm/im-search-plugin.js.LICENSE.txt +0 -1
- package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +0 -2
- package/providers/beta/open-names/dist/esm/im-reverse-geocode.js.LICENSE.txt +0 -1
- package/providers/maplibre/dist/esm/im-maplibre-framework.js +0 -2
- package/providers/maplibre/dist/esm/im-maplibre-framework.js.LICENSE.txt +0 -4
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +0 -2
- package/providers/maplibre/dist/esm/im-maplibre-provider.js.LICENSE.txt +0 -1
- /package/{dist/esm/im-core.js.LICENSE.txt → plugins/beta/draw-es/dist/esm/index.js.LICENSE.txt} +0 -0
- /package/{plugins/beta/datasets/dist/esm/im-datasets-plugin.js.LICENSE.txt → providers/beta/esri/dist/esm/index.js.LICENSE.txt} +0 -0
|
@@ -4,6 +4,8 @@ import { createMapboxDraw } from './mapboxDraw.js'
|
|
|
4
4
|
|
|
5
5
|
export const DrawInit = ({ appState, appConfig, mapState, pluginConfig, pluginState, services, mapProvider, buttonConfig }) => {
|
|
6
6
|
const { events, eventBus } = services
|
|
7
|
+
const { crossHair } = mapState
|
|
8
|
+
const isTouchOrKeyboard = ['touch', 'keyboard'].includes(appState.interfaceType)
|
|
7
9
|
|
|
8
10
|
// Create draw instance once
|
|
9
11
|
useEffect(() => {
|
|
@@ -33,6 +35,19 @@ export const DrawInit = ({ appState, appConfig, mapState, pluginConfig, pluginSt
|
|
|
33
35
|
|
|
34
36
|
}, [mapState.isMapReady, appState.mode])
|
|
35
37
|
|
|
38
|
+
// Show crosshair immediately on touch/keyboard when entering draw mode
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (['draw_polygon', 'draw_line'].includes(pluginState.mode) && isTouchOrKeyboard) {
|
|
41
|
+
const wasAlreadyVisible = crossHair.isVisible
|
|
42
|
+
crossHair.fixAtCenter()
|
|
43
|
+
return () => {
|
|
44
|
+
if (!wasAlreadyVisible) {
|
|
45
|
+
crossHair.hide()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, [pluginState.mode, appState.interfaceType])
|
|
50
|
+
|
|
36
51
|
// Attach events when plgin state changes
|
|
37
52
|
useEffect(() => {
|
|
38
53
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const deleteFeature = ({ mapProvider, services },
|
|
1
|
+
export const deleteFeature = ({ mapProvider, services }, featureIds) => {
|
|
2
2
|
const { draw } = mapProvider
|
|
3
3
|
const { eventBus } = services
|
|
4
4
|
|
|
@@ -6,8 +6,8 @@ export const deleteFeature = ({ mapProvider, services }, featureId) => {
|
|
|
6
6
|
return
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
// --- Delete
|
|
10
|
-
draw.delete(
|
|
9
|
+
// --- Delete features from draw instance
|
|
10
|
+
draw.delete(featureIds)
|
|
11
11
|
|
|
12
|
-
eventBus.emit('draw:delete', {
|
|
12
|
+
eventBus.emit('draw:delete', { featureIds })
|
|
13
13
|
}
|
|
@@ -14,14 +14,17 @@ export const editFeature = ({ appState, appConfig, mapState, pluginConfig, plugi
|
|
|
14
14
|
return
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
// Guard: feature must exist in draw before doing anything
|
|
18
|
+
if (!draw.get(featureId)) {
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
// Determin snapLayers from pluginConfig or runtime config
|
|
18
23
|
let snapLayers = null
|
|
19
|
-
if (options.snapLayers
|
|
20
|
-
snapLayers =
|
|
21
|
-
} else if (pluginConfig.snapLayers !== undefined) {
|
|
22
|
-
snapLayers = pluginConfig.snapLayers
|
|
24
|
+
if (options.snapLayers === undefined) {
|
|
25
|
+
snapLayers = pluginConfig.snapLayers ?? null
|
|
23
26
|
} else {
|
|
24
|
-
snapLayers =
|
|
27
|
+
snapLayers = options.snapLayers
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
// Set per-call snap layers if provided
|
|
@@ -59,4 +62,6 @@ export const editFeature = ({ appState, appConfig, mapState, pluginConfig, plugi
|
|
|
59
62
|
|
|
60
63
|
// Set mode to edit_vertex
|
|
61
64
|
dispatch({ type: 'SET_MODE', payload: 'edit_vertex' })
|
|
65
|
+
|
|
66
|
+
return true
|
|
62
67
|
}
|
|
@@ -148,6 +148,7 @@ export function attachEvents({ pluginState, mapProvider, buttonConfig, eventBus
|
|
|
148
148
|
drawSnap.onClick = handleSnap
|
|
149
149
|
|
|
150
150
|
map.on('styledata', handleStyleData)
|
|
151
|
+
map.on('draw.cancel', handleCancel)
|
|
151
152
|
map.on('draw.create', onCreate)
|
|
152
153
|
map.on('draw.editfinish', onEditFinish)
|
|
153
154
|
map.on('draw.update', onUpdate)
|
|
@@ -161,6 +162,7 @@ export function attachEvents({ pluginState, mapProvider, buttonConfig, eventBus
|
|
|
161
162
|
btn.onClick = null
|
|
162
163
|
}})
|
|
163
164
|
map.off('styledata', handleStyleData)
|
|
165
|
+
map.off('draw.cancel', handleCancel)
|
|
164
166
|
map.off('draw.create', onCreate)
|
|
165
167
|
map.off('draw.editfinish', onEditFinish)
|
|
166
168
|
map.off('draw.update', onUpdate)
|
|
@@ -26,15 +26,15 @@ export const manifest = {
|
|
|
26
26
|
buttons: [{
|
|
27
27
|
id: 'drawAddPoint',
|
|
28
28
|
label: 'Add point',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
iconId: 'plus',
|
|
30
|
+
variant: 'touch',
|
|
31
|
+
hiddenWhen: ({ appState, pluginState }) => !['draw_polygon', 'draw_line'].includes(pluginState.mode) || appState.interfaceType !== 'touch',
|
|
32
|
+
...createButtonSlots(false)
|
|
32
33
|
},{
|
|
33
|
-
id: '
|
|
34
|
-
label: '
|
|
35
|
-
variant: '
|
|
36
|
-
hiddenWhen: ({ pluginState }) => !
|
|
37
|
-
enableWhen: ({ pluginState }) => pluginState.numVertecies >= (pluginState.mode === 'draw_polygon' ? 3 : 2),
|
|
34
|
+
id: 'drawCancel',
|
|
35
|
+
label: 'Cancel',
|
|
36
|
+
variant: 'tertiary',
|
|
37
|
+
hiddenWhen: ({ pluginState }) => !pluginState.mode,
|
|
38
38
|
...createButtonSlots(true)
|
|
39
39
|
},{
|
|
40
40
|
id: 'drawMenu',
|
|
@@ -62,40 +62,12 @@ export const manifest = {
|
|
|
62
62
|
hiddenWhen: ({ pluginState }) => !(['simple_select', 'edit_vertex'].includes(pluginState.mode)),
|
|
63
63
|
}],
|
|
64
64
|
...createButtonSlots(true)
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
// hiddenWhen: ({ pluginState }) => !['draw_polygon', 'draw_line', 'edit_vertex'].includes(pluginState.mode),
|
|
72
|
-
// enableWhen: ({ pluginState }) => pluginState.undoStackLength > 0,
|
|
73
|
-
// excludeWhen: () => true,
|
|
74
|
-
// ...createButtonSlots(false)
|
|
75
|
-
// },{
|
|
76
|
-
// id: 'drawDeletePoint',
|
|
77
|
-
// label: 'Delete point',
|
|
78
|
-
// iconId: 'trash',
|
|
79
|
-
// variant: 'tertiary',
|
|
80
|
-
// enableWhen: ({ pluginState }) => pluginState.selectedVertexIndex >= 0 && pluginState.numVertecies > (pluginState.tempFeature?.geometry?.type === 'Polygon' ? 3 : 2),
|
|
81
|
-
// hiddenWhen: ({ pluginState }) => !(['simple_select', 'edit_vertex'].includes(pluginState.mode)),
|
|
82
|
-
// excludeWhen: () => true,
|
|
83
|
-
// ...createButtonSlots(false)
|
|
84
|
-
// },{
|
|
85
|
-
// id: 'drawSnap',
|
|
86
|
-
// label: 'Snap to line',
|
|
87
|
-
// iconId: 'magnet',
|
|
88
|
-
// variant: 'tertiary',
|
|
89
|
-
// hiddenWhen: ({ pluginState }) => !pluginState.mode || !pluginState.hasSnapLayers,
|
|
90
|
-
// pressedWhen: ({ pluginState }) => !!pluginState.snap,
|
|
91
|
-
// excludeWhen: () => true,
|
|
92
|
-
// ...createButtonSlots(false)
|
|
93
|
-
// },
|
|
94
|
-
{
|
|
95
|
-
id: 'drawCancel',
|
|
96
|
-
label: 'Cancel',
|
|
97
|
-
variant: 'tertiary',
|
|
98
|
-
hiddenWhen: ({ pluginState }) => !pluginState.mode,
|
|
65
|
+
},{
|
|
66
|
+
id: 'drawDone',
|
|
67
|
+
label: 'Done',
|
|
68
|
+
variant: 'primary',
|
|
69
|
+
hiddenWhen: ({ pluginState }) => !['draw_polygon', 'draw_line', 'edit_vertex'].includes(pluginState.mode),
|
|
70
|
+
enableWhen: ({ pluginState }) => pluginState.numVertecies >= (pluginState.mode === 'draw_polygon' ? 3 : 2),
|
|
99
71
|
...createButtonSlots(true)
|
|
100
72
|
}],
|
|
101
73
|
|
|
@@ -108,10 +80,13 @@ export const manifest = {
|
|
|
108
80
|
|
|
109
81
|
icons: [{
|
|
110
82
|
id: 'menu',
|
|
111
|
-
svgContent: '<
|
|
83
|
+
svgContent: '<path d="m6 9 6 6 6-6"/>'
|
|
112
84
|
},{
|
|
113
85
|
id: 'undo',
|
|
114
86
|
svgContent: '<path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"/>'
|
|
87
|
+
},{
|
|
88
|
+
id: 'check',
|
|
89
|
+
svgContent: '<path d="M20 6 9 17l-5-5"/>'
|
|
115
90
|
},{
|
|
116
91
|
id: 'magnet',
|
|
117
92
|
svgContent: '<path d="m12 15 4 4"/><path d="M2.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.029-6.029a1 1 0 1 1 3 3l-6.029 6.029a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.365-6.367A1 1 0 0 0 8.716 4.282z"/><path d="m5 8 4 4"/>'
|
|
@@ -399,7 +399,15 @@ export const createDrawMode = (ParentMode, config) => {
|
|
|
399
399
|
},
|
|
400
400
|
|
|
401
401
|
onKeyup(state, e) {
|
|
402
|
-
if (e.key === 'Escape'
|
|
402
|
+
if (e.key === 'Escape') {
|
|
403
|
+
if (state.interfaceType !== 'keyboard') {
|
|
404
|
+
// Mouse/touch: cancel drawing — onKeyUp (capital U) won't fire since container isn't focused
|
|
405
|
+
this.map.fire('draw.cancel')
|
|
406
|
+
}
|
|
407
|
+
// Keyboard: onKeyUp (capital U) handles reinitialize (container is focused, event reaches it)
|
|
408
|
+
return
|
|
409
|
+
}
|
|
410
|
+
if (document.activeElement !== state.container) {
|
|
403
411
|
return
|
|
404
412
|
}
|
|
405
413
|
this._setInterface(state, 'keyboard')
|
|
@@ -409,6 +417,32 @@ export const createDrawMode = (ParentMode, config) => {
|
|
|
409
417
|
}
|
|
410
418
|
},
|
|
411
419
|
|
|
420
|
+
// Called by mapbox-gl-draw's event system (capital U — distinct from onKeyup above).
|
|
421
|
+
// Registered on ctx.container, so only fires when the viewport has focus (keyboard drawing).
|
|
422
|
+
// 1. A UI element inside the viewport has focus (e.g. popup menu) → ignore, let React handle
|
|
423
|
+
// 2. Keyboard drawing (container focused, interfaceType === 'keyboard') → Escape restarts
|
|
424
|
+
// 3. Non-keyboard with container focused → skip (already handled by window onKeyup via draw.cancel)
|
|
425
|
+
onKeyUp(state, e) {
|
|
426
|
+
const activeEl = document.activeElement
|
|
427
|
+
if (activeEl && activeEl !== state.container && state.container.contains(activeEl)) {
|
|
428
|
+
return
|
|
429
|
+
}
|
|
430
|
+
if (e.key === 'Escape') {
|
|
431
|
+
if (state.interfaceType === 'keyboard') {
|
|
432
|
+
const undoStack = this.map._undoStack
|
|
433
|
+
if (undoStack) {
|
|
434
|
+
undoStack.clear()
|
|
435
|
+
}
|
|
436
|
+
this._reinitializeFeature(state, getFeature(state))
|
|
437
|
+
}
|
|
438
|
+
// Non-keyboard already handled by onKeyup (window) via draw.cancel
|
|
439
|
+
return
|
|
440
|
+
}
|
|
441
|
+
if (activeEl !== state.container) {
|
|
442
|
+
ParentMode.onKeyUp.call(this, state, e)
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
|
|
412
446
|
onFocus(state) {
|
|
413
447
|
state.vertexMarker.style.display = ['touch', 'keyboard'].includes(state.interfaceType) ? 'block' : 'none'
|
|
414
448
|
},
|
|
@@ -153,6 +153,10 @@ export const EditVertexMode = {
|
|
|
153
153
|
},
|
|
154
154
|
|
|
155
155
|
onKeydown(state, e) {
|
|
156
|
+
if (!state.container.contains(document.activeElement)) {
|
|
157
|
+
return
|
|
158
|
+
}
|
|
159
|
+
|
|
156
160
|
state.interfaceType = 'keyboard'
|
|
157
161
|
this.hideTouchVertexIndicator(state)
|
|
158
162
|
|
|
@@ -244,6 +248,10 @@ export const EditVertexMode = {
|
|
|
244
248
|
},
|
|
245
249
|
|
|
246
250
|
onKeyup(state, e) {
|
|
251
|
+
if (!state.container.contains(document.activeElement)) {
|
|
252
|
+
return
|
|
253
|
+
}
|
|
254
|
+
|
|
247
255
|
state.interfaceType = 'keyboard'
|
|
248
256
|
if (ARROW_KEYS.has(e.key) && state.selectedVertexIndex >= 0) {
|
|
249
257
|
e.stopPropagation()
|
|
@@ -331,13 +339,21 @@ export const EditVertexMode = {
|
|
|
331
339
|
|
|
332
340
|
// Push undo for vertex insertion (from dragging midpoint)
|
|
333
341
|
if (wasInsertion) {
|
|
342
|
+
const insertedIndex = state._insertedVertexIndex
|
|
334
343
|
this.pushUndo({
|
|
335
344
|
type: 'insert_vertex',
|
|
336
345
|
featureId: state.featureId,
|
|
337
|
-
vertexIndex:
|
|
346
|
+
vertexIndex: insertedIndex
|
|
338
347
|
})
|
|
348
|
+
// selectedVertexIndex was pointing to the old midpoint-range index;
|
|
349
|
+
// update it to the actual flat index of the newly inserted vertex
|
|
350
|
+
state.selectedVertexIndex = insertedIndex
|
|
351
|
+
state.selectedVertexType = 'vertex'
|
|
339
352
|
state._isInsertingVertex = false
|
|
340
353
|
state._insertedVertexIndex = undefined
|
|
354
|
+
// Broadcast the updated vertex count — DirectSelect.onMouseUp only fires
|
|
355
|
+
// draw.update (not draw.selectionchange), so onSelectionChange never runs
|
|
356
|
+
this.map.fire('draw.vertexselection', { index: insertedIndex, numVertecies: state.vertecies.length })
|
|
341
357
|
}
|
|
342
358
|
// Push undo for the move if vertex actually moved
|
|
343
359
|
else if (vertexMoved && state._moveStartPosition && state._moveStartIndex !== undefined) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
import*as e from"react";import*as t from"react/jsx-runtime";var r,n,o={react(t,r,n){var o,i;t.exports=(o={useEffect:()=>e.useEffect,useRef:()=>e.useRef,useState:()=>e.useState},i={},n.d(i,o),i)},"react/jsx-runtime"(e,r,n){var o,i;e.exports=(o={Fragment:()=>t.Fragment,jsx:()=>t.jsx,jsxs:()=>t.jsxs},i={},n.d(i,o),i)}},i={};function u(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,u),r.exports}u.m=o,u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.f={},u.e=e=>Promise.all(Object.keys(u.f).reduce((t,r)=>(u.f[r](e,t),t),[])),u.u=e=>"../esm/"+e+".js",u.miniCssF=e=>{},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u.p=e+"../css/"})(),r={index:0},n=e=>{var t,n,{__webpack_esm_ids__:o,__webpack_esm_modules__:i,__webpack_esm_runtime__:c}=e,a=0;for(t in i)u.o(i,t)&&(u.m[t]=i[t]);for(c&&c(u);a<o.length;a++)n=o[a],u.o(r,n)&&r[n]&&r[n][0](),r[o[a]]=0},u.f.j=(e,t)=>{var o=u.o(r,e)?r[e]:void 0;if(0!==o)if(o)t.push(o[1]);else{var i=import("../css/"+u.u(e)).then(n,t=>{throw 0!==r[e]&&(r[e]=void 0),t});i=Promise.race([i,new Promise(t=>o=r[e]=[t])]),t.push(o[1]=i)}};var c={};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function f(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var a=n&&n.prototype instanceof c?n:c,f=Object.create(a.prototype);return s(f,"_invoke",function(r,n,o){var i,c,a,f=0,s=o||[],p=!1,l={p:0,n:0,v:e,a:b,f:b.bind(e,4),d:function(t,r){return i=t,c=0,a=e,l.n=r,u}};function b(r,n){for(c=r,a=n,t=0;!p&&f&&!o&&t<s.length;t++){var o,i=s[t],b=l.p,y=i[2];r>3?(o=y===n)&&(a=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=b&&((o=r<2&&b<i[1])?(c=0,l.v=n,l.n=i[1]):b<y&&(o=r<3||i[0]>n||n>y)&&(i[4]=r,i[5]=n,l.n=y,c=0))}if(o||r>1)return u;throw p=!0,n}return function(o,s,y){if(f>1)throw TypeError("Generator is already running");for(p&&1===s&&b(s,y),c=s,a=y;(t=c<2?e:a)||!p;){i||(c?c<3?(c>1&&(l.n=-1),b(c,a)):l.n=a:l.v=a);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(p=l.n<0)?a:r.call(n,l))!==u)break}catch(t){i=e,c=1,a=t}finally{f=1}}return{value:t,done:p}}}(r,o,i),!0),f}var u={};function c(){}function a(){}function p(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(s(t={},n,function(){return this}),t),b=p.prototype=c.prototype=Object.create(l);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,o,"GeneratorFunction")),e.prototype=Object.create(b),e}return a.prototype=p,s(b,"constructor",p),s(p,"constructor",a),a.displayName="GeneratorFunction",s(p,o,"GeneratorFunction"),s(b),s(b,o,"Generator"),s(b,n,function(){return this}),s(b,"toString",function(){return"[object Generator]"}),(f=function(){return{w:i,m:y}})()}function s(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}s=function(e,t,r,n){function i(t,r){s(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},s(e,t,r,n)}function p(e,t,r,n,o,i,u){try{var c=e[i](u),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,o)}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach(function(t){y(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function y(e,t,r){return(t=function(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m(){var e,t;return b(b({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"frame",load:(e=f().m(function e(){var t;return f().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,u.e("im-frame-plugin").then(u.bind(u,"./plugins/beta/frame/src/manifest.js"));case 1:return t=e.v.manifest,e.a(2,t)}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function u(e){p(i,n,o,u,c,"next",e)}function c(e){p(i,n,o,u,c,"throw",e)}u(void 0)})},function(){return t.apply(this,arguments)})})}u.d(c,{A:()=>m});const v=c.A;export{v as default};
|
|
2
|
+
import{useEffect as t,useRef as e,useState as r}from"react";import{Fragment as n,jsx as o,jsxs as i}from"react/jsx-runtime";var u={"./plugins/beta/frame/src/manifest.js"(u,a,c){function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function l(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 p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?l(Object(r),!0).forEach(function(e){s(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function s(t,e,r){return(e=function(t){var e=function(t){if("object"!=f(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==f(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return b(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)?b(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(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 m(t){var e;if(null==t||null===(e=t.geometry)||void 0===e||null===(e=e.coordinates)||void 0===e||!e[0])return null;var r=t.geometry.coordinates[0],n=1/0,o=1/0,i=-1/0,u=-1/0;return r.forEach(function(t){var e=y(t,2),r=e[0],a=e[1];r<n&&(n=r),r>i&&(i=r),a<o&&(o=a),a>u&&(u=a)}),[n,o,i,u]}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 d(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function g(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach(function(e){O(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function O(t,e,r){return(e=function(t){var e=function(t){if("object"!=v(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==v(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function h(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return j(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?j(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}c.d(a,{manifest:()=>I}),c.r(a);var S={aspectRatio:1,mobileWidth:"300px",tabletWidth:"360px",desktopWidth:"400px"};function w(t){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w(t)}function P(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function E(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?P(Object(r),!0).forEach(function(e){T(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function T(t,e,r){return(e=function(t){var e=function(t){if("object"!=w(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=w(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==w(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function R(t){return R="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},R(t)}function x(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 D(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?x(Object(r),!0).forEach(function(e){M(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function M(t,e,r){return(e=function(t){var e=function(t){if("object"!=R(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==R(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function A(t){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A(t)}function k(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?k(Object(r),!0).forEach(function(e){F(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function F(t,e,r){return(e=function(t){var e=function(t){if("object"!=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+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var _={mobile:{slot:"actions",showLabel:!0},tablet:{slot:"actions",showLabel:!0},desktop:{slot:"actions",showLabel:!0}},I={reducer:{initialState:{frame:null,frameRefs:null},actions:{SET_FRAME:function(t,e){return p(p({},t),{},{frame:e})},SET_FRAME_REFS:function(t,e){return p(p({},t),{},{frameRefs:e})}}},InitComponent:function(e){var r,n,o,i,u=e.appState,a=e.mapState,c=e.mapProvider,f=e.pluginConfig,l=e.pluginState,p=e.services,s=e.buttonConfig,y=u.mode,b=u.breakpoint,m=u.layoutRefs,v=p.eventBus,d=s.frameDone,g=s.frameCancel,O=l.dispatch,h=l.frameRefs,j=l.frame,S=null===(r=null===(n=f.includeModes)||void 0===n?void 0:n.includes(y))||void 0===r||r,w=null!==(o=null===(i=f.excludeModes)||void 0===i?void 0:i.includes(y))&&void 0!==o&&o,P=a.isMapReady&&S&&!w;t(function(){if(P)return d.onClick=function(){var t=function(t){var e=t.viewportEl,r=t.mapProvider,n=t.featureId,o=t.scale,i=t.frameEl.getBoundingClientRect(),u=e.getBoundingClientRect(),a={x:(i.left-u.left)/o,y:(i.top-u.top)/o},c={x:(i.right-u.left)/o,y:(i.top-u.top)/o},f={x:(i.right-u.left)/o,y:(i.bottom-u.top)/o},l={x:(i.left-u.left)/o,y:(i.bottom-u.top)/o},p={type:"Feature",geometry:{type:"Polygon",coordinates:[[r.screenToMap(a),r.screenToMap(c),r.screenToMap(f),r.screenToMap(l),r.screenToMap(a)]]},properties:{}};return n&&(p.id=n),p}({frameEl:h.displayRef.current,viewportEl:m.viewportRef.current,featureId:null==j?void 0:j.featureId,scale:{small:1,medium:1.5,large:2}[a.mapSize],mapProvider:c});O({type:"SET_FRAME",payload:null}),v.emit("frame:done",t)},g.onClick=function(){O({type:"SET_FRAME",payload:null}),v.emit("frame:cancel")},function(){d.onClick=null,g.onClick=null}},[a.isMapReady,y,b,j,h,m,c,O,v,d,g])},controls:[{id:"frame",label:"Frame",mobile:{slot:"middle"},tablet:{slot:"middle"},desktop:{slot:"middle"},render:function(u){var a,c=u.appState,f=u.mapState,l=u.pluginState,p=u.mapProvider,s=c.layoutRefs,y=s.actionsRef,b=s.mainRef,m=s.footerRef,v=s.viewportRef,d=l.dispatch,O=e(null),j=e(null),S=e(null),w=h(r("65px"),2),P=w[0],E=w[1],T=h(r(null),2),R=T[0],x=T[1];return t(function(){d({type:"SET_FRAME_REFS",payload:{displayRef:j}})},[]),t(function(){if(l.frame&&O.current){var t=O.current,e=function(){if(y.current&&b.current&&m.current){var e=b.current.offsetHeight,r=m.current.offsetTop,n=y.current.offsetTop,o=e-Math.min(n,r)+10;E("65px 65px ".concat(o,"px 65px"));var i=t.offsetWidth,u=t.offsetHeight;if(e-o-t.offsetTop===t.offsetHeight){var a=function(t,e,r,n){var o=Number.parseInt(r["".concat(n,"Width")]||t,10),i=Math.min(o,t),u=i/r.aspectRatio;return u>e&&(i=(u=e)*r.aspectRatio),{top:(e-u)/2,left:(t-i)/2,width:i,height:u}}(i,u,l.frame,c.breakpoint),f=a.top,p=a.left,s=a.width,v=a.height,d=f+t.offsetTop,g=p+t.offsetLeft;x({top:"".concat(d,"px"),left:"".concat(g,"px"),width:"".concat(s,"px"),height:"".concat(v,"px")})}}},r=new window.ResizeObserver(e);return r.observe(t),e(),function(){return r.disconnect()}}S.current=null},[l.frame,c.breakpoint,y,b,m]),t(function(){var t;if(null!==(t=l.frame)&&void 0!==t&&t.bounds&&j.current&&v.current&&R){var e=j.current,r=v.current,n=e.getBoundingClientRect(),o=r.getBoundingClientRect(),i={small:1,medium:1.5,large:2}[f.mapSize],u={top:(n.top-o.top)/i,right:(o.right-n.right)/i,bottom:(o.bottom-n.bottom)/i,left:(n.left-o.left)/i};p.setPadding(u),p.fitToBounds(l.frame.bounds,!0)}},[null===(a=l.frame)||void 0===a?void 0:a.bounds,R,p,j,v]),l.frame?i(n,{children:[o("div",{className:"im-c-frame-spacer",style:{inset:P},ref:O}),R&&o("div",{ref:j,className:"im-c-frame-display",style:g({},R)})]}):null}}],buttons:[C({id:"frameDone",label:"Done",variant:"primary",hiddenWhen:function(t){return!t.pluginState.frame}},_),C({id:"frameCancel",label:"Cancel",variant:"tertiary",hiddenWhen:function(t){return!t.pluginState.frame}},_)],api:{addFrame:function(t,e){var r=t.pluginConfig,n=t.pluginState,o=t.services,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=n.dispatch,a=o.eventBus;u({type:"SET_FRAME",payload:E(E(E(E({},S),r),i),{},{featureId:e})}),a.emit("frame:add")},editFeature:function(t,e){var r=t.pluginConfig,n=t.pluginState,o=t.mapProvider,i=t.services,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=n.dispatch,c=i.eventBus,f=m(e),l=function(t,e){var r=m(t);if(!r)return null;var n=y(r,4),o=n[0],i=n[1],u=n[2],a=n[3],c=e.mapToScreen([o,a]),f=e.mapToScreen([u,i]),l=Math.abs(f.x-c.x),p=Math.abs(f.y-c.y);return 0===p?null:Math.round(l/p*1e6)/1e6}(e,o),p=D(D(D(D({},S),r),u),{},{aspectRatio:l,featureId:(null==e?void 0:e.id)||e.properties.id});a({type:"SET_FRAME",payload:D(D({},p),{},{bounds:f})}),c.emit("frame:edit")}}}}},a={};function c(t){var e=a[t];if(void 0!==e)return e.exports;var r=a[t]={exports:{}};return u[t](r,r.exports,c),r.exports}c.d=(t,e)=>{for(var r in e)c.o(e,r)&&!c.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},c.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),c.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var f={};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 p(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,f=Object.create(c.prototype);return s(f,"_invoke",function(r,n,o){var i,a,c,f=0,l=o||[],p=!1,s={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return i=e,a=0,c=t,s.n=r,u}};function y(r,n){for(a=r,c=n,e=0;!p&&f&&!o&&e<l.length;e++){var o,i=l[e],y=s.p,b=i[2];r>3?(o=b===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=r<2&&y<i[1])?(a=0,s.v=n,s.n=i[1]):y<b&&(o=r<3||i[0]>n||n>b)&&(i[4]=r,i[5]=n,s.n=b,a=0))}if(o||r>1)return u;throw p=!0,n}return function(o,l,b){if(f>1)throw TypeError("Generator is already running");for(p&&1===l&&y(l,b),a=l,c=b;(e=a<2?t:c)||!p;){i||(a?a<3?(a>1&&(s.n=-1),y(a,c)):s.n=c:s.v=c);try{if(f=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((e=(p=s.n<0)?c:r.call(n,s))!==u)break}catch(e){i=t,a=1,c=e}finally{f=1}}return{value:e,done:p}}}(r,o,i),!0),f}var u={};function a(){}function c(){}function f(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(s(e={},n,function(){return this}),e),y=f.prototype=a.prototype=Object.create(l);function b(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,s(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t}return c.prototype=f,s(y,"constructor",f),s(f,"constructor",c),c.displayName="GeneratorFunction",s(f,o,"GeneratorFunction"),s(y),s(y,o,"Generator"),s(y,n,function(){return this}),s(y,"toString",function(){return"[object Generator]"}),(p=function(){return{w:i,m:b}})()}function s(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}s=function(t,e,r,n){function i(e,r){s(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))},s(t,e,r,n)}function y(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function m(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach(function(e){v(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function v(t,e,r){return(e=function(t){var e=function(t){if("object"!=l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==l(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(){var t,e;return m(m({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"frame",load:(t=p().m(function t(){var e;return p().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Promise.resolve().then(c.bind(c,"./plugins/beta/frame/src/manifest.js"));case 1:return e=t.v.manifest,t.a(2,e)}},t)}),e=function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function u(t){y(i,n,o,u,a,"next",t)}function a(t){y(i,n,o,u,a,"throw",t)}u(void 0)})},function(){return e.apply(this,arguments)})})}c.d(f,{A:()=>d});const g=f.A;export{g as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
import
|
|
2
|
+
import{createContext as e,useContext as t,useEffect as r}from"react";import{Fragment as n,jsx as i,jsxs as o}from"react/jsx-runtime";var a={"./plugins/beta/map-styles/src/manifest.js"(e,t,a){a.d(t,{manifest:()=>f}),a.r(t);new Set,new Set;function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach(function(t){u(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function u(e,t,r){return(t=function(e){var t=function(e){if("object"!=s(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==s(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var p={slot:"middle",initiallyOpen:!1,dismissable:!0,modal:!0},m=(c({},p),c(c({},p),{},{width:"500px"}),c(c({},p),{},{width:"500px"}),{small:1,medium:1.5,large:2}),f={InitComponent:function(e){var t=e.pluginConfig,o=e.services,a=o.events,s=o.eventBus,l=function(){s.emit(a.MAP_INIT_MAP_STYLES,t.mapStyles)};return r(function(){return s.on(a.APP_READY,l),function(){return s.off(a.APP_READY,l)}},[]),i(n,{})},panels:[{id:"mapStyles",label:"Map styles",mobile:{slot:"bottom",modal:!0,dismissable:!0},tablet:{slot:"inset",modal:!0,width:"400px",dismissable:!0},desktop:{slot:"inset",modal:!0,width:"400px",dismissable:!0},render:function(e){var t=e.mapState,r=e.pluginConfig,n=e.services,a=e.mapProvider,s=t.mapStyle,l=t.mapSize,c=r.mapStyles,u=n.events,p=n.eventBus,f=a.capabilities.supportsMapSizes;return o("div",{className:"im-c-map-styles",children:[i("div",{className:"im-c-map-styles__group",children:i("div",{className:"im-c-map-styles__inner",children:c.filter(function(e){return e.url}).map(function(e){return i("div",{className:"im-c-map-styles__item",children:o("button",{className:"im-c-map-styles__button","aria-pressed":e.id===s.id,onClick:function(){return t=e,void p.emit(u.MAP_SET_STYLE,t);var t},children:[i("div",{className:"im-c-map-styles__image",children:i("img",{src:e.thumbnail||void 0,alt:"",height:"60",width:"60"})}),e.label]})},e.id)})})}),f&&o("div",{className:"im-c-map-styles__group",children:[i("h3",{className:"im-c-map-styles__heading",id:"map-text-sizes",children:"Map size"}),i("div",{className:"im-c-map-styles__inner",children:["small","medium","large"].map(function(e){return i("div",{className:"im-c-map-styles__item",children:o("button",{className:"im-c-map-styles__button",onClick:function(){return t=e,p.emit(u.MAP_SET_SIZE,t),void p.emit(u.MAP_SET_PIXEL_RATIO,window.devicePixelRatio*m[t]);var t},"aria-pressed":e===l,children:[i("div",{className:"im-c-map-styles__image",children:o("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fillRule:"evenodd",children:[i("rect",{className:"im-c-map-styles__image-bg",width:"100%",height:"100%"}),i("g",{style:{transform:"scale(".concat(m[e],")"),transformOrigin:"8px 52px"},children:i("path",{d:"M8 51.785L12.948 38.9h1.837l5.274 12.885h-1.943l-1.503-3.903h-5.387l-1.415 3.903H8zm3.718-5.291h4.368l-1.345-3.569-.914-2.671c-.164.826-.395 1.646-.694 2.46l-1.415 3.78zm15.592 4.139c-3.698 3.143-7.836.271-6.315-2.562.963-1.794 5.529-1.982 6.183-2.21.022-.825.052-2.27-2.241-2.312-1.751-.031-2.242 1.025-2.435 1.776l-1.547-.211c.234-1.102.963-2.856 4.21-2.874 4.037-.022 3.612 2.962 3.612 3.524v2.11c0 .315 0 3.012.501 3.911h-1.652c-.164-.328-.27-.712-.316-1.152zm-.132-3.533c-.907.37-3.444.694-3.964.914-1.293.548-.911 2.399.225 2.637.639.134 3.739.476 3.739-2.971v-.58z"})})]})}),e[0].toUpperCase()+e.slice(1)]})},e)})})]})]})}}],buttons:[{id:"mapStyles",label:"Styles",panelId:"mapStyles",iconId:"map",mobile:{slot:"top-left",showLabel:!1},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"map",svgContent:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>'}]}}},s={};function l(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return a[e](r,r.exports,l),r.exports}l.d=(e,t)=>{for(var r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};function u(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function o(r,n,i,o){var l=n&&n.prototype instanceof s?n:s,c=Object.create(l.prototype);return p(c,"_invoke",function(r,n,i){var o,s,l,c=0,u=i||[],p=!1,m={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,r){return o=t,s=0,l=e,m.n=r,a}};function f(r,n){for(s=r,l=n,t=0;!p&&c&&!i&&t<u.length;t++){var i,o=u[t],f=m.p,d=o[2];r>3?(i=d===n)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=f&&((i=r<2&&f<o[1])?(s=0,m.v=n,m.n=o[1]):f<d&&(i=r<3||o[0]>n||n>d)&&(o[4]=r,o[5]=n,m.n=d,s=0))}if(i||r>1)return a;throw p=!0,n}return function(i,u,d){if(c>1)throw TypeError("Generator is already running");for(p&&1===u&&f(u,d),s=u,l=d;(t=s<2?e:l)||!p;){o||(s?s<3?(s>1&&(m.n=-1),f(s,l)):m.n=l:m.v=l);try{if(c=2,o){if(s||(i="next"),t=o[i]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((t=(p=m.n<0)?l:r.call(n,m))!==a)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:p}}}(r,i,o),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var m=[][n]?t(t([][n]())):(p(t={},n,function(){return this}),t),f=c.prototype=s.prototype=Object.create(m);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,p(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return l.prototype=c,p(f,"constructor",c),p(c,"constructor",l),l.displayName="GeneratorFunction",p(c,i,"GeneratorFunction"),p(f),p(f,i,"Generator"),p(f,n,function(){return this}),p(f,"toString",function(){return"[object Generator]"}),(u=function(){return{w:o,m:d}})()}function p(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}p=function(e,t,r,n){function o(t,r){p(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},p(e,t,r,n)}function m(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function f(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:"mapStyles",manifest:r.manifest,mapStyles:r.mapStyles,load:(e=u().m(function e(){var t;return u().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Promise.resolve().then(l.bind(l,"./plugins/beta/map-styles/src/manifest.js"));case 1:return t=e.v.manifest,e.a(2,t)}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){m(o,n,i,a,s,"next",e)}function s(e){m(o,n,i,a,s,"throw",e)}a(void 0)})},function(){return t.apply(this,arguments)}),handlesMapStyle:!0,api:{}}}l.d(c,{A:()=>f});const d=c.A;export{d as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
import
|
|
2
|
+
import{useMemo as r,useRef as t}from"react";import{jsx as e,jsxs as n}from"react/jsx-runtime";var o={"./plugins/beta/scale-bar/src/manifest.js"(o,a,i){function u(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=Array(t);e<t;e++)n[e]=r[e];return n}i.d(a,{manifest:()=>s}),i.r(a);var l={small:1,medium:1.5,large:2},c={metric:[{threshold:1,abbr:"m",abbrPlural:"m",unit:"metre",unitPlural:"metres",factor:1},{threshold:1e3,abbr:"km",abbrPlural:"km",unit:"kilometre",unitPlural:"kilometres",factor:.001}],imperial:[{threshold:1609.344,abbr:"mi",abbrPlural:"mi",unit:"mile",unitPlural:"miles",factor:1/1609.344},{threshold:.9144,abbr:"yd",abbrPlural:"yds",unit:"yard",unitPlural:"yards",factor:1/.9144},{threshold:.3048,abbr:"ft",abbrPlural:"ft",unit:"foot",unitPlural:"feet",factor:1/.3048}]},f=function(r){var t=Math.pow(10,Math.floor(Math.log10(r))),e=r/t;return(e>=10?10:e>=5?5:e>=3?3:e>=2?2:1)*t},s={controls:[{id:"scaleBar",label:"Scale bar",mobile:{slot:"footer-right"},tablet:{slot:"footer-right"},desktop:{slot:"footer-right"},render:function(o){var a=o.mapState,i=o.pluginConfig,s=a.resolution,b=a.mapSize,d=t(null),m=r(function(){return s?function(r,t,e,n){var o,a=r/l[n],i=120*a,s=c[e],b=function(r,t){var e="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!e){if(Array.isArray(r)||(e=function(r,t){if(r){if("string"==typeof r)return u(r,t);var e={}.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?u(r,t):void 0}}(r))||t&&r&&"number"==typeof r.length){e&&(r=e);var n=0,o=function(){};return{s:o,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r){throw r},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){e=e.call(r)},n:function(){var r=e.next();return i=r.done,r},e:function(r){l=!0,a=r},f:function(){try{i||null==e.return||e.return()}finally{if(l)throw a}}}}(s);try{for(b.s();!(o=b.n()).done;){var d=o.value,m=d.abbr,p=d.abbrPlural,h=d.unit,v=d.unitPlural,y=d.factor,g=f(i*y);if(g>=1&&g<1e3){var P=g/y/a;if(P<=120)return{label:g,abbr:g>1?p:m,width:P,unit:g>1?v:h}}}}catch(r){b.e(r)}finally{b.f()}var w=s[s.length-1],j=i*w.factor,S=f(j),O=S>1?w.abbrPlural:w.abbr,x=S>1?w.abbrPlural:w.abbr;return{label:S,abbr:O,width:S/w.factor/a,unit:x}}(s/1,0,i.units,b):{width:0,label:"",abbr:"",unit:""}},[s,b,i.units]);return e("div",{className:"im-c-scale-bar",ref:d,style:{width:"".concat(m.width,"px")},children:n("span",{className:"im-c-scale-bar__label",children:[e("span",{className:"im-u-visually-hidden",children:"Scale bar: "}),m.label,e("span",{"aria-hidden":"true",children:m.abbr}),e("span",{className:"im-u-visually-hidden",children:m.unit})]})})}}]}}},a={};function i(r){var t=a[r];if(void 0!==t)return t.exports;var e=a[r]={exports:{}};return o[r](e,e.exports,i),e.exports}i.d=(r,t)=>{for(var e in t)i.o(t,e)&&!i.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})},i.o=(r,t)=>Object.prototype.hasOwnProperty.call(r,t),i.r=r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var u={};function l(){var r,t,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function a(e,n,o,a){var l=n&&n.prototype instanceof u?n:u,f=Object.create(l.prototype);return c(f,"_invoke",function(e,n,o){var a,u,l,c=0,f=o||[],s=!1,b={p:0,n:0,v:r,a:d,f:d.bind(r,4),d:function(t,e){return a=t,u=0,l=r,b.n=e,i}};function d(e,n){for(u=e,l=n,t=0;!s&&c&&!o&&t<f.length;t++){var o,a=f[t],d=b.p,m=a[2];e>3?(o=m===n)&&(l=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=r):a[0]<=d&&((o=e<2&&d<a[1])?(u=0,b.v=n,b.n=a[1]):d<m&&(o=e<3||a[0]>n||n>m)&&(a[4]=e,a[5]=n,b.n=m,u=0))}if(o||e>1)return i;throw s=!0,n}return function(o,f,m){if(c>1)throw TypeError("Generator is already running");for(s&&1===f&&d(f,m),u=f,l=m;(t=u<2?r:l)||!s;){a||(u?u<3?(u>1&&(b.n=-1),d(u,l)):b.n=l:b.v=l);try{if(c=2,a){if(u||(o="next"),t=a[o]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,u<2&&(u=0)}else 1===u&&(t=a.return)&&t.call(a),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=r}else if((t=(s=b.n<0)?l:e.call(n,b))!==i)break}catch(t){a=r,u=1,l=t}finally{c=1}}return{value:t,done:s}}}(e,o,a),!0),f}var i={};function u(){}function f(){}function s(){}t=Object.getPrototypeOf;var b=[][n]?t(t([][n]())):(c(t={},n,function(){return this}),t),d=s.prototype=u.prototype=Object.create(b);function m(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,s):(r.__proto__=s,c(r,o,"GeneratorFunction")),r.prototype=Object.create(d),r}return f.prototype=s,c(d,"constructor",s),c(s,"constructor",f),f.displayName="GeneratorFunction",c(s,o,"GeneratorFunction"),c(d),c(d,o,"Generator"),c(d,n,function(){return this}),c(d,"toString",function(){return"[object Generator]"}),(l=function(){return{w:a,m}})()}function c(r,t,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(r){o=0}c=function(r,t,e,n){function a(t,e){c(r,t,function(r){return this._invoke(t,e,r)})}t?o?o(r,t,{value:e,enumerable:!n,configurable:!n,writable:!n}):r[t]=e:(a("next",0),a("throw",1),a("return",2))},c(r,t,e,n)}function f(r,t,e,n,o,a,i){try{var u=r[a](i),l=u.value}catch(r){return void e(r)}u.done?t(l):Promise.resolve(l).then(n,o)}function s(){var r,t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.manifest,o=e.units;return{id:"scaleBar",manifest:n,units:void 0===o?"metric":o,load:(r=l().m(function r(){var t;return l().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,Promise.resolve().then(i.bind(i,"./plugins/beta/scale-bar/src/manifest.js"));case 1:return t=r.v.manifest,r.a(2,t)}},r)}),t=function(){var t=this,e=arguments;return new Promise(function(n,o){var a=r.apply(t,e);function i(r){f(a,n,o,i,u,"next",r)}function u(r){f(a,n,o,i,u,"throw",r)}i(void 0)})},function(){return t.apply(this,arguments)})}}i.d(u,{A:()=>s});const b=u.A;export{b as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
import
|
|
2
|
+
import{useEffect as t}from"react";import{jsx as e}from"react/jsx-runtime";var n={"./plugins/beta/use-location/src/manifest.js"(n,r,o){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 a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function c(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?a(Object(n),!0).forEach(function(e){u(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function u(t,e,n){return(e=function(t){var e=function(t){if("object"!=i(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}o.d(r,{manifest:()=>f}),o.r(r);var l={PERMISSION_DENIED:"Location permission denied. Please enable it in your browser settings.",POSITION_UNAVAILABLE:"Location information is unavailable.",TIMEOUT:"The location request timed out. Please try again.",FALLBACK:"Unable to get your location."},s={slot:"right-top",showLabel:!1},f={InitComponent:function(e){e.appConfig;var n=e.appState,r=e.pluginState,o=e.mapState,i=e.mapProvider,a=e.buttonConfig.useLocation;return t(function(){if(o.isMapReady)return function(t){var e=t.appState,n=t.pluginState,r=t.mapProvider,o=t.useLocationButton,i=e.dispatch,a=e.buttonRefs,c=n.dispatch;o.onClick=function(){navigator.geolocation.getCurrentPosition(function(t){var e=t.coords,n=e.latitude,o=e.longitude;try{r.setView({center:[o,n],zoom:12})}catch(t){console.log("Map provider failed to pan:",t)}},function(t){var e=function(t){return t&&"number"==typeof t.code&&l[t.code]||l.FALLBACK}(t),n=a.current[o.id];c({type:"SET_ERROR_MESSAGE",payload:e}),i({type:"OPEN_PANEL",payload:{panelId:"useLocation",props:{triggeringElement:n}}})},{enableHighAccuracy:!0,maximumAge:0,timeout:1e4})}}({appState:n,pluginState:r,mapProvider:i,useLocationButton:a}),function(){a.onClick=null}},[o.isMapReady]),null},reducer:{initialState:{errorMessage:null},actions:{SET_ERROR_MESSAGE:function(t,e){return c(c({},t),{},{errorMessage:e})}}},buttons:[{id:"useLocation",group:"location",label:"Use your location",iconId:"locateFixed",hiddenWhen:function(){return!navigator.geolocation},mobile:s,tablet:s,desktop:s}],panels:[{id:"useLocation",label:"Problem getting your location",mobile:{slot:"banner",initiallyOpen:!1,dismissable:!0,modal:!0},tablet:{slot:"banner",initiallyOpen:!1,dismissable:!0,modal:!0},desktop:{slot:"banner",initiallyOpen:!1,dismissable:!0,modal:!0},render:function(t){var n=t.pluginState.errorMessage;return e("div",{className:"im-c-use-location",children:e("p",{children:n})})}}],icons:[{id:"locateFixed",svgContent:'<line x1="2" x2="5" y1="12" y2="12"/><line x1="19" x2="22" y1="12" y2="12"/><line x1="12" x2="12" y1="2" y2="5"/><line x1="12" x2="12" y1="19" y2="22"/><circle cx="12" cy="12" r="7"/><circle cx="12" cy="12" r="3"/>'}]}}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={exports:{}};return n[t](i,i.exports,o),i.exports}o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};function a(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var a=r&&r.prototype instanceof l?r:l,s=Object.create(a.prototype);return c(s,"_invoke",function(n,r,o){var i,a,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,a=0,c=t,p.n=n,u}};function y(n,r){for(a=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,b=i[2];n>3?(o=b===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(a=0,p.v=r,p.n=i[1]):y<b&&(o=n<3||i[0]>r||r>b)&&(i[4]=n,i[5]=r,p.n=b,a=0))}if(o||n>1)return u;throw f=!0,r}return function(o,s,b){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,b),a=s,c=b;(e=a<2?t:c)||!f;){i||(a?a<3?(a>1&&(p.n=-1),y(a,c)):p.n=c:p.v=c);try{if(l=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==u)break}catch(e){i=t,a=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),s}var u={};function l(){}function s(){}function f(){}e=Object.getPrototypeOf;var p=[][r]?e(e([][r]())):(c(e={},r,function(){return this}),e),y=f.prototype=l.prototype=Object.create(p);function b(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,c(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t}return s.prototype=f,c(y,"constructor",f),c(f,"constructor",s),s.displayName="GeneratorFunction",c(f,o,"GeneratorFunction"),c(y),c(y,o,"Generator"),c(y,r,function(){return this}),c(y,"toString",function(){return"[object Generator]"}),(a=function(){return{w:i,m:b}})()}function c(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}c=function(t,e,n,r){function i(e,n){c(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},c(t,e,n,r)}function u(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function l(){return{id:"useLocation",load:(t=a().m(function t(){var e;return a().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Promise.resolve().then(o.bind(o,"./plugins/beta/use-location/src/manifest.js"));case 1:return e=t.v.manifest,t.a(2,e)}},t)}),e=function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){u(i,r,o,a,c,"next",t)}function c(t){u(i,r,o,a,c,"throw",t)}a(void 0)})},function(){return e.apply(this,arguments)})};var t,e}o.d(i,{A:()=>l});const s=i.A;export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.im-c-mark-location{display:flex;justify-content:center;gap:var(--divider-gap)}.im-o-app--mobile .im-c-mark-location .im-c-button-wrapper,.im-o-app--mobile .im-c-mark-location .im-c-map-button{flex:1 1 auto;min-width:fit-content}.im-o-app--mouse.im-o-app--tablet .im-c-mark-location .im-c-map-button,.im-o-app--mouse.im-o-app--desktop .im-c-mark-location .im-c-map-button{min-width:150px}.im-o-app--mobile .im-c-mark-location .im-c-map-button{flex:1 1 auto;min-width:fit-content}.im-c-button-wrapper--select-at-target{position:absolute;bottom:calc(100% + var(--primary-gap))}
|
|
1
|
+
.im-c-mark-location{display:flex;justify-content:center;gap:var(--divider-gap)}.im-o-app--mobile .im-c-mark-location .im-c-button-wrapper,.im-o-app--mobile .im-c-mark-location .im-c-map-button{flex:1 1 auto;min-width:fit-content}.im-o-app--mouse.im-o-app--tablet .im-c-mark-location .im-c-map-button,.im-o-app--mouse.im-o-app--desktop .im-c-mark-location .im-c-map-button{min-width:150px}.im-o-app--mobile .im-c-mark-location .im-c-map-button{flex:1 1 auto;min-width:fit-content}.im-c-button-wrapper--select-at-target{position:absolute;bottom:calc(100% + var(--primary-gap));z-index:0}
|