@opengis/surveyor 0.0.4 → 0.0.6

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.
@@ -0,0 +1,95 @@
1
+ import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
+ import { computed as t, createBlock as n, defineComponent as r, openBlock as i, resolveDynamicComponent as a } from "vue";
3
+ import { AlertCircle as o, ArrowRight as ee, Award as s, Ban as c, Building2 as l, CalendarDays as u, Check as d, ChevronDown as f, ChevronLeft as p, ChevronRight as m, ChevronsLeft as h, ChevronsRight as g, ChevronsUpDown as _, CircleCheck as v, CircleX as y, ClipboardList as b, Columns3 as x, Download as S, ExternalLink as C, Eye as w, EyeOff as T, FileCheck2 as E, FileText as D, Filter as O, GraduationCap as k, History as A, Home as j, LayoutGrid as M, List as N, Lock as te, LogOut as P, Mail as F, Map as I, MapPin as L, MapPinned as R, Maximize2 as z, MessageSquare as B, Minimize2 as V, MoreVertical as H, PauseCircle as U, Pencil as W, Phone as G, Plus as K, Search as q, Send as J, Settings as Y, ShieldAlert as X, ShieldCheck as Z, SlidersHorizontal as Q, Trash2 as ne, Upload as re, UploadCloud as ie, User as ae, Users as oe, UsersRound as $, X as se } from "lucide-vue-next";
4
+ //#region cabinet/src/components/ui/AppIcon.vue?vue&type=script&setup=true&lang.ts
5
+ var ce = /*@__PURE__*/ r({
6
+ __name: "AppIcon",
7
+ props: {
8
+ name: {
9
+ type: null,
10
+ required: !0
11
+ },
12
+ strokeWidth: {
13
+ type: [Number, String],
14
+ required: !1,
15
+ default: 2
16
+ }
17
+ },
18
+ setup(e, { expose: n }) {
19
+ n();
20
+ let r = {
21
+ "arrow-right": ee,
22
+ award: s,
23
+ ban: c,
24
+ "building-2": l,
25
+ "calendar-days": u,
26
+ "alert-circle": o,
27
+ check: d,
28
+ "chevron-down": f,
29
+ "chevron-left": p,
30
+ "chevron-right": m,
31
+ "chevrons-left": h,
32
+ "chevrons-right": g,
33
+ "chevrons-up-down": _,
34
+ "circle-check": v,
35
+ "circle-x": y,
36
+ "clipboard-list": b,
37
+ "columns-3": x,
38
+ download: S,
39
+ "external-link": C,
40
+ eye: w,
41
+ "eye-off": T,
42
+ "file-check-2": E,
43
+ "file-text": D,
44
+ filter: O,
45
+ "graduation-cap": k,
46
+ history: A,
47
+ home: j,
48
+ "layout-grid": M,
49
+ list: N,
50
+ lock: te,
51
+ "log-out": P,
52
+ "maximize-2": z,
53
+ "minimize-2": V,
54
+ map: I,
55
+ "map-pin": L,
56
+ "map-pinned": R,
57
+ mail: F,
58
+ "message-square": B,
59
+ "more-vertical": H,
60
+ "pause-circle": U,
61
+ pencil: W,
62
+ phone: G,
63
+ plus: K,
64
+ search: q,
65
+ send: J,
66
+ settings: Y,
67
+ "shield-alert": X,
68
+ "shield-check": Z,
69
+ "sliders-horizontal": Q,
70
+ "trash-2": ne,
71
+ upload: re,
72
+ "upload-cloud": ie,
73
+ user: ae,
74
+ users: oe,
75
+ "users-round": $,
76
+ x: se
77
+ }, i = e, a = {
78
+ icons: r,
79
+ props: i,
80
+ icon: t(() => r[i.name])
81
+ };
82
+ return Object.defineProperty(a, "__isScriptSetup", {
83
+ enumerable: !1,
84
+ value: !0
85
+ }), a;
86
+ }
87
+ });
88
+ //#endregion
89
+ //#region cabinet/src/components/ui/AppIcon.vue
90
+ function le(e, t, r, o, ee, s) {
91
+ return i(), n(a(o.icon), { "stroke-width": r.strokeWidth }, null, 8, ["stroke-width"]);
92
+ }
93
+ var ue = /*#__PURE__*/ e(ce, [["render", le], ["__file", "C:/softpro/surveyor/cabinet/src/components/ui/AppIcon.vue"]]);
94
+ //#endregion
95
+ export { ue as t };
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
- import { t } from "./account_types-DLL1w122.js";
3
- import { t as n } from "./application_status-BhNGiY2I.js";
4
- import { o as r } from "./profile-DxZHxGum.js";
2
+ import { t } from "./AppIcon-CO70tpMX.js";
3
+ import { t as n } from "./account_types-DLL1w122.js";
4
+ import { t as r } from "./application_status-BhNGiY2I.js";
5
5
  import { computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, defineComponent as u, normalizeClass as d, openBlock as f, toDisplayString as p } from "vue";
6
6
  //#region cabinet/src/lib/application-status.ts
7
7
  var m = {
@@ -36,15 +36,15 @@ var m = {
36
36
  }, h = {
37
37
  classes: "bg-gray-100 text-gray-600 border-gray-200",
38
38
  dot: "bg-gray-400"
39
- }, g = Object.fromEntries(n.items.map((e) => [e.code, {
39
+ }, g = Object.fromEntries(r.items.map((e) => [e.code, {
40
40
  label: e.name,
41
41
  ...m[e.code] ?? h
42
42
  }]));
43
- Object.fromEntries(n.items.map((e) => [e.code, e.name]));
43
+ Object.fromEntries(r.items.map((e) => [e.code, e.name]));
44
44
  var _ = [{
45
45
  key: "all",
46
46
  label: "Всі"
47
- }, ...n.items.map((e) => ({
47
+ }, ...r.items.map((e) => ({
48
48
  key: e.code,
49
49
  label: e.name
50
50
  }))], v = {
@@ -72,10 +72,10 @@ var _ = [{
72
72
  bg: "bg-gray-50",
73
73
  border: "border-gray-200"
74
74
  };
75
- Object.fromEntries(t.items.map((e) => [e.code, {
75
+ Object.fromEntries(n.items.map((e) => [e.code, {
76
76
  label: e.name,
77
77
  ...v[e.code] ?? y
78
- }])), t.items[0]?.code;
78
+ }])), n.items[0]?.code;
79
79
  //#endregion
80
80
  //#region cabinet/src/components/ui/AppealStatusBadge.vue?vue&type=script&setup=true&lang.ts
81
81
  var b = /*@__PURE__*/ u({
@@ -96,17 +96,17 @@ var b = /*@__PURE__*/ u({
96
96
  default: !1
97
97
  }
98
98
  },
99
- setup(e, { expose: t }) {
100
- t();
101
- let n = e, a = {
102
- props: n,
103
- config: i(() => g[n.status] ?? {
104
- label: n.status || "—",
99
+ setup(e, { expose: n }) {
100
+ n();
101
+ let r = e, a = {
102
+ props: r,
103
+ config: i(() => g[r.status] ?? {
104
+ label: r.status || "—",
105
105
  classes: "bg-gray-100 text-gray-600 border-gray-200",
106
106
  dot: "bg-gray-400"
107
107
  }),
108
- pad: i(() => n.size === "sm" ? "px-2 py-0.5 text-xs" : "px-2.5 py-1 text-xs"),
109
- AppIcon: r
108
+ pad: i(() => r.size === "sm" ? "px-2 py-0.5 text-xs" : "px-2.5 py-1 text-xs"),
109
+ AppIcon: t
110
110
  };
111
111
  return Object.defineProperty(a, "__isScriptSetup", {
112
112
  enumerable: !1,
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
- import { o as t } from "./profile-DxZHxGum.js";
2
+ import { t } from "./AppIcon-CO70tpMX.js";
3
3
  import { createElementBlock as n, createElementVNode as r, createTextVNode as i, createVNode as a, defineComponent as o, openBlock as s, ref as c, toDisplayString as l, watch as u } from "vue";
4
4
  //#region cabinet/src/components/ui/FormFilePicker.vue?vue&type=script&setup=true&lang.ts
5
5
  var d = /*@__PURE__*/ o({
@@ -1,5 +1,5 @@
1
- import { i as e } from "./geometry-DyhIVRcw.js";
2
- import { a as t, r as n } from "./profile-DxZHxGum.js";
1
+ import { a as e, t } from "./surveyor-CDkI2Dcp.js";
2
+ import { i as n } from "./geometry-DyhIVRcw.js";
3
3
  //#region cabinet/src/api/applications.ts
4
4
  function r(e) {
5
5
  let t = new URLSearchParams();
@@ -8,15 +8,15 @@ function r(e) {
8
8
  let n = t.toString();
9
9
  return n ? `?${n}` : "";
10
10
  }
11
- async function i(e = {}) {
12
- let i = await fetch(n(`/api/resource/public_applications${r(e)}`), { credentials: "include" });
13
- if (!i.ok) throw Error(t(await i.text(), i.status));
11
+ async function i(n = {}) {
12
+ let i = await fetch(t(`/api/resource/public_applications${r(n)}`), { credentials: "include" });
13
+ if (!i.ok) throw Error(e(await i.text(), i.status));
14
14
  return i.json();
15
15
  }
16
- async function a(e) {
17
- let r = await fetch(n(`/api/resource/public_applications/${encodeURIComponent(e)}?include=history`), { credentials: "include" });
16
+ async function a(n) {
17
+ let r = await fetch(t(`/api/resource/public_applications/${encodeURIComponent(n)}?include=history`), { credentials: "include" });
18
18
  if (r.status === 404) return null;
19
- if (!r.ok) throw Error(t(await r.text(), r.status));
19
+ if (!r.ok) throw Error(e(await r.text(), r.status));
20
20
  let i = await r.json();
21
21
  return !i || typeof i != "object" || !i.app_id ? null : i;
22
22
  }
@@ -50,27 +50,27 @@ async function s(e) {
50
50
  throw Error("Звернення не знайдено");
51
51
  }
52
52
  function c(e) {
53
- return n(`/api/file/${encodeURIComponent(e)}?download=true`);
53
+ return t(`/api/file/${encodeURIComponent(e)}?download=true`);
54
54
  }
55
55
  function l(e) {
56
- return n(`/api/surveyor/applications/${encodeURIComponent(e)}/export/geometry`);
56
+ return t(`/api/surveyor/applications/${encodeURIComponent(e)}/export/geometry`);
57
57
  }
58
- function u(e, n) {
58
+ function u(t, n) {
59
59
  try {
60
- let t = JSON.parse(e);
61
- if (t.detail) return t.detail;
60
+ let e = JSON.parse(t);
61
+ if (e.detail) return e.detail;
62
62
  } catch {}
63
- return t(e, n);
63
+ return e(t, n);
64
64
  }
65
65
  async function d(e) {
66
- let t = await fetch(n("/api/surveyor/applications"), {
66
+ let n = await fetch(t("/api/surveyor/applications"), {
67
67
  method: "POST",
68
68
  credentials: "include",
69
69
  headers: { "Content-Type": "application/json" },
70
70
  body: JSON.stringify(e)
71
71
  });
72
- if (!t.ok) throw Error(u(await t.text(), t.status));
73
- return t.json();
72
+ if (!n.ok) throw Error(u(await n.text(), n.status));
73
+ return n.json();
74
74
  }
75
75
  var f = 52428800, p = /* @__PURE__ */ new Set([
76
76
  "zip",
@@ -94,22 +94,22 @@ function h(e) {
94
94
  }, r.onerror = () => n(/* @__PURE__ */ Error("Не вдалося прочитати файл")), r.readAsDataURL(e);
95
95
  });
96
96
  }
97
- async function g(t) {
98
- let r = m(t.name);
97
+ async function g(e) {
98
+ let r = m(e.name);
99
99
  if (!p.has(r)) throw Error("Підтримуються файли ZIP (Shapefile) та GeoJSON");
100
- if (!t.size) throw Error("Файл порожній");
101
- if (t.size > f) throw Error("Файл перевищує ліміт 50 МіБ");
102
- let i = await h(t), a = await fetch(n("/api/surveyor/import/geometry"), {
100
+ if (!e.size) throw Error("Файл порожній");
101
+ if (e.size > f) throw Error("Файл перевищує ліміт 50 МіБ");
102
+ let i = await h(e), a = await fetch(t("/api/surveyor/import/geometry"), {
103
103
  method: "POST",
104
104
  credentials: "include",
105
105
  headers: { "Content-Type": "application/json" },
106
106
  body: JSON.stringify({
107
107
  file: i,
108
- filename: t.name
108
+ filename: e.name
109
109
  })
110
110
  });
111
111
  if (!a.ok) throw Error(u(await a.text(), a.status));
112
- let o = e(await a.json());
112
+ let o = n(await a.json());
113
113
  if (!o || o.type !== "Polygon") throw Error("Файл не містить полігональну геометрію");
114
114
  return {
115
115
  type: "Polygon",
@@ -0,0 +1,60 @@
1
+ //#region cabinet/src/utils/auth.ts
2
+ var e = "surveyor_user";
3
+ function t(e) {
4
+ return `${"".replace(/\/$/, "")}${e}`;
5
+ }
6
+ function n() {
7
+ try {
8
+ let t = localStorage.getItem(e);
9
+ return t ? JSON.parse(t) : null;
10
+ } catch {
11
+ return localStorage.removeItem(e), null;
12
+ }
13
+ }
14
+ async function r(t, n) {
15
+ let { loginSurveyor: r } = await import("./surveyor-CDkI2Dcp.js").then((e) => e.c), i = await r(t, n);
16
+ localStorage.setItem(e, JSON.stringify(i.user));
17
+ }
18
+ async function i() {
19
+ try {
20
+ let n = await fetch(t("/api/auth/user"), { credentials: "include" });
21
+ if (!n.ok) return localStorage.removeItem(e), null;
22
+ let r = await n.json();
23
+ return r.id ? (localStorage.setItem(e, JSON.stringify(r)), r) : (localStorage.removeItem(e), null);
24
+ } catch {
25
+ return localStorage.removeItem(e), null;
26
+ }
27
+ }
28
+ async function a() {
29
+ try {
30
+ await fetch(t("/api/auth/logout"), {
31
+ method: "POST",
32
+ credentials: "include"
33
+ });
34
+ } finally {
35
+ localStorage.removeItem(e);
36
+ let { resetCabinetContext: t } = await import("./organizations-DbVDoURw.js").then((e) => e.a);
37
+ t();
38
+ }
39
+ }
40
+ async function o(e) {
41
+ if (await a(), typeof window < "u" && window.location.pathname.startsWith("/cabinet")) {
42
+ window.location.assign("/");
43
+ return;
44
+ }
45
+ await e.push({ name: "login" });
46
+ }
47
+ var s = {
48
+ get currentUser() {
49
+ return n();
50
+ },
51
+ get isAuthenticated() {
52
+ return !!n()?.id;
53
+ },
54
+ login: r,
55
+ checkUser: i,
56
+ logout: a,
57
+ logoutFromCabinet: o
58
+ };
59
+ //#endregion
60
+ export { s as t };