@element-editor/ui 0.2.1 → 0.2.2
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/AGENTS.md +1 -1
- package/dist/{BooleanOperations-BRO7NHUY.js → BooleanOperations-CUQDHcha.js} +1 -1
- package/dist/{BooleanOperations-C2uOHRu3.cjs → BooleanOperations-DrQS-3mJ.cjs} +1 -1
- package/dist/{DataTable-B-2VjBEz.cjs → DataTable-BPtIbZh4.cjs} +1 -1
- package/dist/{DataTable-CS-3dIqY.js → DataTable-Ce5P1HaO.js} +3 -3
- package/dist/{DataTablePanel-DDFUmMaM.js → DataTablePanel-DqS1lhWv.js} +1 -1
- package/dist/{DataTablePanel-58LwzXQR.cjs → DataTablePanel-PH5qtwrD.cjs} +1 -1
- package/dist/{FeatureEditModal-Cc8N6vei.cjs → FeatureEditModal-BNil19oc.cjs} +1 -1
- package/dist/{FeatureEditModal-Dr10p3nE.js → FeatureEditModal-DvdBiMck.js} +2 -2
- package/dist/{FeatureList-Bo9w9nre.js → FeatureList-DJTd3gEU.js} +2 -2
- package/dist/{FeatureList-VRYesXCq.cjs → FeatureList-F3BgjXro.cjs} +1 -1
- package/dist/{FeatureRowContextMenu-CtBqdC1j.cjs → FeatureRowContextMenu-Bw9Z6mpN.cjs} +1 -1
- package/dist/{FeatureRowContextMenu-DCUIiDwc.js → FeatureRowContextMenu-Dlsk7erC.js} +1 -1
- package/dist/{GeoJSONModal-BV9Tamf4.js → GeoJSONModal-BhHkqLAR.js} +2 -2
- package/dist/{GeoJSONModal-Dd-nBufy.cjs → GeoJSONModal-D6JBr9FA.cjs} +1 -1
- package/dist/{SchemaModal-gAuDkd-L.cjs → SchemaModal-5F0HBHGS.cjs} +1 -1
- package/dist/{SchemaModal-DvMbWskS.js → SchemaModal-CI5i_Kxh.js} +2 -2
- package/dist/{SettingsModal-BScVTjpn.js → SettingsModal-4OuBLPyW.js} +2 -2
- package/dist/{SettingsModal-CqaSFxxR.cjs → SettingsModal-au03oFaJ.cjs} +1 -1
- package/dist/{ShortcutsModal-D1Y2bGT8.cjs → ShortcutsModal-DBE-gSUi.cjs} +1 -1
- package/dist/{ShortcutsModal-ozuS2Ysb.js → ShortcutsModal-jGmjontP.js} +2 -2
- package/dist/contexts/ElementEditorConfigContext.d.cts +1 -1
- package/dist/contexts/ElementEditorConfigContext.d.ts +1 -1
- package/dist/element-editor-ui.cjs +1 -1
- package/dist/element-editor-ui.es.js +1 -1
- package/dist/index-mfb91TEp.cjs +1 -0
- package/dist/{index-CILw1Du5.js → index-rT-R0kyV.js} +1028 -988
- package/dist/{useWindowFocus-EemgNOuz.cjs → useWindowFocus-CRWNNxOL.cjs} +1 -1
- package/dist/{useWindowFocus-DuQVjnHE.js → useWindowFocus-CroxgGOo.js} +1 -1
- package/package.json +2 -2
- package/dist/index-DG4wEjGj.cjs +0 -1
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import { e as
|
|
6
|
-
import { jsx as r, jsxs as T, Fragment as
|
|
7
|
-
import { u as ce, f as
|
|
8
|
-
import { loadCustomBindings as
|
|
9
|
-
import { getGeometryBBox as
|
|
10
|
-
import { MapPinPlus as
|
|
11
|
-
import { useShallow as
|
|
12
|
-
import { i as
|
|
13
|
-
import { clsx as
|
|
14
|
-
import { createPortal as
|
|
15
|
-
import { centroid as
|
|
16
|
-
import { featureCollection as
|
|
17
|
-
import { bbox as
|
|
18
|
-
function
|
|
1
|
+
var Fr = Object.defineProperty;
|
|
2
|
+
var zr = (t, e, n) => e in t ? Fr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var Dt = (t, e, n) => zr(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import Lr, { lazy as Ut, useState as q, createElement as Rr, useContext as rt, useCallback as J, createContext as $r, useRef as B, useLayoutEffect as fe, useEffect as $, useMemo as ue, isValidElement as Kr, cloneElement as Or, memo as jt, Suspense as qt, useId as Br } from "react";
|
|
5
|
+
import { e as se, h as le, g as ze, b as Wr, s as Ht, u as S, f as U, l as _r, E as Gr, T as Ur, m as jr, M as qr } from "./useAdapterControls-DVjkwRZ_.js";
|
|
6
|
+
import { jsx as r, jsxs as T, Fragment as re } from "react/jsx-runtime";
|
|
7
|
+
import { u as ce, f as Hr, e as Vr, w as Jr, E as Xr } from "./useAccentStyle-CPo2XqAn.js";
|
|
8
|
+
import { loadCustomBindings as Zr, syncShortcutCache as Oe, getEffectiveKey as Vt, findConflict as Yr, saveCustomBindings as Ze, getCurrentKey as Qr, isMultiGeometry as en, getPartCount as nt, sidebarTakesSpace as ot, NARROW_EDITOR_WIDTH as It, getPartGeometry as tn, getPartLabel as rn, BOUNDARIES_SCHEMA_ID as nn, featureLimitMessage as on, canProcessShape as Le, setGeometryRunner as sn, countShapeVertices as Be, resolveUnitSystem as an, isLineGeometryType as ln, placeBox as cn } from "@element-editor/core/internal";
|
|
9
|
+
import { getGeometryBBox as st, readStorage as Jt, writeStorage as dn, getFixedShortcutDisplay as Xt, ElementEditorError as We, formatLength as Mt, subscribeToDataChanges as un, readAccentPalette as Tt, DEFAULT_MAX_IMPORT_BYTES as mn, parseGeoJSONText as fn } from "@element-editor/core";
|
|
10
|
+
import { MapPinPlus as pn, SidebarSimple as Zt, ArrowLeft as hn, CopySimple as Yt, Trash as Re, CaretDown as gn, CaretRight as yn, Check as bn, Copy as vn, FolderPlus as xn, MapPin as Qt, Polygon as er, StackSimple as Qe, LineSegment as tr, PencilSimple as wn, EyeClosed as et, Eye as it, Folder as kn, FolderOpen as Sn, DotsThree as Cn, Pencil as Nn, FolderMinus as En, Path as Pn, Circle as Dn, Rectangle as In, ScribbleLoop as Mn, HandTap as Tn, Ruler as An, MagnifyingGlass as Ye, X as At, Resize as rr, Scissors as nr, Knife as or, WaveSine as sr, SquareLogo as ir, Shapes as ar, StackPlus as lr, LineSegments as Fn, DotOutline as zn, Crosshair as Ln, ArrowArcRight as Rn, ArrowArcLeft as $n, ArrowsHorizontal as Kn, Hexagon as On, CircleHalfTilt as Bn, CornersOut as Wn, NavigationArrow as _n } from "@phosphor-icons/react";
|
|
11
|
+
import { useShallow as Gn } from "zustand/react/shallow";
|
|
12
|
+
import { i as Un, c as cr, I as Ft, T as jn, f as ve, a as Q, B as ke, b as Me, C as dr, S as zt, d as me, g as Lt, K as Ee, E as te, e as Te, h as qn } from "./EditToolbarBtn-SR4xHd8G.js";
|
|
13
|
+
import { clsx as oe } from "clsx";
|
|
14
|
+
import { createPortal as ur } from "react-dom";
|
|
15
|
+
import { centroid as Hn } from "@turf/centroid";
|
|
16
|
+
import { featureCollection as Vn } from "@turf/helpers";
|
|
17
|
+
import { bbox as mr } from "@turf/bbox";
|
|
18
|
+
function pe(t) {
|
|
19
19
|
let e = null, n = null;
|
|
20
|
-
const s = () => e ?? (e = t().then((i) => (n = i.default, i))), o =
|
|
20
|
+
const s = () => e ?? (e = t().then((i) => (n = i.default, i))), o = Ut(s);
|
|
21
21
|
function d(i) {
|
|
22
22
|
const [m] = q(() => n ?? o);
|
|
23
|
-
return
|
|
23
|
+
return Rr(m, i);
|
|
24
24
|
}
|
|
25
25
|
return Object.assign(d, { preload: s });
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
function
|
|
29
|
-
for (const e of t)
|
|
27
|
+
const fr = [];
|
|
28
|
+
function at(...t) {
|
|
29
|
+
for (const e of t) fr.push(e.preload);
|
|
30
30
|
}
|
|
31
|
-
let
|
|
32
|
-
function
|
|
33
|
-
if (
|
|
34
|
-
|
|
31
|
+
let Rt = !1;
|
|
32
|
+
function Gs() {
|
|
33
|
+
if (Rt || typeof window > "u") return;
|
|
34
|
+
Rt = !0;
|
|
35
35
|
const t = () => {
|
|
36
|
-
for (const n of
|
|
36
|
+
for (const n of fr) n().catch(() => {
|
|
37
37
|
});
|
|
38
38
|
}, e = window.requestIdleCallback;
|
|
39
39
|
e ? e(t, { timeout: 3e3 }) : setTimeout(t, 1500);
|
|
40
40
|
}
|
|
41
|
-
const lt =
|
|
42
|
-
function
|
|
41
|
+
const lt = $r(null);
|
|
42
|
+
function Jn({ children: t }) {
|
|
43
43
|
const e = ce(), [n, s] = q(() => {
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
}), o = J((
|
|
47
|
-
const f =
|
|
44
|
+
const l = Zr(e);
|
|
45
|
+
return Oe(l), l;
|
|
46
|
+
}), o = J((l) => Vt(l, n), [n]), d = J((l, h) => {
|
|
47
|
+
const f = Yr(h, l, n);
|
|
48
48
|
if (f) return f;
|
|
49
|
-
const
|
|
50
|
-
return s(
|
|
51
|
-
}, [n, e]), i = J((
|
|
52
|
-
const
|
|
53
|
-
delete
|
|
49
|
+
const g = { ...n, [l]: h };
|
|
50
|
+
return s(g), Ze(g, e), Oe(g), null;
|
|
51
|
+
}, [n, e]), i = J((l) => {
|
|
52
|
+
const h = { ...n };
|
|
53
|
+
delete h[l], s(h), Ze(h, e), Oe(h);
|
|
54
54
|
}, [n, e]), m = J(() => {
|
|
55
|
-
s({}),
|
|
55
|
+
s({}), Ze({}, e), Oe({});
|
|
56
56
|
}, [e]);
|
|
57
57
|
return /* @__PURE__ */ r(lt.Provider, { value: { custom: n, getKey: o, setKey: d, resetKey: i, resetAll: m }, children: t });
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
return
|
|
59
|
+
function Xn() {
|
|
60
|
+
return rt(lt);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
const t =
|
|
62
|
+
function Pe() {
|
|
63
|
+
const t = rt(lt);
|
|
64
64
|
if (!t) throw new Error("useShortcutConfig must be used inside ShortcutConfigProvider");
|
|
65
65
|
return t;
|
|
66
66
|
}
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
function
|
|
67
|
+
const pr = pe(() => import("./FeatureList-DJTd3gEU.js")), Zn = pe(() => import("./DataTable-Ce5P1HaO.js")), Yn = pe(() => import("./SchemaEditor-ryoTgaLb.js"));
|
|
68
|
+
at(pr, Zn, Yn);
|
|
69
|
+
function Qn() {
|
|
70
70
|
return /* @__PURE__ */ T("div", { className: "flex flex-col items-center justify-center gap-3 h-full text-elm-text-muted", children: [
|
|
71
|
-
/* @__PURE__ */ r(
|
|
71
|
+
/* @__PURE__ */ r(pn, { size: 40, weight: "light" }),
|
|
72
72
|
/* @__PURE__ */ r("p", { className: "text-sm text-center text-balance leading-snug", children: "No features yet — add a point, line, or area" })
|
|
73
73
|
] });
|
|
74
74
|
}
|
|
75
|
-
const
|
|
76
|
-
function
|
|
75
|
+
const eo = () => typeof navigator < "u" && /Mac/.test(navigator.platform);
|
|
76
|
+
function to(t) {
|
|
77
77
|
const e = t == null ? void 0 : t.name;
|
|
78
78
|
return {
|
|
79
79
|
type: "error",
|
|
@@ -84,7 +84,7 @@ function Qn(t) {
|
|
|
84
84
|
quiet: !0
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function ro(t, e) {
|
|
88
88
|
if (e.length === 0) return t.map((s) => s.id);
|
|
89
89
|
const n = [];
|
|
90
90
|
for (const s of e)
|
|
@@ -94,7 +94,7 @@ function eo(t, e) {
|
|
|
94
94
|
s.groupId || n.push(s.id);
|
|
95
95
|
return n;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function Us(t, e) {
|
|
98
98
|
const n = [];
|
|
99
99
|
for (const s of e)
|
|
100
100
|
if (!s.collapsed)
|
|
@@ -102,35 +102,35 @@ function Os(t, e) {
|
|
|
102
102
|
for (const s of t) s.groupId || n.push(s.id);
|
|
103
103
|
return n;
|
|
104
104
|
}
|
|
105
|
-
const
|
|
106
|
-
function
|
|
107
|
-
const e =
|
|
105
|
+
const no = "data-elm-window", tt = /* @__PURE__ */ new WeakMap();
|
|
106
|
+
function oo(t) {
|
|
107
|
+
const e = tt.get(t);
|
|
108
108
|
if (!(e != null && e.size)) return !1;
|
|
109
109
|
let n = null;
|
|
110
110
|
for (const s of e) (!n || s.z() > n.z()) && (n = s);
|
|
111
111
|
return n == null || n.close(), !!n;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
const { uiStore: d } =
|
|
115
|
-
|
|
113
|
+
function js(t, e, n, s, { topWindow: o = !0 } = {}) {
|
|
114
|
+
const { uiStore: d } = se(), i = B(n), m = B(s);
|
|
115
|
+
fe(() => {
|
|
116
116
|
i.current = n, m.current = s;
|
|
117
117
|
}), $(() => {
|
|
118
118
|
if (!e) return;
|
|
119
|
-
const
|
|
120
|
-
let f =
|
|
121
|
-
f ||
|
|
122
|
-
const
|
|
119
|
+
const l = document.activeElement, h = { z: () => m.current, close: () => i.current() };
|
|
120
|
+
let f = tt.get(d);
|
|
121
|
+
f || tt.set(d, f = /* @__PURE__ */ new Set()), o && f.add(h);
|
|
122
|
+
const g = t.current;
|
|
123
123
|
function u(x) {
|
|
124
|
-
x.key !== "Escape" || x.defaultPrevented || !(
|
|
124
|
+
x.key !== "Escape" || x.defaultPrevented || !(g != null && g.contains(x.target)) || (x.preventDefault(), i.current());
|
|
125
125
|
}
|
|
126
126
|
return document.addEventListener("keydown", u), () => {
|
|
127
|
-
f.delete(
|
|
127
|
+
f.delete(h), document.removeEventListener("keydown", u);
|
|
128
128
|
const x = document.activeElement;
|
|
129
|
-
(!x || x === document.body || ((
|
|
129
|
+
(!x || x === document.body || ((g == null ? void 0 : g.contains(x)) ?? !1) || !x.isConnected) && (l != null && l.isConnected) && l !== document.body && l.focus({ preventScroll: !0 });
|
|
130
130
|
};
|
|
131
131
|
}, [e, t, d, o]);
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function so() {
|
|
134
134
|
return new Promise((t) => {
|
|
135
135
|
const e = document.createElement("input");
|
|
136
136
|
e.type = "file", e.accept = ".geojson,.json,application/geo+json,application/json", e.style.display = "none", document.body.appendChild(e);
|
|
@@ -147,102 +147,102 @@ function no() {
|
|
|
147
147
|
}, { once: !0 }), e.click();
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
-
const
|
|
151
|
-
function
|
|
150
|
+
const Ne = /* @__PURE__ */ new Map();
|
|
151
|
+
function hr(t) {
|
|
152
152
|
if (t.closest("[data-elm-portal]")) return !0;
|
|
153
153
|
let e = t;
|
|
154
154
|
for (; e.parentElement && e.parentElement !== document.body; ) e = e.parentElement;
|
|
155
155
|
return e.parentElement === document.body && (e.hasAttribute("data-elm-theme") || e.hasAttribute("data-elm-portal"));
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function io(t, e) {
|
|
158
158
|
if (!e || t.composedPath().includes(e.root)) return !0;
|
|
159
159
|
const n = document.activeElement;
|
|
160
|
-
return !n || n === document.body ||
|
|
160
|
+
return !n || n === document.body || hr(n) ? e.pointerInside ?? Ne.size === 1 : !1;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
const { uiStore: t } =
|
|
164
|
-
return J((e) =>
|
|
162
|
+
function Se() {
|
|
163
|
+
const { uiStore: t } = se();
|
|
164
|
+
return J((e) => io(e, Ne.get(t)), [t]);
|
|
165
165
|
}
|
|
166
|
-
const
|
|
167
|
-
function
|
|
166
|
+
const ao = 140;
|
|
167
|
+
function lo(t, e) {
|
|
168
168
|
t.querySelectorAll(`[data-elm-shortcut="${e}"]`).forEach((n) => {
|
|
169
|
-
n.disabled || (n.setAttribute("data-pressed", ""), setTimeout(() => n.removeAttribute("data-pressed"),
|
|
169
|
+
n.disabled || (n.setAttribute("data-pressed", ""), setTimeout(() => n.removeAttribute("data-pressed"), ao));
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
const
|
|
173
|
-
function
|
|
172
|
+
const co = ["point", "line", "polygon", "route", "circle", "rectangle", "freehand", "picker"];
|
|
173
|
+
function qs(t) {
|
|
174
174
|
var x;
|
|
175
|
-
const { dataStore: e, uiStore: n } =
|
|
176
|
-
|
|
177
|
-
const u = J((w) =>
|
|
175
|
+
const { dataStore: e, uiStore: n } = se(), s = le(), { panTo: o, fitBounds: d, setZoom: i } = ze(), m = Wr(), l = ce(), h = Se(), f = (x = Xn()) == null ? void 0 : x.custom, g = B(f);
|
|
176
|
+
g.current = f;
|
|
177
|
+
const u = J((w) => g.current ? Vt(w, g.current) : Qr(w), []);
|
|
178
178
|
$(() => {
|
|
179
179
|
if (!t) return;
|
|
180
180
|
const w = t.closest("[data-elm-theme]") ?? t, M = { root: w, pointerInside: null };
|
|
181
|
-
|
|
182
|
-
const C = (
|
|
183
|
-
|
|
181
|
+
Ne.set(n, M);
|
|
182
|
+
const C = (a) => {
|
|
183
|
+
a.composedPath().includes(w) ? M.pointerInside = !0 : a.target instanceof Element && hr(a.target) || (M.pointerInside = !1);
|
|
184
184
|
};
|
|
185
185
|
return document.addEventListener("pointerdown", C, { capture: !0, passive: !0 }), () => {
|
|
186
|
-
|
|
186
|
+
Ne.get(n) === M && Ne.delete(n), document.removeEventListener("pointerdown", C, { capture: !0 });
|
|
187
187
|
};
|
|
188
188
|
}, [t, n]), $(() => {
|
|
189
|
-
if (!
|
|
189
|
+
if (!l.ui.keyboardShortcuts.enabled || !l.ui.keyboardShortcuts.mapZoom) return;
|
|
190
190
|
function w(M) {
|
|
191
|
-
if (!(M.metaKey || M.ctrlKey) || !
|
|
192
|
-
const C = M.target,
|
|
193
|
-
if (
|
|
194
|
-
const p = M.key === "+" || M.key === "=",
|
|
195
|
-
if (!p && !
|
|
191
|
+
if (!(M.metaKey || M.ctrlKey) || !h(M)) return;
|
|
192
|
+
const C = M.target, a = C == null ? void 0 : C.tagName;
|
|
193
|
+
if (a === "INPUT" || a === "TEXTAREA" || a === "SELECT" || C != null && C.isContentEditable) return;
|
|
194
|
+
const p = M.key === "+" || M.key === "=", c = M.key === "-" || M.key === "_";
|
|
195
|
+
if (!p && !c || !i) return;
|
|
196
196
|
M.preventDefault();
|
|
197
197
|
const E = e.getState().currentZoom;
|
|
198
198
|
i(E + (p ? 1 : -1));
|
|
199
199
|
}
|
|
200
200
|
return window.addEventListener("keydown", w, { capture: !0 }), () => window.removeEventListener("keydown", w, { capture: !0 });
|
|
201
|
-
}, [
|
|
202
|
-
const w =
|
|
203
|
-
function M(
|
|
201
|
+
}, [l.ui.keyboardShortcuts.enabled, l.ui.keyboardShortcuts.mapZoom, i, e]), $(() => {
|
|
202
|
+
const w = l.ui.keyboardShortcuts.enabled;
|
|
203
|
+
function M(a) {
|
|
204
204
|
var L;
|
|
205
|
-
if (!w &&
|
|
206
|
-
const p = e.getState(),
|
|
205
|
+
if (!w && a.key !== "Enter" || !h(a)) return;
|
|
206
|
+
const p = e.getState(), c = n.getState(), E = c.readonly, y = (v) => {
|
|
207
207
|
var W;
|
|
208
|
-
return
|
|
209
|
-
}, N =
|
|
208
|
+
return lo(((W = Ne.get(n)) == null ? void 0 : W.root) ?? document, v);
|
|
209
|
+
}, N = a.target.tagName, P = a.target, z = a.composedPath(), K = z.some((v) => {
|
|
210
210
|
if (!(v instanceof Element)) return !1;
|
|
211
211
|
const W = v.getAttribute("role");
|
|
212
212
|
return W === "grid" || W === "treegrid";
|
|
213
|
-
}), b = N === "INPUT" || N === "TEXTAREA" || N === "SELECT" || P.isContentEditable || K, k =
|
|
214
|
-
if (!b && !E && k === "z" && (
|
|
215
|
-
|
|
213
|
+
}), b = N === "INPUT" || N === "TEXTAREA" || N === "SELECT" || P.isContentEditable || K, k = a.key.toLowerCase();
|
|
214
|
+
if (!b && !E && k === "z" && (a.metaKey || a.ctrlKey) && !a.shiftKey) {
|
|
215
|
+
a.preventDefault(), y("undo"), p.undoStack.length > 0 && (p.undo(), s({ type: "undo" }));
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
|
-
if (!b && !E && k === "z" && (
|
|
219
|
-
|
|
218
|
+
if (!b && !E && k === "z" && (a.metaKey || a.ctrlKey) && a.shiftKey) {
|
|
219
|
+
a.preventDefault(), y("redo"), p.redoStack.length > 0 && (p.redo(), s({ type: "redo" }));
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
|
-
if (!b && (
|
|
223
|
-
|
|
222
|
+
if (!b && (a.metaKey || a.ctrlKey) && (a.key === "a" || a.key === "A")) {
|
|
223
|
+
a.preventDefault();
|
|
224
224
|
const v = new Set(p.groups.filter((H) => H.hidden).map((H) => H.id)), W = p.features.filter((H) => !H.hidden && !(H.groupId && v.has(H.groupId))).map((H) => H.id);
|
|
225
225
|
W.length > 0 && p.setSelection(W);
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
|
-
if (!b && (
|
|
229
|
-
|
|
230
|
-
const v = !
|
|
231
|
-
|
|
228
|
+
if (!b && (a.metaKey || a.ctrlKey) && !a.shiftKey && (a.key === "j" || a.key === "J")) {
|
|
229
|
+
a.preventDefault();
|
|
230
|
+
const v = !c.autoExitAfterDraw;
|
|
231
|
+
c.setAutoExitAfterDraw(v), s({
|
|
232
232
|
type: "success",
|
|
233
233
|
message: v ? "Drawing tools will exit after each shape" : "Drawing tools will stay active after each shape",
|
|
234
234
|
description: v ? "You’ll go back to select mode. Press a tool key to draw again." : "Keep drawing more shapes in a row. Press the tool key again or Esc to exit."
|
|
235
235
|
});
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
238
|
-
if (!b && !E && (
|
|
239
|
-
|
|
238
|
+
if (!b && !E && (a.metaKey || a.ctrlKey) && !a.shiftKey && (a.key === "o" || a.key === "O")) {
|
|
239
|
+
a.preventDefault(), so().then((v) => {
|
|
240
240
|
v && m(v);
|
|
241
241
|
});
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
|
-
if (!b && (
|
|
245
|
-
|
|
244
|
+
if (!b && (a.metaKey || a.ctrlKey) && !a.shiftKey && (a.key === "s" || a.key === "S")) {
|
|
245
|
+
a.preventDefault();
|
|
246
246
|
const v = p.exportGeoJSON(), W = JSON.parse(v);
|
|
247
247
|
if (!Array.isArray(W.features) || W.features.length === 0) {
|
|
248
248
|
s({ type: "warning", message: "Export failed", description: "No features to export — draw or import something first." });
|
|
@@ -250,24 +250,24 @@ function Ws(t) {
|
|
|
250
250
|
}
|
|
251
251
|
const H = W.features.length;
|
|
252
252
|
(async () => {
|
|
253
|
-
const F = await
|
|
253
|
+
const F = await Ht(v);
|
|
254
254
|
F && s({
|
|
255
255
|
type: "success",
|
|
256
256
|
message: `Exported ${F.name}`,
|
|
257
|
-
description: `${H === 1 ? "1 feature" : `${H} features`}
|
|
257
|
+
description: `${H === 1 ? "1 feature" : `${H} features`}, ${(F.bytes / 1024).toFixed(1)} KB`
|
|
258
258
|
});
|
|
259
259
|
})();
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
|
-
if (!b && (
|
|
263
|
-
if (
|
|
262
|
+
if (!b && (a.metaKey || a.ctrlKey)) {
|
|
263
|
+
if (a.key === "c") {
|
|
264
264
|
if (p.selectedIds.length === 0) return;
|
|
265
265
|
p.copySelection().then((v) => s(v ? { type: "selection:copied" } : { type: "warning", message: "Copied for pasting in this editor only", description: "The browser did not allow writing to the system clipboard." }));
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
|
-
if (
|
|
269
|
-
if (
|
|
270
|
-
|
|
268
|
+
if (a.key === "d") {
|
|
269
|
+
if (a.preventDefault(), E) return;
|
|
270
|
+
y("duplicate");
|
|
271
271
|
const v = p.selectedIds;
|
|
272
272
|
if (p.duplicateSelection())
|
|
273
273
|
if (v.length === 1) {
|
|
@@ -277,54 +277,54 @@ function Ws(t) {
|
|
|
277
277
|
s({ type: "features:duplicated", count: v.length });
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
|
-
if (
|
|
280
|
+
if (a.key === "e" || a.key === "E") {
|
|
281
281
|
if (p.selectedIds.length !== 1) return;
|
|
282
|
-
|
|
282
|
+
a.preventDefault(), c.openEditDialog(p.selectedIds[0], { focusFirstField: !0 });
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
|
-
if ((
|
|
286
|
-
if (
|
|
285
|
+
if ((a.key === "g" || a.key === "G") && !E) {
|
|
286
|
+
if (a.shiftKey) {
|
|
287
287
|
if (p.selectedIds.length === 0 || !p.features.some((W) => p.selectedIds.includes(W.id) && W.groupId)) return;
|
|
288
|
-
|
|
288
|
+
a.preventDefault(), p.ungroupSelection();
|
|
289
289
|
} else {
|
|
290
290
|
if (p.selectedIds.length === 0) return;
|
|
291
|
-
|
|
291
|
+
a.preventDefault();
|
|
292
292
|
const v = p.groupSelection();
|
|
293
|
-
v &&
|
|
293
|
+
v && c.setAutoFocusGroupId(v);
|
|
294
294
|
}
|
|
295
295
|
return;
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
if (
|
|
299
|
-
if ((!b ||
|
|
300
|
-
if (
|
|
301
|
-
|
|
298
|
+
if (a.key === "Enter") {
|
|
299
|
+
if ((!b || a.metaKey || a.ctrlKey) && c.editingMode !== "none") {
|
|
300
|
+
if (c.editingMode === "slice-shape") {
|
|
301
|
+
a.preventDefault(), c.commitSliceShape();
|
|
302
302
|
return;
|
|
303
|
-
} else if (
|
|
304
|
-
|
|
303
|
+
} else if (c.editingMode === "cut-hole") {
|
|
304
|
+
a.preventDefault(), c.commitCutHole();
|
|
305
305
|
return;
|
|
306
|
-
} else if (
|
|
307
|
-
|
|
306
|
+
} else if (c.editingMode === "draw-line" && c.lineInProgress.length >= 2) {
|
|
307
|
+
a.preventDefault(), c.commitLine({});
|
|
308
308
|
return;
|
|
309
|
-
} else if (
|
|
310
|
-
|
|
309
|
+
} else if (c.editingMode === "draw-polygon" && c.polygonInProgress.length >= 3) {
|
|
310
|
+
a.preventDefault(), c.commitPolygon({});
|
|
311
311
|
return;
|
|
312
|
-
} else if (
|
|
313
|
-
|
|
312
|
+
} else if (c.editingMode === "draw-route" && c.routeWaypoints.length >= 2) {
|
|
313
|
+
a.preventDefault(), c.commitRoute();
|
|
314
314
|
return;
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
if (!w) return;
|
|
318
|
-
const W =
|
|
319
|
-
if (
|
|
320
|
-
if (!b && !E && !((L = P.closest) != null && L.call(P, 'button, a[href], [role="button"]')) && !
|
|
318
|
+
const W = c.editingMode === "none" || c.editingMode === "draw-rect" || c.editingMode === "draw-circle" || c.editingMode === "place-point" || c.editingMode === "draw-freehand" || c.editingMode === "pick-shape" || c.editingMode === "draw-line" && c.lineInProgress.length < 2 || c.editingMode === "draw-polygon" && c.polygonInProgress.length < 3 || c.editingMode === "draw-route" && c.routeWaypoints.length < 2;
|
|
319
|
+
if (c.dialogState.type === "closed") {
|
|
320
|
+
if (!b && !E && !((L = P.closest) != null && L.call(P, 'button, a[href], [role="button"]')) && !a.metaKey && !a.ctrlKey && !a.altKey && W) {
|
|
321
321
|
const H = p.selectedIds;
|
|
322
322
|
if (H.length === 1) {
|
|
323
323
|
const F = p.features.find((G) => G.id === H[0]), I = F == null ? void 0 : F.geometry.type;
|
|
324
324
|
if (I === "LineString" || I === "Polygon" || I === "MultiLineString" || I === "MultiPolygon" || I === "GeometryCollection") {
|
|
325
|
-
|
|
326
|
-
const G = !
|
|
327
|
-
G &&
|
|
325
|
+
a.preventDefault();
|
|
326
|
+
const G = !c.vertexEditActive;
|
|
327
|
+
G && c.editingMode !== "none" && c.setEditingMode("none"), c.setVertexEditActive(G);
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
330
|
}
|
|
@@ -332,13 +332,13 @@ function Ws(t) {
|
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
const D = z.some((v) => v instanceof Element && v.hasAttribute("data-elm-search-open"));
|
|
335
|
-
if (
|
|
335
|
+
if (a.key === "Tab" && !b && c.dialogState.type === "closed" && !D && !a.metaKey && !a.ctrlKey && !a.altKey) {
|
|
336
336
|
const v = p.features;
|
|
337
337
|
if (v.length === 0) return;
|
|
338
|
-
|
|
339
|
-
const W =
|
|
338
|
+
a.preventDefault();
|
|
339
|
+
const W = ro(v, p.groups), H = p.selectedIds.length === 1 ? p.selectedIds[0] : null, F = H ? W.indexOf(H) : -1;
|
|
340
340
|
let I;
|
|
341
|
-
|
|
341
|
+
a.shiftKey ? I = F <= 0 ? W.length - 1 : F - 1 : I = F >= W.length - 1 ? 0 : F + 1;
|
|
342
342
|
const _ = W[I];
|
|
343
343
|
p.selectFeature(_);
|
|
344
344
|
const G = v.find((V) => V.id === _);
|
|
@@ -347,52 +347,52 @@ function Ws(t) {
|
|
|
347
347
|
const [V, Y] = G.geometry.coordinates;
|
|
348
348
|
o == null || o([Y, V]);
|
|
349
349
|
} else
|
|
350
|
-
d == null || d(G.bbox ||
|
|
350
|
+
d == null || d(G.bbox || st(G.geometry));
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
|
-
if (!b && !
|
|
354
|
-
const v =
|
|
353
|
+
if (!b && !a.metaKey && !a.ctrlKey && !a.altKey) {
|
|
354
|
+
const v = a.key.toLowerCase();
|
|
355
355
|
if (v === u("show-shortcuts")) {
|
|
356
|
-
|
|
356
|
+
a.preventDefault(), y("show-shortcuts"), c.shortcutsModalOpen ? c.closeShortcutsModal() : c.openShortcutsModal();
|
|
357
357
|
return;
|
|
358
358
|
}
|
|
359
|
-
if (
|
|
360
|
-
|
|
359
|
+
if (l.ui.schemaEditor && !E && v === u("toggle-schema")) {
|
|
360
|
+
a.preventDefault(), y("toggle-schema"), c.toggleSchemaModal();
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
|
-
if (
|
|
364
|
-
|
|
363
|
+
if (l.ui.layerList && v === u("toggle-sidebar")) {
|
|
364
|
+
a.preventDefault(), y("toggle-sidebar"), c.setSidebarOpen(!c.sidebarOpen);
|
|
365
365
|
return;
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
if (!b &&
|
|
369
|
-
const v =
|
|
370
|
-
if (
|
|
371
|
-
|
|
368
|
+
if (!b && c.dialogState.type !== "new-point" && !a.metaKey && !a.ctrlKey && !a.altKey) {
|
|
369
|
+
const v = a.key.toLowerCase();
|
|
370
|
+
if (l.ui.dataTable && v === u("toggle-table")) {
|
|
371
|
+
a.preventDefault(), y("toggle-table"), c.toggleTable();
|
|
372
372
|
return;
|
|
373
373
|
}
|
|
374
|
-
if (
|
|
375
|
-
|
|
374
|
+
if (l.ui.geojsonEditor && v === u("toggle-geojson")) {
|
|
375
|
+
a.preventDefault(), y("toggle-geojson"), c.toggleCodeModal();
|
|
376
376
|
return;
|
|
377
377
|
}
|
|
378
|
-
if (
|
|
379
|
-
|
|
378
|
+
if (l.ui.zoomIndicator && v === u("set-zoom")) {
|
|
379
|
+
a.preventDefault(), y("set-zoom"), c.setZoomEditing(!0);
|
|
380
380
|
return;
|
|
381
381
|
}
|
|
382
382
|
if (v === u("measure")) {
|
|
383
|
-
|
|
383
|
+
y("measure"), c.setEditingMode(c.editingMode === "measure" ? "none" : "measure");
|
|
384
384
|
return;
|
|
385
385
|
}
|
|
386
386
|
if (E) return;
|
|
387
387
|
if (v === u("toggle-transform")) {
|
|
388
|
-
(p.selectedIds.length === 1 && p.selectedIds[0] || p.selectedIds.length > 0) && (
|
|
388
|
+
(p.selectedIds.length === 1 && p.selectedIds[0] || p.selectedIds.length > 0) && (y("toggle-transform"), c.setTransformActive(!c.transformActive), !c.transformActive && c.editingMode !== "none" && c.setEditingMode("none"));
|
|
389
389
|
return;
|
|
390
390
|
}
|
|
391
|
-
const W =
|
|
392
|
-
|
|
391
|
+
const W = c.isToolAvailable, H = (F) => {
|
|
392
|
+
c.editingMode !== F && !p.canAddFeatures(1) || (y(F === "pick-shape" ? "picker" : F), c.setEditingMode(c.editingMode === F ? "none" : F));
|
|
393
393
|
};
|
|
394
|
-
for (const F of
|
|
395
|
-
const I =
|
|
394
|
+
for (const F of co) {
|
|
395
|
+
const I = Hr[F];
|
|
396
396
|
if (W(F) && v === u(I === "pick-shape" ? "picker" : I)) {
|
|
397
397
|
H(I);
|
|
398
398
|
return;
|
|
@@ -400,39 +400,39 @@ function Ws(t) {
|
|
|
400
400
|
}
|
|
401
401
|
if (v === u("cut-hole")) {
|
|
402
402
|
const F = p.features.find((I) => I.id === (p.selectedIds.length === 1 ? p.selectedIds[0] : null));
|
|
403
|
-
F && (F.geometry.type === "Polygon" || F.geometry.type === "MultiPolygon") && (
|
|
403
|
+
F && (F.geometry.type === "Polygon" || F.geometry.type === "MultiPolygon") && (y("cut-hole"), c.setEditingMode(c.editingMode === "cut-hole" ? "none" : "cut-hole"), c.setTransformActive(!1));
|
|
404
404
|
return;
|
|
405
405
|
}
|
|
406
406
|
if (v === u("slice-shape")) {
|
|
407
407
|
const F = p.features.find((I) => I.id === (p.selectedIds.length === 1 ? p.selectedIds[0] : null));
|
|
408
|
-
F && (F.geometry.type === "Polygon" || F.geometry.type === "MultiPolygon") && (
|
|
408
|
+
F && (F.geometry.type === "Polygon" || F.geometry.type === "MultiPolygon") && (y("slice-shape"), c.setEditingMode(c.editingMode === "slice-shape" ? "none" : "slice-shape"), c.setTransformActive(!1));
|
|
409
409
|
return;
|
|
410
410
|
}
|
|
411
411
|
if (v === u("break-apart")) {
|
|
412
412
|
const F = p.selectedIds.length === 1 ? p.selectedIds[0] : null, I = F ? p.features.find((_) => _.id === F) : null;
|
|
413
|
-
if (I &&
|
|
414
|
-
|
|
415
|
-
const _ =
|
|
413
|
+
if (I && en(I.geometry)) {
|
|
414
|
+
y("break-apart");
|
|
415
|
+
const _ = nt(I.geometry);
|
|
416
416
|
p.breakMultiGeometry(F) && s({ type: "feature:broken", featureId: F, count: _, undo: () => e.getState().undo() });
|
|
417
417
|
}
|
|
418
418
|
return;
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
-
if (
|
|
421
|
+
if (a.key !== "Delete" && a.key !== "Backspace" || E || c.dialogState.type === "new-point") return;
|
|
422
422
|
const R = p.selectedIds;
|
|
423
|
-
if (R.length === 0 || b ||
|
|
423
|
+
if (R.length === 0 || b || c.vertexEditActive) return;
|
|
424
424
|
const O = R.length, j = O === 1 ? p.features.find((v) => v.id === R[0]) : null, Z = O === 1 ? String((j == null ? void 0 : j.properties.name) || "Unnamed feature") : `${O} features`;
|
|
425
|
-
|
|
425
|
+
a.preventDefault(), a.stopImmediatePropagation(), y("delete-selected"), p.deleteSelection(), c.closeDialog(), s(O === 1 ? { type: "feature:deleted", featureId: R[0], label: Z, undo: () => e.getState().undo() } : { type: "features:deleted", count: O, undo: () => e.getState().undo() });
|
|
426
426
|
}
|
|
427
|
-
function C(
|
|
428
|
-
var
|
|
429
|
-
if (!
|
|
430
|
-
const p =
|
|
427
|
+
function C(a) {
|
|
428
|
+
var y;
|
|
429
|
+
if (!h(a)) return;
|
|
430
|
+
const p = a.target.tagName;
|
|
431
431
|
if (p === "INPUT" || p === "TEXTAREA" || p === "SELECT" || n.getState().readonly) return;
|
|
432
|
-
const
|
|
433
|
-
if (
|
|
432
|
+
const c = (y = a.clipboardData) == null ? void 0 : y.getData("text");
|
|
433
|
+
if (c)
|
|
434
434
|
try {
|
|
435
|
-
const N = JSON.parse(
|
|
435
|
+
const N = JSON.parse(c);
|
|
436
436
|
if (N.type === "FeatureCollection" || N.type === "Feature") {
|
|
437
437
|
const P = N.type === "FeatureCollection" ? N.features : [N];
|
|
438
438
|
e.setState({ clipboard: P }), e.getState().pasteSelection() && s({ type: "selection:pasted", count: P.length });
|
|
@@ -446,59 +446,59 @@ function Ws(t) {
|
|
|
446
446
|
return window.addEventListener("keydown", M), window.addEventListener("paste", C), () => {
|
|
447
447
|
window.removeEventListener("keydown", M), window.removeEventListener("paste", C);
|
|
448
448
|
};
|
|
449
|
-
}, [e, n, s, o, d,
|
|
449
|
+
}, [e, n, s, o, d, l, u, m]), $(() => {
|
|
450
450
|
function w(M) {
|
|
451
|
-
var
|
|
452
|
-
if (M.key !== "Escape" || !
|
|
451
|
+
var c;
|
|
452
|
+
if (M.key !== "Escape" || !h(M)) return;
|
|
453
453
|
const C = M.target;
|
|
454
|
-
if (C && (C.tagName === "INPUT" || C.tagName === "TEXTAREA" || C.isContentEditable) || (
|
|
455
|
-
const
|
|
456
|
-
if (
|
|
457
|
-
|
|
454
|
+
if (C && (C.tagName === "INPUT" || C.tagName === "TEXTAREA" || C.isContentEditable) || (c = C == null ? void 0 : C.closest) != null && c.call(C, `[${no}]`) || Un()) return;
|
|
455
|
+
const a = n.getState();
|
|
456
|
+
if (a.dialogState.type !== "closed") {
|
|
457
|
+
a.closeDialog(), M.stopPropagation();
|
|
458
458
|
return;
|
|
459
459
|
}
|
|
460
|
-
if (
|
|
461
|
-
if (
|
|
462
|
-
|
|
460
|
+
if (a.editingMode === "none") {
|
|
461
|
+
if (a.vertexEditActive) {
|
|
462
|
+
a.setVertexEditActive(!1), M.stopPropagation();
|
|
463
463
|
return;
|
|
464
464
|
}
|
|
465
|
-
if (
|
|
466
|
-
|
|
465
|
+
if (a.transformActive) {
|
|
466
|
+
a.setTransformActive(!1), M.stopPropagation();
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
469
|
if (e.getState().selectedIds.length > 0) {
|
|
470
470
|
e.getState().selectFeature(null), M.stopPropagation();
|
|
471
471
|
return;
|
|
472
472
|
}
|
|
473
|
-
|
|
473
|
+
oo(n) && M.stopPropagation();
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
476
|
return window.addEventListener("keydown", w, { capture: !0 }), () => window.removeEventListener("keydown", w, { capture: !0 });
|
|
477
477
|
}, []);
|
|
478
478
|
}
|
|
479
|
-
const
|
|
480
|
-
function
|
|
479
|
+
const uo = /* @__PURE__ */ new Set(["true", "yes", "y", "1", "on", "x", "✓"]), mo = /* @__PURE__ */ new Set(["false", "no", "n", "0", "off", ""]);
|
|
480
|
+
function fo(t) {
|
|
481
481
|
const e = t.trim().toLowerCase();
|
|
482
|
-
return
|
|
482
|
+
return uo.has(e) ? !0 : mo.has(e) ? !1 : null;
|
|
483
483
|
}
|
|
484
|
-
function
|
|
485
|
-
return typeof t == "boolean" ? t : typeof t == "number" ? t !== 0 : typeof t == "string" ?
|
|
484
|
+
function po(t) {
|
|
485
|
+
return typeof t == "boolean" ? t : typeof t == "number" ? t !== 0 : typeof t == "string" ? fo(t) === !0 : !1;
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function ho({ fields: t, values: e, onChange: n, errors: s, autoFocusFirst: o, readonly: d }) {
|
|
488
488
|
return /* @__PURE__ */ r("div", { className: "space-y-3", children: t.map((i, m) => {
|
|
489
|
-
const
|
|
489
|
+
const l = e[i.key] ?? "", h = s == null ? void 0 : s[i.key], f = o && m === 0, g = /* @__PURE__ */ T("label", { className: "block text-xs font-medium text-(--elm-text-muted,var(--color-gray-600)) dark:text-(--elm-text-muted,var(--color-gray-400)) mb-1", children: [
|
|
490
490
|
i.label,
|
|
491
491
|
i.required && /* @__PURE__ */ r("span", { className: "text-rose-500 ml-0.5", children: "*" })
|
|
492
492
|
] });
|
|
493
493
|
let u;
|
|
494
494
|
return i.type === "boolean" ? /* @__PURE__ */ T("div", { "data-field-key": i.key, className: "flex items-center justify-between py-1 border-b border-transparent", children: [
|
|
495
|
-
|
|
495
|
+
g,
|
|
496
496
|
/* @__PURE__ */ T("label", { className: "relative inline-flex items-center cursor-pointer", children: [
|
|
497
497
|
/* @__PURE__ */ r(
|
|
498
498
|
"input",
|
|
499
499
|
{
|
|
500
500
|
type: "checkbox",
|
|
501
|
-
checked:
|
|
501
|
+
checked: po(l),
|
|
502
502
|
onChange: (x) => n(i.key, x.target.checked),
|
|
503
503
|
disabled: d,
|
|
504
504
|
className: "sr-only peer"
|
|
@@ -506,24 +506,24 @@ function fo({ fields: t, values: e, onChange: n, errors: s, autoFocusFirst: o, r
|
|
|
506
506
|
),
|
|
507
507
|
/* @__PURE__ */ r("div", { className: "w-9 h-5 bg-(--elm-border-strong,var(--color-gray-200)) peer-focus-visible:ring-2 peer-focus-visible:ring-elm-focus-ring peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-elm-surface rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-(--elm-border-strong,var(--color-gray-300)) after:border after:rounded-full after:h-4 after:w-4 after:transition-transform peer-checked:bg-primary-500 opacity-90 hover:opacity-100 disabled:opacity-50" })
|
|
508
508
|
] }),
|
|
509
|
-
|
|
509
|
+
h && /* @__PURE__ */ r("p", { className: "mt-1 text-xs text-rose-500 w-full basis-full", children: h })
|
|
510
510
|
] }, i.key) : (i.type === "textarea" ? u = /* @__PURE__ */ r(
|
|
511
|
-
|
|
511
|
+
jn,
|
|
512
512
|
{
|
|
513
513
|
rows: 3,
|
|
514
|
-
value: String(
|
|
514
|
+
value: String(l),
|
|
515
515
|
onChange: (x) => n(i.key, x.target.value),
|
|
516
516
|
autoFocus: f,
|
|
517
|
-
error: !!
|
|
517
|
+
error: !!h,
|
|
518
518
|
disabled: d
|
|
519
519
|
}
|
|
520
520
|
) : i.type === "select" ? u = /* @__PURE__ */ T(
|
|
521
|
-
|
|
521
|
+
cr,
|
|
522
522
|
{
|
|
523
|
-
value: String(
|
|
523
|
+
value: String(l),
|
|
524
524
|
onChange: (x) => n(i.key, x.target.value),
|
|
525
525
|
autoFocus: f,
|
|
526
|
-
error: !!
|
|
526
|
+
error: !!h,
|
|
527
527
|
disabled: d,
|
|
528
528
|
children: [
|
|
529
529
|
/* @__PURE__ */ r("option", { value: "", children: "— select —" }),
|
|
@@ -531,41 +531,41 @@ function fo({ fields: t, values: e, onChange: n, errors: s, autoFocusFirst: o, r
|
|
|
531
531
|
]
|
|
532
532
|
}
|
|
533
533
|
) : i.type === "number" ? u = /* @__PURE__ */ r(
|
|
534
|
-
|
|
534
|
+
Ft,
|
|
535
535
|
{
|
|
536
536
|
type: "number",
|
|
537
|
-
value: String(
|
|
537
|
+
value: String(l),
|
|
538
538
|
onChange: (x) => n(i.key, x.target.value),
|
|
539
539
|
autoFocus: f,
|
|
540
|
-
error: !!
|
|
540
|
+
error: !!h,
|
|
541
541
|
disabled: d,
|
|
542
542
|
min: i.min,
|
|
543
543
|
max: i.max
|
|
544
544
|
}
|
|
545
545
|
) : u = /* @__PURE__ */ r(
|
|
546
|
-
|
|
546
|
+
Ft,
|
|
547
547
|
{
|
|
548
548
|
type: i.type,
|
|
549
|
-
value: String(
|
|
549
|
+
value: String(l),
|
|
550
550
|
onChange: (x) => n(i.key, x.target.value),
|
|
551
551
|
autoFocus: f,
|
|
552
|
-
error: !!
|
|
552
|
+
error: !!h,
|
|
553
553
|
disabled: d
|
|
554
554
|
}
|
|
555
555
|
), // `data-field-key` lets the parent panel focus the offending input
|
|
556
556
|
// by key after a failed save (see handleSave in FeatureSidePanel).
|
|
557
557
|
/* @__PURE__ */ T("div", { "data-field-key": i.key, children: [
|
|
558
|
-
|
|
558
|
+
g,
|
|
559
559
|
u,
|
|
560
|
-
|
|
560
|
+
h && /* @__PURE__ */ r("p", { className: "mt-1 text-xs text-rose-500", children: h })
|
|
561
561
|
] }, i.key));
|
|
562
562
|
}) });
|
|
563
563
|
}
|
|
564
|
-
const
|
|
565
|
-
function
|
|
566
|
-
const t = S((o) => o.setSidebarOpen), e = S((o) => o.layout === "split"), n = ce(), { getKey: s } =
|
|
564
|
+
const Ae = "items-center justify-center flex-shrink-0 p-[3px] rounded-elm-control text-elm-text-secondary hover:bg-(--elm-surface-hover,var(--color-gray-100)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700)) active:scale-[0.95] disabled:text-elm-text-disabled disabled:hover:bg-transparent disabled:active:scale-100 disabled:cursor-not-allowed transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-elm-focus-ring", go = "h-10 box-border flex items-center flex-shrink-0 border-b border-elm-border bg-elm-surface-sunken";
|
|
565
|
+
function gr() {
|
|
566
|
+
const t = S((o) => o.setSidebarOpen), e = S((o) => o.layout === "split"), n = ce(), { getKey: s } = Pe();
|
|
567
567
|
return e ? null : /* @__PURE__ */ r(
|
|
568
|
-
|
|
568
|
+
ve,
|
|
569
569
|
{
|
|
570
570
|
content: "Hide layers",
|
|
571
571
|
shortcut: n.ui.keyboardShortcuts.enabled ? /* @__PURE__ */ r(Q, { children: s("toggle-sidebar").toUpperCase() }) : void 0,
|
|
@@ -578,30 +578,30 @@ function pr() {
|
|
|
578
578
|
onClick: (o) => {
|
|
579
579
|
t(!1), o.currentTarget.blur();
|
|
580
580
|
},
|
|
581
|
-
className: `flex ${
|
|
582
|
-
children: /* @__PURE__ */ r(
|
|
581
|
+
className: `flex ${Ae}`,
|
|
582
|
+
children: /* @__PURE__ */ r(Zt, { size: 16, mirrored: !0 })
|
|
583
583
|
}
|
|
584
584
|
)
|
|
585
585
|
}
|
|
586
586
|
);
|
|
587
587
|
}
|
|
588
|
-
const
|
|
589
|
-
function
|
|
588
|
+
const yo = /("(?:\\.|[^"\\])*")(\s*:)?|\b(true|false)\b|\bnull\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g, bo = "text-gray-800 dark:text-[#e06c75]", vo = "text-[#a11] dark:text-[#98c379]", xo = "text-[#164] dark:text-[#d19a66]", wo = "text-[#219] dark:text-[#d19a66]", ko = "text-[#164] dark:text-[#d19a66]";
|
|
589
|
+
function So(t) {
|
|
590
590
|
const e = [];
|
|
591
591
|
let n = 0;
|
|
592
|
-
for (const s of t.matchAll(
|
|
592
|
+
for (const s of t.matchAll(yo)) {
|
|
593
593
|
const o = s.index;
|
|
594
594
|
o > n && e.push(t.slice(n, o));
|
|
595
|
-
const [d, i, m,
|
|
596
|
-
i !== void 0 ? (e.push(/* @__PURE__ */ r("span", { className: m ?
|
|
595
|
+
const [d, i, m, l] = s;
|
|
596
|
+
i !== void 0 ? (e.push(/* @__PURE__ */ r("span", { className: m ? bo : vo, children: i }, o)), m && e.push(m)) : l !== void 0 ? e.push(/* @__PURE__ */ r("span", { className: wo, children: d }, o)) : e.push(/* @__PURE__ */ r("span", { className: d === "null" ? ko : xo, children: d }, o)), n = o + d.length;
|
|
597
597
|
}
|
|
598
598
|
return n < t.length && e.push(t.slice(n)), e;
|
|
599
599
|
}
|
|
600
|
-
function
|
|
601
|
-
const n = ue(() =>
|
|
600
|
+
function Co({ json: t, className: e }) {
|
|
601
|
+
const n = ue(() => So(t), [t]);
|
|
602
602
|
return /* @__PURE__ */ r("pre", { className: e, children: n });
|
|
603
603
|
}
|
|
604
|
-
function
|
|
604
|
+
function $t(t, e) {
|
|
605
605
|
if (t.required && (e == null || String(e).trim() === ""))
|
|
606
606
|
return `${t.label} is required`;
|
|
607
607
|
if (t.type === "number" && e !== void 0 && e !== null && String(e).trim() !== "") {
|
|
@@ -616,11 +616,11 @@ function Rt(t, e) {
|
|
|
616
616
|
}
|
|
617
617
|
return null;
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function yr(t, e) {
|
|
620
620
|
const n = S((i) => i.panelPrefs[t]), s = S((i) => i.setPanelPref), o = n !== null ? n : e;
|
|
621
621
|
return { open: o, toggle: () => s(t, !o) };
|
|
622
622
|
}
|
|
623
|
-
function
|
|
623
|
+
function No(t, e, n) {
|
|
624
624
|
if (t.type === "new-point") {
|
|
625
625
|
const s = {};
|
|
626
626
|
return e.fields.forEach((o) => {
|
|
@@ -633,17 +633,17 @@ function So(t, e, n) {
|
|
|
633
633
|
}
|
|
634
634
|
return {};
|
|
635
635
|
}
|
|
636
|
-
function
|
|
637
|
-
const { dataStore: n } =
|
|
638
|
-
() => t.type === "edit" ?
|
|
639
|
-
[t,
|
|
640
|
-
), x = U((I) => I.addFeature), w = U((I) => I.updateFeature), M = U((I) => I.deleteFeature), C = U((I) => I.duplicateFeature),
|
|
641
|
-
() =>
|
|
636
|
+
function Eo({ dialogState: t, collapsible: e = !1 }) {
|
|
637
|
+
const { dataStore: n } = se(), s = le(), o = S((I) => I.closeDialog), d = U((I) => I.selectFeature), i = U(Gn((I) => I.getVisibleSchemas())), m = U((I) => I.lastUsedSchemaId), l = S((I) => I.readonly), { uiStore: h } = se(), f = Se(), g = U((I) => I.features), u = ue(
|
|
638
|
+
() => t.type === "edit" ? g.find((I) => I.id === t.featureId) ?? null : null,
|
|
639
|
+
[t, g]
|
|
640
|
+
), x = U((I) => I.addFeature), w = U((I) => I.updateFeature), M = U((I) => I.deleteFeature), C = U((I) => I.duplicateFeature), a = U((I) => I.getDefaultSchema), p = U((I) => I.setLastUsedSchemaId), c = t.type === "new-point", E = a(), [y, N] = q(() => t.type === "edit" && (u != null && u.schemaId) ? u.schemaId : m && i.find((_) => _.id === m) ? m : E.id), P = i.find((I) => I.id === y) ?? E, [z, K] = q(
|
|
641
|
+
() => No(t, P, g)
|
|
642
642
|
), [b, k] = q({}), D = u == null ? void 0 : u.properties, R = u == null ? void 0 : u.schemaId, [O, j] = q({ editProps: D, editSchemaId: R });
|
|
643
643
|
u && (O.editProps !== D || O.editSchemaId !== R) && (j({ editProps: D, editSchemaId: R }), K({ ...D }), R && N(R), k({}));
|
|
644
644
|
function Z(I) {
|
|
645
645
|
const _ = i.find((G) => G.id === I) ?? E;
|
|
646
|
-
if (
|
|
646
|
+
if (c) {
|
|
647
647
|
const G = {};
|
|
648
648
|
_.fields.forEach((V) => {
|
|
649
649
|
G[V.key] = z[V.key] ?? "";
|
|
@@ -652,10 +652,10 @@ function Co({ dialogState: t, collapsible: e = !1 }) {
|
|
|
652
652
|
N(I), p(I), k({});
|
|
653
653
|
}
|
|
654
654
|
$(() => {
|
|
655
|
-
if (
|
|
655
|
+
if (l) return;
|
|
656
656
|
function I(_) {
|
|
657
657
|
if ((_.metaKey || _.ctrlKey) && _.key === "Enter" && f(_)) {
|
|
658
|
-
const G =
|
|
658
|
+
const G = h.getState();
|
|
659
659
|
if (G.lineInProgress.length > 0 || G.polygonInProgress.length > 0 || G.routeWaypoints.length > 0 || G.freehandPoints.length > 0 || G.circleCenter !== null || G.rectCorner !== null) return;
|
|
660
660
|
_.preventDefault(), L();
|
|
661
661
|
}
|
|
@@ -666,16 +666,16 @@ function Co({ dialogState: t, collapsible: e = !1 }) {
|
|
|
666
666
|
var G;
|
|
667
667
|
const I = {};
|
|
668
668
|
for (const V of P.fields) {
|
|
669
|
-
const Y =
|
|
669
|
+
const Y = $t(V, z[V.key]);
|
|
670
670
|
Y && (I[V.key] = Y);
|
|
671
671
|
}
|
|
672
672
|
if (Object.keys(I).length > 0) {
|
|
673
673
|
k(I);
|
|
674
674
|
const V = (G = P.fields.find((Y) => I[Y.key])) == null ? void 0 : G.key;
|
|
675
675
|
V && setTimeout(() => {
|
|
676
|
-
var
|
|
677
|
-
const Y = document.querySelector(`[data-field-key="${CSS.escape(V)}"]`),
|
|
678
|
-
|
|
676
|
+
var xe;
|
|
677
|
+
const Y = document.querySelector(`[data-field-key="${CSS.escape(V)}"]`), ne = Y == null ? void 0 : Y.querySelector("input, textarea, select");
|
|
678
|
+
ne == null || ne.focus(), ne && "select" in ne && ((xe = ne.select) == null || xe.call(ne));
|
|
679
679
|
}, 0);
|
|
680
680
|
return;
|
|
681
681
|
}
|
|
@@ -683,13 +683,13 @@ function Co({ dialogState: t, collapsible: e = !1 }) {
|
|
|
683
683
|
const _ = {};
|
|
684
684
|
for (const [V, Y] of Object.entries(z))
|
|
685
685
|
Y !== "" && (_[V] = Y);
|
|
686
|
-
|
|
686
|
+
c && t.type === "new-point" ? x({
|
|
687
687
|
type: "Feature",
|
|
688
688
|
id: crypto.randomUUID(),
|
|
689
|
-
schemaId:
|
|
689
|
+
schemaId: y,
|
|
690
690
|
geometry: { type: "Point", coordinates: t.coords },
|
|
691
691
|
properties: _
|
|
692
|
-
}) : u && w(u.id, { properties: _, schemaId:
|
|
692
|
+
}) : u && w(u.id, { properties: _, schemaId: y }), o();
|
|
693
693
|
}
|
|
694
694
|
function v() {
|
|
695
695
|
if (!u) return;
|
|
@@ -701,20 +701,20 @@ function Co({ dialogState: t, collapsible: e = !1 }) {
|
|
|
701
701
|
const I = String(u.properties.name || "Unnamed feature"), _ = u.id;
|
|
702
702
|
M(_), o(), s({ type: "feature:deleted", featureId: _, label: I, undo: () => n.getState().undo() });
|
|
703
703
|
}
|
|
704
|
-
const H =
|
|
704
|
+
const H = c ? "New point" : u ? String(u.properties.name || "Edit feature") : "Edit feature", F = c ? "point" : (u == null ? void 0 : u.geometry.type) === "MultiPoint" ? "points" : (u == null ? void 0 : u.geometry.type) === "LineString" ? "line" : (u == null ? void 0 : u.geometry.type) === "MultiLineString" ? "lines" : (u == null ? void 0 : u.geometry.type) === "Polygon" ? "area" : (u == null ? void 0 : u.geometry.type) === "MultiPolygon" ? "areas" : (u == null ? void 0 : u.geometry.type) === "GeometryCollection" ? "mixed" : "point";
|
|
705
705
|
return /* @__PURE__ */ T("div", { className: "flex flex-col flex-1 min-h-0", children: [
|
|
706
706
|
/* @__PURE__ */ T("header", { className: "flex items-center gap-1 px-4 pt-4 pb-3 border-b border-elm-border flex-shrink-0 bg-elm-surface-sunken", children: [
|
|
707
|
-
e && /* @__PURE__ */ r(
|
|
708
|
-
/* @__PURE__ */ r(
|
|
707
|
+
e && /* @__PURE__ */ r(gr, {}),
|
|
708
|
+
/* @__PURE__ */ r(ve, { content: "Back to layers", side: "bottom", children: /* @__PURE__ */ r("button", { type: "button", onClick: () => {
|
|
709
709
|
o(), d(null);
|
|
710
|
-
}, "aria-label": "Back to layers", className: `flex ${
|
|
710
|
+
}, "aria-label": "Back to layers", className: `flex ${Ae}`, children: /* @__PURE__ */ r(hn, { size: 16 }) }) }),
|
|
711
711
|
/* @__PURE__ */ T("div", { className: "flex-1 min-w-0 mx-1", children: [
|
|
712
712
|
/* @__PURE__ */ r("p", { className: "text-sm leading-5 font-semibold text-(--elm-text,var(--color-gray-800)) dark:text-(--elm-text,var(--color-gray-100)) truncate", children: H }),
|
|
713
713
|
/* @__PURE__ */ r("p", { className: "text-xs leading-4 text-elm-text-subtle capitalize", children: F })
|
|
714
714
|
] }),
|
|
715
|
-
u && /* @__PURE__ */ T(
|
|
716
|
-
!
|
|
717
|
-
|
|
715
|
+
u && /* @__PURE__ */ T(re, { children: [
|
|
716
|
+
!l && /* @__PURE__ */ r(
|
|
717
|
+
ve,
|
|
718
718
|
{
|
|
719
719
|
content: "Duplicate",
|
|
720
720
|
shortcut: /* @__PURE__ */ T("span", { className: "flex items-center gap-0.5", children: [
|
|
@@ -722,10 +722,10 @@ function Co({ dialogState: t, collapsible: e = !1 }) {
|
|
|
722
722
|
/* @__PURE__ */ r(Q, { children: "D" })
|
|
723
723
|
] }),
|
|
724
724
|
side: "bottom",
|
|
725
|
-
children: /* @__PURE__ */ r("button", { type: "button", onClick: v, "aria-label": "Duplicate feature", className: `flex ${
|
|
725
|
+
children: /* @__PURE__ */ r("button", { type: "button", onClick: v, "aria-label": "Duplicate feature", className: `flex ${Ae}`, children: /* @__PURE__ */ r(Yt, { size: 16 }) })
|
|
726
726
|
}
|
|
727
727
|
),
|
|
728
|
-
!
|
|
728
|
+
!l && /* @__PURE__ */ r(ve, { content: "Delete feature", side: "bottom", children: /* @__PURE__ */ r("button", { type: "button", onClick: W, "aria-label": "Delete feature", className: `flex ${Ae}`, children: /* @__PURE__ */ r(Re, { size: 16 }) }) })
|
|
729
729
|
] })
|
|
730
730
|
] }),
|
|
731
731
|
/* @__PURE__ */ T("div", { className: "flex-1 overflow-y-auto min-h-0 px-4 pt-4", children: [
|
|
@@ -735,11 +735,11 @@ function Co({ dialogState: t, collapsible: e = !1 }) {
|
|
|
735
735
|
/* @__PURE__ */ T("div", { className: "mb-3", children: [
|
|
736
736
|
/* @__PURE__ */ r("label", { className: "block text-xs font-medium text-(--elm-text-muted,var(--color-gray-600)) dark:text-(--elm-text-muted,var(--color-gray-400)) mb-1", children: "Schema" }),
|
|
737
737
|
/* @__PURE__ */ r(
|
|
738
|
-
|
|
738
|
+
cr,
|
|
739
739
|
{
|
|
740
|
-
value:
|
|
740
|
+
value: y,
|
|
741
741
|
onChange: (I) => Z(I.target.value),
|
|
742
|
-
disabled:
|
|
742
|
+
disabled: l,
|
|
743
743
|
children: i.map((I) => {
|
|
744
744
|
var _;
|
|
745
745
|
return /* @__PURE__ */ T("option", { value: I.id, children: [
|
|
@@ -751,7 +751,7 @@ function Co({ dialogState: t, collapsible: e = !1 }) {
|
|
|
751
751
|
)
|
|
752
752
|
] }),
|
|
753
753
|
/* @__PURE__ */ r(
|
|
754
|
-
|
|
754
|
+
ho,
|
|
755
755
|
{
|
|
756
756
|
fields: P.fields,
|
|
757
757
|
values: z,
|
|
@@ -759,36 +759,36 @@ function Co({ dialogState: t, collapsible: e = !1 }) {
|
|
|
759
759
|
K((V) => ({ ...V, [I]: _ }));
|
|
760
760
|
const G = P.fields.find((V) => V.key === I);
|
|
761
761
|
if (G) {
|
|
762
|
-
const V =
|
|
762
|
+
const V = $t(G, _);
|
|
763
763
|
k((Y) => {
|
|
764
764
|
if (V) return { ...Y, [I]: V };
|
|
765
|
-
const
|
|
766
|
-
return delete
|
|
765
|
+
const ne = { ...Y };
|
|
766
|
+
return delete ne[I], ne;
|
|
767
767
|
});
|
|
768
768
|
}
|
|
769
769
|
},
|
|
770
770
|
errors: b,
|
|
771
|
-
autoFocusFirst: !
|
|
772
|
-
readonly:
|
|
771
|
+
autoFocusFirst: !l && (c || t.type === "edit" && !!t.isNew || t.type === "edit" && !!t.focusFirstField),
|
|
772
|
+
readonly: l
|
|
773
773
|
}
|
|
774
774
|
),
|
|
775
|
-
/* @__PURE__ */ r(
|
|
776
|
-
/* @__PURE__ */ r(
|
|
775
|
+
/* @__PURE__ */ r(Do, { dialogState: t, editFeature: u ?? null, values: z, schemaId: y }),
|
|
776
|
+
/* @__PURE__ */ r(Po, { dialogState: t, editFeature: u ?? null }),
|
|
777
777
|
/* @__PURE__ */ r("div", { className: "-mx-4 border-t border-elm-border" })
|
|
778
778
|
] }),
|
|
779
|
-
!
|
|
779
|
+
!l && /* @__PURE__ */ r("div", { className: "px-4 py-3 border-t border-elm-border flex-shrink-0", children: /* @__PURE__ */ T(ke, { variant: "primary", onClick: L, className: "w-full py-2 rounded-elm font-medium", children: [
|
|
780
780
|
"Save",
|
|
781
|
-
/* @__PURE__ */ r("span", { className: "ml-auto flex items-center gap-0.5", children:
|
|
782
|
-
/* @__PURE__ */ r(
|
|
783
|
-
/* @__PURE__ */ r(
|
|
784
|
-
] }) : /* @__PURE__ */ T(
|
|
785
|
-
/* @__PURE__ */ r(
|
|
786
|
-
/* @__PURE__ */ r(
|
|
781
|
+
/* @__PURE__ */ r("span", { className: "ml-auto flex items-center gap-0.5", children: eo() ? /* @__PURE__ */ T(re, { children: [
|
|
782
|
+
/* @__PURE__ */ r(Me, { children: "⌘" }),
|
|
783
|
+
/* @__PURE__ */ r(Me, { children: "↵" })
|
|
784
|
+
] }) : /* @__PURE__ */ T(re, { children: [
|
|
785
|
+
/* @__PURE__ */ r(Me, { children: "Ctrl" }),
|
|
786
|
+
/* @__PURE__ */ r(Me, { children: "↵" })
|
|
787
787
|
] }) })
|
|
788
788
|
] }) })
|
|
789
789
|
] });
|
|
790
790
|
}
|
|
791
|
-
function
|
|
791
|
+
function Po({
|
|
792
792
|
dialogState: t,
|
|
793
793
|
editFeature: e
|
|
794
794
|
}) {
|
|
@@ -802,11 +802,11 @@ function No({
|
|
|
802
802
|
const [i, m] = e.geometry.coordinates;
|
|
803
803
|
return [`${m.toFixed(6)}, ${i.toFixed(6)}`];
|
|
804
804
|
}
|
|
805
|
-
return e.geometry.type === "LineString" ? e.geometry.coordinates.map(([m,
|
|
806
|
-
}, [t, e]), s = n.length <= 5, { open: o, toggle: d } =
|
|
807
|
-
return n.length === 0 ? null : /* @__PURE__ */ r(
|
|
805
|
+
return e.geometry.type === "LineString" ? e.geometry.coordinates.map(([m, l], h) => `${h + 1}. ${l.toFixed(6)}, ${m.toFixed(6)}`) : e.geometry.type === "Polygon" ? e.geometry.coordinates[0].slice(0, -1).map(([m, l], h) => `${h + 1}. ${l.toFixed(6)}, ${m.toFixed(6)}`) : [];
|
|
806
|
+
}, [t, e]), s = n.length <= 5, { open: o, toggle: d } = yr("coordsOpen", s);
|
|
807
|
+
return n.length === 0 ? null : /* @__PURE__ */ r(br, { label: "Coordinates", open: o, onToggle: d, children: /* @__PURE__ */ r("div", { className: "space-y-0.5", children: n.map((i, m) => /* @__PURE__ */ r("p", { className: "text-xs font-elm-mono text-elm-text-muted", children: i }, m)) }) });
|
|
808
808
|
}
|
|
809
|
-
function
|
|
809
|
+
function Do({
|
|
810
810
|
dialogState: t,
|
|
811
811
|
editFeature: e,
|
|
812
812
|
values: n,
|
|
@@ -820,34 +820,34 @@ function Eo({
|
|
|
820
820
|
return { type: "Feature", id: "(new)", schemaId: s, geometry: { type: "Point", coordinates: t.coords }, properties: x };
|
|
821
821
|
}
|
|
822
822
|
return e ?? null;
|
|
823
|
-
}, [t, e, n, s]), { open: d, toggle: i } =
|
|
823
|
+
}, [t, e, n, s]), { open: d, toggle: i } = yr("sourceOpen", !1), [m, l] = q(!1), h = le();
|
|
824
824
|
if (!o) return null;
|
|
825
825
|
const f = JSON.stringify(o, null, 2);
|
|
826
|
-
function
|
|
826
|
+
function g() {
|
|
827
827
|
Promise.resolve().then(() => navigator.clipboard.writeText(f)).then(() => {
|
|
828
|
-
|
|
829
|
-
}, (x) =>
|
|
828
|
+
l(!0), setTimeout(() => l(!1), 1500);
|
|
829
|
+
}, (x) => h(to(x)));
|
|
830
830
|
}
|
|
831
|
-
return /* @__PURE__ */ r(
|
|
831
|
+
return /* @__PURE__ */ r(br, { label: "Source", open: d, onToggle: i, action: /* @__PURE__ */ r(
|
|
832
832
|
"button",
|
|
833
833
|
{
|
|
834
834
|
type: "button",
|
|
835
835
|
onClick: (x) => {
|
|
836
|
-
x.stopPropagation(),
|
|
836
|
+
x.stopPropagation(), g();
|
|
837
837
|
},
|
|
838
838
|
"aria-label": "Copy source",
|
|
839
839
|
className: `flex items-center justify-center w-6 h-6 rounded-elm-chip hover:bg-elm-surface-hover transition-colors ${m ? "text-emerald-500" : "text-elm-text-disabled hover:text-(--elm-text-secondary,var(--color-gray-500)) dark:hover:text-(--elm-text-secondary,var(--color-gray-300))"}`,
|
|
840
|
-
children: m ? /* @__PURE__ */ r(
|
|
840
|
+
children: m ? /* @__PURE__ */ r(bn, { size: 16, weight: "bold" }) : /* @__PURE__ */ r(vn, { size: 16 })
|
|
841
841
|
}
|
|
842
842
|
), children: /* @__PURE__ */ r(
|
|
843
|
-
|
|
843
|
+
Co,
|
|
844
844
|
{
|
|
845
845
|
json: f,
|
|
846
846
|
className: "text-[11px] font-elm-mono text-(--elm-text-secondary,var(--color-gray-800)) dark:text-(--elm-text-secondary,var(--color-gray-300)) bg-elm-surface-sunken border border-(--elm-border-subtle,var(--color-gray-100)) dark:border-(--elm-border-subtle,var(--color-gray-700)) rounded-elm-card p-2 overflow-x-auto whitespace-pre leading-relaxed"
|
|
847
847
|
}
|
|
848
848
|
) });
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function br({
|
|
851
851
|
label: t,
|
|
852
852
|
open: e,
|
|
853
853
|
onToggle: n,
|
|
@@ -864,7 +864,7 @@ function gr({
|
|
|
864
864
|
className: "flex items-center gap-1 text-xs font-medium text-elm-text-subtle hover:text-(--elm-text-secondary,var(--color-gray-600)) dark:hover:text-(--elm-text-secondary,var(--color-gray-300)) hover:bg-elm-surface-hover rounded-elm-control -ml-2 pl-2 transition-colors flex-1 text-left h-full",
|
|
865
865
|
onClick: n,
|
|
866
866
|
children: [
|
|
867
|
-
/* @__PURE__ */ r("span", { className: "text-elm-text-subtle flex-shrink-0", children: e ? /* @__PURE__ */ r(
|
|
867
|
+
/* @__PURE__ */ r("span", { className: "text-elm-text-subtle flex-shrink-0", children: e ? /* @__PURE__ */ r(gn, { size: 12, weight: "bold" }) : /* @__PURE__ */ r(yn, { size: 12, weight: "bold" }) }),
|
|
868
868
|
t
|
|
869
869
|
]
|
|
870
870
|
}
|
|
@@ -874,67 +874,67 @@ function gr({
|
|
|
874
874
|
e && /* @__PURE__ */ r("div", { className: "pb-3", children: o })
|
|
875
875
|
] });
|
|
876
876
|
}
|
|
877
|
-
const
|
|
878
|
-
function
|
|
877
|
+
const vr = "[data-elm-theme],[data-elm-theme] *{transition:none!important}";
|
|
878
|
+
function Kt(t) {
|
|
879
879
|
const e = document.createElement("style");
|
|
880
|
-
e.textContent =
|
|
880
|
+
e.textContent = vr, document.head.appendChild(e), t(), requestAnimationFrame(() => requestAnimationFrame(() => e.remove()));
|
|
881
881
|
}
|
|
882
|
-
function
|
|
882
|
+
function Io(t, e) {
|
|
883
883
|
e == null || e.setAttribute("data-dragging", "");
|
|
884
884
|
const n = document.createElement("div");
|
|
885
885
|
n.style.cssText = `position:fixed;inset:0;z-index:2147483647;cursor:${t}`, document.body.appendChild(n);
|
|
886
886
|
const s = document.createElement("style");
|
|
887
|
-
return s.textContent =
|
|
887
|
+
return s.textContent = vr, document.head.appendChild(s), document.body.style.userSelect = "none", () => {
|
|
888
888
|
e == null || e.removeAttribute("data-dragging"), n.remove(), s.remove(), document.body.style.userSelect = "";
|
|
889
889
|
};
|
|
890
890
|
}
|
|
891
|
-
function
|
|
891
|
+
function xr(t, e, n, s) {
|
|
892
892
|
const o = ce(), [d, i] = q(() => {
|
|
893
|
-
const
|
|
894
|
-
return isNaN(
|
|
893
|
+
const h = parseInt(Jt(t, o) ?? "", 10);
|
|
894
|
+
return isNaN(h) ? e : Math.max(n, Math.min(s, h));
|
|
895
895
|
}), m = B(d);
|
|
896
896
|
m.current = d;
|
|
897
|
-
const
|
|
898
|
-
if (
|
|
899
|
-
|
|
900
|
-
const f =
|
|
897
|
+
const l = J((h) => {
|
|
898
|
+
if (h.button !== 0) return;
|
|
899
|
+
h.preventDefault();
|
|
900
|
+
const f = h.clientX, g = m.current, u = Io("col-resize", h.currentTarget);
|
|
901
901
|
function x(M) {
|
|
902
|
-
const C = Math.max(n, Math.min(s,
|
|
902
|
+
const C = Math.max(n, Math.min(s, g + (f - M.clientX)));
|
|
903
903
|
m.current = C, i(C);
|
|
904
904
|
}
|
|
905
905
|
function w() {
|
|
906
|
-
u(),
|
|
906
|
+
u(), dn(t, String(m.current), o), window.removeEventListener("mousemove", x), window.removeEventListener("mouseup", w);
|
|
907
907
|
}
|
|
908
908
|
window.addEventListener("mousemove", x), window.addEventListener("mouseup", w);
|
|
909
909
|
}, [t, n, s, o]);
|
|
910
|
-
return { width: d, onHandleMouseDown:
|
|
910
|
+
return { width: d, onHandleMouseDown: l };
|
|
911
911
|
}
|
|
912
|
-
function
|
|
913
|
-
const { uiStore: n } =
|
|
914
|
-
|
|
915
|
-
var
|
|
912
|
+
function wr(t, e = !0) {
|
|
913
|
+
const { uiStore: n } = se(), s = ce().ui.layerList, o = S(ot), d = S((f) => f.narrow), i = S((f) => f.sidebarWidth), m = S((f) => f.codeDockWidth), h = S((f) => f.tableFullscreen) || d ? 0 : (s && o ? i : 0) + m;
|
|
914
|
+
fe(() => {
|
|
915
|
+
var g;
|
|
916
916
|
if (!e) return;
|
|
917
|
-
const f = (
|
|
917
|
+
const f = (g = t.current) == null ? void 0 : g.closest("[data-elm-theme]");
|
|
918
918
|
if (f)
|
|
919
|
-
return f.style.setProperty("--elm-panel-offset", `${
|
|
919
|
+
return f.style.setProperty("--elm-panel-offset", `${h}px`), () => {
|
|
920
920
|
f.style.removeProperty("--elm-panel-offset");
|
|
921
921
|
};
|
|
922
|
-
}, [t, e,
|
|
922
|
+
}, [t, e, h]), fe(() => {
|
|
923
923
|
var x;
|
|
924
924
|
if (!e) return;
|
|
925
925
|
const f = (x = t.current) == null ? void 0 : x.closest("[data-elm-theme]");
|
|
926
926
|
if (!f) return;
|
|
927
|
-
const
|
|
927
|
+
const g = () => {
|
|
928
928
|
const w = f.clientWidth;
|
|
929
|
-
w > 0 && n.getState().narrow !== w <
|
|
929
|
+
w > 0 && n.getState().narrow !== w < It && n.getState().setNarrow(w < It);
|
|
930
930
|
};
|
|
931
|
-
|
|
932
|
-
const u = new ResizeObserver(
|
|
931
|
+
g();
|
|
932
|
+
const u = new ResizeObserver(g);
|
|
933
933
|
return u.observe(f), () => u.disconnect();
|
|
934
934
|
}, [t, e, n]);
|
|
935
935
|
}
|
|
936
|
-
const
|
|
937
|
-
function
|
|
936
|
+
const kr = "after:absolute after:transition-colors hover:after:bg-elm-focus-ring data-[dragging]:after:bg-elm-focus-ring", Mo = `absolute left-0 top-0 h-full w-1 z-20 cursor-col-resize after:inset-y-0 after:left-0 after:w-0.5 ${kr}`, Hs = `absolute top-0 left-0 right-0 h-1 z-10 cursor-row-resize after:inset-x-0 after:top-0 after:h-0.5 ${kr}`, To = "p-1 rounded-elm-control flex items-center justify-center text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-elm-focus-ring active:scale-[0.95] disabled:cursor-not-allowed disabled:active:scale-100", Ao = "text-elm-text hover:bg-elm-control-hover disabled:hover:bg-transparent", Fo = "flex items-center justify-center w-6 h-6 rounded-elm-control transition-colors bg-transparent hover:bg-(--elm-control-hover,color-mix(in_oklab,var(--color-gray-200)_70%,transparent)) dark:hover:bg-(--elm-control-hover,var(--color-gray-800)) focus:outline-none focus-visible:ring-2 focus-visible:ring-elm-focus-ring disabled:cursor-not-allowed", zo = "flex items-center justify-center w-12 h-12 backdrop-blur-md border border-elm-border/80 shadow-elm-control rounded-elm transition-colors active:scale-[0.95] focus:outline-none focus-visible:ring-2 focus-visible:ring-elm-focus-ring disabled:cursor-not-allowed disabled:active:scale-100", Lo = "bg-elm-surface/95 hover:bg-elm-surface-hover disabled:hover:bg-elm-surface/95", Ot = "disabled:text-elm-text-disabled", Bt = "text-primary-600 dark:text-primary-400", Ro = "text-elm-text";
|
|
937
|
+
function De({
|
|
938
938
|
label: t,
|
|
939
939
|
tooltipContent: e,
|
|
940
940
|
shortcut: n,
|
|
@@ -943,47 +943,47 @@ function Pe({
|
|
|
943
943
|
onClick: d,
|
|
944
944
|
active: i,
|
|
945
945
|
expanded: m,
|
|
946
|
-
controls:
|
|
947
|
-
disabled:
|
|
946
|
+
controls: l,
|
|
947
|
+
disabled: h,
|
|
948
948
|
size: f = "md",
|
|
949
|
-
children:
|
|
949
|
+
children: g
|
|
950
950
|
}) {
|
|
951
951
|
const x = ce().ui.keyboardShortcuts.enabled ? n : void 0;
|
|
952
|
-
return /* @__PURE__ */ r(
|
|
952
|
+
return /* @__PURE__ */ r(ve, { content: e ?? t, shortcut: x, side: o, children: /* @__PURE__ */ r(
|
|
953
953
|
"button",
|
|
954
954
|
{
|
|
955
955
|
"aria-label": t,
|
|
956
956
|
"data-elm-shortcut": s,
|
|
957
957
|
"aria-pressed": m === void 0 ? i : void 0,
|
|
958
958
|
"aria-expanded": m,
|
|
959
|
-
"aria-controls":
|
|
959
|
+
"aria-controls": l,
|
|
960
960
|
onClick: (w) => {
|
|
961
961
|
d(), w.detail > 0 && w.currentTarget.blur();
|
|
962
962
|
},
|
|
963
|
-
disabled:
|
|
964
|
-
className: f === "group" ? `${
|
|
965
|
-
children:
|
|
963
|
+
disabled: h,
|
|
964
|
+
className: f === "group" ? `${To} ${i ? Bt : Ao} ${Ot}` : `${f === "sm" ? Fo : `${zo} ${Lo}`} ${i ? Bt : Ro} ${Ot}`,
|
|
965
|
+
children: Kr(g) && typeof g.type != "string" ? Or(g, { ...i ? { weight: "fill" } : {}, ...f === "sm" ? { size: 16 } : {} }) : g
|
|
966
966
|
}
|
|
967
967
|
) });
|
|
968
968
|
}
|
|
969
|
-
const
|
|
970
|
-
const { dataStore: n } =
|
|
971
|
-
|
|
972
|
-
const w = S((L) => L.narrow) && !u, [M, C] = q(!1),
|
|
969
|
+
const Vs = jt(function({ footer: e }) {
|
|
970
|
+
const { dataStore: n } = se(), s = le(), o = S((L) => L.sidebarOpen), d = S((L) => L.setSidebarOpen), i = S((L) => L.setSidebarWidth), m = S((L) => L.codeDockWidth), l = S((L) => L.readonly), h = S((L) => L.layout), { width: f, onHandleMouseDown: g } = xr("elm_panel_width", 288, 200, 520), u = h === "split", x = B(null);
|
|
971
|
+
wr(x);
|
|
972
|
+
const w = S((L) => L.narrow) && !u, [M, C] = q(!1), a = B(!1);
|
|
973
973
|
$(() => {
|
|
974
974
|
const L = requestAnimationFrame(() => {
|
|
975
|
-
|
|
975
|
+
a.current = !0;
|
|
976
976
|
});
|
|
977
977
|
return () => cancelAnimationFrame(L);
|
|
978
|
-
}, []),
|
|
979
|
-
w && (
|
|
978
|
+
}, []), fe(() => {
|
|
979
|
+
w && (a.current || C(!0), d(!1));
|
|
980
980
|
}, [w, d]), $(() => {
|
|
981
981
|
if (!M) return;
|
|
982
982
|
const L = requestAnimationFrame(() => C(!1));
|
|
983
983
|
return () => cancelAnimationFrame(L);
|
|
984
984
|
}, [M]);
|
|
985
|
-
const { getKey: p } =
|
|
986
|
-
|
|
985
|
+
const { getKey: p } = Pe(), c = /* @__PURE__ */ r(Q, { children: p("toggle-sidebar").toUpperCase() }), [E, y] = q(null), N = J((L) => y(L), []);
|
|
986
|
+
fe(() => {
|
|
987
987
|
i(f);
|
|
988
988
|
}, [f, i]);
|
|
989
989
|
const P = S((L) => L.dialogState), z = P.type !== "closed", K = U((L) => L.features), b = U((L) => L.selectedIds), k = U((L) => L.deleteSelection), D = U((L) => L.clearSelection), R = S((L) => L.autoFocusGroupId), O = S((L) => L.setAutoFocusGroupId);
|
|
@@ -998,7 +998,7 @@ const Gs = Gt(function({ footer: e }) {
|
|
|
998
998
|
})), O(L);
|
|
999
999
|
}
|
|
1000
1000
|
const Z = P.type === "edit" ? `edit-${P.featureId}` : P.type;
|
|
1001
|
-
return /* @__PURE__ */ r(
|
|
1001
|
+
return /* @__PURE__ */ r(re, { children: /* @__PURE__ */ T(
|
|
1002
1002
|
"aside",
|
|
1003
1003
|
{
|
|
1004
1004
|
ref: x,
|
|
@@ -1006,25 +1006,25 @@ const Gs = Gt(function({ footer: e }) {
|
|
|
1006
1006
|
className: u ? "h-full w-full" : w ? `absolute top-0 h-full z-[600] ${o ? "shadow-elm-raised" : ""}` : "absolute top-0 h-full z-10",
|
|
1007
1007
|
style: u ? void 0 : w ? { width: `min(${f}px, 100% - 48px)`, right: o ? 0 : `calc(-1 * min(${f}px, 100% - 48px))`, transition: M ? "none" : "right 200ms ease" } : { width: f, right: o ? 0 : -f, transition: M ? "none" : "right 200ms ease" },
|
|
1008
1008
|
children: [
|
|
1009
|
-
!u && !o && /* @__PURE__ */ r("div", { className: "absolute z-30", style: { left: -64 - m, top: 16 }, children: /* @__PURE__ */ r(
|
|
1009
|
+
!u && !o && /* @__PURE__ */ r("div", { className: "absolute z-30", style: { left: -64 - m, top: 16 }, children: /* @__PURE__ */ r(De, { label: "Open layers panel", shortcutId: "toggle-sidebar", tooltipContent: "Show layers", shortcut: c, tooltipSide: "bottom", onClick: () => d(!0), children: /* @__PURE__ */ r(Zt, { size: 24 }) }) }),
|
|
1010
1010
|
/* @__PURE__ */ T("div", { inert: !u && !o, className: `h-full flex flex-col overflow-hidden bg-elm-surface ${u ? "" : "border-l border-elm-border/80"}`, children: [
|
|
1011
1011
|
!u && /* @__PURE__ */ r(
|
|
1012
1012
|
"div",
|
|
1013
1013
|
{
|
|
1014
|
-
onMouseDown:
|
|
1015
|
-
className:
|
|
1014
|
+
onMouseDown: g,
|
|
1015
|
+
className: Mo,
|
|
1016
1016
|
title: "Drag to resize panel"
|
|
1017
1017
|
}
|
|
1018
1018
|
),
|
|
1019
|
-
z && b.length < 2 ? /* @__PURE__ */ r(
|
|
1020
|
-
/* @__PURE__ */ r("header", { className: `${
|
|
1019
|
+
z && b.length < 2 ? /* @__PURE__ */ r(Eo, { dialogState: P, collapsible: !0 }, Z) : /* @__PURE__ */ T(re, { children: [
|
|
1020
|
+
/* @__PURE__ */ r("header", { className: `${go} px-3`, children: /* @__PURE__ */ T("div", { className: "flex items-center justify-between h-6 w-full", children: [
|
|
1021
1021
|
/* @__PURE__ */ T("div", { className: "flex items-center gap-1.5", children: [
|
|
1022
|
-
/* @__PURE__ */ r(
|
|
1022
|
+
/* @__PURE__ */ r(gr, {}),
|
|
1023
1023
|
/* @__PURE__ */ r("span", { className: "text-xs font-medium text-elm-text-secondary", children: "Layers" })
|
|
1024
1024
|
] }),
|
|
1025
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-0.5", children: !
|
|
1025
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-0.5", children: !l && /* @__PURE__ */ r(ve, { content: "New group", side: "bottom", children: /* @__PURE__ */ r("button", { type: "button", onClick: j, disabled: K.length === 0, className: `flex ${Ae}`, "aria-label": "New group", children: /* @__PURE__ */ r(xn, { size: 16 }) }) }) })
|
|
1026
1026
|
] }) }),
|
|
1027
|
-
/* @__PURE__ */ r("div", { ref: N, className: "flex-1 overflow-y-auto min-h-0", children: /* @__PURE__ */ r("div", { className: "px-3 py-3 flex flex-col gap-3 h-full", children: /* @__PURE__ */ r(
|
|
1027
|
+
/* @__PURE__ */ r("div", { ref: N, className: "flex-1 overflow-y-auto min-h-0", children: /* @__PURE__ */ r("div", { className: "px-3 py-3 flex flex-col gap-3 h-full", children: /* @__PURE__ */ r(qt, { fallback: K.length === 0 ? /* @__PURE__ */ r("div", { className: "h-full", children: /* @__PURE__ */ r(Qn, {}) }) : null, children: /* @__PURE__ */ r(pr, { autoFocusGroupId: R, scrollElement: E }) }) }) }),
|
|
1028
1028
|
b.length >= 2 && /* @__PURE__ */ T("div", { className: "flex items-center gap-2 px-3 py-2 bg-elm-surface-sunken border-t border-elm-border flex-shrink-0", children: [
|
|
1029
1029
|
/* @__PURE__ */ T("span", { className: "text-xs text-elm-text-secondary font-medium flex-1", children: [
|
|
1030
1030
|
b.length,
|
|
@@ -1038,7 +1038,7 @@ const Gs = Gt(function({ footer: e }) {
|
|
|
1038
1038
|
children: "Clear"
|
|
1039
1039
|
}
|
|
1040
1040
|
),
|
|
1041
|
-
!
|
|
1041
|
+
!l && /* @__PURE__ */ r(
|
|
1042
1042
|
"button",
|
|
1043
1043
|
{
|
|
1044
1044
|
onClick: () => {
|
|
@@ -1057,10 +1057,10 @@ const Gs = Gt(function({ footer: e }) {
|
|
|
1057
1057
|
}
|
|
1058
1058
|
) });
|
|
1059
1059
|
});
|
|
1060
|
-
function
|
|
1061
|
-
return t === "Point" || t === "MultiPoint" ? /* @__PURE__ */ r(
|
|
1060
|
+
function Sr({ type: t, size: e = 20 }) {
|
|
1061
|
+
return t === "Point" || t === "MultiPoint" ? /* @__PURE__ */ r(Qt, { size: e }) : t === "Polygon" || t === "MultiPolygon" ? /* @__PURE__ */ r(er, { size: e, weight: "fill" }) : t === "GeometryCollection" ? /* @__PURE__ */ r(Qe, { size: e }) : /* @__PURE__ */ r(tr, { size: e, weight: "bold" });
|
|
1062
1062
|
}
|
|
1063
|
-
function
|
|
1063
|
+
function $o(t) {
|
|
1064
1064
|
switch (t) {
|
|
1065
1065
|
case "Point":
|
|
1066
1066
|
return "Point";
|
|
@@ -1080,53 +1080,53 @@ function Lo(t) {
|
|
|
1080
1080
|
return t;
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
1083
|
-
function
|
|
1084
|
-
const [m,
|
|
1083
|
+
function Cr({ initialLabel: t, onCommit: e, autoFocus: n, activate: s, onEnd: o, onTab: d, disabled: i }) {
|
|
1084
|
+
const [m, l] = q(() => !i && (!!n || !!s)), [h, f] = q(t), g = B(null);
|
|
1085
1085
|
$(() => {
|
|
1086
|
-
s && !m && !i && (f(t),
|
|
1086
|
+
s && !m && !i && (f(t), l(!0));
|
|
1087
1087
|
}, [s]), $(() => {
|
|
1088
|
-
var
|
|
1089
|
-
m && ((
|
|
1088
|
+
var a, p;
|
|
1089
|
+
m && ((a = g.current) == null || a.focus(), (p = g.current) == null || p.select());
|
|
1090
1090
|
}, [m]);
|
|
1091
|
-
function u(
|
|
1092
|
-
i || (f(
|
|
1091
|
+
function u(a) {
|
|
1092
|
+
i || (f(a), l(!0));
|
|
1093
1093
|
}
|
|
1094
1094
|
function x() {
|
|
1095
|
-
const
|
|
1096
|
-
|
|
1095
|
+
const a = h.trim();
|
|
1096
|
+
a && a !== t && e(a), l(!1), o == null || o();
|
|
1097
1097
|
}
|
|
1098
1098
|
function w() {
|
|
1099
|
-
f(t),
|
|
1099
|
+
f(t), l(!1), o == null || o();
|
|
1100
1100
|
}
|
|
1101
|
-
function M(
|
|
1102
|
-
if (
|
|
1103
|
-
|
|
1101
|
+
function M(a) {
|
|
1102
|
+
if (a.key === "Enter") {
|
|
1103
|
+
a.preventDefault(), a.nativeEvent.stopImmediatePropagation(), x();
|
|
1104
1104
|
return;
|
|
1105
1105
|
}
|
|
1106
|
-
if (
|
|
1107
|
-
|
|
1106
|
+
if (a.key === "Escape") {
|
|
1107
|
+
a.nativeEvent.stopImmediatePropagation(), w();
|
|
1108
1108
|
return;
|
|
1109
1109
|
}
|
|
1110
|
-
if (
|
|
1111
|
-
|
|
1112
|
-
const p =
|
|
1113
|
-
p && p !== t && e(p),
|
|
1110
|
+
if (a.key === "Tab" && d) {
|
|
1111
|
+
a.preventDefault(), a.nativeEvent.stopImmediatePropagation();
|
|
1112
|
+
const p = h.trim();
|
|
1113
|
+
p && p !== t && e(p), l(!1), d(a.shiftKey ? "prev" : "next");
|
|
1114
1114
|
}
|
|
1115
1115
|
}
|
|
1116
1116
|
return { isRenaming: m, startRenaming: u, inputProps: {
|
|
1117
|
-
ref:
|
|
1118
|
-
value:
|
|
1119
|
-
onChange: (
|
|
1117
|
+
ref: g,
|
|
1118
|
+
value: h,
|
|
1119
|
+
onChange: (a) => f(a.target.value),
|
|
1120
1120
|
onBlur: x,
|
|
1121
1121
|
onKeyDown: M,
|
|
1122
|
-
onClick: (
|
|
1122
|
+
onClick: (a) => a.stopPropagation()
|
|
1123
1123
|
} };
|
|
1124
1124
|
}
|
|
1125
|
-
function
|
|
1125
|
+
function Ko(t) {
|
|
1126
1126
|
const e = t.properties.name;
|
|
1127
|
-
return typeof e == "string" && e.trim() ? e :
|
|
1127
|
+
return typeof e == "string" && e.trim() ? e : $o(t.geometry.type);
|
|
1128
1128
|
}
|
|
1129
|
-
const
|
|
1129
|
+
const Js = jt(function({
|
|
1130
1130
|
feature: e,
|
|
1131
1131
|
isSelected: n,
|
|
1132
1132
|
onRowClick: s,
|
|
@@ -1134,30 +1134,30 @@ const Us = Gt(function({
|
|
|
1134
1134
|
onRowJump: d,
|
|
1135
1135
|
onEdit: i,
|
|
1136
1136
|
onToggleHidden: m,
|
|
1137
|
-
containerProps:
|
|
1138
|
-
dragHandleProps:
|
|
1137
|
+
containerProps: l,
|
|
1138
|
+
dragHandleProps: h,
|
|
1139
1139
|
isDragging: f,
|
|
1140
|
-
innerRef:
|
|
1140
|
+
innerRef: g,
|
|
1141
1141
|
isMultiSelected: u,
|
|
1142
1142
|
onMultiSelectToggle: x,
|
|
1143
1143
|
onRangeSelect: w,
|
|
1144
1144
|
isContextMenuActive: M,
|
|
1145
1145
|
dragCountBadge: C,
|
|
1146
|
-
isGhosted:
|
|
1146
|
+
isGhosted: a,
|
|
1147
1147
|
onRename: p,
|
|
1148
|
-
renameActive:
|
|
1148
|
+
renameActive: c,
|
|
1149
1149
|
onRenameEnd: E,
|
|
1150
|
-
onRenameTab:
|
|
1150
|
+
onRenameTab: y,
|
|
1151
1151
|
joinTop: N,
|
|
1152
1152
|
joinBottom: P
|
|
1153
1153
|
}) {
|
|
1154
|
-
const z = B(null), K =
|
|
1154
|
+
const z = B(null), K = Ko(e), b = S((F) => F.readonly), { isRenaming: k, startRenaming: D, inputProps: R } = Cr({
|
|
1155
1155
|
initialLabel: K,
|
|
1156
1156
|
disabled: b,
|
|
1157
1157
|
onCommit: (F) => p == null ? void 0 : p(e.id, F),
|
|
1158
|
-
activate:
|
|
1158
|
+
activate: c,
|
|
1159
1159
|
onEnd: E,
|
|
1160
|
-
onTab:
|
|
1160
|
+
onTab: y
|
|
1161
1161
|
}), O = B(null);
|
|
1162
1162
|
$(() => () => {
|
|
1163
1163
|
O.current !== null && clearTimeout(O.current);
|
|
@@ -1174,26 +1174,26 @@ const Us = Gt(function({
|
|
|
1174
1174
|
I = !0, F.onload = null, F.onerror = null;
|
|
1175
1175
|
};
|
|
1176
1176
|
}, [j]);
|
|
1177
|
-
const v = j !== null && Z, { style: W, ...H } =
|
|
1177
|
+
const v = j !== null && Z, { style: W, ...H } = l ?? {};
|
|
1178
1178
|
return /* @__PURE__ */ r(
|
|
1179
1179
|
"li",
|
|
1180
1180
|
{
|
|
1181
1181
|
ref: (F) => {
|
|
1182
|
-
z.current = F,
|
|
1182
|
+
z.current = F, g == null || g(F);
|
|
1183
1183
|
},
|
|
1184
1184
|
...H,
|
|
1185
|
-
...
|
|
1186
|
-
style: { listStyle: "none", opacity:
|
|
1185
|
+
...h,
|
|
1186
|
+
style: { listStyle: "none", opacity: a ? 0.4 : void 0, outline: "none", ...W },
|
|
1187
1187
|
children: /* @__PURE__ */ T(
|
|
1188
1188
|
"div",
|
|
1189
1189
|
{
|
|
1190
1190
|
"data-feature-id": e.id,
|
|
1191
|
-
className:
|
|
1191
|
+
className: oe(
|
|
1192
1192
|
// Fixed h-9 (36 px): FeatureList's virtualiser computes row offsets from it.
|
|
1193
1193
|
"group flex items-center gap-2 px-2 h-9 rounded-elm-control text-sm cursor-default",
|
|
1194
1194
|
!f && N && "rounded-t-none",
|
|
1195
1195
|
!f && P && "rounded-b-none",
|
|
1196
|
-
f ? "cursor-grabbing shadow-elm-control bg-elm-surface-raised" : u || n ? "bg-(--elm-row-selected) hover:bg-(--elm-row-selected-hover) text-primary-700 dark:text-primary-300" : e.hidden ?
|
|
1196
|
+
f ? "cursor-grabbing shadow-elm-control bg-elm-surface-raised" : u || n ? "bg-(--elm-row-selected) hover:bg-(--elm-row-selected-hover) text-primary-700 dark:text-primary-300" : e.hidden ? oe("text-elm-text-disabled", M ? "bg-(--elm-row-hover)" : "hover:bg-(--elm-row-hover)") : M ? "bg-(--elm-row-hover) text-elm-text-secondary" : "hover:bg-(--elm-row-hover) text-elm-text-secondary"
|
|
1197
1197
|
),
|
|
1198
1198
|
onClick: (F) => {
|
|
1199
1199
|
if (F.metaKey || F.ctrlKey) {
|
|
@@ -1214,12 +1214,12 @@ const Us = Gt(function({
|
|
|
1214
1214
|
alt: "",
|
|
1215
1215
|
className: "w-5 h-5 rounded-elm-chip object-cover flex-shrink-0 border border-(--elm-border,var(--color-gray-200))"
|
|
1216
1216
|
}
|
|
1217
|
-
) : /* @__PURE__ */ r("span", { className:
|
|
1217
|
+
) : /* @__PURE__ */ r("span", { className: oe(
|
|
1218
1218
|
"flex-shrink-0",
|
|
1219
1219
|
// Selected rows tint the icon to match their text color (primary).
|
|
1220
1220
|
// Hidden rows mute it to the row's dimmed text. Otherwise stay neutral gray.
|
|
1221
1221
|
n || u ? "text-primary-700 dark:text-primary-300" : e.hidden ? "text-elm-text-disabled" : "text-(--elm-text-subtle,var(--color-gray-400))"
|
|
1222
|
-
), children: /* @__PURE__ */ r(
|
|
1222
|
+
), children: /* @__PURE__ */ r(Sr, { type: e.geometry.type }) }),
|
|
1223
1223
|
k ? /* @__PURE__ */ r(
|
|
1224
1224
|
"input",
|
|
1225
1225
|
{
|
|
@@ -1251,7 +1251,7 @@ const Us = Gt(function({
|
|
|
1251
1251
|
},
|
|
1252
1252
|
className: "text-elm-text hover:bg-(--elm-surface-hover,var(--color-gray-100)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700)) p-1 rounded-elm-control opacity-0 group-hover:opacity-100",
|
|
1253
1253
|
"aria-label": "Edit",
|
|
1254
|
-
children: /* @__PURE__ */ r(
|
|
1254
|
+
children: /* @__PURE__ */ r(wn, { size: 16 })
|
|
1255
1255
|
}
|
|
1256
1256
|
),
|
|
1257
1257
|
/* @__PURE__ */ r(
|
|
@@ -1260,12 +1260,12 @@ const Us = Gt(function({
|
|
|
1260
1260
|
onClick: (F) => {
|
|
1261
1261
|
F.stopPropagation(), m(e.id);
|
|
1262
1262
|
},
|
|
1263
|
-
className:
|
|
1263
|
+
className: oe(
|
|
1264
1264
|
"text-elm-text hover:bg-(--elm-surface-hover,var(--color-gray-100)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700)) p-1 rounded-elm-control",
|
|
1265
1265
|
e.hidden ? "" : "opacity-0 group-hover:opacity-100"
|
|
1266
1266
|
),
|
|
1267
1267
|
"aria-label": "Toggle visibility",
|
|
1268
|
-
children: e.hidden ? /* @__PURE__ */ r(
|
|
1268
|
+
children: e.hidden ? /* @__PURE__ */ r(et, { size: 16 }) : /* @__PURE__ */ r(it, { size: 16 })
|
|
1269
1269
|
}
|
|
1270
1270
|
)
|
|
1271
1271
|
] })
|
|
@@ -1275,55 +1275,55 @@ const Us = Gt(function({
|
|
|
1275
1275
|
}
|
|
1276
1276
|
);
|
|
1277
1277
|
});
|
|
1278
|
-
function
|
|
1279
|
-
const x = S((z) => z.readonly), { isRenaming: w, startRenaming: M, inputProps: C } =
|
|
1278
|
+
function Xs({ group: t, featureCount: e, autoFocus: n, isSelected: s, onToggleCollapse: o, onToggleHidden: d, onRename: i, onDelete: m, onSelect: l, innerRef: h, dragHandleProps: f, containerProps: g, isDragging: u }) {
|
|
1279
|
+
const x = S((z) => z.readonly), { isRenaming: w, startRenaming: M, inputProps: C } = Cr({
|
|
1280
1280
|
initialLabel: t.name,
|
|
1281
1281
|
disabled: x,
|
|
1282
1282
|
onCommit: i,
|
|
1283
1283
|
autoFocus: n
|
|
1284
|
-
}), [
|
|
1284
|
+
}), [a, p] = q(null), c = B(null);
|
|
1285
1285
|
function E(z) {
|
|
1286
1286
|
z.stopPropagation();
|
|
1287
|
-
const K =
|
|
1287
|
+
const K = c.current;
|
|
1288
1288
|
if (K) {
|
|
1289
1289
|
const b = K.getBoundingClientRect();
|
|
1290
1290
|
p({ x: b.right, y: b.bottom + 4 });
|
|
1291
1291
|
}
|
|
1292
1292
|
}
|
|
1293
|
-
const
|
|
1293
|
+
const y = B(null);
|
|
1294
1294
|
$(() => () => {
|
|
1295
|
-
|
|
1295
|
+
y.current !== null && clearTimeout(y.current);
|
|
1296
1296
|
}, []);
|
|
1297
1297
|
const N = {
|
|
1298
1298
|
label: t.hidden ? "Show on map" : "Hide from map",
|
|
1299
|
-
icon: t.hidden ? /* @__PURE__ */ r(
|
|
1299
|
+
icon: t.hidden ? /* @__PURE__ */ r(it, { size: 16 }) : /* @__PURE__ */ r(et, { size: 16 }),
|
|
1300
1300
|
onClick: () => d()
|
|
1301
1301
|
}, P = x ? [N] : [
|
|
1302
1302
|
N,
|
|
1303
1303
|
{
|
|
1304
1304
|
label: "Rename",
|
|
1305
|
-
icon: /* @__PURE__ */ r(
|
|
1305
|
+
icon: /* @__PURE__ */ r(Nn, { size: 16 }),
|
|
1306
1306
|
onClick: () => M(t.name)
|
|
1307
1307
|
},
|
|
1308
1308
|
{ separator: !0 },
|
|
1309
1309
|
{
|
|
1310
1310
|
// Removes the group but keeps its features at the top level.
|
|
1311
1311
|
label: "Ungroup",
|
|
1312
|
-
icon: /* @__PURE__ */ r(
|
|
1312
|
+
icon: /* @__PURE__ */ r(En, { size: 16 }),
|
|
1313
1313
|
onClick: () => m("ungroup")
|
|
1314
1314
|
},
|
|
1315
1315
|
{
|
|
1316
1316
|
label: "Delete group",
|
|
1317
|
-
icon: /* @__PURE__ */ r(
|
|
1317
|
+
icon: /* @__PURE__ */ r(Re, { size: 16 }),
|
|
1318
1318
|
onClick: () => m("delete-features")
|
|
1319
1319
|
}
|
|
1320
1320
|
];
|
|
1321
|
-
return /* @__PURE__ */ T(
|
|
1322
|
-
|
|
1323
|
-
|
|
1321
|
+
return /* @__PURE__ */ T(re, { children: [
|
|
1322
|
+
a && /* @__PURE__ */ r(
|
|
1323
|
+
dr,
|
|
1324
1324
|
{
|
|
1325
|
-
x:
|
|
1326
|
-
y:
|
|
1325
|
+
x: a.x,
|
|
1326
|
+
y: a.y,
|
|
1327
1327
|
onClose: () => p(null),
|
|
1328
1328
|
items: P
|
|
1329
1329
|
}
|
|
@@ -1331,16 +1331,16 @@ function js({ group: t, featureCount: e, autoFocus: n, isSelected: s, onToggleCo
|
|
|
1331
1331
|
/* @__PURE__ */ T(
|
|
1332
1332
|
"div",
|
|
1333
1333
|
{
|
|
1334
|
-
ref:
|
|
1335
|
-
...
|
|
1334
|
+
ref: h,
|
|
1335
|
+
...g,
|
|
1336
1336
|
...f,
|
|
1337
|
-
className:
|
|
1337
|
+
className: oe(
|
|
1338
1338
|
"group flex items-center gap-2 px-2 py-1.5 rounded-elm-control text-sm font-medium cursor-default",
|
|
1339
1339
|
u ? "shadow-elm-control bg-elm-surface-raised" : s ? "bg-(--elm-row-selected) hover:bg-(--elm-row-selected-hover) text-primary-700 dark:text-primary-300" : t.hidden ? "text-elm-text-disabled hover:bg-(--elm-row-hover)" : "text-elm-text-secondary hover:bg-(--elm-row-hover)"
|
|
1340
1340
|
),
|
|
1341
|
-
style: { outline: "none", cursor: u ? "grabbing" : "default", ...
|
|
1341
|
+
style: { outline: "none", cursor: u ? "grabbing" : "default", ...g == null ? void 0 : g.style },
|
|
1342
1342
|
onClick: () => {
|
|
1343
|
-
|
|
1343
|
+
l && l();
|
|
1344
1344
|
},
|
|
1345
1345
|
onContextMenu: (z) => {
|
|
1346
1346
|
z.preventDefault(), p({ x: z.clientX, y: z.clientY });
|
|
@@ -1349,7 +1349,7 @@ function js({ group: t, featureCount: e, autoFocus: n, isSelected: s, onToggleCo
|
|
|
1349
1349
|
/* @__PURE__ */ r(
|
|
1350
1350
|
"span",
|
|
1351
1351
|
{
|
|
1352
|
-
className:
|
|
1352
|
+
className: oe(
|
|
1353
1353
|
"flex-shrink-0 cursor-pointer",
|
|
1354
1354
|
t.hidden ? "text-elm-text-disabled" : "text-elm-text-muted"
|
|
1355
1355
|
),
|
|
@@ -1357,7 +1357,7 @@ function js({ group: t, featureCount: e, autoFocus: n, isSelected: s, onToggleCo
|
|
|
1357
1357
|
z.stopPropagation(), o();
|
|
1358
1358
|
},
|
|
1359
1359
|
"aria-label": t.collapsed ? "Expand group" : "Collapse group",
|
|
1360
|
-
children: t.collapsed ? /* @__PURE__ */ r(
|
|
1360
|
+
children: t.collapsed ? /* @__PURE__ */ r(kn, { size: 20, weight: "fill" }) : /* @__PURE__ */ r(Sn, { size: 20, weight: "fill" })
|
|
1361
1361
|
}
|
|
1362
1362
|
),
|
|
1363
1363
|
w ? /* @__PURE__ */ r(
|
|
@@ -1371,12 +1371,12 @@ function js({ group: t, featureCount: e, autoFocus: n, isSelected: s, onToggleCo
|
|
|
1371
1371
|
{
|
|
1372
1372
|
className: "flex-1 min-w-0 truncate cursor-default leading-snug border border-transparent rounded-elm-control px-1.5 py-0.5",
|
|
1373
1373
|
onClick: (z) => {
|
|
1374
|
-
z.stopPropagation(), !(!
|
|
1375
|
-
|
|
1374
|
+
z.stopPropagation(), !(!l || z.metaKey || z.ctrlKey || z.shiftKey) && (y.current !== null && (clearTimeout(y.current), y.current = null), !(z.detail >= 2) && (y.current = window.setTimeout(() => {
|
|
1375
|
+
l(), y.current = null;
|
|
1376
1376
|
}, 300)));
|
|
1377
1377
|
},
|
|
1378
1378
|
onDoubleClick: (z) => {
|
|
1379
|
-
z.stopPropagation(),
|
|
1379
|
+
z.stopPropagation(), y.current !== null && (clearTimeout(y.current), y.current = null), M(t.name);
|
|
1380
1380
|
},
|
|
1381
1381
|
children: t.name
|
|
1382
1382
|
}
|
|
@@ -1390,20 +1390,20 @@ function js({ group: t, featureCount: e, autoFocus: n, isSelected: s, onToggleCo
|
|
|
1390
1390
|
},
|
|
1391
1391
|
className: "text-elm-text p-1 rounded-elm-control hover:bg-(--elm-surface-hover,var(--color-gray-100)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700))",
|
|
1392
1392
|
"aria-label": "Show on map",
|
|
1393
|
-
children: /* @__PURE__ */ r(
|
|
1393
|
+
children: /* @__PURE__ */ r(et, { size: 16 })
|
|
1394
1394
|
}
|
|
1395
1395
|
),
|
|
1396
|
-
/* @__PURE__ */ r("div", { className: "opacity-0 group-hover:opacity-100", children: /* @__PURE__ */ r(
|
|
1396
|
+
/* @__PURE__ */ r("div", { className: "opacity-0 group-hover:opacity-100", children: /* @__PURE__ */ r(ve, { content: "More options", children: /* @__PURE__ */ r(
|
|
1397
1397
|
"button",
|
|
1398
1398
|
{
|
|
1399
|
-
ref:
|
|
1399
|
+
ref: c,
|
|
1400
1400
|
onClick: E,
|
|
1401
1401
|
className: "text-elm-text p-1 rounded-elm-control hover:bg-(--elm-surface-hover,var(--color-gray-100)) dark:hover:bg-(--elm-surface-hover,var(--color-gray-700))",
|
|
1402
1402
|
"aria-label": "More options",
|
|
1403
|
-
children: /* @__PURE__ */ r(
|
|
1403
|
+
children: /* @__PURE__ */ r(Cn, { size: 16, weight: "bold" })
|
|
1404
1404
|
}
|
|
1405
1405
|
) }) }),
|
|
1406
|
-
/* @__PURE__ */ r("span", { className:
|
|
1406
|
+
/* @__PURE__ */ r("span", { className: oe(
|
|
1407
1407
|
"font-normal w-7 text-right text-sm",
|
|
1408
1408
|
t.hidden ? "text-elm-text-disabled" : "text-elm-text-subtle"
|
|
1409
1409
|
), children: e })
|
|
@@ -1413,14 +1413,14 @@ function js({ group: t, featureCount: e, autoFocus: n, isSelected: s, onToggleCo
|
|
|
1413
1413
|
)
|
|
1414
1414
|
] });
|
|
1415
1415
|
}
|
|
1416
|
-
function
|
|
1417
|
-
const o =
|
|
1416
|
+
function Zs({ geometry: t, partIndex: e, isSelected: n, onClick: s }) {
|
|
1417
|
+
const o = tn(t, e), d = rn(t, e);
|
|
1418
1418
|
return (
|
|
1419
1419
|
// ml-5 nests the sub-row under its parent feature visually.
|
|
1420
1420
|
/* @__PURE__ */ r("li", { style: { listStyle: "none" }, className: "ml-5", children: /* @__PURE__ */ T(
|
|
1421
1421
|
"div",
|
|
1422
1422
|
{
|
|
1423
|
-
className:
|
|
1423
|
+
className: oe(
|
|
1424
1424
|
// Fixed h-9, like FeatureRow: FeatureList computes the expanded row's height.
|
|
1425
1425
|
"flex items-center gap-2 px-2 h-9 rounded-elm-control text-sm cursor-default",
|
|
1426
1426
|
n ? "bg-(--elm-row-selected) hover:bg-(--elm-row-selected-hover) text-primary-700 dark:text-primary-300" : "text-elm-text-muted hover:bg-(--elm-row-hover)"
|
|
@@ -1429,78 +1429,78 @@ function qs({ geometry: t, partIndex: e, isSelected: n, onClick: s }) {
|
|
|
1429
1429
|
i.stopPropagation(), s();
|
|
1430
1430
|
},
|
|
1431
1431
|
children: [
|
|
1432
|
-
/* @__PURE__ */ r("span", { className:
|
|
1432
|
+
/* @__PURE__ */ r("span", { className: oe(
|
|
1433
1433
|
"flex-shrink-0",
|
|
1434
1434
|
n ? "text-primary-700 dark:text-primary-300" : "text-(--elm-text-subtle,var(--color-gray-400))"
|
|
1435
|
-
), children: /* @__PURE__ */ r(
|
|
1435
|
+
), children: /* @__PURE__ */ r(Sr, { type: o.type }) }),
|
|
1436
1436
|
/* @__PURE__ */ r("span", { className: "flex-1 min-w-0 font-normal truncate leading-snug border border-transparent rounded-elm-control px-1.5 py-0.5", children: d })
|
|
1437
1437
|
]
|
|
1438
1438
|
}
|
|
1439
1439
|
) })
|
|
1440
1440
|
);
|
|
1441
1441
|
}
|
|
1442
|
-
const
|
|
1443
|
-
function
|
|
1444
|
-
const t = ce(), [e] = q(() =>
|
|
1442
|
+
const Oo = "elm_code_docked";
|
|
1443
|
+
function Bo() {
|
|
1444
|
+
const t = ce(), [e] = q(() => Jt(Oo, t) !== "0");
|
|
1445
1445
|
return e;
|
|
1446
1446
|
}
|
|
1447
|
-
function
|
|
1448
|
-
const e = ce(), n = S((f) => f.layout), s = S(
|
|
1449
|
-
|
|
1447
|
+
function Wo(t) {
|
|
1448
|
+
const e = ce(), n = S((f) => f.layout), s = S(ot), o = S((f) => f.sidebarWidth), d = S((f) => f.tableFullscreen), i = S((f) => f.setCodeDockWidth), m = S((f) => f.narrow), l = xr("elm_code_dock_width", 420, 280, 900);
|
|
1449
|
+
fe(() => {
|
|
1450
1450
|
if (t)
|
|
1451
|
-
return
|
|
1452
|
-
}, [t, m,
|
|
1453
|
-
const
|
|
1451
|
+
return Kt(() => i(m ? 0 : l.width)), () => Kt(() => i(0));
|
|
1452
|
+
}, [t, m, l.width, i]);
|
|
1453
|
+
const h = e.ui.layerList && s;
|
|
1454
1454
|
return {
|
|
1455
|
-
...
|
|
1455
|
+
...l,
|
|
1456
1456
|
className: `absolute top-0 ${m ? "z-[600] shadow-elm-raised" : "z-10"} flex flex-col bg-elm-surface border-l border-elm-border/80 overflow-hidden ${d ? "hidden" : ""}`,
|
|
1457
1457
|
// Left of the layers panel, above split layout's bottom panel. Same
|
|
1458
1458
|
// `right` transition as the panel and the data table: one mechanism
|
|
1459
1459
|
// (layout) keeps them in lockstep; mixing it with a compositor
|
|
1460
1460
|
// transform drifted and opened gaps.
|
|
1461
1461
|
style: {
|
|
1462
|
-
right:
|
|
1462
|
+
right: h ? o : 0,
|
|
1463
1463
|
bottom: n === "split" ? "33.33%" : 0,
|
|
1464
|
-
width: m ? `min(${
|
|
1464
|
+
width: m ? `min(${l.width}px, 100%)` : l.width,
|
|
1465
1465
|
transition: "right 200ms ease"
|
|
1466
1466
|
}
|
|
1467
1467
|
};
|
|
1468
1468
|
}
|
|
1469
|
-
function
|
|
1470
|
-
const t =
|
|
1471
|
-
return
|
|
1469
|
+
function Ys() {
|
|
1470
|
+
const t = Bo(), e = Wo(t), n = B(null);
|
|
1471
|
+
return wr(n, t), t ? /* @__PURE__ */ r("div", { ref: n, "aria-hidden": "true", className: e.className, style: e.style }) : null;
|
|
1472
1472
|
}
|
|
1473
|
-
function
|
|
1474
|
-
const [t, e] = q(""), [n, s] = q(!1), [o, d] = q(!1), [i, m] = q(-1),
|
|
1473
|
+
function _o() {
|
|
1474
|
+
const [t, e] = q(""), [n, s] = q(!1), [o, d] = q(!1), [i, m] = q(-1), l = B(null), h = B(null), { results: f, loading: g, error: u, flush: x } = _r(t), w = B(!1), { flyTo: M, fitBounds: C } = ze(), { dataStore: a } = se(), p = Se();
|
|
1475
1475
|
$(() => {
|
|
1476
1476
|
s(t.trim().length >= 2), m(-1);
|
|
1477
1477
|
}, [t, f]), $(() => {
|
|
1478
1478
|
w.current = !1;
|
|
1479
1479
|
}, [t]), $(() => {
|
|
1480
|
-
!w.current ||
|
|
1481
|
-
}, [f,
|
|
1480
|
+
!w.current || g || (w.current = !1, f.length && P(0));
|
|
1481
|
+
}, [f, g]), $(() => {
|
|
1482
1482
|
function b(k) {
|
|
1483
|
-
|
|
1483
|
+
l.current && !l.current.contains(k.target) && s(!1);
|
|
1484
1484
|
}
|
|
1485
1485
|
return document.addEventListener("mousedown", b), () => document.removeEventListener("mousedown", b);
|
|
1486
1486
|
}, []), $(() => {
|
|
1487
1487
|
function b(k) {
|
|
1488
1488
|
var D, R;
|
|
1489
1489
|
if (p(k)) {
|
|
1490
|
-
if (k.key === "f" && (k.metaKey || k.ctrlKey) && !
|
|
1491
|
-
k.preventDefault(), (D =
|
|
1490
|
+
if (k.key === "f" && (k.metaKey || k.ctrlKey) && !Nr(k)) {
|
|
1491
|
+
k.preventDefault(), (D = h.current) == null || D.focus();
|
|
1492
1492
|
return;
|
|
1493
1493
|
}
|
|
1494
|
-
k.key === "Escape" && (n || document.activeElement ===
|
|
1494
|
+
k.key === "Escape" && (n || document.activeElement === h.current) && (k.stopPropagation(), e(""), s(!1), m(-1), (R = h.current) == null || R.blur());
|
|
1495
1495
|
}
|
|
1496
1496
|
}
|
|
1497
1497
|
return window.addEventListener("keydown", b, { capture: !0 }), () => window.removeEventListener("keydown", b, { capture: !0 });
|
|
1498
1498
|
}, [n, p]);
|
|
1499
|
-
function
|
|
1499
|
+
function c(b) {
|
|
1500
1500
|
M == null || M([parseFloat(b.lat), parseFloat(b.lon)], 15);
|
|
1501
1501
|
}
|
|
1502
1502
|
function E(b) {
|
|
1503
|
-
const k = parseFloat(b.lat), D = parseFloat(b.lon), R =
|
|
1503
|
+
const k = parseFloat(b.lat), D = parseFloat(b.lon), R = a.getState().getDefaultSchema(), O = {};
|
|
1504
1504
|
for (const Z of R.fields)
|
|
1505
1505
|
O[Z.key] = Z.key === "name" ? b.display_name.split(",")[0].trim() : "";
|
|
1506
1506
|
const j = {
|
|
@@ -1510,9 +1510,9 @@ function Bo() {
|
|
|
1510
1510
|
geometry: { type: "Point", coordinates: [D, k] },
|
|
1511
1511
|
properties: O
|
|
1512
1512
|
};
|
|
1513
|
-
|
|
1513
|
+
a.getState().addFeature(j), M == null || M([k, D], 15), N();
|
|
1514
1514
|
}
|
|
1515
|
-
function
|
|
1515
|
+
function y(b) {
|
|
1516
1516
|
const k = b.geojson;
|
|
1517
1517
|
if (!k || k.type === "Point") return;
|
|
1518
1518
|
let D;
|
|
@@ -1520,25 +1520,25 @@ function Bo() {
|
|
|
1520
1520
|
const R = {
|
|
1521
1521
|
type: "Feature",
|
|
1522
1522
|
id: crypto.randomUUID(),
|
|
1523
|
-
schemaId:
|
|
1523
|
+
schemaId: nn,
|
|
1524
1524
|
geometry: D,
|
|
1525
1525
|
properties: { name: b.display_name.split(",")[0].trim() }
|
|
1526
1526
|
};
|
|
1527
|
-
|
|
1527
|
+
a.getState().addFeature(R), C == null || C(st(D)), N();
|
|
1528
1528
|
}
|
|
1529
1529
|
function N() {
|
|
1530
1530
|
e(""), s(!1), m(-1);
|
|
1531
1531
|
}
|
|
1532
1532
|
function P(b) {
|
|
1533
|
-
m(b),
|
|
1533
|
+
m(b), c(f[b]), requestAnimationFrame(() => {
|
|
1534
1534
|
var k;
|
|
1535
|
-
return (k =
|
|
1535
|
+
return (k = h.current) == null ? void 0 : k.focus();
|
|
1536
1536
|
});
|
|
1537
1537
|
}
|
|
1538
1538
|
function z(b) {
|
|
1539
1539
|
if (b.key === "Enter") {
|
|
1540
1540
|
if (t.trim().length < 2) return;
|
|
1541
|
-
if (b.preventDefault(), f.length && !
|
|
1541
|
+
if (b.preventDefault(), f.length && !g) {
|
|
1542
1542
|
P(i >= 0 ? i : 0);
|
|
1543
1543
|
return;
|
|
1544
1544
|
}
|
|
@@ -1548,13 +1548,13 @@ function Bo() {
|
|
|
1548
1548
|
f.length && (b.key === "ArrowDown" ? (b.preventDefault(), m((k) => (k + 1) % f.length)) : b.key === "ArrowUp" && (b.preventDefault(), m((k) => k <= 0 ? f.length - 1 : k - 1)));
|
|
1549
1549
|
}
|
|
1550
1550
|
const K = n && t.trim().length >= 2;
|
|
1551
|
-
return { query: t, setQuery: e, setOpen: s, showDropdown: K, containerRef:
|
|
1551
|
+
return { query: t, setQuery: e, setOpen: s, showDropdown: K, containerRef: l, inputRef: h, focused: o, setFocused: d, results: f, loading: g, error: u, flyToResult: c, handleAdd: E, handleAddShape: y, clear: N, activeIndex: i, setActiveIndex: m, handleInputKeyDown: z };
|
|
1552
1552
|
}
|
|
1553
|
-
function
|
|
1553
|
+
function Nr(t) {
|
|
1554
1554
|
var e, n;
|
|
1555
1555
|
return ((n = (e = t.target) == null ? void 0 : e.closest) == null ? void 0 : n.call(e, ".cm-editor")) != null;
|
|
1556
1556
|
}
|
|
1557
|
-
const
|
|
1557
|
+
const Go = 208, Uo = {
|
|
1558
1558
|
"top-left": { style: { top: 16, left: 16 }, className: "flex-col items-start" },
|
|
1559
1559
|
"top-center": { style: { top: 16, left: 0, right: 0 }, className: "flex-col items-center" },
|
|
1560
1560
|
"top-right": { style: { top: 16, right: 16 }, className: "flex-col items-end" },
|
|
@@ -1564,83 +1564,83 @@ const Wo = 208, _o = {
|
|
|
1564
1564
|
"bottom-center": { style: { bottom: 16, left: 0, right: 0 }, className: "flex-col-reverse items-center" },
|
|
1565
1565
|
"bottom-right": { style: { bottom: 16, right: 16 }, className: "flex-col-reverse items-end" }
|
|
1566
1566
|
};
|
|
1567
|
-
function
|
|
1568
|
-
const e = U((A) => A.features.length), n = U((A) => A.maxFeatures), s = n != null && e >= n, o =
|
|
1569
|
-
let A =
|
|
1567
|
+
function Qs({ embedded: t } = {}) {
|
|
1568
|
+
const e = U((A) => A.features.length), n = U((A) => A.maxFeatures), s = n != null && e >= n, o = le(), d = ce(), { toolbar: i } = d, m = i.direction === "vertical", l = Uo[i.position], h = S(ot), f = S((A) => A.sidebarWidth), g = S((A) => A.codeDockWidth), u = S((A) => A.layout), x = d.ui.layerList && h, w = i.position.startsWith("bottom"), M = i.position === "left-center" || i.position === "right-center", C = u === "split" && w, a = u === "split" && M, p = (() => {
|
|
1569
|
+
let A = l.style;
|
|
1570
1570
|
const X = i.position.endsWith("-right") || i.position.startsWith("right");
|
|
1571
|
-
return x ? X && (A = { ...A, right: f + 16 +
|
|
1572
|
-
})(),
|
|
1571
|
+
return x ? X && (A = { ...A, right: f + 16 + g }) : d.ui.layerList && u === "panel" && i.position === "top-right" ? A = { ...A, right: 72 + g } : X && g && (A = { ...A, right: 16 + g }), C ? A = { ...A, bottom: "calc(33.33% + 16px)" } : w && (A = { ...A, bottom: "calc(var(--elm-table-offset, 0px) + 16px)" }), a && (A = { ...A, top: "33.33%" }), A === l.style ? l : { ...l, style: A };
|
|
1572
|
+
})(), c = S((A) => A.editingMode), E = S((A) => A.enabledTools), y = S((A) => A.unavailableTools), N = S((A) => A.readonly), P = S((A) => A.setEditingMode);
|
|
1573
1573
|
function z(A) {
|
|
1574
1574
|
if (s && A !== "none") {
|
|
1575
|
-
o({ type: "error", code: "limit-reached", source: "editor", message:
|
|
1575
|
+
o({ type: "error", code: "limit-reached", source: "editor", message: on(n) });
|
|
1576
1576
|
return;
|
|
1577
1577
|
}
|
|
1578
1578
|
P(A);
|
|
1579
1579
|
}
|
|
1580
|
-
const { getKey: K } =
|
|
1580
|
+
const { getKey: K } = Pe(), { query: b, setQuery: k, setOpen: D, showDropdown: R, containerRef: O, inputRef: j, focused: Z, setFocused: L, results: v, loading: W, error: H, flyToResult: F, handleAdd: I, handleAddShape: _, clear: G, activeIndex: V, setActiveIndex: Y, handleInputKeyDown: ne } = _o(), xe = B(null), Ie = B(null);
|
|
1581
1581
|
$(() => {
|
|
1582
1582
|
var de;
|
|
1583
1583
|
if (t || !w) return;
|
|
1584
|
-
const A = (de =
|
|
1584
|
+
const A = (de = Ie.current) == null ? void 0 : de.closest("[data-elm-theme]");
|
|
1585
1585
|
if (!A) return;
|
|
1586
1586
|
const X = () => {
|
|
1587
|
-
var
|
|
1588
|
-
const
|
|
1589
|
-
A.style.setProperty("--elm-bottom-toolbar-offset", `${
|
|
1587
|
+
var Ce;
|
|
1588
|
+
const we = ((Ce = Ie.current) == null ? void 0 : Ce.offsetHeight) ?? 0;
|
|
1589
|
+
A.style.setProperty("--elm-bottom-toolbar-offset", `${we + 8}px`);
|
|
1590
1590
|
};
|
|
1591
1591
|
X();
|
|
1592
1592
|
const ee = new ResizeObserver(X);
|
|
1593
|
-
return
|
|
1593
|
+
return Ie.current && ee.observe(Ie.current), () => {
|
|
1594
1594
|
ee.disconnect(), A.style.setProperty("--elm-bottom-toolbar-offset", "0px");
|
|
1595
1595
|
};
|
|
1596
1596
|
}, [t, w]);
|
|
1597
|
-
const [
|
|
1598
|
-
|
|
1599
|
-
var
|
|
1600
|
-
const A =
|
|
1597
|
+
const [$e, he] = q(!1), mt = B(null), ft = B(null), [Dr, pt] = q(!1), ht = B(null);
|
|
1598
|
+
fe(() => {
|
|
1599
|
+
var St, Ct;
|
|
1600
|
+
const A = ht.current;
|
|
1601
1601
|
if (m || !A) {
|
|
1602
|
-
|
|
1602
|
+
pt(!1);
|
|
1603
1603
|
return;
|
|
1604
1604
|
}
|
|
1605
|
-
const X = ((
|
|
1605
|
+
const X = ((St = O.current) == null ? void 0 : St.closest('[data-elm-edge="top"], [data-elm-edge="bottom"]')) ?? null, ee = X ?? ((Ct = O.current) == null ? void 0 : Ct.offsetParent);
|
|
1606
1606
|
if (!ee) return;
|
|
1607
|
-
const de = (
|
|
1608
|
-
const
|
|
1609
|
-
let
|
|
1610
|
-
const
|
|
1611
|
-
|
|
1612
|
-
const
|
|
1613
|
-
|
|
1607
|
+
const de = (Ke) => Ke.flatMap((ye) => getComputedStyle(ye).display === "contents" ? de([...ye.children]) : [ye.offsetWidth]), we = () => {
|
|
1608
|
+
const Ke = de([...A.children]).filter((Xe) => Xe > 0), ye = getComputedStyle(A), Tr = parseFloat(ye.paddingLeft) + parseFloat(ye.paddingRight) + parseFloat(ye.borderLeftWidth) + parseFloat(ye.borderRightWidth);
|
|
1609
|
+
let Nt = Ke.reduce((Xe, Ar) => Xe + Ar, 0) + 8 * Math.max(0, Ke.length - 1) + Tr;
|
|
1610
|
+
const Et = A.querySelector("[data-elm-search-toggle]");
|
|
1611
|
+
Et && (Nt += Go - Et.offsetWidth);
|
|
1612
|
+
const Pt = X ? X.clientWidth - (parseFloat(X.dataset.elmClearance ?? "") || 0) : ee.clientWidth - 32;
|
|
1613
|
+
pt(Pt > 0 && Nt > Pt + 0.5);
|
|
1614
1614
|
};
|
|
1615
|
-
|
|
1616
|
-
const
|
|
1617
|
-
return
|
|
1615
|
+
we();
|
|
1616
|
+
const Ce = new ResizeObserver(() => we());
|
|
1617
|
+
return Ce.observe(ee), Ce.observe(A), () => Ce.disconnect();
|
|
1618
1618
|
}, [m, O]);
|
|
1619
|
-
const ge = m ||
|
|
1620
|
-
|
|
1619
|
+
const ge = m || Dr, gt = B(ge);
|
|
1620
|
+
gt.current = ge, $(() => {
|
|
1621
1621
|
ge || he(!1);
|
|
1622
1622
|
}, [ge]);
|
|
1623
|
-
const
|
|
1624
|
-
function
|
|
1625
|
-
const A =
|
|
1623
|
+
const yt = B(null), bt = Se();
|
|
1624
|
+
function vt() {
|
|
1625
|
+
const A = yt.current;
|
|
1626
1626
|
A && (A.style.animation = "none", A.offsetWidth, A.style.animation = "press-pulse 200ms ease-out");
|
|
1627
1627
|
}
|
|
1628
1628
|
$(() => {
|
|
1629
1629
|
function A(X) {
|
|
1630
|
-
X.key === "f" && (X.metaKey || X.ctrlKey) &&
|
|
1630
|
+
X.key === "f" && (X.metaKey || X.ctrlKey) && bt(X) && !Nr(X) && (gt.current ? he(!0) : vt());
|
|
1631
1631
|
}
|
|
1632
1632
|
return window.addEventListener("keydown", A), () => window.removeEventListener("keydown", A);
|
|
1633
|
-
}, [
|
|
1634
|
-
const
|
|
1633
|
+
}, [bt]);
|
|
1634
|
+
const Ir = i.position.startsWith("right") || i.position.endsWith("-right") ? "left" : "right";
|
|
1635
1635
|
$(() => {
|
|
1636
|
-
if (
|
|
1636
|
+
if (!$e) return;
|
|
1637
1637
|
requestAnimationFrame(() => {
|
|
1638
1638
|
var ee;
|
|
1639
1639
|
return (ee = j.current) == null ? void 0 : ee.focus();
|
|
1640
1640
|
});
|
|
1641
1641
|
function A(ee) {
|
|
1642
|
-
var de,
|
|
1643
|
-
!((de =
|
|
1642
|
+
var de, we;
|
|
1643
|
+
!((de = mt.current) != null && de.contains(ee.target)) && !((we = ft.current) != null && we.contains(ee.target)) && he(!1);
|
|
1644
1644
|
}
|
|
1645
1645
|
function X(ee) {
|
|
1646
1646
|
ee.key === "Escape" && he(!1);
|
|
@@ -1648,34 +1648,34 @@ function Vs({ embedded: t } = {}) {
|
|
|
1648
1648
|
return document.addEventListener("mousedown", A), document.addEventListener("keydown", X), () => {
|
|
1649
1649
|
document.removeEventListener("mousedown", A), document.removeEventListener("keydown", X);
|
|
1650
1650
|
};
|
|
1651
|
-
}, [
|
|
1652
|
-
const
|
|
1653
|
-
function
|
|
1651
|
+
}, [$e, j]);
|
|
1652
|
+
const _e = c === "place-point", Ge = c === "draw-line", Ue = c === "draw-polygon", je = c === "draw-circle", qe = c === "draw-rect", He = c === "draw-route", Ve = c === "draw-freehand", Je = c === "pick-shape", xt = c === "measure", ie = (A) => (!E || E.includes(A)) && !y.includes(A), Mr = null;
|
|
1653
|
+
function wt(A) {
|
|
1654
1654
|
var X;
|
|
1655
1655
|
if (A.key === "Tab" && V >= 0) {
|
|
1656
|
-
A.preventDefault(), (X =
|
|
1656
|
+
A.preventDefault(), (X = xe.current) == null || X.focusAdd(V);
|
|
1657
1657
|
return;
|
|
1658
1658
|
}
|
|
1659
|
-
|
|
1659
|
+
ne(A);
|
|
1660
1660
|
}
|
|
1661
|
-
function
|
|
1661
|
+
function kt(A, X) {
|
|
1662
1662
|
var de;
|
|
1663
1663
|
const ee = ((X + A) % v.length + v.length) % v.length;
|
|
1664
|
-
Y(ee), (de =
|
|
1664
|
+
Y(ee), (de = xe.current) == null || de.focusAdd(ee);
|
|
1665
1665
|
}
|
|
1666
1666
|
return /* @__PURE__ */ T(
|
|
1667
1667
|
"div",
|
|
1668
1668
|
{
|
|
1669
1669
|
ref: O,
|
|
1670
1670
|
"data-elm-search-open": R ? "true" : void 0,
|
|
1671
|
-
className: t ? "select-none" :
|
|
1671
|
+
className: t ? "select-none" : oe("absolute z-[500] flex gap-2 pointer-events-none select-none", p.className),
|
|
1672
1672
|
style: t ? void 0 : p.style,
|
|
1673
1673
|
children: [
|
|
1674
|
-
/* @__PURE__ */ T("div", { ref:
|
|
1674
|
+
/* @__PURE__ */ T("div", { ref: Ie, className: "relative w-fit max-w-full", children: [
|
|
1675
1675
|
R && !ge && /* @__PURE__ */ r(
|
|
1676
|
-
|
|
1676
|
+
zt,
|
|
1677
1677
|
{
|
|
1678
|
-
ref:
|
|
1678
|
+
ref: xe,
|
|
1679
1679
|
results: v,
|
|
1680
1680
|
loading: W,
|
|
1681
1681
|
error: H,
|
|
@@ -1684,38 +1684,38 @@ function Vs({ embedded: t } = {}) {
|
|
|
1684
1684
|
onAddShape: N ? void 0 : _,
|
|
1685
1685
|
activeIndex: V,
|
|
1686
1686
|
onHoverIndex: Y,
|
|
1687
|
-
onNavigate:
|
|
1687
|
+
onNavigate: kt,
|
|
1688
1688
|
layout: "row",
|
|
1689
1689
|
className: `absolute left-0 right-0 bg-elm-surface border border-elm-border rounded-elm shadow-elm z-50 overflow-hidden pointer-events-auto ${w ? "bottom-full mb-2" : "top-full mt-2"}`
|
|
1690
1690
|
}
|
|
1691
1691
|
),
|
|
1692
|
-
/* @__PURE__ */ T("div", { ref:
|
|
1692
|
+
/* @__PURE__ */ T("div", { ref: ht, className: oe(
|
|
1693
1693
|
"flex gap-2 bg-elm-surface/95 backdrop-blur-md border border-(--elm-border,color-mix(in_oklab,var(--color-black)_10%,transparent)) dark:border-(--elm-border,color-mix(in_oklab,var(--color-white)_10%,transparent)) shadow-elm rounded-elm pointer-events-auto antialiased",
|
|
1694
1694
|
m ? "flex-col items-center p-[7px]" : "flex-row flex-wrap justify-center items-center p-[7px]"
|
|
1695
1695
|
), children: [
|
|
1696
|
-
N ? null : /* @__PURE__ */ T(
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1696
|
+
N ? null : /* @__PURE__ */ T(re, { children: [
|
|
1697
|
+
ie("point") && /* @__PURE__ */ r(me, { active: _e, disabled: !_e && s, onClick: () => z(_e ? "none" : "place-point"), label: "Point", shortcut: K("place-point").toUpperCase(), shortcutId: "place-point", children: /* @__PURE__ */ r(Qt, { size: 24 }) }),
|
|
1698
|
+
ie("line") && /* @__PURE__ */ r(me, { active: Ge, disabled: !Ge && s, onClick: () => z(Ge ? "none" : "draw-line"), label: "Line", shortcut: K("draw-line").toUpperCase(), shortcutId: "draw-line", children: /* @__PURE__ */ r(tr, { size: 24 }) }),
|
|
1699
|
+
ie("polygon") && /* @__PURE__ */ r(me, { active: Ue, disabled: !Ue && s, onClick: () => z(Ue ? "none" : "draw-polygon"), label: "Area", shortcut: K("draw-polygon").toUpperCase(), shortcutId: "draw-polygon", children: /* @__PURE__ */ r(er, { size: 24 }) }),
|
|
1700
|
+
ie("route") && /* @__PURE__ */ r(me, { active: He, disabled: !He && s, onClick: () => z(He ? "none" : "draw-route"), label: "Route", shortcut: K("draw-route").toUpperCase(), shortcutId: "draw-route", children: /* @__PURE__ */ r(Pn, { size: 24 }) }),
|
|
1701
|
+
ie("circle") && /* @__PURE__ */ r(me, { active: je, disabled: !je && s, onClick: () => z(je ? "none" : "draw-circle"), label: "Circle", shortcut: K("draw-circle").toUpperCase(), shortcutId: "draw-circle", children: /* @__PURE__ */ r(Dn, { size: 24 }) }),
|
|
1702
|
+
ie("rectangle") && /* @__PURE__ */ r(me, { active: qe, disabled: !qe && s, onClick: () => z(qe ? "none" : "draw-rect"), label: "Rectangle", shortcut: K("draw-rect").toUpperCase(), shortcutId: "draw-rect", children: /* @__PURE__ */ r(In, { size: 24 }) }),
|
|
1703
|
+
ie("freehand") && /* @__PURE__ */ r(me, { active: Ve, disabled: !Ve && s, onClick: () => z(Ve ? "none" : "draw-freehand"), label: "Freehand", shortcut: K("draw-freehand").toUpperCase(), shortcutId: "draw-freehand", children: /* @__PURE__ */ r(Mn, { size: 24 }) }),
|
|
1704
|
+
ie("picker") && /* @__PURE__ */ r(me, { active: Je, disabled: !Je && s, onClick: () => z(Je ? "none" : "pick-shape"), label: "Picker", shortcut: K("picker").toUpperCase(), shortcutId: "picker", children: /* @__PURE__ */ r(Tn, { size: 24 }) })
|
|
1705
1705
|
] }),
|
|
1706
|
-
|
|
1707
|
-
!N && /* @__PURE__ */ r(
|
|
1708
|
-
/* @__PURE__ */ r(me, { active:
|
|
1709
|
-
ge &&
|
|
1706
|
+
ie("measure") && /* @__PURE__ */ T(re, { children: [
|
|
1707
|
+
!N && /* @__PURE__ */ r(Lt, { vertical: m }),
|
|
1708
|
+
/* @__PURE__ */ r(me, { active: xt, onClick: () => P(xt ? "none" : "measure"), label: "Measure", shortcut: K("measure").toUpperCase(), shortcutId: "measure", children: /* @__PURE__ */ r(An, { size: 24 }) }),
|
|
1709
|
+
ge && ie("search") && /* @__PURE__ */ r(Lt, { vertical: m })
|
|
1710
1710
|
] }),
|
|
1711
|
-
|
|
1711
|
+
ie("search") && !ge && /* @__PURE__ */ T("div", { className: "flex items-center gap-2 pl-2.5 pr-3 py-1.5 bg-(--elm-surface-sunken,var(--color-gray-100)) dark:bg-(--elm-surface-sunken,color-mix(in_oklab,var(--color-white)_7%,transparent)) hover:bg-(--elm-control-hover,color-mix(in_oklab,var(--color-gray-200)_70%,transparent)) dark:hover:bg-(--elm-control-hover,color-mix(in_oklab,var(--color-white)_10%,transparent)) rounded-elm-control transition-colors w-52 focus-within:ring-1 focus-within:ring-inset focus-within:ring-(--elm-border-strong,var(--color-gray-300)) dark:focus-within:ring-(--elm-border-strong,var(--color-gray-600))", children: [
|
|
1712
1712
|
/* @__PURE__ */ T(
|
|
1713
1713
|
"div",
|
|
1714
1714
|
{
|
|
1715
|
-
ref:
|
|
1715
|
+
ref: yt,
|
|
1716
1716
|
className: "flex items-center gap-2 flex-1 min-w-0",
|
|
1717
1717
|
children: [
|
|
1718
|
-
/* @__PURE__ */ r(
|
|
1718
|
+
/* @__PURE__ */ r(Ye, { size: 14, className: "text-elm-text-subtle flex-shrink-0" }),
|
|
1719
1719
|
/* @__PURE__ */ r(
|
|
1720
1720
|
"input",
|
|
1721
1721
|
{
|
|
@@ -1724,17 +1724,17 @@ function Vs({ embedded: t } = {}) {
|
|
|
1724
1724
|
value: b,
|
|
1725
1725
|
onChange: (A) => k(A.target.value),
|
|
1726
1726
|
onFocus: () => {
|
|
1727
|
-
L(!0),
|
|
1727
|
+
L(!0), vt(), b.trim().length >= 2 && D(!0);
|
|
1728
1728
|
},
|
|
1729
1729
|
onBlur: () => L(!1),
|
|
1730
|
-
onKeyDown:
|
|
1730
|
+
onKeyDown: wt,
|
|
1731
1731
|
placeholder: "Search places…",
|
|
1732
1732
|
className: "bg-transparent text-sm text-elm-text-secondary placeholder-elm-text-muted outline-none w-full",
|
|
1733
1733
|
autoComplete: "off"
|
|
1734
1734
|
}
|
|
1735
1735
|
),
|
|
1736
1736
|
W && /* @__PURE__ */ r("div", { className: "w-3 h-3 border-2 border-(--elm-border-strong,var(--color-gray-300)) border-t-primary-500 rounded-full animate-spin flex-shrink-0" }),
|
|
1737
|
-
!W && b && /* @__PURE__ */ r("button", { onClick: G, className: "p-1 -m-1 rounded-elm-chip text-elm-text hover:bg-(--elm-control-hover,var(--color-gray-200)) dark:hover:bg-(--elm-control-hover,color-mix(in_oklab,var(--color-white)_15%,transparent)) transition-colors flex-shrink-0", "aria-label": "Clear search", children: /* @__PURE__ */ r(
|
|
1737
|
+
!W && b && /* @__PURE__ */ r("button", { onClick: G, className: "p-1 -m-1 rounded-elm-chip text-elm-text hover:bg-(--elm-control-hover,var(--color-gray-200)) dark:hover:bg-(--elm-control-hover,color-mix(in_oklab,var(--color-white)_15%,transparent)) transition-colors flex-shrink-0", "aria-label": "Clear search", children: /* @__PURE__ */ r(At, { size: 12 }) })
|
|
1738
1738
|
]
|
|
1739
1739
|
}
|
|
1740
1740
|
),
|
|
@@ -1744,41 +1744,41 @@ function Vs({ embedded: t } = {}) {
|
|
|
1744
1744
|
/* @__PURE__ */ T(
|
|
1745
1745
|
"span",
|
|
1746
1746
|
{
|
|
1747
|
-
className:
|
|
1747
|
+
className: oe(
|
|
1748
1748
|
"flex items-center gap-0.5 flex-shrink-0 transition-all duration-110 ease-out",
|
|
1749
1749
|
Z ? "opacity-0 scale-75 pointer-events-none" : "opacity-100 scale-100"
|
|
1750
1750
|
),
|
|
1751
1751
|
children: [
|
|
1752
|
-
/* @__PURE__ */ r(
|
|
1753
|
-
/* @__PURE__ */ r(
|
|
1752
|
+
/* @__PURE__ */ r(Ee, { children: "⌘" }),
|
|
1753
|
+
/* @__PURE__ */ r(Ee, { children: "F" })
|
|
1754
1754
|
]
|
|
1755
1755
|
}
|
|
1756
1756
|
)
|
|
1757
1757
|
] }),
|
|
1758
|
-
|
|
1758
|
+
ie("search") && ge && /* @__PURE__ */ T("div", { ref: ft, "data-elm-search-toggle": "", className: m ? "relative" : void 0, children: [
|
|
1759
1759
|
/* @__PURE__ */ r(
|
|
1760
1760
|
me,
|
|
1761
1761
|
{
|
|
1762
|
-
active:
|
|
1762
|
+
active: $e,
|
|
1763
1763
|
onClick: () => he((A) => !A),
|
|
1764
1764
|
label: "Search places",
|
|
1765
1765
|
shortcut: "⌘F",
|
|
1766
|
-
children: /* @__PURE__ */ r(
|
|
1766
|
+
children: /* @__PURE__ */ r(Ye, { size: 24 })
|
|
1767
1767
|
}
|
|
1768
1768
|
),
|
|
1769
|
-
|
|
1769
|
+
$e && /* @__PURE__ */ T(
|
|
1770
1770
|
"div",
|
|
1771
1771
|
{
|
|
1772
|
-
ref:
|
|
1773
|
-
className:
|
|
1772
|
+
ref: mt,
|
|
1773
|
+
className: oe(
|
|
1774
1774
|
"absolute z-50 bg-elm-surface/97 backdrop-blur-md border border-elm-border/80 shadow-elm rounded-elm pointer-events-auto antialiased flex flex-col",
|
|
1775
1775
|
// Vertical: beside the column. Compact horizontal: under
|
|
1776
1776
|
// (or above) the bar, as wide as it, like the inline dropdown.
|
|
1777
|
-
m ?
|
|
1777
|
+
m ? Ir === "right" ? "top-0 w-80 left-full ml-2" : "top-0 w-80 right-full mr-2" : `left-0 right-0 min-w-0 ${w ? "bottom-full mb-2" : "top-full mt-2"}`
|
|
1778
1778
|
),
|
|
1779
1779
|
children: [
|
|
1780
1780
|
/* @__PURE__ */ T("div", { className: "flex items-center gap-2 px-3 py-2", children: [
|
|
1781
|
-
/* @__PURE__ */ r(
|
|
1781
|
+
/* @__PURE__ */ r(Ye, { size: 16, className: "text-elm-text-subtle flex-shrink-0" }),
|
|
1782
1782
|
/* @__PURE__ */ r(
|
|
1783
1783
|
"input",
|
|
1784
1784
|
{
|
|
@@ -1790,19 +1790,19 @@ function Vs({ embedded: t } = {}) {
|
|
|
1790
1790
|
L(!0), b.trim().length >= 2 && D(!0);
|
|
1791
1791
|
},
|
|
1792
1792
|
onBlur: () => L(!1),
|
|
1793
|
-
onKeyDown:
|
|
1793
|
+
onKeyDown: wt,
|
|
1794
1794
|
placeholder: "Search places…",
|
|
1795
1795
|
className: "bg-transparent text-sm text-elm-text-secondary placeholder-elm-text-muted outline-none w-full",
|
|
1796
1796
|
autoComplete: "off"
|
|
1797
1797
|
}
|
|
1798
1798
|
),
|
|
1799
1799
|
W && /* @__PURE__ */ r("div", { className: "w-3 h-3 border-2 border-(--elm-border-strong,var(--color-gray-300)) border-t-primary-500 rounded-full animate-spin flex-shrink-0" }),
|
|
1800
|
-
!W && b && /* @__PURE__ */ r("button", { onClick: G, className: "p-1 -m-1 rounded-elm-chip text-elm-text hover:bg-(--elm-control-hover,var(--color-gray-200)) dark:hover:bg-(--elm-control-hover,color-mix(in_oklab,var(--color-white)_15%,transparent)) transition-colors flex-shrink-0", "aria-label": "Clear search", children: /* @__PURE__ */ r(
|
|
1800
|
+
!W && b && /* @__PURE__ */ r("button", { onClick: G, className: "p-1 -m-1 rounded-elm-chip text-elm-text hover:bg-(--elm-control-hover,var(--color-gray-200)) dark:hover:bg-(--elm-control-hover,color-mix(in_oklab,var(--color-white)_15%,transparent)) transition-colors flex-shrink-0", "aria-label": "Clear search", children: /* @__PURE__ */ r(At, { size: 12 }) })
|
|
1801
1801
|
] }),
|
|
1802
1802
|
R && /* @__PURE__ */ r(
|
|
1803
|
-
|
|
1803
|
+
zt,
|
|
1804
1804
|
{
|
|
1805
|
-
ref:
|
|
1805
|
+
ref: xe,
|
|
1806
1806
|
results: v,
|
|
1807
1807
|
loading: W,
|
|
1808
1808
|
error: H,
|
|
@@ -1817,7 +1817,7 @@ function Vs({ embedded: t } = {}) {
|
|
|
1817
1817
|
},
|
|
1818
1818
|
activeIndex: V,
|
|
1819
1819
|
onHoverIndex: Y,
|
|
1820
|
-
onNavigate:
|
|
1820
|
+
onNavigate: kt,
|
|
1821
1821
|
className: "border-t border-elm-border max-h-80 overflow-y-auto"
|
|
1822
1822
|
}
|
|
1823
1823
|
)
|
|
@@ -1827,12 +1827,12 @@ function Vs({ embedded: t } = {}) {
|
|
|
1827
1827
|
] })
|
|
1828
1828
|
] })
|
|
1829
1829
|
] }),
|
|
1830
|
-
!N &&
|
|
1830
|
+
!N && Mr
|
|
1831
1831
|
]
|
|
1832
1832
|
}
|
|
1833
1833
|
);
|
|
1834
1834
|
}
|
|
1835
|
-
function
|
|
1835
|
+
function Wt(t) {
|
|
1836
1836
|
const e = [], n = (s) => {
|
|
1837
1837
|
for (const o of Array.from(s.children)) {
|
|
1838
1838
|
if (getComputedStyle(o).display === "contents") {
|
|
@@ -1847,47 +1847,47 @@ function Bt(t) {
|
|
|
1847
1847
|
};
|
|
1848
1848
|
return n(t), e.length;
|
|
1849
1849
|
}
|
|
1850
|
-
function
|
|
1851
|
-
|
|
1850
|
+
function jo(t, e) {
|
|
1851
|
+
fe(() => {
|
|
1852
1852
|
const n = t.current;
|
|
1853
1853
|
if (!n) return;
|
|
1854
1854
|
const s = () => {
|
|
1855
1855
|
n.style.maxWidth = "";
|
|
1856
|
-
const
|
|
1857
|
-
if (
|
|
1858
|
-
let
|
|
1859
|
-
for (; f -
|
|
1860
|
-
const
|
|
1861
|
-
n.style.maxWidth =
|
|
1856
|
+
const l = Wt(n);
|
|
1857
|
+
if (l < 2) return;
|
|
1858
|
+
let h = 0, f = n.offsetWidth;
|
|
1859
|
+
for (; f - h > 1; ) {
|
|
1860
|
+
const g = h + f >> 1;
|
|
1861
|
+
n.style.maxWidth = g + "px", Wt(n) > l || n.scrollWidth > n.clientWidth ? h = g : f = g;
|
|
1862
1862
|
}
|
|
1863
1863
|
n.style.maxWidth = f + "px";
|
|
1864
1864
|
};
|
|
1865
1865
|
s();
|
|
1866
1866
|
const o = [];
|
|
1867
|
-
for (let
|
|
1867
|
+
for (let l = n.parentElement; l && o.length < 8 && (o.push(l), !l.hasAttribute("data-elm-theme")); l = l.parentElement)
|
|
1868
1868
|
;
|
|
1869
1869
|
const d = /* @__PURE__ */ new WeakMap(), i = () => {
|
|
1870
|
-
for (const
|
|
1870
|
+
for (const l of o) d.set(l, l.clientWidth);
|
|
1871
1871
|
};
|
|
1872
1872
|
i();
|
|
1873
|
-
const m = new ResizeObserver((
|
|
1874
|
-
|
|
1873
|
+
const m = new ResizeObserver((l) => {
|
|
1874
|
+
l.every((h) => d.get(h.target) === h.target.clientWidth) || (s(), i());
|
|
1875
1875
|
});
|
|
1876
|
-
for (const
|
|
1876
|
+
for (const l of o) m.observe(l);
|
|
1877
1877
|
return () => {
|
|
1878
1878
|
m.disconnect(), n.style.maxWidth = "";
|
|
1879
1879
|
};
|
|
1880
1880
|
}, [t, e]);
|
|
1881
1881
|
}
|
|
1882
|
-
const
|
|
1883
|
-
function
|
|
1884
|
-
const { dataStore: t } =
|
|
1882
|
+
const qo = Ut(() => import("./BooleanOperations-CUQDHcha.js"));
|
|
1883
|
+
function ei() {
|
|
1884
|
+
const { dataStore: t } = se(), e = S((k) => k.readonly), n = S((k) => k.transformActive), s = S((k) => k.setTransformActive), o = S((k) => k.editingMode), d = S((k) => k.setEditingMode), i = U((k) => k.selectedIds), m = i.length === 1 ? i[0] : null, l = S((k) => k.closeDialog), { getKey: h } = Pe(), f = le(), g = U((k) => {
|
|
1885
1885
|
if (!m) return null;
|
|
1886
1886
|
const D = k.features.find((R) => R.id === m);
|
|
1887
1887
|
return (D == null ? void 0 : D.geometry.type) ?? null;
|
|
1888
1888
|
}), u = B(null);
|
|
1889
|
-
if (
|
|
1890
|
-
const x = m !== null || i.length > 0, w =
|
|
1889
|
+
if (jo(u, `${e}|${i.length}|${g}`), e) return null;
|
|
1890
|
+
const x = m !== null || i.length > 0, w = g === "Polygon" || g === "MultiPolygon", M = g === "MultiPoint" || g === "MultiPolygon" || g === "MultiLineString" || g === "GeometryCollection", C = i.length === 1 && g === "Point", a = x && !C, p = w, c = Le(g), E = M, y = i.length >= 2, N = E || y;
|
|
1891
1891
|
function P() {
|
|
1892
1892
|
if (i.length !== 0 && t.getState().duplicateSelection())
|
|
1893
1893
|
if (i.length === 1) {
|
|
@@ -1900,7 +1900,7 @@ function Js() {
|
|
|
1900
1900
|
if (!m || !M) return;
|
|
1901
1901
|
const k = t.getState().features.find((R) => R.id === m);
|
|
1902
1902
|
if (!k) return;
|
|
1903
|
-
const D =
|
|
1903
|
+
const D = nt(k.geometry);
|
|
1904
1904
|
t.getState().breakMultiGeometry(m) && f({ type: "feature:broken", featureId: m, count: D, undo: () => t.getState().undo() });
|
|
1905
1905
|
}
|
|
1906
1906
|
function K() {
|
|
@@ -1909,53 +1909,53 @@ function Js() {
|
|
|
1909
1909
|
function b() {
|
|
1910
1910
|
if (i.length === 0) return;
|
|
1911
1911
|
const k = i.length, D = k === 1 ? t.getState().features.find((O) => O.id === i[0]) : null, R = k === 1 ? String((D == null ? void 0 : D.properties.name) || "Unnamed feature") : `${k} features`;
|
|
1912
|
-
t.getState().deleteSelection(),
|
|
1912
|
+
t.getState().deleteSelection(), l(), f(k === 1 ? { type: "feature:deleted", featureId: i[0], label: R, undo: () => t.getState().undo() } : { type: "features:deleted", count: k, undo: () => t.getState().undo() });
|
|
1913
1913
|
}
|
|
1914
1914
|
return /* @__PURE__ */ T("div", { className: "flex flex-wrap items-center justify-center gap-3 max-w-full pointer-events-none", children: [
|
|
1915
1915
|
x && /* @__PURE__ */ T("div", { ref: u, className: "flex flex-wrap items-center justify-center gap-2 max-w-full bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm rounded-elm px-2 py-2 pointer-events-auto antialiased", children: [
|
|
1916
|
-
|
|
1916
|
+
a && /* @__PURE__ */ r(
|
|
1917
1917
|
te,
|
|
1918
1918
|
{
|
|
1919
1919
|
label: "Transform",
|
|
1920
|
-
shortcut: /* @__PURE__ */ r(Q, { children:
|
|
1920
|
+
shortcut: /* @__PURE__ */ r(Q, { children: h("toggle-transform").toUpperCase() }),
|
|
1921
1921
|
shortcutId: "toggle-transform",
|
|
1922
1922
|
onClick: () => {
|
|
1923
1923
|
s(!n), !n && o !== "none" && d("none");
|
|
1924
1924
|
},
|
|
1925
1925
|
active: n,
|
|
1926
|
-
children: /* @__PURE__ */ r(
|
|
1926
|
+
children: /* @__PURE__ */ r(rr, { size: 24 })
|
|
1927
1927
|
}
|
|
1928
1928
|
),
|
|
1929
|
-
|
|
1930
|
-
p && /* @__PURE__ */ T(
|
|
1929
|
+
a && (c || N) && /* @__PURE__ */ r(Te, {}),
|
|
1930
|
+
p && /* @__PURE__ */ T(re, { children: [
|
|
1931
1931
|
/* @__PURE__ */ r(
|
|
1932
1932
|
te,
|
|
1933
1933
|
{
|
|
1934
1934
|
label: "Cut hole",
|
|
1935
|
-
shortcut: /* @__PURE__ */ r(Q, { children:
|
|
1935
|
+
shortcut: /* @__PURE__ */ r(Q, { children: h("cut-hole").toUpperCase() }),
|
|
1936
1936
|
shortcutId: "cut-hole",
|
|
1937
1937
|
onClick: () => {
|
|
1938
1938
|
d(o === "cut-hole" ? "none" : "cut-hole"), n && s(!1);
|
|
1939
1939
|
},
|
|
1940
1940
|
active: o === "cut-hole",
|
|
1941
|
-
children: /* @__PURE__ */ r(
|
|
1941
|
+
children: /* @__PURE__ */ r(nr, { size: 24 })
|
|
1942
1942
|
}
|
|
1943
1943
|
),
|
|
1944
1944
|
/* @__PURE__ */ r(
|
|
1945
1945
|
te,
|
|
1946
1946
|
{
|
|
1947
1947
|
label: "Slice shape",
|
|
1948
|
-
shortcut: /* @__PURE__ */ r(Q, { children:
|
|
1948
|
+
shortcut: /* @__PURE__ */ r(Q, { children: h("slice-shape").toUpperCase() }),
|
|
1949
1949
|
shortcutId: "slice-shape",
|
|
1950
1950
|
onClick: () => {
|
|
1951
1951
|
d(o === "slice-shape" ? "none" : "slice-shape"), n && s(!1);
|
|
1952
1952
|
},
|
|
1953
1953
|
active: o === "slice-shape",
|
|
1954
|
-
children: /* @__PURE__ */ r(
|
|
1954
|
+
children: /* @__PURE__ */ r(or, { size: 24 })
|
|
1955
1955
|
}
|
|
1956
1956
|
)
|
|
1957
1957
|
] }),
|
|
1958
|
-
|
|
1958
|
+
c && /* @__PURE__ */ T(re, { children: [
|
|
1959
1959
|
/* @__PURE__ */ r(
|
|
1960
1960
|
te,
|
|
1961
1961
|
{
|
|
@@ -1975,7 +1975,7 @@ function Js() {
|
|
|
1975
1975
|
d(o === "smooth-shape" ? "none" : "smooth-shape"), n && s(!1);
|
|
1976
1976
|
},
|
|
1977
1977
|
active: o === "smooth-shape",
|
|
1978
|
-
children: /* @__PURE__ */ r(
|
|
1978
|
+
children: /* @__PURE__ */ r(sr, { size: 24 })
|
|
1979
1979
|
}
|
|
1980
1980
|
),
|
|
1981
1981
|
/* @__PURE__ */ r(
|
|
@@ -1986,59 +1986,59 @@ function Js() {
|
|
|
1986
1986
|
d(o === "buffer-shape" ? "none" : "buffer-shape"), n && s(!1);
|
|
1987
1987
|
},
|
|
1988
1988
|
active: o === "buffer-shape",
|
|
1989
|
-
children: /* @__PURE__ */ r(
|
|
1989
|
+
children: /* @__PURE__ */ r(ir, { size: 24 })
|
|
1990
1990
|
}
|
|
1991
1991
|
)
|
|
1992
1992
|
] }),
|
|
1993
|
-
|
|
1993
|
+
c && N && /* @__PURE__ */ r(Te, {}),
|
|
1994
1994
|
E && /* @__PURE__ */ r(
|
|
1995
1995
|
te,
|
|
1996
1996
|
{
|
|
1997
1997
|
label: "Break apart",
|
|
1998
|
-
shortcut: /* @__PURE__ */ r(Q, { children:
|
|
1998
|
+
shortcut: /* @__PURE__ */ r(Q, { children: h("break-apart").toUpperCase() }),
|
|
1999
1999
|
shortcutId: "break-apart",
|
|
2000
2000
|
onClick: z,
|
|
2001
|
-
children: /* @__PURE__ */ r(
|
|
2001
|
+
children: /* @__PURE__ */ r(ar, { size: 24 })
|
|
2002
2002
|
}
|
|
2003
2003
|
),
|
|
2004
|
-
|
|
2005
|
-
(
|
|
2004
|
+
y && /* @__PURE__ */ r(te, { label: "Merge", onClick: K, children: /* @__PURE__ */ r(lr, { size: 24 }) }),
|
|
2005
|
+
(a || c || N) && /* @__PURE__ */ r(Te, {}),
|
|
2006
2006
|
/* @__PURE__ */ r(
|
|
2007
2007
|
te,
|
|
2008
2008
|
{
|
|
2009
2009
|
label: "Duplicate",
|
|
2010
|
-
shortcut: /* @__PURE__ */ T(
|
|
2010
|
+
shortcut: /* @__PURE__ */ T(re, { children: [
|
|
2011
2011
|
/* @__PURE__ */ r(Q, { children: "⌘" }),
|
|
2012
2012
|
/* @__PURE__ */ r(Q, { children: "D" })
|
|
2013
2013
|
] }),
|
|
2014
2014
|
shortcutId: "duplicate",
|
|
2015
2015
|
onClick: P,
|
|
2016
|
-
children: /* @__PURE__ */ r(
|
|
2016
|
+
children: /* @__PURE__ */ r(Yt, { size: 24 })
|
|
2017
2017
|
}
|
|
2018
2018
|
),
|
|
2019
2019
|
/* @__PURE__ */ r(
|
|
2020
2020
|
te,
|
|
2021
2021
|
{
|
|
2022
2022
|
label: "Delete",
|
|
2023
|
-
shortcut: /* @__PURE__ */ r(Q, { children:
|
|
2023
|
+
shortcut: /* @__PURE__ */ r(Q, { children: Xt("delete-selected") }),
|
|
2024
2024
|
shortcutId: "delete-selected",
|
|
2025
2025
|
onClick: b,
|
|
2026
|
-
children: /* @__PURE__ */ r(
|
|
2026
|
+
children: /* @__PURE__ */ r(Re, { size: 24 })
|
|
2027
2027
|
}
|
|
2028
2028
|
)
|
|
2029
2029
|
] }),
|
|
2030
|
-
i.length >= 2 && /* @__PURE__ */ r(
|
|
2030
|
+
i.length >= 2 && /* @__PURE__ */ r(qt, { fallback: null, children: /* @__PURE__ */ r(qo, {}) })
|
|
2031
2031
|
] });
|
|
2032
2032
|
}
|
|
2033
|
-
const
|
|
2034
|
-
function
|
|
2033
|
+
const Ho = "calc(var(--elm-bottom-stack-offset, calc(var(--elm-table-offset, 0px) + var(--elm-bottom-toolbar-offset, 0px) + 16px)) + 58px)";
|
|
2034
|
+
function ti({ mapContainer: t, count: e, onSimplify: n, onDelete: s }) {
|
|
2035
2035
|
const o = t.parentElement;
|
|
2036
|
-
return o ?
|
|
2036
|
+
return o ? ur(
|
|
2037
2037
|
/* @__PURE__ */ r(
|
|
2038
2038
|
"div",
|
|
2039
2039
|
{
|
|
2040
2040
|
className: "absolute left-0 right-0 z-[400] flex justify-center pointer-events-none",
|
|
2041
|
-
style: { bottom:
|
|
2041
|
+
style: { bottom: Ho },
|
|
2042
2042
|
onMouseDown: (d) => d.stopPropagation(),
|
|
2043
2043
|
onContextMenu: (d) => d.stopPropagation(),
|
|
2044
2044
|
children: /* @__PURE__ */ T("div", { className: "flex items-center gap-2 bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm rounded-elm px-2 py-2 pointer-events-auto antialiased", children: [
|
|
@@ -2048,64 +2048,64 @@ function Xs({ mapContainer: t, count: e, onSimplify: n, onDelete: s }) {
|
|
|
2048
2048
|
e !== 1 ? "s" : "",
|
|
2049
2049
|
" selected"
|
|
2050
2050
|
] }),
|
|
2051
|
-
/* @__PURE__ */ r(
|
|
2051
|
+
/* @__PURE__ */ r(Te, {}),
|
|
2052
2052
|
/* @__PURE__ */ T(te, { label: "Simplify selected points", onClick: n, disabled: e < 3, children: [
|
|
2053
|
-
/* @__PURE__ */ r(
|
|
2053
|
+
/* @__PURE__ */ r(Fn, { size: 24 }),
|
|
2054
2054
|
/* @__PURE__ */ r("span", { className: "px-1 font-medium", children: "Simplify" })
|
|
2055
2055
|
] }),
|
|
2056
2056
|
/* @__PURE__ */ T(te, { label: "Delete selected points", onClick: s, children: [
|
|
2057
|
-
/* @__PURE__ */ r(
|
|
2057
|
+
/* @__PURE__ */ r(Re, { size: 24 }),
|
|
2058
2058
|
/* @__PURE__ */ r("span", { className: "px-1 font-medium", children: "Delete" })
|
|
2059
2059
|
] }),
|
|
2060
|
-
/* @__PURE__ */ r(
|
|
2060
|
+
/* @__PURE__ */ r(Ee, { children: "Del" })
|
|
2061
2061
|
] })
|
|
2062
2062
|
}
|
|
2063
2063
|
),
|
|
2064
2064
|
o
|
|
2065
2065
|
) : null;
|
|
2066
2066
|
}
|
|
2067
|
-
const
|
|
2068
|
-
{ mode: "cut-hole", label: "Cut hole", icon: /* @__PURE__ */ r(
|
|
2069
|
-
{ mode: "slice-shape", label: "Slice shape", icon: /* @__PURE__ */ r(
|
|
2070
|
-
],
|
|
2071
|
-
{ mode: "simplify-shape", label: "Simplify shape", icon:
|
|
2072
|
-
{ mode: "smooth-shape", label: "Smooth shape", icon: /* @__PURE__ */ r(
|
|
2073
|
-
{ mode: "buffer-shape", label: "Buffer", icon: /* @__PURE__ */ r(
|
|
2067
|
+
const Vo = /* @__PURE__ */ r("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.2, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ r("polyline", { points: "2.5,8 5.25,3.5 8,8 10.75,12.5 13.5,8" }) }), Jo = [
|
|
2068
|
+
{ mode: "cut-hole", label: "Cut hole", icon: /* @__PURE__ */ r(nr, { size: 16 }), shortcut: "cut-hole" },
|
|
2069
|
+
{ mode: "slice-shape", label: "Slice shape", icon: /* @__PURE__ */ r(or, { size: 16 }), shortcut: "slice-shape" }
|
|
2070
|
+
], Xo = [
|
|
2071
|
+
{ mode: "simplify-shape", label: "Simplify shape", icon: Vo },
|
|
2072
|
+
{ mode: "smooth-shape", label: "Smooth shape", icon: /* @__PURE__ */ r(sr, { size: 16 }) },
|
|
2073
|
+
{ mode: "buffer-shape", label: "Buffer", icon: /* @__PURE__ */ r(ir, { size: 16 }) }
|
|
2074
2074
|
];
|
|
2075
|
-
function
|
|
2076
|
-
const { feature: o, requestPreciseCoords: d } = n, { dataStore: i } =
|
|
2075
|
+
function ri({ x: t, y: e, data: n, onClose: s }) {
|
|
2076
|
+
const { feature: o, requestPreciseCoords: d } = n, { dataStore: i } = se(), m = S((P) => P.readonly), l = S((P) => P.transformActive), h = S((P) => P.setTransformActive), f = S((P) => P.editingMode), g = S((P) => P.setEditingMode), u = S((P) => P.closeDialog), x = U((P) => P.selectedIds), w = le(), { getKey: M } = Pe();
|
|
2077
2077
|
if (m) return null;
|
|
2078
|
-
const C = o.geometry.type,
|
|
2078
|
+
const C = o.geometry.type, a = C === "Polygon" || C === "MultiPolygon", p = C === "MultiPoint" || C === "MultiPolygon" || C === "MultiLineString" || C === "GeometryCollection", c = x.length >= 2 && x.includes(o.id);
|
|
2079
2079
|
function E(P) {
|
|
2080
|
-
|
|
2080
|
+
g(f === P ? "none" : P), l && h(!1);
|
|
2081
2081
|
}
|
|
2082
|
-
function
|
|
2082
|
+
function y(P) {
|
|
2083
2083
|
return /* @__PURE__ */ r(Q, { children: M(P).toUpperCase() });
|
|
2084
2084
|
}
|
|
2085
2085
|
const N = [];
|
|
2086
2086
|
if (N.push({
|
|
2087
2087
|
label: "Transform",
|
|
2088
|
-
icon: /* @__PURE__ */ r(
|
|
2089
|
-
shortcut:
|
|
2088
|
+
icon: /* @__PURE__ */ r(rr, { size: 16 }),
|
|
2089
|
+
shortcut: y("toggle-transform"),
|
|
2090
2090
|
onClick: () => {
|
|
2091
|
-
|
|
2091
|
+
h(!l), !l && f !== "none" && g("none");
|
|
2092
2092
|
}
|
|
2093
|
-
}),
|
|
2093
|
+
}), Le(C)) {
|
|
2094
2094
|
N.push({ separator: !0 });
|
|
2095
|
-
for (const P of [...
|
|
2095
|
+
for (const P of [...a ? Jo : [], ...Xo])
|
|
2096
2096
|
N.push({
|
|
2097
2097
|
label: P.label,
|
|
2098
2098
|
icon: P.icon,
|
|
2099
|
-
shortcut: P.shortcut ?
|
|
2099
|
+
shortcut: P.shortcut ? y(P.shortcut) : void 0,
|
|
2100
2100
|
onClick: () => E(P.mode)
|
|
2101
2101
|
});
|
|
2102
2102
|
}
|
|
2103
|
-
return
|
|
2103
|
+
return a && N.push({
|
|
2104
2104
|
label: "Center point",
|
|
2105
|
-
icon: /* @__PURE__ */ r(
|
|
2105
|
+
icon: /* @__PURE__ */ r(zn, { size: 16, weight: "fill" }),
|
|
2106
2106
|
onClick: () => {
|
|
2107
2107
|
var b;
|
|
2108
|
-
const P =
|
|
2108
|
+
const P = Hn(o), z = typeof ((b = o.properties) == null ? void 0 : b.name) == "string" && o.properties.name ? o.properties.name : null, K = {
|
|
2109
2109
|
type: "Feature",
|
|
2110
2110
|
id: crypto.randomUUID(),
|
|
2111
2111
|
geometry: { type: "Point", coordinates: P.geometry.coordinates },
|
|
@@ -2114,40 +2114,40 @@ function Zs({ x: t, y: e, data: n, onClose: s }) {
|
|
|
2114
2114
|
};
|
|
2115
2115
|
i.getState().addFeature(K);
|
|
2116
2116
|
}
|
|
2117
|
-
}), (p ||
|
|
2117
|
+
}), (p || c) && (N.push({ separator: !0 }), p && N.push({
|
|
2118
2118
|
label: "Break apart",
|
|
2119
|
-
icon: /* @__PURE__ */ r(
|
|
2120
|
-
shortcut:
|
|
2119
|
+
icon: /* @__PURE__ */ r(ar, { size: 16 }),
|
|
2120
|
+
shortcut: y("break-apart"),
|
|
2121
2121
|
onClick: () => {
|
|
2122
|
-
const P =
|
|
2122
|
+
const P = nt(o.geometry);
|
|
2123
2123
|
i.getState().breakMultiGeometry(o.id) && w({ type: "feature:broken", featureId: o.id, count: P, undo: () => i.getState().undo() });
|
|
2124
2124
|
}
|
|
2125
|
-
}),
|
|
2125
|
+
}), c && N.push({
|
|
2126
2126
|
label: `Merge ${x.length} features`,
|
|
2127
|
-
icon: /* @__PURE__ */ r(
|
|
2127
|
+
icon: /* @__PURE__ */ r(lr, { size: 16 }),
|
|
2128
2128
|
onClick: () => {
|
|
2129
2129
|
const P = x.length;
|
|
2130
2130
|
i.getState().mergeFeatures(), w({ type: "success", message: `Merged ${P} features` });
|
|
2131
2131
|
}
|
|
2132
2132
|
})), d && (N.push({ separator: !0 }), N.push({
|
|
2133
2133
|
label: "Precise coordinates…",
|
|
2134
|
-
icon: /* @__PURE__ */ r(
|
|
2134
|
+
icon: /* @__PURE__ */ r(Ln, { size: 16 }),
|
|
2135
2135
|
onClick: d
|
|
2136
2136
|
})), N.push({ separator: !0 }), N.push({
|
|
2137
|
-
label:
|
|
2138
|
-
icon: /* @__PURE__ */ r(
|
|
2139
|
-
shortcut: /* @__PURE__ */ r(Q, { children:
|
|
2137
|
+
label: c ? `Delete ${x.length} features` : "Delete",
|
|
2138
|
+
icon: /* @__PURE__ */ r(Re, { size: 16 }),
|
|
2139
|
+
shortcut: /* @__PURE__ */ r(Q, { children: Xt("delete-selected") }),
|
|
2140
2140
|
onClick: () => {
|
|
2141
2141
|
var K;
|
|
2142
|
-
const P =
|
|
2142
|
+
const P = c ? x.length : 1, z = String(((K = o.properties) == null ? void 0 : K.name) || "feature");
|
|
2143
2143
|
i.getState().deleteSelection(), u(), w(P === 1 ? { type: "feature:deleted", featureId: o.id, label: z, undo: () => i.getState().undo() } : { type: "features:deleted", count: P, undo: () => i.getState().undo() });
|
|
2144
2144
|
}
|
|
2145
|
-
}), /* @__PURE__ */ r(
|
|
2145
|
+
}), /* @__PURE__ */ r(dr, { x: t, y: e, items: N, onClose: s });
|
|
2146
2146
|
}
|
|
2147
|
-
function
|
|
2148
|
-
const n = U((d) => d.undoStack.length > 0), s = U((d) => d.undo), o =
|
|
2147
|
+
function Zo({ size: t, tooltipSide: e }) {
|
|
2148
|
+
const n = U((d) => d.undoStack.length > 0), s = U((d) => d.undo), o = le();
|
|
2149
2149
|
return /* @__PURE__ */ r(
|
|
2150
|
-
|
|
2150
|
+
De,
|
|
2151
2151
|
{
|
|
2152
2152
|
label: "Undo",
|
|
2153
2153
|
shortcutId: "undo",
|
|
@@ -2161,14 +2161,14 @@ function Jo({ size: t, tooltipSide: e }) {
|
|
|
2161
2161
|
disabled: !n,
|
|
2162
2162
|
size: t,
|
|
2163
2163
|
tooltipSide: e,
|
|
2164
|
-
children: /* @__PURE__ */ r(
|
|
2164
|
+
children: /* @__PURE__ */ r($n, { size: 24 })
|
|
2165
2165
|
}
|
|
2166
2166
|
);
|
|
2167
2167
|
}
|
|
2168
|
-
function
|
|
2169
|
-
const n = U((d) => d.redoStack.length > 0), s = U((d) => d.redo), o =
|
|
2168
|
+
function Yo({ size: t, tooltipSide: e }) {
|
|
2169
|
+
const n = U((d) => d.redoStack.length > 0), s = U((d) => d.redo), o = le();
|
|
2170
2170
|
return /* @__PURE__ */ r(
|
|
2171
|
-
|
|
2171
|
+
De,
|
|
2172
2172
|
{
|
|
2173
2173
|
label: "Redo",
|
|
2174
2174
|
shortcutId: "redo",
|
|
@@ -2183,62 +2183,102 @@ function Xo({ size: t, tooltipSide: e }) {
|
|
|
2183
2183
|
disabled: !n,
|
|
2184
2184
|
size: t,
|
|
2185
2185
|
tooltipSide: e,
|
|
2186
|
-
children: /* @__PURE__ */ r(
|
|
2186
|
+
children: /* @__PURE__ */ r(Rn, { size: 24 })
|
|
2187
2187
|
}
|
|
2188
2188
|
);
|
|
2189
2189
|
}
|
|
2190
|
-
function
|
|
2190
|
+
function Qo({ direction: t = "horizontal", children: e }) {
|
|
2191
2191
|
return /* @__PURE__ */ r("div", { "data-elm-group": "", className: `flex bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm rounded-elm pointer-events-auto antialiased items-center gap-1 px-2 py-1.5 ${t === "vertical" ? "flex-col" : "flex-row"}`, children: e });
|
|
2192
2192
|
}
|
|
2193
|
-
function
|
|
2193
|
+
function ni({ direction: t = "vertical" }) {
|
|
2194
2194
|
const e = t === "vertical" ? "right" : "top";
|
|
2195
|
-
return /* @__PURE__ */ T(
|
|
2196
|
-
/* @__PURE__ */ r(
|
|
2197
|
-
/* @__PURE__ */ r(
|
|
2195
|
+
return /* @__PURE__ */ T(Qo, { direction: t, children: [
|
|
2196
|
+
/* @__PURE__ */ r(Zo, { size: "group", tooltipSide: e }),
|
|
2197
|
+
/* @__PURE__ */ r(Yo, { size: "group", tooltipSide: e })
|
|
2198
2198
|
] });
|
|
2199
2199
|
}
|
|
2200
|
-
const
|
|
2201
|
-
function
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2200
|
+
const _t = "h-8 px-3 rounded-elm-control text-sm flex items-center justify-center gap-1.5 active:scale-[0.95]", be = { before: "Undo last", key: "⌫", keyName: "Backspace" }, es = { before: "Hold", key: "Shift", keyName: "Shift", after: "for a square" }, ts = (t) => typeof t == "string" ? t : `${t.before} ${t.keyName} ${t.after ?? ""}`;
|
|
2201
|
+
function rs({ parts: t }) {
|
|
2202
|
+
return /* @__PURE__ */ r(
|
|
2203
|
+
"ul",
|
|
2204
|
+
{
|
|
2205
|
+
"data-elm-hint": !0,
|
|
2206
|
+
"aria-label": "Drawing hints",
|
|
2207
|
+
className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-1 min-w-0 px-2 m-0 list-none text-sm text-elm-text-muted",
|
|
2208
|
+
children: t.map((e) => /* @__PURE__ */ r("li", { className: "inline-flex items-center gap-1.5 whitespace-nowrap", children: typeof e == "string" ? e : /* @__PURE__ */ T(re, { children: [
|
|
2209
|
+
e.before,
|
|
2210
|
+
e.key === e.keyName ? /* @__PURE__ */ r(Ee, { children: e.key }) : /* @__PURE__ */ T(re, { children: [
|
|
2211
|
+
/* @__PURE__ */ r("span", { "aria-hidden": "true", className: "inline-flex", children: /* @__PURE__ */ r(Ee, { children: e.key }) }),
|
|
2212
|
+
/* @__PURE__ */ r("span", { className: "sr-only", children: e.keyName })
|
|
2213
|
+
] }),
|
|
2214
|
+
e.after
|
|
2215
|
+
] }) }, ts(e)))
|
|
2216
|
+
}
|
|
2217
|
+
);
|
|
2218
|
+
}
|
|
2219
|
+
function Gt() {
|
|
2220
|
+
const t = B(null);
|
|
2221
|
+
return fe(() => {
|
|
2222
|
+
const e = t.current, n = e == null ? void 0 : e.parentElement;
|
|
2223
|
+
if (!e || !n) return;
|
|
2224
|
+
const s = (i, m) => {
|
|
2225
|
+
let l = i;
|
|
2226
|
+
for (; l && getComputedStyle(l).display === "contents"; ) l = m === "first" ? l.firstElementChild : l.lastElementChild;
|
|
2227
|
+
const h = (l ?? i).getBoundingClientRect();
|
|
2228
|
+
return h.top + h.height / 2;
|
|
2229
|
+
}, o = () => {
|
|
2230
|
+
e.style.display = "";
|
|
2231
|
+
const i = e.previousElementSibling, m = e.nextElementSibling, l = s(e, "first");
|
|
2232
|
+
(!i || !m || Math.abs(s(i, "last") - l) > 4 || Math.abs(s(m, "first") - l) > 4) && (e.style.display = "none");
|
|
2233
|
+
};
|
|
2234
|
+
o();
|
|
2235
|
+
const d = new ResizeObserver(o);
|
|
2236
|
+
d.observe(n);
|
|
2237
|
+
for (const i of Array.from(n.children)) i !== e && d.observe(i);
|
|
2238
|
+
return () => d.disconnect();
|
|
2239
|
+
}), /* @__PURE__ */ r("span", { ref: t, "aria-hidden": "true", className: "flex", children: /* @__PURE__ */ r(Te, {}) });
|
|
2240
|
+
}
|
|
2241
|
+
function oi() {
|
|
2242
|
+
const { ui: t } = ce(), e = S((v) => v.editingMode), n = S((v) => v.lineInProgress), s = S((v) => v.polygonInProgress), o = S((v) => v.routeWaypoints), d = S((v) => v.routeLoading), i = S((v) => v.commitLine), m = S((v) => v.commitPolygon), l = S((v) => v.commitRoute), h = S((v) => v.commitSliceShape), f = S((v) => v.commitCutHole), g = S((v) => v.cancelDrawing), u = S((v) => v.circleCenter), x = S((v) => v.rectCorner), w = S((v) => v.freehandPoints), M = S((v) => v.freehandClosed), C = S((v) => v.setFreehandClosed), a = S((v) => v.measurePoints), p = S((v) => v.measureMode), c = S((v) => v.setMeasureMode), E = e === "draw-line" || e === "slice-shape", y = e === "draw-polygon" || e === "cut-hole", N = e === "draw-route", P = e === "draw-circle", z = e === "draw-rect", K = e === "draw-freehand", b = e === "place-point", k = e === "measure", D = e === "pick-shape";
|
|
2243
|
+
if (!(E || y || N || P || z || K || b) && !k && !D) return null;
|
|
2244
|
+
const O = n.length > 0 || s.length > 0 || !!u || !!x || o.length > 0 || w.length > 0 || a.length > 0;
|
|
2205
2245
|
function j() {
|
|
2206
2246
|
if (e === "slice-shape") {
|
|
2207
2247
|
if (n.length < 2) return;
|
|
2208
|
-
|
|
2248
|
+
h();
|
|
2209
2249
|
} else if (e === "cut-hole") {
|
|
2210
2250
|
if (s.length < 3) return;
|
|
2211
2251
|
f();
|
|
2212
2252
|
} else if (E) {
|
|
2213
2253
|
if (n.length < 2) return;
|
|
2214
2254
|
i({});
|
|
2215
|
-
} else if (
|
|
2255
|
+
} else if (y) {
|
|
2216
2256
|
if (s.length < 3) return;
|
|
2217
2257
|
m({});
|
|
2218
2258
|
} else if (N) {
|
|
2219
2259
|
if (o.length < 2) return;
|
|
2220
|
-
|
|
2260
|
+
l();
|
|
2221
2261
|
}
|
|
2222
2262
|
}
|
|
2223
|
-
const Z = E ? n.length >= 2 :
|
|
2263
|
+
const Z = E ? n.length >= 2 : y ? s.length >= 3 : N ? o.length >= 2 && !d : !1, L = b ? ["Click to place a point"] : e === "draw-line" ? n.length === 0 ? ["Click to place the first point"] : ["Click to add points", "Double-click to finish", be] : e === "draw-polygon" ? s.length === 0 ? ["Click to place the first point"] : s.length < 3 ? ["Click to continue", be] : ["Click to add points", "Double-click to close", be] : N ? o.length === 0 ? ["Click to place the first waypoint"] : ["Click to add waypoints", be] : P ? ["Click and drag to size"] : z ? ["Click and drag to size", es] : K ? ["Click and drag to draw"] : e === "slice-shape" ? n.length === 0 ? ["Draw a line across the shape to slice it"] : ["Click to add points", "Double-click to cut", be] : e === "cut-hole" ? s.length === 0 ? ["Draw a shape inside to cut a hole"] : s.length < 3 ? ["Click to continue", be] : ["Click to add points", "Double-click to cut", be] : k ? a.length === 0 ? ["Click to start measuring"] : ["Click to add points", "Double-click to finish", be] : D ? ["Click anywhere to import a shape from the map"] : null;
|
|
2224
2264
|
return /* @__PURE__ */ T("div", { className: "flex flex-wrap items-center justify-center gap-2 max-w-full bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm rounded-elm px-2 py-2 pointer-events-auto", children: [
|
|
2225
|
-
k && /* @__PURE__ */ T(
|
|
2265
|
+
k && /* @__PURE__ */ T(re, { children: [
|
|
2226
2266
|
/* @__PURE__ */ r(
|
|
2227
2267
|
te,
|
|
2228
2268
|
{
|
|
2229
2269
|
active: p === "distance",
|
|
2230
|
-
onClick: () =>
|
|
2270
|
+
onClick: () => c("distance"),
|
|
2231
2271
|
label: "Measure distance",
|
|
2232
|
-
children: /* @__PURE__ */ r(
|
|
2272
|
+
children: /* @__PURE__ */ r(Kn, { size: 24 })
|
|
2233
2273
|
}
|
|
2234
2274
|
),
|
|
2235
2275
|
/* @__PURE__ */ r(
|
|
2236
2276
|
te,
|
|
2237
2277
|
{
|
|
2238
2278
|
active: p === "area",
|
|
2239
|
-
onClick: () =>
|
|
2279
|
+
onClick: () => c("area"),
|
|
2240
2280
|
label: "Measure area",
|
|
2241
|
-
children: /* @__PURE__ */ r(
|
|
2281
|
+
children: /* @__PURE__ */ r(On, { size: 24 })
|
|
2242
2282
|
}
|
|
2243
2283
|
)
|
|
2244
2284
|
] }),
|
|
@@ -2248,21 +2288,21 @@ function Qs() {
|
|
|
2248
2288
|
active: M,
|
|
2249
2289
|
onClick: () => C(!M),
|
|
2250
2290
|
label: "Closed shape",
|
|
2251
|
-
children: /* @__PURE__ */ r(
|
|
2291
|
+
children: /* @__PURE__ */ r(Bn, { size: 24, weight: M ? "fill" : "regular" })
|
|
2252
2292
|
}
|
|
2253
2293
|
),
|
|
2254
|
-
(k || e === "draw-freehand") && /* @__PURE__ */ r(
|
|
2255
|
-
t.hints && L && /* @__PURE__ */ r(
|
|
2256
|
-
t.hints && L && /* @__PURE__ */ r(
|
|
2294
|
+
(k || e === "draw-freehand") && /* @__PURE__ */ r(Gt, {}),
|
|
2295
|
+
t.hints && L && /* @__PURE__ */ r(rs, { parts: L }),
|
|
2296
|
+
t.hints && L && /* @__PURE__ */ r(Gt, {}),
|
|
2257
2297
|
Z && /* @__PURE__ */ T(
|
|
2258
2298
|
"button",
|
|
2259
2299
|
{
|
|
2260
2300
|
type: "button",
|
|
2261
2301
|
onClick: j,
|
|
2262
|
-
className: `${
|
|
2302
|
+
className: `${_t} shadow-sm bg-primary-500 text-white hover:bg-primary-600`,
|
|
2263
2303
|
children: [
|
|
2264
2304
|
N ? "Save route" : e === "slice-shape" ? "Slice" : e === "cut-hole" ? "Cut" : "Finish",
|
|
2265
|
-
/* @__PURE__ */ r(
|
|
2305
|
+
/* @__PURE__ */ r(Me, { children: "↵" })
|
|
2266
2306
|
]
|
|
2267
2307
|
}
|
|
2268
2308
|
),
|
|
@@ -2270,24 +2310,24 @@ function Qs() {
|
|
|
2270
2310
|
"button",
|
|
2271
2311
|
{
|
|
2272
2312
|
type: "button",
|
|
2273
|
-
onClick:
|
|
2274
|
-
className: `${
|
|
2313
|
+
onClick: g,
|
|
2314
|
+
className: `${_t} text-(--elm-text-muted,var(--color-gray-600)) dark:text-(--elm-text-muted,var(--color-gray-400)) hover:bg-elm-control-hover`,
|
|
2275
2315
|
children: [
|
|
2276
2316
|
O ? "Cancel" : "Exit",
|
|
2277
|
-
/* @__PURE__ */ r(
|
|
2317
|
+
/* @__PURE__ */ r(Ee, { children: "Esc" })
|
|
2278
2318
|
]
|
|
2279
2319
|
}
|
|
2280
2320
|
)
|
|
2281
2321
|
] });
|
|
2282
2322
|
}
|
|
2283
|
-
function
|
|
2284
|
-
const { fitBounds: n } =
|
|
2323
|
+
function si({ size: t, tooltipSide: e } = {}) {
|
|
2324
|
+
const { fitBounds: n } = ze(), s = le(), o = U((m) => m.features), d = U((m) => m.selectedIds);
|
|
2285
2325
|
function i() {
|
|
2286
2326
|
if (!n) return;
|
|
2287
2327
|
let m = o;
|
|
2288
2328
|
if (d.length > 0) {
|
|
2289
|
-
const
|
|
2290
|
-
m = o.filter((
|
|
2329
|
+
const l = new Set(d);
|
|
2330
|
+
m = o.filter((h) => l.has(h.id));
|
|
2291
2331
|
}
|
|
2292
2332
|
if (m.length === 0) {
|
|
2293
2333
|
s({ type: "warning", message: "No features on the map to zoom to" });
|
|
@@ -2296,55 +2336,55 @@ function ei({ size: t, tooltipSide: e } = {}) {
|
|
|
2296
2336
|
try {
|
|
2297
2337
|
if (m.length === 1) {
|
|
2298
2338
|
const f = m[0];
|
|
2299
|
-
n(f.bbox ||
|
|
2339
|
+
n(f.bbox || st(f.geometry));
|
|
2300
2340
|
return;
|
|
2301
2341
|
}
|
|
2302
|
-
const
|
|
2303
|
-
n(
|
|
2304
|
-
} catch (
|
|
2305
|
-
s({ type: "error", code: "geometry", source: "editor", message: "Failed to calculate map bounds", cause:
|
|
2342
|
+
const l = Vn(m), h = mr(l);
|
|
2343
|
+
n(h);
|
|
2344
|
+
} catch (l) {
|
|
2345
|
+
s({ type: "error", code: "geometry", source: "editor", message: "Failed to calculate map bounds", cause: l });
|
|
2306
2346
|
}
|
|
2307
2347
|
}
|
|
2308
2348
|
return /* @__PURE__ */ r(
|
|
2309
|
-
|
|
2349
|
+
De,
|
|
2310
2350
|
{
|
|
2311
2351
|
label: "Fit map to features",
|
|
2312
2352
|
tooltipContent: d.length > 0 ? "Zoom to selection" : "Zoom to all features",
|
|
2313
2353
|
onClick: i,
|
|
2314
2354
|
size: t,
|
|
2315
2355
|
tooltipSide: e,
|
|
2316
|
-
children: /* @__PURE__ */ r(
|
|
2356
|
+
children: /* @__PURE__ */ r(Wn, { size: 24 })
|
|
2317
2357
|
}
|
|
2318
2358
|
);
|
|
2319
2359
|
}
|
|
2320
|
-
const
|
|
2321
|
-
function
|
|
2322
|
-
const d = U((E) => E.currentZoom), { flyTo: i, getCenter: m } =
|
|
2360
|
+
const ns = "flex items-center justify-center h-6 min-w-6 px-1.5 rounded-elm-control bg-transparent border border-transparent text-elm-text font-elm-mono text-xs tabular-nums select-none transition-colors focus-visible:ring-2 focus-visible:ring-elm-focus-ring", os = "flex items-center justify-center h-8 min-w-8 px-1 rounded-elm-control bg-transparent border border-transparent text-elm-text font-elm-mono text-sm tabular-nums select-none transition-colors", ss = "flex items-center justify-center w-12 h-12 bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm-control rounded-elm text-elm-text font-elm-mono text-sm select-none transition-colors";
|
|
2361
|
+
function ii({ minZoom: t = 1, maxZoom: e = 22, fractional: n = !1, size: s = "md", tooltipSide: o = "top" }) {
|
|
2362
|
+
const d = U((E) => E.currentZoom), { flyTo: i, getCenter: m } = ze(), l = le(), h = !!i && !!m, f = S((E) => E.zoomEditing), g = S((E) => E.setZoomEditing), [u, x] = q(null), w = B(null), M = B(!1), { getKey: C } = Pe(), a = s === "sm" ? ns : s === "group" ? os : ss, p = s !== "md";
|
|
2323
2363
|
$(() => {
|
|
2324
2364
|
u !== null && (n ? Math.abs(d - u) < 0.05 : Math.round(d) === Math.round(u)) && x(null);
|
|
2325
2365
|
}, [d, u, n]);
|
|
2326
|
-
function
|
|
2366
|
+
function c() {
|
|
2327
2367
|
var P;
|
|
2328
2368
|
const E = (((P = w.current) == null ? void 0 : P.value) ?? "").trim();
|
|
2329
2369
|
if (E === "") {
|
|
2330
|
-
|
|
2370
|
+
g(!1);
|
|
2331
2371
|
return;
|
|
2332
2372
|
}
|
|
2333
|
-
const
|
|
2334
|
-
if (!Number.isFinite(
|
|
2335
|
-
|
|
2373
|
+
const y = Number(E);
|
|
2374
|
+
if (!Number.isFinite(y)) {
|
|
2375
|
+
l({ type: "warning", message: `"${E}" is not a valid zoom level` });
|
|
2336
2376
|
return;
|
|
2337
2377
|
}
|
|
2338
|
-
if (
|
|
2339
|
-
|
|
2378
|
+
if (y < t || y > e) {
|
|
2379
|
+
l({ type: "warning", message: `Zoom must be between ${t} and ${e}` });
|
|
2340
2380
|
return;
|
|
2341
2381
|
}
|
|
2342
2382
|
if (!i || !m) {
|
|
2343
|
-
|
|
2383
|
+
l({ type: "warning", message: "Map is not ready yet — try again in a moment" });
|
|
2344
2384
|
return;
|
|
2345
2385
|
}
|
|
2346
2386
|
const N = m();
|
|
2347
|
-
x(
|
|
2387
|
+
x(y), i([N[1], N[0]], y), g(!1);
|
|
2348
2388
|
}
|
|
2349
2389
|
if (f) {
|
|
2350
2390
|
const E = n ? (u ?? d).toFixed(1) : String(Math.round(u ?? d));
|
|
@@ -2357,44 +2397,44 @@ function ti({ minZoom: t = 1, maxZoom: e = 22, fractional: n = !1, size: s = "md
|
|
|
2357
2397
|
pattern: n ? "[0-9.]*" : "[0-9]*",
|
|
2358
2398
|
autoFocus: !0,
|
|
2359
2399
|
defaultValue: E,
|
|
2360
|
-
onFocus: (
|
|
2361
|
-
const N =
|
|
2400
|
+
onFocus: (y) => {
|
|
2401
|
+
const N = y.currentTarget;
|
|
2362
2402
|
M.current ? N.setSelectionRange(N.value.length, N.value.length) : N.select(), M.current = !1;
|
|
2363
2403
|
},
|
|
2364
|
-
onKeyDown: (
|
|
2365
|
-
|
|
2404
|
+
onKeyDown: (y) => {
|
|
2405
|
+
y.key === "Enter" ? (y.preventDefault(), c()) : y.key === "Escape" && (y.preventDefault(), g(!1));
|
|
2366
2406
|
},
|
|
2367
|
-
onBlur: () =>
|
|
2407
|
+
onBlur: () => g(!1),
|
|
2368
2408
|
"aria-label": "Zoom level",
|
|
2369
|
-
className: `${
|
|
2409
|
+
className: `${a.replace(" select-none", "")} text-center focus:outline-none focus:border-elm-focus-ring${p ? " w-10 !bg-elm-surface" : ""}`
|
|
2370
2410
|
}
|
|
2371
2411
|
);
|
|
2372
2412
|
}
|
|
2373
2413
|
return /* @__PURE__ */ r(
|
|
2374
|
-
|
|
2414
|
+
ve,
|
|
2375
2415
|
{
|
|
2376
|
-
content:
|
|
2416
|
+
content: h ? "Set zoom level" : "Map zoom level",
|
|
2377
2417
|
side: o,
|
|
2378
|
-
shortcut:
|
|
2418
|
+
shortcut: h ? /* @__PURE__ */ r(Q, { children: C("set-zoom").toUpperCase() }) : void 0,
|
|
2379
2419
|
children: /* @__PURE__ */ r(
|
|
2380
2420
|
"button",
|
|
2381
2421
|
{
|
|
2382
2422
|
type: "button",
|
|
2383
|
-
"aria-label":
|
|
2423
|
+
"aria-label": h ? "Set map zoom level" : "Map zoom level",
|
|
2384
2424
|
"data-elm-shortcut": "set-zoom",
|
|
2385
2425
|
onClick: () => {
|
|
2386
|
-
|
|
2426
|
+
h && (M.current = !0, g(!0));
|
|
2387
2427
|
},
|
|
2388
|
-
disabled: !
|
|
2389
|
-
className: `${
|
|
2428
|
+
disabled: !h,
|
|
2429
|
+
className: `${a} ${h ? `${p ? "hover:bg-(--elm-control-hover,color-mix(in_oklab,var(--color-gray-200)_70%,transparent)) dark:hover:bg-(--elm-control-hover,var(--color-gray-800))" : "hover:bg-elm-surface-hover"} focus:outline-none focus-visible:ring-2 focus-visible:ring-elm-focus-ring cursor-pointer` : "cursor-default"}`,
|
|
2390
2430
|
children: n ? (u ?? d).toFixed(1) : Math.round(u ?? d)
|
|
2391
2431
|
}
|
|
2392
2432
|
)
|
|
2393
2433
|
}
|
|
2394
2434
|
);
|
|
2395
2435
|
}
|
|
2396
|
-
function
|
|
2397
|
-
const { flyTo: s } =
|
|
2436
|
+
function ai({ zoom: t = 15, size: e, tooltipSide: n }) {
|
|
2437
|
+
const { flyTo: s } = ze(), o = le(), [d, i] = q(!1);
|
|
2398
2438
|
function m() {
|
|
2399
2439
|
if (!navigator.geolocation) {
|
|
2400
2440
|
o({ type: "error", code: "unsupported", source: "locate", message: "Geolocation is not supported by this browser" });
|
|
@@ -2405,16 +2445,16 @@ function ri({ zoom: t = 15, size: e, tooltipSide: n }) {
|
|
|
2405
2445
|
return;
|
|
2406
2446
|
}
|
|
2407
2447
|
d || (i(!0), navigator.geolocation.getCurrentPosition(
|
|
2408
|
-
(
|
|
2409
|
-
i(!1), s([
|
|
2448
|
+
(l) => {
|
|
2449
|
+
i(!1), s([l.coords.latitude, l.coords.longitude], t);
|
|
2410
2450
|
},
|
|
2411
|
-
(
|
|
2451
|
+
(l) => {
|
|
2412
2452
|
i(!1), o({
|
|
2413
2453
|
type: "error",
|
|
2414
|
-
code:
|
|
2454
|
+
code: l.code === l.PERMISSION_DENIED ? "permission-denied" : l.code === l.TIMEOUT ? "timeout" : "unknown",
|
|
2415
2455
|
source: "locate",
|
|
2416
|
-
cause:
|
|
2417
|
-
message:
|
|
2456
|
+
cause: l,
|
|
2457
|
+
message: l.code === l.PERMISSION_DENIED ? "Location access denied" : "Could not determine your location"
|
|
2418
2458
|
});
|
|
2419
2459
|
},
|
|
2420
2460
|
{ timeout: 1e4 }
|
|
@@ -2423,56 +2463,56 @@ function ri({ zoom: t = 15, size: e, tooltipSide: n }) {
|
|
|
2423
2463
|
return (
|
|
2424
2464
|
// Not `disabled` while locating: that fades the whole button (disabled
|
|
2425
2465
|
// opacity). A repeat click is ignored in handleLocate instead.
|
|
2426
|
-
/* @__PURE__ */ r(
|
|
2466
|
+
/* @__PURE__ */ r(De, { label: d ? "Locating…" : "Show my location", onClick: m, size: e, tooltipSide: n, children: d ? /* @__PURE__ */ r("div", { className: `${e === "sm" ? "w-3.5 h-3.5" : "w-5 h-5"} border-2 border-current/25 border-t-current rounded-full animate-spin`, "aria-hidden": !0 }) : /* @__PURE__ */ r(_n, { size: 24 }) })
|
|
2427
2467
|
);
|
|
2428
2468
|
}
|
|
2429
|
-
function
|
|
2469
|
+
function li() {
|
|
2430
2470
|
return S((e) => e.readonly) ? /* @__PURE__ */ T("div", { className: "flex items-center gap-2 px-4 py-2 bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm rounded-elm text-sm text-(--elm-text-secondary,var(--color-gray-600)) dark:text-(--elm-text-secondary,var(--color-gray-300)) pointer-events-auto antialiased select-none", children: [
|
|
2431
|
-
/* @__PURE__ */ r(
|
|
2471
|
+
/* @__PURE__ */ r(it, { size: 20, weight: "duotone", className: "text-elm-text-muted" }),
|
|
2432
2472
|
/* @__PURE__ */ r("span", { children: "View-only mode" })
|
|
2433
2473
|
] }) : null;
|
|
2434
2474
|
}
|
|
2435
|
-
const
|
|
2436
|
-
let
|
|
2437
|
-
const
|
|
2438
|
-
function
|
|
2439
|
-
|
|
2440
|
-
const n = [...
|
|
2441
|
-
|
|
2475
|
+
const is = 3e4;
|
|
2476
|
+
let ae = null;
|
|
2477
|
+
const Fe = /* @__PURE__ */ new Map();
|
|
2478
|
+
function ct(t, e) {
|
|
2479
|
+
ae == null || ae.terminate(), ae = null;
|
|
2480
|
+
const n = [...Fe.values()];
|
|
2481
|
+
Fe.clear();
|
|
2442
2482
|
for (const s of n)
|
|
2443
|
-
clearTimeout(s.timer), s.reject(new
|
|
2483
|
+
clearTimeout(s.timer), s.reject(new We(e, "geometry", t));
|
|
2444
2484
|
}
|
|
2445
|
-
async function
|
|
2446
|
-
if (
|
|
2485
|
+
async function as() {
|
|
2486
|
+
if (ae) return ae;
|
|
2447
2487
|
const { default: t } = await import("./geometryWorker-DgQCFSmD.js");
|
|
2448
|
-
return
|
|
2449
|
-
const { id: n, ok: s, result: o, error: d } = e.data, i =
|
|
2488
|
+
return ae || (ae = new t(), ae.onmessage = (e) => {
|
|
2489
|
+
const { id: n, ok: s, result: o, error: d } = e.data, i = Fe.get(n);
|
|
2450
2490
|
if (i) {
|
|
2451
|
-
if (
|
|
2491
|
+
if (Fe.delete(n), clearTimeout(i.timer), s && (o != null && o.geometry)) {
|
|
2452
2492
|
i.resolve(o.geometry);
|
|
2453
2493
|
return;
|
|
2454
2494
|
}
|
|
2455
|
-
i.reject(new
|
|
2495
|
+
i.reject(new We("geometry", "geometry", (d == null ? void 0 : d.message) || "Geometry operation failed"));
|
|
2456
2496
|
}
|
|
2457
|
-
},
|
|
2497
|
+
}, ae.onerror = () => ct("Geometry worker failed", "geometry"), ae);
|
|
2458
2498
|
}
|
|
2459
|
-
function
|
|
2460
|
-
return
|
|
2499
|
+
function Er(t, { timeoutMs: e = is } = {}) {
|
|
2500
|
+
return as().then((n) => new Promise((s, o) => {
|
|
2461
2501
|
const d = crypto.randomUUID(), i = setTimeout(() => {
|
|
2462
|
-
|
|
2502
|
+
ct(`Geometry operation timed out after ${e} ms`, "timeout");
|
|
2463
2503
|
}, e);
|
|
2464
|
-
|
|
2504
|
+
Fe.set(d, { resolve: s, reject: o, timer: i });
|
|
2465
2505
|
const m = { id: d, payload: t };
|
|
2466
2506
|
n.postMessage(m);
|
|
2467
2507
|
}));
|
|
2468
2508
|
}
|
|
2469
|
-
typeof Worker < "u" &&
|
|
2470
|
-
function
|
|
2471
|
-
|
|
2509
|
+
typeof Worker < "u" && sn(Er);
|
|
2510
|
+
function ci() {
|
|
2511
|
+
ct("Geometry worker disposed", "unknown");
|
|
2472
2512
|
}
|
|
2473
|
-
function
|
|
2513
|
+
function dt(t, e) {
|
|
2474
2514
|
var m;
|
|
2475
|
-
const n = (m =
|
|
2515
|
+
const n = (m = rt(Gr)) == null ? void 0 : m.emit, s = B(n);
|
|
2476
2516
|
s.current = n;
|
|
2477
2517
|
const o = B({
|
|
2478
2518
|
seq: 0,
|
|
@@ -2483,21 +2523,21 @@ function ct(t, e) {
|
|
|
2483
2523
|
onSettled: null,
|
|
2484
2524
|
alive: !0
|
|
2485
2525
|
}).current, d = J(() => {
|
|
2486
|
-
const
|
|
2487
|
-
o.onSettled = null,
|
|
2488
|
-
}, [o]), i = J((
|
|
2489
|
-
const
|
|
2490
|
-
o.busy = !0,
|
|
2526
|
+
const l = o.onSettled;
|
|
2527
|
+
o.onSettled = null, l == null || l();
|
|
2528
|
+
}, [o]), i = J((l) => {
|
|
2529
|
+
const h = ++o.seq, f = o.epoch;
|
|
2530
|
+
o.busy = !0, Er(l).then((g) => g, (g) => {
|
|
2491
2531
|
var u;
|
|
2492
2532
|
return o.alive && f === o.epoch && ((u = s.current) == null || u.call(s, {
|
|
2493
2533
|
type: "error",
|
|
2494
|
-
code:
|
|
2534
|
+
code: g instanceof We ? g.code : "geometry",
|
|
2495
2535
|
source: "geometry",
|
|
2496
|
-
message: `The ${
|
|
2497
|
-
cause:
|
|
2536
|
+
message: `The ${l.type} preview failed: ${g instanceof Error ? g.message : String(g)}`,
|
|
2537
|
+
cause: g,
|
|
2498
2538
|
quiet: !0
|
|
2499
2539
|
})), null;
|
|
2500
|
-
}).then((
|
|
2540
|
+
}).then((g) => {
|
|
2501
2541
|
if (o.busy = !1, !o.alive || f !== o.epoch) {
|
|
2502
2542
|
if (o.queued) {
|
|
2503
2543
|
const w = o.queued;
|
|
@@ -2507,8 +2547,8 @@ function ct(t, e) {
|
|
|
2507
2547
|
}
|
|
2508
2548
|
const u = o.queued;
|
|
2509
2549
|
o.queued = null;
|
|
2510
|
-
const x =
|
|
2511
|
-
(x || u && u.geometry ===
|
|
2550
|
+
const x = h === o.seq;
|
|
2551
|
+
(x || u && u.geometry === l.geometry) && (o.owned = !0, e(g)), u ? i(u) : x && d();
|
|
2512
2552
|
});
|
|
2513
2553
|
}, [o, e, d]);
|
|
2514
2554
|
return $(() => {
|
|
@@ -2523,45 +2563,45 @@ function ct(t, e) {
|
|
|
2523
2563
|
i(t);
|
|
2524
2564
|
}, [t, o, i, e]), $(() => (o.alive = !0, () => {
|
|
2525
2565
|
o.alive = !1, o.queued = null, o.onSettled = null;
|
|
2526
|
-
}), [o]), J((
|
|
2527
|
-
!o.busy && !o.queued ?
|
|
2566
|
+
}), [o]), J((l) => {
|
|
2567
|
+
!o.busy && !o.queued ? l() : o.onSettled = l;
|
|
2528
2568
|
}, [o]);
|
|
2529
2569
|
}
|
|
2530
|
-
const
|
|
2531
|
-
function
|
|
2532
|
-
const n = t *
|
|
2570
|
+
const ls = 111320;
|
|
2571
|
+
function cs(t, e) {
|
|
2572
|
+
const n = t * ls;
|
|
2533
2573
|
if (n < 1)
|
|
2534
|
-
return `<1${
|
|
2535
|
-
const s =
|
|
2574
|
+
return `<1${Mt(1, e).unit}`;
|
|
2575
|
+
const s = Mt(n, e);
|
|
2536
2576
|
return `~${s.value}${s.unit}`;
|
|
2537
2577
|
}
|
|
2538
|
-
function
|
|
2539
|
-
const t = S((
|
|
2578
|
+
function di() {
|
|
2579
|
+
const t = S((y) => y.editingMode), e = S((y) => y.simplifyTolerance), n = S((y) => y.setSimplifyTolerance), s = S((y) => y.setGeometryPreview), o = S((y) => y.geometryPreview), d = S((y) => y.commitGeometryProcess), i = S((y) => y.cancelGeometryProcess), { units: m } = ce(), l = { unit: m.length, display: m.display, precision: m.precision }, { dataStore: h } = se(), f = Se(), g = U((y) => y.selectedIds[0] ?? null), u = U((y) => {
|
|
2540
2580
|
var N;
|
|
2541
|
-
return
|
|
2542
|
-
}), x = U((
|
|
2581
|
+
return g ? ((N = y.features.find((P) => P.id === g)) == null ? void 0 : N.geometry) ?? null : null;
|
|
2582
|
+
}), x = U((y) => {
|
|
2543
2583
|
var N;
|
|
2544
|
-
return
|
|
2584
|
+
return g ? ((N = y.features.find((P) => P.id === g)) == null ? void 0 : N._drawType) ?? null : null;
|
|
2545
2585
|
}), w = ue(() => {
|
|
2546
2586
|
if (!u || t !== "simplify-shape") return 0;
|
|
2547
2587
|
try {
|
|
2548
|
-
const
|
|
2588
|
+
const y = mr({ type: "Feature", geometry: u, properties: {} }), N = Math.sqrt((y[2] - y[0]) ** 2 + (y[3] - y[1]) ** 2);
|
|
2549
2589
|
return (e / 100) ** 2 * N * 0.3;
|
|
2550
2590
|
} catch {
|
|
2551
2591
|
return 0;
|
|
2552
2592
|
}
|
|
2553
|
-
}, [e, u, t]), M = t === "simplify-shape", C = ue(() => !M || !u || !
|
|
2593
|
+
}, [e, u, t]), M = t === "simplify-shape", C = ue(() => !M || !u || !Le(u.type) ? null : { type: "simplify", geometry: u, tolerance: w }, [M, u, w]), a = dt(C, s);
|
|
2554
2594
|
$(() => () => {
|
|
2555
|
-
|
|
2556
|
-
}, [s,
|
|
2557
|
-
const p = u ?
|
|
2595
|
+
h.getState(), s(null);
|
|
2596
|
+
}, [s, h]);
|
|
2597
|
+
const p = u ? Be(u) : 0, c = o ? Be(o) : p, E = p - c;
|
|
2558
2598
|
return $(() => {
|
|
2559
2599
|
if (t !== "simplify-shape") return;
|
|
2560
|
-
function
|
|
2561
|
-
f(N) && (N.key === "Enter" && o && E > 0 ? (N.preventDefault(),
|
|
2600
|
+
function y(N) {
|
|
2601
|
+
f(N) && (N.key === "Enter" && o && E > 0 ? (N.preventDefault(), a(d)) : N.key === "Escape" && (N.preventDefault(), i()));
|
|
2562
2602
|
}
|
|
2563
|
-
return window.addEventListener("keydown",
|
|
2564
|
-
}, [t, o, E, d, i,
|
|
2603
|
+
return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
|
|
2604
|
+
}, [t, o, E, d, i, a, f]), t !== "simplify-shape" ? null : /* @__PURE__ */ T("div", { className: "flex flex-wrap items-center justify-center gap-3 max-w-full bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm rounded-elm px-3 py-1.5 pointer-events-auto", children: [
|
|
2565
2605
|
/* @__PURE__ */ r("span", { className: "text-sm font-medium text-elm-text-secondary shrink-0", children: "Simplify" }),
|
|
2566
2606
|
/* @__PURE__ */ T("div", { className: "flex items-center gap-2", children: [
|
|
2567
2607
|
/* @__PURE__ */ r(
|
|
@@ -2571,16 +2611,16 @@ function si() {
|
|
|
2571
2611
|
min: 0,
|
|
2572
2612
|
max: 100,
|
|
2573
2613
|
value: e,
|
|
2574
|
-
onChange: (
|
|
2614
|
+
onChange: (y) => n(Number(y.target.value)),
|
|
2575
2615
|
className: "w-32 accent-primary-600"
|
|
2576
2616
|
}
|
|
2577
2617
|
),
|
|
2578
|
-
/* @__PURE__ */ r("span", { className: "text-sm text-elm-text-muted w-16 shrink-0", children:
|
|
2618
|
+
/* @__PURE__ */ r("span", { className: "text-sm text-elm-text-muted w-16 shrink-0", children: cs(w, l) })
|
|
2579
2619
|
] }),
|
|
2580
2620
|
/* @__PURE__ */ T("div", { className: "flex items-center gap-1 text-sm text-elm-text-muted shrink-0", children: [
|
|
2581
2621
|
/* @__PURE__ */ r("span", { className: "font-elm-mono", children: p }),
|
|
2582
2622
|
/* @__PURE__ */ r("span", { children: "→" }),
|
|
2583
|
-
/* @__PURE__ */ r("span", { className: `font-elm-mono font-medium ${E > 0 ? "text-primary-600 dark:text-primary-400" : "text-(--elm-text-secondary,var(--color-gray-600)) dark:text-(--elm-text-secondary,var(--color-gray-300))"}`, children:
|
|
2623
|
+
/* @__PURE__ */ r("span", { className: `font-elm-mono font-medium ${E > 0 ? "text-primary-600 dark:text-primary-400" : "text-(--elm-text-secondary,var(--color-gray-600)) dark:text-(--elm-text-secondary,var(--color-gray-300))"}`, children: c }),
|
|
2584
2624
|
E > 0 && /* @__PURE__ */ T("span", { className: "text-xs text-primary-500", children: [
|
|
2585
2625
|
"(−",
|
|
2586
2626
|
E,
|
|
@@ -2590,30 +2630,30 @@ function si() {
|
|
|
2590
2630
|
] }),
|
|
2591
2631
|
x && /* @__PURE__ */ r("span", { className: "text-xs text-amber-600 dark:text-amber-400 shrink-0", children: x === "route" ? "Turns this route into a plain line." : `Turns this ${x} into a plain shape.` }),
|
|
2592
2632
|
/* @__PURE__ */ T("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
2593
|
-
/* @__PURE__ */ r(
|
|
2594
|
-
/* @__PURE__ */ r(
|
|
2633
|
+
/* @__PURE__ */ r(ke, { variant: "ghost", onClick: i, className: "rounded-elm-control h-8 px-3 text-sm", children: "Cancel" }),
|
|
2634
|
+
/* @__PURE__ */ r(ke, { variant: "primary", onClick: () => a(d), disabled: !o || E === 0, className: "rounded-elm-control h-8 px-3 text-sm", children: "Apply" })
|
|
2595
2635
|
] })
|
|
2596
2636
|
] });
|
|
2597
2637
|
}
|
|
2598
|
-
function
|
|
2599
|
-
const t = S((p) => p.editingMode), e = S((p) => p.smoothIterations), n = S((p) => p.setSmoothIterations), s = S((p) => p.setGeometryPreview), o = S((p) => p.geometryPreview), d = S((p) => p.commitGeometryProcess), i = S((p) => p.cancelGeometryProcess), { dataStore: m } =
|
|
2600
|
-
var
|
|
2601
|
-
return
|
|
2602
|
-
}),
|
|
2603
|
-
var
|
|
2604
|
-
return
|
|
2605
|
-
}), u = t === "smooth-shape", x = ue(() => !u || !f || !
|
|
2638
|
+
function ui() {
|
|
2639
|
+
const t = S((p) => p.editingMode), e = S((p) => p.smoothIterations), n = S((p) => p.setSmoothIterations), s = S((p) => p.setGeometryPreview), o = S((p) => p.geometryPreview), d = S((p) => p.commitGeometryProcess), i = S((p) => p.cancelGeometryProcess), { dataStore: m } = se(), l = Se(), h = U((p) => p.selectedIds[0] ?? null), f = U((p) => {
|
|
2640
|
+
var c;
|
|
2641
|
+
return h ? ((c = p.features.find((E) => E.id === h)) == null ? void 0 : c.geometry) ?? null : null;
|
|
2642
|
+
}), g = U((p) => {
|
|
2643
|
+
var c;
|
|
2644
|
+
return h ? ((c = p.features.find((E) => E.id === h)) == null ? void 0 : c._drawType) ?? null : null;
|
|
2645
|
+
}), u = t === "smooth-shape", x = ue(() => !u || !f || !Le(f.type) ? null : { type: "smooth", geometry: f, iterations: e }, [u, f, e]), w = dt(x, s);
|
|
2606
2646
|
$(() => () => {
|
|
2607
2647
|
m.getState(), s(null);
|
|
2608
2648
|
}, [s, m]);
|
|
2609
|
-
const M = f ?
|
|
2649
|
+
const M = f ? Be(f) : 0, C = o ? Be(o) : M, a = C - M;
|
|
2610
2650
|
return $(() => {
|
|
2611
2651
|
if (t !== "smooth-shape") return;
|
|
2612
|
-
function p(
|
|
2613
|
-
c
|
|
2652
|
+
function p(c) {
|
|
2653
|
+
l(c) && (c.key === "Enter" && o ? (c.preventDefault(), w(d)) : c.key === "Escape" && (c.preventDefault(), i()));
|
|
2614
2654
|
}
|
|
2615
2655
|
return window.addEventListener("keydown", p), () => window.removeEventListener("keydown", p);
|
|
2616
|
-
}, [t, o, d, i, w,
|
|
2656
|
+
}, [t, o, d, i, w, l]), t !== "smooth-shape" ? null : /* @__PURE__ */ T("div", { className: "flex flex-wrap items-center justify-center gap-3 max-w-full bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm rounded-elm px-3 py-1.5 pointer-events-auto", children: [
|
|
2617
2657
|
/* @__PURE__ */ r("span", { className: "text-sm font-medium text-elm-text-secondary shrink-0", children: "Smooth" }),
|
|
2618
2658
|
/* @__PURE__ */ T("div", { className: "flex items-center gap-2", children: [
|
|
2619
2659
|
/* @__PURE__ */ r(
|
|
@@ -2638,50 +2678,50 @@ function ii() {
|
|
|
2638
2678
|
/* @__PURE__ */ r("span", { className: "font-elm-mono", children: M }),
|
|
2639
2679
|
/* @__PURE__ */ r("span", { children: "→" }),
|
|
2640
2680
|
/* @__PURE__ */ r("span", { className: "font-elm-mono font-medium text-primary-600 dark:text-primary-400", children: C }),
|
|
2641
|
-
|
|
2681
|
+
a > 0 && /* @__PURE__ */ T("span", { className: "text-xs text-primary-500", children: [
|
|
2642
2682
|
"(+",
|
|
2643
|
-
|
|
2683
|
+
a,
|
|
2644
2684
|
")"
|
|
2645
2685
|
] }),
|
|
2646
2686
|
/* @__PURE__ */ r("span", { className: "ml-0.5", children: "points" })
|
|
2647
2687
|
] }),
|
|
2648
|
-
|
|
2688
|
+
g && /* @__PURE__ */ r("span", { className: "text-xs text-amber-600 dark:text-amber-400 shrink-0", children: g === "route" ? "Turns this route into a plain line." : `Turns this ${g} into a plain shape.` }),
|
|
2649
2689
|
/* @__PURE__ */ T("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
2650
|
-
/* @__PURE__ */ r(
|
|
2651
|
-
/* @__PURE__ */ r(
|
|
2690
|
+
/* @__PURE__ */ r(ke, { variant: "ghost", onClick: i, className: "rounded-elm-control h-8 px-3 text-sm", children: "Cancel" }),
|
|
2691
|
+
/* @__PURE__ */ r(ke, { variant: "primary", onClick: () => w(d), disabled: !o, className: "rounded-elm-control h-8 px-3 text-sm", children: "Apply" })
|
|
2652
2692
|
] })
|
|
2653
2693
|
] });
|
|
2654
2694
|
}
|
|
2655
|
-
const
|
|
2656
|
-
function
|
|
2695
|
+
const ut = 0.3048, ds = 5280, Pr = ut * ds;
|
|
2696
|
+
function us(t, e) {
|
|
2657
2697
|
switch (e) {
|
|
2658
2698
|
case "m":
|
|
2659
2699
|
return t;
|
|
2660
2700
|
case "km":
|
|
2661
2701
|
return t * 1e3;
|
|
2662
2702
|
case "ft":
|
|
2663
|
-
return t *
|
|
2703
|
+
return t * ut;
|
|
2664
2704
|
case "mi":
|
|
2665
|
-
return t *
|
|
2705
|
+
return t * Pr;
|
|
2666
2706
|
}
|
|
2667
2707
|
}
|
|
2668
|
-
function
|
|
2708
|
+
function ms(t, e) {
|
|
2669
2709
|
switch (e) {
|
|
2670
2710
|
case "m":
|
|
2671
2711
|
return t;
|
|
2672
2712
|
case "km":
|
|
2673
2713
|
return t / 1e3;
|
|
2674
2714
|
case "ft":
|
|
2675
|
-
return t /
|
|
2715
|
+
return t / ut;
|
|
2676
2716
|
case "mi":
|
|
2677
|
-
return t /
|
|
2717
|
+
return t / Pr;
|
|
2678
2718
|
}
|
|
2679
2719
|
}
|
|
2680
|
-
function
|
|
2681
|
-
const { dataStore: t } =
|
|
2720
|
+
function mi() {
|
|
2721
|
+
const { dataStore: t } = se(), e = Se(), n = S((D) => D.editingMode), s = S((D) => D.bufferDistance), o = S((D) => D.setBufferDistance), d = S((D) => D.bufferCreateNew), i = S((D) => D.setBufferCreateNew), m = S((D) => D.setGeometryPreview), l = S((D) => D.geometryPreview), h = S((D) => D.commitBufferProcess), f = S((D) => D.cancelBufferProcess), { units: g } = ce(), u = an(g.length), x = ue(
|
|
2682
2722
|
() => u === "imperial" ? ["ft", "mi"] : ["m", "km"],
|
|
2683
2723
|
[u]
|
|
2684
|
-
), [w, M] = q(!1), C = w ? x[1] : x[0], [
|
|
2724
|
+
), [w, M] = q(!1), C = w ? x[1] : x[0], [a, p] = q(null);
|
|
2685
2725
|
$(() => {
|
|
2686
2726
|
var O;
|
|
2687
2727
|
if (n !== "buffer-shape") {
|
|
@@ -2691,25 +2731,25 @@ function li() {
|
|
|
2691
2731
|
const D = t.getState().selectedIds[0] ?? null;
|
|
2692
2732
|
if (!D) return;
|
|
2693
2733
|
const R = ((O = t.getState().features.find((j) => j.id === D)) == null ? void 0 : O.geometry) ?? null;
|
|
2694
|
-
R &&
|
|
2734
|
+
R && Le(R.type) && p(R);
|
|
2695
2735
|
}, [n, t]);
|
|
2696
|
-
const
|
|
2697
|
-
() =>
|
|
2698
|
-
[
|
|
2699
|
-
),
|
|
2736
|
+
const c = ln(a == null ? void 0 : a.type), E = ue(
|
|
2737
|
+
() => a && !(c && s <= 0) ? { type: "buffer", geometry: a, distance: s } : null,
|
|
2738
|
+
[a, s, c]
|
|
2739
|
+
), y = dt(E, m);
|
|
2700
2740
|
$(() => () => {
|
|
2701
2741
|
m(null);
|
|
2702
2742
|
}, [m]), $(() => {
|
|
2703
2743
|
if (n !== "buffer-shape") return;
|
|
2704
2744
|
function D(R) {
|
|
2705
|
-
e(R) && (R.key === "Enter" &&
|
|
2745
|
+
e(R) && (R.key === "Enter" && l ? (R.preventDefault(), y(h)) : R.key === "Escape" && (R.preventDefault(), f()));
|
|
2706
2746
|
}
|
|
2707
2747
|
return window.addEventListener("keydown", D), () => window.removeEventListener("keydown", D);
|
|
2708
|
-
}, [n,
|
|
2709
|
-
const N = C === "km" || C === "mi", P =
|
|
2748
|
+
}, [n, l, h, f, y, e]);
|
|
2749
|
+
const N = C === "km" || C === "mi", P = ms(s, C), z = N ? Number(P.toFixed(2)) : Math.round(P), K = N ? 0.1 : 1;
|
|
2710
2750
|
function b(D) {
|
|
2711
2751
|
const R = parseFloat(D);
|
|
2712
|
-
isNaN(R) || o(Math.round(
|
|
2752
|
+
isNaN(R) || o(Math.round(us(R, C)));
|
|
2713
2753
|
}
|
|
2714
2754
|
function k() {
|
|
2715
2755
|
M((D) => !D);
|
|
@@ -2721,7 +2761,7 @@ function li() {
|
|
|
2721
2761
|
"input",
|
|
2722
2762
|
{
|
|
2723
2763
|
type: "range",
|
|
2724
|
-
min:
|
|
2764
|
+
min: c ? 0 : -500,
|
|
2725
2765
|
max: 2e3,
|
|
2726
2766
|
step: 1,
|
|
2727
2767
|
value: s,
|
|
@@ -2769,50 +2809,50 @@ function li() {
|
|
|
2769
2809
|
)
|
|
2770
2810
|
] }),
|
|
2771
2811
|
/* @__PURE__ */ T("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
2772
|
-
/* @__PURE__ */ r(
|
|
2773
|
-
/* @__PURE__ */ r(
|
|
2812
|
+
/* @__PURE__ */ r(ke, { variant: "ghost", onClick: f, className: "rounded-elm-control h-8 px-3 text-sm", children: "Cancel" }),
|
|
2813
|
+
/* @__PURE__ */ r(ke, { variant: "primary", onClick: () => y(h), disabled: !l, className: "rounded-elm-control h-8 px-3 text-sm", children: "Apply" })
|
|
2774
2814
|
] })
|
|
2775
2815
|
] });
|
|
2776
2816
|
}
|
|
2777
|
-
const
|
|
2778
|
-
function
|
|
2779
|
-
const [i, m] = q(!1), [
|
|
2780
|
-
|
|
2817
|
+
const fs = 8, ps = { ArrowLeft: -1, ArrowRight: 1, ArrowUp: -3, ArrowDown: 3 };
|
|
2818
|
+
function fi({ options: t, value: e, onChange: n, label: s = "Basemap", size: o, tooltipSide: d }) {
|
|
2819
|
+
const [i, m] = q(!1), [l, h] = q(null), [f, g] = q(!1), u = B(null), x = B(null), w = Br(), M = Vr(), C = l !== null;
|
|
2820
|
+
fe(() => {
|
|
2781
2821
|
var K, b;
|
|
2782
|
-
const
|
|
2783
|
-
if (!i || !
|
|
2784
|
-
const { width:
|
|
2785
|
-
|
|
2822
|
+
const c = (b = (K = u.current) == null ? void 0 : K.querySelector("button")) == null ? void 0 : b.getBoundingClientRect(), E = x.current;
|
|
2823
|
+
if (!i || !c || !E) return;
|
|
2824
|
+
const { width: y, height: N } = E.getBoundingClientRect(), P = c.top + c.height / 2 > window.innerHeight / 2, z = c.left + c.width / 2 > window.innerWidth / 2;
|
|
2825
|
+
h(cn(z ? c.right : c.left, P ? c.top : c.bottom, y, N, {
|
|
2786
2826
|
x: z ? "before" : "after",
|
|
2787
2827
|
y: P ? "before" : "after",
|
|
2788
|
-
gapY:
|
|
2828
|
+
gapY: fs
|
|
2789
2829
|
}));
|
|
2790
2830
|
}, [i, t.length]), $(() => {
|
|
2791
2831
|
var E;
|
|
2792
2832
|
if (!i || !C) return;
|
|
2793
|
-
const
|
|
2794
|
-
(E = (
|
|
2833
|
+
const c = x.current;
|
|
2834
|
+
(E = (c == null ? void 0 : c.querySelector('[aria-pressed="true"]')) ?? (c == null ? void 0 : c.querySelector("button"))) == null || E.focus();
|
|
2795
2835
|
}, [i, C]), $(() => {
|
|
2796
2836
|
if (!i) return;
|
|
2797
|
-
const
|
|
2798
|
-
var
|
|
2799
|
-
E.key === "Escape" && (E.stopImmediatePropagation(), E.preventDefault(), (
|
|
2837
|
+
const c = (E) => {
|
|
2838
|
+
var y, N, P;
|
|
2839
|
+
E.key === "Escape" && (E.stopImmediatePropagation(), E.preventDefault(), (y = x.current) != null && y.contains(document.activeElement) && ((P = (N = u.current) == null ? void 0 : N.querySelector("button")) == null || P.focus()), m(!1));
|
|
2800
2840
|
};
|
|
2801
|
-
return window.addEventListener("keydown",
|
|
2841
|
+
return window.addEventListener("keydown", c, { capture: !0 }), () => window.removeEventListener("keydown", c, { capture: !0 });
|
|
2802
2842
|
}, [i]);
|
|
2803
|
-
const
|
|
2804
|
-
const E =
|
|
2843
|
+
const a = (c) => {
|
|
2844
|
+
const E = ps[c.key];
|
|
2805
2845
|
if (!E) return;
|
|
2806
|
-
const
|
|
2807
|
-
N && (
|
|
2846
|
+
const y = Array.from(c.currentTarget.querySelectorAll("button")), N = y[y.indexOf(document.activeElement) + E];
|
|
2847
|
+
N && (c.preventDefault(), N.focus());
|
|
2808
2848
|
};
|
|
2809
2849
|
return /* @__PURE__ */ T("div", { ref: u, className: "contents", children: [
|
|
2810
|
-
/* @__PURE__ */ r(
|
|
2811
|
-
var
|
|
2812
|
-
|
|
2813
|
-
}, active: i, expanded: i, controls: i ? w : void 0, size: o, tooltipSide: d, children: /* @__PURE__ */ r(
|
|
2814
|
-
i &&
|
|
2815
|
-
/* @__PURE__ */ r("div", { "data-elm-portal": !0, "data-elm-theme": f ? "dark" : "light", style: M, [
|
|
2850
|
+
/* @__PURE__ */ r(De, { label: s, onClick: () => {
|
|
2851
|
+
var c, E;
|
|
2852
|
+
h(null), g(((E = (c = u.current) == null ? void 0 : c.closest("[data-elm-theme]")) == null ? void 0 : E.getAttribute("data-elm-theme")) === "dark"), m((y) => !y);
|
|
2853
|
+
}, active: i, expanded: i, controls: i ? w : void 0, size: o, tooltipSide: d, children: /* @__PURE__ */ r(Qe, { size: 24 }) }),
|
|
2854
|
+
i && ur(
|
|
2855
|
+
/* @__PURE__ */ r("div", { "data-elm-portal": !0, "data-elm-theme": f ? "dark" : "light", style: M, [qn]: "", children: /* @__PURE__ */ r(
|
|
2816
2856
|
"div",
|
|
2817
2857
|
{
|
|
2818
2858
|
ref: x,
|
|
@@ -2820,23 +2860,23 @@ function ai({ options: t, value: e, onChange: n, label: s = "Basemap", size: o,
|
|
|
2820
2860
|
role: "group",
|
|
2821
2861
|
"aria-label": s,
|
|
2822
2862
|
className: "fixed z-[9999] w-80 max-h-[70vh] flex flex-col bg-elm-surface/95 backdrop-blur-md border border-elm-border/80 shadow-elm rounded-elm antialiased",
|
|
2823
|
-
style: { left: (
|
|
2824
|
-
children: /* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-2 p-2 overflow-y-auto", onKeyDown:
|
|
2825
|
-
const E =
|
|
2863
|
+
style: { left: (l == null ? void 0 : l.left) ?? 0, top: (l == null ? void 0 : l.top) ?? 0, visibility: l ? void 0 : "hidden" },
|
|
2864
|
+
children: /* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-2 p-2 overflow-y-auto", onKeyDown: a, children: t.map((c) => {
|
|
2865
|
+
const E = c.id === e;
|
|
2826
2866
|
return /* @__PURE__ */ T(
|
|
2827
2867
|
"button",
|
|
2828
2868
|
{
|
|
2829
2869
|
type: "button",
|
|
2830
2870
|
"aria-pressed": E,
|
|
2831
|
-
"aria-label":
|
|
2832
|
-
onClick: () => n(
|
|
2871
|
+
"aria-label": c.label,
|
|
2872
|
+
onClick: () => n(c.id),
|
|
2833
2873
|
className: `flex flex-col rounded-elm-card border transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-400/60 ${E ? "border-primary-500 ring-2 ring-primary-400/40 bg-primary-50 hover:bg-primary-100 dark:bg-primary-950/40 dark:hover:bg-primary-950/60" : "border-elm-border hover:border-(--elm-border-strong,var(--color-gray-400)) dark:hover:border-(--elm-border-strong,var(--color-gray-500)) bg-elm-surface hover:bg-elm-surface-hover"}`,
|
|
2834
2874
|
children: [
|
|
2835
|
-
Array.isArray(
|
|
2836
|
-
/* @__PURE__ */ r("div", { className: `text-[11px] leading-4 tracking-tight text-center px-0.5 py-1 truncate font-medium ${E ? "text-primary-700 dark:text-primary-300" : "text-(--elm-text-secondary,var(--color-gray-700)) dark:text-(--elm-text-secondary,var(--color-gray-200))"}`, children:
|
|
2875
|
+
Array.isArray(c.thumbnail) ? /* @__PURE__ */ r("div", { className: "w-full h-12 flex rounded-t-elm-card overflow-hidden", children: c.thumbnail.map((y) => /* @__PURE__ */ r("img", { src: y, alt: "", className: "w-1/2 h-full object-cover", loading: "lazy", draggable: !1 }, y)) }) : c.thumbnail ? /* @__PURE__ */ r("img", { src: c.thumbnail, alt: "", className: "w-full h-12 object-cover rounded-t-elm-card", loading: "lazy", draggable: !1 }) : /* @__PURE__ */ r("div", { className: "w-full h-12 rounded-t-elm-card bg-elm-surface-hover flex items-center justify-center text-elm-text-subtle", children: /* @__PURE__ */ r(Qe, { size: 20 }) }),
|
|
2876
|
+
/* @__PURE__ */ r("div", { className: `text-[11px] leading-4 tracking-tight text-center px-0.5 py-1 truncate font-medium ${E ? "text-primary-700 dark:text-primary-300" : "text-(--elm-text-secondary,var(--color-gray-700)) dark:text-(--elm-text-secondary,var(--color-gray-200))"}`, children: c.label })
|
|
2837
2877
|
]
|
|
2838
2878
|
},
|
|
2839
|
-
|
|
2879
|
+
c.id
|
|
2840
2880
|
);
|
|
2841
2881
|
}) })
|
|
2842
2882
|
}
|
|
@@ -2845,17 +2885,17 @@ function ai({ options: t, value: e, onChange: n, label: s = "Basemap", size: o,
|
|
|
2845
2885
|
)
|
|
2846
2886
|
] });
|
|
2847
2887
|
}
|
|
2848
|
-
function
|
|
2888
|
+
function pi(t, e) {
|
|
2849
2889
|
const n = B(e);
|
|
2850
|
-
n.current = e, $(() =>
|
|
2890
|
+
n.current = e, $(() => un(t, () => n.current), [t]);
|
|
2851
2891
|
}
|
|
2852
|
-
const
|
|
2853
|
-
function
|
|
2854
|
-
const [e, n] = q(() =>
|
|
2892
|
+
const hs = (t, e) => Object.keys(t).every((n) => t[n] === e[n]);
|
|
2893
|
+
function hi(t) {
|
|
2894
|
+
const [e, n] = q(() => Tt(t));
|
|
2855
2895
|
return $(() => {
|
|
2856
2896
|
const s = () => {
|
|
2857
|
-
const m =
|
|
2858
|
-
n((
|
|
2897
|
+
const m = Tt(t);
|
|
2898
|
+
n((l) => hs(l, m) ? l : m);
|
|
2859
2899
|
};
|
|
2860
2900
|
let o = 0;
|
|
2861
2901
|
const d = () => {
|
|
@@ -2864,19 +2904,19 @@ function di(t) {
|
|
|
2864
2904
|
}));
|
|
2865
2905
|
};
|
|
2866
2906
|
s();
|
|
2867
|
-
const i =
|
|
2907
|
+
const i = Jr((t == null ? void 0 : t.closest("[data-elm-theme]")) ?? null, d);
|
|
2868
2908
|
return () => {
|
|
2869
2909
|
i(), cancelAnimationFrame(o);
|
|
2870
2910
|
};
|
|
2871
2911
|
}, [t]), e;
|
|
2872
2912
|
}
|
|
2873
|
-
const
|
|
2913
|
+
const gs = [
|
|
2874
2914
|
".geojson",
|
|
2875
2915
|
".json",
|
|
2876
2916
|
"application/geo+json",
|
|
2877
2917
|
"application/json"
|
|
2878
2918
|
];
|
|
2879
|
-
function
|
|
2919
|
+
function ys(t, e) {
|
|
2880
2920
|
const n = t.name.toLowerCase();
|
|
2881
2921
|
for (const s of e) {
|
|
2882
2922
|
const o = s.toLowerCase();
|
|
@@ -2890,14 +2930,14 @@ function ms(t, e) {
|
|
|
2890
2930
|
}
|
|
2891
2931
|
return !1;
|
|
2892
2932
|
}
|
|
2893
|
-
function
|
|
2933
|
+
function gi(t) {
|
|
2894
2934
|
const {
|
|
2895
2935
|
onImport: e,
|
|
2896
2936
|
onError: n,
|
|
2897
|
-
maxBytes: s =
|
|
2898
|
-
accept: o =
|
|
2937
|
+
maxBytes: s = mn,
|
|
2938
|
+
accept: o = gs,
|
|
2899
2939
|
disabled: d = !1
|
|
2900
|
-
} = t, [i, m] = q(!1), [
|
|
2940
|
+
} = t, [i, m] = q(!1), [l, h] = q(!1), f = B(0), g = B(null), u = B(!0), x = B(e), w = B(n);
|
|
2901
2941
|
$(() => {
|
|
2902
2942
|
x.current = e;
|
|
2903
2943
|
}, [e]), $(() => {
|
|
@@ -2907,7 +2947,7 @@ function ui(t) {
|
|
|
2907
2947
|
}), []);
|
|
2908
2948
|
const M = ue(() => o.join(","), [o]), C = J(async (b) => {
|
|
2909
2949
|
var k, D, R, O;
|
|
2910
|
-
if (!
|
|
2950
|
+
if (!ys(b, o)) {
|
|
2911
2951
|
(k = w.current) == null || k.call(w, { kind: "wrong-type", file: b });
|
|
2912
2952
|
return;
|
|
2913
2953
|
}
|
|
@@ -2915,11 +2955,11 @@ function ui(t) {
|
|
|
2915
2955
|
(D = w.current) == null || D.call(w, { kind: "too-large", bytes: b.size, maxBytes: s });
|
|
2916
2956
|
return;
|
|
2917
2957
|
}
|
|
2918
|
-
|
|
2958
|
+
h(!0);
|
|
2919
2959
|
try {
|
|
2920
2960
|
const j = await b.text();
|
|
2921
2961
|
if (!u.current) return;
|
|
2922
|
-
const Z =
|
|
2962
|
+
const Z = fn(j, { maxBytes: s });
|
|
2923
2963
|
if (!u.current) return;
|
|
2924
2964
|
if (!Z.ok) {
|
|
2925
2965
|
(R = w.current) == null || R.call(w, Z.error);
|
|
@@ -2933,15 +2973,15 @@ function ui(t) {
|
|
|
2933
2973
|
cause: j instanceof Error ? j : new Error(String(j))
|
|
2934
2974
|
});
|
|
2935
2975
|
} finally {
|
|
2936
|
-
u.current &&
|
|
2976
|
+
u.current && h(!1);
|
|
2937
2977
|
}
|
|
2938
|
-
}, [o, s]),
|
|
2978
|
+
}, [o, s]), a = J((b) => {
|
|
2939
2979
|
var k, D;
|
|
2940
2980
|
d || (D = (k = b.dataTransfer) == null ? void 0 : k.types) != null && D.includes("Files") && (b.preventDefault(), b.stopPropagation(), f.current += 1, m(!0));
|
|
2941
2981
|
}, [d]), p = J((b) => {
|
|
2942
2982
|
var k, D;
|
|
2943
2983
|
d || (D = (k = b.dataTransfer) == null ? void 0 : k.types) != null && D.includes("Files") && (b.preventDefault(), b.stopPropagation(), b.dataTransfer.dropEffect = "copy");
|
|
2944
|
-
}, [d]),
|
|
2984
|
+
}, [d]), c = J((b) => {
|
|
2945
2985
|
d || (b.preventDefault(), b.stopPropagation(), f.current = Math.max(0, f.current - 1), f.current === 0 && m(!1));
|
|
2946
2986
|
}, [d]), E = J((b) => {
|
|
2947
2987
|
var D, R;
|
|
@@ -2949,37 +2989,37 @@ function ui(t) {
|
|
|
2949
2989
|
b.preventDefault(), b.stopPropagation(), f.current = 0, m(!1);
|
|
2950
2990
|
const k = (R = (D = b.dataTransfer) == null ? void 0 : D.files) == null ? void 0 : R[0];
|
|
2951
2991
|
k && C(k);
|
|
2952
|
-
}, [d, C]),
|
|
2992
|
+
}, [d, C]), y = J((b) => {
|
|
2953
2993
|
var D;
|
|
2954
2994
|
if (d) return;
|
|
2955
2995
|
const k = (D = b.target.files) == null ? void 0 : D[0];
|
|
2956
2996
|
b.target.value = "", k && C(k);
|
|
2957
2997
|
}, [d, C]), N = J((b) => {
|
|
2958
|
-
|
|
2998
|
+
g.current = b;
|
|
2959
2999
|
}, []), P = J(() => {
|
|
2960
3000
|
var b;
|
|
2961
|
-
d || (b =
|
|
3001
|
+
d || (b = g.current) == null || b.click();
|
|
2962
3002
|
}, [d]), z = J(() => ({
|
|
2963
|
-
onDragEnter:
|
|
3003
|
+
onDragEnter: a,
|
|
2964
3004
|
onDragOver: p,
|
|
2965
|
-
onDragLeave:
|
|
3005
|
+
onDragLeave: c,
|
|
2966
3006
|
onDrop: E
|
|
2967
|
-
}), [
|
|
3007
|
+
}), [a, p, c, E]), K = J(() => ({
|
|
2968
3008
|
type: "file",
|
|
2969
3009
|
accept: M,
|
|
2970
3010
|
style: { display: "none" },
|
|
2971
3011
|
ref: N,
|
|
2972
|
-
onChange:
|
|
2973
|
-
}), [M, N,
|
|
2974
|
-
return { getRootProps: z, getInputProps: K, isDragActive: i, isProcessing:
|
|
3012
|
+
onChange: y
|
|
3013
|
+
}), [M, N, y]);
|
|
3014
|
+
return { getRootProps: z, getInputProps: K, isDragActive: i, isProcessing: l, open: P };
|
|
2975
3015
|
}
|
|
2976
|
-
const
|
|
2977
|
-
function
|
|
3016
|
+
const bs = "application/geo+json";
|
|
3017
|
+
function vs(t, e) {
|
|
2978
3018
|
const n = typeof e == "function" ? e(t) : typeof e == "string" && e.length > 0 ? e : "features";
|
|
2979
3019
|
return n.toLowerCase().endsWith(".geojson") ? n : `${n}.geojson`;
|
|
2980
3020
|
}
|
|
2981
|
-
function
|
|
2982
|
-
const { getFeatureCollection: e, filename: n, indent: s = 2, disabled: o = !1 } = t, d = B(e), i = B(t.onExport), m = B(t.onError),
|
|
3021
|
+
function yi(t) {
|
|
3022
|
+
const { getFeatureCollection: e, filename: n, indent: s = 2, disabled: o = !1 } = t, d = B(e), i = B(t.onExport), m = B(t.onError), l = B(n), h = B(s), f = B(o);
|
|
2983
3023
|
$(() => {
|
|
2984
3024
|
d.current = e;
|
|
2985
3025
|
}, [e]), $(() => {
|
|
@@ -2987,57 +3027,57 @@ function mi(t) {
|
|
|
2987
3027
|
}, [t.onExport]), $(() => {
|
|
2988
3028
|
m.current = t.onError;
|
|
2989
3029
|
}, [t.onError]), $(() => {
|
|
2990
|
-
|
|
3030
|
+
l.current = n;
|
|
2991
3031
|
}, [n]), $(() => {
|
|
2992
|
-
|
|
3032
|
+
h.current = s;
|
|
2993
3033
|
}, [s]), $(() => {
|
|
2994
3034
|
f.current = o;
|
|
2995
3035
|
}, [o]);
|
|
2996
|
-
const
|
|
2997
|
-
var
|
|
3036
|
+
const g = J(() => {
|
|
3037
|
+
var a;
|
|
2998
3038
|
if (f.current) return null;
|
|
2999
3039
|
const C = d.current();
|
|
3000
|
-
return !C || !Array.isArray(C.features) || C.features.length === 0 ? ((
|
|
3040
|
+
return !C || !Array.isArray(C.features) || C.features.length === 0 ? ((a = m.current) == null || a.call(m, { kind: "empty" }), null) : C;
|
|
3001
3041
|
}, []), u = J((C) => {
|
|
3002
|
-
var
|
|
3042
|
+
var a;
|
|
3003
3043
|
try {
|
|
3004
|
-
return JSON.stringify(C, null,
|
|
3044
|
+
return JSON.stringify(C, null, h.current);
|
|
3005
3045
|
} catch (p) {
|
|
3006
|
-
return (
|
|
3046
|
+
return (a = m.current) == null || a.call(m, {
|
|
3007
3047
|
kind: "serialization-error",
|
|
3008
3048
|
cause: p instanceof Error ? p : new Error(String(p))
|
|
3009
3049
|
}), null;
|
|
3010
3050
|
}
|
|
3011
3051
|
}, []), x = J(() => {
|
|
3012
|
-
const C =
|
|
3052
|
+
const C = g();
|
|
3013
3053
|
return C ? u(C) : null;
|
|
3014
|
-
}, [
|
|
3054
|
+
}, [g, u]), w = J(() => {
|
|
3015
3055
|
const C = x();
|
|
3016
|
-
return C === null ? null : new Blob([C], { type:
|
|
3056
|
+
return C === null ? null : new Blob([C], { type: bs });
|
|
3017
3057
|
}, [x]);
|
|
3018
3058
|
return { exportToFile: J(() => {
|
|
3019
|
-
const C =
|
|
3059
|
+
const C = g();
|
|
3020
3060
|
if (!C) return null;
|
|
3021
|
-
const
|
|
3022
|
-
if (
|
|
3023
|
-
const p =
|
|
3024
|
-
return
|
|
3061
|
+
const a = u(C);
|
|
3062
|
+
if (a === null) return null;
|
|
3063
|
+
const p = vs(C, l.current);
|
|
3064
|
+
return Ht(a, p).then((c) => {
|
|
3025
3065
|
var E;
|
|
3026
|
-
|
|
3066
|
+
c && ((E = i.current) == null || E.call(i, C, c));
|
|
3027
3067
|
}), p;
|
|
3028
|
-
}, [
|
|
3068
|
+
}, [g, u]), exportToString: x, exportToBlob: w };
|
|
3029
3069
|
}
|
|
3030
|
-
class
|
|
3070
|
+
class xs extends Lr.Component {
|
|
3031
3071
|
constructor() {
|
|
3032
3072
|
super(...arguments);
|
|
3033
|
-
|
|
3073
|
+
Dt(this, "state", { hasError: !1, error: null });
|
|
3034
3074
|
}
|
|
3035
3075
|
static getDerivedStateFromError(n) {
|
|
3036
3076
|
return { hasError: !0, error: n };
|
|
3037
3077
|
}
|
|
3038
3078
|
componentDidCatch(n) {
|
|
3039
3079
|
var s, o;
|
|
3040
|
-
(o = (s = this.props).onError) == null || o.call(s, new
|
|
3080
|
+
(o = (s = this.props).onError) == null || o.call(s, new We("crash", "editor", `The editor crashed: ${(n == null ? void 0 : n.message) ?? String(n)}`, { cause: n }));
|
|
3041
3081
|
}
|
|
3042
3082
|
render() {
|
|
3043
3083
|
var n;
|
|
@@ -3080,86 +3120,86 @@ class hs extends Fr.Component {
|
|
|
3080
3120
|
) : this.props.children;
|
|
3081
3121
|
}
|
|
3082
3122
|
}
|
|
3083
|
-
function
|
|
3123
|
+
function bi({ config: t, accentColor: e, featureColor: n, onEvent: s, onError: o, toaster: d = !0, children: i }) {
|
|
3084
3124
|
const m = ue(
|
|
3085
3125
|
() => e || n ? { ...t, ...e && { accentColor: e }, ...n && { featureColor: n } } : t,
|
|
3086
3126
|
[t, e, n]
|
|
3087
3127
|
);
|
|
3088
|
-
return /* @__PURE__ */ r(
|
|
3128
|
+
return /* @__PURE__ */ r(xs, { onError: o, children: /* @__PURE__ */ r(Xr, { config: m, children: /* @__PURE__ */ r(Jn, { children: /* @__PURE__ */ r(Ur, { children: /* @__PURE__ */ r(jr, { onEvent: s, onError: o, toaster: d, children: /* @__PURE__ */ r(qr, { children: i }) }) }) }) }) });
|
|
3089
3129
|
}
|
|
3090
|
-
const
|
|
3091
|
-
() => import("./ShortcutsModal-
|
|
3130
|
+
const ws = pe(() => import("./GeoJSONModal-BhHkqLAR.js")), ks = pe(() => import("./SchemaModal-CI5i_Kxh.js")), Ss = pe(() => import("./FeatureEditModal-DvdBiMck.js")), Cs = pe(() => import("./DataTablePanel-DqS1lhWv.js")), Ns = pe(() => import("./SettingsModal-4OuBLPyW.js")), Es = pe(
|
|
3131
|
+
() => import("./ShortcutsModal-jGmjontP.js").then((t) => ({ default: t.ShortcutsModal }))
|
|
3092
3132
|
);
|
|
3093
|
-
|
|
3094
|
-
const
|
|
3095
|
-
|
|
3133
|
+
at(ws, ks, Ss, Cs, Ns, Es);
|
|
3134
|
+
const Ps = pe(() => import("./BooleanOperations-CUQDHcha.js"));
|
|
3135
|
+
at(Ps);
|
|
3096
3136
|
export {
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3137
|
+
Es as $,
|
|
3138
|
+
oi as A,
|
|
3139
|
+
fi as B,
|
|
3140
|
+
Oo as C,
|
|
3141
|
+
Zn as D,
|
|
3142
|
+
ei as E,
|
|
3143
|
+
Eo as F,
|
|
3144
|
+
Xs as G,
|
|
3145
|
+
bi as H,
|
|
3146
|
+
Ss as I,
|
|
3147
|
+
pr as J,
|
|
3148
|
+
ri as K,
|
|
3149
|
+
si as L,
|
|
3150
|
+
Qs as M,
|
|
3151
|
+
Qn as N,
|
|
3152
|
+
Ys as O,
|
|
3153
|
+
Zs as P,
|
|
3154
|
+
ws as Q,
|
|
3155
|
+
De as R,
|
|
3156
|
+
Vs as S,
|
|
3157
|
+
ai as T,
|
|
3158
|
+
li as U,
|
|
3159
|
+
Yo as V,
|
|
3160
|
+
no as W,
|
|
3161
|
+
Yn as X,
|
|
3162
|
+
ks as Y,
|
|
3163
|
+
Ns as Z,
|
|
3164
|
+
Jn as _,
|
|
3165
|
+
Ae as a,
|
|
3166
|
+
di as a0,
|
|
3167
|
+
ui as a1,
|
|
3168
|
+
Zo as a2,
|
|
3169
|
+
ni as a3,
|
|
3170
|
+
ti as a4,
|
|
3171
|
+
ii as a5,
|
|
3172
|
+
ci as a6,
|
|
3173
|
+
Gs as a7,
|
|
3174
|
+
hi as a8,
|
|
3175
|
+
pi as a9,
|
|
3176
|
+
gi as aa,
|
|
3177
|
+
yi as ab,
|
|
3178
|
+
Se as ac,
|
|
3179
|
+
qs as ad,
|
|
3180
|
+
Pe as b,
|
|
3181
|
+
Er as c,
|
|
3182
|
+
ro as d,
|
|
3183
|
+
Js as e,
|
|
3184
|
+
po as f,
|
|
3185
|
+
Us as g,
|
|
3186
|
+
fo as h,
|
|
3187
|
+
eo as i,
|
|
3188
|
+
Sr as j,
|
|
3189
|
+
$o as k,
|
|
3190
|
+
Ko as l,
|
|
3191
|
+
Bo as m,
|
|
3192
|
+
Wo as n,
|
|
3193
|
+
wr as o,
|
|
3194
|
+
go as p,
|
|
3195
|
+
Mo as q,
|
|
3196
|
+
Hs as r,
|
|
3197
|
+
Io as s,
|
|
3198
|
+
to as t,
|
|
3199
|
+
js as u,
|
|
3200
|
+
Ps as v,
|
|
3201
|
+
mi as w,
|
|
3202
|
+
Qo as x,
|
|
3203
|
+
Cs as y,
|
|
3204
|
+
xs as z
|
|
3165
3205
|
};
|