@opengis/gis 0.2.178 → 0.2.180

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 (22) hide show
  1. package/dist/{CardIcon-CMRD1LLh.js → CardIcon-g4POnzwa.js} +1 -1
  2. package/dist/{EntityTablePage-XNNCltAN.js → EntityTablePage-B7K_hSYY.js} +1 -1
  3. package/dist/{ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-BqUjKTDY.js → ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-BcSv7m_s.js} +1 -1
  4. package/dist/{MapSettings-P3h-vHn3.js → MapSettings-C3hn2A7K.js} +1 -1
  5. package/dist/MapToolbarRight.vue_vue_type_script_setup_true_lang-Diu4LI2Z.js +1230 -0
  6. package/dist/{RastersTablePage-DnhGZLiH.js → RastersTablePage-6Emo2MXj.js} +1 -1
  7. package/dist/cartocss-COLdNfzh.js +1460 -0
  8. package/dist/{import-utils-BCATsbB5.js → import-utils-DTDbjorg.js} +1 -1
  9. package/dist/{index-cUagVqgA.js → index-Czv-aLH-.js} +11 -11
  10. package/dist/index.css +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/index.umd.cjs +29 -29
  13. package/dist/{raster-CP0tUp3j.js → raster-CB8C1210.js} +225 -219
  14. package/dist/{register-Cr-uQcby.js → register-DkQ3WyMI.js} +3 -3
  15. package/dist/{service-DwJaKrOd.js → service-BTKNJ8d_.js} +603 -597
  16. package/dist/{vs-datatable-B9WoVk-b.js → vs-datatable-C4NSnPIQ.js} +1 -1
  17. package/package.json +1 -1
  18. package/server/routes/registers/functions/getFilterSQLParametrized/formatValue.js +1 -1
  19. package/server/routes/registers/functions/gis.suggest.js +1 -1
  20. package/server/routes/registers/functions/handleRegistryRequest.js +4 -2
  21. package/dist/HeaderActions.vue_vue_type_script_setup_true_lang-BXQ3hKwa.js +0 -1099
  22. package/dist/cartocss-BkrOeQg4.js +0 -1586
@@ -0,0 +1,1460 @@
1
+ import { openBlock as x, createElementBlock as P, createElementVNode as l, defineComponent as U, computed as B, createTextVNode as Le, createVNode as S, mergeModels as pt, defineAsyncComponent as Se, useModel as vt, ref as b, withCtx as j, toDisplayString as O, unref as I, watch as q, onUnmounted as yt, createCommentVNode as N, onBeforeUnmount as ae, onMounted as Ee, createBlock as A, Transition as gt, withModifiers as De, Fragment as me, renderList as Qe, normalizeStyle as $e, normalizeClass as pe, withDirectives as Ue, vModelText as ht, vModelCheckbox as bt, resolveDynamicComponent as xt } from "vue";
2
+ import { useRouter as _t, useRoute as wt } from "vue-router";
3
+ import { notify as D } from "@opengis/core";
4
+ import { Minimize2 as kt, Maximize2 as Ct, Link2 as Mt, Ruler as St, Eye as $t, EyeOff as Lt } from "lucide-vue-next";
5
+ import { _ as Ye, f as oe, o as Et, p as Vt, q as zt, M as Rt, i as Bt, j as qe, r as Pt, t as Tt, m as At } from "./index-Czv-aLH-.js";
6
+ import { S as Ft, C as Nt } from "./CardIcon-g4POnzwa.js";
7
+ import { h as ve, _ as jt, a as Ot, b as Dt, c as Ut, d as qt, e as Zt, f as It, g as Qt } from "./MapToolbarRight.vue_vue_type_script_setup_true_lang-Diu4LI2Z.js";
8
+ import { _ as He } from "./MonacoEditor.vue_vue_type_script_setup_true_lang-D3ZPeXMw.js";
9
+ import { V as Yt } from "./vs-datatable-C4NSnPIQ.js";
10
+ import { _ as Ze } from "./ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-BcSv7m_s.js";
11
+ const Ht = {}, Jt = {
12
+ xmlns: "http://www.w3.org/2000/svg",
13
+ width: "24",
14
+ height: "24",
15
+ viewBox: "0 0 24 24",
16
+ fill: "none",
17
+ stroke: "currentColor",
18
+ "stroke-width": "2",
19
+ "stroke-linecap": "round",
20
+ "stroke-linejoin": "round",
21
+ class: "lucide lucide-table"
22
+ };
23
+ function Kt($, r) {
24
+ return x(), P("svg", Jt, [...r[0] || (r[0] = [
25
+ l("path", { d: "M12 3v18" }, null, -1),
26
+ l("rect", {
27
+ width: "18",
28
+ height: "18",
29
+ x: "3",
30
+ y: "3",
31
+ rx: "2"
32
+ }, null, -1),
33
+ l("path", { d: "M3 9h18" }, null, -1),
34
+ l("path", { d: "M3 15h18" }, null, -1)
35
+ ])]);
36
+ }
37
+ const Xt = /* @__PURE__ */ Ye(Ht, [["render", Kt]]), Gt = { class: "flex flex-col h-full" }, Wt = { class: "flex justify-end mb-3 gap-2" }, ea = /* @__PURE__ */ U({
38
+ __name: "cartocss-css-tab",
39
+ props: {
40
+ modelValue: {}
41
+ },
42
+ emits: ["update:modelValue", "save"],
43
+ setup($, { emit: r }) {
44
+ const n = $, k = r, _ = B({
45
+ get: () => n.modelValue,
46
+ set: (v) => k("update:modelValue", v)
47
+ });
48
+ return (v, g) => (x(), P("div", Gt, [
49
+ l("div", Wt, [
50
+ l("button", {
51
+ type: "button",
52
+ class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium bg-gradient-to-r from-sky-400 to-blue-400 hover:from-sky-500 hover:to-blue-500 text-white shadow-sm px-4 py-2 h-9 text-xs transition-all duration-300",
53
+ onClick: g[0] || (g[0] = (y) => v.$emit("save"))
54
+ }, [...g[2] || (g[2] = [
55
+ l("svg", {
56
+ xmlns: "http://www.w3.org/2000/svg",
57
+ width: "24",
58
+ height: "24",
59
+ viewBox: "0 0 24 24",
60
+ fill: "none",
61
+ stroke: "currentColor",
62
+ "stroke-width": "2",
63
+ "stroke-linecap": "round",
64
+ "stroke-linejoin": "round",
65
+ class: "h-3.5 w-3.5"
66
+ }, [
67
+ l("path", { d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a 2 2 0 0 1-2-2V5a 2 2 0 0 1 2-2z" }),
68
+ l("path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a 1 1 0 0 0-1 1v7" }),
69
+ l("path", { d: "M7 3v4a1 1 0 0 0 1 1h7" })
70
+ ], -1),
71
+ Le(" Зберегти ", -1)
72
+ ])])
73
+ ]),
74
+ S(He, {
75
+ modelValue: _.value,
76
+ "onUpdate:modelValue": g[1] || (g[1] = (y) => _.value = y),
77
+ language: "cartocss",
78
+ class: "flex-1 rounded-lg overflow-hidden"
79
+ }, null, 8, ["modelValue"])
80
+ ]));
81
+ }
82
+ }), ta = { class: "flex flex-col flex-1 min-h-0" }, aa = { class: "flex justify-between mb-3 gap-2" }, oa = { class: "text-left" }, na = { class: "font-medium text-gray-900" }, la = { class: "text-xs text-gray-500" }, sa = { class: "flex justify-center gap-2" }, ra = ["checked", "onChange"], ua = { class: "text-sm font-medium text-gray-900" }, ia = /* @__PURE__ */ U({
83
+ __name: "cartocss-data-tab",
84
+ props: {
85
+ modelValue: { default: [] },
86
+ modelModifiers: {}
87
+ },
88
+ emits: /* @__PURE__ */ pt(["save"], ["update:modelValue"]),
89
+ setup($, { emit: r }) {
90
+ const n = [
91
+ { key: "table", label: "Таблиця", slot: "datasetCell" },
92
+ {
93
+ key: "active",
94
+ label: "Активний",
95
+ slot: "activeCell",
96
+ width: "140px"
97
+ },
98
+ {
99
+ key: "zoom",
100
+ label: "Min Зум",
101
+ slot: "zoomCell",
102
+ width: "140px"
103
+ }
104
+ ], k = Se(
105
+ () => import("@opengis/core").then((w) => w.VsModal)
106
+ ), _ = Se(() => import("@opengis/form")), v = vt($, "modelValue"), g = r, y = b(!1), h = b({
107
+ table: "",
108
+ query: "",
109
+ srid: "",
110
+ key: "",
111
+ columns: "",
112
+ gcol: "",
113
+ minzoom: "",
114
+ maxzoom: "",
115
+ proj4text: "",
116
+ active: !0
117
+ }), u = {
118
+ table: { type: "text", label: "Таблиця", validators: ["required"] },
119
+ key: { type: "text", label: "Ключ", validators: ["required"] },
120
+ query: { type: "text", label: "Query" },
121
+ columns: { type: "text", label: "Колонки" },
122
+ gcol: { type: "text", label: "Колонка geometry" },
123
+ srid: { type: "number", label: "SRID" },
124
+ proj4text: { type: "text", label: "PROJ4" },
125
+ active: { type: "switcher", label: "Активна" },
126
+ minzoom: { type: "number", label: "Min Зум", col: 6 },
127
+ maxzoom: { type: "number", label: "Max Зум", col: 6 }
128
+ };
129
+ function s() {
130
+ h.value = {
131
+ table: "",
132
+ query: "",
133
+ srid: "",
134
+ key: "",
135
+ columns: "",
136
+ gcol: "",
137
+ minzoom: "",
138
+ maxzoom: "",
139
+ proj4text: "",
140
+ active: !0
141
+ }, y.value = !0;
142
+ }
143
+ function m() {
144
+ y.value = !1;
145
+ }
146
+ function z() {
147
+ var i, o;
148
+ const w = (i = h.value.table) == null ? void 0 : i.trim(), C = (o = h.value.key) == null ? void 0 : o.trim();
149
+ if (!w || !C) {
150
+ D({
151
+ type: "warning",
152
+ title: "Перевірка",
153
+ message: "Вкажіть таблицю та підпис"
154
+ });
155
+ return;
156
+ }
157
+ v.value = [
158
+ ...Array.isArray(v.value) ? v.value : [],
159
+ { ...h.value, table: w, key: C }
160
+ ], y.value = !1;
161
+ }
162
+ function p(w, C) {
163
+ var o;
164
+ const i = ((o = C == null ? void 0 : C.target) == null ? void 0 : o.checked) ?? !1;
165
+ w.active = i, v.value = Array.isArray(v.value) ? [...v.value] : [];
166
+ }
167
+ return (w, C) => (x(), P("div", ta, [
168
+ l("div", aa, [
169
+ l("button", {
170
+ type: "button",
171
+ class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium bg-gradient-to-r from-gray-500 to-gray-400 text-white h-9 px-4 py-2 hover:from-gray-600 hover:to-gray-500",
172
+ onClick: s
173
+ }, " Додати таблицю "),
174
+ l("button", {
175
+ type: "button",
176
+ class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium bg-gradient-to-r from-sky-400 to-blue-400 hover:from-sky-500 hover:to-blue-500 text-white shadow-sm px-4 py-2 h-9 text-xs transition-all duration-300",
177
+ onClick: C[0] || (C[0] = (i) => g("save"))
178
+ }, " Зберегти ")
179
+ ]),
180
+ S(Yt, {
181
+ modelValue: v.value,
182
+ "onUpdate:modelValue": C[1] || (C[1] = (i) => v.value = i),
183
+ "columns-scheme": n,
184
+ "form-scheme": u,
185
+ "add-button": !1,
186
+ "main-col-width": "260px"
187
+ }, {
188
+ datasetCell: j(({ row: i }) => [
189
+ l("div", oa, [
190
+ l("div", na, O(i.table), 1),
191
+ l("div", la, O(i.key), 1)
192
+ ])
193
+ ]),
194
+ activeCell: j(({ row: i }) => [
195
+ l("label", sa, [
196
+ l("input", {
197
+ type: "checkbox",
198
+ class: "h-4 w-4 text-sky-500 border-gray-300 rounded focus:ring-sky-300",
199
+ checked: i.active,
200
+ onChange: (o) => p(i, o)
201
+ }, null, 40, ra)
202
+ ])
203
+ ]),
204
+ zoomCell: j(({ row: i }) => [
205
+ l("div", ua, O(i.zoom), 1)
206
+ ]),
207
+ _: 1
208
+ }, 8, ["modelValue"]),
209
+ S(I(k), {
210
+ teleport: "#modal",
211
+ visible: y.value,
212
+ "onUpdate:visible": C[3] || (C[3] = (i) => y.value = i),
213
+ title: "Нова таблиця CartoCSS"
214
+ }, {
215
+ footer: j(() => [
216
+ l("div", { class: "flex justify-end gap-2 p-4 border-т" }, [
217
+ l("button", {
218
+ type: "button",
219
+ class: "px-4 py-2 rounded bg-gray-100 text-gray-700",
220
+ onClick: m
221
+ }, " Скасувати "),
222
+ l("button", {
223
+ type: "button",
224
+ class: "px-4 py-2 rounded bg-blue-600 text-white",
225
+ onClick: z
226
+ }, " Додати ")
227
+ ])
228
+ ]),
229
+ default: j(() => [
230
+ S(I(_), {
231
+ values: h.value,
232
+ "onUpdate:values": C[2] || (C[2] = (i) => h.value = i),
233
+ schema: u
234
+ }, null, 8, ["values"])
235
+ ]),
236
+ _: 1
237
+ }, 8, ["visible"])
238
+ ]));
239
+ }
240
+ }), ca = { class: "flex flex-col flex-1 min-h-0 gap-4" }, da = { class: "h-[calc(100vh-230px)] rounded-md border border-gray-200 bg-white" }, fa = /* @__PURE__ */ U({
241
+ __name: "cartocss-card-tab",
242
+ props: {
243
+ card: {},
244
+ table: {}
245
+ },
246
+ emits: ["save"],
247
+ setup($, { emit: r }) {
248
+ const n = $, k = r, _ = b(n.table), v = b(n.card), g = Se(() => import("@opengis/form").then((h) => h.VsInputText));
249
+ function y() {
250
+ k("save", {
251
+ card_html: v.value,
252
+ card_table: _.value
253
+ });
254
+ }
255
+ return (h, u) => (x(), P("div", ca, [
256
+ l("div", { class: "flex items-center justify-end gap-3" }, [
257
+ l("button", {
258
+ type: "button",
259
+ class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium bg-gradient-to-r from-sky-400 to-blue-400 hover:from-sky-500 hover:to-blue-500 text-white shadow-sm px-4 py-2 h-9 text-xs transition-all duration-300",
260
+ onClick: y
261
+ }, [...u[2] || (u[2] = [
262
+ l("svg", {
263
+ xmlns: "http://www.w3.org/2000/svg",
264
+ width: "24",
265
+ height: "24",
266
+ viewBox: "0 0 24 24",
267
+ fill: "none",
268
+ stroke: "currentColor",
269
+ "stroke-width": "2",
270
+ "stroke-linecap": "round",
271
+ "stroke-linejoin": "round",
272
+ class: "h-3.5 w-3.5"
273
+ }, [
274
+ l("path", { d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a 2 2 0 0 1-2-2V5a 2 2 0 0 1 2-2z" }),
275
+ l("path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a 1 1 0 0 0-1 1v7" }),
276
+ l("path", { d: "M7 3v4a1 1 0 0 0 1 1h7" })
277
+ ], -1),
278
+ Le(" Зберегти картку ", -1)
279
+ ])])
280
+ ]),
281
+ l("div", null, [
282
+ S(I(g), {
283
+ modelValue: _.value,
284
+ "onUpdate:modelValue": u[0] || (u[0] = (s) => _.value = s)
285
+ }, null, 8, ["modelValue"])
286
+ ]),
287
+ l("div", da, [
288
+ S(He, {
289
+ modelValue: v.value,
290
+ "onUpdate:modelValue": u[1] || (u[1] = (s) => v.value = s),
291
+ language: "html",
292
+ theme: "vs-light",
293
+ class: "h-full w-full rounded-md"
294
+ }, null, 8, ["modelValue"])
295
+ ])
296
+ ]));
297
+ }
298
+ }), ma = /* @__PURE__ */ U({
299
+ __name: "CartocssLayerLoader",
300
+ props: {
301
+ layerId: { type: String, required: !0 },
302
+ tileUrl: { type: String, default: "" },
303
+ title: { type: String, default: "" },
304
+ active: { type: Boolean, default: !1 },
305
+ owner: { type: String, default: "" },
306
+ opacity: { type: Number, default: 1 }
307
+ },
308
+ setup($) {
309
+ const r = $, n = oe(), {
310
+ activateTemporaryLayer: k,
311
+ deactivateTemporaryLayer: _,
312
+ setTemporaryLayerOpacity: v
313
+ } = Et(n.map), g = B(() => {
314
+ var m;
315
+ const s = `${(m = r == null ? void 0 : r.tileUrl) == null ? void 0 : m.trim()}`;
316
+ return s ? typeof window > "u" || typeof location > "u" || /^https?:\/\//i.test(s) ? s : s.startsWith("//") ? `${window.location.protocol}${s}` : s.startsWith("/") ? `${location.origin}${s}` : `${location.origin}/${s}` : "";
317
+ });
318
+ let y = "", h = "";
319
+ function u() {
320
+ const s = r.active && !!g.value;
321
+ y && (!s || y !== r.layerId) && (_(y, h || void 0), y = "", h = ""), s && (k(
322
+ {
323
+ id: r.layerId,
324
+ title: r.title || r.layerId,
325
+ url: g.value,
326
+ opacity: r.opacity
327
+ },
328
+ {},
329
+ r.owner
330
+ ), y = r.layerId, h = r.owner || "");
331
+ }
332
+ return q(
333
+ () => [r.layerId, g.value, r.active, r.owner],
334
+ u,
335
+ { immediate: !0 }
336
+ ), q(
337
+ () => r.opacity,
338
+ (s) => {
339
+ !y || !r.active || v(y, s, h || void 0);
340
+ },
341
+ { immediate: !0 }
342
+ ), yt(() => {
343
+ y && (_(y, h || void 0), y = "", h = "");
344
+ }), (s, m) => N("", !0);
345
+ }
346
+ }), pa = /* @__PURE__ */ U({
347
+ __name: "CartocssMapClickListener",
348
+ props: {
349
+ cartocssId: {},
350
+ infoEnabled: { type: [Boolean, null] },
351
+ active: { type: [Boolean, null] }
352
+ },
353
+ setup($) {
354
+ const r = $, n = B(() => r.cartocssId ?? null), k = B(
355
+ () => !!r.infoEnabled && r.active !== !1
356
+ ), { map: _, ready: v } = oe(), g = (p) => {
357
+ !p || typeof window > "u" || window.dispatchEvent(
358
+ new CustomEvent(zt, { detail: p })
359
+ );
360
+ }, y = async (p) => {
361
+ const w = await fetch(`/api/map-format?${p.toString()}`);
362
+ if (!w.ok)
363
+ throw new Error(`API returned ${w.status}`);
364
+ return w.json();
365
+ };
366
+ let h = null, u = null;
367
+ const s = (p) => {
368
+ if (!p) return null;
369
+ if (typeof p == "string")
370
+ try {
371
+ return JSON.parse(p);
372
+ } catch {
373
+ return null;
374
+ }
375
+ return p;
376
+ }, m = async (p, w) => {
377
+ var o;
378
+ const C = n.value ? `external:${n.value},${String(p)}` : null, i = new URLSearchParams({
379
+ layer: n.value ?? "",
380
+ id: String(p)
381
+ });
382
+ try {
383
+ const c = await y(i), R = typeof c.html == "string" ? c.html : null, V = s(
384
+ ((o = c == null ? void 0 : c.data) == null ? void 0 : o.geom) ?? (c == null ? void 0 : c.geom) ?? null
385
+ );
386
+ (R || V) && g({
387
+ html: R,
388
+ geometry: V ?? w,
389
+ infoToken: C
390
+ });
391
+ } catch (c) {
392
+ console.warn("CartoCSS map-format (id) error", c);
393
+ }
394
+ }, z = async (p) => {
395
+ var o, c, R, V;
396
+ if (!n.value || r.active === !1) return;
397
+ if (!k.value) {
398
+ D({
399
+ type: "error",
400
+ title: "CartoCSS",
401
+ message: "Картка не налаштована"
402
+ });
403
+ return;
404
+ }
405
+ const w = (o = p == null ? void 0 : p.lngLat) == null ? void 0 : o.lng, C = (c = p == null ? void 0 : p.lngLat) == null ? void 0 : c.lat;
406
+ if (typeof w != "number" || typeof C != "number") return;
407
+ const i = new URLSearchParams({
408
+ layer: n.value,
409
+ lat: C.toFixed(6),
410
+ lng: w.toFixed(6)
411
+ });
412
+ try {
413
+ const M = await y(i), K = s(
414
+ ((R = M == null ? void 0 : M.data) == null ? void 0 : R.geom) ?? (M == null ? void 0 : M.geom) ?? null
415
+ ), Q = ((V = M == null ? void 0 : M.data) == null ? void 0 : V.id) ?? (M == null ? void 0 : M.id);
416
+ if (Q != null) {
417
+ await m(Q, K);
418
+ return;
419
+ }
420
+ Vt({ html: M == null ? void 0 : M.html }) && g({
421
+ html: M == null ? void 0 : M.html,
422
+ geometry: K,
423
+ infoToken: null
424
+ });
425
+ } catch (M) {
426
+ console.warn("CartoCSS map-format error", M);
427
+ }
428
+ };
429
+ return v().then(() => {
430
+ u = _.value, u && (u.on("click", z), h = () => u == null ? void 0 : u.off("click", z));
431
+ }), ae(() => {
432
+ h == null || h(), h = null, u = null;
433
+ }), () => {
434
+ };
435
+ }
436
+ }), va = 100, ya = /* @__PURE__ */ U({
437
+ __name: "MapFullscreenButton",
438
+ props: {
439
+ target: {}
440
+ },
441
+ setup($) {
442
+ const r = $, { map: n, ready: k } = oe(), _ = b(!1), v = b(!1);
443
+ function g() {
444
+ var m, z;
445
+ if (r.target) return r.target;
446
+ const s = (z = (m = n.value) == null ? void 0 : m.getContainer) == null ? void 0 : z.call(m);
447
+ return s ? s.closest(".map-view-root") ?? s : null;
448
+ }
449
+ function y() {
450
+ const s = g();
451
+ v.value = !!(s && document.fullscreenElement === s);
452
+ }
453
+ function h() {
454
+ window.setTimeout(() => {
455
+ var s, m;
456
+ (m = (s = n.value) == null ? void 0 : s.resize) == null || m.call(s);
457
+ }, va);
458
+ }
459
+ async function u() {
460
+ const s = g();
461
+ if (s)
462
+ try {
463
+ document.fullscreenElement === s ? await document.exitFullscreen() : document.fullscreenElement ? (await document.exitFullscreen(), await s.requestFullscreen()) : await s.requestFullscreen();
464
+ } catch (m) {
465
+ console.error("Fullscreen error:", m);
466
+ } finally {
467
+ y(), h();
468
+ }
469
+ }
470
+ return Ee(async () => {
471
+ await (k == null ? void 0 : k()), _.value = !!n.value, y(), document.addEventListener("fullscreenchange", y), document.addEventListener("fullscreenchange", h);
472
+ }), ae(() => {
473
+ document.removeEventListener("fullscreenchange", y), document.removeEventListener("fullscreenchange", h);
474
+ }), (s, m) => (x(), A(ve, {
475
+ title: v.value ? "Вийти з повного екрана" : "Повний екран",
476
+ tooltip: v.value ? "Вийти з повного екрана" : "Повний екран",
477
+ active: v.value,
478
+ disabled: !_.value,
479
+ onClick: u
480
+ }, {
481
+ default: j(() => [
482
+ v.value ? (x(), A(I(kt), {
483
+ key: 0,
484
+ class: "w-4 h-4"
485
+ })) : (x(), A(I(Ct), {
486
+ key: 1,
487
+ class: "w-4 h-4"
488
+ }))
489
+ ]),
490
+ _: 1
491
+ }, 8, ["title", "tooltip", "active", "disabled"]));
492
+ }
493
+ }), ga = /* @__PURE__ */ U({
494
+ __name: "MapCopyLinkButton",
495
+ props: {
496
+ url: { default: "" }
497
+ },
498
+ setup($) {
499
+ const r = $;
500
+ async function n() {
501
+ const k = r.url || (typeof window < "u" ? window.location.href : "");
502
+ if (!k) {
503
+ D({
504
+ type: "warning",
505
+ title: "Посилання",
506
+ message: "Немає URL для копіювання"
507
+ });
508
+ return;
509
+ }
510
+ try {
511
+ await navigator.clipboard.writeText(k), D({
512
+ type: "success",
513
+ title: "Посилання",
514
+ message: "Посилання скопійовано"
515
+ });
516
+ } catch (_) {
517
+ console.error("Copy link error:", _), D({
518
+ type: "error",
519
+ title: "Посилання",
520
+ message: "Не вдалося скопіювати посилання"
521
+ });
522
+ }
523
+ }
524
+ return (k, _) => (x(), A(ve, {
525
+ title: "Копіювати посилання",
526
+ tooltip: "Копіювати посилання",
527
+ onClick: n
528
+ }, {
529
+ default: j(() => [
530
+ S(I(Mt), { class: "w-4 h-4" })
531
+ ]),
532
+ _: 1
533
+ }));
534
+ }
535
+ }), ha = {
536
+ key: 0,
537
+ class: "absolute right-full top-0 mr-2 z-[450] flex",
538
+ role: "group",
539
+ "aria-label": "Вибір рівня зуму"
540
+ }, ba = { class: "flex flex-col items-center rounded-lg border border-gray-200 bg-white/95 py-2.5 pl-1 pr-2 shadow-lg backdrop-blur-sm" }, xa = ["title", "onClick"], _a = {
541
+ key: 0,
542
+ class: "absolute right-5 text-[9px] tabular-nums text-gray-400"
543
+ }, wa = /* @__PURE__ */ U({
544
+ __name: "MapZoomSlider",
545
+ props: {
546
+ visible: { type: Boolean },
547
+ modelValue: {},
548
+ min: { default: 5 },
549
+ max: { default: 20 }
550
+ },
551
+ emits: ["update:modelValue"],
552
+ setup($, { emit: r }) {
553
+ const n = $, k = r, _ = b(), v = b(n.modelValue), g = b(!1);
554
+ q(
555
+ () => n.modelValue,
556
+ (i) => {
557
+ g.value || (v.value = i);
558
+ }
559
+ );
560
+ const y = B(() => {
561
+ const i = [];
562
+ for (let o = n.min; o <= n.max; o += 1) i.push(o);
563
+ return i;
564
+ }), h = B(() => {
565
+ const i = /* @__PURE__ */ new Set();
566
+ for (let o = n.min; o <= n.max; o += 5)
567
+ i.add(o);
568
+ return i.add(n.max), i;
569
+ }), u = (i) => h.value.has(i), s = (i) => {
570
+ const o = n.max - n.min;
571
+ return o <= 0 ? 0 : (n.max - i) / o * 100;
572
+ }, m = (i) => {
573
+ k("update:modelValue", i);
574
+ }, z = (i) => {
575
+ if (!_.value) return;
576
+ const o = _.value.getBoundingClientRect(), c = (i - o.top) / o.height;
577
+ v.value = Math.max(
578
+ n.min,
579
+ Math.min(n.max, Math.round(n.max - c * (n.max - n.min)))
580
+ );
581
+ }, p = (i) => {
582
+ z(i.clientY);
583
+ }, w = () => {
584
+ window.removeEventListener("mousemove", p), window.removeEventListener("mouseup", w), g.value = !1, v.value !== n.modelValue && k("update:modelValue", v.value);
585
+ }, C = (i) => {
586
+ g.value = !0, z(i.clientY), window.addEventListener("mousemove", p), window.addEventListener("mouseup", w);
587
+ };
588
+ return (i, o) => (x(), A(gt, { name: "zoom-panel" }, {
589
+ default: j(() => [
590
+ $.visible ? (x(), P("div", ha, [
591
+ l("div", ba, [
592
+ o[1] || (o[1] = l("span", { class: "mb-1 text-[9px] font-semibold uppercase tracking-wider text-gray-400" }, " Zoom ", -1)),
593
+ l("div", {
594
+ ref_key: "sliderRef",
595
+ ref: _,
596
+ class: "relative h-44 w-8 cursor-pointer select-none",
597
+ onMousedown: De(C, ["prevent"])
598
+ }, [
599
+ o[0] || (o[0] = l("div", { class: "absolute right-0 top-0 bottom-0 w-px bg-gray-200" }, null, -1)),
600
+ (x(!0), P(me, null, Qe(y.value, (c) => (x(), P("button", {
601
+ key: c,
602
+ type: "button",
603
+ class: "absolute right-0 -translate-y-1/2 flex items-center justify-end group",
604
+ style: $e({ top: `${s(c)}%` }),
605
+ title: `Zoom ${c}`,
606
+ onClick: De((R) => m(c), ["stop"])
607
+ }, [
608
+ l("span", {
609
+ class: pe([
610
+ "block rounded-full",
611
+ u(c) ? "h-px w-2.5 bg-gray-300 group-hover:bg-gray-400" : "h-px w-1.5 bg-gray-200 group-hover:bg-gray-300"
612
+ ])
613
+ }, null, 2),
614
+ u(c) ? (x(), P("span", _a, O(c), 1)) : N("", !0)
615
+ ], 12, xa))), 128)),
616
+ l("div", {
617
+ class: "absolute right-0 -translate-y-1/2 flex items-center",
618
+ style: $e({ top: `${s(v.value)}%` })
619
+ }, [
620
+ l("div", {
621
+ class: pe(["h-[4px] w-4 rounded-full bg-blue-600/80 shadow-sm transition-all", g.value ? "bg-blue-300 transform duration-200" : ""])
622
+ }, null, 2)
623
+ ], 4)
624
+ ], 544)
625
+ ])
626
+ ])) : N("", !0)
627
+ ]),
628
+ _: 1
629
+ }));
630
+ }
631
+ }), ka = /* @__PURE__ */ Ye(wa, [["__scopeId", "data-v-ca77aba8"]]), Ca = { class: "text-[0.7rem] font-bold tabular-nums leading-none text-gray-600" }, Ce = 5, Me = 20, Ma = 13, Sa = 0.01, $a = 200, La = /* @__PURE__ */ U({
632
+ __name: "MapZoomLevelButton",
633
+ setup($) {
634
+ const { map: r, ready: n } = oe(), k = b(!1), _ = b(!1), v = b(Ma), g = b(!1), y = b(Ce), h = b(Me), u = B(() => String(v.value));
635
+ function s(o) {
636
+ return Math.round(Math.min(h.value, Math.max(y.value, o)));
637
+ }
638
+ function m() {
639
+ var V, M;
640
+ const o = r.value;
641
+ if (!o) return;
642
+ const c = (V = o.getMinZoom) == null ? void 0 : V.call(o), R = (M = o.getMaxZoom) == null ? void 0 : M.call(o);
643
+ Number.isFinite(c) && (y.value = Math.max(Ce, Math.floor(Number(c)))), Number.isFinite(R) && (h.value = Math.min(Me, Math.ceil(Number(R)))), y.value > h.value && (y.value = Ce, h.value = Me);
644
+ }
645
+ function z() {
646
+ var V;
647
+ const o = r.value;
648
+ if (!o || g.value) return;
649
+ const c = (V = o.getZoom) == null ? void 0 : V.call(o);
650
+ if (c == null) return;
651
+ const R = s(c);
652
+ v.value !== R && (v.value = R);
653
+ }
654
+ function p(o) {
655
+ var K, Q;
656
+ const c = r.value;
657
+ if (!(c != null && c.easeTo)) return;
658
+ const R = (K = c.getCenter) == null ? void 0 : K.call(c);
659
+ if (!R) return;
660
+ const V = s(o), M = (Q = c.getZoom) == null ? void 0 : Q.call(c);
661
+ M != null && Math.abs(M - V) < Sa || (g.value = !0, c.easeTo({
662
+ center: [R.lng, R.lat],
663
+ zoom: V,
664
+ duration: $a,
665
+ essential: !0
666
+ }));
667
+ }
668
+ function w() {
669
+ g.value = !1, z();
670
+ }
671
+ function C() {
672
+ _.value = !_.value, _.value && (m(), z());
673
+ }
674
+ function i(o) {
675
+ v.value = o, p(o);
676
+ }
677
+ return Ee(async () => {
678
+ var c;
679
+ await (n == null ? void 0 : n());
680
+ const o = r.value;
681
+ k.value = !!o, m(), z(), (c = o == null ? void 0 : o.on) == null || c.call(o, "zoomend", w);
682
+ }), ae(() => {
683
+ var o, c;
684
+ (c = (o = r.value) == null ? void 0 : o.off) == null || c.call(o, "zoomend", w);
685
+ }), (o, c) => (x(), P(me, null, [
686
+ S(ve, {
687
+ title: _.value ? "Закрити вибір зуму" : "Вибрати рівень зуму",
688
+ tooltip: "Рівень зуму",
689
+ active: _.value,
690
+ disabled: !k.value,
691
+ "aria-label": "Рівень зуму",
692
+ onClick: C
693
+ }, {
694
+ default: j(() => [
695
+ l("div", Ca, O(u.value), 1)
696
+ ]),
697
+ _: 1
698
+ }, 8, ["title", "active", "disabled"]),
699
+ S(ka, {
700
+ visible: _.value,
701
+ "model-value": v.value,
702
+ min: y.value,
703
+ max: h.value,
704
+ "onUpdate:modelValue": i
705
+ }, null, 8, ["visible", "model-value", "min", "max"])
706
+ ], 64));
707
+ }
708
+ }), Ea = /* @__PURE__ */ U({
709
+ __name: "MapRulerButton",
710
+ props: {
711
+ active: { type: Boolean }
712
+ },
713
+ emits: ["click"],
714
+ setup($) {
715
+ return (r, n) => (x(), A(ve, {
716
+ title: $.active ? "Вимкнути лінійку" : "Увімкнути лінійку",
717
+ tooltip: "Вимірювання",
718
+ active: $.active,
719
+ "aria-label": "Вимірювання",
720
+ onClick: n[0] || (n[0] = (k) => r.$emit("click", k))
721
+ }, {
722
+ default: j(() => [
723
+ S(I(St), { class: "w-4 h-4" })
724
+ ]),
725
+ _: 1
726
+ }, 8, ["title", "active"]));
727
+ }
728
+ }), Va = /* @__PURE__ */ U({
729
+ __name: "RulerMapClickBridge",
730
+ props: {
731
+ active: { type: Boolean }
732
+ },
733
+ emits: ["map-click"],
734
+ setup($, { emit: r }) {
735
+ const n = $, k = r, { map: _, ready: v } = oe();
736
+ let g = null;
737
+ function y(u) {
738
+ if (!n.active) return;
739
+ const s = u == null ? void 0 : u.lngLat;
740
+ typeof (s == null ? void 0 : s.lat) != "number" || typeof (s == null ? void 0 : s.lng) != "number" || k("map-click", { lat: s.lat, lng: s.lng });
741
+ }
742
+ async function h() {
743
+ if (g == null || g(), g = null, !n.active) return;
744
+ await (v == null ? void 0 : v());
745
+ const u = _.value;
746
+ u != null && u.on && (u.on("click", y), g = () => {
747
+ var s;
748
+ return (s = u.off) == null ? void 0 : s.call(u, "click", y);
749
+ });
750
+ }
751
+ return q(
752
+ () => n.active,
753
+ () => {
754
+ h();
755
+ },
756
+ { immediate: !0 }
757
+ ), ae(() => {
758
+ g == null || g(), g = null;
759
+ }), (u, s) => null;
760
+ }
761
+ }), za = { class: "flex h-full bg-gradient-to-br from-slate-50 to-white" }, Ra = { class: "flex-1 relative overflow-hidden" }, Ba = { class: "absolute top-0 left-0 w-full z-20" }, Pa = { class: "px-4 sm:px-6 py-4 border-b border-gray-200 bg-white shadow-sm" }, Ta = { class: "flex items-start justify-between gap-4" }, Aa = { class: "flex-1 min-w-0" }, Fa = { class: "flex items-center text-sm text-gray-500 mb-3" }, Na = { class: "text-gray-900 font-medium truncate max-w-xs" }, ja = { class: "flex items-center justify-between gap-4" }, Oa = { class: "flex-1 min-w-0" }, Da = { class: "flex items-center gap-3 mb-1" }, Ua = { class: "text-base font-semibold text-gray-900 truncate" }, qa = {
762
+ key: 0,
763
+ class: "px-2 py-0.5 bg-green-50 border border-green-200 rounded flex-shrink-0"
764
+ }, Za = { class: "text-xs font-medium text-green-700" }, Ia = ["title"], Qa = { class: "w-full h-full bg-gradient-to-br from-sky-50 via-white to-blue-50 flex items-center justify-center relative pt-[115px]" }, Ya = { class: "relative w-full h-full" }, Ha = { class: "absolute top-3 left-3 z-20" }, Ja = { class: "px-3 py-2 flex items-center gap-2 border-b border-gray-100" }, Ka = { class: "text-xs text-gray-700 w-9 text-right" }, Xa = { class: "px-3 py-2 flex items-center gap-2" }, Ga = {
765
+ for: "show-layer",
766
+ class: "text-xs text-gray-700 flex items-center gap-1 cursor-pointer"
767
+ }, Wa = {
768
+ key: 2,
769
+ class: "absolute bottom-4 left-1/2 z-30 -translate-x-1/2 rounded-2xl border border-sky-200 bg-white/95 px-4 py-2 text-xs font-medium text-slate-700 shadow-lg backdrop-blur"
770
+ }, eo = { class: "flex-1 flex flex-col h-full" }, to = {
771
+ key: 0,
772
+ class: "px-3 pt-3 pb-2 border-b border-gray-100"
773
+ }, ao = ["aria-selected", "onClick"], oo = { class: "leading-none" }, no = { class: "flex flex-col flex-1 overflow-y-hidden p-3" }, lo = {
774
+ key: 0,
775
+ class: "flex-1 flex items-center justify-center text-sm text-gray-500"
776
+ }, so = "cartocss-demo-001", ro = "OpenGIS", Ie = 2, fe = 5, uo = 5, _o = /* @__PURE__ */ U({
777
+ __name: "cartocss",
778
+ setup($) {
779
+ const r = _t(), n = wt(), k = b(null), _ = B(() => {
780
+ var t;
781
+ const e = (t = n.matched[n.matched.length - 1]) == null ? void 0 : t.path;
782
+ return (typeof e == "string" && e ? e : n.path).replace(/\/:id\??$/, "") || "/";
783
+ }), v = B(() => {
784
+ var a;
785
+ const e = (a = n.meta) == null ? void 0 : a.title;
786
+ return typeof e == "string" && e.trim() ? e : "CartoCSS";
787
+ });
788
+ function g() {
789
+ r.push(_.value);
790
+ }
791
+ const y = [
792
+ { key: "css", label: "CSS", icon: Ft },
793
+ { key: "data", label: "Дані", icon: Xt },
794
+ { key: "metadata", label: "Метадані", icon: Qt },
795
+ { key: "card", label: "Картка", icon: Nt }
796
+ ], h = y.map((e) => e.key), u = b(
797
+ h.includes(n.query.tab) ? n.query.tab : "css"
798
+ ), s = b(!0), m = b(null), z = B(
799
+ () => {
800
+ var e;
801
+ return (e = m.value) != null && e.source_path ? y.filter((a) => a.key === "card" || a.key === "metadata") : y;
802
+ }
803
+ ), p = B(
804
+ () => n.params.id || so
805
+ ), w = b({
806
+ id: p.value,
807
+ name: "",
808
+ description: ""
809
+ });
810
+ let C = null;
811
+ const i = b(!1);
812
+ function o(e) {
813
+ if (Array.isArray(e)) return o(e[0]);
814
+ if (typeof e != "string" && typeof e != "number") return null;
815
+ const a = typeof e == "number" ? e : Number(e.trim());
816
+ return Number.isFinite(a) ? a : null;
817
+ }
818
+ function c(e, a) {
819
+ return e.toFixed(a);
820
+ }
821
+ function R(e, a, t) {
822
+ const d = 0.5 * 10 ** -t;
823
+ return Math.abs(e - a) > d;
824
+ }
825
+ function V() {
826
+ var e;
827
+ return (e = k.value) == null ? void 0 : e.ctx;
828
+ }
829
+ function M() {
830
+ var L, T, J, Z;
831
+ const e = (T = (L = V()) == null ? void 0 : L.map) == null ? void 0 : T.value;
832
+ if (!e) return;
833
+ const a = o(n.query.z), t = o(n.query.x), d = o(n.query.y);
834
+ if (a == null || t == null || d == null) return;
835
+ const f = (J = e.getCenter) == null ? void 0 : J.call(e), E = (Z = e.getZoom) == null ? void 0 : Z.call(e);
836
+ (!f || R(f.lng, t, fe) || R(f.lat, d, fe) || R(E ?? 0, a, Ie)) && (i.value = !0, e.jumpTo({ center: [t, d], zoom: a }), i.value = !1);
837
+ }
838
+ function K() {
839
+ var f, E, F, L;
840
+ if (i.value) return;
841
+ const e = (E = (f = V()) == null ? void 0 : f.map) == null ? void 0 : E.value;
842
+ if (!e) return;
843
+ const a = (F = e.getCenter) == null ? void 0 : F.call(e), t = (L = e.getZoom) == null ? void 0 : L.call(e);
844
+ if (!a || t == null) return;
845
+ const d = {
846
+ ...n.query,
847
+ z: c(t, Ie),
848
+ x: c(a.lng, fe),
849
+ y: c(a.lat, fe)
850
+ };
851
+ n.query.z === d.z && n.query.x === d.x && n.query.y === d.y || r.replace({ query: d });
852
+ }
853
+ function Q(e) {
854
+ typeof document > "u" || (document.title = e ? `${e} — CartoCSS` : ro);
855
+ }
856
+ const ne = b(""), le = b([]), ye = b(!1), se = b(!1), ge = b(""), he = b(0), X = b(!0), re = b(1), Y = b(!1), ee = b(null), H = b(!1), be = b(null), ue = b(
857
+ []
858
+ ), xe = b(!1), Ve = b("general");
859
+ function Je(e) {
860
+ ue.value = e;
861
+ }
862
+ function Ke(e) {
863
+ var a;
864
+ (a = be.value) == null || a.addPoint(e);
865
+ }
866
+ function ze() {
867
+ var e;
868
+ ue.value = [], xe.value = !1, (e = be.value) == null || e.clearPoints(), H.value = !1;
869
+ }
870
+ function Xe() {
871
+ if (H.value) {
872
+ ze();
873
+ return;
874
+ }
875
+ H.value = !0;
876
+ }
877
+ const Ge = B(() => `cartocss-layer-${p.value}`), We = B(
878
+ () => `${Math.round(re.value * 100)}%`
879
+ ), et = B(
880
+ () => `cartocss-extent-${p.value}`
881
+ ), tt = B(
882
+ () => `cartocss-extent-draft-${p.value}`
883
+ ), Re = B(() => {
884
+ var f;
885
+ const e = (f = ge.value) == null ? void 0 : f.trim();
886
+ if (!e) return "";
887
+ const a = e.includes("?") ? "&" : "?", t = `${e}${a}nottl=1`, d = he.value;
888
+ return d ? `${e}${a}ts=${d}&nocache=1` : t;
889
+ }), Be = b(""), Pe = b(""), Te = B(() => {
890
+ var E;
891
+ const e = (E = m.value) == null ? void 0 : E.bounds;
892
+ if (!Array.isArray(e) || e.length < 4) return null;
893
+ const [a, t, d, f] = e;
894
+ return [a, t, d, f].some(
895
+ (F) => typeof F != "number" || Number.isNaN(F)
896
+ ) ? null : [(a + d) / 2, (t + f) / 2];
897
+ }), at = B(() => {
898
+ var E;
899
+ const e = (E = m.value) == null ? void 0 : E.bounds;
900
+ if (!Array.isArray(e) || e.length < 4) return null;
901
+ const [a, t, d, f] = e;
902
+ return [a, t, d, f].some(
903
+ (F) => typeof F != "number" || Number.isNaN(F)
904
+ ) ? null : [a, t, d, f];
905
+ }), _e = B(() => {
906
+ const e = m.value;
907
+ return e ? [
908
+ e.description,
909
+ e.group_id ? `Група: ${e.group_id}` : null,
910
+ e.source_path ? `Шлях: ${e.source_path}` : null,
911
+ e.is_public === !0 ? "Публічний" : "Не публічний",
912
+ e.enabled === !0 ? "Активний" : "Неактивний"
913
+ ].filter(Boolean).join(", ") : "";
914
+ }), Ae = B(() => {
915
+ var a;
916
+ const e = (a = m.value) == null ? void 0 : a.group_id;
917
+ return e ? String(e).toUpperCase() : "";
918
+ });
919
+ let G = null, te = !1, W = null;
920
+ function ie(e) {
921
+ return Number(e.toFixed(uo));
922
+ }
923
+ function Fe(e, a) {
924
+ const [t, d] = e, [f, E] = a;
925
+ return [
926
+ ie(Math.min(t, f)),
927
+ ie(Math.min(d, E)),
928
+ ie(Math.max(t, f)),
929
+ ie(Math.max(d, E))
930
+ ];
931
+ }
932
+ function ot(e) {
933
+ const [a, t, d, f] = e;
934
+ return {
935
+ type: "Polygon",
936
+ coordinates: [
937
+ [
938
+ [a, t],
939
+ [d, t],
940
+ [d, f],
941
+ [a, f],
942
+ [a, t]
943
+ ]
944
+ ]
945
+ };
946
+ }
947
+ function we(e) {
948
+ var d, f, E;
949
+ const a = (f = (d = V()) == null ? void 0 : d.map) == null ? void 0 : f.value, t = (E = a == null ? void 0 : a.getCanvas) == null ? void 0 : E.call(a);
950
+ t != null && t.style && (t.style.cursor = e);
951
+ }
952
+ async function nt(e, a) {
953
+ if (!(!p.value || !m.value)) {
954
+ se.value = !0;
955
+ try {
956
+ const t = ot(e), d = await fetch(`/api/gis-css/${p.value}`, {
957
+ method: "POST",
958
+ headers: { "Content-Type": "application/json" },
959
+ body: JSON.stringify({ geom: t })
960
+ });
961
+ if (!d.ok)
962
+ throw new Error(`Failed to save cartocss bounds: ${d.status}`);
963
+ D({
964
+ type: "success",
965
+ title: "Bounds збережено",
966
+ message: "Нові межі успішно збережено."
967
+ }), await ce(p.value, { bustCache: !0 });
968
+ } catch (t) {
969
+ console.error("Failed to save CartoCSS bounds", t), m.value && (m.value = {
970
+ ...m.value,
971
+ bounds: a ? [...a] : null
972
+ }), D({
973
+ type: "error",
974
+ title: "Помилка",
975
+ message: "Не вдалося зберегти Bounds"
976
+ });
977
+ } finally {
978
+ se.value = !1;
979
+ }
980
+ }
981
+ }
982
+ function Ne(e) {
983
+ var t, d, f;
984
+ const a = (d = (t = V()) == null ? void 0 : t.map) == null ? void 0 : d.value;
985
+ if ((f = a == null ? void 0 : a.dragPan) != null && f.enable && a.dragPan.enable(), (e == null ? void 0 : e.length) === 4 && m.value) {
986
+ const E = Array.isArray(m.value.bounds) ? [...m.value.bounds] : null;
987
+ m.value = {
988
+ ...m.value,
989
+ bounds: [...e]
990
+ }, nt(e, E);
991
+ }
992
+ G = null, te = !1, ee.value = null, Y.value = !1, we("");
993
+ }
994
+ function ke() {
995
+ Ne(null);
996
+ }
997
+ function lt() {
998
+ var E, F;
999
+ const e = (F = (E = V()) == null ? void 0 : E.map) == null ? void 0 : F.value;
1000
+ if (!e) return;
1001
+ const a = (L) => {
1002
+ var J, Z, de;
1003
+ if (!Y.value || ((J = L == null ? void 0 : L.originalEvent) == null ? void 0 : J.button) != null && L.originalEvent.button !== 0)
1004
+ return;
1005
+ const T = L == null ? void 0 : L.lngLat;
1006
+ T && (G = [T.lng, T.lat], te = !0, ee.value = [T.lng, T.lat, T.lng, T.lat], (de = (Z = e.dragPan) == null ? void 0 : Z.disable) == null || de.call(Z));
1007
+ }, t = (L) => {
1008
+ if (!Y.value || !te || !G)
1009
+ return;
1010
+ const T = L == null ? void 0 : L.lngLat;
1011
+ T && (ee.value = Fe(G, [
1012
+ T.lng,
1013
+ T.lat
1014
+ ]));
1015
+ }, d = (L) => {
1016
+ if (!Y.value || !te || !G)
1017
+ return;
1018
+ const T = L == null ? void 0 : L.lngLat;
1019
+ if (!T) {
1020
+ ke();
1021
+ return;
1022
+ }
1023
+ const J = Fe(G, [
1024
+ T.lng,
1025
+ T.lat
1026
+ ]), [Z, de, ft, mt] = J;
1027
+ if (!(Math.abs(ft - Z) > 0 && Math.abs(mt - de) > 0)) {
1028
+ D({
1029
+ type: "warning",
1030
+ title: "Bounds не змінено",
1031
+ message: "Потрібно протягнути прямокутник з ненульовою площею."
1032
+ }), ke();
1033
+ return;
1034
+ }
1035
+ Ne(J);
1036
+ }, f = (L) => {
1037
+ Y.value && L.key === "Escape" && (L.preventDefault(), ke());
1038
+ };
1039
+ e.on("mousedown", a), e.on("mousemove", t), e.on("mouseup", d), window.addEventListener("keydown", f), W = () => {
1040
+ e.off("mousedown", a), e.off("mousemove", t), e.off("mouseup", d), window.removeEventListener("keydown", f);
1041
+ };
1042
+ }
1043
+ async function st() {
1044
+ var t;
1045
+ const e = V();
1046
+ !(e != null && e.ready) || (await e.ready(), !((t = e.map) == null ? void 0 : t.value)) || (W || lt(), Y.value = !0, te = !1, G = null, ee.value = null, we("crosshair"), D({
1047
+ type: "info",
1048
+ title: "Редагування Bounds",
1049
+ message: "Протягніть прямокутник на карті, щоб задати нові межі."
1050
+ }));
1051
+ }
1052
+ q(
1053
+ p,
1054
+ (e) => {
1055
+ e && ce(e);
1056
+ },
1057
+ { immediate: !0 }
1058
+ ), q(
1059
+ () => {
1060
+ var e;
1061
+ return (e = w.value) == null ? void 0 : e.name;
1062
+ },
1063
+ (e) => Q(e),
1064
+ { immediate: !0 }
1065
+ );
1066
+ async function rt() {
1067
+ var d;
1068
+ const e = V();
1069
+ if (!(e != null && e.ready)) return;
1070
+ await e.ready(), M();
1071
+ const a = (d = e.map) == null ? void 0 : d.value;
1072
+ if (!a) return;
1073
+ const t = () => K();
1074
+ a.on("moveend", t), a.on("zoomend", t), C = () => {
1075
+ a.off("moveend", t), a.off("zoomend", t);
1076
+ };
1077
+ }
1078
+ q(
1079
+ () => [n.query.z, n.query.x, n.query.y],
1080
+ () => {
1081
+ M();
1082
+ }
1083
+ ), Ee(() => {
1084
+ rt();
1085
+ }), ae(() => {
1086
+ C == null || C(), C = null, W == null || W(), W = null, we("");
1087
+ }), q(
1088
+ () => n.query.tab,
1089
+ (e) => {
1090
+ e && z.value.some((a) => a.key === e) && u.value !== e && (u.value = e);
1091
+ }
1092
+ ), q(
1093
+ z,
1094
+ (e) => {
1095
+ e.length && !e.some((a) => a.key === u.value) && (u.value = e[0].key);
1096
+ },
1097
+ { immediate: !0 }
1098
+ ), q(u, (e) => {
1099
+ n.query.tab !== e && z.value.some((a) => a.key === e) && r.replace({ query: { ...n.query, tab: e } });
1100
+ }), q(
1101
+ () => m.value,
1102
+ (e) => {
1103
+ const a = e == null ? void 0 : e.card_html;
1104
+ Be.value = a, Pe.value = e == null ? void 0 : e.card_table;
1105
+ },
1106
+ { immediate: !0 }
1107
+ );
1108
+ function je() {
1109
+ p.value && ce(p.value, { bustCache: !0 });
1110
+ }
1111
+ async function ut(e, a) {
1112
+ if (p.value) {
1113
+ se.value = !0;
1114
+ try {
1115
+ const t = await fetch(`/api/gis-css/${p.value}`, {
1116
+ method: "POST",
1117
+ headers: { "Content-Type": "application/json" },
1118
+ body: JSON.stringify(e)
1119
+ });
1120
+ if (!t.ok) throw new Error(`Failed to save cartocss: ${t.status}`);
1121
+ D({ type: "success", title: "Збережено", message: a }), await ce(p.value, { bustCache: !0 });
1122
+ } catch (t) {
1123
+ console.error("Failed to save CartoCSS", t), D({
1124
+ type: "error",
1125
+ title: "Помилка",
1126
+ message: "Не вдалося зберегти CartoCSS"
1127
+ });
1128
+ } finally {
1129
+ se.value = !1;
1130
+ }
1131
+ }
1132
+ }
1133
+ function it(e) {
1134
+ if (!e) return null;
1135
+ if (typeof e == "string")
1136
+ try {
1137
+ return JSON.parse(e);
1138
+ } catch (a) {
1139
+ return console.warn("Failed to parse CartoCSS config", a), null;
1140
+ }
1141
+ return typeof e == "object" ? e : null;
1142
+ }
1143
+ function ct(e) {
1144
+ const a = Array.isArray(e) ? e : e == null ? void 0 : e.datasets;
1145
+ return Array.isArray(a) ? a.map((t, d) => ({
1146
+ table: (t == null ? void 0 : t.table) || (t == null ? void 0 : t.id) || `dataset_${d + 1}`,
1147
+ query: (t == null ? void 0 : t.query) || "",
1148
+ srid: (t == null ? void 0 : t.srid) || "",
1149
+ gcol: (t == null ? void 0 : t.gcol) || "",
1150
+ key: (t == null ? void 0 : t.key) || (t == null ? void 0 : t.label) || "Без підпису",
1151
+ active: typeof (t == null ? void 0 : t.active) == "boolean" ? t.active : !0,
1152
+ minzoom: typeof (t == null ? void 0 : t.zoom) > "u" ? "" : String(t.zoom),
1153
+ maxzoom: typeof (t == null ? void 0 : t.maxzoom) > "u" ? "" : String(t.maxzoom),
1154
+ columns: (t == null ? void 0 : t.columns) || "",
1155
+ proj4text: (t == null ? void 0 : t.proj4text) || ""
1156
+ })) : [];
1157
+ }
1158
+ async function ce(e, a) {
1159
+ ye.value = !0;
1160
+ try {
1161
+ const t = await fetch(`/api/gis-css/${e}`);
1162
+ if (!t.ok) throw new Error(`Failed to load cartocss: ${t.status}`);
1163
+ const d = await t.json(), f = (d == null ? void 0 : d.message) || d || {};
1164
+ m.value = f, w.value = {
1165
+ id: f.cartocss_key || e,
1166
+ name: f.name || w.value.name,
1167
+ description: f.description || w.value.description
1168
+ }, ne.value = typeof f.style == "string" ? f.style : "";
1169
+ const E = it(f.config ?? []);
1170
+ le.value = ct(E);
1171
+ const F = typeof f.url == "string" ? f.url : "";
1172
+ ge.value = F, X.value = !!(F && f.enabled !== !1), he.value = a != null && a.bustCache ? Date.now() : 0;
1173
+ } catch (t) {
1174
+ console.error("Failed to fetch CartoCSS", t), X.value = !1, ge.value = "", he.value = 0, m.value = null;
1175
+ } finally {
1176
+ ye.value = !1;
1177
+ }
1178
+ }
1179
+ async function Oe() {
1180
+ await ut(
1181
+ {
1182
+ style: ne.value || "",
1183
+ config: le.value
1184
+ },
1185
+ "CartoCSS оновлено"
1186
+ );
1187
+ }
1188
+ async function dt(e) {
1189
+ const a = await fetch(`/api/gis-css/${p.value}`, {
1190
+ method: "POST",
1191
+ headers: { "Content-Type": "application/json" },
1192
+ body: JSON.stringify(e)
1193
+ });
1194
+ if (!a.ok) throw new Error(`Failed to save cartocss: ${a.status}`);
1195
+ D({
1196
+ type: "success",
1197
+ title: "Збережено",
1198
+ message: "Картка CartoCSS оновлена"
1199
+ });
1200
+ }
1201
+ return (e, a) => (x(), P("div", za, [
1202
+ l("div", Ra, [
1203
+ l("div", Ba, [
1204
+ l("div", Pa, [
1205
+ l("div", Ta, [
1206
+ l("div", Aa, [
1207
+ l("div", Fa, [
1208
+ l("button", {
1209
+ type: "button",
1210
+ class: "hover:text-gray-700 cursor-pointer transition-colors",
1211
+ onClick: g
1212
+ }, O(v.value), 1),
1213
+ a[7] || (a[7] = l("svg", {
1214
+ xmlns: "http://www.w3.org/2000/svg",
1215
+ width: "24",
1216
+ height: "24",
1217
+ viewBox: "0 0 24 24",
1218
+ fill: "none",
1219
+ stroke: "currentColor",
1220
+ "stroke-width": "2",
1221
+ "stroke-linecap": "round",
1222
+ "stroke-linejoin": "round",
1223
+ class: "lucide lucide-chevron-right w-4 h-4 mx-1"
1224
+ }, [
1225
+ l("path", { d: "m9 18 6-6-6-6" })
1226
+ ], -1)),
1227
+ l("span", Na, O(w.value.name || "CartoCSS"), 1)
1228
+ ]),
1229
+ l("div", ja, [
1230
+ l("div", Oa, [
1231
+ l("div", Da, [
1232
+ l("h1", Ua, O(w.value.name || "CartoCSS"), 1),
1233
+ Ae.value ? (x(), P("div", qa, [
1234
+ l("span", Za, O(Ae.value), 1)
1235
+ ])) : N("", !0)
1236
+ ]),
1237
+ _e.value ? (x(), P("p", {
1238
+ key: 0,
1239
+ class: "text-xs text-gray-500 truncate",
1240
+ title: _e.value
1241
+ }, O(_e.value), 9, Ia)) : N("", !0)
1242
+ ])
1243
+ ])
1244
+ ]),
1245
+ S(jt, {
1246
+ class: "flex-shrink-0",
1247
+ "entity-id": p.value,
1248
+ "entity-info": w.value,
1249
+ "form-endpoint": (t) => `/api/form/gis.cartocss.table/${t}`,
1250
+ "save-endpoint": (t) => `/api/gis-css/${t}`,
1251
+ "entity-label": "CartoCSS",
1252
+ "save-method": "post",
1253
+ onSaved: je
1254
+ }, null, 8, ["entity-id", "entity-info", "form-endpoint", "save-endpoint"])
1255
+ ])
1256
+ ])
1257
+ ]),
1258
+ l("div", Qa, [
1259
+ l("div", Ya, [
1260
+ S(Rt, {
1261
+ ref_key: "mapViewRef",
1262
+ ref: k
1263
+ }, {
1264
+ default: j(() => {
1265
+ var t, d;
1266
+ return [
1267
+ l("div", Ha, [
1268
+ S(Bt, null, {
1269
+ default: j(() => [
1270
+ l("div", Ja, [
1271
+ a[8] || (a[8] = l("span", { class: "text-xs text-gray-600 whitespace-nowrap" }, "Прозорість:", -1)),
1272
+ Ue(l("input", {
1273
+ type: "range",
1274
+ min: "0",
1275
+ max: "1",
1276
+ step: "0.01",
1277
+ "onUpdate:modelValue": a[0] || (a[0] = (f) => re.value = f),
1278
+ class: "flex-1 h-1 accent-blue-600",
1279
+ style: { "accent-color": "rgb(30, 78, 216)" }
1280
+ }, null, 512), [
1281
+ [
1282
+ ht,
1283
+ re.value,
1284
+ void 0,
1285
+ { number: !0 }
1286
+ ]
1287
+ ]),
1288
+ l("span", Ka, O(We.value), 1)
1289
+ ]),
1290
+ l("div", Xa, [
1291
+ Ue(l("input", {
1292
+ id: "show-layer",
1293
+ type: "checkbox",
1294
+ class: "rounded",
1295
+ "onUpdate:modelValue": a[1] || (a[1] = (f) => X.value = f),
1296
+ style: { "accent-color": "rgb(30, 78, 216)" }
1297
+ }, null, 512), [
1298
+ [bt, X.value]
1299
+ ]),
1300
+ l("label", Ga, [
1301
+ X.value ? (x(), A(I($t), {
1302
+ key: 0,
1303
+ class: "w-3.5 h-3.5"
1304
+ })) : (x(), A(I(Lt), {
1305
+ key: 1,
1306
+ class: "w-3.5 h-3.5"
1307
+ })),
1308
+ a[9] || (a[9] = Le(" Показати шар ", -1))
1309
+ ])
1310
+ ])
1311
+ ]),
1312
+ _: 1
1313
+ })
1314
+ ]),
1315
+ S(Ot, null, {
1316
+ default: j(() => [
1317
+ S(Dt),
1318
+ S(Ut),
1319
+ S(qt),
1320
+ S(qe),
1321
+ Te.value ? (x(), A(qe, {
1322
+ key: 0,
1323
+ targetCenter: Te.value,
1324
+ targetLabel: "Центр даних",
1325
+ targetAriaLabel: "Перейти до центру даних"
1326
+ }, null, 8, ["targetCenter"])) : N("", !0),
1327
+ S(ya),
1328
+ S(ga),
1329
+ S(Ea, {
1330
+ active: H.value,
1331
+ onClick: Xe
1332
+ }, null, 8, ["active"]),
1333
+ S(La)
1334
+ ]),
1335
+ _: 1
1336
+ }),
1337
+ H.value ? (x(), A(Pt, {
1338
+ key: 0,
1339
+ ref_key: "rulerPanelRef",
1340
+ ref: be,
1341
+ onClose: ze,
1342
+ onTabChange: a[2] || (a[2] = (f) => Ve.value = f),
1343
+ onPointsChange: Je,
1344
+ onShapeClosedChange: a[3] || (a[3] = (f) => xe.value = f)
1345
+ }, null, 512)) : N("", !0),
1346
+ H.value && ue.value.length > 0 ? (x(), A(Tt, {
1347
+ key: 1,
1348
+ points: ue.value,
1349
+ "is-shape-closed": xe.value,
1350
+ "label-mode": Ve.value
1351
+ }, null, 8, ["points", "is-shape-closed", "label-mode"])) : N("", !0),
1352
+ S(Va, {
1353
+ active: H.value,
1354
+ onMapClick: Ke
1355
+ }, null, 8, ["active"]),
1356
+ Y.value ? (x(), P("div", Wa, " Потягніть на карті, щоб намалювати нові Bounds. Esc скасовує редагування. ")) : N("", !0),
1357
+ Re.value ? (x(), A(ma, {
1358
+ key: 3,
1359
+ "layer-id": Ge.value,
1360
+ "tile-url": Re.value,
1361
+ active: X.value,
1362
+ opacity: re.value,
1363
+ title: w.value.name,
1364
+ owner: p.value
1365
+ }, null, 8, ["layer-id", "tile-url", "active", "opacity", "title", "owner"])) : N("", !0),
1366
+ S(Ze, {
1367
+ extent: at.value,
1368
+ "layer-id": et.value
1369
+ }, null, 8, ["extent", "layer-id"]),
1370
+ S(Ze, {
1371
+ extent: ee.value,
1372
+ "layer-id": tt.value,
1373
+ "line-color": "#0ea5e9",
1374
+ "line-width": 3
1375
+ }, null, 8, ["extent", "layer-id"]),
1376
+ S(pa, {
1377
+ "cartocss-id": p.value,
1378
+ bounds: ((t = m.value) == null ? void 0 : t.bounds) ?? null,
1379
+ active: X.value && !Y.value && !H.value,
1380
+ "info-enabled": (d = m.value) == null ? void 0 : d.info
1381
+ }, null, 8, ["cartocss-id", "bounds", "active", "info-enabled"]),
1382
+ S(At, { "map-id": p.value }, null, 8, ["map-id"])
1383
+ ];
1384
+ }),
1385
+ _: 1
1386
+ }, 512)
1387
+ ])
1388
+ ]),
1389
+ m.value ? (x(), A(Zt, {
1390
+ key: 0,
1391
+ open: s.value,
1392
+ onToggle: a[4] || (a[4] = (t) => s.value = !s.value)
1393
+ }, null, 8, ["open"])) : N("", !0)
1394
+ ]),
1395
+ m.value ? (x(), P("div", {
1396
+ key: 0,
1397
+ class: pe(["bg-white border-l border-gray-100 flex flex-col overflow-hidden shadow-lg flex-shrink-0 transition-[width] duration-100 ease-in-out", s.value ? "w-[650px]" : "w-0"])
1398
+ }, [
1399
+ l("div", eo, [
1400
+ z.value.length > 1 ? (x(), P("div", to, [
1401
+ l("div", {
1402
+ class: "items-center justify-center text-muted-foreground grid w-full h-12 p-1 bg-gray-50 rounded-xl shadow-sm",
1403
+ style: $e({
1404
+ gridTemplateColumns: `repeat(${z.value.length}, minmax(0, 1fr))`
1405
+ })
1406
+ }, [
1407
+ (x(!0), P(me, null, Qe(z.value, (t) => (x(), P("button", {
1408
+ key: t.key,
1409
+ type: "button",
1410
+ role: "tab",
1411
+ "aria-selected": u.value === t.key,
1412
+ class: pe([
1413
+ "whitespace-nowrap flex flex-col items-center justify-center gap-0.5 py-1 px-1 text-[9px] font-medium transition-all duration-300 hover:bg-white/70 rounded-lg group",
1414
+ u.value === t.key ? "bg-white shadow-sm text-gray-700" : ""
1415
+ ]),
1416
+ onClick: (d) => u.value = t.key
1417
+ }, [
1418
+ (x(), A(xt(t.icon), { class: "h-3.5 w-3.5 mb-0.5" })),
1419
+ l("span", oo, O(t.label), 1)
1420
+ ], 10, ao))), 128))
1421
+ ], 4)
1422
+ ])) : N("", !0),
1423
+ l("div", no, [
1424
+ ye.value ? (x(), P("div", lo, " Завантаження стилю… ")) : (x(), P(me, { key: 1 }, [
1425
+ u.value === "css" ? (x(), A(ea, {
1426
+ key: 0,
1427
+ modelValue: ne.value,
1428
+ "onUpdate:modelValue": a[5] || (a[5] = (t) => ne.value = t),
1429
+ class: "flex-1 min-h-0",
1430
+ onSave: Oe
1431
+ }, null, 8, ["modelValue"])) : u.value === "data" ? (x(), A(ia, {
1432
+ key: 1,
1433
+ modelValue: le.value,
1434
+ "onUpdate:modelValue": a[6] || (a[6] = (t) => le.value = t),
1435
+ class: "flex-1 min-h-0 flex flex-col",
1436
+ onSave: Oe
1437
+ }, null, 8, ["modelValue"])) : u.value === "card" ? (x(), A(fa, {
1438
+ key: 2,
1439
+ card: Be.value,
1440
+ table: Pe.value,
1441
+ class: "flex-1 min-h-0",
1442
+ onSave: dt
1443
+ }, null, 8, ["card", "table"])) : u.value === "metadata" ? (x(), A(It, {
1444
+ key: 3,
1445
+ data: m.value,
1446
+ "entity-id": p.value,
1447
+ "entity-type": "css",
1448
+ onSaved: je,
1449
+ onEditCssBounds: st
1450
+ }, null, 8, ["data", "entity-id"])) : N("", !0)
1451
+ ], 64))
1452
+ ])
1453
+ ])
1454
+ ], 2)) : N("", !0)
1455
+ ]));
1456
+ }
1457
+ });
1458
+ export {
1459
+ _o as default
1460
+ };