@opengis/gis 0.1.65 → 0.1.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,3656 @@
1
+ import { computed as M, createElementBlock as p, openBlock as c, normalizeStyle as fe, createCommentVNode as F, createElementVNode as r, toDisplayString as S, Fragment as B, renderList as W, normalizeClass as K, ref as A, onMounted as xe, resolveDirective as ut, withDirectives as ne, watch as he, vModelText as Ne, vModelCheckbox as qe, defineComponent as Ye, reactive as pt, onBeforeUnmount as ht, createBlock as X, renderSlot as We, Teleport as Ke, createVNode as N, Transition as ft, withCtx as Z, vShow as Ee, nextTick as $e, resolveComponent as G, unref as Ze, createTextVNode as ae, createStaticVNode as Oe, withModifiers as gt, resolveDynamicComponent as De, withKeys as vt, onUnmounted as mt, mergeProps as yt } from "vue";
2
+ import bt from "@opengis/filter";
3
+ const H = (e, t) => {
4
+ const o = e.__vccOpts || e;
5
+ for (const [n, s] of t)
6
+ o[n] = s;
7
+ return o;
8
+ }, wt = {
9
+ key: 0,
10
+ class: "p-5 pb-0 flex justify-between items-center"
11
+ }, xt = { class: "inline-block font-semibold text-lg text-gray-800" }, _t = { class: "flex flex-col gap-1 p-5" }, kt = { class: "flex items-center justify-between w-full text-sm text-gray-800 ml-2" }, Lt = {
12
+ key: 0,
13
+ class: "ms-2 text-xs text-gray-500"
14
+ }, Ct = {
15
+ __name: "vs-legend-widget",
16
+ props: {
17
+ config: {
18
+ type: Object,
19
+ required: !0
20
+ }
21
+ },
22
+ setup(e) {
23
+ const t = e, o = M(() => {
24
+ var s;
25
+ return ((s = t.config) == null ? void 0 : s.items) || [];
26
+ }), n = M(() => {
27
+ var s;
28
+ return ((s = t.config) == null ? void 0 : s.title) || "";
29
+ });
30
+ return (s, i) => (c(), p("div", {
31
+ class: "legend-widget flex flex-col bg-white border border-stone-200 shadow-2xs rounded-xl z-10 relative",
32
+ style: fe({ width: e.config.width || "100%" })
33
+ }, [
34
+ n.value ? (c(), p("div", wt, [
35
+ r("h2", xt, S(n.value), 1)
36
+ ])) : F("", !0),
37
+ r("div", _t, [
38
+ (c(!0), p(B, null, W(o.value, (d) => (c(), p("div", {
39
+ class: "flex items-center",
40
+ key: d.label
41
+ }, [
42
+ r("span", {
43
+ class: K(["shrink-0 size-2.5 inline-block me-2.5 h-[10px] w-[10px]", [
44
+ d.shape === "square" ? "rounded-sm" : "",
45
+ d.shape === "circle" ? "rounded-full" : "",
46
+ d.shape === "line" ? "w-6 h-0.5" : "",
47
+ d.shape === "dashed-line" ? "w-6 h-0.5 dashed-line" : ""
48
+ ]]),
49
+ style: fe({ backgroundColor: d.color })
50
+ }, null, 6),
51
+ r("span", kt, [
52
+ r("span", null, S(d.label), 1),
53
+ d.count !== void 0 ? (c(), p("span", Lt, " (" + S(d.count) + ") ", 1)) : F("", !0)
54
+ ])
55
+ ]))), 128))
56
+ ])
57
+ ], 4));
58
+ }
59
+ }, $t = /* @__PURE__ */ H(Ct, [["__scopeId", "data-v-dd12cf90"]]), It = { class: "flex flex-row gap-x-3 z-10 relative" }, Vt = ["onClick"], St = ["src", "alt"], Ft = {
60
+ __name: "vs-basemaps-widget",
61
+ props: {
62
+ map: {
63
+ type: Object,
64
+ required: !0
65
+ },
66
+ config: {
67
+ type: Object,
68
+ default: () => ({})
69
+ },
70
+ position: {
71
+ type: String,
72
+ default: "bottom-left"
73
+ }
74
+ },
75
+ setup(e) {
76
+ const t = e, o = A("voyager"), n = M(() => {
77
+ var g;
78
+ if (!((g = t.config) != null && g.layers)) return [];
79
+ const v = t.config.layers.map((l) => ({
80
+ id: l.id,
81
+ title: l.label || l.title,
82
+ url: l.url,
83
+ service: l.type,
84
+ category: "Базові карти",
85
+ attribution: l.attribution,
86
+ image: l.image,
87
+ enabled: !0,
88
+ owner: l.owner || "Unknown"
89
+ }));
90
+ return v.push({
91
+ id: "__none__",
92
+ title: "Без підложки",
93
+ url: "",
94
+ service: "",
95
+ category: "Базові карти",
96
+ attribution: "",
97
+ enabled: !0,
98
+ owner: ""
99
+ }), v;
100
+ });
101
+ function s(v) {
102
+ return {
103
+ version: 8,
104
+ sources: {
105
+ [v.id]: {
106
+ type: "raster",
107
+ tiles: [v.url],
108
+ tileSize: 256,
109
+ attribution: v.attribution || ""
110
+ }
111
+ },
112
+ layers: [
113
+ {
114
+ id: v.id,
115
+ type: "raster",
116
+ source: v.id
117
+ }
118
+ ]
119
+ };
120
+ }
121
+ const i = (v) => {
122
+ if (!t.map) return;
123
+ const g = t.map.getStyle(), l = n.value.map((h) => h.id), u = g.layers.filter((h) => !l.includes(h.id)), a = {};
124
+ for (const h in g.sources)
125
+ l.includes(h) || (a[h] = g.sources[h]);
126
+ if (v.id === "__none__") {
127
+ const h = {
128
+ version: 8,
129
+ sources: { ...a },
130
+ layers: [...u]
131
+ };
132
+ t.map.setStyle(h);
133
+ return;
134
+ }
135
+ const m = s(v);
136
+ t.map.setStyle(m), t.map.once("styledata", () => {
137
+ for (const [h, f] of Object.entries(a))
138
+ t.map.getSource(h) || t.map.addSource(h, f);
139
+ for (const h of u)
140
+ t.map.getLayer(h.id) || t.map.addLayer(h);
141
+ });
142
+ }, d = (v) => {
143
+ o.value = v;
144
+ const g = n.value.find((l) => l.id === v);
145
+ g && t.map && i(g);
146
+ };
147
+ return xe(() => {
148
+ var v;
149
+ (v = t.config) != null && v.default && (o.value = t.config.default), d(o.value);
150
+ }), (v, g) => {
151
+ const l = ut("tooltip");
152
+ return c(), p("div", It, [
153
+ (c(!0), p(B, null, W(n.value, (u) => ne((c(), p("div", {
154
+ trigger: "hover",
155
+ placement: "top",
156
+ key: u.id
157
+ }, [
158
+ r("div", {
159
+ class: K([
160
+ "w-14 h-14 flex items-center justify-center bg-gray-200 rounded-xl shadow-2xs cursor-pointer transition-all border-4",
161
+ o.value === u.id ? "border-blue-400" : "border-transparent"
162
+ ]),
163
+ onClick: (a) => d(u.id)
164
+ }, [
165
+ u.image ? (c(), p("img", {
166
+ key: 0,
167
+ src: u.image,
168
+ alt: u.title,
169
+ class: K(["object-cover rounded-lg", u.id === "__none__" ? "w-10 h-10" : "w-12 h-12"])
170
+ }, null, 10, St)) : F("", !0)
171
+ ], 10, Vt)
172
+ ])), [
173
+ [l, u.title]
174
+ ])), 128))
175
+ ]);
176
+ };
177
+ }
178
+ };
179
+ function Ie(e) {
180
+ if (!e.attrType || !e.attribute || !e.rules)
181
+ return e.color || "#ccc";
182
+ const t = e.rules.map((o) => [
183
+ ["==", ["get", e.attribute], o.id || o.value],
184
+ o.color
185
+ ]);
186
+ return t.push(e.color || "#ccc"), ["case", ...t.flat()];
187
+ }
188
+ function jt(e) {
189
+ if (!e.attrType || e.attrType !== "icon-by-attribute" || !e.attribute || !e.rules)
190
+ return e.default_icon || null;
191
+ const t = e.rules.map((o) => [
192
+ ["==", ["get", e.attribute], o.value],
193
+ o.icon
194
+ ]);
195
+ return t.push(e.default_icon || "marker.svg"), ["case", ...t.flat()];
196
+ }
197
+ function Xe(e) {
198
+ if (!e.attrType || e.attrType !== "attribute-pattern" || !e.attribute || !e.rules)
199
+ return e.fillPattern || "";
200
+ const t = e.rules.map((o) => [
201
+ ["==", ["get", e.attribute], o.value],
202
+ o.fillPattern || ""
203
+ ]);
204
+ return t.push(e.fillPattern || ""), ["case", ...t.flat()];
205
+ }
206
+ function pe(e, t = "stroke", o = "#ccc") {
207
+ return [
208
+ "case",
209
+ ["boolean", ["feature-state", "hovered"], !1],
210
+ "#ff0000",
211
+ ["boolean", ["feature-state", "selected"], !1],
212
+ "#ff0000",
213
+ e[t] || o
214
+ ];
215
+ }
216
+ function Pt(e) {
217
+ const t = [
218
+ {
219
+ type: "fill",
220
+ minzoom: e.pointZoom || 0,
221
+ paint: {
222
+ "fill-color": Ie(e),
223
+ "fill-outline-color": pe(e, "stroke", "#ccc"),
224
+ "fill-opacity": e.opacity || 1,
225
+ ...e.attrType === "attribute-pattern" && {
226
+ "fill-pattern": Xe(e)
227
+ },
228
+ ...e.fillPattern && !e.attrType && { "fill-pattern": e.fillPattern }
229
+ }
230
+ },
231
+ {
232
+ type: "line",
233
+ paint: {
234
+ "line-color": pe(e, "stroke", "#ccc"),
235
+ "line-width": e.width || 2,
236
+ "line-opacity": e.lineOpacity || e.opacity || 1
237
+ }
238
+ }
239
+ ];
240
+ return e.pointZoom && t.push({
241
+ type: "circle",
242
+ maxzoom: e.pointZoom,
243
+ paint: {
244
+ "circle-color": e.color || "#ccc",
245
+ "circle-stroke-color": pe(e, "stroke", "#ccc"),
246
+ "circle-stroke-width": e.width || 2,
247
+ "circle-opacity": e.opacity || 1
248
+ }
249
+ }), t;
250
+ }
251
+ function Et(e) {
252
+ return [
253
+ {
254
+ type: "line",
255
+ paint: {
256
+ "line-color": pe(e, "color", Ie(e)),
257
+ "line-width": e.width || 2,
258
+ "line-opacity": e.opacity || 1,
259
+ ...e.dashArray && { "line-dasharray": e.dashArray }
260
+ },
261
+ layout: {
262
+ ...e.lineCap && { "line-cap": e.lineCap },
263
+ ...e.lineJoin && { "line-join": e.lineJoin }
264
+ }
265
+ }
266
+ ];
267
+ }
268
+ function Mt(e) {
269
+ const t = [
270
+ {
271
+ type: "circle",
272
+ maxzoom: e.icon && +e.iconZoom || 22,
273
+ paint: {
274
+ "circle-radius": e.radius || 6,
275
+ "circle-stroke-color": pe(e, "stroke", "#ccc"),
276
+ "circle-stroke-width": e.width || 2,
277
+ "circle-color": Ie(e),
278
+ "circle-opacity": e.opacity || 1
279
+ }
280
+ }
281
+ ];
282
+ return e != null && e.clusterZoom ? (t.push({
283
+ type: "circle",
284
+ filter: ["has", "point_count"],
285
+ paint: {
286
+ "circle-color": ["step", ["get", "point_count"], "#51bbd6", 100, "#f1f075", 750, "#f28cb1"],
287
+ "circle-radius": ["step", ["get", "point_count"], 20, 100, 30, 750, 40]
288
+ }
289
+ }), t.push({
290
+ type: "symbol",
291
+ filter: ["has", "point_count"],
292
+ layout: {
293
+ "text-field": ["get", "point_count"],
294
+ "text-font": ["Open Sans Regular"],
295
+ "text-size": 12
296
+ }
297
+ })) : e.icon && t.push({
298
+ type: "symbol",
299
+ minzoom: +e.iconZoom || 16,
300
+ layout: {
301
+ "icon-image": e.icon,
302
+ "icon-allow-overlap": !0
303
+ }
304
+ }), t;
305
+ }
306
+ function Tt(e, t, o) {
307
+ const n = e.type || "point";
308
+ return n === "polygon" ? [
309
+ {
310
+ type: "fill",
311
+ ...o !== void 0 ? { maxzoom: o } : {},
312
+ paint: {
313
+ "fill-color": Ie(e),
314
+ "fill-outline-color": pe(e, "stroke", "#ccc"),
315
+ "fill-opacity": e.opacity || 1,
316
+ ...e.attrType === "attribute-pattern" && {
317
+ "fill-pattern": Xe(e)
318
+ },
319
+ ...e.fillPattern && !e.attrType && { "fill-pattern": e.fillPattern }
320
+ }
321
+ },
322
+ {
323
+ type: "line",
324
+ ...o !== void 0 ? { maxzoom: o } : {},
325
+ paint: {
326
+ "line-color": pe(e, "stroke", "#ccc"),
327
+ "line-width": e.width || 2,
328
+ "line-opacity": e.lineOpacity || e.opacity || 1
329
+ }
330
+ }
331
+ ] : n === "line" ? [
332
+ {
333
+ type: "line",
334
+ ...o !== void 0 ? { maxzoom: o } : {},
335
+ paint: {
336
+ "line-color": pe(e, "color", Ie(e)),
337
+ "line-width": e.width || 2,
338
+ "line-opacity": e.opacity || 1,
339
+ ...e.dashArray && { "line-dasharray": e.dashArray }
340
+ },
341
+ layout: {
342
+ ...e.lineCap && { "line-cap": e.lineCap },
343
+ ...e.lineJoin && { "line-join": e.lineJoin }
344
+ }
345
+ }
346
+ ] : [
347
+ {
348
+ type: "circle",
349
+ ...o !== void 0 ? { maxzoom: o } : {},
350
+ paint: {
351
+ "circle-radius": e.radius || 6,
352
+ "circle-stroke-color": pe(e, "stroke", "#ccc"),
353
+ "circle-stroke-width": e.width || 2,
354
+ "circle-color": Ie(e),
355
+ "circle-opacity": e.opacity || 1
356
+ }
357
+ }
358
+ ];
359
+ }
360
+ function et(e) {
361
+ var o, n;
362
+ if (!e) return null;
363
+ if (e.attrType === "icon-by-attribute" && e.iconZoom) {
364
+ const s = jt(e), i = Array.isArray(s) && s[0] === "case" ? s : [
365
+ "case",
366
+ ["==", ["get", e.attribute], ((n = (o = e.rules) == null ? void 0 : o[0]) == null ? void 0 : n.value) || ""],
367
+ s,
368
+ s
369
+ ], d = Tt(e, void 0, +e.iconZoom), v = {
370
+ type: "symbol",
371
+ minzoom: +e.iconZoom,
372
+ layout: {
373
+ "icon-image": i,
374
+ "icon-size": (e == null ? void 0 : e.icon_size) || 1,
375
+ "icon-allow-overlap": !0,
376
+ "icon-anchor": (e == null ? void 0 : e.icon_anchor) || "bottom"
377
+ },
378
+ paint: {
379
+ "icon-opacity": e.opacity || 1
380
+ }
381
+ };
382
+ return [...d, v];
383
+ }
384
+ const t = e.type || "point";
385
+ return t === "polygon" ? Pt(e) : t === "line" ? Et(e) : Mt(e);
386
+ }
387
+ function zt(e) {
388
+ return e.startsWith("http") ? e : `${window.location.origin}${e}`;
389
+ }
390
+ function At(e) {
391
+ const {
392
+ id: t,
393
+ sourceLayer: o,
394
+ url: n,
395
+ bounds: s,
396
+ title: i,
397
+ style: d,
398
+ service: v,
399
+ service_type: g,
400
+ source_type: l,
401
+ data: u
402
+ } = e, a = zt(n), m = g || v || l || "vector";
403
+ switch (m) {
404
+ case "vtile":
405
+ case "vector":
406
+ return Ot(
407
+ t,
408
+ o,
409
+ a,
410
+ s,
411
+ i,
412
+ d
413
+ );
414
+ case "raster":
415
+ return Dt(t, a, s, i, d);
416
+ case "geojson":
417
+ return Ut(t, u || a, s, i, d);
418
+ default:
419
+ throw new Error(`Unsupported layer service type: ${m}`);
420
+ }
421
+ }
422
+ function Bt(e) {
423
+ switch (e) {
424
+ case "polygon":
425
+ return { type: "polygon", color: "#3388ff", opacity: 0.5 };
426
+ case "line":
427
+ return { type: "line", color: "#3388ff", opacity: 1 };
428
+ case "point":
429
+ default:
430
+ return { type: "point", color: "#3388ff", radius: 6, opacity: 1 };
431
+ }
432
+ }
433
+ function Ot(e, t, o, n, s, i) {
434
+ const d = t || (o.match(/\/vtile\/([^/]+)/) || [])[1] || e, v = {
435
+ type: "vector",
436
+ tiles: [o],
437
+ ...n && { bounds: n }
438
+ }, u = et(i || {}).map((a, m) => ({
439
+ ...a,
440
+ id: `${e}-${m}`,
441
+ "source-layer": d,
442
+ source: e
443
+ }));
444
+ return {
445
+ id: e,
446
+ title: s,
447
+ source: v,
448
+ layers: u,
449
+ visible: !0
450
+ };
451
+ }
452
+ function Dt(e, t, o, n, s) {
453
+ const i = {
454
+ type: "raster",
455
+ tiles: [t],
456
+ tileSize: 256,
457
+ ...o && { bounds: o }
458
+ }, d = s || {}, v = {
459
+ id: e,
460
+ type: "raster",
461
+ source: e,
462
+ layout: {
463
+ visibility: "visible"
464
+ },
465
+ ...d && { paint: d }
466
+ };
467
+ return {
468
+ id: e,
469
+ title: n,
470
+ source: i,
471
+ layers: [v],
472
+ visible: !0
473
+ };
474
+ }
475
+ function Ut(e, t, o, n, s) {
476
+ var u;
477
+ const i = {
478
+ type: "geojson",
479
+ data: t,
480
+ ...o && { bounds: o }
481
+ };
482
+ let d = "point";
483
+ if (t && t.features && t.features.length > 0) {
484
+ const a = (u = t.features[0].geometry) == null ? void 0 : u.type;
485
+ a === "Polygon" || a === "MultiPolygon" ? d = "polygon" : a === "LineString" || a === "MultiLineString" ? d = "line" : d = "point";
486
+ }
487
+ const v = s || Bt(d), l = et(v).map((a, m) => ({
488
+ ...a,
489
+ id: `${e}-${m}`,
490
+ source: e
491
+ }));
492
+ return {
493
+ id: e,
494
+ title: n,
495
+ source: i,
496
+ layers: l,
497
+ visible: !0
498
+ };
499
+ }
500
+ function Rt(e) {
501
+ if (!e || e.attrType !== "icon-by-attribute") return [];
502
+ const t = /* @__PURE__ */ new Set();
503
+ return e.default_icon && t.add(e.default_icon), Array.isArray(e.rules) && e.rules.forEach((o) => {
504
+ o.icon && t.add(o.icon);
505
+ }), Array.from(t).map((o) => ({
506
+ name: o,
507
+ url: (e.icon_base_url || "") + o
508
+ }));
509
+ }
510
+ function Ht(e) {
511
+ const t = /* @__PURE__ */ new Set();
512
+ function o(n) {
513
+ typeof n == "string" ? t.add(n) : Array.isArray(n) && n.forEach(o);
514
+ }
515
+ return e && e["icon-image"] && o(e["icon-image"]), Array.from(t);
516
+ }
517
+ async function tt(e, t) {
518
+ const o = t.map(async ({ name: n, url: s }) => {
519
+ const i = await e.loadImage(s);
520
+ return { name: n, data: i.data };
521
+ });
522
+ try {
523
+ const n = await Promise.all(o);
524
+ for (const { name: s, data: i } of n)
525
+ e.hasImage(s) || e.addImage(s, i);
526
+ } catch (n) {
527
+ console.error("Failed to load icons:", n);
528
+ }
529
+ }
530
+ function Wt(e, t, o = "/icons/") {
531
+ const s = Ht(t).map((i) => ({ name: i, url: o + i }));
532
+ return tt(e, s);
533
+ }
534
+ async function we(e, t) {
535
+ const o = At(t), n = Rt(t.style);
536
+ n.length > 0 && await tt(e, n), t.layout && t.layout["icon-image"] && await Wt(e, t.layout), e.getSource(o.id) || e.addSource(o.id, o.source);
537
+ for (const s of o.layers)
538
+ t.visible !== void 0 && (s.layout = {
539
+ ...s.layout,
540
+ visibility: t.visible ? "visible" : "none"
541
+ }), e.getLayer(s.id) ? e.setLayoutProperty(
542
+ s.id,
543
+ "visibility",
544
+ t.visible ? "visible" : "none"
545
+ ) : await e.addLayer(s);
546
+ return o;
547
+ }
548
+ function Ce(e, t) {
549
+ e.getStyle().layers.filter((s) => s.source === t).forEach((s) => {
550
+ e.removeLayer(s.id);
551
+ }), e.getSource(t) && e.removeSource(t);
552
+ }
553
+ const Nt = { class: "w-full flex flex-col bg-white border border-stone-200 shadow-2xs rounded-xl z-10 relative" }, Zt = { class: "flex flex-col justify-between h-full pb-5 px-5" }, qt = {
554
+ key: 0,
555
+ class: "relative mb-[10px]"
556
+ }, Gt = {
557
+ width: "16",
558
+ height: "17",
559
+ viewBox: "0 0 16 17",
560
+ fill: "none",
561
+ xmlns: "http://www.w3.org/2000/svg",
562
+ class: "absolute top-1/2 left-[8px] w-[16px] h-[16px]",
563
+ style: { transform: "translate(0px, -50%)" }
564
+ }, Jt = {
565
+ key: 1,
566
+ class: "mb-4"
567
+ }, Qt = { class: "" }, Yt = { class: "space-y-2" }, Kt = { class: "flex items-center gap-[10px] text-gray-500" }, Xt = { class: "dataset-checkbox-container flex" }, eo = ["onUpdate:modelValue", "onChange"], to = { class: "text-sm" }, oo = ["onClick"], ro = ["innerHTML"], so = {
568
+ key: 0,
569
+ class: "text-sm text-gray-500 text-center py-2"
570
+ }, no = {
571
+ __name: "vs-layers-widget",
572
+ props: {
573
+ map: {
574
+ type: Object,
575
+ required: !0
576
+ },
577
+ history: {
578
+ type: Boolean,
579
+ default: !1
580
+ },
581
+ config: {
582
+ type: Object,
583
+ default: () => ({
584
+ layers: [],
585
+ search: !1,
586
+ allow_toggle_all: !1
587
+ })
588
+ },
589
+ position: {
590
+ type: String,
591
+ default: "bottom-left"
592
+ },
593
+ hasFilters: {
594
+ type: Boolean,
595
+ default: !1
596
+ }
597
+ },
598
+ emits: ["set-filter-layer", "update:enabledLayerIds"],
599
+ setup(e, { emit: t }) {
600
+ const o = e, n = t, s = A(""), i = A([]);
601
+ function d() {
602
+ const f = new URLSearchParams(window.location.search).get("layers");
603
+ return f ? f.split(",") : [];
604
+ }
605
+ function v(h) {
606
+ const f = new URLSearchParams(window.location.search);
607
+ h.length > 0 ? f.set("layers", h.join(",")) : f.delete("layers");
608
+ const L = `${window.location.pathname}?${f.toString()}`;
609
+ window.history.replaceState({}, "", L);
610
+ }
611
+ xe(() => {
612
+ let h = [];
613
+ o.history && (h = d()), h.length > 0 ? i.value = o.config.layers.map((f) => ({
614
+ ...f,
615
+ visible: h.includes(String(f.id))
616
+ })) : i.value = o.config.layers.map((f) => ({
617
+ ...f,
618
+ visible: f.visible ?? !1
619
+ })), i.value.forEach((f) => {
620
+ f.visible && we(o.map, f);
621
+ }), n("update:enabledLayerIds", u());
622
+ });
623
+ const g = M(() => {
624
+ if (!s.value) return i.value;
625
+ const h = s.value.toLowerCase();
626
+ return i.value.filter((f) => (f.title || f.name || f.label || "").toLowerCase().includes(h));
627
+ }), l = M(() => i.value.every((h) => h.visible)), u = () => i.value.filter((h) => h.visible).map((h) => h.id), a = (h) => {
628
+ h.visible ? we(o.map, h) : (Ce(o.map, h.id), n("set-filter-layer", null)), o.map.getStyle().layers.filter((j) => j.source === h.id).forEach((j) => {
629
+ o.map.setLayoutProperty(
630
+ j.id,
631
+ "visibility",
632
+ h.visible ? "visible" : "none"
633
+ );
634
+ }), n("update:enabledLayerIds", u());
635
+ }, m = () => {
636
+ const h = !l.value;
637
+ i.value.forEach((f) => {
638
+ f.visible = h, h ? we(o.map, f) : Ce(o.map, f.id);
639
+ }), h || n("set-filter-layer", null), n("update:enabledLayerIds", u());
640
+ };
641
+ return he(
642
+ () => u(),
643
+ (h) => {
644
+ o.history && v(h);
645
+ },
646
+ { deep: !0 }
647
+ ), (h, f) => (c(), p("div", Nt, [
648
+ f[2] || (f[2] = r("div", { class: "p-5 pb-3 flex justify-between items-center" }, [
649
+ r("h2", { class: "inline-block font-semibold text-lg text-gray-800" }, "Шари")
650
+ ], -1)),
651
+ r("div", Zt, [
652
+ e.config.search ? (c(), p("div", qt, [
653
+ ne(r("input", {
654
+ type: "text",
655
+ "onUpdate:modelValue": f[0] || (f[0] = (L) => s.value = L),
656
+ placeholder: "Введіть назву шару...",
657
+ class: "py-[7px] ps-8 pe-8 block w-full bg-gray-100 border-transparent rounded-lg text-sm focus:bg-white focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none"
658
+ }, null, 512), [
659
+ [Ne, s.value]
660
+ ]),
661
+ (c(), p("svg", Gt, [...f[1] || (f[1] = [
662
+ r("path", {
663
+ d: "M7.33333 13.1667C10.2789 13.1667 12.6667 10.7789 12.6667 7.83333C12.6667 4.88781 10.2789 2.5 7.33333 2.5C4.38781 2.5 2 4.88781 2 7.83333C2 10.7789 4.38781 13.1667 7.33333 13.1667Z",
664
+ stroke: "#6B7280",
665
+ "stroke-linecap": "round",
666
+ "stroke-linejoin": "round"
667
+ }, null, -1),
668
+ r("path", {
669
+ d: "M13.9995 14.5L11.1328 11.6333",
670
+ stroke: "#6B7280",
671
+ "stroke-linecap": "round",
672
+ "stroke-linejoin": "round"
673
+ }, null, -1)
674
+ ])]))
675
+ ])) : F("", !0),
676
+ e.config.allow_toggle_all ? (c(), p("div", Jt, [
677
+ r("button", {
678
+ onClick: m,
679
+ class: "w-full py-[7px] bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors"
680
+ }, S(l.value ? "Вимкнути всі" : "Увімкнути всі"), 1)
681
+ ])) : F("", !0),
682
+ r("div", Qt, [
683
+ r("ul", Yt, [
684
+ (c(!0), p(B, null, W(g.value, (L) => (c(), p("li", {
685
+ key: L.id,
686
+ class: "flex flex-wrap justify-between items-center gap-x-2"
687
+ }, [
688
+ r("label", Kt, [
689
+ r("span", Xt, [
690
+ ne(r("input", {
691
+ class: "dataset-checkbox",
692
+ type: "checkbox",
693
+ "onUpdate:modelValue": (j) => L.visible = j,
694
+ onChange: () => a(L)
695
+ }, null, 40, eo), [
696
+ [qe, L.visible]
697
+ ])
698
+ ]),
699
+ r("span", to, S(L.title || L.name || L.label), 1)
700
+ ]),
701
+ L.actions && L.visible ? (c(!0), p(B, { key: 0 }, W(L.actions, (j) => (c(), p("div", {
702
+ key: j.id
703
+ }, [
704
+ r("button", {
705
+ class: "text-sm text-gray-500",
706
+ onClick: (T) => h.$emit("show-widget", j.widget)
707
+ }, [
708
+ r("div", {
709
+ innerHTML: j.icon
710
+ }, null, 8, ro)
711
+ ], 8, oo)
712
+ ]))), 128)) : F("", !0)
713
+ ]))), 128)),
714
+ s.value && g.value.length === 0 ? (c(), p("li", so, " Шарів не знайдено ")) : F("", !0)
715
+ ])
716
+ ])
717
+ ])
718
+ ]));
719
+ }
720
+ };
721
+ Ye({
722
+ props: {
723
+ modelValue: { type: Boolean, default: () => !1 },
724
+ title: { type: String, default: () => "" },
725
+ disabled: { type: Boolean, default: () => !1 }
726
+ },
727
+ data() {
728
+ return {};
729
+ },
730
+ mounted() {
731
+ this.modelValue || this.$emit("update:modelValue", !1);
732
+ },
733
+ computed: {
734
+ modelState: {
735
+ get() {
736
+ return this.modelValue;
737
+ },
738
+ set(e) {
739
+ this.$emit("update:modelValue", e);
740
+ }
741
+ },
742
+ labelCursorClasses() {
743
+ return [
744
+ { "cursor-not-allowed": this.disabled },
745
+ { "cursor-pointer": !this.disabled }
746
+ ];
747
+ }
748
+ },
749
+ methods: {
750
+ handleEnterDown(e) {
751
+ const { keyCode: t } = e;
752
+ t === 13 && (this.modelState = !this.modelState);
753
+ },
754
+ addKeyHandler() {
755
+ window.addEventListener("keydown", this.handleEnterDown);
756
+ },
757
+ removeKeyHandler() {
758
+ window.removeEventListener("keydown", this.handleEnterDown);
759
+ }
760
+ }
761
+ });
762
+ const Pe = async (e, t, o, n = 10) => {
763
+ var L, j, T, k;
764
+ if (!t || !o) return;
765
+ await $e();
766
+ const s = await (o == null ? void 0 : o.getBoundingClientRect()), i = await (t == null ? void 0 : t.getBoundingClientRect());
767
+ if (!i || !s) return;
768
+ const d = await parseInt((L = t == null ? void 0 : t.getBoundingClientRect()) == null ? void 0 : L.height), v = await parseInt((j = t == null ? void 0 : t.getBoundingClientRect()) == null ? void 0 : j.width), g = await parseInt((T = o == null ? void 0 : o.getBoundingClientRect()) == null ? void 0 : T.height), l = await parseInt((k = o == null ? void 0 : o.getBoundingClientRect()) == null ? void 0 : k.width), u = await window.innerHeight, a = await window.innerWidth;
769
+ let m = 0, h = 0;
770
+ const f = i.bottom + n + g;
771
+ switch (e) {
772
+ case "top":
773
+ i.top - s.height - n < 0 ? m = i.top - s.height + n + g + d : m = i.top - s.height - n, a > l + i.right + 30 ? h = i.left - s.width / 2 + i.width / 2 : h = a - 30 - l;
774
+ break;
775
+ case "bottom":
776
+ u > f ? m = i.bottom + n : m = i.bottom - n - g - d, h = i.left - s.width / 2 + i.width / 2;
777
+ break;
778
+ case "left":
779
+ m = i.top - s.height / 2 + i.height / 2, i.left - s.width - n > 0 ? h = i.left - s.width - n : h = 10;
780
+ break;
781
+ case "right":
782
+ m = i.top - s.height / 2 + i.height / 2, a - v > l ? h = i.right + n : h = a - 30 - l;
783
+ break;
784
+ case "top-right":
785
+ i.top - s.height - n < 0 ? m = i.top - s.height + n + g + d : m = i.top - s.height - n, a - v > l ? h = i.right + n : h = a - 30 - l;
786
+ break;
787
+ case "top-left":
788
+ i.top - s.height - n < 0 ? m = i.top - s.height + n + g + d : m = i.top - s.height - n, i.left - s.width - n > 0 ? h = i.left - s.width - n : h = 10;
789
+ break;
790
+ case "top-start":
791
+ i.top - s.height - n < 0 ? m = i.top - s.height + n + g + d : m = i.top - s.height - n, i.left > 0 ? h = i.left : h = 10;
792
+ break;
793
+ case "bottom-right":
794
+ u > f ? m = i.bottom + n : m = i.bottom - n - g - d, a - v > l ? h = i.left : h = a - 30 - l;
795
+ break;
796
+ case "bottom-left":
797
+ u > f ? m = i.bottom + n : m = i.bottom - n - g - d, i.left > 0 ? h = i.right - l : h = 10;
798
+ break;
799
+ case "bottom-start":
800
+ u > f ? m = i.bottom + n : m = i.bottom - n - g - d, i.left > 0 ? h = i.left : h = 10;
801
+ break;
802
+ }
803
+ m + g > u ? m = u - g - n : m < 0 && (m = n), h + l > a ? h = a - l - n : h < 0 && (h = n), o instanceof HTMLElement && (o.style.top = `${m}px`, o.style.left = `${h}px`, o.style.position = "fixed");
804
+ }, io = { class: "text-center" }, ao = { class: "py-2 px-4 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full" }, Ve = /* @__PURE__ */ Ye({
805
+ __name: "vs-popover",
806
+ props: {
807
+ isOpen: { type: Boolean, default: !1 },
808
+ placement: { default: "top" },
809
+ gap: { default: 8 },
810
+ width: { default: "" },
811
+ disabled: { type: Boolean, default: !1 },
812
+ trigger: { default: "click" },
813
+ teleport: { default: "body" }
814
+ },
815
+ emits: ["isvisible"],
816
+ setup(e, { expose: t, emit: o }) {
817
+ const n = e, s = o, i = A(!1), d = A([]), v = A(null), g = A(null), l = A(null), u = (_) => {
818
+ var D, le;
819
+ if (!_) {
820
+ i.value = !1;
821
+ return;
822
+ }
823
+ (D = g.value) != null && D.contains(_.target) || (le = l.value) != null && le.contains(_.target) || (i.value = !1);
824
+ }, a = (_) => {
825
+ i.value && l.value && !l.value.contains(_.target) && (i.value = !1);
826
+ }, m = () => {
827
+ i.value = !1;
828
+ }, h = () => {
829
+ i.value && (i.value = !1);
830
+ }, f = () => {
831
+ let _ = v.value;
832
+ for (; _ && _ !== document.body; )
833
+ (_.scrollHeight > _.clientHeight || _.scrollWidth > _.clientWidth) && (_.addEventListener("scroll", m), d.value.push(_)), _ = _.parentElement;
834
+ document.body && (document.body.addEventListener("scroll", m), d.value.push(document.body));
835
+ }, L = () => {
836
+ d.value.forEach((_) => {
837
+ _.removeEventListener("scroll", m);
838
+ }), d.value = [];
839
+ };
840
+ he(i, (_) => {
841
+ _ ? (f(), window.addEventListener("resize", () => Pe(n.placement, g.value, l.value)), Pe(n.placement, g.value, l.value)) : window.removeEventListener("resize", () => Pe(n.placement, g.value, l.value)), s("isvisible", _);
842
+ }), xe(() => {
843
+ window.addEventListener("click", u), window.addEventListener("popstate", h), window.addEventListener("scroll", a, !0), f();
844
+ }), ht(() => {
845
+ window.removeEventListener("click", u), window.removeEventListener("popstate", h), L();
846
+ });
847
+ const j = () => {
848
+ i.value = !0, Pe(n.placement, g.value, l.value);
849
+ }, T = () => {
850
+ i.value = !1;
851
+ }, k = async () => {
852
+ await Pe(n.placement, g.value, l.value), i.value = !i.value;
853
+ };
854
+ return t({
855
+ togglePopover: k
856
+ }), (_, D) => (c(), p("div", {
857
+ ref_key: "popover",
858
+ ref: v,
859
+ class: "vs-popover inline-block"
860
+ }, [
861
+ r("div", io, [
862
+ _.trigger === "click" ? (c(), p("div", {
863
+ key: 0,
864
+ ref_key: "popoverRef",
865
+ ref: g,
866
+ onClick: k,
867
+ class: K({ "pointer-events-none": _.disabled })
868
+ }, [
869
+ We(_.$slots, "reference", {}, () => [
870
+ D[0] || (D[0] = r("button", null, "Click me!", -1))
871
+ ])
872
+ ], 2)) : F("", !0),
873
+ _.trigger === "hover" ? (c(), p("div", {
874
+ key: 1,
875
+ ref_key: "popoverRef",
876
+ ref: g,
877
+ onMouseover: j,
878
+ onMouseleave: T,
879
+ class: K({ "pointer-events-none": _.disabled })
880
+ }, [
881
+ We(_.$slots, "reference", {}, () => [
882
+ D[1] || (D[1] = r("button", null, "Click me!", -1))
883
+ ])
884
+ ], 34)) : F("", !0),
885
+ (c(), X(Ke, { to: _.teleport }, [
886
+ N(ft, { name: "fade" }, {
887
+ default: Z(() => [
888
+ ne(r("div", {
889
+ class: K(["vsTailwind vs-popover__content", _.placement]),
890
+ ref_key: "contentPop",
891
+ ref: l,
892
+ style: fe({
893
+ width: _.width ? _.width + "px" : "fit-content",
894
+ zIndex: 10002
895
+ })
896
+ }, [
897
+ r("div", ao, [
898
+ We(_.$slots, "default", {}, () => [
899
+ D[2] || (D[2] = r("span", null, "Popover content", -1))
900
+ ])
901
+ ])
902
+ ], 6), [
903
+ [Ee, i.value]
904
+ ])
905
+ ]),
906
+ _: 3
907
+ })
908
+ ], 8, ["to"]))
909
+ ])
910
+ ], 512));
911
+ }
912
+ });
913
+ pt({ visible: !0 });
914
+ const lo = { class: "legend-widget flex flex-col bg-white border border-stone-200 shadow-2xs rounded-xl z-10 relative" }, co = {
915
+ key: 0,
916
+ class: "p-5 pb-3 flex justify-between items-start gap-[30px]"
917
+ }, uo = { class: "inline-block font-semibold text-lg text-gray-800 dark:text-neutral-200" }, po = { class: "flex flex-col gap-1" }, ho = { class: "flex flex-col gap-1 p-5 pt-0" }, fo = ["innerHTML"], go = {
918
+ __name: "vs-info-widget",
919
+ props: {
920
+ config: {
921
+ type: Object,
922
+ required: !0
923
+ }
924
+ },
925
+ setup(e) {
926
+ const t = e, o = M(() => {
927
+ var i;
928
+ return ((i = t.config) == null ? void 0 : i.title) || "";
929
+ }), n = M(() => {
930
+ var i;
931
+ return ((i = t.config) == null ? void 0 : i.content) || "";
932
+ }), s = M(() => {
933
+ var i;
934
+ return ((i = t.config) == null ? void 0 : i.goTo) || [];
935
+ });
936
+ return (i, d) => {
937
+ var g, l;
938
+ const v = G("router-link");
939
+ return c(), p("div", lo, [
940
+ o.value || (g = s.value) != null && g.length ? (c(), p("div", co, [
941
+ r("h2", uo, S(o.value), 1),
942
+ (l = s.value) != null && l.length ? (c(), X(Ze(Ve), {
943
+ key: 0,
944
+ placement: "bottom"
945
+ }, {
946
+ reference: Z(() => [
947
+ N(Ze(Ve), {
948
+ trigger: "hover",
949
+ placement: "right"
950
+ }, {
951
+ reference: Z(() => [...d[0] || (d[0] = [
952
+ r("div", { class: "flex items-center justify-center h-8 w-8 transition-colors rounded-full hover:bg-gray-100 cursor-pointer" }, [
953
+ r("svg", {
954
+ width: "16",
955
+ height: "16",
956
+ viewBox: "0 0 24 24",
957
+ fill: "none",
958
+ xmlns: "http://www.w3.org/2000/svg"
959
+ }, [
960
+ r("path", {
961
+ d: "M4 12H20",
962
+ stroke: "#000000",
963
+ "stroke-linecap": "round",
964
+ "stroke-linejoin": "round"
965
+ }),
966
+ r("path", {
967
+ d: "M4 6H20",
968
+ stroke: "#000000",
969
+ "stroke-linecap": "round",
970
+ "stroke-linejoin": "round"
971
+ }),
972
+ r("path", {
973
+ d: "M4 18H20",
974
+ stroke: "#000000",
975
+ "stroke-linecap": "round",
976
+ "stroke-linejoin": "round"
977
+ })
978
+ ])
979
+ ], -1)
980
+ ])]),
981
+ default: Z(() => [
982
+ d[1] || (d[1] = ae(" Перейти на карту ", -1))
983
+ ]),
984
+ _: 1
985
+ })
986
+ ]),
987
+ default: Z(() => [
988
+ r("div", po, [
989
+ (c(!0), p(B, null, W(s.value, (u) => (c(), p("div", {
990
+ key: u.label
991
+ }, [
992
+ u.url ? (c(), X(v, {
993
+ key: 0,
994
+ to: u.url,
995
+ class: "text-sm text-gray-800 dark:text-neutral-200 hover:bg-gray-100 hover:text-blue-600 transition-colors rounded px-2 py-1 block"
996
+ }, {
997
+ default: Z(() => [
998
+ ae(S(u.label), 1)
999
+ ]),
1000
+ _: 2
1001
+ }, 1032, ["to"])) : F("", !0)
1002
+ ]))), 128))
1003
+ ])
1004
+ ]),
1005
+ _: 1
1006
+ })) : F("", !0)
1007
+ ])) : F("", !0),
1008
+ r("div", ho, [
1009
+ r("div", { innerHTML: n.value }, null, 8, fo)
1010
+ ])
1011
+ ]);
1012
+ };
1013
+ }
1014
+ }, vo = /* @__PURE__ */ H(go, [["__scopeId", "data-v-629caa82"]]), mo = { class: "w-full flex flex-col bg-white border border-stone-200 shadow-2xs rounded-xl z-10 relative overflow-hidden" }, yo = {
1015
+ key: 0,
1016
+ class: "p-5 pb-3 flex justify-between items-center"
1017
+ }, bo = { class: "inline-block font-semibold text-lg text-gray-800" }, wo = {
1018
+ key: 1,
1019
+ class: "flex"
1020
+ }, xo = { class: "flex items-center mx-[8px]" }, _o = { class: "min-h-[34px] max-h-[34px] overflow-hidden min-w-[34px] flex justify-center items-center bg-stone-100 text-stone-800 py-2 px-3 text-sm rounded-lg" }, ko = { class: "min-h-[34px] flex justify-center items-center text-stone-500 py-2 px-1.5 text-sm" }, Lo = { class: "flex flex-col justify-between pb-5 px-5 h-full overflow-y-auto flex-1 [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent" }, Co = {
1021
+ key: 0,
1022
+ class: "text-center"
1023
+ }, $o = {
1024
+ key: 1,
1025
+ class: "text-red-500"
1026
+ }, Io = { key: 2 }, Vo = ["innerHTML"], So = {
1027
+ key: 1,
1028
+ class: "flow-root"
1029
+ }, Fo = { class: "-my-3 divide-y divide-gray-100 text-sm" }, jo = { class: "font-medium text-gray-900" }, Po = { class: "text-gray-700 sm:col-span-2" }, Eo = {
1030
+ key: 2,
1031
+ class: "vs-map-card-info__nodata"
1032
+ }, Mo = {
1033
+ key: 3,
1034
+ class: "pt-4 flex justify-end"
1035
+ }, To = ["href"], ot = {
1036
+ __name: "vs-card-widget",
1037
+ props: {
1038
+ config: {
1039
+ type: Object,
1040
+ required: !0
1041
+ },
1042
+ cardValues: {
1043
+ type: Object,
1044
+ required: !0
1045
+ }
1046
+ },
1047
+ emits: ["close", "content-resize"],
1048
+ setup(e, { emit: t }) {
1049
+ const o = e, n = t, s = M(() => {
1050
+ var T;
1051
+ return ((T = o.config) == null ? void 0 : T.title) || "";
1052
+ }), i = M(
1053
+ () => !!(typeof window.app == "object" && window.app && window.app.config)
1054
+ ), d = A([]), v = A(!1), g = A(null), l = A(0), u = M(() => l.value + 1), a = M(() => {
1055
+ var T;
1056
+ return ((T = o.info) == null ? void 0 : T.length) || 0;
1057
+ }), m = M(() => d.value[l.value]), h = M(() => {
1058
+ if (!m.value) return {};
1059
+ const { rows: T, columns: k } = m.value;
1060
+ return !T || !k ? {} : k.reduce((_, D) => (!D.hide && !["geom", "geodata", "id"].includes(D.name) && (_[D.ua] = T[D.name] ?? "-"), _), {});
1061
+ });
1062
+ async function f() {
1063
+ var T, k, _, D, le, ce;
1064
+ v.value = !0, g.value = null;
1065
+ try {
1066
+ const te = {
1067
+ id: (T = o.cardValues) == null ? void 0 : T.id,
1068
+ layer: typeof ((k = o.cardValues) == null ? void 0 : k.layer) == "object" ? (D = (_ = o.cardValues) == null ? void 0 : _.layer) == null ? void 0 : D.id : (le = o.cardValues) == null ? void 0 : le.layer,
1069
+ map: (ce = o.cardValues) == null ? void 0 : ce.map
1070
+ }, Ue = await fetch("/api/map-format?" + new URLSearchParams(te)).then((Me) => Me.json());
1071
+ d.value[l.value] = Ue;
1072
+ } catch (te) {
1073
+ g.value = (te == null ? void 0 : te.message) || "Помилка запиту";
1074
+ } finally {
1075
+ v.value = !1, await $e(), n("content-resize");
1076
+ }
1077
+ }
1078
+ function L() {
1079
+ l.value < o.info.length - 1 && (l.value += 1, d.value[l.value] || f());
1080
+ }
1081
+ function j() {
1082
+ l.value > 0 && (l.value -= 1, d.value[l.value] || f());
1083
+ }
1084
+ return xe(async () => {
1085
+ await $e(), f();
1086
+ }), he(
1087
+ () => o.info,
1088
+ () => {
1089
+ l.value = 0, f(), n("content-resize");
1090
+ },
1091
+ { deep: !0 }
1092
+ ), he([() => o.cardValues, () => o.config], async () => {
1093
+ await $e(), f(), n("content-resize");
1094
+ }), (T, k) => {
1095
+ var _, D;
1096
+ return c(), p("div", mo, [
1097
+ s.value ? (c(), p("div", yo, [
1098
+ r("h2", bo, S(s.value), 1),
1099
+ r("button", {
1100
+ type: "button",
1101
+ class: "size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600 ml-2",
1102
+ onClick: k[0] || (k[0] = (le) => n("close"))
1103
+ }, [...k[1] || (k[1] = [
1104
+ r("svg", {
1105
+ class: "shrink-0 size-4 cursor-pointer",
1106
+ xmlns: "http://www.w3.org/2000/svg",
1107
+ width: "24",
1108
+ height: "24",
1109
+ viewBox: "0 0 24 24",
1110
+ fill: "none",
1111
+ stroke: "currentColor",
1112
+ "stroke-width": "2",
1113
+ "stroke-linecap": "round",
1114
+ "stroke-linejoin": "round"
1115
+ }, [
1116
+ r("path", { d: "M18 6 6 18" }),
1117
+ r("path", { d: "m6 6 12 12" })
1118
+ ], -1)
1119
+ ])])
1120
+ ])) : F("", !0),
1121
+ a.value > 1 ? (c(), p("div", wo, [
1122
+ r("button", {
1123
+ type: "button",
1124
+ class: K([{
1125
+ "opacity-flex items-center justify-between border-b px-[16px] py-[8px]50 pointer-events-none": u.value === 1
1126
+ }, "min-h-[34px] min-w-[34px] py-2 px-2.5 inline-flex justify-center items-center gap-x-2 text-sm rounded-lg text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"]),
1127
+ onClick: j
1128
+ }, " ◀ ", 2),
1129
+ r("div", xo, [
1130
+ r("span", _o, S(u.value), 1),
1131
+ k[2] || (k[2] = r("span", { class: "min-h-[34px] flex justify-center items-center text-stone-500 py-2 px-1.5 text-sm" }, "з", -1)),
1132
+ r("span", ko, S(a.value), 1)
1133
+ ]),
1134
+ r("button", {
1135
+ type: "button",
1136
+ onClick: L,
1137
+ class: K([{
1138
+ "opacity-50 pointer-events-none": u.value === a.value
1139
+ }, "min-h-[34px] min-w-[34px] py-2 px-2.5 inline-flex justify-center items-center gap-x-2 text-sm rounded-lg text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"])
1140
+ }, " ▶ ", 2)
1141
+ ])) : F("", !0),
1142
+ r("div", Lo, [
1143
+ v.value ? (c(), p("div", Co, "Завантаження даних...")) : g.value ? (c(), p("div", $o, " Помилка завантаження даних ")) : (c(), p("div", Io, [
1144
+ (_ = m.value) != null && _.html ? (c(), p("div", {
1145
+ key: 0,
1146
+ innerHTML: m.value.html,
1147
+ class: "custom-table-html border-b"
1148
+ }, null, 8, Vo)) : Object.keys(h.value).length ? (c(), p("div", So, [
1149
+ r("dl", Fo, [
1150
+ (c(!0), p(B, null, W(h.value, (le, ce) => (c(), p("div", {
1151
+ key: ce,
1152
+ class: "grid grid-cols-1 gap-1 py-3 even:bg-gray-50 sm:grid-cols-3 sm:gap-4"
1153
+ }, [
1154
+ r("dt", jo, S(ce), 1),
1155
+ r("dd", Po, S(le), 1)
1156
+ ]))), 128))
1157
+ ])
1158
+ ])) : (c(), p("div", Eo, "Даних не знайдено."))
1159
+ ])),
1160
+ (D = m.value) != null && D.cardInterface && i.value ? (c(), p("div", Mo, [
1161
+ r("a", {
1162
+ href: `/card/${m.value.cardInterface}/${m.value.id}`,
1163
+ target: "_blank",
1164
+ class: "w-full !cursor-pointer text-center gap-2 px-3 py-1.5 bg-blue-600 text-white rounded hover:bg-blue-700 transition text-sm font-medium"
1165
+ }, " Перейти в реєстр ", 8, To)
1166
+ ])) : F("", !0)
1167
+ ])
1168
+ ]);
1169
+ };
1170
+ }
1171
+ }, zo = { class: "size-full flex flex-col bg-white border border-gray-200 shadow-2xs rounded-xl dark:bg-neutral-800 dark:border-neutral-700" }, Ao = {
1172
+ key: 0,
1173
+ class: "p-5 pb-0 items-center"
1174
+ }, Bo = { class: "inline-block font-semibold text-lg text-gray-800 dark:text-neutral-200" }, Oo = { class: "h-full p-5" }, Do = { class: "h-full flex flex-col justify-between space-y-4" }, Uo = { class: "space-y-4" }, Ro = {
1175
+ key: 0,
1176
+ class: "flex gap-x-1 w-full h-2.5 rounded-full overflow-hidden"
1177
+ }, Ho = ["aria-valuenow"], Wo = { class: "text-sm text-gray-500 px-2 w-full py-2 cursor-pointer !flex flex-row items-center rounded-lg group hover:bg-gray-100" }, No = ["for"], Zo = {
1178
+ key: 0,
1179
+ width: "16",
1180
+ height: "auto",
1181
+ src: "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTYgMTYnIGZpbGw9J3doaXRlJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnPjxwYXRoIGQ9J00xMi4yMDcgNC43OTNhMSAxIDAgMDEwIDEuNDE0bC01IDVhMSAxIDAgMDEtMS40MTQgMGwtMi0yYTEgMSAwIDAxMS40MTQtMS40MTRMNi41IDkuMDg2bDQuMjkzLTQuMjkzYTEgMSAwIDAxMS40MTQgMHonLz48L3N2Zz4="
1182
+ }, qo = ["id", "onUpdate:modelValue"], Go = { class: "ml-2 text-gray-800 dark:text-neutral-200" }, Jo = {
1183
+ key: 0,
1184
+ class: "ms-auto text-xs text-gray-500 dark:text-neutral-500"
1185
+ }, Qo = {
1186
+ __name: "vs-attributre-widget",
1187
+ props: {
1188
+ config: {
1189
+ type: Object,
1190
+ required: !0
1191
+ },
1192
+ map: {
1193
+ type: Object,
1194
+ required: !0
1195
+ }
1196
+ },
1197
+ setup(e) {
1198
+ const t = e, o = M(() => {
1199
+ var g;
1200
+ return ((g = t.config) == null ? void 0 : g.title) || "";
1201
+ }), n = A([]), s = M(() => t.config.layer.style.rules.some(
1202
+ (g) => g.count !== void 0
1203
+ )), i = M(() => t.config.layer.style.rules.reduce(
1204
+ (g, l) => g + (l.count || 0),
1205
+ 0
1206
+ )), d = (g) => !g || i.value === 0 ? 0 : Math.round(g / i.value * 100), v = () => {
1207
+ const l = t.config.layer.style.rules.filter(
1208
+ (u, a) => n.value[a]
1209
+ ).map((u) => u.id || u.value).join(",");
1210
+ if (t.config.layer.id) {
1211
+ const u = t.map.getSource(t.config.layer.id);
1212
+ if (u) {
1213
+ const m = u.tiles[0].split("?filter=")[0], h = l ? `${m}?filter=${t.config.layer.style.attribute}=${l}` : m;
1214
+ u.setTiles([h]);
1215
+ }
1216
+ }
1217
+ };
1218
+ return xe(() => {
1219
+ var g;
1220
+ (g = t.config) != null && g.layer && (we(t.map, t.config.layer), n.value = new Array(t.config.layer.style.rules.length).fill(
1221
+ !1
1222
+ ));
1223
+ }), (g, l) => (c(), p("div", zo, [
1224
+ o.value ? (c(), p("div", Ao, [
1225
+ r("div", null, [
1226
+ r("h2", Bo, S(o.value), 1)
1227
+ ])
1228
+ ])) : F("", !0),
1229
+ r("div", Oo, [
1230
+ r("div", Do, [
1231
+ r("div", Uo, [
1232
+ s.value ? (c(), p("div", Ro, [
1233
+ (c(!0), p(B, null, W(e.config.layer.style.rules, (u, a) => (c(), p("div", {
1234
+ key: a,
1235
+ class: "flex flex-col justify-center overflow-hidden text-xs text-white text-center whitespace-nowrap",
1236
+ style: fe({
1237
+ width: `${d(u.count)}%`,
1238
+ backgroundColor: u.color
1239
+ }),
1240
+ role: "progressbar",
1241
+ "aria-valuenow": d(u.count),
1242
+ "aria-valuemin": "0",
1243
+ "aria-valuemax": "100"
1244
+ }, null, 12, Ho))), 128))
1245
+ ])) : F("", !0),
1246
+ r("ul", null, [
1247
+ (c(!0), p(B, null, W(e.config.layer.style.rules, (u, a) => (c(), p("li", { key: a }, [
1248
+ r("div", Wo, [
1249
+ r("label", {
1250
+ for: `filter-${a}`,
1251
+ class: "flex items-center w-full cursor-pointer"
1252
+ }, [
1253
+ r("div", {
1254
+ class: "w-[18px] h-[18px] border rounded-[4px] flex items-center justify-center",
1255
+ style: fe({
1256
+ background: n.value[a] ? u.color || "#2563eb" : "#fff",
1257
+ borderColor: n.value[a] ? u.color || "#2563eb" : u.color || "#d9d9d9"
1258
+ })
1259
+ }, [
1260
+ n.value[a] ? (c(), p("img", Zo)) : F("", !0)
1261
+ ], 4),
1262
+ ne(r("input", {
1263
+ type: "checkbox",
1264
+ id: `filter-${a}`,
1265
+ "onUpdate:modelValue": (m) => n.value[a] = m,
1266
+ onChange: v,
1267
+ class: "hidden",
1268
+ disabled: !1
1269
+ }, null, 40, qo), [
1270
+ [qe, n.value[a]]
1271
+ ]),
1272
+ r("span", Go, S(u.label || u.text), 1),
1273
+ s.value ? (c(), p("span", Jo, "(" + S(u.count) + ")", 1)) : F("", !0)
1274
+ ], 8, No)
1275
+ ])
1276
+ ]))), 128))
1277
+ ])
1278
+ ])
1279
+ ])
1280
+ ])
1281
+ ]));
1282
+ }
1283
+ }, Yo = { class: "hover:bg-gray-100 rounded-lg flex items-center ml-[20px] py-[8px] px-[8px]" }, Ko = ["for"], Xo = { class: "custom-checkbox-wrapper" }, er = ["id", "checked"], tr = { class: "custom-checkbox" }, or = {
1284
+ key: 0,
1285
+ xmlns: "http://www.w3.org/2000/svg",
1286
+ width: "12",
1287
+ height: "8",
1288
+ viewBox: "0 0 12 8",
1289
+ fill: "none"
1290
+ }, rr = { class: "flex items-center justify-between ml-2 w-full" }, sr = ["title"], nr = {
1291
+ key: 0,
1292
+ class: "text-xs opacity-60 text-[#4b5563]"
1293
+ }, ir = {
1294
+ __name: "vs-map-catalog-item",
1295
+ props: {
1296
+ layer: {
1297
+ type: Object,
1298
+ required: !0
1299
+ },
1300
+ map: {
1301
+ type: Object,
1302
+ default: () => null
1303
+ },
1304
+ selectedLayers: {
1305
+ type: Array,
1306
+ default: () => []
1307
+ }
1308
+ },
1309
+ emits: ["select", "remove"],
1310
+ setup(e, { emit: t }) {
1311
+ const o = e, n = t, s = M(() => o.selectedLayers.some((v) => v.id === o.layer.id)), i = (v) => Intl.NumberFormat("uk", {
1312
+ notation: "compact"
1313
+ }).format(v), d = (v) => {
1314
+ n(v ? "select" : "remove", o.layer);
1315
+ };
1316
+ return (v, g) => {
1317
+ var l, u, a, m, h;
1318
+ return c(), p("div", Yo, [
1319
+ r("label", {
1320
+ class: "flex items-center w-full cursor-pointer",
1321
+ for: e.layer.id
1322
+ }, [
1323
+ r("div", Xo, [
1324
+ r("input", {
1325
+ id: e.layer.id,
1326
+ type: "checkbox",
1327
+ checked: s.value,
1328
+ onChange: g[0] || (g[0] = (f) => d(f.target.checked)),
1329
+ class: "custom-checkbox-input"
1330
+ }, null, 40, er),
1331
+ r("div", tr, [
1332
+ s.value ? (c(), p("svg", or, [...g[1] || (g[1] = [
1333
+ r("path", {
1334
+ d: "M10.6663 1L4.24967 7.41667L1.33301 4.5",
1335
+ stroke: "#fff",
1336
+ "stroke-linecap": "round",
1337
+ "stroke-linejoin": "round"
1338
+ }, null, -1)
1339
+ ])])) : F("", !0)
1340
+ ])
1341
+ ]),
1342
+ r("div", rr, [
1343
+ r("div", {
1344
+ class: "whitespace-nowrap text text-ellipsis max-w-[260px] overflow-hidden text-[13px] text-[#4b5563]",
1345
+ title: (l = e.layer) == null ? void 0 : l.name
1346
+ }, S(((u = e.layer) == null ? void 0 : u.name) || ((a = e.layer) == null ? void 0 : a.title)), 9, sr),
1347
+ isNaN(i((m = e.layer) == null ? void 0 : m.count)) ? F("", !0) : (c(), p("div", nr, S(i((h = e.layer) == null ? void 0 : h.count)), 1))
1348
+ ])
1349
+ ], 8, Ko)
1350
+ ]);
1351
+ };
1352
+ }
1353
+ }, ar = /* @__PURE__ */ H(ir, [["__scopeId", "data-v-b96f3537"]]), lr = {}, cr = {
1354
+ xmlns: "http://www.w3.org/2000/svg",
1355
+ width: "16",
1356
+ height: "16",
1357
+ viewBox: "0 0 24 24",
1358
+ fill: "none",
1359
+ stroke: "currentColor",
1360
+ "stroke-width": "2",
1361
+ "stroke-linecap": "round",
1362
+ "stroke-linejoin": "round",
1363
+ class: "lucide lucide-zoom-in"
1364
+ };
1365
+ function dr(e, t) {
1366
+ return c(), p("svg", cr, [...t[0] || (t[0] = [
1367
+ r("circle", {
1368
+ cx: "11",
1369
+ cy: "11",
1370
+ r: "8"
1371
+ }, null, -1),
1372
+ r("line", {
1373
+ x1: "21",
1374
+ x2: "16.65",
1375
+ y1: "21",
1376
+ y2: "16.65"
1377
+ }, null, -1),
1378
+ r("line", {
1379
+ x1: "11",
1380
+ x2: "11",
1381
+ y1: "8",
1382
+ y2: "14"
1383
+ }, null, -1),
1384
+ r("line", {
1385
+ x1: "8",
1386
+ x2: "14",
1387
+ y1: "11",
1388
+ y2: "11"
1389
+ }, null, -1)
1390
+ ])]);
1391
+ }
1392
+ const ur = /* @__PURE__ */ H(lr, [["render", dr]]), pr = {}, hr = {
1393
+ xmlns: "http://www.w3.org/2000/svg",
1394
+ width: "16",
1395
+ height: "16",
1396
+ viewBox: "0 0 24 24",
1397
+ fill: "none",
1398
+ stroke: "currentColor",
1399
+ "stroke-width": "2",
1400
+ "stroke-linecap": "round",
1401
+ "stroke-linejoin": "round",
1402
+ class: "lucide lucide-info"
1403
+ };
1404
+ function fr(e, t) {
1405
+ return c(), p("svg", hr, [...t[0] || (t[0] = [
1406
+ r("circle", {
1407
+ cx: "12",
1408
+ cy: "12",
1409
+ r: "10"
1410
+ }, null, -1),
1411
+ r("path", { d: "M12 16v-4" }, null, -1),
1412
+ r("path", { d: "M12 8h.01" }, null, -1)
1413
+ ])]);
1414
+ }
1415
+ const gr = /* @__PURE__ */ H(pr, [["render", fr]]), vr = {}, mr = {
1416
+ xmlns: "http://www.w3.org/2000/svg",
1417
+ width: "16",
1418
+ height: "16",
1419
+ viewBox: "0 0 24 24",
1420
+ fill: "none",
1421
+ stroke: "currentColor",
1422
+ "stroke-width": "2",
1423
+ "stroke-linecap": "round",
1424
+ "stroke-linejoin": "round",
1425
+ class: "lucide lucide-table"
1426
+ };
1427
+ function yr(e, t) {
1428
+ return c(), p("svg", mr, [...t[0] || (t[0] = [
1429
+ r("path", { d: "M12 3v18" }, null, -1),
1430
+ r("rect", {
1431
+ width: "18",
1432
+ height: "18",
1433
+ x: "3",
1434
+ y: "3",
1435
+ rx: "2"
1436
+ }, null, -1),
1437
+ r("path", { d: "M3 9h18" }, null, -1),
1438
+ r("path", { d: "M3 15h18" }, null, -1)
1439
+ ])]);
1440
+ }
1441
+ const br = /* @__PURE__ */ H(vr, [["render", yr]]), wr = {}, xr = {
1442
+ xmlns: "http://www.w3.org/2000/svg",
1443
+ width: "16",
1444
+ height: "16",
1445
+ viewBox: "0 0 24 24",
1446
+ fill: "none",
1447
+ stroke: "currentColor",
1448
+ "stroke-width": "2",
1449
+ "stroke-linecap": "round",
1450
+ "stroke-linejoin": "round",
1451
+ class: "lucide lucide-trash2"
1452
+ };
1453
+ function _r(e, t) {
1454
+ return c(), p("svg", xr, [...t[0] || (t[0] = [
1455
+ Oe('<path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line>', 5)
1456
+ ])]);
1457
+ }
1458
+ const kr = /* @__PURE__ */ H(wr, [["render", _r]]), Lr = {}, Cr = {
1459
+ xmlns: "http://www.w3.org/2000/svg",
1460
+ width: "18",
1461
+ height: "18",
1462
+ viewBox: "0 0 24 24",
1463
+ fill: "none",
1464
+ stroke: "currentColor",
1465
+ "stroke-width": "2",
1466
+ "stroke-linecap": "round",
1467
+ "stroke-linejoin": "round",
1468
+ class: "lucide lucide-more-vertical text-gray-600"
1469
+ };
1470
+ function $r(e, t) {
1471
+ return c(), p("svg", Cr, [...t[0] || (t[0] = [
1472
+ r("circle", {
1473
+ cx: "12",
1474
+ cy: "12",
1475
+ r: "1"
1476
+ }, null, -1),
1477
+ r("circle", {
1478
+ cx: "12",
1479
+ cy: "5",
1480
+ r: "1"
1481
+ }, null, -1),
1482
+ r("circle", {
1483
+ cx: "12",
1484
+ cy: "19",
1485
+ r: "1"
1486
+ }, null, -1)
1487
+ ])]);
1488
+ }
1489
+ const Ir = /* @__PURE__ */ H(Lr, [["render", $r]]), Vr = {}, Sr = {
1490
+ width: "6",
1491
+ height: "10",
1492
+ viewBox: "0 0 6 10",
1493
+ fill: "none",
1494
+ xmlns: "http://www.w3.org/2000/svg"
1495
+ };
1496
+ function Fr(e, t) {
1497
+ return c(), p("svg", Sr, [...t[0] || (t[0] = [
1498
+ r("path", {
1499
+ d: "M1 9L5 5L1 1",
1500
+ stroke: "currentColor",
1501
+ "stroke-linecap": "round",
1502
+ "stroke-linejoin": "round"
1503
+ }, null, -1)
1504
+ ])]);
1505
+ }
1506
+ const jr = /* @__PURE__ */ H(Vr, [["render", Fr]]), Pr = {}, Er = {
1507
+ width: "18",
1508
+ height: "18",
1509
+ viewBox: "0 0 24 24",
1510
+ fill: "none",
1511
+ xmlns: "http://www.w3.org/2000/svg"
1512
+ };
1513
+ function Mr(e, t) {
1514
+ return c(), p("svg", Er, [...t[0] || (t[0] = [
1515
+ Oe('<g clip-path="url(#clip0_231_103)"><path d="M12 20L9 21V12.5L4.52 7.572C4.18545 7.20393 4.00005 6.7244 4 6.227V4H20V6.172C19.9999 6.70239 19.7891 7.21101 19.414 7.586L15 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M21.121 20.1209C21.5406 19.7014 21.8265 19.1668 21.9423 18.5849C22.0581 18.0029 21.9988 17.3997 21.7717 16.8514C21.5447 16.3032 21.1602 15.8346 20.6668 15.5049C20.1734 15.1752 19.5934 14.9993 19 14.9993C18.4066 14.9993 17.8266 15.1752 17.3332 15.5049C16.8398 15.8346 16.4553 16.3032 16.2283 16.8514C16.0012 17.3997 15.9419 18.0029 16.0577 18.5849C16.1735 19.1668 16.4594 19.7014 16.879 20.1209C17.297 20.5399 18.004 21.1659 19 21.9999C20.051 21.1099 20.759 20.4839 21.121 20.1209Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M19 18V18.01" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_231_103"><rect width="24" height="24" fill="white"></rect></clipPath></defs>', 2)
1516
+ ])]);
1517
+ }
1518
+ const Tr = /* @__PURE__ */ H(Pr, [["render", Mr]]);
1519
+ function zr() {
1520
+ const t = new URLSearchParams(window.location.search).get("layers");
1521
+ return t ? t.split(",") : [];
1522
+ }
1523
+ function Ar(e) {
1524
+ const t = new URLSearchParams(window.location.search);
1525
+ e.length > 0 ? t.set("layers", e.join(",")) : t.delete("layers");
1526
+ const o = `${window.location.pathname}?${t.toString()}`;
1527
+ window.history.replaceState({}, "", o);
1528
+ }
1529
+ const Br = {
1530
+ components: {
1531
+ VsPopover: Ve,
1532
+ VsLayersItem: ar,
1533
+ ZoomInIcon: ur,
1534
+ InfoIcon: gr,
1535
+ TableIcon: br,
1536
+ TrashIcon: kr,
1537
+ DotsIcon: Ir,
1538
+ ChevronRightIcon: jr,
1539
+ FilterIcon: Tr
1540
+ },
1541
+ props: {
1542
+ center: { type: Array, default: () => [26.2516, 50.6199] },
1543
+ zoom: { type: Number, default: 12 },
1544
+ map: { type: Object, default: () => null },
1545
+ history: { type: Boolean, default: !1 }
1546
+ },
1547
+ emits: ["content-resize"],
1548
+ data() {
1549
+ return {
1550
+ layers: null,
1551
+ rawCatalog: null,
1552
+ categories: null,
1553
+ selectedCategory: "",
1554
+ search: "",
1555
+ activeView: "catalog",
1556
+ selectedLayers: [],
1557
+ mounted: !1,
1558
+ draggedLayerIndex: null,
1559
+ filterType: "",
1560
+ filterCategory: ""
1561
+ };
1562
+ },
1563
+ computed: {
1564
+ searchedLayers() {
1565
+ return this.layers.filter(
1566
+ ({ name: e }) => e == null ? void 0 : e.toLowerCase().match(this.search.toLowerCase())
1567
+ );
1568
+ }
1569
+ },
1570
+ async mounted() {
1571
+ if (this.mounted = !0, await this.getLayers(), this.categories = this.layersCategories(), this.history) {
1572
+ const e = zr();
1573
+ e.length > 0 && this.layers && (e.forEach((t) => {
1574
+ const o = this.layers.find((n) => String(n.id) === t);
1575
+ if (o && !this.selectedLayers.find((n) => n.id === o.id)) {
1576
+ const n = {
1577
+ ...o,
1578
+ visible: !0,
1579
+ opacity: 100,
1580
+ showFilters: !1
1581
+ };
1582
+ this.selectedLayers.push(n), we(this.map, n);
1583
+ }
1584
+ }), this.activeView = "selected");
1585
+ }
1586
+ this._resizeObserver = new window.ResizeObserver(() => {
1587
+ this.$emit("content-resize");
1588
+ }), this.$nextTick(() => {
1589
+ const e = this.$el;
1590
+ e && this._resizeObserver.observe(e);
1591
+ });
1592
+ },
1593
+ beforeUnmount() {
1594
+ this._resizeObserver && this._resizeObserver.disconnect();
1595
+ },
1596
+ watch: {
1597
+ // --- HISTORY: оновлення layers у URL ---
1598
+ selectedLayers: {
1599
+ handler(e) {
1600
+ this.history && Ar(e.map((t) => t.id));
1601
+ },
1602
+ deep: !0
1603
+ }
1604
+ },
1605
+ methods: {
1606
+ async getLayers() {
1607
+ try {
1608
+ const e = await fetch("/api/map-catalog").then((o) => o.json()), t = (e.services || []).filter(
1609
+ (o) => o.service_type !== "other"
1610
+ );
1611
+ this.layers = [...t, ...e.rasters || []], this.$emit("catalog-layers", this.layers), this.rawCatalog = {
1612
+ ...e,
1613
+ services: t
1614
+ };
1615
+ } catch (e) {
1616
+ console.error("Помилка завантаження шарів:", e);
1617
+ }
1618
+ },
1619
+ layersCategories() {
1620
+ return this.rawCatalog ? {
1621
+ Сервіси: this.rawCatalog.services || [],
1622
+ Растри: this.rawCatalog.rasters || []
1623
+ } : {};
1624
+ },
1625
+ selectCategory(e) {
1626
+ this.selectedCategory = this.selectedCategory === e ? "" : e;
1627
+ },
1628
+ formatNumber(e) {
1629
+ return Intl.NumberFormat("uk", {
1630
+ notation: "compact"
1631
+ }).format(e);
1632
+ },
1633
+ onEnter() {
1634
+ this.layers.filter(
1635
+ ({ name: e }) => e == null ? void 0 : e.toLowerCase().match(this.search.toLowerCase())
1636
+ );
1637
+ },
1638
+ clearSearch() {
1639
+ this.search = "";
1640
+ },
1641
+ addToSelected(e) {
1642
+ if (!this.selectedLayers.find((t) => t.id === e.id)) {
1643
+ const t = {
1644
+ ...e,
1645
+ visible: !0,
1646
+ opacity: 100,
1647
+ showFilters: !1
1648
+ };
1649
+ this.selectedLayers.unshift(t), we(this.map, t);
1650
+ }
1651
+ },
1652
+ deleteLayer(e) {
1653
+ const t = this.selectedLayers.findIndex((o) => o.id === e.id);
1654
+ t !== -1 && this.selectedLayers.splice(t, 1), Ce(this.map, e.id);
1655
+ },
1656
+ async toggleLayerVisibility(e) {
1657
+ try {
1658
+ e.visible ? (await we(this.map, e), this.updateLayerOpacity(e)) : await Ce(this.map, e.id);
1659
+ } catch (t) {
1660
+ console.error("Error toggling layer visibility:", t), e.visible = !e.visible;
1661
+ }
1662
+ },
1663
+ onLayerOpacityChange(e) {
1664
+ this.updateLayerOpacity(e);
1665
+ },
1666
+ updateLayerOpacity(e) {
1667
+ if (this.map) {
1668
+ const t = this.map.getStyle().layers.filter((n) => n.id.includes(e.id)), o = e.opacity / 100;
1669
+ t.forEach((n) => {
1670
+ n.type === "fill" ? (e.originalFillOpacity || (e.originalFillOpacity = this.map.getPaintProperty(n.id, "fill-opacity") || 1), this.map.setPaintProperty(
1671
+ n.id,
1672
+ "fill-opacity",
1673
+ e.originalFillOpacity * o
1674
+ )) : n.type === "raster" ? this.map.setPaintProperty(n.id, "raster-opacity", o) : n.type === "line" ? this.map.setPaintProperty(n.id, "line-opacity", o) : n.type === "circle" ? (this.map.setPaintProperty(n.id, "circle-opacity", o), this.map.setPaintProperty(
1675
+ n.id,
1676
+ "circle-stroke-opacity",
1677
+ o
1678
+ )) : n.type === "symbol" && (this.map.setPaintProperty(n.id, "icon-opacity", o), this.map.setPaintProperty(n.id, "text-opacity", o));
1679
+ });
1680
+ }
1681
+ },
1682
+ async handleRemoveFromCatalog(e) {
1683
+ const t = this.selectedLayers.find((o) => o.id === e.id);
1684
+ t != null && t.visible && await Ce(this.map, e.id), this.deleteLayer(e);
1685
+ },
1686
+ clearSelectedLayers() {
1687
+ this.selectedLayers.forEach(async (e) => {
1688
+ e.visible && await Ce(this.map, e.id);
1689
+ }), this.selectedLayers = [];
1690
+ },
1691
+ zoomToLayer(e) {
1692
+ this.fitBoundsByLayer(e);
1693
+ },
1694
+ showLayerInfo(e) {
1695
+ },
1696
+ showLayerTable(e) {
1697
+ },
1698
+ showLayerFilter(e) {
1699
+ e.showFilters = !e.showFilters;
1700
+ },
1701
+ fitBoundsByLayer(e) {
1702
+ e && e.bbox && Array.isArray(e.bbox) && e.bbox.length === 4 && this.map && this.map.fitBounds(
1703
+ [
1704
+ [e.bbox[0], e.bbox[1]],
1705
+ [e.bbox[2], e.bbox[3]]
1706
+ ],
1707
+ {
1708
+ padding: 50,
1709
+ duration: 0
1710
+ }
1711
+ );
1712
+ },
1713
+ async handleFilterChange({ url: e }, t) {
1714
+ const o = this.map.getSource(t.id);
1715
+ if (o) {
1716
+ const s = o.tiles[0].split("?filter=")[0], i = e ? `${s}?filter=${e}` : s;
1717
+ o.setTiles([i]);
1718
+ }
1719
+ },
1720
+ popoverActions(e) {
1721
+ return [
1722
+ {
1723
+ label: "Збільшити до шару",
1724
+ icon: "ZoomInIcon",
1725
+ class: Array.isArray(e.bbox) && e.bbox.length === 4 ? "text-gray-700 hover:bg-gray-100" : "text-gray-700 hover:bg-gray-100 opacity-50 cursor-not-allowed",
1726
+ handler: "zoomToLayer"
1727
+ },
1728
+ // {
1729
+ // label: "Фільтри",
1730
+ // icon: "FilterIcon",
1731
+ // class: [
1732
+ // layer.filters?.length
1733
+ // ? "text-gray-700 hover:bg-gray-100"
1734
+ // : "text-gray-700 hover:bg-gray-100 opacity-50 cursor-not-allowed",
1735
+ // layer.showFilters ? "bg-blue-100 text-blue-700" : "",
1736
+ // ].join(" "),
1737
+ // handler: "showLayerFilter",
1738
+ // },
1739
+ {
1740
+ label: "Інформація про шар",
1741
+ icon: "InfoIcon",
1742
+ class: "text-gray-700 hover:bg-gray-100 opacity-50 cursor-not-allowed",
1743
+ handler: "showLayerInfo"
1744
+ },
1745
+ {
1746
+ label: "Таблиця шару",
1747
+ icon: "TableIcon",
1748
+ class: "text-gray-700 hover:bg-gray-100 opacity-50 cursor-not-allowed",
1749
+ handler: "showLayerTable"
1750
+ },
1751
+ {
1752
+ divider: !0
1753
+ },
1754
+ {
1755
+ label: "Видалити шар",
1756
+ icon: "TrashIcon",
1757
+ class: "text-red-600 hover:bg-red-50",
1758
+ handler: "deleteLayer"
1759
+ }
1760
+ ];
1761
+ },
1762
+ onDragStart(e) {
1763
+ this.draggedLayerIndex = e;
1764
+ },
1765
+ onDragOver(e) {
1766
+ },
1767
+ onDrop(e) {
1768
+ if (this.draggedLayerIndex === null || this.draggedLayerIndex === e)
1769
+ return;
1770
+ const t = this.selectedLayers[this.draggedLayerIndex];
1771
+ if (this.selectedLayers.splice(this.draggedLayerIndex, 1), this.selectedLayers.splice(e, 0, t), this.draggedLayerIndex = null, this.map && this.selectedLayers.length > 1)
1772
+ for (let o = this.selectedLayers.length - 1; o >= 0; o--) {
1773
+ const n = this.selectedLayers[o];
1774
+ n.visible && this.map.getStyle().layers.find((s) => s.id.includes(n.id)) && this.map.getStyle().layers.forEach((s) => {
1775
+ s.id.includes(n.id) && this.map.moveLayer(s.id);
1776
+ });
1777
+ }
1778
+ },
1779
+ onDragEnd() {
1780
+ this.draggedLayerIndex = null;
1781
+ }
1782
+ }
1783
+ }, Or = { class: "w-full max-w-md mx-auto p-4 bg-white border border-gray-200 rounded-lg shadow-sm" }, Dr = { class: "flex items-center justify-between mb-4" }, Ur = { class: "flex items-center gap-2" }, Rr = { class: "text-lg font-semibold text-gray-800" }, Hr = { key: 0 }, Wr = { key: 1 }, Nr = { class: "flex mb-4 border-b border-gray-200" }, Zr = { key: 0 }, qr = { class: "mb-4" }, Gr = {
1784
+ key: 0,
1785
+ class: "space-y-2 max-h-[400px] overflow-y-auto pr-1 [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"
1786
+ }, Jr = ["onDragstart", "onDragover", "onDrop"], Qr = { class: "flex items-center justify-between" }, Yr = { class: "flex items-center gap-2 cursor-move" }, Kr = ["onUpdate:modelValue", "onChange"], Xr = { class: "text-gray-800" }, es = { class: "flex items-center gap-2" }, ts = { class: "relative" }, os = { class: "flex items-center gap-2" }, rs = ["onUpdate:modelValue", "onInput"], ss = { class: "text-xs text-gray-600 whitespace-nowrap" }, ns = ["onClick"], is = { class: "relative" }, as = { class: "w-48" }, ls = {
1787
+ key: 0,
1788
+ class: "my-1 border-gray-200"
1789
+ }, cs = ["disabled", "onClick"], ds = {
1790
+ class: "p-1 rounded-full hover:bg-gray-100 transition-colors",
1791
+ "aria-label": "Layer actions"
1792
+ }, us = {
1793
+ key: 0,
1794
+ class: "bg-blue-50 rounded-md mt-2"
1795
+ }, ps = { class: "px-2 pt-2 text-blue-600 hover:text-blue-700 transition-colors" }, hs = {
1796
+ key: 0,
1797
+ class: "text-center text-[14px] text-[#4b5563]"
1798
+ }, fs = { class: "relative mt-[10px]" }, gs = {
1799
+ key: 0,
1800
+ class: "vs-layers-catalog__list flex-1 scrollable-container overflow-auto mt-2 catalog-list"
1801
+ }, vs = {
1802
+ key: 0,
1803
+ class: "text-center text-[14px] text-[#4b5563]"
1804
+ }, ms = {
1805
+ key: 0,
1806
+ class: "text-center text-[14px] text-[#4b5563]"
1807
+ }, ys = ["onClick"], bs = { class: "flex items-center gap-x-3" }, ws = ["title"], xs = { class: "text-xs opacity-60 text-[#4b5563]" };
1808
+ function _s(e, t, o, n, s, i) {
1809
+ var h;
1810
+ const d = G("VsPopover"), v = G("DotsIcon"), g = G("VsFilter"), l = G("searchIcon"), u = G("closeIcon"), a = G("VsLayersItem"), m = G("chevronRightIcon");
1811
+ return c(), p("div", Or, [
1812
+ r("div", Dr, [
1813
+ r("div", Ur, [
1814
+ t[7] || (t[7] = r("svg", {
1815
+ xmlns: "http://www.w3.org/2000/svg",
1816
+ width: "20",
1817
+ height: "20",
1818
+ viewBox: "0 0 24 24",
1819
+ fill: "none",
1820
+ stroke: "currentColor",
1821
+ "stroke-width": "2",
1822
+ "stroke-linecap": "round",
1823
+ "stroke-linejoin": "round",
1824
+ class: "lucide lucide-layers text-blue-600"
1825
+ }, [
1826
+ r("path", { d: "m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z" }),
1827
+ r("path", { d: "m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65" }),
1828
+ r("path", { d: "m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65" })
1829
+ ], -1)),
1830
+ r("h2", Rr, [
1831
+ ae(S(s.activeView === "catalog" ? "Каталог" : "Вибрані шари") + " ", 1),
1832
+ s.activeView === "catalog" ? (c(), p("span", Hr, "(" + S(((h = s.layers) == null ? void 0 : h.length) || 0) + ")", 1)) : (c(), p("span", Wr, "(" + S(s.selectedLayers.length) + ")", 1))
1833
+ ])
1834
+ ]),
1835
+ r("button", {
1836
+ class: "p-1 rounded-full hover:bg-gray-200 transition-colors",
1837
+ "aria-label": "Reset layers",
1838
+ onClick: t[0] || (t[0] = (...f) => i.clearSelectedLayers && i.clearSelectedLayers(...f))
1839
+ }, [...t[8] || (t[8] = [
1840
+ Oe('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-refresh-cw text-gray-600" data-v-ed5e991a><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" data-v-ed5e991a></path><path d="M21 3v5h-5" data-v-ed5e991a></path><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" data-v-ed5e991a></path><path d="M8 16H3v5" data-v-ed5e991a></path></svg>', 1)
1841
+ ])])
1842
+ ]),
1843
+ r("div", Nr, [
1844
+ r("button", {
1845
+ class: K([
1846
+ "px-4 py-2 text-sm font-medium",
1847
+ s.activeView === "catalog" ? "text-blue-600 border-b-2 border-blue-600" : "text-gray-600 hover:text-gray-800"
1848
+ ]),
1849
+ onClick: t[1] || (t[1] = (f) => s.activeView = "catalog")
1850
+ }, " Каталог ", 2),
1851
+ r("button", {
1852
+ class: K([
1853
+ "px-4 py-2 text-sm font-medium",
1854
+ s.activeView === "selected" ? "text-blue-600 border-b-2 border-blue-600" : "text-gray-600 hover:text-gray-800"
1855
+ ]),
1856
+ onClick: t[2] || (t[2] = (f) => s.activeView = "selected")
1857
+ }, " Вибрані шари ", 2)
1858
+ ]),
1859
+ s.activeView === "selected" ? (c(), p("div", Zr, [
1860
+ r("div", qr, [
1861
+ r("button", {
1862
+ class: "flex items-center gap-2 text-blue-600 hover:text-blue-700 transition-colors px-3 py-2 rounded-md bg-blue-50 hover:bg-blue-100 w-full justify-center",
1863
+ onClick: t[3] || (t[3] = (f) => s.activeView = "catalog")
1864
+ }, [...t[9] || (t[9] = [
1865
+ r("svg", {
1866
+ xmlns: "http://www.w3.org/2000/svg",
1867
+ width: "16",
1868
+ height: "16",
1869
+ viewBox: "0 0 24 24",
1870
+ fill: "none",
1871
+ stroke: "currentColor",
1872
+ "stroke-width": "2",
1873
+ "stroke-linecap": "round",
1874
+ "stroke-linejoin": "round",
1875
+ class: "lucide lucide-plus"
1876
+ }, [
1877
+ r("path", { d: "M5 12h14" }),
1878
+ r("path", { d: "M12 5v14" })
1879
+ ], -1),
1880
+ r("span", null, "Вибрати шар", -1)
1881
+ ])])
1882
+ ]),
1883
+ s.mounted ? (c(), p("div", Gr, [
1884
+ (c(!0), p(B, null, W(s.selectedLayers, (f, L) => {
1885
+ var j, T;
1886
+ return c(), p("div", {
1887
+ key: f.id || L,
1888
+ class: K(["border border-gray-200 rounded-md p-3 mb-2 bg-white shadow-sm text-[13px] text-[#4b5563]", { dragging: s.draggedLayerIndex === L }]),
1889
+ draggable: "true",
1890
+ onDragstart: (k) => i.onDragStart(L),
1891
+ onDragover: gt((k) => i.onDragOver(L), ["prevent"]),
1892
+ onDrop: (k) => i.onDrop(L),
1893
+ onDragend: t[4] || (t[4] = (...k) => i.onDragEnd && i.onDragEnd(...k))
1894
+ }, [
1895
+ r("div", Qr, [
1896
+ r("div", Yr, [
1897
+ t[10] || (t[10] = Oe('<svg width="16" height="16" fill="none" stroke="#9ca3af" stroke-width="2" viewBox="0 0 24 24" class="mr-1 shrink-0" data-v-ed5e991a><circle cx="5" cy="5" r="1.5" data-v-ed5e991a></circle><circle cx="5" cy="12" r="1.5" data-v-ed5e991a></circle><circle cx="5" cy="19" r="1.5" data-v-ed5e991a></circle><circle cx="12" cy="5" r="1.5" data-v-ed5e991a></circle><circle cx="12" cy="12" r="1.5" data-v-ed5e991a></circle><circle cx="12" cy="19" r="1.5" data-v-ed5e991a></circle><circle cx="19" cy="5" r="1.5" data-v-ed5e991a></circle><circle cx="19" cy="12" r="1.5" data-v-ed5e991a></circle><circle cx="19" cy="19" r="1.5" data-v-ed5e991a></circle></svg>', 1)),
1898
+ ne(r("input", {
1899
+ type: "checkbox",
1900
+ class: "w-4 h-4 text-blue-600 rounded focus:ring-blue-500",
1901
+ "onUpdate:modelValue": (k) => f.visible = k,
1902
+ onChange: (k) => i.toggleLayerVisibility(f)
1903
+ }, null, 40, Kr), [
1904
+ [qe, f.visible]
1905
+ ]),
1906
+ r("span", Xr, S(f.name || f.title || f.label), 1)
1907
+ ]),
1908
+ r("div", es, [
1909
+ r("div", ts, [
1910
+ N(d, { placement: "bottom" }, {
1911
+ reference: Z(() => [
1912
+ r("div", {
1913
+ class: "text-sm text-gray-600 hover:text-gray-800 transition-colors px-2 py-1 rounded hover:bg-gray-100 cursor-pointer",
1914
+ onClick: (k) => i.updateLayerOpacity(f)
1915
+ }, S(f.opacity || 100) + "% ", 9, ns)
1916
+ ]),
1917
+ default: Z(() => [
1918
+ r("div", os, [
1919
+ t[11] || (t[11] = r("label", { class: "text-gray-600 whitespace-nowrap" }, "Прозорість:", -1)),
1920
+ ne(r("input", {
1921
+ type: "range",
1922
+ min: "0",
1923
+ max: "100",
1924
+ step: "1",
1925
+ "onUpdate:modelValue": (k) => f.opacity = k,
1926
+ onInput: (k) => i.onLayerOpacityChange(f),
1927
+ class: "h-2 w-full accent-blue-600 rounded-lg cursor-pointer bg-gray-200"
1928
+ }, null, 40, rs), [
1929
+ [Ne, f.opacity]
1930
+ ]),
1931
+ r("span", ss, S(Math.round(f.opacity)) + "% ", 1)
1932
+ ])
1933
+ ]),
1934
+ _: 2
1935
+ }, 1024)
1936
+ ]),
1937
+ r("div", is, [
1938
+ N(d, { placement: "bottom" }, {
1939
+ reference: Z(() => [
1940
+ r("div", ds, [
1941
+ N(v)
1942
+ ])
1943
+ ]),
1944
+ default: Z(() => [
1945
+ r("div", as, [
1946
+ (c(!0), p(B, null, W(i.popoverActions(f), (k, _) => (c(), p(B, { key: _ }, [
1947
+ k.divider ? (c(), p("hr", ls)) : (c(), p("button", {
1948
+ key: 1,
1949
+ class: K(
1950
+ "w-full p-2 text-left text-sm flex items-center gap-2 " + (k.class || "")
1951
+ ),
1952
+ disabled: k.disabled,
1953
+ onClick: (D) => !k.disabled && e.$options.methods[k.handler].call(this, f)
1954
+ }, [
1955
+ (c(), X(De(k.icon), { class: "lucide" })),
1956
+ ae(" " + S(k.label), 1)
1957
+ ], 10, cs))
1958
+ ], 64))), 128))
1959
+ ])
1960
+ ]),
1961
+ _: 2
1962
+ }, 1024)
1963
+ ])
1964
+ ])
1965
+ ]),
1966
+ f.showFilters ? (c(), p("div", us, [
1967
+ r("div", ps, " Фільтри для шару: " + S(f.name || f.title || f.label), 1),
1968
+ ne(N(g, {
1969
+ ref_for: !0,
1970
+ ref: "filter",
1971
+ scheme: f.filters,
1972
+ header: !1,
1973
+ urlSeparator: "true",
1974
+ view: "plain",
1975
+ name: "filter",
1976
+ onFilterChange: (k) => i.handleFilterChange(k, f)
1977
+ }, null, 8, ["scheme", "onFilterChange"]), [
1978
+ [Ee, (j = f.filters) == null ? void 0 : j.length]
1979
+ ]),
1980
+ ne(r("div", null, [...t[12] || (t[12] = [
1981
+ r("div", { class: "px-2 text-[14px] text-[#4b5563]" }, " Фільтри для шару відсутні ", -1)
1982
+ ])], 512), [
1983
+ [Ee, !((T = f.filters) != null && T.length)]
1984
+ ])
1985
+ ])) : F("", !0)
1986
+ ], 42, Jr);
1987
+ }), 128)),
1988
+ s.selectedLayers.length === 0 ? (c(), p("div", hs, [...t[13] || (t[13] = [
1989
+ r("p", null, 'Щоб додати шар, натисніть на кнопку "Вибрати шар".', -1)
1990
+ ])])) : F("", !0)
1991
+ ])) : F("", !0)
1992
+ ])) : (c(), p(B, { key: 1 }, [
1993
+ r("div", fs, [
1994
+ ne(r("input", {
1995
+ title: "value",
1996
+ placeholder: "Введіть назву шару...",
1997
+ "onUpdate:modelValue": t[5] || (t[5] = (f) => s.search = f),
1998
+ type: "text",
1999
+ class: "py-[7px] pl-2 pe-8 block w-full bg-gray-100 border-transparent rounded-lg text-sm focus:bg-white focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",
2000
+ onKeyup: t[6] || (t[6] = vt((...f) => i.onEnter && i.onEnter(...f), ["enter"]))
2001
+ }, null, 544), [
2002
+ [Ne, s.search]
2003
+ ]),
2004
+ N(l, {
2005
+ class: "absolute top-1/2 left-[8px] w-[16px] h-[16px]",
2006
+ style: { transform: "translate(0, -50%)" }
2007
+ }),
2008
+ s.search ? (c(), X(u, {
2009
+ key: 0,
2010
+ class: "absolute top-1/2 right-[10px] w-[16px] h-[16px] cursor-pointer",
2011
+ style: { transform: "translate(0, -50%)" },
2012
+ onClick: i.clearSearch
2013
+ }, null, 8, ["onClick"])) : F("", !0)
2014
+ ]),
2015
+ s.categories ? (c(), p("div", gs, [
2016
+ s.search ? (c(), p(B, { key: 0 }, [
2017
+ (c(!0), p(B, null, W(i.searchedLayers, (f, L) => (c(), X(a, {
2018
+ key: L,
2019
+ layer: f,
2020
+ map: o.map,
2021
+ selectedLayers: s.selectedLayers,
2022
+ onSelect: i.addToSelected,
2023
+ onRemove: i.handleRemoveFromCatalog
2024
+ }, null, 8, ["layer", "map", "selectedLayers", "onSelect", "onRemove"]))), 128)),
2025
+ i.searchedLayers.length === 0 ? (c(), p("div", vs, " Нічого не знайдено ")) : F("", !0)
2026
+ ], 64)) : (c(), p(B, { key: 1 }, [
2027
+ !s.categories || Object.keys(s.categories).length === 0 ? (c(), p("div", ms, " Каталог порожній ")) : (c(!0), p(B, { key: 1 }, W(Object.keys(s.categories), (f) => (c(), p("div", { key: f }, [
2028
+ r("div", {
2029
+ class: "hover:bg-gray-100 focus:bg-gray-100 px-2.5 cursor-pointer p-[8px] rounded-lg flex justify-between items-center",
2030
+ onClick: (L) => i.selectCategory(f)
2031
+ }, [
2032
+ r("div", bs, [
2033
+ N(m, {
2034
+ class: K({
2035
+ "rotate-up": f === s.selectedCategory,
2036
+ "rotate-down": f !== s.selectedCategory
2037
+ })
2038
+ }, null, 8, ["class"]),
2039
+ r("div", {
2040
+ class: "max-w-[260px] text-[14px] text-[#4b5563]",
2041
+ title: f
2042
+ }, S(f), 9, ws)
2043
+ ]),
2044
+ r("div", xs, S(i.formatNumber(s.categories[f].length)), 1)
2045
+ ], 8, ys),
2046
+ ne(r("div", null, [
2047
+ (c(!0), p(B, null, W(s.categories[f], (L, j) => (c(), X(a, {
2048
+ key: j,
2049
+ layer: L,
2050
+ map: o.map,
2051
+ selectedLayers: s.selectedLayers,
2052
+ onSelect: i.addToSelected,
2053
+ onRemove: i.handleRemoveFromCatalog
2054
+ }, null, 8, ["layer", "map", "selectedLayers", "onSelect", "onRemove"]))), 128))
2055
+ ], 512), [
2056
+ [Ee, f === s.selectedCategory]
2057
+ ])
2058
+ ]))), 128))
2059
+ ], 64))
2060
+ ])) : F("", !0)
2061
+ ], 64))
2062
+ ]);
2063
+ }
2064
+ const ks = /* @__PURE__ */ H(Br, [["render", _s], ["__scopeId", "data-v-ed5e991a"]]), Ls = {
2065
+ key: 0,
2066
+ class: "w-full flex flex-col bg-white border border-stone-200 shadow-2xs rounded-xl z-10 relative widget"
2067
+ }, Cs = {
2068
+ key: 0,
2069
+ class: "p-5 pb-3 flex justify-between items-center"
2070
+ }, $s = { class: "inline-block font-semibold text-lg text-gray-800 dark:text-neutral-200" }, Is = { class: "flex flex-col justify-between h-full" }, Vs = {
2071
+ __name: "vs-filters-widget",
2072
+ props: {
2073
+ config: {
2074
+ type: Object,
2075
+ required: !0
2076
+ },
2077
+ map: {
2078
+ type: Object,
2079
+ required: !0
2080
+ },
2081
+ enabledLayerIds: {
2082
+ type: Array,
2083
+ default: () => []
2084
+ }
2085
+ },
2086
+ setup(e) {
2087
+ const t = e, o = M(() => {
2088
+ var d;
2089
+ return ((d = t.config) == null ? void 0 : d.filters) || [];
2090
+ }), n = M(() => o.value), s = M(() => {
2091
+ var v;
2092
+ const d = (v = t.config) == null ? void 0 : v.conditions;
2093
+ return !d || !d.layers ? !0 : t.enabledLayerIds.some((g) => d.layers.includes(g));
2094
+ }), i = async ({ data: d }) => {
2095
+ var a;
2096
+ const v = Object.entries(d).map((m) => m.join("=")).join("|"), g = (a = t.config) == null ? void 0 : a.conditions, l = (g == null ? void 0 : g.layers) || [], u = t.enabledLayerIds.filter(
2097
+ (m) => l.includes(m)
2098
+ );
2099
+ u.length && u.forEach((m) => {
2100
+ const h = t.map.getSource(m);
2101
+ if (h) {
2102
+ const L = h.tiles[0].split("?filter=")[0], j = v ? `${L}?filter=${v}` : L;
2103
+ h.setTiles([j]);
2104
+ }
2105
+ });
2106
+ };
2107
+ return (d, v) => s.value ? (c(), p("div", Ls, [
2108
+ e.config.title ? (c(), p("div", Cs, [
2109
+ r("h2", $s, S(e.config.title), 1)
2110
+ ])) : F("", !0),
2111
+ r("div", Is, [
2112
+ N(Ze(bt), {
2113
+ ref: "filter",
2114
+ schema: n.value,
2115
+ view: "vertical",
2116
+ onChange: i
2117
+ }, null, 8, ["schema"])
2118
+ ])
2119
+ ])) : F("", !0);
2120
+ }
2121
+ }, Ss = {
2122
+ type: "button",
2123
+ class: "py-2 px-2.5 inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg bg-white text-gray-800 hover:bg-gray-50 focus:outline-none focus:bg-gray-49 h-[38px] shadow-md"
2124
+ }, Fs = { class: "flex gap-[5px] items-center" }, js = { class: "text-gray-600" }, Ps = {
2125
+ key: 0,
2126
+ class: "w-[16px] h-[16px] font-medium bg-gray-800 text-white rounded-full flex items-center justify-center text-[10px]"
2127
+ }, Es = {
2128
+ __name: "vs-inline-filters-widget",
2129
+ props: {
2130
+ config: {
2131
+ type: Object,
2132
+ required: !0
2133
+ },
2134
+ map: {
2135
+ type: Object,
2136
+ required: !0
2137
+ },
2138
+ enabledLayerIds: {
2139
+ type: Array,
2140
+ default: () => []
2141
+ }
2142
+ },
2143
+ setup(e) {
2144
+ const t = e, o = A(0), n = A(null), s = M(() => {
2145
+ var l;
2146
+ return ((l = t.config) == null ? void 0 : l.filters) || [];
2147
+ }), i = M(() => s.value.map((l) => ({
2148
+ ...l,
2149
+ id: l.name
2150
+ }))), d = M(() => {
2151
+ var u;
2152
+ const l = (u = t.config) == null ? void 0 : u.conditions;
2153
+ return !l || !l.layers ? !0 : t.enabledLayerIds.some((a) => l.layers.includes(a));
2154
+ }), v = M(() => {
2155
+ var l;
2156
+ if (t.enabledLayerIds && t.enabledLayerIds.length) {
2157
+ const a = (((l = t.config) == null ? void 0 : l.layers) || []).find((m) => m.id === t.enabledLayerIds[0]);
2158
+ return (a == null ? void 0 : a.title) || (a == null ? void 0 : a.name) || (a == null ? void 0 : a.label) || t.enabledLayerIds[0];
2159
+ }
2160
+ return "";
2161
+ }), g = async ({ url: l }) => {
2162
+ var h, f;
2163
+ const u = (h = t.config) == null ? void 0 : h.conditions;
2164
+ if (!u) {
2165
+ const L = (f = t.config) == null ? void 0 : f.layer_id;
2166
+ if (!L) return;
2167
+ const j = t.map.getSource(L);
2168
+ if (j) {
2169
+ const k = j.tiles[0].split("?filter=")[0], _ = l ? `${k}?filter=${l}` : k;
2170
+ j.setTiles([_]);
2171
+ }
2172
+ return;
2173
+ }
2174
+ const a = (u == null ? void 0 : u.layers) || [], m = t.enabledLayerIds.filter((L) => a.includes(L));
2175
+ m.length && m.forEach((L) => {
2176
+ const j = t.map.getSource(L);
2177
+ if (j) {
2178
+ const k = j.tiles[0].split("?filter=")[0], _ = l ? `${k}?filter=${l}` : k;
2179
+ j.setTiles([_]);
2180
+ }
2181
+ });
2182
+ };
2183
+ return he(
2184
+ () => t.enabledLayerIds,
2185
+ (l) => {
2186
+ (!l || !l.length) && n.value && (n.value.activeFilters = {}, o.value = 0);
2187
+ }
2188
+ ), he(
2189
+ () => {
2190
+ var l;
2191
+ return (l = n.value) == null ? void 0 : l.activeFilters;
2192
+ },
2193
+ (l) => {
2194
+ o.value = Object.keys(l || {}).length;
2195
+ },
2196
+ { deep: !0 }
2197
+ ), (l, u) => {
2198
+ const a = G("VsPopover"), m = G("VsFilterList");
2199
+ return d.value && i.value.length ? (c(), X(m, {
2200
+ key: 0,
2201
+ ref_key: "filter",
2202
+ ref: n,
2203
+ isDialog: e.config.dialog ?? !0,
2204
+ scheme: i.value,
2205
+ urlSeparator: "true",
2206
+ view: "plain",
2207
+ name: "filter",
2208
+ onFilterChange: g
2209
+ }, {
2210
+ button: Z(({ visible: h }) => [
2211
+ N(a, {
2212
+ teleport: "body",
2213
+ trigger: "hover",
2214
+ placement: "bottom"
2215
+ }, {
2216
+ reference: Z(() => [
2217
+ r("button", Ss, [
2218
+ r("div", Fs, [
2219
+ u[0] || (u[0] = r("svg", {
2220
+ width: "18",
2221
+ height: "18",
2222
+ viewBox: "0 0 24 24",
2223
+ fill: "none",
2224
+ xmlns: "http://www.w3.org/2000/svg"
2225
+ }, [
2226
+ r("path", {
2227
+ d: "M12 20L9 21V12.5L4.52 7.572C4.18545 7.20393 4.00005 6.7244 4 6.227V4H20V6.172C19.9999 6.70239 19.7891 7.21101 19.414 7.586L15 12",
2228
+ stroke: "currentColor",
2229
+ "stroke-linecap": "round",
2230
+ "stroke-linejoin": "round"
2231
+ }),
2232
+ r("path", {
2233
+ d: "M21.121 20.1209C21.5406 19.7014 21.8265 19.1668 21.9423 18.5849C22.0581 18.0029 21.9988 17.3997 21.7717 16.8514C21.5447 16.3032 21.1602 15.8346 20.6668 15.5049C20.1734 15.1752 19.5934 14.9993 19 14.9993C18.4066 14.9993 17.8266 15.1752 17.3332 15.5049C16.8398 15.8346 16.4553 16.3032 16.2283 16.8514C16.0012 17.3997 15.9419 18.0029 16.0577 18.5849C16.1735 19.1668 16.4594 19.7014 16.879 20.1209C17.297 20.5399 18.004 21.1659 19 21.9999C20.051 21.1099 20.759 20.4839 21.121 20.1209Z",
2234
+ stroke: "currentColor",
2235
+ "stroke-linecap": "round",
2236
+ "stroke-linejoin": "round"
2237
+ }),
2238
+ r("path", {
2239
+ d: "M19 18V18.01",
2240
+ stroke: "currentColor",
2241
+ "stroke-linecap": "round",
2242
+ "stroke-linejoin": "round"
2243
+ })
2244
+ ], -1)),
2245
+ r("span", js, S(v.value), 1),
2246
+ o.value ? (c(), p("span", Ps, S(o.value), 1)) : F("", !0)
2247
+ ])
2248
+ ])
2249
+ ]),
2250
+ default: Z(() => [
2251
+ u[1] || (u[1] = ae(" Відкрити бокову панель ", -1))
2252
+ ]),
2253
+ _: 1
2254
+ })
2255
+ ]),
2256
+ _: 1
2257
+ }, 8, ["isDialog", "scheme"])) : F("", !0);
2258
+ };
2259
+ }
2260
+ }, Ms = {
2261
+ name: "VsListWidget",
2262
+ props: {
2263
+ config: {
2264
+ type: Object,
2265
+ required: !0
2266
+ }
2267
+ },
2268
+ data() {
2269
+ return {
2270
+ items: [],
2271
+ total: 0,
2272
+ currentPage: 1,
2273
+ limit: 16,
2274
+ rootEl: null,
2275
+ resizeObserver: null
2276
+ };
2277
+ },
2278
+ methods: {
2279
+ async fetchData() {
2280
+ const e = {
2281
+ page: this.currentPage,
2282
+ limit: this.limit
2283
+ };
2284
+ try {
2285
+ const t = await fetch(this.config.api + "?" + new URLSearchParams(e)).then((o) => o.json());
2286
+ this.items = t.rows, this.total = t.total, this.$emit("content-resize");
2287
+ } catch (t) {
2288
+ console.error("Error fetching data:", t);
2289
+ }
2290
+ },
2291
+ handlePageChange(e) {
2292
+ this.currentPage = e, this.fetchData();
2293
+ },
2294
+ changeLimit(e) {
2295
+ this.limit = e, this.currentPage = 1, this.fetchData();
2296
+ }
2297
+ },
2298
+ mounted() {
2299
+ this.fetchData(), this.resizeObserver = new ResizeObserver(() => {
2300
+ this.$emit("content-resize");
2301
+ }), this.$nextTick(() => {
2302
+ this.$refs.rootEl && this.resizeObserver.observe(this.$refs.rootEl);
2303
+ });
2304
+ },
2305
+ beforeUnmount() {
2306
+ this.resizeObserver && this.$refs.rootEl && (this.resizeObserver.unobserve(this.$refs.rootEl), this.resizeObserver.disconnect());
2307
+ }
2308
+ }, Ts = {
2309
+ class: "bg-white p-4 rounded-lg h-full flex flex-col overflow-hidden",
2310
+ ref: "rootEl"
2311
+ }, zs = {
2312
+ key: 0,
2313
+ class: "flex flex-col flex-1 overflow-hidden"
2314
+ }, As = { class: "space-y-0 overflow-y-auto flex-1 [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent" }, Bs = ["onClick"], Os = { class: "text-base font-medium" }, Ds = { class: "mt-2 flex flex-wrap gap-2" }, Us = {
2315
+ key: 1,
2316
+ class: "px-2 py-1 text-sm bg-gray-100 rounded-full"
2317
+ }, Rs = {
2318
+ key: 0,
2319
+ class: "my-5 pr-2"
2320
+ }, Hs = { class: "paginationWrapper relative flex justify-center" }, Ws = {
2321
+ key: 1,
2322
+ class: "text-center text-slate-400"
2323
+ };
2324
+ function Ns(e, t, o, n, s, i) {
2325
+ var v;
2326
+ const d = G("VsPagination");
2327
+ return c(), p("div", Ts, [
2328
+ t[0] || (t[0] = r("h2", { class: "text-xl font-semibold mb-4" }, "Список", -1)),
2329
+ ((v = s.items) == null ? void 0 : v.length) > 0 ? (c(), p("div", zs, [
2330
+ r("div", As, [
2331
+ (c(!0), p(B, null, W(s.items, (g) => (c(), p("div", {
2332
+ key: g.id,
2333
+ class: "py-4 border-b last:border-b-0 hover:bg-gray-50",
2334
+ onClick: (l) => e.$emit("cardValuesId", g.id)
2335
+ }, [
2336
+ r("h3", Os, S(g.name), 1),
2337
+ r("div", Ds, [
2338
+ g.status_data ? (c(), p("span", {
2339
+ key: 0,
2340
+ class: K(["px-2 py-1 text-sm rounded-full", {
2341
+ "bg-green-100 text-green-800": g.status_data.color === "green",
2342
+ "bg-red-100 text-red-800": g.status_data.color === "red"
2343
+ }])
2344
+ }, S(g.status_data.text), 3)) : F("", !0),
2345
+ g.class_mbd_id_data ? (c(), p("span", Us, S(g.class_mbd_id_data.text), 1)) : F("", !0)
2346
+ ])
2347
+ ], 8, Bs))), 128))
2348
+ ]),
2349
+ s.total > s.limit ? (c(), p("div", Rs, [
2350
+ r("div", Hs, [
2351
+ N(d, {
2352
+ total: s.total,
2353
+ maxPages: 4,
2354
+ defaultPage: s.currentPage,
2355
+ pageSize: s.limit,
2356
+ goTo: !1,
2357
+ size: "medium",
2358
+ onPageChange: i.handlePageChange,
2359
+ backgroundColor: "#e5e7eb",
2360
+ borderedCellSelected: !0,
2361
+ pageSizes: [16, 32, 48, 64],
2362
+ onPageSizeChange: i.changeLimit
2363
+ }, null, 8, ["total", "defaultPage", "pageSize", "onPageChange", "onPageSizeChange"])
2364
+ ])
2365
+ ])) : F("", !0)
2366
+ ])) : (c(), p("div", Ws, "Немає даних"))
2367
+ ], 512);
2368
+ }
2369
+ const Zs = /* @__PURE__ */ H(Ms, [["render", Ns]]), qs = { class: "map-skeleton-loader" }, Gs = {
2370
+ __name: "vs-skeleton-loader",
2371
+ setup(e) {
2372
+ return (t, o) => (c(), p("div", qs, [...o[0] || (o[0] = [
2373
+ r("div", { class: "dot-pulse" }, null, -1)
2374
+ ])]));
2375
+ }
2376
+ }, Js = /* @__PURE__ */ H(Gs, [["__scopeId", "data-v-954c1e03"]]), Qs = {}, Ys = {
2377
+ width: "24",
2378
+ height: "24",
2379
+ viewBox: "0 0 24 24",
2380
+ fill: "none",
2381
+ xmlns: "http://www.w3.org/2000/svg"
2382
+ };
2383
+ function Ks(e, t) {
2384
+ return c(), p("svg", Ys, [...t[0] || (t[0] = [
2385
+ r("title", null, "Globe Icon", -1),
2386
+ r("desc", null, " A circular representation of a globe with horizontal and vertical lines ", -1),
2387
+ r("path", {
2388
+ d: "M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",
2389
+ stroke: "#1E40AF",
2390
+ "stroke-width": "1",
2391
+ "stroke-linecap": "round",
2392
+ "stroke-linejoin": "round"
2393
+ }, null, -1),
2394
+ r("path", {
2395
+ d: "M2 12H22",
2396
+ stroke: "#1E40AF",
2397
+ "stroke-width": "1",
2398
+ "stroke-linecap": "round",
2399
+ "stroke-linejoin": "round"
2400
+ }, null, -1),
2401
+ r("path", {
2402
+ d: "M12 2C14.5013 4.73835 15.9228 8.29203 16 12C15.9228 15.708 14.5013 19.2616 12 22C9.49872 19.2616 8.07725 15.708 8 12C8.07725 8.29203 9.49872 4.73835 12 2Z",
2403
+ stroke: "#1E40AF",
2404
+ "stroke-width": "1",
2405
+ "stroke-linecap": "round",
2406
+ "stroke-linejoin": "round"
2407
+ }, null, -1)
2408
+ ])]);
2409
+ }
2410
+ const Xs = /* @__PURE__ */ H(Qs, [["render", Ks]]), en = {
2411
+ components: {
2412
+ homeIcon: Xs
2413
+ },
2414
+ name: "vs-homezoom",
2415
+ props: {
2416
+ map: { type: Object },
2417
+ initialView: { type: Object, default: () => ({}) }
2418
+ },
2419
+ methods: {
2420
+ homeZoom() {
2421
+ !this.map || !this.initialView || (this.initialView.bbox ? this.map.fitBounds(this.initialView.bbox, { duration: 0, padding: 10 }) : this.initialView.center && this.initialView.zoom !== void 0 && (this.map.setCenter(this.initialView.center), this.map.setZoom(this.initialView.zoom)), this.initialView.pitch !== void 0 && this.map.setPitch(this.initialView.pitch), this.initialView.bearing !== void 0 && this.map.setBearing(this.initialView.bearing));
2422
+ }
2423
+ },
2424
+ computed: {}
2425
+ };
2426
+ function tn(e, t, o, n, s, i) {
2427
+ const d = G("homeIcon"), v = G("VsPopover");
2428
+ return c(), p("div", null, [
2429
+ N(v, {
2430
+ trigger: "hover",
2431
+ placement: "left",
2432
+ teleport: "body",
2433
+ class: "flex"
2434
+ }, {
2435
+ reference: Z(() => [
2436
+ N(d, {
2437
+ onClick: i.homeZoom,
2438
+ class: "w-full h-auto p-[9px] [transition:.3s] hover:[transition:.3s] text-[24px] hover:bg-[#DBEAFE] flex font-normal cursor-pointer text-[#1E40AF] bg-[#fff] rounded-[4px] border-[1px] border-solid border-[#E5E7EB]"
2439
+ }, null, 8, ["onClick"])
2440
+ ]),
2441
+ default: Z(() => [
2442
+ t[0] || (t[0] = r("div", null, "Повернутися до початкових налаштувань", -1))
2443
+ ]),
2444
+ _: 1
2445
+ })
2446
+ ]);
2447
+ }
2448
+ const on = /* @__PURE__ */ H(en, [["render", tn]]), rn = {}, sn = {
2449
+ width: "24",
2450
+ height: "24",
2451
+ viewBox: "0 0 24 24",
2452
+ fill: "none",
2453
+ xmlns: "http://www.w3.org/2000/svg"
2454
+ };
2455
+ function nn(e, t) {
2456
+ return c(), p("svg", sn, [...t[0] || (t[0] = [
2457
+ r("title", null, "Document with Two Sections Icon", -1),
2458
+ r("desc", null, "A document icon with a split design indicating two sections", -1),
2459
+ r("path", {
2460
+ d: "M6 9V2H18V9",
2461
+ stroke: "#1E40AF",
2462
+ "stroke-width": "1",
2463
+ "stroke-linecap": "round",
2464
+ "stroke-linejoin": "round"
2465
+ }, null, -1),
2466
+ r("path", {
2467
+ d: "M6 18H4C3.46957 18 2.96086 17.7893 2.58579 17.4142C2.21071 17.0391 2 16.5304 2 16V11C2 10.4696 2.21071 9.96086 2.58579 9.58579C2.96086 9.21071 3.46957 9 4 9H20C20.5304 9 21.0391 9.21071 21.4142 9.58579C21.7893 9.96086 22 10.4696 22 11V16C22 16.5304 21.7893 17.0391 21.4142 17.4142C21.0391 17.7893 20.5304 18 20 18H18",
2468
+ stroke: "#1E40AF",
2469
+ "stroke-width": "1",
2470
+ "stroke-linecap": "round",
2471
+ "stroke-linejoin": "round"
2472
+ }, null, -1),
2473
+ r("path", {
2474
+ d: "M18 14H6V22H18V14Z",
2475
+ stroke: "#1E40AF",
2476
+ "stroke-width": "1",
2477
+ "stroke-linecap": "round",
2478
+ "stroke-linejoin": "round"
2479
+ }, null, -1)
2480
+ ])]);
2481
+ }
2482
+ const an = /* @__PURE__ */ H(rn, [["render", nn]]), ln = {
2483
+ components: {
2484
+ printIcon: an,
2485
+ VsPopover: Ve
2486
+ },
2487
+ props: {
2488
+ map: { type: Object },
2489
+ activeTool: String,
2490
+ setActiveTool: Function
2491
+ },
2492
+ data() {
2493
+ return {
2494
+ printVisible: !1,
2495
+ scriptElements: [],
2496
+ styleElements: [],
2497
+ resourcesLoaded: !1
2498
+ };
2499
+ },
2500
+ watch: {
2501
+ activeTool(e) {
2502
+ e !== "print" ? this.printVisible = !1 : this.init();
2503
+ },
2504
+ async printVisible(e) {
2505
+ !this.resourcesLoaded && e ? (await this.loadResources(), this.init(), this.simulateClick()) : this.removeResources();
2506
+ },
2507
+ activeTool(e, t) {
2508
+ e !== "print" && t === "print" && (this.closePrint && this.closePrint(), this.printVisible = !1), e === "print" && !this.printVisible && (this.printVisible = !0, this.init());
2509
+ }
2510
+ },
2511
+ computed: {
2512
+ modalButtonClasses() {
2513
+ return {
2514
+ "!bg-[#DBEAFE]": this.printVisible,
2515
+ "bg-white": !this.printVisible
2516
+ };
2517
+ }
2518
+ },
2519
+ mounted() {
2520
+ document.addEventListener("click", (e) => {
2521
+ const t = document.querySelector(".mapboxgl-export-list");
2522
+ if (t && t.contains(e.target)) {
2523
+ e.stopPropagation();
2524
+ return;
2525
+ }
2526
+ !e.target.classList.contains("mapboxgl-export-list") && !e.target.classList.contains("print-button") && !e.target.classList.contains("mapboxgl-export-control") && !e.target.id.includes("mapbox-gl-export") && (this.printVisible = !1);
2527
+ });
2528
+ },
2529
+ methods: {
2530
+ addScript(e) {
2531
+ return new Promise((t, o) => {
2532
+ const n = document.createElement("script");
2533
+ n.src = e, n.async = !0, n.onload = t, n.onerror = o, document.head.appendChild(n), this.scriptElements.push(n);
2534
+ });
2535
+ },
2536
+ addStyle(e) {
2537
+ return new Promise((t, o) => {
2538
+ const n = document.createElement("link");
2539
+ n.href = e, n.rel = "stylesheet", n.type = "text/css", n.onload = t, n.onerror = o, document.head.appendChild(n), this.styleElements.push(n);
2540
+ });
2541
+ },
2542
+ async loadResources() {
2543
+ try {
2544
+ await this.addStyle(
2545
+ "https://cdn.jsdelivr.net/npm/@watergis/mapbox-gl-export@3.5.4/dist/mapbox-gl-export.min.css"
2546
+ ), await this.addScript(
2547
+ "https://cdn.jsdelivr.net/npm/@watergis/mapbox-gl-export@3.5.4/dist/mapbox-gl-export.umd.min.js"
2548
+ ), this.resourcesLoaded = !0;
2549
+ } catch (e) {
2550
+ console.error("Failed to load resources:", e);
2551
+ }
2552
+ },
2553
+ removeResources() {
2554
+ this.scriptElements.forEach((e) => {
2555
+ e.parentNode && e.parentNode.removeChild(e);
2556
+ }), this.scriptElements = [], this.styleElements.forEach((e) => {
2557
+ e.parentNode && e.parentNode.removeChild(e);
2558
+ }), this.styleElements = [], this.resourcesLoaded = !1;
2559
+ },
2560
+ async toggleResources() {
2561
+ this.printVisible = !this.printVisible;
2562
+ },
2563
+ init() {
2564
+ if (!window.MapboxExportControl) {
2565
+ console.error("MapboxExportControl is not loaded.");
2566
+ return;
2567
+ }
2568
+ window.mapboxgl.accessToken = "pk.eyJ1Ijoia3Jpemhhbm92c2t5IiwiYSI6ImNsemkxNWtkODA5dDcycnNhMWZzYWM0MTAifQ.6fEpgfd_2mA4UYuflDewpQ";
2569
+ const { MapboxExportControl: e, Size: t, PageOrientation: o, Format: n, DPI: s } = window.MapboxExportControl;
2570
+ this.map.addControl(
2571
+ new e({
2572
+ PageSize: t.A3,
2573
+ PageOrientation: o.Portrait,
2574
+ Format: n.PNG,
2575
+ DPI: s[96],
2576
+ Crosshair: !0,
2577
+ PrintableArea: !0,
2578
+ Local: "uk"
2579
+ })
2580
+ );
2581
+ },
2582
+ simulateClick() {
2583
+ new Promise((t) => {
2584
+ const o = setTimeout(() => {
2585
+ const n = document.querySelector(".mapboxgl-export-control");
2586
+ n && (clearInterval(o), t(n));
2587
+ }, 100);
2588
+ }).then((t) => {
2589
+ t.click();
2590
+ }).catch(() => {
2591
+ console.error("Print button not found.");
2592
+ });
2593
+ },
2594
+ togglePrint() {
2595
+ !this.activeTool || this.activeTool !== "print" ? this.setActiveTool && this.setActiveTool("print") : this.setActiveTool && this.setActiveTool(null), this.printVisible = !this.printVisible, this.printVisible ? this.init() : this.removeResources();
2596
+ }
2597
+ }
2598
+ };
2599
+ function cn(e, t, o, n, s, i) {
2600
+ const d = G("printIcon"), v = G("VsPopover");
2601
+ return c(), X(v, {
2602
+ trigger: "hover",
2603
+ placement: "left",
2604
+ teleport: "body"
2605
+ }, {
2606
+ reference: Z(() => [
2607
+ N(d, {
2608
+ onClick: i.togglePrint,
2609
+ class: K([i.modalButtonClasses, "print-button w-full h-auto p-[9px] [transition:.3s] hover:[transition:.3s] text-[24px] hover:bg-[#DBEAFE] flex font-normal cursor-pointer text-[#1E40AF] bg-[#fff] rounded-[4px] border-[1px] border-solid border-[#E5E7EB]"])
2610
+ }, null, 8, ["onClick", "class"])
2611
+ ]),
2612
+ default: Z(() => [
2613
+ t[0] || (t[0] = r("div", null, "Надрукувати", -1))
2614
+ ]),
2615
+ _: 1
2616
+ });
2617
+ }
2618
+ const dn = /* @__PURE__ */ H(ln, [["render", cn]]), un = {
2619
+ props: {
2620
+ map: {
2621
+ type: Object,
2622
+ required: !0
2623
+ }
2624
+ },
2625
+ data() {
2626
+ return {
2627
+ is3D: !1
2628
+ };
2629
+ },
2630
+ components: {
2631
+ VsPopover: Ve
2632
+ },
2633
+ mounted() {
2634
+ this.map.on("move", this.updateViewStatus), this.updateViewStatus();
2635
+ },
2636
+ beforeUnmount() {
2637
+ this.map.off("move", this.updateViewStatus);
2638
+ },
2639
+ methods: {
2640
+ toggleView() {
2641
+ this.is3D ? this.map.easeTo({
2642
+ pitch: 0,
2643
+ bearing: 0,
2644
+ duration: 1e3
2645
+ }) : this.map.easeTo({
2646
+ pitch: 60,
2647
+ bearing: -29.6,
2648
+ duration: 1e3
2649
+ });
2650
+ },
2651
+ updateViewStatus() {
2652
+ this.is3D = this.map.getPitch() !== 0;
2653
+ }
2654
+ }
2655
+ };
2656
+ function pn(e, t, o, n, s, i) {
2657
+ const d = G("VsPopover");
2658
+ return c(), X(d, {
2659
+ trigger: "hover",
2660
+ placement: "left",
2661
+ teleport: "body",
2662
+ class: "flex"
2663
+ }, {
2664
+ reference: Z(() => [
2665
+ r("div", {
2666
+ class: "font-light w-full h-[44px] p-[9px] [transition:.3s] hover:[transition:.3s] text-[19px] hover:bg-[#DBEAFE] flex cursor-pointer text-[#1E40AF] bg-[#fff] rounded-[4px] border-[1px] border-solid border-[#E5E7EB]",
2667
+ onClick: t[0] || (t[0] = (...v) => i.toggleView && i.toggleView(...v))
2668
+ }, S(s.is3D ? "2D" : "3D"), 1)
2669
+ ]),
2670
+ default: Z(() => [
2671
+ t[1] || (t[1] = r("div", null, "Перемикач виду", -1))
2672
+ ]),
2673
+ _: 1
2674
+ });
2675
+ }
2676
+ const hn = /* @__PURE__ */ H(un, [["render", pn]]), fn = {}, gn = {
2677
+ class: "shrink-0 size-4",
2678
+ xmlns: "http://www.w3.org/2000/svg",
2679
+ width: "24",
2680
+ height: "24",
2681
+ viewBox: "0 0 24 24",
2682
+ fill: "none",
2683
+ stroke: "currentColor",
2684
+ "stroke-width": "2",
2685
+ "stroke-linecap": "round",
2686
+ "stroke-linejoin": "round"
2687
+ };
2688
+ function vn(e, t) {
2689
+ return c(), p("svg", gn, [...t[0] || (t[0] = [
2690
+ r("path", { d: "M18 6 6 18" }, null, -1),
2691
+ r("path", { d: "m6 6 12 12" }, null, -1)
2692
+ ])]);
2693
+ }
2694
+ const mn = /* @__PURE__ */ H(fn, [["render", vn]]), yn = {
2695
+ props: {
2696
+ bgColor: {
2697
+ type: String,
2698
+ default: "#1E40AF"
2699
+ }
2700
+ }
2701
+ }, bn = {
2702
+ width: "24",
2703
+ height: "24",
2704
+ viewBox: "0 0 24 24",
2705
+ fill: "none",
2706
+ xmlns: "http://www.w3.org/2000/svg"
2707
+ }, wn = ["stroke"], xn = ["stroke"], _n = ["stroke"], kn = ["stroke"], Ln = ["stroke"], Cn = ["stroke"];
2708
+ function $n(e, t, o, n, s, i) {
2709
+ return c(), p("svg", bn, [
2710
+ t[0] || (t[0] = r("title", null, "Target Icon", -1)),
2711
+ t[1] || (t[1] = r("desc", null, "A target icon with a circular pattern inside a rounded square", -1)),
2712
+ r("path", {
2713
+ d: "M2 12H5",
2714
+ stroke: o.bgColor,
2715
+ "stroke-width": "1",
2716
+ "stroke-linecap": "round",
2717
+ "stroke-linejoin": "round"
2718
+ }, null, 8, wn),
2719
+ r("path", {
2720
+ d: "M19 12H22",
2721
+ stroke: o.bgColor,
2722
+ "stroke-width": "1",
2723
+ "stroke-linecap": "round",
2724
+ "stroke-linejoin": "round"
2725
+ }, null, 8, xn),
2726
+ r("path", {
2727
+ d: "M12 2V5",
2728
+ stroke: o.bgColor,
2729
+ "stroke-width": "1",
2730
+ "stroke-linecap": "round",
2731
+ "stroke-linejoin": "round"
2732
+ }, null, 8, _n),
2733
+ r("path", {
2734
+ d: "M12 19V22",
2735
+ stroke: o.bgColor,
2736
+ "stroke-width": "1",
2737
+ "stroke-linecap": "round",
2738
+ "stroke-linejoin": "round"
2739
+ }, null, 8, kn),
2740
+ r("path", {
2741
+ d: "M12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19Z",
2742
+ stroke: o.bgColor,
2743
+ "stroke-width": "1",
2744
+ "stroke-linecap": "round",
2745
+ "stroke-linejoin": "round"
2746
+ }, null, 8, Ln),
2747
+ r("path", {
2748
+ d: "M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z",
2749
+ stroke: o.bgColor,
2750
+ "stroke-width": "1",
2751
+ "stroke-linecap": "round",
2752
+ "stroke-linejoin": "round"
2753
+ }, null, 8, Cn)
2754
+ ]);
2755
+ }
2756
+ const In = /* @__PURE__ */ H(yn, [["render", $n]]), Vn = {
2757
+ components: {
2758
+ geoIcon: In,
2759
+ VsPopover: Ve,
2760
+ closeIcon: mn
2761
+ },
2762
+ data() {
2763
+ return {
2764
+ location: null,
2765
+ data: null,
2766
+ marker: null,
2767
+ showLocation: !1
2768
+ };
2769
+ },
2770
+ computed: {
2771
+ modalButtonClasses() {
2772
+ return {
2773
+ "!bg-[#DBEAFE]": this.showLocation,
2774
+ "bg-white": !this.showLocation
2775
+ };
2776
+ }
2777
+ },
2778
+ props: {
2779
+ map: { type: Object }
2780
+ },
2781
+ beforeUnmount() {
2782
+ var e;
2783
+ (e = this.marker) == null || e.remove();
2784
+ },
2785
+ watch: {
2786
+ activeControl(e, t) {
2787
+ e !== "geolocation" && t === "geolocation" && (this.showLocation = !1, this.closeGeolocation());
2788
+ }
2789
+ },
2790
+ methods: {
2791
+ togleGeolocation() {
2792
+ this.showLocation = !this.showLocation, this.showLocation ? this.getUserLocation() : (this.closeGeolocation(), this.activeControl = "no");
2793
+ },
2794
+ getUserLocation() {
2795
+ navigator.geolocation ? navigator.geolocation.getCurrentPosition(
2796
+ this.onGeolocationSuccess,
2797
+ this.onGeolocationError
2798
+ ) : (this.showLocation = !1, this.activeControl = "no", this.$notify({
2799
+ type: "error",
2800
+ title: "Помилка",
2801
+ message: "Цей браузер не підтримує геолокацію"
2802
+ }), this.$emit("close"));
2803
+ },
2804
+ async onGeolocationSuccess(e) {
2805
+ this.location = {
2806
+ latitude: e.coords.latitude,
2807
+ longitude: e.coords.longitude
2808
+ };
2809
+ const o = await (await fetch(
2810
+ `https://nominatim.openstreetmap.org/reverse?format=json&lat=${this.location.latitude}&lon=${this.location.longitude}`
2811
+ )).json();
2812
+ this.data = o.address;
2813
+ const n = [this.location.longitude, this.location.latitude], s = [
2814
+ [parseFloat(o.boundingbox[2]), parseFloat(o.boundingbox[0])],
2815
+ [parseFloat(o.boundingbox[3]), parseFloat(o.boundingbox[1])]
2816
+ ];
2817
+ this.map.fitBounds(s, {
2818
+ padding: 200,
2819
+ maxZoom: 16
2820
+ }), this.marker || (this.marker = new Marker({
2821
+ color: "var(--primary)"
2822
+ })), this.marker.setLngLat(n).addTo(this.map), this.activeControl = "geolocation";
2823
+ },
2824
+ closeGeolocation() {
2825
+ this.showLocation = !1, this.marker && (this.marker.remove(), this.marker = null), this.location = null, this.data = null;
2826
+ },
2827
+ onGeolocationError() {
2828
+ this.showLocation = !1, this.activeControl = "no", this.$notify({
2829
+ type: "error",
2830
+ title: "Помилка",
2831
+ message: "Для визначення геолокації потрібен HTTPS протокол"
2832
+ }), this.$emit("close");
2833
+ }
2834
+ }
2835
+ }, Sn = {
2836
+ key: 0,
2837
+ class: "max-w-[412px] absolute w-full top-[20px] right-[70px] bg-white border rounded-[15px] p-4 z-10"
2838
+ }, Fn = { class: "flex justify-between items-center border-b pb-[16px]" }, jn = { class: "d-flex" }, Pn = { class: "pt-[16px]" };
2839
+ function En(e, t, o, n, s, i) {
2840
+ var l, u, a, m, h, f;
2841
+ const d = G("closeIcon"), v = G("geoIcon"), g = G("VsPopover");
2842
+ return c(), p("div", null, [
2843
+ (c(), X(Ke, { to: "#maplibre-demo-map" }, [
2844
+ s.location ? (c(), p("div", Sn, [
2845
+ r("div", Fn, [
2846
+ t[0] || (t[0] = r("div", { class: "text-lg font-semibold" }, "Ваша геолокація", -1)),
2847
+ r("div", jn, [
2848
+ N(d, { onClick: i.closeGeolocation }, null, 8, ["onClick"])
2849
+ ])
2850
+ ]),
2851
+ r("div", Pn, [
2852
+ r("div", null, [
2853
+ t[1] || (t[1] = r("strong", null, "Широта:", -1)),
2854
+ ae(" " + S((l = s.location) == null ? void 0 : l.latitude), 1)
2855
+ ]),
2856
+ r("div", null, [
2857
+ t[2] || (t[2] = r("strong", null, "Довгота:", -1)),
2858
+ ae(" " + S((u = s.location) == null ? void 0 : u.longitude), 1)
2859
+ ]),
2860
+ r("div", null, [
2861
+ t[3] || (t[3] = r("strong", null, "КраЇна:", -1)),
2862
+ ae(" " + S((a = s.data) == null ? void 0 : a.country), 1)
2863
+ ]),
2864
+ r("div", null, [
2865
+ t[4] || (t[4] = r("strong", null, "Код країни:", -1)),
2866
+ ae(" " + S((m = s.data) == null ? void 0 : m.country_code), 1)
2867
+ ]),
2868
+ r("div", null, [
2869
+ t[5] || (t[5] = r("strong", null, "Місто:", -1)),
2870
+ ae(" " + S((h = s.data) == null ? void 0 : h.city), 1)
2871
+ ]),
2872
+ r("div", null, [
2873
+ t[6] || (t[6] = r("strong", null, "Поштовий індекс:", -1)),
2874
+ ae(" " + S((f = s.data) == null ? void 0 : f.postcode), 1)
2875
+ ])
2876
+ ])
2877
+ ])) : F("", !0)
2878
+ ])),
2879
+ N(g, {
2880
+ trigger: "hover",
2881
+ placement: "left",
2882
+ teleport: "body",
2883
+ class: "flex"
2884
+ }, {
2885
+ reference: Z(() => [
2886
+ N(v, {
2887
+ onClick: i.togleGeolocation,
2888
+ class: K([i.modalButtonClasses, "w-full h-auto p-[9px] [transition:.3s] hover:[transition:.3s] text-[24px] hover:bg-[#DBEAFE] flex font-normal cursor-pointer text-[#1E40AF] bg-[#fff] rounded-[4px] border-[1px] border-solid border-[#E5E7EB]"])
2889
+ }, null, 8, ["onClick", "class"])
2890
+ ]),
2891
+ default: Z(() => [
2892
+ t[7] || (t[7] = r("div", null, "Дізнатися геолокацію", -1))
2893
+ ]),
2894
+ _: 1
2895
+ })
2896
+ ]);
2897
+ }
2898
+ const Mn = /* @__PURE__ */ H(Vn, [["render", En]]), Be = {
2899
+ __name: "vs-map-widget-column",
2900
+ props: {
2901
+ position: String,
2902
+ widgets: Array,
2903
+ map: Object,
2904
+ mapLoaded: Boolean,
2905
+ cardValues: Object,
2906
+ hasFilters: Boolean,
2907
+ currentFilterLayer: Object,
2908
+ enabledLayerIds: Array,
2909
+ getWidgetComponent: Function,
2910
+ getColumnWidth: Function,
2911
+ rightColumnOffset: [String, Number],
2912
+ maxHeight: Number,
2913
+ history: Boolean
2914
+ },
2915
+ emits: [
2916
+ "set-filter-layer",
2917
+ "update:enabledLayerIds",
2918
+ "cardValuesId",
2919
+ "closeCard",
2920
+ "content-resize"
2921
+ ],
2922
+ setup(e, { expose: t, emit: o }) {
2923
+ const n = o, s = e, i = A(
2924
+ s.widgets.map((l) => {
2925
+ var u;
2926
+ return {
2927
+ ...l,
2928
+ config: { ...l.config, visible: ((u = l.config) == null ? void 0 : u.visible) !== !1 }
2929
+ };
2930
+ })
2931
+ );
2932
+ he(
2933
+ () => s.widgets.map((l) => l.id || l.type).join(","),
2934
+ () => {
2935
+ i.value = s.widgets.map((l) => {
2936
+ var u;
2937
+ return {
2938
+ ...l,
2939
+ config: { ...l.config, visible: ((u = l.config) == null ? void 0 : u.visible) !== !1 }
2940
+ };
2941
+ });
2942
+ }
2943
+ );
2944
+ function d(l) {
2945
+ const u = i.value.find((a) => a.id === l);
2946
+ u && u.config && (u.config.visible = !u.config.visible, setTimeout(() => {
2947
+ n("content-resize");
2948
+ }, 30));
2949
+ }
2950
+ const v = A(null);
2951
+ t({ columnRef: v });
2952
+ let g = null;
2953
+ return xe(() => {
2954
+ g = new MutationObserver(() => {
2955
+ var l;
2956
+ clearTimeout((l = v.value) == null ? void 0 : l._resizeTimeout), v.value._resizeTimeout = setTimeout(() => {
2957
+ n("content-resize");
2958
+ }, 30);
2959
+ }), v.value && g.observe(v.value, {
2960
+ childList: !0,
2961
+ subtree: !0,
2962
+ characterData: !0
2963
+ });
2964
+ }), mt(() => {
2965
+ g && g.disconnect();
2966
+ }), (l, u) => e.mapLoaded ? (c(), p("div", {
2967
+ key: 0,
2968
+ class: "widget-column",
2969
+ ref_key: "columnRef",
2970
+ ref: v,
2971
+ style: fe({
2972
+ width: e.getColumnWidth(e.position),
2973
+ paddingRight: e.rightColumnOffset
2974
+ })
2975
+ }, [
2976
+ (c(!0), p(B, null, W(i.value, (a) => {
2977
+ var m;
2978
+ return c(), p(B, {
2979
+ key: a.id || a.type
2980
+ }, [
2981
+ a.type !== "card" ? ne((c(), X(De(e.getWidgetComponent(a.type)), {
2982
+ key: 0,
2983
+ map: e.map,
2984
+ config: a.config,
2985
+ hasFilters: e.hasFilters,
2986
+ currentLayer: e.currentFilterLayer,
2987
+ enabledLayerIds: e.enabledLayerIds,
2988
+ history: e.history,
2989
+ onSetFilterLayer: u[0] || (u[0] = (h) => l.$emit("set-filter-layer", h)),
2990
+ "onUpdate:enabledLayerIds": u[1] || (u[1] = (h) => l.$emit("update:enabledLayerIds", h)),
2991
+ onCardValuesId: u[2] || (u[2] = (h) => l.$emit("cardValuesId", h)),
2992
+ onShowWidget: d,
2993
+ onCatalogLayers: u[3] || (u[3] = (h) => l.$emit("catalog-layers", h)),
2994
+ class: "widget"
2995
+ }, null, 40, ["map", "config", "hasFilters", "currentLayer", "enabledLayerIds", "history"])), [
2996
+ [Ee, ((m = a.config) == null ? void 0 : m.visible) !== !1]
2997
+ ]) : F("", !0),
2998
+ e.cardValues && a.type === "card" ? (c(), X(ot, {
2999
+ key: 1,
3000
+ config: a.config,
3001
+ cardValues: e.cardValues,
3002
+ class: "widget",
3003
+ onClose: u[4] || (u[4] = (h) => l.$emit("closeCard"))
3004
+ }, null, 8, ["config", "cardValues"])) : F("", !0)
3005
+ ], 64);
3006
+ }), 128))
3007
+ ], 4)) : F("", !0);
3008
+ }
3009
+ }, Tn = { class: "map-widgets-flex" }, zn = { class: "widgets-left" }, An = { class: "widgets-top" }, Bn = { class: "widgets-bottom" }, On = { class: "widgets-right" }, Dn = { class: "widgets-top" }, Un = { class: "widgets-bottom" }, Rn = { class: "absolute top-[180px] right-2 z-10 flex flex-col gap-[5px]" }, Hn = {
3010
+ __name: "vs-map",
3011
+ props: {
3012
+ table: {
3013
+ type: String,
3014
+ required: !0
3015
+ },
3016
+ height: {
3017
+ type: String,
3018
+ required: !0
3019
+ }
3020
+ },
3021
+ setup(e) {
3022
+ const t = e, o = A(null), n = A(!1);
3023
+ let s = null;
3024
+ const i = A(null), d = A(null), v = A([]), g = A([]), l = A(null), u = A(null), a = A(null), m = A([]);
3025
+ let h = null;
3026
+ function f(b) {
3027
+ return !a.value || !a.value.widgets ? [] : b === "center" ? [
3028
+ ...a.value.widgets.filter(
3029
+ (x) => (x.position || {}) === "center"
3030
+ ) || [],
3031
+ ...g.value.filter((x) => x.position === "center")
3032
+ ] : a.value.widgets.filter(
3033
+ (y) => (y.position || {}) === b
3034
+ ) || [];
3035
+ }
3036
+ const L = (b, y, x) => {
3037
+ try {
3038
+ if (b)
3039
+ if (x === "markdown") {
3040
+ const $ = b.replace(/\{\{([^}]+)\}\}/g, (w, C) => {
3041
+ try {
3042
+ return new Function("data", `with(data) { return ${C} }`)(y);
3043
+ } catch {
3044
+ return "";
3045
+ }
3046
+ });
3047
+ return marked($);
3048
+ } else
3049
+ return y[b] || b;
3050
+ } catch ($) {
3051
+ return console.error("Error processing template:", $), b;
3052
+ }
3053
+ }, j = (b, y, x, $, w) => {
3054
+ const C = L(b, $, w), P = y ? L(y, $, w) : "";
3055
+ let V = "";
3056
+ return x != null && x.length && (V = x.map((E) => {
3057
+ const J = L(E.value, $, w);
3058
+ return `
3059
+ <tr class="flex justify-between items-center">
3060
+ <td class="font-medium mr-1.5 flex items-center">${E.label}</td>
3061
+ <td class="text-right">${J}</td>
3062
+ </tr>
3063
+ `;
3064
+ }).join("")), `
3065
+ <div class="absolute min-w-[250px] max-w-[350px] bg-white/90 border border-gray-200 rounded-lg shadow-md text-gray-800 pointer-events-none">
3066
+ ${C ? `
3067
+ <div class="font-semibold text-sm border-b border-solid border-gray-200 text-gray-800 rounded-t-lg px-2 py-1">
3068
+ <h3>${C}</h3>
3069
+ </div>
3070
+ ` : ""}
3071
+ ${y ? `<div class="text-sm px-2 py-1 break-words">${P}</div>` : ""}
3072
+ ${x != null && x.length && !y ? `
3073
+ <div class="text-xs px-2 py-0.5 text-gray-500">
3074
+ <table class="w-full">
3075
+ <tbody>${V}</tbody>
3076
+ </table>
3077
+ </div>
3078
+ ` : ""}
3079
+ </div>
3080
+ `;
3081
+ }, T = (b) => ({
3082
+ legend: $t,
3083
+ basemaps: Ft,
3084
+ layers: no,
3085
+ info: vo,
3086
+ attribute: Qo,
3087
+ catalog: ks,
3088
+ filters: Vs,
3089
+ "inline-filters": Es,
3090
+ list: Zs,
3091
+ card: ot
3092
+ })[b], k = M(() => !!a.value && Array.isArray(a.value.widgets) && a.value.widgets.some((b) => b.type === "filters")), _ = (b) => {
3093
+ i.value = b;
3094
+ };
3095
+ function D() {
3096
+ const b = new URLSearchParams(window.location.search), y = parseFloat(b.get("x")), x = parseFloat(b.get("y")), $ = parseFloat(b.get("z")), w = parseFloat(b.get("bearing")), C = parseFloat(b.get("pitch"));
3097
+ return {
3098
+ center: isFinite(y) && isFinite(x) ? [y, x] : null,
3099
+ zoom: isFinite($) ? $ : null,
3100
+ bearing: isFinite(w) ? w : null,
3101
+ pitch: isFinite(C) ? C : null
3102
+ };
3103
+ }
3104
+ function le({ center: b, zoom: y, bearing: x, pitch: $ }) {
3105
+ const w = new URLSearchParams(window.location.search);
3106
+ w.set("x", b[0].toFixed(5)), w.set("y", b[1].toFixed(5)), w.set("z", y.toFixed(2)), w.set("bearing", x.toFixed(2)), w.set("pitch", $.toFixed(2));
3107
+ const C = `${window.location.pathname}?${w.toString()}`;
3108
+ window.history.replaceState({}, "", C);
3109
+ }
3110
+ const ce = () => {
3111
+ var C, P, V;
3112
+ if (!a.value || !a.value.map) return;
3113
+ const b = {
3114
+ version: 8,
3115
+ glyphs: "https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",
3116
+ sources: {},
3117
+ layers: []
3118
+ };
3119
+ let y = a.value.map.center, x = a.value.map.zoom, $ = a.value.map.bearing || 0, w = a.value.map.pitch || 0;
3120
+ if (a.value.history) {
3121
+ const E = D();
3122
+ E.center && (y = E.center), E.zoom !== null && (x = E.zoom), E.bearing !== null && ($ = E.bearing), E.pitch !== null && (w = E.pitch);
3123
+ }
3124
+ o.value = new maplibregl.Map({
3125
+ container: "maplibre-demo-map",
3126
+ style: b,
3127
+ center: y,
3128
+ zoom: x,
3129
+ bearing: $,
3130
+ pitch: w,
3131
+ maxBounds: [18.0856083513, 40.3614785833, 58.0807890155, 56.3350745713]
3132
+ }), (V = (P = (C = a == null ? void 0 : a.value) == null ? void 0 : C.interactions) == null ? void 0 : P.navigation) != null && V.enabled && !h && (h = new maplibregl.NavigationControl({
3133
+ showCompass: !0,
3134
+ showZoom: !0,
3135
+ visualizePitch: !0
3136
+ }), o.value.addControl(h, "top-right")), o.value.on("load", async () => {
3137
+ var Y, ke, U, Le, Fe;
3138
+ n.value = !0;
3139
+ const E = D(), J = E.center && E.zoom !== null;
3140
+ if ((Y = a.value.map) != null && Y.bbox && !J) {
3141
+ const [q, R, I, oe] = a.value.map.bbox;
3142
+ o.value.fitBounds(
3143
+ [
3144
+ [q, R],
3145
+ [I, oe]
3146
+ ],
3147
+ {
3148
+ padding: 50,
3149
+ duration: 0
3150
+ }
3151
+ );
3152
+ }
3153
+ if (await (async () => {
3154
+ var R, I, oe, re, ee;
3155
+ const q = ((ee = (re = (oe = (I = (R = a.value) == null ? void 0 : R.widgets) == null ? void 0 : I.find((z) => z.type === "layers")) == null ? void 0 : oe.config) == null ? void 0 : re.layers) == null ? void 0 : ee.filter(
3156
+ (z) => {
3157
+ var de;
3158
+ return ((de = z.style) == null ? void 0 : de.attrType) === "icon-by-attribute";
3159
+ }
3160
+ )) || [];
3161
+ for (const z of q) {
3162
+ const { rules: de, default_icon: ve, icon_base_url: me } = z.style, ye = [...de.map((se) => se.icon), ve].filter(
3163
+ Boolean
3164
+ );
3165
+ for (const se of ye)
3166
+ try {
3167
+ const ue = `${me}${se}`, be = await o.value.loadImage(ue);
3168
+ o.value.hasImage(se) || o.value.addImage(se, be.data);
3169
+ } catch (ue) {
3170
+ console.error(`Failed to load icon: ${se}`, ue);
3171
+ }
3172
+ }
3173
+ })(), (Le = (U = (ke = a.value) == null ? void 0 : ke.interactions) == null ? void 0 : U.hover) != null && Le.enabled && (o.value.on("mousemove", (q) => {
3174
+ var de, ve, me, ye, se, ue, be, je, Q, Ae;
3175
+ const R = o.value.queryRenderedFeatures(q.point);
3176
+ if (o.value && o.value.getCanvas && (o.value.getCanvas().style.cursor = R.length ? "pointer" : ""), !R.length) {
3177
+ if (d.value) {
3178
+ const O = (de = o.value.getSource(
3179
+ d.value.source
3180
+ )) == null ? void 0 : de.type;
3181
+ d.value.source, d.value.id, O === "vector" && d.value.source, ge(
3182
+ o.value,
3183
+ d.value.source,
3184
+ d.value.id,
3185
+ { hovered: !1 }
3186
+ ), d.value = null;
3187
+ }
3188
+ s && (s.remove(), s = null);
3189
+ return;
3190
+ }
3191
+ const I = R[0];
3192
+ if (!d.value || d.value.id !== I.id || d.value.source !== I.layer.source) {
3193
+ if (d.value) {
3194
+ const Re = (ve = o.value.getSource(
3195
+ d.value.source
3196
+ )) == null ? void 0 : ve.type;
3197
+ d.value.source, d.value.id, Re === "vector" && d.value.source, ge(
3198
+ o.value,
3199
+ d.value.source,
3200
+ d.value.id,
3201
+ { hovered: !1 }
3202
+ );
3203
+ }
3204
+ const O = (me = o.value.getSource(I.layer.source)) == null ? void 0 : me.type;
3205
+ I.layer.source, I.id, O === "vector" && I.layer.source, ge(o.value, I.layer.source, I.id, {
3206
+ hovered: !0
3207
+ }), d.value = { source: I.layer.source, id: I.id };
3208
+ }
3209
+ const oe = (se = (ye = a.value) == null ? void 0 : ye.widgets) == null ? void 0 : se.find(
3210
+ (O) => O.type === "layers"
3211
+ ), re = (be = (ue = a.value) == null ? void 0 : ue.widgets) == null ? void 0 : be.find(
3212
+ (O) => O.type === "attribute"
3213
+ );
3214
+ let ee = null;
3215
+ if (oe && (ee = oe.config.layers.find(
3216
+ (O) => O.id === I.layer.source
3217
+ )), (Q = (je = a.value) == null ? void 0 : je.widgets) == null ? void 0 : Q.find(
3218
+ (O) => O.type === "catalog"
3219
+ )) {
3220
+ if (!R.length) {
3221
+ s && (s.style.display = "none");
3222
+ return;
3223
+ }
3224
+ const O = R[0];
3225
+ s = dt(O, q, s);
3226
+ return;
3227
+ }
3228
+ if (!ee && re && re.config.layer.id === I.layer.source && (ee = re.config.layer), (Ae = ee == null ? void 0 : ee.style) != null && Ae.popup) {
3229
+ const O = ee.style.popup;
3230
+ let Re = O.title, He = "";
3231
+ O.mode === "markdown" ? He = Array.isArray(O.content) ? O.content.join(`
3232
+
3233
+ `) : "" : He = Array.isArray(O.content) ? O.content.join("") : "", s || (s = document.createElement("div"), o.value.getContainer().appendChild(s)), s.innerHTML = j(
3234
+ Re,
3235
+ He,
3236
+ O.fields,
3237
+ I.properties,
3238
+ O.mode
3239
+ ), Qe(s, q);
3240
+ }
3241
+ }), o.value.on("mouseleave", () => {
3242
+ var q;
3243
+ if (s && (s.remove(), s = null), d.value) {
3244
+ const R = (q = o.value.getSource(
3245
+ d.value.source
3246
+ )) == null ? void 0 : q.type;
3247
+ d.value.source, d.value.id, R === "vector" && d.value.source, ge(
3248
+ o.value,
3249
+ d.value.source,
3250
+ d.value.id,
3251
+ { hovered: !1 }
3252
+ ), d.value = null;
3253
+ }
3254
+ o.value && o.value.getCanvas && (o.value.getCanvas().style.cursor = "");
3255
+ })), o.value.on("click", async (q) => {
3256
+ var ve, me, ye, se, ue, be, je;
3257
+ if (te(), ["length", "area", "print"].includes(u.value)) return;
3258
+ const R = o.value.queryRenderedFeatures(q.point);
3259
+ if (!R.length) return;
3260
+ const I = R[0], oe = (me = (ve = a.value) == null ? void 0 : ve.widgets) == null ? void 0 : me.find(
3261
+ (Q) => Q.type === "layers"
3262
+ ), re = (se = (ye = a.value) == null ? void 0 : ye.widgets) == null ? void 0 : se.find(
3263
+ (Q) => Q.type === "attribute"
3264
+ ), ee = (be = (ue = a.value) == null ? void 0 : ue.widgets) == null ? void 0 : be.find(
3265
+ (Q) => Q.type === "catalog"
3266
+ );
3267
+ let z;
3268
+ if (ee ? z = I.layer.source : z = (re == null ? void 0 : re.config.layer) || (oe == null ? void 0 : oe.config.layers.find((Q) => Q.id === I.layer.source)), z != null && z.noCard) return;
3269
+ v.value.forEach((Q) => {
3270
+ var O;
3271
+ const Ae = (O = o.value.getSource(Q.source)) == null ? void 0 : O.type;
3272
+ Q.source, Q.id, Ae === "vector" && Q.source, ge(o.value, Q.source, Q.id, {
3273
+ selected: !1
3274
+ });
3275
+ }), v.value = [];
3276
+ const de = (je = o.value.getSource(I.layer.source)) == null ? void 0 : je.type;
3277
+ I.layer.source, I.id, de === "vector" && I.layer.source, ge(o.value, I.layer.source, I.id, {
3278
+ selected: !0
3279
+ }), v.value.push({ source: I.layer.source, id: I.id }), l.value = {
3280
+ layer: (z == null ? void 0 : z.service_key) || z || "",
3281
+ map: (z == null ? void 0 : z.map_key) || "",
3282
+ id: I.properties.id,
3283
+ title: (z == null ? void 0 : z.title) || ""
3284
+ };
3285
+ }), o.value.on("dblclick", (q) => {
3286
+ var oe, re, ee;
3287
+ if (te(), ["length", "area", "print"].includes(u.value)) return;
3288
+ it([q.lngLat.lng, q.lngLat.lat]);
3289
+ const R = (re = (oe = a.value) == null ? void 0 : oe.widgets) == null ? void 0 : re.find(
3290
+ (z) => z.type === "layers"
3291
+ );
3292
+ let I = null;
3293
+ (ee = R == null ? void 0 : R.config) != null && ee.layers && (I = R.config.layers.find(
3294
+ (z) => z.visible !== !1 && ["tms", "wms", "raster"].includes(
3295
+ (z.service_type || z.service || "").toLowerCase()
3296
+ )
3297
+ )), !(I != null && I.noCard) && (l.value = {
3298
+ layer: (I == null ? void 0 : I.map_key) || "",
3299
+ map: (I == null ? void 0 : I.service_key) || "",
3300
+ id: "",
3301
+ title: (I == null ? void 0 : I.title) || ""
3302
+ });
3303
+ }), o.value.resize(), (Fe = a == null ? void 0 : a.value) != null && Fe.history) {
3304
+ const q = () => {
3305
+ const R = o.value.getCenter();
3306
+ le({
3307
+ center: [R.lng, R.lat],
3308
+ zoom: o.value.getZoom(),
3309
+ bearing: o.value.getBearing(),
3310
+ pitch: o.value.getPitch()
3311
+ });
3312
+ };
3313
+ o.value.on("moveend", q), o.value.on("rotate", q), o.value.on("pitch", q);
3314
+ }
3315
+ });
3316
+ }, te = () => {
3317
+ Ge(), v.value.forEach((b) => {
3318
+ o.value && ge(o.value, b.source, b.id, {
3319
+ selected: !1
3320
+ });
3321
+ }), v.value = [], l.value = null;
3322
+ };
3323
+ xe(async () => {
3324
+ await Me(), await $e(), ce();
3325
+ const b = document.getElementById("maplibre-demo-map");
3326
+ b && b.addEventListener("mouseleave", () => {
3327
+ s && (s.remove(), s = null);
3328
+ }), he(
3329
+ () => t.table,
3330
+ async (y) => {
3331
+ if (y) {
3332
+ if (te(), u.value = null, s && (s.remove(), s = null), o.value) {
3333
+ try {
3334
+ o.value.remove();
3335
+ } catch {
3336
+ }
3337
+ o.value = null, n.value = !1;
3338
+ }
3339
+ await Me(), await $e(), ce();
3340
+ }
3341
+ }
3342
+ );
3343
+ });
3344
+ const Ue = M(() => ({
3345
+ height: (t == null ? void 0 : t.height) || "100vh",
3346
+ width: "100%"
3347
+ })), Me = async () => {
3348
+ const b = await fetch(`/api/map/${t.table}`).then((y) => y.json());
3349
+ a.value = b;
3350
+ }, Te = (b) => {
3351
+ if (!a.value || !a.value.widgets) return "400px";
3352
+ const y = a.value.widgets.find((x) => x.position === b);
3353
+ return (y == null ? void 0 : y.width) || "400px";
3354
+ }, ie = A([]);
3355
+ he(
3356
+ () => a.value,
3357
+ (b) => {
3358
+ b && b.map && (ie.value = rt(), ce());
3359
+ }
3360
+ );
3361
+ const rt = () => {
3362
+ var y;
3363
+ if (!a.value || !a.value.widgets) return [];
3364
+ const b = a.value.widgets.find((x) => x.type === "layers");
3365
+ return (y = b == null ? void 0 : b.config) != null && y.layers ? b.config.layers.map((x) => ({ ...x, visible: x.visible ?? !1 })).filter((x) => x.visible).map((x) => x.id) : [];
3366
+ };
3367
+ function ge(b, y, x, $) {
3368
+ b.getStyle().layers.filter((C) => C.source === y).forEach((C) => {
3369
+ var V;
3370
+ const P = { source: y, id: x };
3371
+ ((V = b.getSource(y)) == null ? void 0 : V.type) === "vector" && C["source-layer"] && (P.sourceLayer = C["source-layer"]), b.setFeatureState(P, $);
3372
+ });
3373
+ }
3374
+ const st = M(() => !!a.value && !!a.value.interactions && !!a.value.interactions.navigation && a.value.interactions.navigation.enabled), nt = M(() => !!a.value && Array.isArray(a.value.tools) && a.value.tools.length > 0), ze = M(() => st.value || nt.value ? "40px" : "20px");
3375
+ function Ge() {
3376
+ o.value && (o.value.getLayer("layer-with-pulsing-dot") && o.value.removeLayer("layer-with-pulsing-dot"), o.value.getSource("dot-point") && o.value.removeSource("dot-point"), o.value.hasImage && o.value.hasImage("pulsing-dot") && o.value.removeImage("pulsing-dot"));
3377
+ }
3378
+ function it(b) {
3379
+ var $, w, C, P;
3380
+ Ge();
3381
+ const y = 80, x = {
3382
+ width: y,
3383
+ height: y,
3384
+ data: new Uint8Array(y * y * 4),
3385
+ onAdd() {
3386
+ const V = document.createElement("canvas");
3387
+ V.width = this.width, V.height = this.height, this.context = V.getContext("2d", { willReadFrequently: !0 });
3388
+ },
3389
+ render() {
3390
+ var U;
3391
+ const E = performance.now() % 2e3 / 2e3, J = y / 2 * 0.3, Se = y / 2 * 0.7 * E + J, { context: Y } = this;
3392
+ Y.clearRect(0, 0, this.width, this.height), Y.beginPath(), Y.arc(this.width / 2, this.height / 2, Se, 0, Math.PI * 2), Y.fillStyle = `rgba(255, 100, 100, ${1 - E})`, Y.fill();
3393
+ const ke = y / 2 * 0.7 * (E - 0.5 < 0 ? E - 0.5 + 1 : E - 0.5) + J;
3394
+ return Y.beginPath(), Y.arc(
3395
+ this.width / 2,
3396
+ this.height / 2,
3397
+ ke,
3398
+ 0,
3399
+ Math.PI * 2
3400
+ ), Y.fillStyle = `rgba(255, 100, 100, ${1 - (E - 0.5 < 0 ? E - 0.5 + 1 : E - 0.5)})`, Y.fill(), this.data = Y.getImageData(0, 0, this.width, this.height).data, (U = o.value) == null || U.triggerRepaint(), !0;
3401
+ }
3402
+ };
3403
+ ($ = o.value) != null && $.hasImage("pulsing-dot") || (w = o.value) == null || w.addImage("pulsing-dot", x, { pixelRatio: 2 }), (C = o.value) == null || C.addSource("dot-point", {
3404
+ type: "geojson",
3405
+ data: {
3406
+ type: "Feature",
3407
+ geometry: { type: "Point", coordinates: b }
3408
+ }
3409
+ }), (P = o.value) == null || P.addLayer({
3410
+ id: "layer-with-pulsing-dot",
3411
+ type: "symbol",
3412
+ source: "dot-point",
3413
+ layout: { "icon-image": "pulsing-dot" },
3414
+ paint: { "icon-opacity": 0.6 }
3415
+ });
3416
+ }
3417
+ const at = M(() => {
3418
+ var b, y, x, $, w, C, P, V, E, J;
3419
+ return {
3420
+ center: (y = (b = a == null ? void 0 : a.value) == null ? void 0 : b.map) == null ? void 0 : y.center,
3421
+ zoom: ($ = (x = a == null ? void 0 : a.value) == null ? void 0 : x.map) == null ? void 0 : $.zoom,
3422
+ pitch: ((C = (w = a == null ? void 0 : a.value) == null ? void 0 : w.map) == null ? void 0 : C.pitch) || 0,
3423
+ bearing: ((V = (P = a == null ? void 0 : a.value) == null ? void 0 : P.map) == null ? void 0 : V.bearing) || 0,
3424
+ bbox: ((J = (E = a == null ? void 0 : a.value) == null ? void 0 : E.map) == null ? void 0 : J.bbox) || null
3425
+ };
3426
+ }), Je = {
3427
+ home: on,
3428
+ print: dn,
3429
+ geolocation: Mn,
3430
+ pitch: hn
3431
+ // length: VsLengthMeasure,
3432
+ // area: VsAreaMeasure,
3433
+ }, lt = (b) => {
3434
+ u.value = b;
3435
+ };
3436
+ function _e(b) {
3437
+ if (!a.value || !a.value.widgets) return;
3438
+ const y = a.value.widgets.find((w) => w.type === "list");
3439
+ if (!y || !y.config) return;
3440
+ const { map_key: x, service_key: $ } = y.config;
3441
+ x && $ && (l.value = {
3442
+ id: b,
3443
+ map: x,
3444
+ layer: $
3445
+ });
3446
+ }
3447
+ const ct = M(
3448
+ () => a.value && a.value.widgets ? a.value.widgets.filter((b) => b.position === "absolute") : []
3449
+ );
3450
+ function dt(b, y, x) {
3451
+ const $ = b.properties, w = m.value.find(
3452
+ (U) => String(U.id) === String(b.source)
3453
+ ), C = Array.isArray(w == null ? void 0 : w.popup) ? w.popup : [], V = C.filter((U) => U.meta === "image").map((U) => $ == null ? void 0 : $[U.name]).filter(Boolean), E = V.length > 0 ? `
3454
+ <div class="popup-image-single overflow-hidden rounded-t-xl" style="width:260px;height:160px;margin:0 auto 0 auto;">
3455
+ <img src="${V[0]}" style="width:100%;height:100%;object-fit:cover;border-radius:12px 12px 0 0;display:block;" />
3456
+ </div>
3457
+ ` : "", J = C.find((U) => U.meta === "title"), Se = J ? $ == null ? void 0 : $[J.name] : "";
3458
+ let Y = C.filter((U) => U.meta !== "title" && U.meta !== "image").map((U) => {
3459
+ const Le = $ == null ? void 0 : $[U.name];
3460
+ let Fe = Le ?? "-";
3461
+ switch (U.meta) {
3462
+ case "badge":
3463
+ Fe = Le ? `<span class="inline-block rounded px-2 py-0.5 text-xs bg-yellow-100 text-yellow-800 ">${Le}</span>` : "-";
3464
+ break;
3465
+ }
3466
+ return `
3467
+ <tr style="display: table-row;">
3468
+ <td style="display: table-cell; padding: 2px 8px 2px 0; vertical-align: middle; font-weight: 500; width: 50%; text-align: left;">${U.ua || U.name}</td>
3469
+ <td style="display: table-cell; padding: 2px 0 2px 8px; vertical-align: middle; width: 50%; text-align: right;">${Fe}</td>
3470
+ </tr>
3471
+ `;
3472
+ }).join("");
3473
+ C.length || (Y = Object.keys($).map(
3474
+ (U) => `
3475
+ <tr style="display: table-row;">
3476
+ <td style="display: table-cell; padding: 2px 8px 2px 0; vertical-align: middle; font-weight: 500; width: 50%; text-align: left;">${U}</td>
3477
+ <td style="display: table-cell; padding: 2px 0 2px 8px; vertical-align: middle; width: 50%; text-align: right;">${$[U] || "-"}</td>
3478
+ </tr>
3479
+ `
3480
+ ).join(""));
3481
+ const ke = `
3482
+ <div class="absolute min-w-[250px] max-w-[300px] bg-white/90 border border-gray-200 rounded-lg shadow-md text-gray-800 pointer-events-none" style="display: flex; flex-direction: column; justify-content: center;">
3483
+ ${E}
3484
+ ${Se ? `<div class="font-semibold text-sm border-b border-solid border-gray-200 text-gray-800 px-2 py-1">${Se}</div>` : ""}
3485
+ <div class="text-xs px-2 py-0.5 text-gray-500" style="display: flex; justify-content: center; align-items: center; flex: 1;">
3486
+ <table class="w-full" style="border-collapse: collapse; border: none; margin: 0 auto;">
3487
+ <tbody>${Y}</tbody>
3488
+ </table>
3489
+ </div>
3490
+ </div>
3491
+ `;
3492
+ return x || (x = document.createElement("div"), x.className = "custom-popup absolute z-50", document.body.appendChild(x)), x.innerHTML = ke, Qe(x, y), x;
3493
+ }
3494
+ function Qe(b, y) {
3495
+ const x = b.offsetWidth, $ = b.offsetHeight, w = document.getElementById("maplibre-demo-map"), C = w.getBoundingClientRect(), P = y.originalEvent.clientX - C.left, V = y.originalEvent.clientY - C.top;
3496
+ let E = P - x / 2;
3497
+ E = Math.max(10, Math.min(E, C.width - x - 10));
3498
+ let J;
3499
+ V - $ - 10 > 0 ? J = V - $ - 5 : V + $ + 10 < C.height ? J = V + 10 : J = Math.max(10, C.height - $ - 10), b.style.position = "absolute", b.style.left = `${E + 20}px`, b.style.top = `${J + 10}px`, b.parentNode !== w && w.appendChild(b);
3500
+ }
3501
+ return (b, y) => {
3502
+ var x, $;
3503
+ return c(), p("div", {
3504
+ class: "maplibre-demo-map-container",
3505
+ style: fe(Ue.value)
3506
+ }, [
3507
+ y[10] || (y[10] = r("div", { id: "maplibre-demo-map" }, null, -1)),
3508
+ n.value ? (c(), p(B, { key: 1 }, [
3509
+ r("div", Tn, [
3510
+ r("div", zn, [
3511
+ r("div", An, [
3512
+ (c(), p(B, null, W(["top-left"], (w) => {
3513
+ var C, P;
3514
+ return N(Be, {
3515
+ key: w,
3516
+ position: w,
3517
+ widgets: f(w),
3518
+ map: o.value,
3519
+ mapLoaded: n.value,
3520
+ cardValues: l.value,
3521
+ hasFilters: k.value,
3522
+ history: (P = (C = a.value) == null ? void 0 : C.value) == null ? void 0 : P.history,
3523
+ currentFilterLayer: i.value,
3524
+ enabledLayerIds: ie.value,
3525
+ getWidgetComponent: T,
3526
+ getColumnWidth: Te,
3527
+ rightColumnOffset: w === "top-right" ? ze.value : void 0,
3528
+ onSetFilterLayer: _,
3529
+ "onUpdate:enabledLayerIds": y[0] || (y[0] = (V) => ie.value = V),
3530
+ onCardValuesId: _e,
3531
+ onCloseCard: te,
3532
+ onCatalogLayers: y[1] || (y[1] = (V) => m.value = V)
3533
+ }, null, 8, ["position", "widgets", "map", "mapLoaded", "cardValues", "hasFilters", "history", "currentFilterLayer", "enabledLayerIds", "rightColumnOffset"]);
3534
+ }), 64))
3535
+ ]),
3536
+ r("div", Bn, [
3537
+ (c(), p(B, null, W(["bottom-left"], (w) => {
3538
+ var C, P;
3539
+ return N(Be, {
3540
+ key: w,
3541
+ position: w,
3542
+ widgets: f(w),
3543
+ map: o.value,
3544
+ mapLoaded: n.value,
3545
+ cardValues: l.value,
3546
+ hasFilters: k.value,
3547
+ history: (P = (C = a.value) == null ? void 0 : C.value) == null ? void 0 : P.history,
3548
+ currentFilterLayer: i.value,
3549
+ enabledLayerIds: ie.value,
3550
+ getWidgetComponent: T,
3551
+ getColumnWidth: Te,
3552
+ rightColumnOffset: w === "top-right" ? ze.value : void 0,
3553
+ onSetFilterLayer: _,
3554
+ "onUpdate:enabledLayerIds": y[2] || (y[2] = (V) => ie.value = V),
3555
+ onCardValuesId: _e,
3556
+ onCloseCard: te,
3557
+ onCatalogLayers: y[3] || (y[3] = (V) => m.value = V)
3558
+ }, null, 8, ["position", "widgets", "map", "mapLoaded", "cardValues", "hasFilters", "history", "currentFilterLayer", "enabledLayerIds", "rightColumnOffset"]);
3559
+ }), 64))
3560
+ ])
3561
+ ]),
3562
+ r("div", On, [
3563
+ r("div", Dn, [
3564
+ (c(), p(B, null, W(["top-right"], (w) => {
3565
+ var C, P;
3566
+ return N(Be, {
3567
+ key: w,
3568
+ position: w,
3569
+ widgets: f(w),
3570
+ map: o.value,
3571
+ mapLoaded: n.value,
3572
+ cardValues: l.value,
3573
+ hasFilters: k.value,
3574
+ history: (P = (C = a.value) == null ? void 0 : C.value) == null ? void 0 : P.history,
3575
+ currentFilterLayer: i.value,
3576
+ enabledLayerIds: ie.value,
3577
+ getWidgetComponent: T,
3578
+ getColumnWidth: Te,
3579
+ rightColumnOffset: w === "top-right" ? ze.value : void 0,
3580
+ onSetFilterLayer: _,
3581
+ "onUpdate:enabledLayerIds": y[4] || (y[4] = (V) => ie.value = V),
3582
+ onCardValuesId: _e,
3583
+ onCloseCard: te,
3584
+ onCatalogLayers: y[5] || (y[5] = (V) => m.value = V)
3585
+ }, null, 8, ["position", "widgets", "map", "mapLoaded", "cardValues", "hasFilters", "history", "currentFilterLayer", "enabledLayerIds", "rightColumnOffset"]);
3586
+ }), 64))
3587
+ ]),
3588
+ r("div", Un, [
3589
+ (c(), p(B, null, W(["bottom-right"], (w) => {
3590
+ var C, P;
3591
+ return N(Be, {
3592
+ key: w,
3593
+ position: w,
3594
+ widgets: f(w),
3595
+ map: o.value,
3596
+ mapLoaded: n.value,
3597
+ cardValues: l.value,
3598
+ hasFilters: k.value,
3599
+ history: (P = (C = a.value) == null ? void 0 : C.value) == null ? void 0 : P.history,
3600
+ currentFilterLayer: i.value,
3601
+ enabledLayerIds: ie.value,
3602
+ getWidgetComponent: T,
3603
+ getColumnWidth: Te,
3604
+ rightColumnOffset: w === "top-right" ? ze.value : void 0,
3605
+ onSetFilterLayer: _,
3606
+ "onUpdate:enabledLayerIds": y[6] || (y[6] = (V) => ie.value = V),
3607
+ onCardValuesId: _e,
3608
+ onCloseCard: te,
3609
+ onCatalogLayers: y[7] || (y[7] = (V) => m.value = V)
3610
+ }, null, 8, ["position", "widgets", "map", "mapLoaded", "cardValues", "hasFilters", "history", "currentFilterLayer", "enabledLayerIds", "rightColumnOffset"]);
3611
+ }), 64))
3612
+ ])
3613
+ ])
3614
+ ]),
3615
+ (c(!0), p(B, null, W(ct.value, (w, C) => (c(), p("div", {
3616
+ key: "abs-" + (w.id || w.type || C),
3617
+ class: "absolute z-20",
3618
+ style: fe(w.style)
3619
+ }, [
3620
+ (c(), X(De(T(w.type)), {
3621
+ map: o.value,
3622
+ config: w.config,
3623
+ hasFilters: k.value,
3624
+ currentFilterLayer: i.value,
3625
+ enabledLayerIds: ie.value,
3626
+ cardValues: l.value,
3627
+ onSetFilterLayer: _,
3628
+ "onUpdate:enabledLayerIds": y[8] || (y[8] = (P) => ie.value = P),
3629
+ onCardValuesId: _e,
3630
+ onCloseCard: te,
3631
+ onCatalogLayers: y[9] || (y[9] = (P) => m.value = P)
3632
+ }, null, 40, ["map", "config", "hasFilters", "currentFilterLayer", "enabledLayerIds", "cardValues"]))
3633
+ ], 4))), 128)),
3634
+ r("div", Rn, [
3635
+ (c(!0), p(B, null, W(($ = (x = a.value) == null ? void 0 : x.value) == null ? void 0 : $.tools, (w) => (c(), p(B, { key: w }, [
3636
+ n.value && Je[w] ? (c(), X(De(Je[w]), yt({
3637
+ key: 0,
3638
+ map: o.value,
3639
+ activeTool: u.value,
3640
+ setActiveTool: lt
3641
+ }, { ref_for: !0 }, w === "home" ? { initialView: at.value } : {}, { onCardValuesId: _e }), null, 16, ["map", "activeTool"])) : F("", !0)
3642
+ ], 64))), 128))
3643
+ ])
3644
+ ], 64)) : (c(), X(Js, { key: 0 }))
3645
+ ], 4);
3646
+ };
3647
+ }
3648
+ }, Wn = /* @__PURE__ */ H(Hn, [["__scopeId", "data-v-126309b6"]]);
3649
+ function qn(e) {
3650
+ e.component("MapCustom", Wn);
3651
+ }
3652
+ export {
3653
+ Wn as MapCustom,
3654
+ Wn as default,
3655
+ qn as install
3656
+ };