@opengis/gis 0.2.128 → 0.2.130

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 (25) hide show
  1. package/dist/{CardIcon-DgpYeKbG.js → CardIcon-BeZkp0PF.js} +1 -1
  2. package/dist/{EntityTablePage-DNdVavT4.js → EntityTablePage-A1oEJgB4.js} +1 -1
  3. package/dist/{ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-DQnIBCpE.js → ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-Wr8oJ-ni.js} +24 -22
  4. package/dist/{HeaderActions.vue_vue_type_script_setup_true_lang-Cg2y4sIa.js → HeaderActions.vue_vue_type_script_setup_true_lang-6BnXldBs.js} +345 -321
  5. package/dist/{MapSettings-CHF3VpUu.js → MapSettings-EmXkXJ90.js} +12 -12
  6. package/dist/{RastersTablePage-Ci3P3r4c.js → RastersTablePage-Cgecxbky.js} +1 -1
  7. package/dist/cartocss-C29B9mz3.js +1024 -0
  8. package/dist/{import-utils-ElncWVJV.js → import-utils-CFjQD50e.js} +1 -1
  9. package/dist/{index-UGx54M0Q.js → index-1vaLWtnh.js} +377 -386
  10. package/dist/index.css +1 -1
  11. package/dist/index.js +4 -4
  12. package/dist/index.umd.cjs +41 -41
  13. package/dist/raster-DFuH49fc.js +792 -0
  14. package/dist/{register-BfNUPbey.js → register-COO0Y_MS.js} +3 -3
  15. package/dist/{service-DsykdHry.js → service-DagZaIev.js} +911 -879
  16. package/dist/{vs-datatable-D6g7tjZo.js → vs-datatable-BaMRTZVi.js} +1 -1
  17. package/package.json +2 -2
  18. package/server/routes/gis/cartocss/get.cartocss.js +11 -2
  19. package/server/routes/gis/registers/add.registry.js +3 -4
  20. package/server/routes/gis/registers/funcs/columns.js +2 -4
  21. package/server/routes/mapnik/controllers/pretile.js +6 -7
  22. package/server/routes/mapnik/controllers/rasterInfo.js +5 -1
  23. package/server/routes/mapnik/functions/cartoBounds.js +6 -2
  24. package/dist/cartocss-BsaIlSRb.js +0 -894
  25. package/dist/raster-BDWEafwx.js +0 -663
@@ -1,894 +0,0 @@
1
- import { openBlock as b, createElementBlock as $, createElementVNode as a, defineComponent as F, computed as S, createTextVNode as ve, createVNode as V, mergeModels as Me, defineAsyncComponent as ee, useModel as je, ref as g, withCtx as R, toDisplayString as E, unref as J, watch as N, onUnmounted as Le, createCommentVNode as A, onBeforeUnmount as he, onMounted as qe, withDirectives as Ae, vModelText as Ne, createBlock as T, normalizeClass as fe, normalizeStyle as Ee, Fragment as me, renderList as Te, resolveDynamicComponent as Ue } from "vue";
2
- import { useRouter as Ie, useRoute as De } from "vue-router";
3
- import { notify as P } from "@opengis/core";
4
- import { _ as Oe, f as ge, n as Re, o as Fe, p as Be, M as Pe, i as Qe, j as pe, m as He } from "./index-UGx54M0Q.js";
5
- import { S as Ye, C as Je } from "./CardIcon-DgpYeKbG.js";
6
- import { _ as We, a as Xe, b as Ge, c as Ze } from "./HeaderActions.vue_vue_type_script_setup_true_lang-Cg2y4sIa.js";
7
- import { _ as xe } from "./MonacoEditor.vue_vue_type_script_setup_true_lang-D3ZPeXMw.js";
8
- import { V as Ke } from "./vs-datatable-D6g7tjZo.js";
9
- import { _ as et } from "./ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-DQnIBCpE.js";
10
- const tt = {}, ot = {
11
- xmlns: "http://www.w3.org/2000/svg",
12
- width: "24",
13
- height: "24",
14
- viewBox: "0 0 24 24",
15
- fill: "none",
16
- stroke: "currentColor",
17
- "stroke-width": "2",
18
- "stroke-linecap": "round",
19
- "stroke-linejoin": "round",
20
- class: "lucide lucide-table"
21
- };
22
- function at(L, l) {
23
- return b(), $("svg", ot, [...l[0] || (l[0] = [
24
- a("path", { d: "M12 3v18" }, null, -1),
25
- a("rect", {
26
- width: "18",
27
- height: "18",
28
- x: "3",
29
- y: "3",
30
- rx: "2"
31
- }, null, -1),
32
- a("path", { d: "M3 9h18" }, null, -1),
33
- a("path", { d: "M3 15h18" }, null, -1)
34
- ])]);
35
- }
36
- const nt = /* @__PURE__ */ Oe(tt, [["render", at]]), st = { class: "flex flex-col h-full" }, lt = { class: "flex justify-end mb-3 gap-2" }, rt = /* @__PURE__ */ F({
37
- __name: "cartocss-css-tab",
38
- props: {
39
- modelValue: {}
40
- },
41
- emits: ["update:modelValue", "save"],
42
- setup(L, { emit: l }) {
43
- const u = L, z = l, _ = S({
44
- get: () => u.modelValue,
45
- set: (h) => z("update:modelValue", h)
46
- });
47
- return (h, i) => (b(), $("div", st, [
48
- a("div", lt, [
49
- a("button", {
50
- type: "button",
51
- 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",
52
- onClick: i[0] || (i[0] = (d) => h.$emit("save"))
53
- }, [...i[2] || (i[2] = [
54
- a("svg", {
55
- xmlns: "http://www.w3.org/2000/svg",
56
- width: "24",
57
- height: "24",
58
- viewBox: "0 0 24 24",
59
- fill: "none",
60
- stroke: "currentColor",
61
- "stroke-width": "2",
62
- "stroke-linecap": "round",
63
- "stroke-linejoin": "round",
64
- class: "h-3.5 w-3.5"
65
- }, [
66
- a("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" }),
67
- a("path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a 1 1 0 0 0-1 1v7" }),
68
- a("path", { d: "M7 3v4a1 1 0 0 0 1 1h7" })
69
- ], -1),
70
- ve(" Зберегти ", -1)
71
- ])])
72
- ]),
73
- V(xe, {
74
- modelValue: _.value,
75
- "onUpdate:modelValue": i[1] || (i[1] = (d) => _.value = d),
76
- language: "cartocss",
77
- class: "flex-1 rounded-lg overflow-hidden"
78
- }, null, 8, ["modelValue"])
79
- ]));
80
- }
81
- }), ut = { class: "flex flex-col flex-1 min-h-0" }, it = { class: "flex justify-between mb-3 gap-2" }, ct = { class: "text-left" }, dt = { class: "font-medium text-gray-900" }, ft = { class: "text-xs text-gray-500" }, mt = { class: "flex justify-center gap-2" }, pt = ["checked", "onChange"], yt = { class: "text-sm font-medium text-gray-900" }, vt = /* @__PURE__ */ F({
82
- __name: "cartocss-data-tab",
83
- props: {
84
- modelValue: { default: [] },
85
- modelModifiers: {}
86
- },
87
- emits: /* @__PURE__ */ Me(["save"], ["update:modelValue"]),
88
- setup(L, { emit: l }) {
89
- const u = [
90
- { key: "table", label: "Таблиця", slot: "datasetCell" },
91
- {
92
- key: "active",
93
- label: "Активний",
94
- slot: "activeCell",
95
- width: "140px"
96
- },
97
- {
98
- key: "zoom",
99
- label: "Min Зум",
100
- slot: "zoomCell",
101
- width: "140px"
102
- }
103
- ], z = ee(
104
- () => import("@opengis/core").then((x) => x.VsModal)
105
- ), _ = ee(() => import("@opengis/form")), h = je(L, "modelValue"), i = l, d = g(!1), s = g({
106
- table: "",
107
- query: "",
108
- srid: "",
109
- key: "",
110
- columns: "",
111
- minzoom: "",
112
- maxzoom: "",
113
- proj4text: "",
114
- active: !0
115
- }), m = {
116
- table: { type: "text", label: "Таблиця", validators: ["required"] },
117
- key: { type: "text", label: "Ключ", validators: ["required"] },
118
- query: { type: "text", label: "Query" },
119
- columns: { type: "text", label: "Колонки" },
120
- srid: { type: "number", label: "SRID" },
121
- proj4text: { type: "text", label: "PROJ4" },
122
- active: { type: "switcher", label: "Активна" },
123
- minzoom: { type: "number", label: "Min Зум", col: 6 },
124
- maxzoom: { type: "number", label: "Max Зум", col: 6 }
125
- };
126
- function n() {
127
- s.value = {
128
- table: "",
129
- query: "",
130
- srid: "",
131
- key: "",
132
- columns: "",
133
- minzoom: "",
134
- maxzoom: "",
135
- proj4text: "",
136
- active: !0
137
- }, d.value = !0;
138
- }
139
- function k() {
140
- d.value = !1;
141
- }
142
- function q() {
143
- var f, w;
144
- const x = (f = s.value.table) == null ? void 0 : f.trim(), v = (w = s.value.key) == null ? void 0 : w.trim();
145
- if (!x || !v) {
146
- P({
147
- type: "warning",
148
- title: "Перевірка",
149
- message: "Вкажіть таблицю та підпис"
150
- });
151
- return;
152
- }
153
- h.value = [
154
- ...Array.isArray(h.value) ? h.value : [],
155
- { ...s.value, table: x, key: v }
156
- ], d.value = !1;
157
- }
158
- function p(x, v) {
159
- var w;
160
- const f = ((w = v == null ? void 0 : v.target) == null ? void 0 : w.checked) ?? !1;
161
- x.active = f, h.value = Array.isArray(h.value) ? [...h.value] : [];
162
- }
163
- return (x, v) => (b(), $("div", ut, [
164
- a("div", it, [
165
- a("button", {
166
- type: "button",
167
- 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",
168
- onClick: n
169
- }, " Додати таблицю "),
170
- a("button", {
171
- type: "button",
172
- 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",
173
- onClick: v[0] || (v[0] = (f) => i("save"))
174
- }, " Зберегти ")
175
- ]),
176
- V(Ke, {
177
- modelValue: h.value,
178
- "onUpdate:modelValue": v[1] || (v[1] = (f) => h.value = f),
179
- "columns-scheme": u,
180
- "form-scheme": m,
181
- "add-button": !1,
182
- "main-col-width": "260px"
183
- }, {
184
- datasetCell: R(({ row: f }) => [
185
- a("div", ct, [
186
- a("div", dt, E(f.table), 1),
187
- a("div", ft, E(f.key), 1)
188
- ])
189
- ]),
190
- activeCell: R(({ row: f }) => [
191
- a("label", mt, [
192
- a("input", {
193
- type: "checkbox",
194
- class: "h-4 w-4 text-sky-500 border-gray-300 rounded focus:ring-sky-300",
195
- checked: f.active,
196
- onChange: (w) => p(f, w)
197
- }, null, 40, pt)
198
- ])
199
- ]),
200
- zoomCell: R(({ row: f }) => [
201
- a("div", yt, E(f.zoom), 1)
202
- ]),
203
- _: 1
204
- }, 8, ["modelValue"]),
205
- V(J(z), {
206
- teleport: "#modal",
207
- visible: d.value,
208
- "onUpdate:visible": v[3] || (v[3] = (f) => d.value = f),
209
- title: "Нова таблиця CartoCSS"
210
- }, {
211
- footer: R(() => [
212
- a("div", { class: "flex justify-end gap-2 p-4 border-т" }, [
213
- a("button", {
214
- type: "button",
215
- class: "px-4 py-2 rounded bg-gray-100 text-gray-700",
216
- onClick: k
217
- }, " Скасувати "),
218
- a("button", {
219
- type: "button",
220
- class: "px-4 py-2 rounded bg-blue-600 text-white",
221
- onClick: q
222
- }, " Додати ")
223
- ])
224
- ]),
225
- default: R(() => [
226
- V(J(_), {
227
- values: s.value,
228
- "onUpdate:values": v[2] || (v[2] = (f) => s.value = f),
229
- schema: m
230
- }, null, 8, ["values"])
231
- ]),
232
- _: 1
233
- }, 8, ["visible"])
234
- ]));
235
- }
236
- }), ht = { class: "flex flex-col flex-1 min-h-0 gap-4" }, gt = { class: "h-[calc(100vh-230px)] rounded-md border border-gray-200 bg-white" }, xt = /* @__PURE__ */ F({
237
- __name: "cartocss-card-tab",
238
- props: {
239
- card: {},
240
- table: {}
241
- },
242
- emits: ["save"],
243
- setup(L, { emit: l }) {
244
- const u = L, z = l, _ = g(u.table), h = g(u.card), i = ee(() => import("@opengis/form").then((s) => s.VsInputText));
245
- function d() {
246
- z("save", {
247
- card_html: h.value,
248
- card_table: _.value
249
- });
250
- }
251
- return (s, m) => (b(), $("div", ht, [
252
- a("div", { class: "flex items-center justify-end gap-3" }, [
253
- a("button", {
254
- type: "button",
255
- 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",
256
- onClick: d
257
- }, [...m[2] || (m[2] = [
258
- a("svg", {
259
- xmlns: "http://www.w3.org/2000/svg",
260
- width: "24",
261
- height: "24",
262
- viewBox: "0 0 24 24",
263
- fill: "none",
264
- stroke: "currentColor",
265
- "stroke-width": "2",
266
- "stroke-linecap": "round",
267
- "stroke-linejoin": "round",
268
- class: "h-3.5 w-3.5"
269
- }, [
270
- a("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" }),
271
- a("path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a 1 1 0 0 0-1 1v7" }),
272
- a("path", { d: "M7 3v4a1 1 0 0 0 1 1h7" })
273
- ], -1),
274
- ve(" Зберегти картку ", -1)
275
- ])])
276
- ]),
277
- a("div", null, [
278
- V(J(i), {
279
- modelValue: _.value,
280
- "onUpdate:modelValue": m[0] || (m[0] = (n) => _.value = n)
281
- }, null, 8, ["modelValue"])
282
- ]),
283
- a("div", gt, [
284
- V(xe, {
285
- modelValue: h.value,
286
- "onUpdate:modelValue": m[1] || (m[1] = (n) => h.value = n),
287
- language: "html",
288
- theme: "vs-light",
289
- class: "h-full w-full rounded-md"
290
- }, null, 8, ["modelValue"])
291
- ])
292
- ]));
293
- }
294
- }), bt = /* @__PURE__ */ F({
295
- __name: "CartocssLayerLoader",
296
- props: {
297
- layerId: { type: String, required: !0 },
298
- tileUrl: { type: String, default: "" },
299
- title: { type: String, default: "" },
300
- active: { type: Boolean, default: !1 },
301
- owner: { type: String, default: "" },
302
- opacity: { type: Number, default: 1 }
303
- },
304
- setup(L) {
305
- const l = L, u = ge(), {
306
- activateTemporaryLayer: z,
307
- deactivateTemporaryLayer: _,
308
- setTemporaryLayerOpacity: h
309
- } = Re(u.map), i = S(() => {
310
- var k;
311
- const n = `${(k = l == null ? void 0 : l.tileUrl) == null ? void 0 : k.trim()}`;
312
- return n ? typeof window > "u" || typeof location > "u" || /^https?:\/\//i.test(n) ? n : n.startsWith("//") ? `${window.location.protocol}${n}` : n.startsWith("/") ? `${location.origin}${n}` : `${location.origin}/${n}` : "";
313
- });
314
- let d = "", s = "";
315
- function m() {
316
- const n = l.active && !!i.value;
317
- d && (!n || d !== l.layerId) && (_(d, s || void 0), d = "", s = ""), n && (z(
318
- {
319
- id: l.layerId,
320
- title: l.title || l.layerId,
321
- url: i.value,
322
- opacity: l.opacity
323
- },
324
- {},
325
- l.owner
326
- ), d = l.layerId, s = l.owner || "");
327
- }
328
- return N(
329
- () => [l.layerId, i.value, l.active, l.owner],
330
- m,
331
- { immediate: !0 }
332
- ), N(
333
- () => l.opacity,
334
- (n) => {
335
- !d || !l.active || h(d, n, s || void 0);
336
- },
337
- { immediate: !0 }
338
- ), Le(() => {
339
- d && (_(d, s || void 0), d = "", s = "");
340
- }), (n, k) => A("", !0);
341
- }
342
- }), _t = /* @__PURE__ */ F({
343
- __name: "CartocssMapClickListener",
344
- props: {
345
- cartocssId: {},
346
- infoEnabled: { type: [Boolean, null] }
347
- },
348
- setup(L) {
349
- const l = L, u = S(() => l.cartocssId ?? null), z = S(() => !!l.infoEnabled), { map: _, ready: h } = ge(), i = (p) => {
350
- !p || typeof window > "u" || window.dispatchEvent(
351
- new CustomEvent(Be, { detail: p })
352
- );
353
- }, d = async (p) => {
354
- const x = await fetch(`/api/map-format?${p.toString()}`);
355
- if (!x.ok)
356
- throw new Error(`API returned ${x.status}`);
357
- return x.json();
358
- };
359
- let s = null, m = null;
360
- const n = (p) => {
361
- if (!p) return null;
362
- if (typeof p == "string")
363
- try {
364
- return JSON.parse(p);
365
- } catch {
366
- return null;
367
- }
368
- return p;
369
- }, k = async (p, x) => {
370
- var w;
371
- const v = u.value ? `external:${u.value},${String(p)}` : null, f = new URLSearchParams({
372
- layer: u.value ?? "",
373
- id: String(p)
374
- });
375
- try {
376
- const C = await d(f), U = typeof C.html == "string" ? C.html : null, I = n(
377
- ((w = C == null ? void 0 : C.data) == null ? void 0 : w.geom) ?? (C == null ? void 0 : C.geom) ?? null
378
- );
379
- (U || I) && i({
380
- html: U,
381
- geometry: I ?? x,
382
- infoToken: v
383
- });
384
- } catch (C) {
385
- console.warn("CartoCSS map-format (id) error", C);
386
- }
387
- }, q = async (p) => {
388
- var w, C, U, I;
389
- if (!u.value) return;
390
- if (!z.value) {
391
- P({
392
- type: "error",
393
- title: "CartoCSS",
394
- message: "Картка не налаштована"
395
- });
396
- return;
397
- }
398
- const x = (w = p == null ? void 0 : p.lngLat) == null ? void 0 : w.lng, v = (C = p == null ? void 0 : p.lngLat) == null ? void 0 : C.lat;
399
- if (typeof x != "number" || typeof v != "number") return;
400
- const f = new URLSearchParams({
401
- layer: u.value,
402
- lat: v.toFixed(6),
403
- lng: x.toFixed(6)
404
- });
405
- try {
406
- const y = await d(f), D = n(
407
- ((U = y == null ? void 0 : y.data) == null ? void 0 : U.geom) ?? (y == null ? void 0 : y.geom) ?? null
408
- ), O = ((I = y == null ? void 0 : y.data) == null ? void 0 : I.id) ?? (y == null ? void 0 : y.id);
409
- if (O != null) {
410
- await k(O, D);
411
- return;
412
- }
413
- Fe({ html: y == null ? void 0 : y.html }) && i({
414
- html: y == null ? void 0 : y.html,
415
- geometry: D,
416
- infoToken: null
417
- });
418
- } catch (y) {
419
- console.warn("CartoCSS map-format error", y);
420
- }
421
- };
422
- return h().then(() => {
423
- m = _.value, m && (m.on("click", q), s = () => m == null ? void 0 : m.off("click", q));
424
- }), he(() => {
425
- s == null || s(), s = null, m = null;
426
- }), () => {
427
- };
428
- }
429
- }), wt = { class: "flex h-full bg-gradient-to-br from-slate-50 to-white" }, kt = { class: "flex-1 relative overflow-hidden" }, Ct = { class: "absolute top-0 left-0 w-full z-20" }, St = { class: "px-4 sm:px-6 py-4 border-b border-gray-200 bg-white shadow-sm" }, $t = { class: "flex items-start justify-between gap-4" }, Vt = { class: "flex-1 min-w-0" }, zt = { class: "flex items-center text-sm text-gray-500 mb-3" }, Mt = { class: "text-gray-900 font-medium truncate max-w-xs" }, jt = { class: "flex items-center justify-between gap-4" }, Lt = { class: "flex-1 min-w-0" }, qt = { class: "flex items-center gap-3 mb-1" }, At = { class: "text-base font-semibold text-gray-900 truncate" }, Nt = {
430
- key: 0,
431
- class: "px-2 py-0.5 bg-green-50 border border-green-200 rounded flex-shrink-0"
432
- }, Et = { class: "text-xs font-medium text-green-700" }, Tt = ["title"], Ut = { 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]" }, It = { class: "relative w-full h-full" }, Dt = { class: "absolute top-[5.5rem] left-4 z-30 flex flex-col items-start gap-2" }, Ot = { class: "rounded-2xl bg-white/90 px-3 py-2 text-xs font-medium text-slate-600 shadow-sm backdrop-blur" }, Rt = { class: "flex items-center gap-2" }, Ft = { class: "rounded-2xl bg-white/90 px-3 py-2 text-xs font-medium text-slate-600 shadow-sm backdrop-blur" }, Bt = { class: "inline-flex items-center gap-2 text-[11px] text-slate-600" }, Pt = ["checked"], Qt = { class: "absolute top-4 left-4 z-20" }, Ht = { class: "absolute top-[6.5rem] right-2 space-y-1 z-20" }, Yt = { class: "flex-1 flex flex-col h-full" }, Jt = {
433
- key: 0,
434
- class: "px-3 pt-3 pb-2 border-b border-gray-100"
435
- }, Wt = ["aria-selected", "onClick"], Xt = { class: "leading-none" }, Gt = { class: "flex flex-col flex-1 overflow-y-hidden p-3" }, Zt = {
436
- key: 0,
437
- class: "flex-1 flex items-center justify-center text-sm text-gray-500"
438
- }, Kt = "cartocss-demo-001", eo = "OpenGIS", ye = 2, Y = 5, co = /* @__PURE__ */ F({
439
- __name: "cartocss",
440
- setup(L) {
441
- const l = Ie(), u = De(), z = g(null), _ = [
442
- { key: "css", label: "CSS", icon: Ye },
443
- { key: "data", label: "Дані", icon: nt },
444
- { key: "metadata", label: "Метадані", icon: Ze },
445
- { key: "card", label: "Картка", icon: Je }
446
- ], h = _.map((e) => e.key), i = g(
447
- h.includes(u.query.tab) ? u.query.tab : "css"
448
- ), d = g(!0), s = g(null), m = S(() => {
449
- var e;
450
- return (e = s.value) != null && e.source_path ? _.filter((o) => o.key === "card" || o.key === "metadata") : _;
451
- }), n = S(
452
- () => u.params.id || Kt
453
- ), k = g({
454
- id: n.value,
455
- name: "",
456
- description: ""
457
- });
458
- let q = null;
459
- const p = g(!1);
460
- function x(e) {
461
- if (Array.isArray(e)) return x(e[0]);
462
- if (typeof e != "string" && typeof e != "number") return null;
463
- const o = typeof e == "number" ? e : Number(e.trim());
464
- return Number.isFinite(o) ? o : null;
465
- }
466
- function v(e, o) {
467
- return e.toFixed(o);
468
- }
469
- function f(e, o, t) {
470
- const r = 0.5 * 10 ** -t;
471
- return Math.abs(e - o) > r;
472
- }
473
- function w() {
474
- var e;
475
- return (e = z.value) == null ? void 0 : e.ctx;
476
- }
477
- function C() {
478
- var B, ie, ce, de;
479
- const e = (ie = (B = w()) == null ? void 0 : B.map) == null ? void 0 : ie.value;
480
- if (!e) return;
481
- const o = x(u.query.z), t = x(u.query.x), r = x(u.query.y);
482
- if (o == null || t == null || r == null) return;
483
- const c = (ce = e.getCenter) == null ? void 0 : ce.call(e), M = (de = e.getZoom) == null ? void 0 : de.call(e);
484
- (!c || f(c.lng, t, Y) || f(c.lat, r, Y) || f(M ?? 0, o, ye)) && (p.value = !0, e.jumpTo({ center: [t, r], zoom: o }), p.value = !1);
485
- }
486
- function U() {
487
- var c, M, j, B;
488
- if (p.value) return;
489
- const e = (M = (c = w()) == null ? void 0 : c.map) == null ? void 0 : M.value;
490
- if (!e) return;
491
- const o = (j = e.getCenter) == null ? void 0 : j.call(e), t = (B = e.getZoom) == null ? void 0 : B.call(e);
492
- if (!o || t == null) return;
493
- const r = {
494
- ...u.query,
495
- z: v(t, ye),
496
- x: v(o.lng, Y),
497
- y: v(o.lat, Y)
498
- };
499
- u.query.z === r.z && u.query.x === r.x && u.query.y === r.y || l.replace({ query: r });
500
- }
501
- function I(e) {
502
- typeof document > "u" || (document.title = e ? `${e} — CartoCSS` : eo);
503
- }
504
- const y = g("");
505
- g("");
506
- const D = g([]), O = g(!1), te = g(!1), W = g(""), X = g(0), Q = g(!1), H = g(1), G = g(!0), be = S(() => `cartocss-layer-${n.value}`), _e = S(() => `${Math.round(H.value * 100)}%`), we = S(() => `cartocss-extent-${n.value}`), oe = S(() => {
507
- var c;
508
- const e = (c = W.value) == null ? void 0 : c.trim();
509
- if (!e) return "";
510
- const o = e.includes("?") ? "&" : "?", t = `${e}${o}nottl=1`, r = X.value;
511
- return r ? `${e}${o}ts=${r}&nocache=1` : t;
512
- });
513
- S(() => {
514
- const e = s.value;
515
- return e ? e.cartocss_key || e.source_path || n.value || "" : n.value || "";
516
- });
517
- const ae = g(""), ne = g(""), se = S(() => {
518
- var M;
519
- const e = (M = s.value) == null ? void 0 : M.bounds;
520
- if (!Array.isArray(e) || e.length < 4) return null;
521
- const [o, t, r, c] = e;
522
- return [o, t, r, c].some(
523
- (j) => typeof j != "number" || Number.isNaN(j)
524
- ) ? null : [(o + r) / 2, (t + c) / 2];
525
- }), ke = S(() => {
526
- var M;
527
- const e = (M = s.value) == null ? void 0 : M.bounds;
528
- if (!Array.isArray(e) || e.length < 4) return null;
529
- const [o, t, r, c] = e;
530
- return [o, t, r, c].some(
531
- (j) => typeof j != "number" || Number.isNaN(j)
532
- ) ? null : [o, t, r, c];
533
- }), Z = S(() => {
534
- const e = s.value;
535
- return e ? [
536
- e.description,
537
- e.group_id ? `Група: ${e.group_id}` : null,
538
- e.source_path ? `Шлях: ${e.source_path}` : null,
539
- e.is_public === !0 ? "Публічний" : "Не публічний",
540
- e.enabled === !0 ? "Активний" : "Неактивний"
541
- ].filter(Boolean).join(", ") : "";
542
- }), le = S(() => {
543
- var o;
544
- const e = (o = s.value) == null ? void 0 : o.group_id;
545
- return e ? String(e).toUpperCase() : "";
546
- });
547
- N(
548
- n,
549
- (e) => {
550
- e && K(e);
551
- },
552
- { immediate: !0 }
553
- ), N(
554
- () => {
555
- var e;
556
- return (e = k.value) == null ? void 0 : e.name;
557
- },
558
- (e) => I(e),
559
- { immediate: !0 }
560
- );
561
- async function Ce() {
562
- var r;
563
- const e = w();
564
- if (!(e != null && e.ready)) return;
565
- await e.ready(), C();
566
- const o = (r = e.map) == null ? void 0 : r.value;
567
- if (!o) return;
568
- const t = () => U();
569
- o.on("moveend", t), o.on("zoomend", t), q = () => {
570
- o.off("moveend", t), o.off("zoomend", t);
571
- };
572
- }
573
- N(
574
- () => [u.query.z, u.query.x, u.query.y],
575
- () => {
576
- C();
577
- }
578
- ), qe(() => {
579
- Ce();
580
- }), he(() => {
581
- q == null || q(), q = null;
582
- }), N(
583
- () => u.query.tab,
584
- (e) => {
585
- e && m.value.some((o) => o.key === e) && i.value !== e && (i.value = e);
586
- }
587
- ), N(
588
- m,
589
- (e) => {
590
- e.length && !e.some((o) => o.key === i.value) && (i.value = e[0].key);
591
- },
592
- { immediate: !0 }
593
- ), N(i, (e) => {
594
- u.query.tab !== e && m.value.some((o) => o.key === e) && l.replace({ query: { ...u.query, tab: e } });
595
- }), N(
596
- () => s.value,
597
- (e) => {
598
- const o = e == null ? void 0 : e.card_html;
599
- ae.value = o, ne.value = e == null ? void 0 : e.card_table;
600
- },
601
- { immediate: !0 }
602
- );
603
- function re() {
604
- n.value && K(n.value, { bustCache: !0 });
605
- }
606
- async function Se(e, o) {
607
- if (n.value) {
608
- te.value = !0;
609
- try {
610
- const t = await fetch(`/api/gis-css/${n.value}`, {
611
- method: "POST",
612
- headers: { "Content-Type": "application/json" },
613
- body: JSON.stringify(e)
614
- });
615
- if (!t.ok) throw new Error(`Failed to save cartocss: ${t.status}`);
616
- P({ type: "success", title: "Збережено", message: o }), await K(n.value, { bustCache: !0 });
617
- } catch (t) {
618
- console.error("Failed to save CartoCSS", t), P({ type: "error", title: "Помилка", message: "Не вдалося зберегти CartoCSS" });
619
- } finally {
620
- te.value = !1;
621
- }
622
- }
623
- }
624
- function $e(e) {
625
- if (!e) return null;
626
- if (typeof e == "string")
627
- try {
628
- return JSON.parse(e);
629
- } catch (o) {
630
- return console.warn("Failed to parse CartoCSS config", o), null;
631
- }
632
- return typeof e == "object" ? e : null;
633
- }
634
- function Ve(e) {
635
- const o = Array.isArray(e) ? e : e == null ? void 0 : e.datasets;
636
- return Array.isArray(o) ? o.map((t, r) => ({
637
- table: (t == null ? void 0 : t.table) || (t == null ? void 0 : t.id) || `dataset_${r + 1}`,
638
- query: (t == null ? void 0 : t.query) || "",
639
- srid: (t == null ? void 0 : t.srid) || "",
640
- key: (t == null ? void 0 : t.key) || (t == null ? void 0 : t.label) || "Без підпису",
641
- active: typeof (t == null ? void 0 : t.active) == "boolean" ? t.active : !0,
642
- minzoom: typeof (t == null ? void 0 : t.zoom) > "u" ? "" : String(t.zoom),
643
- maxzoom: typeof (t == null ? void 0 : t.maxzoom) > "u" ? "" : String(t.maxzoom),
644
- columns: (t == null ? void 0 : t.columns) || "",
645
- proj4text: (t == null ? void 0 : t.proj4text) || ""
646
- })) : [];
647
- }
648
- async function K(e, o) {
649
- O.value = !0;
650
- try {
651
- const t = await fetch(`/api/gis-css/${e}`);
652
- if (!t.ok) throw new Error(`Failed to load cartocss: ${t.status}`);
653
- const r = await t.json(), c = (r == null ? void 0 : r.message) || r || {};
654
- s.value = c, k.value = {
655
- id: c.cartocss_key || e,
656
- name: c.name || k.value.name,
657
- description: c.description || k.value.description
658
- }, y.value = typeof c.style == "string" ? c.style : "";
659
- const M = $e(c.config ?? []);
660
- D.value = Ve(M);
661
- const j = typeof c.url == "string" ? c.url : "";
662
- W.value = j, Q.value = !!(j && c.enabled !== !1), X.value = o != null && o.bustCache ? Date.now() : 0;
663
- } catch (t) {
664
- console.error("Failed to fetch CartoCSS", t), Q.value = !1, W.value = "", X.value = 0, s.value = null;
665
- } finally {
666
- O.value = !1;
667
- }
668
- }
669
- async function ue() {
670
- await Se(
671
- {
672
- style: y.value || "",
673
- config: D.value
674
- },
675
- "CartoCSS оновлено"
676
- );
677
- }
678
- async function ze(e) {
679
- const o = await fetch(`/api/gis-css/${n.value}`, {
680
- method: "POST",
681
- headers: { "Content-Type": "application/json" },
682
- body: JSON.stringify(e)
683
- });
684
- if (!o.ok) throw new Error(`Failed to save cartocss: ${o.status}`);
685
- P({ type: "success", title: "Збережено", message: "Картка CartoCSS оновлена" });
686
- }
687
- return (e, o) => (b(), $("div", wt, [
688
- a("div", kt, [
689
- a("div", Ct, [
690
- a("div", St, [
691
- a("div", $t, [
692
- a("div", Vt, [
693
- a("div", zt, [
694
- a("button", {
695
- type: "button",
696
- class: "hover:text-gray-700 cursor-pointer transition-colors",
697
- onClick: o[0] || (o[0] = (t) => J(l).push("/gis.cartocss"))
698
- }, " CartoCSS "),
699
- o[6] || (o[6] = a("svg", {
700
- xmlns: "http://www.w3.org/2000/svg",
701
- width: "24",
702
- height: "24",
703
- viewBox: "0 0 24 24",
704
- fill: "none",
705
- stroke: "currentColor",
706
- "stroke-width": "2",
707
- "stroke-linecap": "round",
708
- "stroke-linejoin": "round",
709
- class: "lucide lucide-chevron-right w-4 h-4 mx-1"
710
- }, [
711
- a("path", { d: "m9 18 6-6-6-6" })
712
- ], -1)),
713
- a("span", Mt, E(k.value.name || "CartoCSS"), 1)
714
- ]),
715
- a("div", jt, [
716
- a("div", Lt, [
717
- a("div", qt, [
718
- a("h1", At, E(k.value.name || "CartoCSS"), 1),
719
- le.value ? (b(), $("div", Nt, [
720
- a("span", Et, E(le.value), 1)
721
- ])) : A("", !0)
722
- ]),
723
- Z.value ? (b(), $("p", {
724
- key: 0,
725
- class: "text-xs text-gray-500 truncate",
726
- title: Z.value
727
- }, E(Z.value), 9, Tt)) : A("", !0)
728
- ])
729
- ])
730
- ]),
731
- V(We, {
732
- class: "flex-shrink-0",
733
- "entity-id": n.value,
734
- "entity-info": k.value,
735
- "form-endpoint": (t) => `/api/form/gis.cartocss.table/${t}`,
736
- "save-endpoint": (t) => `/api/gis-css/${t}`,
737
- "entity-label": "CartoCSS",
738
- "save-method": "post",
739
- onSaved: re
740
- }, null, 8, ["entity-id", "entity-info", "form-endpoint", "save-endpoint"])
741
- ])
742
- ])
743
- ]),
744
- a("div", Ut, [
745
- a("div", It, [
746
- V(Pe, {
747
- ref_key: "mapViewRef",
748
- ref: z
749
- }, {
750
- default: R(() => {
751
- var t, r;
752
- return [
753
- a("div", Dt, [
754
- a("div", Ot, [
755
- a("div", Rt, [
756
- o[7] || (o[7] = a("span", null, "Прозорість:", -1)),
757
- Ae(a("input", {
758
- "onUpdate:modelValue": o[1] || (o[1] = (c) => H.value = c),
759
- type: "range",
760
- min: "0",
761
- max: "1",
762
- step: "0.01",
763
- class: "h-1 w-28 cursor-pointer appearance-none rounded-full bg-slate-300 focus:outline-none",
764
- style: { "accent-color": "#3b82f6" }
765
- }, null, 512), [
766
- [
767
- Ne,
768
- H.value,
769
- void 0,
770
- { number: !0 }
771
- ]
772
- ]),
773
- a("span", null, E(_e.value), 1)
774
- ])
775
- ]),
776
- a("div", Ft, [
777
- a("label", Bt, [
778
- a("input", {
779
- type: "checkbox",
780
- class: "h-3.5 w-3.5 rounded border-slate-300 text-blue-600 focus:ring-blue-200",
781
- checked: G.value,
782
- onChange: o[2] || (o[2] = (c) => G.value = c.target.checked)
783
- }, null, 40, Pt),
784
- o[8] || (o[8] = a("span", null, "Межі css", -1))
785
- ])
786
- ])
787
- ]),
788
- a("div", Qt, [
789
- V(Qe)
790
- ]),
791
- a("div", Ht, [
792
- V(pe),
793
- se.value ? (b(), T(pe, {
794
- key: 0,
795
- targetCenter: se.value,
796
- targetLabel: "Центр даних",
797
- targetAriaLabel: "Перейти до центру даних"
798
- }, null, 8, ["targetCenter"])) : A("", !0)
799
- ]),
800
- oe.value ? (b(), T(bt, {
801
- key: 0,
802
- "layer-id": be.value,
803
- "tile-url": oe.value,
804
- active: Q.value,
805
- opacity: H.value,
806
- title: k.value.name,
807
- owner: n.value
808
- }, null, 8, ["layer-id", "tile-url", "active", "opacity", "title", "owner"])) : A("", !0),
809
- V(et, {
810
- extent: G.value ? ke.value : null,
811
- "layer-id": we.value
812
- }, null, 8, ["extent", "layer-id"]),
813
- V(_t, {
814
- "cartocss-id": n.value,
815
- bounds: ((t = s.value) == null ? void 0 : t.bounds) ?? null,
816
- active: Q.value,
817
- "info-enabled": (r = s.value) == null ? void 0 : r.info
818
- }, null, 8, ["cartocss-id", "bounds", "active", "info-enabled"]),
819
- V(He, { "map-id": n.value }, null, 8, ["map-id"])
820
- ];
821
- }),
822
- _: 1
823
- }, 512)
824
- ])
825
- ]),
826
- s.value ? (b(), T(Xe, {
827
- key: 0,
828
- open: d.value,
829
- onToggle: o[3] || (o[3] = (t) => d.value = !d.value)
830
- }, null, 8, ["open"])) : A("", !0)
831
- ]),
832
- s.value ? (b(), $("div", {
833
- key: 0,
834
- class: fe(["bg-white border-l border-gray-100 flex flex-col overflow-hidden shadow-lg flex-shrink-0 transition-[width] duration-100 ease-in-out", d.value ? "w-[650px]" : "w-0"])
835
- }, [
836
- a("div", Yt, [
837
- m.value.length > 1 ? (b(), $("div", Jt, [
838
- a("div", {
839
- class: "items-center justify-center text-muted-foreground grid w-full h-12 p-1 bg-gray-50 rounded-xl shadow-sm",
840
- style: Ee({ gridTemplateColumns: `repeat(${m.value.length}, minmax(0, 1fr))` })
841
- }, [
842
- (b(!0), $(me, null, Te(m.value, (t) => (b(), $("button", {
843
- key: t.key,
844
- type: "button",
845
- role: "tab",
846
- "aria-selected": i.value === t.key,
847
- class: fe([
848
- "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",
849
- i.value === t.key ? "bg-white shadow-sm text-gray-700" : ""
850
- ]),
851
- onClick: (r) => i.value = t.key
852
- }, [
853
- (b(), T(Ue(t.icon), { class: "h-3.5 w-3.5 mb-0.5" })),
854
- a("span", Xt, E(t.label), 1)
855
- ], 10, Wt))), 128))
856
- ], 4)
857
- ])) : A("", !0),
858
- a("div", Gt, [
859
- O.value ? (b(), $("div", Zt, " Завантаження стилю… ")) : (b(), $(me, { key: 1 }, [
860
- i.value === "css" ? (b(), T(rt, {
861
- key: 0,
862
- modelValue: y.value,
863
- "onUpdate:modelValue": o[4] || (o[4] = (t) => y.value = t),
864
- class: "flex-1 min-h-0",
865
- onSave: ue
866
- }, null, 8, ["modelValue"])) : i.value === "data" ? (b(), T(vt, {
867
- key: 1,
868
- modelValue: D.value,
869
- "onUpdate:modelValue": o[5] || (o[5] = (t) => D.value = t),
870
- class: "flex-1 min-h-0 flex flex-col",
871
- onSave: ue
872
- }, null, 8, ["modelValue"])) : i.value === "card" ? (b(), T(xt, {
873
- key: 2,
874
- card: ae.value,
875
- table: ne.value,
876
- class: "flex-1 min-h-0",
877
- onSave: ze
878
- }, null, 8, ["card", "table"])) : i.value === "metadata" ? (b(), T(Ge, {
879
- key: 3,
880
- data: s.value,
881
- "entity-id": n.value,
882
- "entity-type": "css",
883
- onSaved: re
884
- }, null, 8, ["data", "entity-id"])) : A("", !0)
885
- ], 64))
886
- ])
887
- ])
888
- ], 2)) : A("", !0)
889
- ]));
890
- }
891
- });
892
- export {
893
- co as default
894
- };