@gameap/frontend 4.1.0-dev7 → 4.1.0-dev9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/{AdminClientCertificatesView-BQyXmri1.js → AdminClientCertificatesView-rVNAX5Dl.js} +97 -94
  2. package/dist/AdminDaemonTaskListView-CoUVp9tK.js +316 -0
  3. package/dist/{AdminDaemonTaskOutputView-DRrZwAwW.js → AdminDaemonTaskOutputView-BJpuWCtc.js} +18 -17
  4. package/dist/{AdminGamesEdit-CDTCJu52.js → AdminGamesEdit-HKWU2C59.js} +121 -117
  5. package/dist/AdminGamesList-BwN_RFDY.js +518 -0
  6. package/dist/{AdminModEdit-P0crpkM3.js → AdminModEdit-CbVGlk5M.js} +123 -119
  7. package/dist/AdminNodeShowView-C7VsvwQo.js +175 -0
  8. package/dist/AdminNodesCreateView-BfEHhFn2.js +87 -0
  9. package/dist/{AdminNodesEditView-DdNciuMa.js → AdminNodesEditView-DE-zhVTd.js} +11 -11
  10. package/dist/AdminNodesView-QMdy3oJ1.js +167 -0
  11. package/dist/AdminPluginsView-BBALhxPk.js +984 -0
  12. package/dist/{AdminServersCreate-zGHHAEkO.js → AdminServersCreate-g_A290kz.js} +122 -124
  13. package/dist/{AdminServersEdit-BR6sRGlM.js → AdminServersEdit-D0RERbR5.js} +125 -124
  14. package/dist/{AdminServersList-DhUQ1zrt.js → AdminServersList-_ek_2u8B.js} +35 -31
  15. package/dist/{AdminUsersEditView-CqRLzCkV.js → AdminUsersEditView-CbZCH6eM.js} +89 -85
  16. package/dist/{AdminUsersView-TCHghzxY.js → AdminUsersView-D4WoRB5b.js} +145 -141
  17. package/dist/CreateModForm-CpbIOQNu.js +123 -0
  18. package/dist/CreateNodeModal-C96UVcAJ.js +99 -0
  19. package/dist/{DsIpSelector-EnBHsJLE.js → DsIpSelector-D_hc_JYQ.js} +1 -1
  20. package/dist/EmptyView-qkQQJ_OR.js +9 -0
  21. package/dist/FileManager-v-1ASSne.js +5931 -0
  22. package/dist/GameIcon-DaYNlnur.js +87 -0
  23. package/dist/{GameModSelector-bZsSGC6T.js → GameModSelector-CiI3H5Zq.js} +21 -20
  24. package/dist/InputManyList-C52f5V6l.js +110 -0
  25. package/dist/InputTextList-5KeNATa7.js +63 -0
  26. package/dist/PluginPendingView-CDR44QCG.js +34 -0
  27. package/dist/ProfileView-CC3KJ2gK.js +295 -0
  28. package/dist/RconConsole-DkRK7vz3.js +74 -0
  29. package/dist/{RconPlayers-CXL0bHlU.js → RconPlayers-CDRCp79f.js} +131 -127
  30. package/dist/ServerConsole-Bj0Zr1BS.js +99 -0
  31. package/dist/ServerControlButton-C4zWzA-d.js +185 -0
  32. package/dist/ServerIdView-BJS6wcMH.js +608 -0
  33. package/dist/{ServerSelector-D7O1thVu.js → ServerSelector-DPM5SjWO.js} +7 -7
  34. package/dist/{ServerSettings-Lk4lq5hI.js → ServerSettings-BYRSLaJk.js} +26 -26
  35. package/dist/{ServerStatus-CCFiPWXV.js → ServerStatus-BK8yKehx.js} +1 -1
  36. package/dist/{ServerTasks-gNFBkyv1.js → ServerTasks-DUC2DDcY.js} +304 -302
  37. package/dist/ServersView-BbLoOEEz.js +312 -0
  38. package/dist/SettingsParameters-C-TFWsJF.js +89 -0
  39. package/dist/SmartPortSelector-DCsuCDpV.js +174 -0
  40. package/dist/TokensView-B5D45QbV.js +392 -0
  41. package/dist/{UpdateNodeForm-BQDjp3CR.js → UpdateNodeForm-DmAoHURu.js} +131 -127
  42. package/dist/UserServerPrivileges-k-30v4ps.js +319 -0
  43. package/dist/{_createCompounder-NPjOAZm-.js → _createCompounder-DHQYnhTQ.js} +2 -2
  44. package/dist/{camelCase-BXg45SFI.js → camelCase-CE1GGhvX.js} +2 -2
  45. package/dist/{capitalize-BSQeiLff.js → capitalize-DnZmwhT4.js} +5 -5
  46. package/dist/{clientCertificates-Dm0Bh62v.js → clientCertificates-Dd9OqxGQ.js} +1 -1
  47. package/dist/frontend.css +6 -14
  48. package/dist/{gameList-CJAymSBL.js → gameList-BLdEusRA.js} +40 -40
  49. package/dist/gameap.svg +3 -0
  50. package/dist/gameap_full.svg +9 -0
  51. package/dist/index-BDKiNPpP.js +3840 -0
  52. package/dist/index.js +1 -1
  53. package/dist/isEmpty-lBntcFaB.js +263 -0
  54. package/dist/join-CmlzL0H9.js +7 -0
  55. package/dist/{loader-BGOXrNPF.js → loader-C49Def-j.js} +1 -1
  56. package/dist/{snakeCase-o1mQEFQr.js → snakeCase--wUVfLw4.js} +1 -1
  57. package/dist/validators-BVXTUmow.js +65 -0
  58. package/package.json +1 -1
  59. package/dist/AdminDaemonTaskListView-DTQbTpkt.js +0 -315
  60. package/dist/AdminGamesList-CU_RB7gu.js +0 -499
  61. package/dist/AdminNodeShowView-Col-7fyA.js +0 -166
  62. package/dist/AdminNodesCreateView-CZsMnSCJ.js +0 -84
  63. package/dist/AdminNodesView-DvuZ9haB.js +0 -160
  64. package/dist/CreateModForm-Byq8UvuW.js +0 -122
  65. package/dist/CreateNodeModal-BNV35RnR.js +0 -93
  66. package/dist/FileManager-X3FkHNzF.js +0 -31882
  67. package/dist/InputManyList-BFGIEnls.js +0 -110
  68. package/dist/InputTextList-D280D5fs.js +0 -63
  69. package/dist/PluginPendingView-Cp6KgA8z.js +0 -31
  70. package/dist/RconConsole-BxjHKC6E.js +0 -74
  71. package/dist/ServerConsole-Cr-BZJIC.js +0 -98
  72. package/dist/ServerIdView-wsnPfVUi.js +0 -576
  73. package/dist/SettingsParameters-BVpVg868.js +0 -87
  74. package/dist/SmartPortSelector-bubAEnvR.js +0 -161
  75. package/dist/UserServerPrivileges-CizE2EYl.js +0 -318
  76. package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
  77. package/dist/index-Fmomw6wi.js +0 -5750
@@ -0,0 +1,87 @@
1
+ import { computed as f, createElementBlock as d, openBlock as u, normalizeClass as l } from "vue";
2
+ const k = {
3
+ __name: "GameIcon",
4
+ props: {
5
+ game: "minecraft",
6
+ search: ""
7
+ },
8
+ setup(g) {
9
+ const c = {
10
+ "7d2d": "fa-solid fa-7",
11
+ "7days2die": "fa-solid fa-7",
12
+ ark: "gicon gicon-ark-survival-evolved",
13
+ arma2: "gicon gicon-arma-2",
14
+ arma2oa: "gicon gicon-arma-2",
15
+ arma3: "gicon gicon-arma-3",
16
+ blackmesasource: "gicon gicon-black-mesa",
17
+ bms: "gicon gicon-black-mesa",
18
+ counterstrike: "gicon gicon-counter-strike1",
19
+ cs15: "gicon gicon-counter-strike1",
20
+ cs2: "gicon gicon-counter-strike",
21
+ csgo: "gicon gicon-counter-strike",
22
+ css: "gicon gicon-counter-strike-source",
23
+ cssource: "gicon gicon-counter-strike-source",
24
+ cssv34: "gicon gicon-counter-strike-source",
25
+ cstrike: "gicon gicon-counter-strike1",
26
+ czero: "gicon gicon-counter-strike1",
27
+ dod: "gicon gicon-day-of-defeat",
28
+ dods: "gicon gicon-day-of-defeat",
29
+ dontstarve: "gicon gicon-dont-starve",
30
+ dontstarvetogether: "gicon gicon-dont-starve",
31
+ dst: "gicon gicon-dont-starve",
32
+ fivem: "gicon gicon-fivem",
33
+ garrysmod: "gicon gicon-garrys-mod",
34
+ grandtheftauto: "gicon gicon-grand-theft-auto",
35
+ gta: "gicon gicon-grand-theft-auto",
36
+ halflife: "gicon gicon-half-life",
37
+ hurtworld: "gicon gicon-hurtworld",
38
+ l4d2: "gicon gicon-left-4-dead",
39
+ l4d: "gicon gicon-left-4-dead",
40
+ minecraft: "gicon gicon-minecraft",
41
+ mta: "gicon gicon-grand-theft-auto",
42
+ op4: "gicon gicon-half-life",
43
+ pmmp: "gicon gicon-minecraft-creeper",
44
+ qw: "gicon gicon-quake",
45
+ q1: "gicon gicon-quake",
46
+ quake: "gicon gicon-quake",
47
+ q2: "gicon gicon-quake-2",
48
+ quake2: "gicon gicon-quake-2",
49
+ q3: "gicon gicon-quake-3",
50
+ quake3: "gicon gicon-quake-3",
51
+ q4: "gicon gicon-quake",
52
+ quake4: "gicon gicon-quake",
53
+ rust: "gicon gicon-rust",
54
+ samp: "gicon gicon-rockstar",
55
+ teamfortress2: "gicon gicon-team-fortress-2",
56
+ teamspeak3: "fa-brands fa-teamspeak",
57
+ teamspeak: "fa-brands fa-teamspeak",
58
+ tf2: "gicon gicon-team-fortress-2",
59
+ valve: "gicon gicon-half-life"
60
+ }, a = [
61
+ "fa-solid fa-gamepad",
62
+ "fa-solid fa-dice-one",
63
+ "fa-solid fa-dice-two",
64
+ "fa-solid fa-dice-three",
65
+ "fa-solid fa-dice-four",
66
+ "fa-solid fa-dice-five",
67
+ "fa-solid fa-dice-six",
68
+ "fa-solid fa-dice",
69
+ "fa-solid fa-puzzle-piece"
70
+ ], n = g, t = f(() => c[n.game] === void 0 ? r(n.game) : c[n.game]), r = (o) => {
71
+ if (c[o] === void 0)
72
+ return a[s(o)];
73
+ };
74
+ function s(o) {
75
+ let i = 0;
76
+ for (let e = 0; e < o.length; e++)
77
+ i += o.charCodeAt(e);
78
+ return i % a.length;
79
+ }
80
+ return (o, i) => (u(), d("i", {
81
+ class: l([t.value, o.$attrs.class])
82
+ }, null, 2));
83
+ }
84
+ };
85
+ export {
86
+ k as _
87
+ };
@@ -1,9 +1,10 @@
1
1
  import { mergeModels as x, useModel as p, onUnmounted as C, computed as c, watch as r, resolveComponent as N, createElementBlock as O, openBlock as P, createElementVNode as s, withDirectives as b, createVNode as n, vModelText as f, unref as u, withCtx as M, h as V } from "vue";
2
2
  import { storeToRefs as w } from "pinia";
3
- import { v as D, t as h, g as j } from "./index-Fmomw6wi.js";
4
- import { u as k } from "./gameList-CJAymSBL.js";
3
+ import { h as D, t as h } from "./index-BDKiNPpP.js";
4
+ import { u as j } from "./gameList-BLdEusRA.js";
5
5
  import { NFormItem as G } from "naive-ui";
6
- const y = { class: "mb-3" }, B = { class: "mb-3" }, $ = {
6
+ import { _ as k } from "./GameIcon-DaYNlnur.js";
7
+ const y = { class: "mb-3" }, B = { class: "mb-3" }, q = {
7
8
  __name: "GameModSelector",
8
9
  props: /* @__PURE__ */ x({
9
10
  games: Object,
@@ -18,21 +19,21 @@ const y = { class: "mb-3" }, B = { class: "mb-3" }, $ = {
18
19
  }),
19
20
  emits: ["update:game", "update:gameMod"],
20
21
  setup(m) {
21
- const S = m, o = p(m, "game"), l = p(m, "gameMod"), g = D(), d = k(), { gameModsList: v } = w(d);
22
+ const S = m, o = p(m, "game"), t = p(m, "gameMod"), g = D(), d = j(), { gameModsList: v } = w(d);
22
23
  C(() => {
23
24
  d.setSelectedGameMod(null), g.setGameCode(null);
24
25
  });
25
- const L = (a) => [
26
- V(j, { game: a.value, class: "mr-2" }),
26
+ const _ = (a) => [
27
+ V(k, { game: a.value, class: "mr-2" }),
27
28
  a.label
28
- ], U = c(() => Object.entries(S.games).map(([a, e]) => ({ value: a, label: e }))), _ = c(() => v.value.map((a) => ({ value: Number(a.id), label: a.name })));
29
+ ], L = c(() => Object.entries(S.games).map(([a, e]) => ({ value: a, label: e }))), U = c(() => v.value.map((a) => ({ value: Number(a.id), label: a.name })));
29
30
  return r(o, () => {
30
31
  g.setGameCode(o.value), d.fetchGameModsList(o.value);
31
- }), r(l, () => {
32
- d.setSelectedGameMod(l.value);
32
+ }), r(t, () => {
33
+ d.setSelectedGameMod(t.value);
33
34
  }), r(v, (a) => {
34
35
  let e = null;
35
- a.length > 0 && (e = a[0].id), a.find((t) => t.id === l.value) && (e = l.value), l.value = e;
36
+ a.length > 0 && (e = a[0].id), a.find((l) => l.id === t.value) && (e = t.value), t.value = e;
36
37
  }), (a, e) => {
37
38
  const i = N("n-select");
38
39
  return P(), O("div", null, [
@@ -40,7 +41,7 @@ const y = { class: "mb-3" }, B = { class: "mb-3" }, $ = {
40
41
  b(s("input", {
41
42
  type: "hidden",
42
43
  name: "game_id",
43
- "onUpdate:modelValue": e[0] || (e[0] = (t) => o.value = t)
44
+ "onUpdate:modelValue": e[0] || (e[0] = (l) => o.value = l)
44
45
  }, null, 512), [
45
46
  [f, o.value]
46
47
  ]),
@@ -53,9 +54,9 @@ const y = { class: "mb-3" }, B = { class: "mb-3" }, $ = {
53
54
  filterable: "",
54
55
  disabled: m.gameSelectDisabled,
55
56
  value: o.value,
56
- "onUpdate:value": e[1] || (e[1] = (t) => o.value = t),
57
- options: U.value,
58
- "render-label": L
57
+ "onUpdate:value": e[1] || (e[1] = (l) => o.value = l),
58
+ options: L.value,
59
+ "render-label": _
59
60
  }, null, 8, ["disabled", "value", "options"])
60
61
  ]),
61
62
  _: 1
@@ -65,9 +66,9 @@ const y = { class: "mb-3" }, B = { class: "mb-3" }, $ = {
65
66
  b(s("input", {
66
67
  type: "hidden",
67
68
  name: "game_mod_id",
68
- "onUpdate:modelValue": e[2] || (e[2] = (t) => l.value = t)
69
+ "onUpdate:modelValue": e[2] || (e[2] = (l) => t.value = l)
69
70
  }, null, 512), [
70
- [f, l.value]
71
+ [f, t.value]
71
72
  ]),
72
73
  n(u(G), {
73
74
  label: u(h)("labels.game_mod_id"),
@@ -76,10 +77,10 @@ const y = { class: "mb-3" }, B = { class: "mb-3" }, $ = {
76
77
  default: M(() => [
77
78
  n(i, {
78
79
  filterable: "",
79
- value: l.value,
80
- "onUpdate:value": e[3] || (e[3] = (t) => l.value = t),
80
+ value: t.value,
81
+ "onUpdate:value": e[3] || (e[3] = (l) => t.value = l),
81
82
  disabled: !o.value,
82
- options: _.value
83
+ options: U.value
83
84
  }, null, 8, ["value", "disabled", "options"])
84
85
  ]),
85
86
  _: 1
@@ -90,5 +91,5 @@ const y = { class: "mb-3" }, B = { class: "mb-3" }, $ = {
90
91
  }
91
92
  };
92
93
  export {
93
- $ as default
94
+ q as default
94
95
  };
@@ -0,0 +1,110 @@
1
+ import { mergeModels as _, useModel as b, reactive as g, computed as x, h as s, createElementBlock as V, openBlock as N, normalizeClass as w, createElementVNode as y, createVNode as o, withCtx as h, unref as r, createTextVNode as C, toDisplayString as I } from "vue";
2
+ import { t as c, _ as m, a as u } from "./index-BDKiNPpP.js";
3
+ import { NSwitch as z, NInput as M, NDataTable as T } from "naive-ui";
4
+ const A = { class: "mb-3" }, E = { class: "flex justify-center mt-2" }, D = {
5
+ __name: "InputManyList",
6
+ props: /* @__PURE__ */ _({
7
+ labels: Array,
8
+ keys: Array,
9
+ inputTypes: Array,
10
+ name: String
11
+ }, {
12
+ modelValue: {},
13
+ modelModifiers: {}
14
+ }),
15
+ emits: ["update:modelValue"],
16
+ setup(d) {
17
+ const a = d, l = b(d, "modelValue");
18
+ g({
19
+ text: "form-control",
20
+ checkbox: ""
21
+ });
22
+ const k = (t) => {
23
+ l.value.splice(t, 1);
24
+ }, p = () => {
25
+ let t = {};
26
+ a.keys.forEach((e) => {
27
+ t[e] = "";
28
+ }), l.value.push(t);
29
+ }, v = x(() => {
30
+ let t = [];
31
+ for (let e = 0; e < a.labels.length; e++)
32
+ t.push({
33
+ title: a.labels[e],
34
+ key: a.keys[e],
35
+ render(n, f) {
36
+ switch (a.inputTypes[e]) {
37
+ case "text":
38
+ return s(M, {
39
+ value: n[a.keys[e]],
40
+ onUpdateValue(i) {
41
+ l.value[f][a.keys[e]] = i;
42
+ }
43
+ });
44
+ case "checkbox":
45
+ return s(z, {
46
+ value: n[a.keys[e]],
47
+ onUpdateValue(i) {
48
+ l.value[f][a.keys[e]] = i;
49
+ }
50
+ });
51
+ }
52
+ }
53
+ });
54
+ return t.push({
55
+ title: c("main.actions"),
56
+ render(e, n) {
57
+ return [
58
+ s(m, {
59
+ color: "red",
60
+ size: "small",
61
+ text: c("main.delete"),
62
+ onClick: () => {
63
+ k(n);
64
+ }
65
+ }, { default: () => [
66
+ s(u, { name: "close", class: "mr-0.5" }),
67
+ s("span", { class: "hidden lg:inline" }, c("main.delete"))
68
+ ] })
69
+ ];
70
+ }
71
+ }), t;
72
+ });
73
+ return (t, e) => (N(), V("div", {
74
+ class: w(["block w-full overflow-auto scrolling-touch", t.$attrs.class])
75
+ }, [
76
+ y("div", A, [
77
+ o(m, {
78
+ color: "green",
79
+ size: "small",
80
+ onClick: p
81
+ }, {
82
+ default: h(() => [
83
+ o(r(u), { name: "add" })
84
+ ]),
85
+ _: 1
86
+ })
87
+ ]),
88
+ o(r(T), {
89
+ columns: v.value,
90
+ data: l.value
91
+ }, null, 8, ["columns", "data"]),
92
+ y("div", E, [
93
+ o(m, {
94
+ color: "green",
95
+ size: "small",
96
+ onClick: p
97
+ }, {
98
+ default: h(() => [
99
+ o(r(u), { name: "add" }),
100
+ C(" " + I(r(c)("main.add")), 1)
101
+ ]),
102
+ _: 1
103
+ })
104
+ ])
105
+ ], 2));
106
+ }
107
+ };
108
+ export {
109
+ D as default
110
+ };
@@ -0,0 +1,63 @@
1
+ import { mergeModels as v, useModel as _, createElementBlock as a, openBlock as s, createElementVNode as o, Fragment as h, renderList as k, createVNode as l, unref as r, withCtx as u } from "vue";
2
+ import { _ as c, a as i } from "./index-BDKiNPpP.js";
3
+ import { NInput as x } from "naive-ui";
4
+ const g = { class: "flex flex-wrap" }, V = { class: "md:w-full pr-4 pl-4 relative flex items-stretch w-full" }, w = { class: "flex justify-center mt-2" }, N = {
5
+ __name: "InputTextList",
6
+ props: /* @__PURE__ */ v({
7
+ label: String,
8
+ name: String
9
+ }, {
10
+ modelValue: {},
11
+ modelModifiers: {}
12
+ }),
13
+ emits: ["update:modelValue"],
14
+ setup(d) {
15
+ const e = _(d, "modelValue"), f = (n) => {
16
+ e.value.splice(n, 1);
17
+ }, p = () => {
18
+ e.value ? e.value.push("") : e.value = [""];
19
+ };
20
+ return (n, C) => (s(), a("div", null, [
21
+ (s(!0), a(h, null, k(e.value, (I, t) => (s(), a("div", {
22
+ class: "mb-3 deletable",
23
+ key: t
24
+ }, [
25
+ o("div", g, [
26
+ o("div", V, [
27
+ l(r(x), {
28
+ type: "text",
29
+ value: e.value[t],
30
+ "onUpdate:value": (m) => e.value[t] = m
31
+ }, null, 8, ["value", "onUpdate:value"]),
32
+ l(c, {
33
+ color: "red",
34
+ size: "small",
35
+ class: "ml-1",
36
+ onClick: (m) => f(t)
37
+ }, {
38
+ default: u(() => [
39
+ l(r(i), { name: "close" })
40
+ ]),
41
+ _: 1
42
+ }, 8, ["onClick"])
43
+ ])
44
+ ])
45
+ ]))), 128)),
46
+ o("div", w, [
47
+ l(c, {
48
+ color: "green",
49
+ size: "small",
50
+ onClick: p
51
+ }, {
52
+ default: u(() => [
53
+ l(r(i), { name: "add" })
54
+ ]),
55
+ _: 1
56
+ })
57
+ ])
58
+ ]));
59
+ }
60
+ };
61
+ export {
62
+ N as default
63
+ };
@@ -0,0 +1,34 @@
1
+ import { ref as c, watch as d, onMounted as g, createElementBlock as m, createBlock as p, openBlock as l, createElementVNode as r, createVNode as f, unref as _ } from "vue";
2
+ import { useRoute as x, useRouter as h } from "vue-router";
3
+ import { g as P, a as R, V as k } from "./index-BDKiNPpP.js";
4
+ const v = {
5
+ key: 0,
6
+ class: "flex items-center justify-center h-64"
7
+ }, y = { class: "text-center" }, $ = {
8
+ __name: "PluginPendingView",
9
+ setup(V) {
10
+ const s = x(), i = h(), e = P(), o = c(!e.initialized);
11
+ function a() {
12
+ const t = s.params.pluginId;
13
+ e.registeredRoutes.some(
14
+ (u) => u.startsWith(`plugin.${t}.`)
15
+ ) ? (i.removeRoute("plugin.pending"), i.replace(s.fullPath)) : o.value = !1;
16
+ }
17
+ return d(() => e.initialized, (t) => {
18
+ t && a();
19
+ }), g(() => {
20
+ e.initialized && a();
21
+ }), (t, n) => o.value ? (l(), m("div", v, [
22
+ r("div", y, [
23
+ f(_(R), {
24
+ name: "loading",
25
+ class: "animate-spin text-4xl text-stone-400"
26
+ }),
27
+ n[0] || (n[0] = r("p", { class: "mt-4 text-stone-600 dark:text-stone-400" }, "Loading plugin...", -1))
28
+ ])
29
+ ])) : (l(), p(k, { key: 1 }));
30
+ }
31
+ };
32
+ export {
33
+ $ as default
34
+ };
@@ -0,0 +1,295 @@
1
+ import { mergeModels as E, ref as U, useModel as M, createElementBlock as k, openBlock as x, normalizeClass as $, createVNode as s, unref as e, withCtx as d, createTextVNode as F, toDisplayString as r, createElementVNode as l, computed as N, Fragment as q } from "vue";
2
+ import { t as a, _ as y, a as L, k as z, o as I, q as v, m as A, s as B, n as P, e as D } from "./index-BDKiNPpP.js";
3
+ import { NForm as O, NFormItem as w, NInput as _, NSelect as R, NDivider as T, NCard as j, NTable as G, NModal as W } from "naive-ui";
4
+ import { i as H, a as J, s as K, b as Q, r as X } from "./validators-BVXTUmow.js";
5
+ const Y = { class: "flex w-full" }, Z = { class: "grid grid-cols-1 w-full" }, ee = { class: "flex w-full" }, le = { class: "grid grid-cols-2 gap-x-4 w-full" }, ae = { class: "hidden lg:inline" }, se = {
6
+ __name: "UpdateProfileForm",
7
+ props: {
8
+ modelValue: {
9
+ name: "",
10
+ language: "",
11
+ currentPassword: "",
12
+ password: "",
13
+ passwordConfirmation: ""
14
+ },
15
+ modelModifiers: {}
16
+ },
17
+ emits: /* @__PURE__ */ E(["update"], ["update:modelValue"]),
18
+ setup(C, { emit: c }) {
19
+ const g = U({}), o = M(C, "modelValue"), b = [
20
+ {
21
+ label: "English",
22
+ value: "en"
23
+ },
24
+ {
25
+ label: "Русский",
26
+ value: "ru"
27
+ }
28
+ ], h = {
29
+ name: {
30
+ required: !0,
31
+ validator: X(a("labels.name"))
32
+ },
33
+ password: {
34
+ validator: H(
35
+ J(
36
+ Q(a("labels.password"), 8),
37
+ K(
38
+ a("labels.password"),
39
+ a("labels.password_confirmation"),
40
+ () => o.value.passwordConfirmation
41
+ )
42
+ )
43
+ )
44
+ }
45
+ }, i = c, V = () => {
46
+ g.value.validate().then(() => {
47
+ i("update");
48
+ });
49
+ };
50
+ return (m, t) => (x(), k("div", {
51
+ class: $(m.$attrs.class)
52
+ }, [
53
+ s(e(O), {
54
+ "label-placement": "top",
55
+ "label-width": "auto",
56
+ ref_key: "formRef",
57
+ ref: g,
58
+ model: o.value,
59
+ rules: h
60
+ }, {
61
+ default: d(() => [
62
+ s(e(w), {
63
+ label: e(a)("labels.name"),
64
+ path: "name"
65
+ }, {
66
+ default: d(() => [
67
+ s(e(_), {
68
+ value: o.value.name,
69
+ "onUpdate:value": t[0] || (t[0] = (u) => o.value.name = u),
70
+ type: "text"
71
+ }, null, 8, ["value"])
72
+ ]),
73
+ _: 1
74
+ }, 8, ["label"]),
75
+ s(e(w), {
76
+ label: e(a)("profile.language"),
77
+ path: "language"
78
+ }, {
79
+ default: d(() => [
80
+ s(e(R), {
81
+ value: o.value.language,
82
+ "onUpdate:value": t[1] || (t[1] = (u) => o.value.language = u),
83
+ options: b
84
+ }, null, 8, ["value"])
85
+ ]),
86
+ _: 1
87
+ }, 8, ["label"]),
88
+ s(e(T), null, {
89
+ default: d(() => [
90
+ F(r(e(a)("profile.change_password")), 1)
91
+ ]),
92
+ _: 1
93
+ }),
94
+ s(e(w), {
95
+ label: e(a)("labels.current_password"),
96
+ path: "currentPassword"
97
+ }, {
98
+ default: d(() => [
99
+ l("div", Y, [
100
+ l("div", Z, [
101
+ s(e(_), {
102
+ value: o.value.currentPassword,
103
+ "onUpdate:value": t[2] || (t[2] = (u) => o.value.currentPassword = u),
104
+ type: "password",
105
+ "show-password-on": "click",
106
+ placeholder: e(a)("labels.current_password"),
107
+ "input-props": { autocomplete: "one-time-code" }
108
+ }, null, 8, ["value", "placeholder"])
109
+ ])
110
+ ])
111
+ ]),
112
+ _: 1
113
+ }, 8, ["label"]),
114
+ s(e(w), {
115
+ label: e(a)("labels.password"),
116
+ path: "password"
117
+ }, {
118
+ default: d(() => [
119
+ l("div", ee, [
120
+ l("div", le, [
121
+ s(e(_), {
122
+ value: o.value.password,
123
+ "onUpdate:value": t[3] || (t[3] = (u) => o.value.password = u),
124
+ type: "password",
125
+ "show-password-on": "click",
126
+ placeholder: e(a)("labels.new_password"),
127
+ "input-props": { autocomplete: "one-time-code" }
128
+ }, null, 8, ["value", "placeholder"]),
129
+ s(e(_), {
130
+ value: o.value.passwordConfirmation,
131
+ "onUpdate:value": t[4] || (t[4] = (u) => o.value.passwordConfirmation = u),
132
+ type: "password",
133
+ "show-password-on": "click",
134
+ "input-props": { autocomplete: "one-time-code" },
135
+ placeholder: e(a)("labels.password_confirmation")
136
+ }, null, 8, ["value", "placeholder"])
137
+ ])
138
+ ])
139
+ ]),
140
+ _: 1
141
+ }, 8, ["label"])
142
+ ]),
143
+ _: 1
144
+ }, 8, ["model"]),
145
+ s(y, {
146
+ color: "green",
147
+ onClick: V,
148
+ class: "mt-4"
149
+ }, {
150
+ default: d(() => [
151
+ s(e(L), {
152
+ name: "save",
153
+ class: "mr-0.5"
154
+ }),
155
+ l("span", ae, " " + r(e(a)("main.save")), 1)
156
+ ]),
157
+ _: 1
158
+ })
159
+ ], 2));
160
+ }
161
+ }, ue = {
162
+ __name: "ProfileView",
163
+ setup(C) {
164
+ const c = z(), g = I(), o = {
165
+ en: "English",
166
+ ru: "Русский"
167
+ }, b = N(() => {
168
+ const f = v();
169
+ return o[f] || f;
170
+ }), h = N(() => [
171
+ { route: "/", text: "GameAP", icon: "gicon gicon-gameap" },
172
+ { route: { name: "profile" }, text: a("profile.profile") }
173
+ ]), i = N(() => c.user), V = () => {
174
+ t.value = {
175
+ name: i.value.name,
176
+ language: v()
177
+ }, m.value = !0;
178
+ }, m = U(!1), t = U({
179
+ name: i.value.name,
180
+ language: v()
181
+ }), u = () => {
182
+ const f = v(), n = t.value.language;
183
+ let p = {
184
+ name: t.value.name
185
+ };
186
+ t.value.password && (p.current_password = t.value.currentPassword, p.password = t.value.password), c.saveProfile(p).then(() => {
187
+ n && n !== f ? (g.setLanguage(n), B(n), P({
188
+ content: a("profile.update_with_lang_success_msg"),
189
+ type: "success"
190
+ }, () => {
191
+ window.location.reload();
192
+ })) : P({
193
+ content: a("profile.update_success_msg"),
194
+ type: "success"
195
+ }), c.fetchProfile(), m.value = !1;
196
+ }).catch((S) => {
197
+ D(S), m.value = !1;
198
+ });
199
+ };
200
+ return (f, n) => (x(), k(q, null, [
201
+ s(e(A), { items: h.value }, null, 8, ["items"]),
202
+ s(y, {
203
+ color: "green",
204
+ size: "middle",
205
+ class: "mb-5",
206
+ onClick: n[0] || (n[0] = (p) => V())
207
+ }, {
208
+ default: d(() => [
209
+ s(e(L), {
210
+ name: "edit",
211
+ class: "mr-1"
212
+ }),
213
+ l("span", null, r(e(a)("profile.edit")), 1)
214
+ ]),
215
+ _: 1
216
+ }),
217
+ s(e(j), {
218
+ title: e(a)("profile.profile"),
219
+ size: "small",
220
+ class: "mb-3",
221
+ "header-class": "g-card-header",
222
+ segmented: {
223
+ content: !0,
224
+ footer: "soft"
225
+ }
226
+ }, {
227
+ default: d(() => [
228
+ s(e(G), {
229
+ bordered: !1,
230
+ "single-line": !0
231
+ }, {
232
+ default: d(() => [
233
+ l("tbody", null, [
234
+ l("tr", null, [
235
+ l("td", null, [
236
+ l("strong", null, r(e(a)("users.login")) + ":", 1)
237
+ ]),
238
+ l("td", null, r(i.value.login), 1)
239
+ ]),
240
+ l("tr", null, [
241
+ n[3] || (n[3] = l("td", null, [
242
+ l("strong", null, "Email:")
243
+ ], -1)),
244
+ l("td", null, r(i.value.email), 1)
245
+ ]),
246
+ l("tr", null, [
247
+ l("td", null, [
248
+ l("strong", null, r(e(a)("users.name")) + ":", 1)
249
+ ]),
250
+ l("td", null, r(i.value.name), 1)
251
+ ]),
252
+ l("tr", null, [
253
+ l("td", null, [
254
+ l("strong", null, r(e(a)("users.roles")) + ":", 1)
255
+ ]),
256
+ l("td", null, r(i.value.roles.join(", ")), 1)
257
+ ]),
258
+ l("tr", null, [
259
+ l("td", null, [
260
+ l("strong", null, r(e(a)("profile.language")) + ":", 1)
261
+ ]),
262
+ l("td", null, r(b.value), 1)
263
+ ])
264
+ ])
265
+ ]),
266
+ _: 1
267
+ })
268
+ ]),
269
+ _: 1
270
+ }, 8, ["title"]),
271
+ s(e(W), {
272
+ show: m.value,
273
+ "onUpdate:show": n[2] || (n[2] = (p) => m.value = p),
274
+ class: "custom-card",
275
+ preset: "card",
276
+ title: e(a)("profile.edit"),
277
+ bordered: !1,
278
+ style: { width: "600px" },
279
+ segmented: { content: "soft", footer: "soft" }
280
+ }, {
281
+ default: d(() => [
282
+ s(se, {
283
+ modelValue: t.value,
284
+ "onUpdate:modelValue": n[1] || (n[1] = (p) => t.value = p),
285
+ onUpdate: u
286
+ }, null, 8, ["modelValue"])
287
+ ]),
288
+ _: 1
289
+ }, 8, ["show", "title"])
290
+ ], 64));
291
+ }
292
+ };
293
+ export {
294
+ ue as default
295
+ };