@ogc-maps/storybook-components 0.4.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/{FeatureDetailPanel-DpcaTS9I.js → FeatureDetailPanel-CkFpdEKW.js} +8 -7
  2. package/dist/{FeatureTooltip-CM0ZTudi.js → FeatureTooltip-Db1LgLQV.js} +9 -7
  3. package/dist/{LayerPanel-BHpb8dbm.js → LayerPanel-SCdJ8948.js} +21 -21
  4. package/dist/{Legend-D4cc1JzQ.js → Legend-BMrkY-rw.js} +4 -4
  5. package/dist/PropertyList-BGXHLVBM.js +33 -0
  6. package/dist/SearchPanel-DCY01Wa-.js +363 -0
  7. package/dist/components/BasemapEditor/BasemapEditor.d.ts +7 -0
  8. package/dist/components/BasemapEditor/BasemapEditor.d.ts.map +1 -0
  9. package/dist/components/BasemapEditor/BasemapList.d.ts +7 -0
  10. package/dist/components/BasemapEditor/BasemapList.d.ts.map +1 -0
  11. package/dist/components/BasemapEditor/index.d.ts +5 -0
  12. package/dist/components/BasemapEditor/index.d.ts.map +1 -0
  13. package/dist/components/CollectionBrowser/CollectionBrowser.d.ts +8 -0
  14. package/dist/components/CollectionBrowser/CollectionBrowser.d.ts.map +1 -0
  15. package/dist/components/CollectionBrowser/index.d.ts +3 -0
  16. package/dist/components/CollectionBrowser/index.d.ts.map +1 -0
  17. package/dist/components/ConfigPreview/ConfigPreview.d.ts +5 -0
  18. package/dist/components/ConfigPreview/ConfigPreview.d.ts.map +1 -0
  19. package/dist/components/ConfigPreview/index.d.ts +3 -0
  20. package/dist/components/ConfigPreview/index.d.ts.map +1 -0
  21. package/dist/components/FeatureDetailPanel/FeatureDetailPanel.d.ts +2 -1
  22. package/dist/components/FeatureDetailPanel/FeatureDetailPanel.d.ts.map +1 -1
  23. package/dist/components/FeatureDetailPanel/index.js +1 -1
  24. package/dist/components/FeatureTooltip/FeatureTooltip.d.ts +2 -1
  25. package/dist/components/FeatureTooltip/FeatureTooltip.d.ts.map +1 -1
  26. package/dist/components/FeatureTooltip/index.js +1 -1
  27. package/dist/components/LayerEditor/LayerEditor.d.ts +8 -0
  28. package/dist/components/LayerEditor/LayerEditor.d.ts.map +1 -0
  29. package/dist/components/LayerEditor/LayerList.d.ts +8 -0
  30. package/dist/components/LayerEditor/LayerList.d.ts.map +1 -0
  31. package/dist/components/LayerEditor/index.d.ts +5 -0
  32. package/dist/components/LayerEditor/index.d.ts.map +1 -0
  33. package/dist/components/LayerPanel/index.js +1 -1
  34. package/dist/components/Legend/index.js +1 -1
  35. package/dist/components/LegendEditor/LegendEditor.d.ts +7 -0
  36. package/dist/components/LegendEditor/LegendEditor.d.ts.map +1 -0
  37. package/dist/components/LegendEditor/LegendEntryEditor.d.ts +7 -0
  38. package/dist/components/LegendEditor/LegendEntryEditor.d.ts.map +1 -0
  39. package/dist/components/LegendEditor/index.d.ts +5 -0
  40. package/dist/components/LegendEditor/index.d.ts.map +1 -0
  41. package/dist/components/PropertyDisplayEditor/PropertyDisplayEditor.d.ts +15 -0
  42. package/dist/components/PropertyDisplayEditor/PropertyDisplayEditor.d.ts.map +1 -0
  43. package/dist/components/PropertyDisplayEditor/__tests__/PropertyDisplayEditor.test.d.ts +2 -0
  44. package/dist/components/PropertyDisplayEditor/__tests__/PropertyDisplayEditor.test.d.ts.map +1 -0
  45. package/dist/components/PropertyDisplayEditor/index.d.ts +3 -0
  46. package/dist/components/PropertyDisplayEditor/index.d.ts.map +1 -0
  47. package/dist/components/SearchFieldEditor/SearchFieldEditor.d.ts +8 -0
  48. package/dist/components/SearchFieldEditor/SearchFieldEditor.d.ts.map +1 -0
  49. package/dist/components/SearchFieldEditor/SearchFieldList.d.ts +8 -0
  50. package/dist/components/SearchFieldEditor/SearchFieldList.d.ts.map +1 -0
  51. package/dist/components/SearchFieldEditor/index.d.ts +5 -0
  52. package/dist/components/SearchFieldEditor/index.d.ts.map +1 -0
  53. package/dist/components/SearchPanel/AutocompleteInput.d.ts +12 -0
  54. package/dist/components/SearchPanel/AutocompleteInput.d.ts.map +1 -0
  55. package/dist/components/SearchPanel/DateRangeInput.d.ts +11 -0
  56. package/dist/components/SearchPanel/DateRangeInput.d.ts.map +1 -0
  57. package/dist/components/SearchPanel/NumberInput.d.ts +11 -0
  58. package/dist/components/SearchPanel/NumberInput.d.ts.map +1 -0
  59. package/dist/components/SearchPanel/SearchPanel.d.ts +7 -3
  60. package/dist/components/SearchPanel/SearchPanel.d.ts.map +1 -1
  61. package/dist/components/SearchPanel/index.js +1 -1
  62. package/dist/components/SourceEditor/SourceEditor.d.ts +10 -0
  63. package/dist/components/SourceEditor/SourceEditor.d.ts.map +1 -0
  64. package/dist/components/SourceEditor/SourceList.d.ts +7 -0
  65. package/dist/components/SourceEditor/SourceList.d.ts.map +1 -0
  66. package/dist/components/SourceEditor/index.d.ts +5 -0
  67. package/dist/components/SourceEditor/index.d.ts.map +1 -0
  68. package/dist/components/StyleEditor/StyleEditor.d.ts +11 -0
  69. package/dist/components/StyleEditor/StyleEditor.d.ts.map +1 -0
  70. package/dist/components/StyleEditor/index.d.ts +3 -0
  71. package/dist/components/StyleEditor/index.d.ts.map +1 -0
  72. package/dist/components/UIConfigEditor/UIConfigEditor.d.ts +7 -0
  73. package/dist/components/UIConfigEditor/UIConfigEditor.d.ts.map +1 -0
  74. package/dist/components/UIConfigEditor/index.d.ts +3 -0
  75. package/dist/components/UIConfigEditor/index.d.ts.map +1 -0
  76. package/dist/components/ViewEditor/ViewEditor.d.ts +7 -0
  77. package/dist/components/ViewEditor/ViewEditor.d.ts.map +1 -0
  78. package/dist/components/ViewEditor/index.d.ts +3 -0
  79. package/dist/components/ViewEditor/index.d.ts.map +1 -0
  80. package/dist/components/_shared/PropertyList.d.ts +2 -1
  81. package/dist/components/_shared/PropertyList.d.ts.map +1 -1
  82. package/dist/components/admin/ColorPicker.d.ts +7 -0
  83. package/dist/components/admin/ColorPicker.d.ts.map +1 -0
  84. package/dist/components/admin/ConfirmDialog.d.ts +9 -0
  85. package/dist/components/admin/ConfirmDialog.d.ts.map +1 -0
  86. package/dist/components/admin/FormField.d.ts +10 -0
  87. package/dist/components/admin/FormField.d.ts.map +1 -0
  88. package/dist/components/admin/index.d.ts +7 -0
  89. package/dist/components/admin/index.d.ts.map +1 -0
  90. package/dist/components/index.d.ts +24 -0
  91. package/dist/components/index.d.ts.map +1 -1
  92. package/dist/cql2-Dhe6Ny6v.js +352 -0
  93. package/dist/hooks/index.d.ts +6 -2
  94. package/dist/hooks/index.d.ts.map +1 -1
  95. package/dist/hooks/index.js +38 -10
  96. package/dist/hooks/useCsvExport.d.ts +2 -1
  97. package/dist/hooks/useCsvExport.d.ts.map +1 -1
  98. package/dist/hooks/useOgcCollectionDetail.d.ts +14 -0
  99. package/dist/hooks/useOgcCollectionDetail.d.ts.map +1 -0
  100. package/dist/hooks/useOgcQueryables.d.ts +14 -0
  101. package/dist/hooks/useOgcQueryables.d.ts.map +1 -0
  102. package/dist/index-Bw9lUiuL.js +2860 -0
  103. package/dist/main.js +2090 -54
  104. package/dist/schemas/config.d.ts +917 -69
  105. package/dist/schemas/config.d.ts.map +1 -1
  106. package/dist/schemas/index.js +21 -2822
  107. package/dist/style.css +1 -1
  108. package/dist/types/index.d.ts +30 -3
  109. package/dist/types/index.d.ts.map +1 -1
  110. package/dist/types/index.js +22 -16
  111. package/dist/utils/__tests__/cql2.test.d.ts +2 -0
  112. package/dist/utils/__tests__/cql2.test.d.ts.map +1 -0
  113. package/dist/utils/__tests__/propertyDisplay.test.d.ts +2 -0
  114. package/dist/utils/__tests__/propertyDisplay.test.d.ts.map +1 -0
  115. package/dist/utils/cql2.d.ts +75 -0
  116. package/dist/utils/cql2.d.ts.map +1 -0
  117. package/dist/utils/index.d.ts +3 -0
  118. package/dist/utils/index.d.ts.map +1 -1
  119. package/dist/utils/ogcApi.d.ts +61 -0
  120. package/dist/utils/ogcApi.d.ts.map +1 -1
  121. package/dist/utils/propertyDisplay.d.ts +6 -0
  122. package/dist/utils/propertyDisplay.d.ts.map +1 -0
  123. package/dist/utils/queryableHelpers.d.ts +35 -0
  124. package/dist/utils/queryableHelpers.d.ts.map +1 -0
  125. package/package.json +4 -2
  126. package/dist/PropertyList-BH_DTkcU.js +0 -32
  127. package/dist/SearchPanel-B5GPX1gF.js +0 -106
  128. package/dist/useCsvExport-C4WAm7kG.js +0 -146
package/dist/main.js CHANGED
@@ -1,55 +1,2091 @@
1
- import { B as o } from "./BasemapSwitcher-BW7lyZ2Y.js";
2
- import { C as t } from "./CollapsibleControl-VFUTWb_5.js";
3
- import { C as s, f as l, a as c } from "./CoordinateDisplay-PxPmVjpm.js";
4
- import { E as f } from "./ExportButton-CLsWoW4m.js";
5
- import { F as S } from "./FeatureDetailPanel-DpcaTS9I.js";
6
- import { F as C } from "./FeatureTooltip-CM0ZTudi.js";
7
- import { L as g } from "./LayerPanel-BHpb8dbm.js";
8
- import { L as u } from "./Legend-D4cc1JzQ.js";
9
- import { S as F } from "./SearchPanel-B5GPX1gF.js";
10
- import { i as L, j as P, f as T, a as v, b as B, g as D, c as E, d as M, u as U, e as V, h as b } from "./useCsvExport-C4WAm7kG.js";
11
- import { BasemapConfigSchema as O, CirclePaintSchema as j, CircleStyleSchema as A, FillPaintSchema as I, FillStyleSchema as J, FilterConfigSchema as Q, LayerConfigSchema as k, LegendConfigSchema as q, LegendEntrySchema as z, LinePaintSchema as G, LineStyleSchema as H, MapConfigSchema as K, OgcApiSourceSchema as N, SearchConfigSchema as R, SearchFieldSchema as W, StyleConfigSchema as X, UIConfigSchema as Y, ViewConfigSchema as Z, safeValidateMapConfig as _, validateMapConfig as $ } from "./schemas/index.js";
12
- import './style.css';export {
13
- O as BasemapConfigSchema,
14
- o as BasemapSwitcher,
15
- j as CirclePaintSchema,
16
- A as CircleStyleSchema,
17
- t as CollapsibleControl,
18
- s as CoordinateDisplay,
19
- f as ExportButton,
20
- S as FeatureDetailPanel,
21
- C as FeatureTooltip,
22
- I as FillPaintSchema,
23
- J as FillStyleSchema,
24
- Q as FilterConfigSchema,
25
- k as LayerConfigSchema,
26
- g as LayerPanel,
27
- u as Legend,
28
- q as LegendConfigSchema,
29
- z as LegendEntrySchema,
30
- G as LinePaintSchema,
31
- H as LineStyleSchema,
32
- K as MapConfigSchema,
33
- N as OgcApiSourceSchema,
34
- R as SearchConfigSchema,
35
- W as SearchFieldSchema,
36
- F as SearchPanel,
37
- X as StyleConfigSchema,
38
- Y as UIConfigSchema,
39
- Z as ViewConfigSchema,
40
- L as downloadCsv,
41
- P as featuresToCsv,
42
- T as fetchCollections,
43
- v as fetchFeatures,
44
- B as fetchQueryables,
45
- l as formatDMS,
46
- c as formatDecimal,
47
- D as getFilteredVectorTileUrl,
48
- E as getTileJsonUrl,
49
- M as getVectorTileUrl,
50
- _ as safeValidateMapConfig,
51
- U as useCsvExport,
52
- V as useOgcCollections,
53
- b as useOgcFeatures,
54
- $ as validateMapConfig
1
+ import { B as He } from "./BasemapSwitcher-BW7lyZ2Y.js";
2
+ import { C as Ze } from "./CollapsibleControl-VFUTWb_5.js";
3
+ import { C as Xe, f as ea, a as aa } from "./CoordinateDisplay-PxPmVjpm.js";
4
+ import { E as ta } from "./ExportButton-CLsWoW4m.js";
5
+ import { F as ra } from "./FeatureDetailPanel-CkFpdEKW.js";
6
+ import { F as ua } from "./FeatureTooltip-Db1LgLQV.js";
7
+ import { L as na } from "./LayerPanel-SCdJ8948.js";
8
+ import { L as sa } from "./Legend-BMrkY-rw.js";
9
+ import { S as da } from "./SearchPanel-DCY01Wa-.js";
10
+ import { jsxs as t, jsx as e, Fragment as E } from "react/jsx-runtime";
11
+ import { useState as w, useRef as X, useEffect as ee } from "react";
12
+ import { I as le, j as he, i as ue, K as be } from "./cql2-Dhe6Ny6v.js";
13
+ import { a as ba, b as ga, L as xa, e as fa, M as ya, f as Na, c as va, d as wa, g as Ca, h as ka, k as Sa, l as La, m as Fa, n as Da, o as Ea, p as Ta, q as Ma, r as Ia, s as ja, t as Aa, u as Oa, v as Pa, w as $a, x as Ba, y as qa, z as Ra, A as Ua, B as Va, C as Ga, D as _a, E as Qa, F as za, G as Wa, H as Ja, J as Ha } from "./cql2-Dhe6Ny6v.js";
14
+ import { s as ge } from "./index-Bw9lUiuL.js";
15
+ import { B as Za, C as Ya, a as Xa, D as ei, F as ai, b as ii, c as ti, L as pi, d as ri, e as li, f as ui, g as mi, M as ni, N as oi, O as si, P as ci, h as di, S as hi, i as bi, j as gi, k as xi, T as fi, U as yi, V as Ni, v as vi } from "./index-Bw9lUiuL.js";
16
+ import './style.css';function x({ label: a, error: i, required: p, htmlFor: r, children: m }) {
17
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-1", children: [
18
+ /* @__PURE__ */ t("label", { htmlFor: r, className: "mapui:text-xs mapui:font-medium mapui:text-gray-700", children: [
19
+ a,
20
+ p && /* @__PURE__ */ e("span", { className: "mapui:ml-0.5 mapui:text-red-500", "aria-hidden": "true", children: "*" })
21
+ ] }),
22
+ m,
23
+ i && /* @__PURE__ */ e("p", { className: "mapui:m-0 mapui:text-xs mapui:text-red-600", role: "alert", children: i })
24
+ ] });
25
+ }
26
+ function A({ value: a, onChange: i, label: p }) {
27
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
28
+ /* @__PURE__ */ e(
29
+ "input",
30
+ {
31
+ type: "color",
32
+ value: a,
33
+ onChange: (r) => i(r.target.value),
34
+ "aria-label": p ?? "Color",
35
+ className: "mapui:h-8 mapui:w-10 mapui:cursor-pointer mapui:rounded mapui:border mapui:border-gray-300 mapui:p-0.5"
36
+ }
37
+ ),
38
+ /* @__PURE__ */ e("span", { className: "mapui:font-mono mapui:text-xs mapui:text-gray-600", children: a })
39
+ ] });
40
+ }
41
+ function H({
42
+ open: a,
43
+ title: i,
44
+ description: p,
45
+ onConfirm: r,
46
+ onCancel: m
47
+ }) {
48
+ return a ? /* @__PURE__ */ e(
49
+ "div",
50
+ {
51
+ className: "mapui:fixed mapui:inset-0 mapui:z-50 mapui:flex mapui:items-center mapui:justify-center mapui:bg-black/50",
52
+ role: "dialog",
53
+ "aria-modal": "true",
54
+ "aria-labelledby": "confirm-dialog-title",
55
+ "aria-describedby": "confirm-dialog-description",
56
+ children: /* @__PURE__ */ t("div", { className: "mapui:w-full mapui:max-w-sm mapui:rounded-lg mapui:bg-white mapui:p-6 mapui:shadow-xl", children: [
57
+ /* @__PURE__ */ e(
58
+ "h2",
59
+ {
60
+ id: "confirm-dialog-title",
61
+ className: "mapui:m-0 mapui:mb-2 mapui:text-base mapui:font-semibold mapui:text-gray-900",
62
+ children: i
63
+ }
64
+ ),
65
+ /* @__PURE__ */ e(
66
+ "p",
67
+ {
68
+ id: "confirm-dialog-description",
69
+ className: "mapui:m-0 mapui:mb-6 mapui:text-sm mapui:text-gray-600",
70
+ children: p
71
+ }
72
+ ),
73
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:justify-end mapui:gap-2", children: [
74
+ /* @__PURE__ */ e(
75
+ "button",
76
+ {
77
+ type: "button",
78
+ onClick: m,
79
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-gray-300 mapui:bg-white mapui:px-3 mapui:py-1.5 mapui:text-sm mapui:font-medium mapui:text-gray-700 hover:mapui:bg-gray-50",
80
+ children: "Cancel"
81
+ }
82
+ ),
83
+ /* @__PURE__ */ e(
84
+ "button",
85
+ {
86
+ type: "button",
87
+ onClick: r,
88
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-transparent mapui:bg-red-600 mapui:px-3 mapui:py-1.5 mapui:text-sm mapui:font-medium mapui:text-white hover:mapui:bg-red-700",
89
+ children: "Confirm"
90
+ }
91
+ )
92
+ ] })
93
+ ] })
94
+ }
95
+ ) : null;
96
+ }
97
+ const U = "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500";
98
+ function ae({
99
+ value: a,
100
+ onChange: i,
101
+ onTestConnection: p,
102
+ testStatus: r = "idle",
103
+ testError: m
104
+ }) {
105
+ const u = (g) => i({ ...a, ...g });
106
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-3", children: [
107
+ /* @__PURE__ */ e(x, { label: "ID", required: !0, children: /* @__PURE__ */ e(
108
+ "input",
109
+ {
110
+ type: "text",
111
+ value: a.id,
112
+ onChange: (g) => u({ id: g.target.value }),
113
+ placeholder: "my-source",
114
+ className: U
115
+ }
116
+ ) }),
117
+ /* @__PURE__ */ t(x, { label: "URL", required: !0, children: [
118
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:gap-2", children: [
119
+ /* @__PURE__ */ e(
120
+ "input",
121
+ {
122
+ type: "url",
123
+ value: a.url,
124
+ onChange: (g) => u({ url: g.target.value }),
125
+ placeholder: "https://example.com/ogcapi",
126
+ className: `${U} mapui:flex-1`
127
+ }
128
+ ),
129
+ p && /* @__PURE__ */ e(
130
+ "button",
131
+ {
132
+ type: "button",
133
+ onClick: () => p(a.url),
134
+ disabled: r === "loading" || !a.url,
135
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-blue-500 mapui:bg-white mapui:px-3 mapui:py-1 mapui:text-sm mapui:text-blue-600 hover:mapui:bg-blue-50 disabled:mapui:cursor-not-allowed disabled:mapui:opacity-50",
136
+ children: r === "loading" ? "Testing…" : "Test Connection"
137
+ }
138
+ )
139
+ ] }),
140
+ r === "success" && /* @__PURE__ */ e("span", { className: "mapui:text-xs mapui:text-green-600", children: "Connection successful" }),
141
+ r === "error" && /* @__PURE__ */ e("span", { className: "mapui:text-xs mapui:text-red-600", children: m ?? "Connection failed" })
142
+ ] }),
143
+ /* @__PURE__ */ e(x, { label: "Label", children: /* @__PURE__ */ e(
144
+ "input",
145
+ {
146
+ type: "text",
147
+ value: a.label ?? "",
148
+ onChange: (g) => u({ label: g.target.value || void 0 }),
149
+ placeholder: "My OGC API Source",
150
+ className: U
151
+ }
152
+ ) }),
153
+ /* @__PURE__ */ e(x, { label: "Tile Matrix Set ID", children: /* @__PURE__ */ e(
154
+ "input",
155
+ {
156
+ type: "text",
157
+ value: a.tileMatrixSetId ?? "WebMercatorQuad",
158
+ onChange: (g) => u({ tileMatrixSetId: g.target.value || void 0 }),
159
+ placeholder: "WebMercatorQuad",
160
+ className: U
161
+ }
162
+ ) })
163
+ ] });
164
+ }
165
+ const _ = () => ({
166
+ id: "",
167
+ url: "",
168
+ label: void 0,
169
+ tileMatrixSetId: "WebMercatorQuad"
170
+ });
171
+ function Be({ sources: a, onChange: i }) {
172
+ const [p, r] = w(null), [m, u] = w(null), [g, n] = w(!1), [l, N] = w(_()), [h, c] = w({}), [C, o] = w({}), [b, y] = w(null), D = async (f, S) => {
173
+ c((L) => ({ ...L, [f]: "loading" }));
174
+ try {
175
+ const L = await fetch(`${S}/conformance`);
176
+ L.ok ? c((k) => ({ ...k, [f]: "success" })) : (c((k) => ({ ...k, [f]: "error" })), o((k) => ({ ...k, [f]: `HTTP ${L.status}` })));
177
+ } catch (L) {
178
+ c((k) => ({ ...k, [f]: "error" })), o((k) => ({ ...k, [f]: L instanceof Error ? L.message : "Network error" }));
179
+ }
180
+ }, s = () => {
181
+ m && (i(a.map((f) => f.id === p ? m : f)), r(null), u(null));
182
+ }, T = () => {
183
+ i([...a, l]), n(!1), N(_());
184
+ }, M = (f) => {
185
+ i(a.filter((S) => S.id !== f)), y(null);
186
+ };
187
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-3", children: [
188
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:justify-between", children: [
189
+ /* @__PURE__ */ e("h3", { className: "mapui:m-0 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Sources" }),
190
+ /* @__PURE__ */ e(
191
+ "button",
192
+ {
193
+ type: "button",
194
+ onClick: () => {
195
+ n(!0), N(_());
196
+ },
197
+ className: "mapui:cursor-pointer mapui:rounded mapui:bg-blue-600 mapui:px-3 mapui:py-1 mapui:text-xs mapui:font-medium mapui:text-white hover:mapui:bg-blue-700",
198
+ children: "+ Add Source"
199
+ }
200
+ )
201
+ ] }),
202
+ a.length === 0 && !g && /* @__PURE__ */ e("p", { className: "mapui:m-0 mapui:text-sm mapui:text-gray-500", children: "No sources configured." }),
203
+ /* @__PURE__ */ e("ul", { className: "mapui:m-0 mapui:list-none mapui:flex mapui:flex-col mapui:gap-2 mapui:p-0", children: a.map((f) => /* @__PURE__ */ e(
204
+ "li",
205
+ {
206
+ className: "mapui:rounded-lg mapui:border mapui:border-gray-200 mapui:bg-white mapui:p-3",
207
+ children: p === f.id ? /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-3", children: [
208
+ /* @__PURE__ */ e(
209
+ ae,
210
+ {
211
+ value: m ?? f,
212
+ onChange: u,
213
+ onTestConnection: (S) => D(`edit-${f.id}`, S),
214
+ testStatus: h[`edit-${f.id}`],
215
+ testError: C[`edit-${f.id}`]
216
+ }
217
+ ),
218
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:gap-2", children: [
219
+ /* @__PURE__ */ e(
220
+ "button",
221
+ {
222
+ type: "button",
223
+ onClick: s,
224
+ disabled: !(m != null && m.id) || !(m != null && m.url),
225
+ className: "mapui:cursor-pointer mapui:rounded mapui:bg-blue-600 mapui:px-3 mapui:py-1 mapui:text-xs mapui:font-medium mapui:text-white hover:mapui:bg-blue-700 disabled:mapui:cursor-not-allowed disabled:mapui:opacity-50",
226
+ children: "Save"
227
+ }
228
+ ),
229
+ /* @__PURE__ */ e(
230
+ "button",
231
+ {
232
+ type: "button",
233
+ onClick: () => {
234
+ r(null), u(null);
235
+ },
236
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-gray-300 mapui:bg-white mapui:px-3 mapui:py-1 mapui:text-xs mapui:text-gray-700 hover:mapui:bg-gray-50",
237
+ children: "Cancel"
238
+ }
239
+ )
240
+ ] })
241
+ ] }) : /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-start mapui:justify-between mapui:gap-2", children: [
242
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-0.5", children: [
243
+ /* @__PURE__ */ e("span", { className: "mapui:text-sm mapui:font-medium mapui:text-gray-800", children: f.label ?? f.id }),
244
+ /* @__PURE__ */ e("span", { className: "mapui:font-mono mapui:text-xs mapui:text-gray-500", children: f.url }),
245
+ f.tileMatrixSetId && /* @__PURE__ */ t("span", { className: "mapui:text-xs mapui:text-gray-400", children: [
246
+ "TMS: ",
247
+ f.tileMatrixSetId
248
+ ] })
249
+ ] }),
250
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:shrink-0 mapui:gap-1", children: [
251
+ /* @__PURE__ */ e(
252
+ "button",
253
+ {
254
+ type: "button",
255
+ onClick: () => {
256
+ r(f.id), u(f);
257
+ },
258
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-gray-200 mapui:bg-white mapui:px-2 mapui:py-1 mapui:text-xs mapui:text-gray-600 hover:mapui:bg-gray-50",
259
+ children: "Edit"
260
+ }
261
+ ),
262
+ /* @__PURE__ */ e(
263
+ "button",
264
+ {
265
+ type: "button",
266
+ onClick: () => y(f.id),
267
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-red-200 mapui:bg-white mapui:px-2 mapui:py-1 mapui:text-xs mapui:text-red-600 hover:mapui:bg-red-50",
268
+ children: "Remove"
269
+ }
270
+ )
271
+ ] })
272
+ ] })
273
+ },
274
+ f.id
275
+ )) }),
276
+ g && /* @__PURE__ */ t("div", { className: "mapui:rounded-lg mapui:border mapui:border-blue-200 mapui:bg-blue-50 mapui:p-3", children: [
277
+ /* @__PURE__ */ e("p", { className: "mapui:m-0 mapui:mb-3 mapui:text-xs mapui:font-semibold mapui:text-blue-700", children: "New Source" }),
278
+ /* @__PURE__ */ e(
279
+ ae,
280
+ {
281
+ value: l,
282
+ onChange: N,
283
+ onTestConnection: (f) => D("new", f),
284
+ testStatus: h.new,
285
+ testError: C.new
286
+ }
287
+ ),
288
+ /* @__PURE__ */ t("div", { className: "mapui:mt-3 mapui:flex mapui:gap-2", children: [
289
+ /* @__PURE__ */ e(
290
+ "button",
291
+ {
292
+ type: "button",
293
+ onClick: T,
294
+ disabled: !l.id || !l.url,
295
+ className: "mapui:cursor-pointer mapui:rounded mapui:bg-blue-600 mapui:px-3 mapui:py-1 mapui:text-xs mapui:font-medium mapui:text-white hover:mapui:bg-blue-700 disabled:mapui:cursor-not-allowed disabled:mapui:opacity-50",
296
+ children: "Save"
297
+ }
298
+ ),
299
+ /* @__PURE__ */ e(
300
+ "button",
301
+ {
302
+ type: "button",
303
+ onClick: () => n(!1),
304
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-gray-300 mapui:bg-white mapui:px-3 mapui:py-1 mapui:text-xs mapui:text-gray-700 hover:mapui:bg-gray-50",
305
+ children: "Cancel"
306
+ }
307
+ )
308
+ ] })
309
+ ] }),
310
+ /* @__PURE__ */ e(
311
+ H,
312
+ {
313
+ open: b !== null,
314
+ title: "Remove Source",
315
+ description: "Are you sure you want to remove this source? Any layers using it will be affected.",
316
+ onConfirm: () => b && M(b),
317
+ onCancel: () => y(null)
318
+ }
319
+ )
320
+ ] });
321
+ }
322
+ function qe({
323
+ sourceUrl: a,
324
+ selectedCollectionIds: i,
325
+ onSelect: p,
326
+ onDeselect: r
327
+ }) {
328
+ const { collections: m, loading: u, error: g } = le(a || null);
329
+ return u ? /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2 mapui:py-4 mapui:text-sm mapui:text-gray-500", children: [
330
+ /* @__PURE__ */ e("span", { className: "mapui:inline-block mapui:h-4 mapui:w-4 mapui:animate-spin mapui:rounded-full mapui:border-2 mapui:border-gray-300 mapui:border-t-blue-600" }),
331
+ "Loading collections…"
332
+ ] }) : g ? /* @__PURE__ */ t("div", { className: "mapui:rounded mapui:bg-red-50 mapui:p-3 mapui:text-sm mapui:text-red-700", children: [
333
+ "Failed to load collections: ",
334
+ g.message
335
+ ] }) : m.length === 0 ? /* @__PURE__ */ e("p", { className: "mapui:m-0 mapui:text-sm mapui:text-gray-500", children: "No collections found at this source." }) : /* @__PURE__ */ e("ul", { className: "mapui:m-0 mapui:list-none mapui:flex mapui:flex-col mapui:gap-1 mapui:p-0", children: m.map((n) => {
336
+ const l = i.includes(n.id);
337
+ return /* @__PURE__ */ t(
338
+ "li",
339
+ {
340
+ className: "mapui:flex mapui:items-start mapui:gap-3 mapui:rounded mapui:border mapui:border-gray-200 mapui:p-2 hover:mapui:bg-gray-50",
341
+ children: [
342
+ /* @__PURE__ */ e(
343
+ "input",
344
+ {
345
+ type: "checkbox",
346
+ id: `collection-${n.id}`,
347
+ checked: l,
348
+ onChange: () => l ? r(n.id) : p(n.id),
349
+ className: "mapui:mt-0.5 mapui:h-4 mapui:w-4 mapui:cursor-pointer mapui:accent-blue-600"
350
+ }
351
+ ),
352
+ /* @__PURE__ */ t(
353
+ "label",
354
+ {
355
+ htmlFor: `collection-${n.id}`,
356
+ className: "mapui:flex mapui:cursor-pointer mapui:flex-col mapui:gap-0.5",
357
+ children: [
358
+ /* @__PURE__ */ e("span", { className: "mapui:text-sm mapui:font-medium mapui:text-gray-800", children: n.title ?? n.id }),
359
+ /* @__PURE__ */ e("span", { className: "mapui:font-mono mapui:text-xs mapui:text-gray-500", children: n.id }),
360
+ n.description && /* @__PURE__ */ e("span", { className: "mapui:text-xs mapui:text-gray-400 mapui:line-clamp-2", children: n.description })
361
+ ]
362
+ }
363
+ )
364
+ ]
365
+ },
366
+ n.id
367
+ );
368
+ }) });
369
+ }
370
+ const J = {
371
+ type: "fill",
372
+ paint: { "fill-color": "#4a90d9", "fill-opacity": 0.6, "fill-outline-color": "transparent" }
373
+ }, me = {
374
+ type: "line",
375
+ paint: { "line-color": "#2980b9", "line-width": 2, "line-opacity": 1 }
376
+ }, ne = {
377
+ type: "circle",
378
+ paint: { "circle-color": "#e74c3c", "circle-radius": 5, "circle-opacity": 0.9 }
379
+ }, q = "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500";
380
+ function xe({ style: a }) {
381
+ return a.type === "fill" ? /* @__PURE__ */ e(
382
+ "div",
383
+ {
384
+ className: "mapui:h-8 mapui:w-full mapui:rounded mapui:border mapui:border-gray-200",
385
+ style: {
386
+ backgroundColor: a.paint["fill-color"],
387
+ opacity: a.paint["fill-opacity"],
388
+ outline: a.paint["fill-outline-color"] ? `2px solid ${a.paint["fill-outline-color"]}` : void 0
389
+ },
390
+ "aria-label": "Style preview"
391
+ }
392
+ ) : a.type === "line" ? /* @__PURE__ */ e(
393
+ "div",
394
+ {
395
+ className: "mapui:flex mapui:h-8 mapui:w-full mapui:items-center mapui:rounded mapui:border mapui:border-gray-200 mapui:px-2",
396
+ "aria-label": "Style preview",
397
+ children: /* @__PURE__ */ e(
398
+ "div",
399
+ {
400
+ style: {
401
+ width: "100%",
402
+ height: a.paint["line-width"],
403
+ backgroundColor: a.paint["line-color"],
404
+ opacity: a.paint["line-opacity"]
405
+ }
406
+ }
407
+ )
408
+ }
409
+ ) : /* @__PURE__ */ e(
410
+ "div",
411
+ {
412
+ className: "mapui:flex mapui:h-8 mapui:w-full mapui:items-center mapui:justify-center mapui:rounded mapui:border mapui:border-gray-200",
413
+ "aria-label": "Style preview",
414
+ children: /* @__PURE__ */ e(
415
+ "div",
416
+ {
417
+ style: {
418
+ width: a.paint["circle-radius"] * 2,
419
+ height: a.paint["circle-radius"] * 2,
420
+ backgroundColor: a.paint["circle-color"],
421
+ opacity: a.paint["circle-opacity"],
422
+ borderRadius: "50%",
423
+ border: a.paint["circle-stroke-color"] ? `${a.paint["circle-stroke-width"] ?? 1}px solid ${a.paint["circle-stroke-color"]}` : void 0
424
+ }
425
+ }
426
+ )
427
+ }
428
+ );
429
+ }
430
+ function fe({ value: a, onChange: i, suggestedType: p }) {
431
+ var m;
432
+ const r = (u) => {
433
+ i(u === "fill" ? J : u === "line" ? me : ne);
434
+ };
435
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-3", children: [
436
+ p && p !== a.type && /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:justify-between mapui:rounded mapui:border mapui:border-blue-200 mapui:bg-blue-50 mapui:px-3 mapui:py-2 mapui:text-sm mapui:text-blue-800", children: [
437
+ /* @__PURE__ */ t("span", { children: [
438
+ "Detected geometry suggests ",
439
+ /* @__PURE__ */ e("strong", { children: p }),
440
+ " style."
441
+ ] }),
442
+ /* @__PURE__ */ e(
443
+ "button",
444
+ {
445
+ type: "button",
446
+ onClick: () => r(p),
447
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-blue-400 mapui:bg-white mapui:px-2 mapui:py-0.5 mapui:text-xs mapui:text-blue-700 hover:mapui:bg-blue-100",
448
+ children: "Apply"
449
+ }
450
+ )
451
+ ] }),
452
+ /* @__PURE__ */ e(x, { label: "Style Type", children: /* @__PURE__ */ t(
453
+ "select",
454
+ {
455
+ value: a.type,
456
+ onChange: (u) => r(u.target.value),
457
+ className: q,
458
+ children: [
459
+ /* @__PURE__ */ e("option", { value: "fill", children: "Fill" }),
460
+ /* @__PURE__ */ e("option", { value: "line", children: "Line" }),
461
+ /* @__PURE__ */ e("option", { value: "circle", children: "Circle" })
462
+ ]
463
+ }
464
+ ) }),
465
+ /* @__PURE__ */ t("div", { className: "mapui:rounded mapui:border mapui:border-gray-100 mapui:p-2", children: [
466
+ /* @__PURE__ */ e("p", { className: "mapui:m-0 mapui:mb-1 mapui:text-xs mapui:text-gray-500", children: "Preview" }),
467
+ /* @__PURE__ */ e(xe, { style: a })
468
+ ] }),
469
+ a.type === "fill" && /* @__PURE__ */ t(E, { children: [
470
+ /* @__PURE__ */ e(x, { label: "Fill Color", children: /* @__PURE__ */ e(
471
+ A,
472
+ {
473
+ value: a.paint["fill-color"],
474
+ onChange: (u) => i({ ...a, paint: { ...a.paint, "fill-color": u } }),
475
+ label: "Fill color"
476
+ }
477
+ ) }),
478
+ /* @__PURE__ */ e(x, { label: "Fill Opacity", children: /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
479
+ /* @__PURE__ */ e(
480
+ "input",
481
+ {
482
+ type: "range",
483
+ min: 0,
484
+ max: 1,
485
+ step: 0.01,
486
+ value: a.paint["fill-opacity"],
487
+ onChange: (u) => i({
488
+ ...a,
489
+ paint: { ...a.paint, "fill-opacity": parseFloat(u.target.value) }
490
+ }),
491
+ className: "mapui:flex-1"
492
+ }
493
+ ),
494
+ /* @__PURE__ */ e("span", { className: "mapui:w-8 mapui:text-right mapui:text-xs mapui:text-gray-600", children: a.paint["fill-opacity"].toFixed(2) })
495
+ ] }) }),
496
+ /* @__PURE__ */ e(x, { label: "Fill Outline Color (optional)", children: /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
497
+ /* @__PURE__ */ e(
498
+ "input",
499
+ {
500
+ type: "checkbox",
501
+ checked: a.paint["fill-outline-color"] !== void 0,
502
+ onChange: (u) => i({
503
+ ...a,
504
+ paint: {
505
+ ...a.paint,
506
+ "fill-outline-color": u.target.checked ? "#000000" : void 0
507
+ }
508
+ }),
509
+ className: "mapui:h-4 mapui:w-4 mapui:accent-blue-600"
510
+ }
511
+ ),
512
+ a.paint["fill-outline-color"] !== void 0 && /* @__PURE__ */ e(
513
+ A,
514
+ {
515
+ value: a.paint["fill-outline-color"],
516
+ onChange: (u) => i({
517
+ ...a,
518
+ paint: { ...a.paint, "fill-outline-color": u }
519
+ }),
520
+ label: "Outline color"
521
+ }
522
+ )
523
+ ] }) })
524
+ ] }),
525
+ a.type === "line" && /* @__PURE__ */ t(E, { children: [
526
+ /* @__PURE__ */ e(x, { label: "Line Color", children: /* @__PURE__ */ e(
527
+ A,
528
+ {
529
+ value: a.paint["line-color"],
530
+ onChange: (u) => i({ ...a, paint: { ...a.paint, "line-color": u } }),
531
+ label: "Line color"
532
+ }
533
+ ) }),
534
+ /* @__PURE__ */ e(x, { label: "Line Width", children: /* @__PURE__ */ e(
535
+ "input",
536
+ {
537
+ type: "number",
538
+ min: 0,
539
+ step: 0.5,
540
+ value: a.paint["line-width"],
541
+ onChange: (u) => i({
542
+ ...a,
543
+ paint: { ...a.paint, "line-width": parseFloat(u.target.value) || 0 }
544
+ }),
545
+ className: q
546
+ }
547
+ ) }),
548
+ /* @__PURE__ */ e(x, { label: "Line Opacity", children: /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
549
+ /* @__PURE__ */ e(
550
+ "input",
551
+ {
552
+ type: "range",
553
+ min: 0,
554
+ max: 1,
555
+ step: 0.01,
556
+ value: a.paint["line-opacity"],
557
+ onChange: (u) => i({
558
+ ...a,
559
+ paint: { ...a.paint, "line-opacity": parseFloat(u.target.value) }
560
+ }),
561
+ className: "mapui:flex-1"
562
+ }
563
+ ),
564
+ /* @__PURE__ */ e("span", { className: "mapui:w-8 mapui:text-right mapui:text-xs mapui:text-gray-600", children: a.paint["line-opacity"].toFixed(2) })
565
+ ] }) }),
566
+ /* @__PURE__ */ e(x, { label: "Dash Array (optional, comma-separated)", children: /* @__PURE__ */ e(
567
+ "input",
568
+ {
569
+ type: "text",
570
+ value: ((m = a.paint["line-dasharray"]) == null ? void 0 : m.join(", ")) ?? "",
571
+ onChange: (u) => {
572
+ const g = u.target.value.trim(), n = g ? g.split(",").map((l) => parseFloat(l.trim())).filter((l) => !isNaN(l)) : void 0;
573
+ i({
574
+ ...a,
575
+ paint: { ...a.paint, "line-dasharray": n }
576
+ });
577
+ },
578
+ placeholder: "e.g. 2, 4",
579
+ className: q
580
+ }
581
+ ) })
582
+ ] }),
583
+ a.type === "circle" && /* @__PURE__ */ t(E, { children: [
584
+ /* @__PURE__ */ e(x, { label: "Circle Color", children: /* @__PURE__ */ e(
585
+ A,
586
+ {
587
+ value: a.paint["circle-color"],
588
+ onChange: (u) => i({ ...a, paint: { ...a.paint, "circle-color": u } }),
589
+ label: "Circle color"
590
+ }
591
+ ) }),
592
+ /* @__PURE__ */ e(x, { label: "Circle Radius", children: /* @__PURE__ */ e(
593
+ "input",
594
+ {
595
+ type: "number",
596
+ min: 0,
597
+ step: 1,
598
+ value: a.paint["circle-radius"],
599
+ onChange: (u) => i({
600
+ ...a,
601
+ paint: {
602
+ ...a.paint,
603
+ "circle-radius": parseFloat(u.target.value) || 0
604
+ }
605
+ }),
606
+ className: q
607
+ }
608
+ ) }),
609
+ /* @__PURE__ */ e(x, { label: "Circle Opacity", children: /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
610
+ /* @__PURE__ */ e(
611
+ "input",
612
+ {
613
+ type: "range",
614
+ min: 0,
615
+ max: 1,
616
+ step: 0.01,
617
+ value: a.paint["circle-opacity"],
618
+ onChange: (u) => i({
619
+ ...a,
620
+ paint: {
621
+ ...a.paint,
622
+ "circle-opacity": parseFloat(u.target.value)
623
+ }
624
+ }),
625
+ className: "mapui:flex-1"
626
+ }
627
+ ),
628
+ /* @__PURE__ */ e("span", { className: "mapui:w-8 mapui:text-right mapui:text-xs mapui:text-gray-600", children: a.paint["circle-opacity"].toFixed(2) })
629
+ ] }) }),
630
+ /* @__PURE__ */ e(x, { label: "Stroke Color (optional)", children: /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
631
+ /* @__PURE__ */ e(
632
+ "input",
633
+ {
634
+ type: "checkbox",
635
+ checked: a.paint["circle-stroke-color"] !== void 0,
636
+ onChange: (u) => i({
637
+ ...a,
638
+ paint: {
639
+ ...a.paint,
640
+ "circle-stroke-color": u.target.checked ? "#000000" : void 0,
641
+ "circle-stroke-width": u.target.checked ? 1 : void 0
642
+ }
643
+ }),
644
+ className: "mapui:h-4 mapui:w-4 mapui:accent-blue-600"
645
+ }
646
+ ),
647
+ a.paint["circle-stroke-color"] !== void 0 && /* @__PURE__ */ e(
648
+ A,
649
+ {
650
+ value: a.paint["circle-stroke-color"],
651
+ onChange: (u) => i({
652
+ ...a,
653
+ paint: { ...a.paint, "circle-stroke-color": u }
654
+ }),
655
+ label: "Stroke color"
656
+ }
657
+ )
658
+ ] }) }),
659
+ a.paint["circle-stroke-color"] !== void 0 && /* @__PURE__ */ e(x, { label: "Stroke Width", children: /* @__PURE__ */ e(
660
+ "input",
661
+ {
662
+ type: "number",
663
+ min: 0,
664
+ step: 1,
665
+ value: a.paint["circle-stroke-width"] ?? 1,
666
+ onChange: (u) => i({
667
+ ...a,
668
+ paint: {
669
+ ...a.paint,
670
+ "circle-stroke-width": parseFloat(u.target.value) || 0
671
+ }
672
+ }),
673
+ className: q
674
+ }
675
+ ) })
676
+ ] })
677
+ ] });
678
+ }
679
+ const ie = "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500";
680
+ function ye({ value: a, onChange: i }) {
681
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-2", children: [
682
+ /* @__PURE__ */ e(x, { label: "Label", children: /* @__PURE__ */ e(
683
+ "input",
684
+ {
685
+ type: "text",
686
+ value: a.label,
687
+ onChange: (p) => i({ ...a, label: p.target.value }),
688
+ placeholder: "Legend entry label",
689
+ className: ie
690
+ }
691
+ ) }),
692
+ /* @__PURE__ */ e(x, { label: "Color", children: /* @__PURE__ */ e(
693
+ A,
694
+ {
695
+ value: a.color,
696
+ onChange: (p) => i({ ...a, color: p }),
697
+ label: "Entry color"
698
+ }
699
+ ) }),
700
+ /* @__PURE__ */ e(x, { label: "Shape", children: /* @__PURE__ */ t(
701
+ "select",
702
+ {
703
+ value: a.shape ?? "square",
704
+ onChange: (p) => i({ ...a, shape: p.target.value }),
705
+ className: ie,
706
+ children: [
707
+ /* @__PURE__ */ e("option", { value: "square", children: "Square" }),
708
+ /* @__PURE__ */ e("option", { value: "circle", children: "Circle" }),
709
+ /* @__PURE__ */ e("option", { value: "line", children: "Line" })
710
+ ]
711
+ }
712
+ ) })
713
+ ] });
714
+ }
715
+ const te = () => ({ label: "", color: "#4a90d9", shape: "square" });
716
+ function Ne({ value: a, onChange: i }) {
717
+ const p = (a == null ? void 0 : a.entries) ?? [], r = () => {
718
+ i({ entries: [...p, te()] });
719
+ }, m = (n, l) => {
720
+ const N = p.map((h, c) => c === n ? l : h);
721
+ i({ entries: N });
722
+ }, u = (n) => {
723
+ const l = p.filter((N, h) => h !== n);
724
+ i(l.length > 0 ? { entries: l } : void 0);
725
+ }, g = (n) => {
726
+ i(n ? { entries: [te()] } : void 0);
727
+ };
728
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-3", children: [
729
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
730
+ /* @__PURE__ */ e(
731
+ "input",
732
+ {
733
+ type: "checkbox",
734
+ id: "legend-enabled",
735
+ checked: a !== void 0,
736
+ onChange: (n) => g(n.target.checked),
737
+ className: "mapui:h-4 mapui:w-4 mapui:accent-blue-600"
738
+ }
739
+ ),
740
+ /* @__PURE__ */ e("label", { htmlFor: "legend-enabled", className: "mapui:text-sm mapui:font-medium mapui:text-gray-700", children: "Enable Legend" })
741
+ ] }),
742
+ a !== void 0 && /* @__PURE__ */ t(E, { children: [
743
+ /* @__PURE__ */ e("ul", { className: "mapui:m-0 mapui:list-none mapui:flex mapui:flex-col mapui:gap-2 mapui:p-0", children: p.map((n, l) => /* @__PURE__ */ t(
744
+ "li",
745
+ {
746
+ className: "mapui:rounded mapui:border mapui:border-gray-200 mapui:p-3",
747
+ children: [
748
+ /* @__PURE__ */ t("div", { className: "mapui:mb-2 mapui:flex mapui:items-center mapui:justify-between", children: [
749
+ /* @__PURE__ */ t("span", { className: "mapui:text-xs mapui:font-medium mapui:text-gray-600", children: [
750
+ "Entry ",
751
+ l + 1
752
+ ] }),
753
+ /* @__PURE__ */ e(
754
+ "button",
755
+ {
756
+ type: "button",
757
+ onClick: () => u(l),
758
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-red-200 mapui:bg-white mapui:px-2 mapui:py-0.5 mapui:text-xs mapui:text-red-600 hover:mapui:bg-red-50",
759
+ children: "Remove"
760
+ }
761
+ )
762
+ ] }),
763
+ /* @__PURE__ */ e(
764
+ ye,
765
+ {
766
+ value: n,
767
+ onChange: (N) => m(l, N)
768
+ }
769
+ )
770
+ ]
771
+ },
772
+ l
773
+ )) }),
774
+ /* @__PURE__ */ e(
775
+ "button",
776
+ {
777
+ type: "button",
778
+ onClick: r,
779
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-dashed mapui:border-gray-300 mapui:px-3 mapui:py-2 mapui:text-sm mapui:text-gray-600 hover:mapui:border-blue-400 hover:mapui:text-blue-600",
780
+ children: "+ Add Entry"
781
+ }
782
+ )
783
+ ] })
784
+ ] });
785
+ }
786
+ const F = "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500", ve = {
787
+ text: { type: "text", property: "", label: "", autocomplete: !1 },
788
+ number: { type: "number", property: "", label: "", inputMode: "input", operator: "eq" },
789
+ datetime: { type: "datetime", property: "", label: "", range: !1 },
790
+ select: { type: "select", property: "", label: "" }
791
+ };
792
+ function we({ value: a, onChange: i, availableProperties: p }) {
793
+ var g, n;
794
+ const r = (l) => {
795
+ i({ ...ve[l], property: a.property, label: a.label });
796
+ }, m = (l) => i({ ...a, ...l }), u = p && p.length > 0;
797
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-3", children: [
798
+ /* @__PURE__ */ e(x, { label: "Field Type", children: /* @__PURE__ */ t(
799
+ "select",
800
+ {
801
+ value: a.type,
802
+ onChange: (l) => r(l.target.value),
803
+ className: F,
804
+ children: [
805
+ /* @__PURE__ */ e("option", { value: "text", children: "Text" }),
806
+ /* @__PURE__ */ e("option", { value: "number", children: "Number" }),
807
+ /* @__PURE__ */ e("option", { value: "datetime", children: "Date/Time" }),
808
+ /* @__PURE__ */ e("option", { value: "select", children: "Select" })
809
+ ]
810
+ }
811
+ ) }),
812
+ /* @__PURE__ */ e(x, { label: "Property", required: !0, children: u ? /* @__PURE__ */ t(
813
+ "select",
814
+ {
815
+ value: a.property,
816
+ onChange: (l) => m({ property: l.target.value }),
817
+ className: F,
818
+ children: [
819
+ /* @__PURE__ */ e("option", { value: "", children: "Select a property…" }),
820
+ p.map((l) => /* @__PURE__ */ e("option", { value: l.name, children: l.title ?? l.name }, l.name))
821
+ ]
822
+ }
823
+ ) : /* @__PURE__ */ e(
824
+ "input",
825
+ {
826
+ type: "text",
827
+ value: a.property,
828
+ onChange: (l) => m({ property: l.target.value }),
829
+ placeholder: "e.g. name",
830
+ className: F
831
+ }
832
+ ) }),
833
+ /* @__PURE__ */ e(x, { label: "Label", children: /* @__PURE__ */ e(
834
+ "input",
835
+ {
836
+ type: "text",
837
+ value: a.label,
838
+ onChange: (l) => m({ label: l.target.value }),
839
+ placeholder: "Display label",
840
+ className: F
841
+ }
842
+ ) }),
843
+ /* @__PURE__ */ e(x, { label: "Placeholder", children: /* @__PURE__ */ e(
844
+ "input",
845
+ {
846
+ type: "text",
847
+ value: a.placeholder ?? "",
848
+ onChange: (l) => m({ placeholder: l.target.value || void 0 }),
849
+ placeholder: "Input placeholder text",
850
+ className: F
851
+ }
852
+ ) }),
853
+ a.type === "text" && /* @__PURE__ */ t(E, { children: [
854
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
855
+ /* @__PURE__ */ e(
856
+ "input",
857
+ {
858
+ type: "checkbox",
859
+ id: "text-autocomplete",
860
+ checked: a.autocomplete ?? !1,
861
+ onChange: (l) => i({ ...a, autocomplete: l.target.checked }),
862
+ className: "mapui:h-4 mapui:w-4 mapui:accent-blue-600"
863
+ }
864
+ ),
865
+ /* @__PURE__ */ e("label", { htmlFor: "text-autocomplete", className: "mapui:text-sm mapui:text-gray-700", children: "Enable Autocomplete" })
866
+ ] }),
867
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
868
+ /* @__PURE__ */ e(
869
+ "input",
870
+ {
871
+ type: "checkbox",
872
+ id: "text-prefetch",
873
+ checked: a.prefetch ?? !1,
874
+ onChange: (l) => i({ ...a, prefetch: l.target.checked }),
875
+ className: "mapui:h-4 mapui:w-4 mapui:accent-blue-600"
876
+ }
877
+ ),
878
+ /* @__PURE__ */ e("label", { htmlFor: "text-prefetch", className: "mapui:text-sm mapui:text-gray-700", children: "Prefetch Options" })
879
+ ] }),
880
+ /* @__PURE__ */ e(x, { label: "Static Options (comma-separated)", children: /* @__PURE__ */ e(
881
+ "input",
882
+ {
883
+ type: "text",
884
+ value: ((g = a.options) == null ? void 0 : g.join(", ")) ?? "",
885
+ onChange: (l) => {
886
+ const N = l.target.value.trim(), h = N ? N.split(",").map((c) => c.trim()).filter(Boolean) : void 0;
887
+ i({ ...a, options: h });
888
+ },
889
+ placeholder: "option1, option2",
890
+ className: F
891
+ }
892
+ ) })
893
+ ] }),
894
+ a.type === "number" && /* @__PURE__ */ t(E, { children: [
895
+ /* @__PURE__ */ e(x, { label: "Input Mode", children: /* @__PURE__ */ t(
896
+ "select",
897
+ {
898
+ value: a.inputMode ?? "input",
899
+ onChange: (l) => i({
900
+ ...a,
901
+ inputMode: l.target.value
902
+ }),
903
+ className: F,
904
+ children: [
905
+ /* @__PURE__ */ e("option", { value: "input", children: "Input" }),
906
+ /* @__PURE__ */ e("option", { value: "slider", children: "Slider" })
907
+ ]
908
+ }
909
+ ) }),
910
+ /* @__PURE__ */ e(x, { label: "Operator", children: /* @__PURE__ */ t(
911
+ "select",
912
+ {
913
+ value: a.operator ?? "eq",
914
+ onChange: (l) => i({
915
+ ...a,
916
+ operator: l.target.value
917
+ }),
918
+ className: F,
919
+ children: [
920
+ /* @__PURE__ */ e("option", { value: "eq", children: "Equal (=)" }),
921
+ /* @__PURE__ */ e("option", { value: "gt", children: "Greater Than (>)" }),
922
+ /* @__PURE__ */ e("option", { value: "gte", children: "Greater or Equal (>=)" }),
923
+ /* @__PURE__ */ e("option", { value: "lt", children: "Less Than (<)" }),
924
+ /* @__PURE__ */ e("option", { value: "lte", children: "Less or Equal (<=)" }),
925
+ /* @__PURE__ */ e("option", { value: "between", children: "Between" })
926
+ ]
927
+ }
928
+ ) }),
929
+ /* @__PURE__ */ t("div", { className: "mapui:grid mapui:grid-cols-3 mapui:gap-2", children: [
930
+ /* @__PURE__ */ e(x, { label: "Min", children: /* @__PURE__ */ e(
931
+ "input",
932
+ {
933
+ type: "number",
934
+ value: a.min ?? "",
935
+ onChange: (l) => i({
936
+ ...a,
937
+ min: l.target.value ? parseFloat(l.target.value) : void 0
938
+ }),
939
+ className: F
940
+ }
941
+ ) }),
942
+ /* @__PURE__ */ e(x, { label: "Max", children: /* @__PURE__ */ e(
943
+ "input",
944
+ {
945
+ type: "number",
946
+ value: a.max ?? "",
947
+ onChange: (l) => i({
948
+ ...a,
949
+ max: l.target.value ? parseFloat(l.target.value) : void 0
950
+ }),
951
+ className: F
952
+ }
953
+ ) }),
954
+ /* @__PURE__ */ e(x, { label: "Step", children: /* @__PURE__ */ e(
955
+ "input",
956
+ {
957
+ type: "number",
958
+ value: a.step ?? "",
959
+ onChange: (l) => i({
960
+ ...a,
961
+ step: l.target.value ? parseFloat(l.target.value) : void 0
962
+ }),
963
+ className: F
964
+ }
965
+ ) })
966
+ ] })
967
+ ] }),
968
+ a.type === "datetime" && /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
969
+ /* @__PURE__ */ e(
970
+ "input",
971
+ {
972
+ type: "checkbox",
973
+ id: "datetime-range",
974
+ checked: a.range ?? !1,
975
+ onChange: (l) => i({ ...a, range: l.target.checked }),
976
+ className: "mapui:h-4 mapui:w-4 mapui:accent-blue-600"
977
+ }
978
+ ),
979
+ /* @__PURE__ */ e("label", { htmlFor: "datetime-range", className: "mapui:text-sm mapui:text-gray-700", children: "Date Range" })
980
+ ] }),
981
+ a.type === "select" && /* @__PURE__ */ t(E, { children: [
982
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
983
+ /* @__PURE__ */ e(
984
+ "input",
985
+ {
986
+ type: "checkbox",
987
+ id: "select-prefetch",
988
+ checked: a.prefetch ?? !1,
989
+ onChange: (l) => i({ ...a, prefetch: l.target.checked }),
990
+ className: "mapui:h-4 mapui:w-4 mapui:accent-blue-600"
991
+ }
992
+ ),
993
+ /* @__PURE__ */ e("label", { htmlFor: "select-prefetch", className: "mapui:text-sm mapui:text-gray-700", children: "Prefetch Options" })
994
+ ] }),
995
+ /* @__PURE__ */ e(x, { label: "Static Options (comma-separated)", children: /* @__PURE__ */ e(
996
+ "input",
997
+ {
998
+ type: "text",
999
+ value: ((n = a.options) == null ? void 0 : n.join(", ")) ?? "",
1000
+ onChange: (l) => {
1001
+ const N = l.target.value.trim(), h = N ? N.split(",").map((c) => c.trim()).filter(Boolean) : void 0;
1002
+ i({ ...a, options: h });
1003
+ },
1004
+ placeholder: "option1, option2",
1005
+ className: F
1006
+ }
1007
+ ) })
1008
+ ] })
1009
+ ] });
1010
+ }
1011
+ const Ce = () => ({
1012
+ type: "text",
1013
+ property: "",
1014
+ label: "",
1015
+ autocomplete: !1
1016
+ });
1017
+ function ke({ fields: a, onChange: i, availableProperties: p }) {
1018
+ const [r, m] = w(null), u = () => {
1019
+ const h = [...a, Ce()];
1020
+ i(h), m(h.length - 1);
1021
+ }, g = (h, c) => {
1022
+ i(a.map((C, o) => o === h ? c : C));
1023
+ }, n = (h) => {
1024
+ i(a.filter((c, C) => C !== h)), m(null);
1025
+ }, l = (h) => {
1026
+ if (h === 0) return;
1027
+ const c = [...a];
1028
+ [c[h - 1], c[h]] = [c[h], c[h - 1]], i(c), m(h - 1);
1029
+ }, N = (h) => {
1030
+ if (h === a.length - 1) return;
1031
+ const c = [...a];
1032
+ [c[h], c[h + 1]] = [c[h + 1], c[h]], i(c), m(h + 1);
1033
+ };
1034
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-2", children: [
1035
+ a.length === 0 && /* @__PURE__ */ e("p", { className: "mapui:m-0 mapui:text-sm mapui:text-gray-500", children: "No search fields configured." }),
1036
+ /* @__PURE__ */ e("ul", { className: "mapui:m-0 mapui:list-none mapui:flex mapui:flex-col mapui:gap-2 mapui:p-0", children: a.map((h, c) => /* @__PURE__ */ t("li", { className: "mapui:rounded mapui:border mapui:border-gray-200 mapui:bg-white", children: [
1037
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-1 mapui:px-3 mapui:py-2", children: [
1038
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-0.5", children: [
1039
+ /* @__PURE__ */ e(
1040
+ "button",
1041
+ {
1042
+ type: "button",
1043
+ onClick: () => l(c),
1044
+ disabled: c === 0,
1045
+ "aria-label": "Move up",
1046
+ className: "mapui:cursor-pointer mapui:rounded mapui:border-none mapui:bg-transparent mapui:px-1 mapui:text-xs mapui:text-gray-400 hover:mapui:text-gray-600 disabled:mapui:opacity-30",
1047
+ children: "▲"
1048
+ }
1049
+ ),
1050
+ /* @__PURE__ */ e(
1051
+ "button",
1052
+ {
1053
+ type: "button",
1054
+ onClick: () => N(c),
1055
+ disabled: c === a.length - 1,
1056
+ "aria-label": "Move down",
1057
+ className: "mapui:cursor-pointer mapui:rounded mapui:border-none mapui:bg-transparent mapui:px-1 mapui:text-xs mapui:text-gray-400 hover:mapui:text-gray-600 disabled:mapui:opacity-30",
1058
+ children: "▼"
1059
+ }
1060
+ )
1061
+ ] }),
1062
+ /* @__PURE__ */ t(
1063
+ "button",
1064
+ {
1065
+ type: "button",
1066
+ onClick: () => m(r === c ? null : c),
1067
+ className: "mapui:flex-1 mapui:cursor-pointer mapui:border-none mapui:bg-transparent mapui:text-left mapui:text-sm mapui:font-medium mapui:text-gray-800",
1068
+ children: [
1069
+ /* @__PURE__ */ e("span", { className: "mapui:mr-1 mapui:rounded mapui:bg-gray-100 mapui:px-1 mapui:py-0.5 mapui:text-xs mapui:font-mono mapui:text-gray-500", children: h.type }),
1070
+ h.label || h.property || "Untitled field"
1071
+ ]
1072
+ }
1073
+ ),
1074
+ /* @__PURE__ */ e(
1075
+ "button",
1076
+ {
1077
+ type: "button",
1078
+ onClick: () => n(c),
1079
+ "aria-label": "Remove field",
1080
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-red-200 mapui:bg-white mapui:px-2 mapui:py-0.5 mapui:text-xs mapui:text-red-600 hover:mapui:bg-red-50",
1081
+ children: "Remove"
1082
+ }
1083
+ )
1084
+ ] }),
1085
+ r === c && /* @__PURE__ */ e("div", { className: "mapui:border-t mapui:border-gray-100 mapui:p-3", children: /* @__PURE__ */ e(
1086
+ we,
1087
+ {
1088
+ value: h,
1089
+ onChange: (C) => g(c, C),
1090
+ availableProperties: p
1091
+ }
1092
+ ) })
1093
+ ] }, c)) }),
1094
+ /* @__PURE__ */ e(
1095
+ "button",
1096
+ {
1097
+ type: "button",
1098
+ onClick: u,
1099
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-dashed mapui:border-gray-300 mapui:px-3 mapui:py-2 mapui:text-sm mapui:text-gray-600 hover:mapui:border-blue-400 hover:mapui:text-blue-600",
1100
+ children: "+ Add Search Field"
1101
+ }
1102
+ )
1103
+ ] });
1104
+ }
1105
+ function Se(a) {
1106
+ return Object.entries(a).map(([i, p]) => ({
1107
+ key: i,
1108
+ label: p.label ?? "",
1109
+ visible: p.visible ?? !0
1110
+ }));
1111
+ }
1112
+ function Le(a) {
1113
+ const i = {};
1114
+ for (const p of a)
1115
+ i[p.key] = {
1116
+ visible: p.visible,
1117
+ ...p.label ? { label: p.label } : {}
1118
+ };
1119
+ return i;
1120
+ }
1121
+ const Q = "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500";
1122
+ function Fe({ value: a, onChange: i, availableProperties: p }) {
1123
+ const r = Se(a), m = p && p.length > 0, u = (o) => i(Le(o)), g = () => {
1124
+ u([...r, { key: "", label: "", visible: !0 }]);
1125
+ }, n = (o) => {
1126
+ u(r.filter((b, y) => y !== o));
1127
+ }, l = (o, b) => {
1128
+ u(r.map((y, D) => D === o ? { ...y, ...b } : y));
1129
+ }, N = (o, b) => {
1130
+ const y = p == null ? void 0 : p.find((s) => s.name === b), D = (y == null ? void 0 : y.title) ?? r[o].label;
1131
+ u(r.map((s, T) => T === o ? { ...s, key: b, label: D } : s));
1132
+ }, h = (o) => {
1133
+ if (o === 0) return;
1134
+ const b = [...r];
1135
+ [b[o - 1], b[o]] = [b[o], b[o - 1]], u(b);
1136
+ }, c = (o) => {
1137
+ if (o === r.length - 1) return;
1138
+ const b = [...r];
1139
+ [b[o], b[o + 1]] = [b[o + 1], b[o]], u(b);
1140
+ }, C = () => {
1141
+ if (!p) return;
1142
+ const o = p.map((b) => ({
1143
+ key: b.name,
1144
+ label: b.title ?? "",
1145
+ visible: !0
1146
+ }));
1147
+ u(o);
1148
+ };
1149
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-2", children: [
1150
+ r.length === 0 ? /* @__PURE__ */ t(E, { children: [
1151
+ /* @__PURE__ */ e("p", { className: "mapui:m-0 mapui:text-sm mapui:text-gray-500", children: "No property display rules configured. All properties will be shown." }),
1152
+ m && /* @__PURE__ */ e(
1153
+ "button",
1154
+ {
1155
+ type: "button",
1156
+ onClick: C,
1157
+ className: "mapui:cursor-pointer mapui:self-start mapui:rounded mapui:border mapui:border-blue-300 mapui:bg-blue-50 mapui:px-3 mapui:py-1.5 mapui:text-sm mapui:text-blue-700 hover:mapui:bg-blue-100",
1158
+ children: "Populate from API metadata"
1159
+ }
1160
+ )
1161
+ ] }) : /* @__PURE__ */ t(E, { children: [
1162
+ /* @__PURE__ */ t("div", { className: "mapui:grid mapui:items-center mapui:gap-2 mapui:px-8", style: { gridTemplateColumns: "1fr 1fr auto" }, children: [
1163
+ /* @__PURE__ */ e(x, { label: "Property Key", children: /* @__PURE__ */ e("span", {}) }),
1164
+ /* @__PURE__ */ e(x, { label: "Display Label", children: /* @__PURE__ */ e("span", {}) }),
1165
+ /* @__PURE__ */ e("span", { className: "mapui:text-xs mapui:font-medium mapui:text-gray-600", children: "Visible" })
1166
+ ] }),
1167
+ /* @__PURE__ */ e("ul", { className: "mapui:m-0 mapui:list-none mapui:flex mapui:flex-col mapui:gap-1.5 mapui:p-0", children: r.map((o, b) => /* @__PURE__ */ t("li", { className: "mapui:flex mapui:items-center mapui:gap-1 mapui:rounded mapui:border mapui:border-gray-200 mapui:bg-white mapui:px-2 mapui:py-1.5", children: [
1168
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-0.5", children: [
1169
+ /* @__PURE__ */ e(
1170
+ "button",
1171
+ {
1172
+ type: "button",
1173
+ onClick: () => h(b),
1174
+ disabled: b === 0,
1175
+ "aria-label": "Move up",
1176
+ className: "mapui:cursor-pointer mapui:rounded mapui:border-none mapui:bg-transparent mapui:px-1 mapui:text-xs mapui:text-gray-400 hover:mapui:text-gray-600 disabled:mapui:opacity-30",
1177
+ children: "▲"
1178
+ }
1179
+ ),
1180
+ /* @__PURE__ */ e(
1181
+ "button",
1182
+ {
1183
+ type: "button",
1184
+ onClick: () => c(b),
1185
+ disabled: b === r.length - 1,
1186
+ "aria-label": "Move down",
1187
+ className: "mapui:cursor-pointer mapui:rounded mapui:border-none mapui:bg-transparent mapui:px-1 mapui:text-xs mapui:text-gray-400 hover:mapui:text-gray-600 disabled:mapui:opacity-30",
1188
+ children: "▼"
1189
+ }
1190
+ )
1191
+ ] }),
1192
+ /* @__PURE__ */ t("div", { className: "mapui:grid mapui:flex-1 mapui:items-center mapui:gap-2", style: { gridTemplateColumns: "1fr 1fr auto auto" }, children: [
1193
+ m ? /* @__PURE__ */ t(
1194
+ "select",
1195
+ {
1196
+ value: o.key,
1197
+ onChange: (y) => N(b, y.target.value),
1198
+ "aria-label": "Property key",
1199
+ className: Q,
1200
+ children: [
1201
+ /* @__PURE__ */ e("option", { value: "", children: "Select a property…" }),
1202
+ p.map((y) => /* @__PURE__ */ e("option", { value: y.name, children: y.title ?? y.name }, y.name))
1203
+ ]
1204
+ }
1205
+ ) : /* @__PURE__ */ e(
1206
+ "input",
1207
+ {
1208
+ type: "text",
1209
+ value: o.key,
1210
+ onChange: (y) => l(b, { key: y.target.value }),
1211
+ placeholder: "property_name",
1212
+ "aria-label": "Property key",
1213
+ className: Q
1214
+ }
1215
+ ),
1216
+ /* @__PURE__ */ e(
1217
+ "input",
1218
+ {
1219
+ type: "text",
1220
+ value: o.label,
1221
+ onChange: (y) => l(b, { label: y.target.value }),
1222
+ placeholder: "Friendly name",
1223
+ "aria-label": "Display label",
1224
+ className: Q
1225
+ }
1226
+ ),
1227
+ /* @__PURE__ */ e(
1228
+ "input",
1229
+ {
1230
+ type: "checkbox",
1231
+ checked: o.visible,
1232
+ onChange: (y) => l(b, { visible: y.target.checked }),
1233
+ "aria-label": "Visible",
1234
+ className: "mapui:h-4 mapui:w-4 mapui:accent-blue-600"
1235
+ }
1236
+ ),
1237
+ /* @__PURE__ */ e(
1238
+ "button",
1239
+ {
1240
+ type: "button",
1241
+ onClick: () => n(b),
1242
+ "aria-label": "Remove property",
1243
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-red-200 mapui:bg-white mapui:px-2 mapui:py-0.5 mapui:text-xs mapui:text-red-600 hover:mapui:bg-red-50",
1244
+ children: "Remove"
1245
+ }
1246
+ )
1247
+ ] })
1248
+ ] }, b)) })
1249
+ ] }),
1250
+ /* @__PURE__ */ e(
1251
+ "button",
1252
+ {
1253
+ type: "button",
1254
+ onClick: g,
1255
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-dashed mapui:border-gray-300 mapui:px-3 mapui:py-2 mapui:text-sm mapui:text-gray-600 hover:mapui:border-blue-400 hover:mapui:text-blue-600",
1256
+ children: "+ Add Property"
1257
+ }
1258
+ )
1259
+ ] });
1260
+ }
1261
+ const oe = /geojson\.org\/schema\/(\w+)\.json/;
1262
+ function De(a) {
1263
+ return !!a.$ref && oe.test(a.$ref);
1264
+ }
1265
+ function Ee(a) {
1266
+ const i = oe.exec(a);
1267
+ return i ? i[1] : null;
1268
+ }
1269
+ function K(a) {
1270
+ const i = a.toLowerCase();
1271
+ return i.includes("polygon") ? "fill" : i.includes("linestring") ? "line" : i.includes("point") ? "circle" : null;
1272
+ }
1273
+ function se(a) {
1274
+ for (const i of Object.values(a.properties))
1275
+ if (i.$ref) {
1276
+ const p = Ee(i.$ref);
1277
+ if (p) return K(p);
1278
+ }
1279
+ return null;
1280
+ }
1281
+ function Te(a) {
1282
+ return Object.entries(a.properties).filter(([, i]) => !De(i)).map(([i, p]) => ({
1283
+ name: i,
1284
+ title: p.title,
1285
+ type: p.type,
1286
+ format: p.format,
1287
+ enum: p.enum,
1288
+ minimum: p.minimum,
1289
+ maximum: p.maximum
1290
+ }));
1291
+ }
1292
+ async function Re(a, i) {
1293
+ var p, r;
1294
+ try {
1295
+ const m = await he(a, i), u = se(m);
1296
+ if (u) return u;
1297
+ } catch {
1298
+ }
1299
+ try {
1300
+ const u = (r = (p = (await ue(a, i, { limit: 1 })).features[0]) == null ? void 0 : p.geometry) == null ? void 0 : r.type;
1301
+ if (typeof u == "string") return K(u);
1302
+ } catch {
1303
+ }
1304
+ return null;
1305
+ }
1306
+ function Ue(a) {
1307
+ return a.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (i) => i.toUpperCase());
1308
+ }
1309
+ const R = "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500";
1310
+ function V({
1311
+ title: a,
1312
+ children: i
1313
+ }) {
1314
+ const [p, r] = w(!1);
1315
+ return /* @__PURE__ */ t("div", { className: "mapui:rounded mapui:border mapui:border-gray-200", children: [
1316
+ /* @__PURE__ */ t(
1317
+ "button",
1318
+ {
1319
+ type: "button",
1320
+ onClick: () => r((m) => !m),
1321
+ className: "mapui:flex mapui:w-full mapui:cursor-pointer mapui:items-center mapui:justify-between mapui:rounded mapui:border-none mapui:bg-gray-50 mapui:px-3 mapui:py-2 mapui:text-sm mapui:font-medium mapui:text-gray-700 hover:mapui:bg-gray-100",
1322
+ children: [
1323
+ /* @__PURE__ */ e("span", { children: a }),
1324
+ /* @__PURE__ */ e("span", { "aria-hidden": "true", children: p ? "▲" : "▼" })
1325
+ ]
1326
+ }
1327
+ ),
1328
+ p && /* @__PURE__ */ e("div", { className: "mapui:p-3", children: i })
1329
+ ] });
1330
+ }
1331
+ function pe({ value: a, onChange: i, availableSources: p }) {
1332
+ var D;
1333
+ const r = (s) => i({ ...a, ...s }), m = X(a);
1334
+ m.current = a;
1335
+ const u = X(i);
1336
+ u.current = i;
1337
+ const g = p.find((s) => s.id === a.sourceId), n = (g == null ? void 0 : g.url) ?? null, l = a.collection || null, { collections: N, loading: h } = le(n), { queryables: c, loading: C } = be(n, l), o = c ? Te(c) : [], [b, y] = w(
1338
+ null
1339
+ );
1340
+ return ee(() => {
1341
+ if (!c) {
1342
+ y(null);
1343
+ return;
1344
+ }
1345
+ const s = (f) => {
1346
+ if (y(f), f && !m.current.style) {
1347
+ const S = f === "fill" ? J : f === "line" ? me : ne;
1348
+ u.current({ ...m.current, style: S });
1349
+ }
1350
+ }, T = se(c);
1351
+ if (T) {
1352
+ s(T);
1353
+ return;
1354
+ }
1355
+ if (!n || !l) {
1356
+ y(null);
1357
+ return;
1358
+ }
1359
+ let M = !1;
1360
+ return ue(n, l, { limit: 1 }).then((f) => {
1361
+ var L, k;
1362
+ if (M) return;
1363
+ const S = (k = (L = f.features[0]) == null ? void 0 : L.geometry) == null ? void 0 : k.type;
1364
+ s(typeof S == "string" ? K(S) : null);
1365
+ }).catch(() => {
1366
+ M || y(null);
1367
+ }), () => {
1368
+ M = !0;
1369
+ };
1370
+ }, [c, n, l]), ee(() => {
1371
+ y(null);
1372
+ }, [n, l]), /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-3", children: [
1373
+ /* @__PURE__ */ t("div", { className: "mapui:grid mapui:grid-cols-2 mapui:gap-3", children: [
1374
+ /* @__PURE__ */ e(x, { label: "Layer ID", required: !0, children: /* @__PURE__ */ e(
1375
+ "input",
1376
+ {
1377
+ type: "text",
1378
+ value: a.id,
1379
+ onChange: (s) => r({ id: s.target.value }),
1380
+ placeholder: "my-layer",
1381
+ className: R
1382
+ }
1383
+ ) }),
1384
+ /* @__PURE__ */ e(x, { label: "Label", children: /* @__PURE__ */ e(
1385
+ "input",
1386
+ {
1387
+ type: "text",
1388
+ value: a.label,
1389
+ onChange: (s) => r({ label: s.target.value }),
1390
+ placeholder: "My Layer",
1391
+ className: R
1392
+ }
1393
+ ) })
1394
+ ] }),
1395
+ /* @__PURE__ */ e(x, { label: "Source", required: !0, children: /* @__PURE__ */ t(
1396
+ "select",
1397
+ {
1398
+ value: a.sourceId,
1399
+ onChange: (s) => r({ sourceId: s.target.value }),
1400
+ className: R,
1401
+ children: [
1402
+ /* @__PURE__ */ e("option", { value: "", children: "Select a source…" }),
1403
+ p.map((s) => /* @__PURE__ */ e("option", { value: s.id, children: s.label ?? s.id }, s.id))
1404
+ ]
1405
+ }
1406
+ ) }),
1407
+ /* @__PURE__ */ t(x, { label: "Collection", required: !0, children: [
1408
+ N.length > 0 ? /* @__PURE__ */ t(
1409
+ "select",
1410
+ {
1411
+ value: a.collection,
1412
+ onChange: (s) => r({ collection: s.target.value }),
1413
+ className: R,
1414
+ children: [
1415
+ /* @__PURE__ */ e("option", { value: "", children: "Select a collection…" }),
1416
+ N.map((s) => /* @__PURE__ */ e("option", { value: s.id, children: s.title ?? s.id }, s.id))
1417
+ ]
1418
+ }
1419
+ ) : /* @__PURE__ */ e(
1420
+ "input",
1421
+ {
1422
+ type: "text",
1423
+ value: a.collection,
1424
+ onChange: (s) => r({ collection: s.target.value }),
1425
+ placeholder: h ? "Loading collections…" : "collection-id",
1426
+ className: R
1427
+ }
1428
+ ),
1429
+ C && /* @__PURE__ */ e("span", { className: "mapui:mt-0.5 mapui:block mapui:text-xs mapui:text-gray-400", children: "Loading properties…" })
1430
+ ] }),
1431
+ /* @__PURE__ */ e(x, { label: "Data Mode", children: /* @__PURE__ */ e("div", { className: "mapui:flex mapui:gap-4", children: ["vector-tiles", "geojson"].map((s) => /* @__PURE__ */ t("label", { className: "mapui:flex mapui:cursor-pointer mapui:items-center mapui:gap-1.5", children: [
1432
+ /* @__PURE__ */ e(
1433
+ "input",
1434
+ {
1435
+ type: "radio",
1436
+ name: `data-mode-${a.id}`,
1437
+ value: s,
1438
+ checked: a.dataMode === s,
1439
+ onChange: () => r({ dataMode: s }),
1440
+ className: "mapui:accent-blue-600"
1441
+ }
1442
+ ),
1443
+ /* @__PURE__ */ e("span", { className: "mapui:text-sm mapui:text-gray-700", children: s })
1444
+ ] }, s)) }) }),
1445
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
1446
+ /* @__PURE__ */ e(
1447
+ "input",
1448
+ {
1449
+ type: "checkbox",
1450
+ id: "layer-visible",
1451
+ checked: a.visible,
1452
+ onChange: (s) => r({ visible: s.target.checked }),
1453
+ className: "mapui:h-4 mapui:w-4 mapui:accent-blue-600"
1454
+ }
1455
+ ),
1456
+ /* @__PURE__ */ e("label", { htmlFor: "layer-visible", className: "mapui:text-sm mapui:text-gray-700", children: "Visible by default" })
1457
+ ] }),
1458
+ /* @__PURE__ */ e(V, { title: "Style", children: /* @__PURE__ */ e(
1459
+ fe,
1460
+ {
1461
+ value: a.style ?? J,
1462
+ onChange: (s) => r({ style: s }),
1463
+ suggestedType: b
1464
+ }
1465
+ ) }),
1466
+ /* @__PURE__ */ e(V, { title: "Legend", children: /* @__PURE__ */ e(
1467
+ Ne,
1468
+ {
1469
+ value: a.legend,
1470
+ onChange: (s) => r({ legend: s })
1471
+ }
1472
+ ) }),
1473
+ /* @__PURE__ */ e(V, { title: "Search Fields", children: /* @__PURE__ */ e(
1474
+ ke,
1475
+ {
1476
+ fields: ((D = a.search) == null ? void 0 : D.fields) ?? [],
1477
+ onChange: (s) => r({ search: s.length > 0 ? { fields: s } : void 0 }),
1478
+ availableProperties: o
1479
+ }
1480
+ ) }),
1481
+ /* @__PURE__ */ e(V, { title: "Property Display", children: /* @__PURE__ */ e(
1482
+ Fe,
1483
+ {
1484
+ value: a.propertyDisplay ?? {},
1485
+ onChange: (s) => r({ propertyDisplay: Object.keys(s).length > 0 ? s : void 0 }),
1486
+ availableProperties: o
1487
+ }
1488
+ ) })
1489
+ ] });
1490
+ }
1491
+ const z = () => ({
1492
+ id: "",
1493
+ sourceId: "",
1494
+ collection: "",
1495
+ label: "New Layer",
1496
+ visible: !0,
1497
+ dataMode: "vector-tiles"
1498
+ });
1499
+ function Ve({ layers: a, onChange: i, availableSources: p }) {
1500
+ const [r, m] = w(null), [u, g] = w(!1), [n, l] = w(z()), [N, h] = w(null), [c, C] = w(null), [o, b] = w(null), y = () => {
1501
+ i([...a, n]), g(!1), l(z());
1502
+ }, D = (d) => {
1503
+ i(a.map((v) => v.id === r ? d : v));
1504
+ }, s = (d) => {
1505
+ i(a.filter((v) => v.id !== d)), h(null), r === d && m(null);
1506
+ }, T = (d) => {
1507
+ if (d === 0) return;
1508
+ const v = [...a];
1509
+ [v[d - 1], v[d]] = [v[d], v[d - 1]], i(v);
1510
+ }, M = (d) => {
1511
+ if (d === a.length - 1) return;
1512
+ const v = [...a];
1513
+ [v[d], v[d + 1]] = [v[d + 1], v[d]], i(v);
1514
+ }, f = (d, v) => {
1515
+ C(v), d.dataTransfer.effectAllowed = "move", d.dataTransfer.setData("text/plain", v);
1516
+ }, S = (d, v) => {
1517
+ d.preventDefault(), d.dataTransfer.dropEffect = "move", b(v);
1518
+ }, L = () => {
1519
+ b(null);
1520
+ }, k = (d, v) => {
1521
+ d.preventDefault(), b(null);
1522
+ const O = c;
1523
+ if (C(null), !O || O === v) return;
1524
+ const P = a.findIndex((j) => j.id === O), $ = a.findIndex((j) => j.id === v);
1525
+ if (P === -1 || $ === -1) return;
1526
+ const I = [...a];
1527
+ I.splice(P, 1), I.splice($, 0, a[P]), i(I);
1528
+ }, de = () => {
1529
+ C(null), b(null);
1530
+ };
1531
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-3", children: [
1532
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:justify-between", children: [
1533
+ /* @__PURE__ */ e("h3", { className: "mapui:m-0 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Layers" }),
1534
+ /* @__PURE__ */ e(
1535
+ "button",
1536
+ {
1537
+ type: "button",
1538
+ onClick: () => {
1539
+ g(!0), l(z());
1540
+ },
1541
+ className: "mapui:cursor-pointer mapui:rounded mapui:bg-blue-600 mapui:px-3 mapui:py-1 mapui:text-xs mapui:font-medium mapui:text-white hover:mapui:bg-blue-700",
1542
+ children: "+ Add Layer"
1543
+ }
1544
+ )
1545
+ ] }),
1546
+ a.length === 0 && !u && /* @__PURE__ */ e("p", { className: "mapui:m-0 mapui:text-sm mapui:text-gray-500", children: "No layers configured." }),
1547
+ /* @__PURE__ */ e("ul", { className: "mapui:m-0 mapui:list-none mapui:flex mapui:flex-col mapui:gap-2 mapui:p-0", children: a.map((d, v) => {
1548
+ var I, j, Z, Y;
1549
+ const O = c === d.id, P = o === d.id, $ = r === d.id;
1550
+ return /* @__PURE__ */ t(
1551
+ "li",
1552
+ {
1553
+ draggable: !$,
1554
+ onDragStart: $ ? void 0 : (B) => f(B, d.id),
1555
+ onDragOver: (B) => S(B, d.id),
1556
+ onDragLeave: L,
1557
+ onDrop: (B) => k(B, d.id),
1558
+ onDragEnd: de,
1559
+ className: [
1560
+ "mapui:rounded-lg mapui:border mapui:bg-white mapui:transition-colors",
1561
+ P ? "mapui:border-blue-400 mapui:bg-blue-50" : "mapui:border-gray-200",
1562
+ O ? "mapui:opacity-50" : "mapui:opacity-100"
1563
+ ].join(" "),
1564
+ children: [
1565
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:justify-between mapui:gap-2 mapui:px-3 mapui:py-2", children: [
1566
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:min-w-0 mapui:items-center mapui:gap-2", children: [
1567
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:shrink-0 mapui:flex-col mapui:gap-0.5", children: [
1568
+ /* @__PURE__ */ e(
1569
+ "button",
1570
+ {
1571
+ type: "button",
1572
+ onClick: () => T(v),
1573
+ disabled: v === 0,
1574
+ "aria-label": "Move layer up",
1575
+ className: "mapui:cursor-pointer mapui:rounded mapui:border-none mapui:bg-transparent mapui:px-1 mapui:text-xs mapui:text-gray-400 hover:mapui:text-gray-600 disabled:mapui:opacity-30",
1576
+ children: "▲"
1577
+ }
1578
+ ),
1579
+ /* @__PURE__ */ e(
1580
+ "button",
1581
+ {
1582
+ type: "button",
1583
+ onClick: () => M(v),
1584
+ disabled: v === a.length - 1,
1585
+ "aria-label": "Move layer down",
1586
+ className: "mapui:cursor-pointer mapui:rounded mapui:border-none mapui:bg-transparent mapui:px-1 mapui:text-xs mapui:text-gray-400 hover:mapui:text-gray-600 disabled:mapui:opacity-30",
1587
+ children: "▼"
1588
+ }
1589
+ )
1590
+ ] }),
1591
+ /* @__PURE__ */ e(
1592
+ "span",
1593
+ {
1594
+ className: "mapui:shrink-0 mapui:cursor-grab mapui:text-gray-400 active:mapui:cursor-grabbing",
1595
+ "aria-hidden": "true",
1596
+ children: "⠿"
1597
+ }
1598
+ ),
1599
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:min-w-0 mapui:flex-col mapui:gap-0.5", children: [
1600
+ /* @__PURE__ */ e("span", { className: "mapui:text-sm mapui:font-medium mapui:text-gray-800", children: d.label || d.id }),
1601
+ /* @__PURE__ */ e("span", { className: "mapui:font-mono mapui:text-xs mapui:text-gray-500", children: d.collection }),
1602
+ /* @__PURE__ */ t("div", { className: "mapui:mt-1 mapui:flex mapui:flex-wrap mapui:gap-1", children: [
1603
+ /* @__PURE__ */ e("span", { className: "mapui:rounded mapui:bg-slate-100 mapui:px-1.5 mapui:py-0.5 mapui:text-[10px] mapui:font-medium mapui:text-slate-700", children: d.dataMode }),
1604
+ d.style && /* @__PURE__ */ e("span", { className: "mapui:rounded mapui:bg-purple-100 mapui:px-1.5 mapui:py-0.5 mapui:text-[10px] mapui:font-medium mapui:text-purple-700", children: d.style.type }),
1605
+ d.visible === !1 && /* @__PURE__ */ e("span", { className: "mapui:rounded mapui:bg-amber-100 mapui:px-1.5 mapui:py-0.5 mapui:text-[10px] mapui:font-medium mapui:text-amber-700", children: "hidden" }),
1606
+ (((j = (I = d.search) == null ? void 0 : I.fields) == null ? void 0 : j.length) ?? 0) > 0 && /* @__PURE__ */ t("span", { className: "mapui:rounded mapui:bg-blue-100 mapui:px-1.5 mapui:py-0.5 mapui:text-[10px] mapui:font-medium mapui:text-blue-700", children: [
1607
+ d.search.fields.length,
1608
+ " search fields"
1609
+ ] }),
1610
+ (((Y = (Z = d.legend) == null ? void 0 : Z.entries) == null ? void 0 : Y.length) ?? 0) > 0 && /* @__PURE__ */ t("span", { className: "mapui:rounded mapui:bg-green-100 mapui:px-1.5 mapui:py-0.5 mapui:text-[10px] mapui:font-medium mapui:text-green-700", children: [
1611
+ d.legend.entries.length,
1612
+ " legend entries"
1613
+ ] })
1614
+ ] })
1615
+ ] })
1616
+ ] }),
1617
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:shrink-0 mapui:gap-1", children: [
1618
+ /* @__PURE__ */ e(
1619
+ "button",
1620
+ {
1621
+ type: "button",
1622
+ onClick: () => m(r === d.id ? null : d.id),
1623
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-gray-200 mapui:bg-white mapui:px-2 mapui:py-1 mapui:text-xs mapui:text-gray-600 hover:mapui:bg-gray-50",
1624
+ children: r === d.id ? "Close" : "Edit"
1625
+ }
1626
+ ),
1627
+ /* @__PURE__ */ e(
1628
+ "button",
1629
+ {
1630
+ type: "button",
1631
+ onClick: () => h(d.id),
1632
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-red-200 mapui:bg-white mapui:px-2 mapui:py-1 mapui:text-xs mapui:text-red-600 hover:mapui:bg-red-50",
1633
+ children: "Remove"
1634
+ }
1635
+ )
1636
+ ] })
1637
+ ] }),
1638
+ r === d.id && /* @__PURE__ */ e("div", { className: "mapui:border-t mapui:border-gray-100 mapui:p-3", children: /* @__PURE__ */ e(
1639
+ pe,
1640
+ {
1641
+ value: d,
1642
+ onChange: D,
1643
+ availableSources: p
1644
+ }
1645
+ ) })
1646
+ ]
1647
+ },
1648
+ d.id
1649
+ );
1650
+ }) }),
1651
+ u && /* @__PURE__ */ t("div", { className: "mapui:rounded-lg mapui:border mapui:border-blue-200 mapui:bg-blue-50 mapui:p-3", children: [
1652
+ /* @__PURE__ */ e("p", { className: "mapui:m-0 mapui:mb-3 mapui:text-xs mapui:font-semibold mapui:text-blue-700", children: "New Layer" }),
1653
+ /* @__PURE__ */ e(
1654
+ pe,
1655
+ {
1656
+ value: n,
1657
+ onChange: l,
1658
+ availableSources: p
1659
+ }
1660
+ ),
1661
+ /* @__PURE__ */ t("div", { className: "mapui:mt-3 mapui:flex mapui:gap-2", children: [
1662
+ /* @__PURE__ */ e(
1663
+ "button",
1664
+ {
1665
+ type: "button",
1666
+ onClick: y,
1667
+ disabled: !n.id || !n.sourceId || !n.collection,
1668
+ className: "mapui:cursor-pointer mapui:rounded mapui:bg-blue-600 mapui:px-3 mapui:py-1 mapui:text-xs mapui:font-medium mapui:text-white hover:mapui:bg-blue-700 disabled:mapui:cursor-not-allowed disabled:mapui:opacity-50",
1669
+ children: "Save"
1670
+ }
1671
+ ),
1672
+ /* @__PURE__ */ e(
1673
+ "button",
1674
+ {
1675
+ type: "button",
1676
+ onClick: () => g(!1),
1677
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-gray-300 mapui:bg-white mapui:px-3 mapui:py-1 mapui:text-xs mapui:text-gray-700 hover:mapui:bg-gray-50",
1678
+ children: "Cancel"
1679
+ }
1680
+ )
1681
+ ] })
1682
+ ] }),
1683
+ /* @__PURE__ */ e(
1684
+ H,
1685
+ {
1686
+ open: N !== null,
1687
+ title: "Remove Layer",
1688
+ description: "Are you sure you want to remove this layer from the configuration?",
1689
+ onConfirm: () => N && s(N),
1690
+ onCancel: () => h(null)
1691
+ }
1692
+ )
1693
+ ] });
1694
+ }
1695
+ const G = "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500";
1696
+ function re({ value: a, onChange: i }) {
1697
+ const p = (r) => i({ ...a, ...r });
1698
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-3", children: [
1699
+ /* @__PURE__ */ e(x, { label: "ID", required: !0, children: /* @__PURE__ */ e(
1700
+ "input",
1701
+ {
1702
+ type: "text",
1703
+ value: a.id,
1704
+ onChange: (r) => p({ id: r.target.value }),
1705
+ placeholder: "osm",
1706
+ className: G
1707
+ }
1708
+ ) }),
1709
+ /* @__PURE__ */ e(x, { label: "Label", children: /* @__PURE__ */ e(
1710
+ "input",
1711
+ {
1712
+ type: "text",
1713
+ value: a.label,
1714
+ onChange: (r) => p({ label: r.target.value }),
1715
+ placeholder: "OpenStreetMap",
1716
+ className: G
1717
+ }
1718
+ ) }),
1719
+ /* @__PURE__ */ e(x, { label: "Style URL", required: !0, children: /* @__PURE__ */ e(
1720
+ "input",
1721
+ {
1722
+ type: "url",
1723
+ value: a.url,
1724
+ onChange: (r) => p({ url: r.target.value }),
1725
+ placeholder: "https://example.com/style.json",
1726
+ className: G
1727
+ }
1728
+ ) }),
1729
+ /* @__PURE__ */ t(x, { label: "Thumbnail URL (optional)", children: [
1730
+ /* @__PURE__ */ e(
1731
+ "input",
1732
+ {
1733
+ type: "url",
1734
+ value: a.thumbnail ?? "",
1735
+ onChange: (r) => p({ thumbnail: r.target.value || void 0 }),
1736
+ placeholder: "https://example.com/thumbnail.png",
1737
+ className: G
1738
+ }
1739
+ ),
1740
+ a.thumbnail && /* @__PURE__ */ e(
1741
+ "img",
1742
+ {
1743
+ src: a.thumbnail,
1744
+ alt: "Thumbnail preview",
1745
+ className: "mapui:mt-1 mapui:h-16 mapui:w-24 mapui:rounded mapui:border mapui:border-gray-200 mapui:object-cover"
1746
+ }
1747
+ )
1748
+ ] })
1749
+ ] });
1750
+ }
1751
+ const W = () => ({ id: "", label: "", url: "" });
1752
+ function Ge({ basemaps: a, onChange: i }) {
1753
+ const [p, r] = w(null), [m, u] = w(!1), [g, n] = w(W()), [l, N] = w(null), h = (o) => {
1754
+ i(a.map((b) => b.id === p ? o : b));
1755
+ }, c = () => {
1756
+ i([...a, g]), u(!1), n(W());
1757
+ }, C = (o) => {
1758
+ i(a.filter((b) => b.id !== o)), N(null);
1759
+ };
1760
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-3", children: [
1761
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:justify-between", children: [
1762
+ /* @__PURE__ */ e("h3", { className: "mapui:m-0 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Basemaps" }),
1763
+ /* @__PURE__ */ e(
1764
+ "button",
1765
+ {
1766
+ type: "button",
1767
+ onClick: () => {
1768
+ u(!0), n(W());
1769
+ },
1770
+ className: "mapui:cursor-pointer mapui:rounded mapui:bg-blue-600 mapui:px-3 mapui:py-1 mapui:text-xs mapui:font-medium mapui:text-white hover:mapui:bg-blue-700",
1771
+ children: "+ Add Basemap"
1772
+ }
1773
+ )
1774
+ ] }),
1775
+ a.length === 0 && !m && /* @__PURE__ */ e("p", { className: "mapui:m-0 mapui:text-sm mapui:text-gray-500", children: "No basemaps configured." }),
1776
+ /* @__PURE__ */ e("ul", { className: "mapui:m-0 mapui:list-none mapui:flex mapui:flex-col mapui:gap-2 mapui:p-0", children: a.map((o) => /* @__PURE__ */ t(
1777
+ "li",
1778
+ {
1779
+ className: "mapui:rounded-lg mapui:border mapui:border-gray-200 mapui:bg-white",
1780
+ children: [
1781
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-3 mapui:px-3 mapui:py-2", children: [
1782
+ o.thumbnail && /* @__PURE__ */ e(
1783
+ "img",
1784
+ {
1785
+ src: o.thumbnail,
1786
+ alt: "",
1787
+ className: "mapui:h-10 mapui:w-14 mapui:shrink-0 mapui:rounded mapui:object-cover"
1788
+ }
1789
+ ),
1790
+ /* @__PURE__ */ t("div", { className: "mapui:flex-1 mapui:overflow-hidden", children: [
1791
+ /* @__PURE__ */ e("span", { className: "mapui:block mapui:text-sm mapui:font-medium mapui:text-gray-800", children: o.label || o.id }),
1792
+ /* @__PURE__ */ e("span", { className: "mapui:block mapui:truncate mapui:font-mono mapui:text-xs mapui:text-gray-500", children: o.url })
1793
+ ] }),
1794
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:shrink-0 mapui:gap-1", children: [
1795
+ /* @__PURE__ */ e(
1796
+ "button",
1797
+ {
1798
+ type: "button",
1799
+ onClick: () => r(p === o.id ? null : o.id),
1800
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-gray-200 mapui:bg-white mapui:px-2 mapui:py-1 mapui:text-xs mapui:text-gray-600 hover:mapui:bg-gray-50",
1801
+ children: p === o.id ? "Close" : "Edit"
1802
+ }
1803
+ ),
1804
+ /* @__PURE__ */ e(
1805
+ "button",
1806
+ {
1807
+ type: "button",
1808
+ onClick: () => N(o.id),
1809
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-red-200 mapui:bg-white mapui:px-2 mapui:py-1 mapui:text-xs mapui:text-red-600 hover:mapui:bg-red-50",
1810
+ children: "Remove"
1811
+ }
1812
+ )
1813
+ ] })
1814
+ ] }),
1815
+ p === o.id && /* @__PURE__ */ e("div", { className: "mapui:border-t mapui:border-gray-100 mapui:p-3", children: /* @__PURE__ */ e(re, { value: o, onChange: h }) })
1816
+ ]
1817
+ },
1818
+ o.id
1819
+ )) }),
1820
+ m && /* @__PURE__ */ t("div", { className: "mapui:rounded-lg mapui:border mapui:border-blue-200 mapui:bg-blue-50 mapui:p-3", children: [
1821
+ /* @__PURE__ */ e("p", { className: "mapui:m-0 mapui:mb-3 mapui:text-xs mapui:font-semibold mapui:text-blue-700", children: "New Basemap" }),
1822
+ /* @__PURE__ */ e(re, { value: g, onChange: n }),
1823
+ /* @__PURE__ */ t("div", { className: "mapui:mt-3 mapui:flex mapui:gap-2", children: [
1824
+ /* @__PURE__ */ e(
1825
+ "button",
1826
+ {
1827
+ type: "button",
1828
+ onClick: c,
1829
+ disabled: !g.id || !g.url,
1830
+ className: "mapui:cursor-pointer mapui:rounded mapui:bg-blue-600 mapui:px-3 mapui:py-1 mapui:text-xs mapui:font-medium mapui:text-white hover:mapui:bg-blue-700 disabled:mapui:cursor-not-allowed disabled:mapui:opacity-50",
1831
+ children: "Save"
1832
+ }
1833
+ ),
1834
+ /* @__PURE__ */ e(
1835
+ "button",
1836
+ {
1837
+ type: "button",
1838
+ onClick: () => u(!1),
1839
+ className: "mapui:cursor-pointer mapui:rounded mapui:border mapui:border-gray-300 mapui:bg-white mapui:px-3 mapui:py-1 mapui:text-xs mapui:text-gray-700 hover:mapui:bg-gray-50",
1840
+ children: "Cancel"
1841
+ }
1842
+ )
1843
+ ] })
1844
+ ] }),
1845
+ /* @__PURE__ */ e(
1846
+ H,
1847
+ {
1848
+ open: l !== null,
1849
+ title: "Remove Basemap",
1850
+ description: "Are you sure you want to remove this basemap from the configuration?",
1851
+ onConfirm: () => l && C(l),
1852
+ onCancel: () => N(null)
1853
+ }
1854
+ )
1855
+ ] });
1856
+ }
1857
+ const Me = [
1858
+ { key: "showLayerPanel", label: "Layer Panel", description: "Toggle layer visibility" },
1859
+ { key: "showLegend", label: "Legend", description: "Map legend" },
1860
+ { key: "showBasemapSwitcher", label: "Basemap Switcher", description: "Switch basemap styles" },
1861
+ { key: "showSearchPanel", label: "Search Panel", description: "Search and filter features" },
1862
+ { key: "showCoordinateDisplay", label: "Coordinate Display", description: "Show cursor coordinates" },
1863
+ { key: "showFeatureDetail", label: "Feature Detail Panel", description: "Inspect feature properties" },
1864
+ { key: "showFeatureTooltip", label: "Feature Tooltip", description: "Hover tooltip on features" },
1865
+ { key: "showExportButton", label: "Export Button", description: "Export data as CSV" }
1866
+ ];
1867
+ function _e({ value: a, onChange: i }) {
1868
+ const p = (r, m) => {
1869
+ i({ ...a, [r]: m });
1870
+ };
1871
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-1", children: [
1872
+ /* @__PURE__ */ e("p", { className: "mapui:m-0 mapui:mb-2 mapui:text-xs mapui:text-gray-500", children: "Enable or disable UI panels and controls." }),
1873
+ /* @__PURE__ */ e("div", { className: "mapui:grid mapui:grid-cols-1 mapui:gap-2 sm:mapui:grid-cols-2", children: Me.map(({ key: r, label: m, description: u }) => {
1874
+ const g = a[r];
1875
+ return /* @__PURE__ */ t(
1876
+ "label",
1877
+ {
1878
+ className: "mapui:flex mapui:cursor-pointer mapui:items-center mapui:justify-between mapui:gap-3 mapui:rounded mapui:border mapui:border-gray-200 mapui:bg-white mapui:px-3 mapui:py-2 hover:mapui:bg-gray-50",
1879
+ children: [
1880
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-0.5", children: [
1881
+ /* @__PURE__ */ e("span", { className: "mapui:text-sm mapui:font-medium mapui:text-gray-800", children: m }),
1882
+ /* @__PURE__ */ e("span", { className: "mapui:text-xs mapui:text-gray-500", children: u })
1883
+ ] }),
1884
+ /* @__PURE__ */ t("div", { className: "mapui:relative mapui:flex mapui:shrink-0 mapui:items-center", children: [
1885
+ /* @__PURE__ */ e(
1886
+ "input",
1887
+ {
1888
+ type: "checkbox",
1889
+ checked: g,
1890
+ onChange: (n) => p(r, n.target.checked),
1891
+ className: "mapui:sr-only",
1892
+ "aria-label": m
1893
+ }
1894
+ ),
1895
+ /* @__PURE__ */ e(
1896
+ "div",
1897
+ {
1898
+ className: [
1899
+ "mapui:relative mapui:h-5 mapui:w-9 mapui:rounded-full mapui:transition-colors",
1900
+ g ? "mapui:bg-blue-600" : "mapui:bg-gray-300"
1901
+ ].join(" "),
1902
+ children: /* @__PURE__ */ e(
1903
+ "div",
1904
+ {
1905
+ className: [
1906
+ "mapui:absolute mapui:top-0.5 mapui:h-4 mapui:w-4 mapui:rounded-full mapui:bg-white mapui:shadow mapui:transition-transform",
1907
+ g ? "mapui:translate-x-4" : "mapui:translate-x-0.5"
1908
+ ].join(" ")
1909
+ }
1910
+ )
1911
+ }
1912
+ )
1913
+ ] })
1914
+ ]
1915
+ },
1916
+ r
1917
+ );
1918
+ }) })
1919
+ ] });
1920
+ }
1921
+ const ce = [
1922
+ { key: "latitude", label: "Latitude", min: -90, max: 90, step: 1e-6, placeholder: "0" },
1923
+ { key: "longitude", label: "Longitude", min: -180, max: 180, step: 1e-6, placeholder: "0" },
1924
+ { key: "zoom", label: "Zoom", min: 0, max: 24, step: 0.1, placeholder: "2" },
1925
+ { key: "pitch", label: "Pitch (°)", min: 0, max: 85, step: 1, placeholder: "0" },
1926
+ { key: "bearing", label: "Bearing (°)", min: -180, max: 180, step: 1, placeholder: "0" }
1927
+ ];
1928
+ function Ie(a, i) {
1929
+ const p = ce.find((r) => r.key === a);
1930
+ if (p) {
1931
+ if (isNaN(i)) return "Must be a number";
1932
+ if (i < p.min) return `Must be at least ${p.min}`;
1933
+ if (i > p.max) return `Must be at most ${p.max}`;
1934
+ }
1935
+ }
1936
+ const je = "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500";
1937
+ function Qe({ value: a, onChange: i }) {
1938
+ const p = (r, m) => {
1939
+ const u = parseFloat(m);
1940
+ i({ ...a, [r]: isNaN(u) ? 0 : u });
1941
+ };
1942
+ return /* @__PURE__ */ e("div", { className: "mapui:grid mapui:grid-cols-2 mapui:gap-3", children: ce.map(({ key: r, label: m, min: u, max: g, step: n, placeholder: l }) => {
1943
+ const N = Ie(r, a[r]);
1944
+ return /* @__PURE__ */ e(x, { label: m, error: N, children: /* @__PURE__ */ e(
1945
+ "input",
1946
+ {
1947
+ type: "number",
1948
+ min: u,
1949
+ max: g,
1950
+ step: n,
1951
+ value: a[r],
1952
+ placeholder: l,
1953
+ onChange: (h) => p(r, h.target.value),
1954
+ className: `${je} ${N ? "mapui:border-red-400" : ""}`
1955
+ }
1956
+ ) }, r);
1957
+ }) });
1958
+ }
1959
+ function ze({ config: a }) {
1960
+ const i = ge(a);
1961
+ return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-3", children: [
1962
+ /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
1963
+ /* @__PURE__ */ e(
1964
+ "span",
1965
+ {
1966
+ className: [
1967
+ "mapui:inline-flex mapui:items-center mapui:rounded-full mapui:px-2.5 mapui:py-0.5 mapui:text-xs mapui:font-semibold",
1968
+ i.success ? "mapui:bg-green-100 mapui:text-green-800" : "mapui:bg-red-100 mapui:text-red-800"
1969
+ ].join(" "),
1970
+ children: i.success ? "Valid" : "Invalid"
1971
+ }
1972
+ ),
1973
+ /* @__PURE__ */ e("span", { className: "mapui:text-xs mapui:text-gray-500", children: "MapConfig validation" })
1974
+ ] }),
1975
+ !i.success && /* @__PURE__ */ t("div", { className: "mapui:rounded mapui:bg-red-50 mapui:p-3", children: [
1976
+ /* @__PURE__ */ e("p", { className: "mapui:m-0 mapui:mb-1 mapui:text-xs mapui:font-semibold mapui:text-red-700", children: "Validation Errors" }),
1977
+ /* @__PURE__ */ e("ul", { className: "mapui:m-0 mapui:list-none mapui:flex mapui:flex-col mapui:gap-1 mapui:p-0", children: i.error.errors.map((p, r) => /* @__PURE__ */ t("li", { className: "mapui:flex mapui:flex-col mapui:gap-0.5", children: [
1978
+ /* @__PURE__ */ e("span", { className: "mapui:font-mono mapui:text-xs mapui:text-red-600", children: p.path.join(" > ") || "root" }),
1979
+ /* @__PURE__ */ e("span", { className: "mapui:text-xs mapui:text-red-800", children: p.message })
1980
+ ] }, r)) })
1981
+ ] }),
1982
+ /* @__PURE__ */ e("div", { className: "mapui:overflow-auto mapui:rounded mapui:border mapui:border-gray-200 mapui:bg-gray-50", children: /* @__PURE__ */ e("pre", { className: "mapui:m-0 mapui:p-3 mapui:text-xs mapui:text-gray-800 mapui:whitespace-pre", children: JSON.stringify(a, null, 2) }) })
1983
+ ] });
1984
+ }
1985
+ export {
1986
+ Za as BasemapConfigSchema,
1987
+ re as BasemapEditor,
1988
+ Ge as BasemapList,
1989
+ He as BasemapSwitcher,
1990
+ Ya as CirclePaintSchema,
1991
+ Xa as CircleStyleSchema,
1992
+ Ze as CollapsibleControl,
1993
+ qe as CollectionBrowser,
1994
+ A as ColorPicker,
1995
+ ze as ConfigPreview,
1996
+ H as ConfirmDialog,
1997
+ Xe as CoordinateDisplay,
1998
+ ei as DatetimeSearchFieldSchema,
1999
+ ta as ExportButton,
2000
+ ra as FeatureDetailPanel,
2001
+ ua as FeatureTooltip,
2002
+ ai as FillPaintSchema,
2003
+ ii as FillStyleSchema,
2004
+ ti as FilterConfigSchema,
2005
+ x as FormField,
2006
+ pi as LayerConfigSchema,
2007
+ pe as LayerEditor,
2008
+ Ve as LayerList,
2009
+ na as LayerPanel,
2010
+ sa as Legend,
2011
+ ri as LegendConfigSchema,
2012
+ Ne as LegendEditor,
2013
+ ye as LegendEntryEditor,
2014
+ li as LegendEntrySchema,
2015
+ ui as LinePaintSchema,
2016
+ mi as LineStyleSchema,
2017
+ ni as MapConfigSchema,
2018
+ oi as NumberSearchFieldSchema,
2019
+ si as OgcApiSourceSchema,
2020
+ ci as PropertyDisplayConfigSchema,
2021
+ Fe as PropertyDisplayEditor,
2022
+ di as PropertyDisplaySchema,
2023
+ hi as SearchConfigSchema,
2024
+ we as SearchFieldEditor,
2025
+ ke as SearchFieldList,
2026
+ bi as SearchFieldSchema,
2027
+ da as SearchPanel,
2028
+ gi as SelectSearchFieldSchema,
2029
+ ae as SourceEditor,
2030
+ Be as SourceList,
2031
+ xi as StyleConfigSchema,
2032
+ fe as StyleEditor,
2033
+ fi as TextSearchFieldSchema,
2034
+ _e as UIConfigEditor,
2035
+ yi as UIConfigSchema,
2036
+ Ni as ViewConfigSchema,
2037
+ Qe as ViewEditor,
2038
+ ba as and,
2039
+ ga as between,
2040
+ ne as defaultCircle,
2041
+ J as defaultFill,
2042
+ me as defaultLine,
2043
+ se as detectGeometryTypeFromQueryables,
2044
+ Re as detectStyleTypeForCollection,
2045
+ xa as downloadCsv,
2046
+ fa as eq,
2047
+ Ee as extractGeometryType,
2048
+ ya as featuresToCsv,
2049
+ Na as fetchCollectionDetail,
2050
+ va as fetchCollections,
2051
+ wa as fetchConformance,
2052
+ Ca as fetchDistinctValues,
2053
+ ka as fetchFeatureCount,
2054
+ ue as fetchFeatures,
2055
+ he as fetchQueryables,
2056
+ Sa as fetchTileJson,
2057
+ ea as formatDMS,
2058
+ aa as formatDecimal,
2059
+ La as fromSimpleFilters,
2060
+ Fa as fromStructuredFilters,
2061
+ K as geometryTypeToStyleType,
2062
+ Da as getCql2FilteredVectorTileUrl,
2063
+ Ea as getFilteredVectorTileUrl,
2064
+ Ta as getTileJsonUrl,
2065
+ Ma as getVectorTileUrl,
2066
+ Ia as gt,
2067
+ ja as gte,
2068
+ Ue as humanizePropertyName,
2069
+ Aa as inList,
2070
+ De as isGeometryProperty,
2071
+ Oa as isNull,
2072
+ Pa as like,
2073
+ $a as lt,
2074
+ Ba as lte,
2075
+ qa as neq,
2076
+ Ra as not,
2077
+ Ua as or,
2078
+ Va as resolvePropertyDisplay,
2079
+ ge as safeValidateMapConfig,
2080
+ Ga as serializeCql2,
2081
+ _a as tAfter,
2082
+ Qa as tBefore,
2083
+ za as tDuring,
2084
+ Te as toAvailableProperties,
2085
+ Wa as useCsvExport,
2086
+ Ja as useOgcCollectionDetail,
2087
+ le as useOgcCollections,
2088
+ Ha as useOgcFeatures,
2089
+ be as useOgcQueryables,
2090
+ vi as validateMapConfig
55
2091
  };