@webx-ui/module-auth 0.2.1 → 0.4.0

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 CHANGED
@@ -1,52 +1,53 @@
1
- import { inject as ee, defineComponent as q, computed as C, ref as b, useTemplateRef as te, onBeforeUnmount as ae, resolveComponent as r, openBlock as x, createBlock as k, withCtx as n, createVNode as l, withModifiers as oe, createCommentVNode as T, createElementVNode as le, createTextVNode as M, toDisplayString as $, createElementBlock as W, Fragment as j, unref as E, renderList as ne, h as se, watch as ue } from "vue";
2
- import { useTranslate as K, HttpError as re, useAdmin as ie, useI18n as ce } from "@webx-ui/admin";
3
- const O = /* @__PURE__ */ Symbol("webx-auth");
4
- function R() {
5
- const e = ee(O, null);
6
- if (e === null)
1
+ import { inject as We, defineComponent as I, computed as B, ref as w, useTemplateRef as le, onBeforeUnmount as ze, resolveComponent as W, openBlock as k, createBlock as S, withCtx as l, createVNode as n, withModifiers as ae, createCommentVNode as P, createElementVNode as O, createTextVNode as L, toDisplayString as V, watch as oe, unref as e, isRef as pe, createElementBlock as K, resolveDynamicComponent as Be, createSlots as ne, Fragment as te, renderList as fe, h as he } from "vue";
2
+ import { useTranslate as R, HttpError as Fe, useAdmin as q, useI18n as be } from "@webx-ui/admin";
3
+ import { useModal as ye, WxDialog as we, WxFormItem as D, WxInput as Z, WxSelect as H, WxSpace as E, WxCheckbox as de, WxText as Y, WxButton as j, toast as G, WxTable as Te, WxActions as ce, WxAction as me, WxBadge as ee, WxAvatar as Me, createModal as ge, WxCard as Pe, confirm as Ne } from "@webx-ui/core";
4
+ const _e = /* @__PURE__ */ Symbol("webx-auth");
5
+ function xe() {
6
+ const a = We(_e, null);
7
+ if (a === null)
7
8
  throw new Error("useAuth() was called outside a panel that installed the auth plugin.");
8
- return e;
9
+ return a;
9
10
  }
10
- function de(e) {
11
- const o = `${e.apiPath}/auth`;
11
+ function Oe(a) {
12
+ const i = `${a.apiPath}/auth`;
12
13
  return {
13
14
  async me() {
14
15
  try {
15
- return (await e.http.get(`${o}/me`)).data;
16
- } catch (t) {
17
- if (me(t))
16
+ return (await a.http.get(`${i}/me`)).data;
17
+ } catch (s) {
18
+ if (Ie(s))
18
19
  return null;
19
- throw t;
20
+ throw s;
20
21
  }
21
22
  },
22
- async login(t) {
23
- const a = await e.http.post(`${o}/login`, {
24
- email: t.email,
25
- password: t.password,
26
- remember: t.remember ?? !1
23
+ async login(s) {
24
+ const o = await a.http.post(`${i}/login`, {
25
+ email: s.email,
26
+ password: s.password,
27
+ remember: s.remember ?? !1
27
28
  });
28
- return e.setUser(a.data), await e.reload(), a.data;
29
+ return a.setUser(o.data), await a.reload(), o.data;
29
30
  },
30
- async setLocale(t) {
31
- const a = await e.http.put(`${o}/locale`, { locale: t });
32
- e.setUser(a.data), await e.setLocale(t);
31
+ async setLocale(s) {
32
+ const o = await a.http.put(`${i}/locale`, { locale: s });
33
+ a.setUser(o.data), await a.setLocale(s);
33
34
  },
34
35
  async logout() {
35
36
  try {
36
- await e.http.post(`${o}/logout`);
37
+ await a.http.post(`${i}/logout`);
37
38
  } finally {
38
- e.setUser(null), e.state.status = "unauthenticated", e.state.manifest = null;
39
+ a.setUser(null), a.state.status = "unauthenticated", a.state.manifest = null;
39
40
  }
40
41
  }
41
42
  };
42
43
  }
43
- function pe(e, o) {
44
- e.provide(O, o);
44
+ function Ee(a, i) {
45
+ a.provide(_e, i);
45
46
  }
46
- function me(e) {
47
- return typeof e == "object" && e !== null && "status" in e && e.status === 401;
47
+ function Ie(a) {
48
+ return typeof a == "object" && a !== null && "status" in a && a.status === 401;
48
49
  }
49
- const ve = ["title", "aria-label", "aria-pressed"], fe = /* @__PURE__ */ q({
50
+ const Re = ["title", "aria-label", "aria-pressed"], De = /* @__PURE__ */ I({
50
51
  __name: "LoginCard",
51
52
  props: {
52
53
  emailLabel: { default: void 0 },
@@ -61,170 +62,170 @@ const ve = ["title", "aria-label", "aria-pressed"], fe = /* @__PURE__ */ q({
61
62
  autofocus: { type: Boolean, default: !0 }
62
63
  },
63
64
  emits: ["success"],
64
- setup(e, { expose: o, emit: t }) {
65
- const a = e, i = t, d = R(), u = K("webx-auth"), c = C(() => ({
66
- email: a.emailLabel ?? u("card.email"),
67
- password: a.passwordLabel ?? u("card.password"),
68
- remember: a.rememberLabel ?? u("card.remember"),
69
- submit: a.submitLabel ?? u("card.submit"),
70
- capsLock: a.capsLockWarning ?? u("card.caps-lock"),
71
- reveal: a.revealLabel ?? u("card.reveal"),
72
- hide: a.hideLabel ?? u("card.hide")
73
- })), V = b(""), v = b(""), p = b(!1), g = b(!1), f = b(!1), S = b(!1), m = b(""), y = b({}), w = b(0), _ = te("emailField");
74
- let U = null;
75
- ae(A);
76
- const z = C(() => w.value > 0), H = C(
77
- () => a.throttleMessage === void 0 ? u("card.throttled", { seconds: w.value }) : a.throttleMessage.replace(":seconds", String(w.value))
65
+ setup(a, { expose: i, emit: s }) {
66
+ const o = a, u = s, b = xe(), h = R("webx-auth"), r = B(() => ({
67
+ email: o.emailLabel ?? h("card.email"),
68
+ password: o.passwordLabel ?? h("card.password"),
69
+ remember: o.rememberLabel ?? h("card.remember"),
70
+ submit: o.submitLabel ?? h("card.submit"),
71
+ capsLock: o.capsLockWarning ?? h("card.caps-lock"),
72
+ reveal: o.revealLabel ?? h("card.reveal"),
73
+ hide: o.hideLabel ?? h("card.hide")
74
+ })), d = w(""), A = w(""), _ = w(!1), c = w(!1), t = w(!1), U = w(!1), C = w(""), $ = w({}), z = w(0), F = le("emailField");
75
+ let T = null;
76
+ ze(x);
77
+ const m = B(() => z.value > 0), v = B(
78
+ () => o.throttleMessage === void 0 ? h("card.throttled", { seconds: z.value }) : o.throttleMessage.replace(":seconds", String(z.value))
78
79
  );
79
- async function D() {
80
- if (!(g.value || z.value)) {
81
- g.value = !0, m.value = "", y.value = {};
80
+ async function f() {
81
+ if (!(c.value || m.value)) {
82
+ c.value = !0, C.value = "", $.value = {};
82
83
  try {
83
- await d.login({
84
- email: V.value,
85
- password: v.value,
86
- remember: p.value
87
- }), v.value = "", i("success");
88
- } catch (s) {
89
- G(s);
84
+ await b.login({
85
+ email: d.value,
86
+ password: A.value,
87
+ remember: _.value
88
+ }), A.value = "", u("success");
89
+ } catch (g) {
90
+ Q(g);
90
91
  } finally {
91
- g.value = !1;
92
+ c.value = !1;
92
93
  }
93
94
  }
94
95
  }
95
- function G(s) {
96
- if (!(s instanceof re)) {
97
- m.value = s instanceof Error ? s.message : String(s);
96
+ function Q(g) {
97
+ if (!(g instanceof Fe)) {
98
+ C.value = g instanceof Error ? g.message : String(g);
98
99
  return;
99
100
  }
100
- if (s.isValidation) {
101
- y.value = s.errors;
101
+ if (g.isValidation) {
102
+ $.value = g.errors;
102
103
  return;
103
104
  }
104
- if (s.isThrottled) {
105
- J(s.retryAfter ?? 60);
105
+ if (g.isThrottled) {
106
+ y(g.retryAfter ?? 60);
106
107
  return;
107
108
  }
108
- m.value = s.message;
109
+ C.value = g.message;
109
110
  }
110
- function J(s) {
111
- A(), w.value = s, U = setInterval(() => {
112
- w.value -= 1, w.value <= 0 && A();
111
+ function y(g) {
112
+ x(), z.value = g, T = setInterval(() => {
113
+ z.value -= 1, z.value <= 0 && x();
113
114
  }, 1e3);
114
115
  }
115
- function A() {
116
- U !== null && (clearInterval(U), U = null), w.value = 0;
116
+ function x() {
117
+ T !== null && (clearInterval(T), T = null), z.value = 0;
117
118
  }
118
- function N(s) {
119
- S.value = s.getModifierState("CapsLock");
119
+ function p(g) {
120
+ U.value = g.getModifierState("CapsLock");
120
121
  }
121
- return o({ focus: () => _.value?.focus() }), (s, h) => {
122
- const I = r("wx-alert"), B = r("wx-icon"), P = r("wx-input"), F = r("wx-form-item"), Q = r("wx-checkbox"), X = r("wx-button"), Y = r("wx-form"), Z = r("wx-card");
123
- return x(), k(Z, {
122
+ return i({ focus: () => F.value?.focus() }), (g, M) => {
123
+ const ie = W("wx-alert"), X = W("wx-icon"), re = W("wx-input"), ue = W("wx-form-item"), Le = W("wx-checkbox"), $e = W("wx-button"), Se = W("wx-form"), Ue = W("wx-card");
124
+ return k(), S(Ue, {
124
125
  class: "wx-login",
125
126
  padding: 24
126
127
  }, {
127
- default: n(() => [
128
- l(Y, {
129
- errors: y.value,
130
- disabled: g.value,
128
+ default: l(() => [
129
+ n(Se, {
130
+ errors: $.value,
131
+ disabled: c.value,
131
132
  gap: "md",
132
- onSubmit: oe(D, ["prevent"])
133
+ onSubmit: ae(f, ["prevent"])
133
134
  }, {
134
- default: n(() => [
135
- m.value !== "" ? (x(), k(I, {
135
+ default: l(() => [
136
+ C.value !== "" ? (k(), S(ie, {
136
137
  key: 0,
137
138
  type: "danger",
138
139
  variant: "soft",
139
140
  live: "",
140
- description: m.value,
141
+ description: C.value,
141
142
  class: "wx-login__message"
142
- }, null, 8, ["description"])) : z.value ? (x(), k(I, {
143
+ }, null, 8, ["description"])) : m.value ? (k(), S(ie, {
143
144
  key: 1,
144
145
  type: "warning",
145
146
  variant: "soft",
146
147
  live: "",
147
- description: H.value,
148
+ description: v.value,
148
149
  class: "wx-login__message"
149
- }, null, 8, ["description"])) : T("", !0),
150
- l(F, { name: "email" }, {
151
- default: n(() => [
152
- l(P, {
150
+ }, null, 8, ["description"])) : P("", !0),
151
+ n(ue, { name: "email" }, {
152
+ default: l(() => [
153
+ n(re, {
153
154
  ref_key: "emailField",
154
- ref: _,
155
- modelValue: V.value,
156
- "onUpdate:modelValue": h[0] || (h[0] = (L) => V.value = L),
155
+ ref: F,
156
+ modelValue: d.value,
157
+ "onUpdate:modelValue": M[0] || (M[0] = (N) => d.value = N),
157
158
  type: "email",
158
- placeholder: c.value.email,
159
- "aria-label": c.value.email,
159
+ placeholder: r.value.email,
160
+ "aria-label": r.value.email,
160
161
  autocomplete: "username",
161
- autofocus: e.autofocus,
162
+ autofocus: a.autofocus,
162
163
  inputmode: "email",
163
164
  size: "lg"
164
165
  }, {
165
- prefix: n(() => [
166
- l(B, { name: "mail" })
166
+ prefix: l(() => [
167
+ n(X, { name: "mail" })
167
168
  ]),
168
169
  _: 1
169
170
  }, 8, ["modelValue", "placeholder", "aria-label", "autofocus"])
170
171
  ]),
171
172
  _: 1
172
173
  }),
173
- l(F, {
174
+ n(ue, {
174
175
  name: "password",
175
- help: S.value ? c.value.capsLock : void 0
176
+ help: U.value ? r.value.capsLock : void 0
176
177
  }, {
177
- default: n(() => [
178
- l(P, {
179
- modelValue: v.value,
180
- "onUpdate:modelValue": h[2] || (h[2] = (L) => v.value = L),
181
- type: f.value ? "text" : "password",
182
- placeholder: c.value.password,
183
- "aria-label": c.value.password,
178
+ default: l(() => [
179
+ n(re, {
180
+ modelValue: A.value,
181
+ "onUpdate:modelValue": M[2] || (M[2] = (N) => A.value = N),
182
+ type: t.value ? "text" : "password",
183
+ placeholder: r.value.password,
184
+ "aria-label": r.value.password,
184
185
  autocomplete: "current-password",
185
186
  size: "lg",
186
- onKeydown: N,
187
- onKeyup: N
187
+ onKeydown: p,
188
+ onKeyup: p
188
189
  }, {
189
- prefix: n(() => [
190
- l(B, { name: "lock" })
190
+ prefix: l(() => [
191
+ n(X, { name: "lock" })
191
192
  ]),
192
- suffix: n(() => [
193
- le("button", {
193
+ suffix: l(() => [
194
+ O("button", {
194
195
  type: "button",
195
196
  class: "wx-login__reveal",
196
- title: f.value ? c.value.hide : c.value.reveal,
197
- "aria-label": f.value ? c.value.hide : c.value.reveal,
198
- "aria-pressed": f.value,
197
+ title: t.value ? r.value.hide : r.value.reveal,
198
+ "aria-label": t.value ? r.value.hide : r.value.reveal,
199
+ "aria-pressed": t.value,
199
200
  tabindex: "-1",
200
- onClick: h[1] || (h[1] = (L) => f.value = !f.value)
201
+ onClick: M[1] || (M[1] = (N) => t.value = !t.value)
201
202
  }, [
202
- l(B, {
203
- name: f.value ? "eye-off" : "eye"
203
+ n(X, {
204
+ name: t.value ? "eye-off" : "eye"
204
205
  }, null, 8, ["name"])
205
- ], 8, ve)
206
+ ], 8, Re)
206
207
  ]),
207
208
  _: 1
208
209
  }, 8, ["modelValue", "type", "placeholder", "aria-label"])
209
210
  ]),
210
211
  _: 1
211
212
  }, 8, ["help"]),
212
- e.remember ? (x(), k(Q, {
213
+ a.remember ? (k(), S(Le, {
213
214
  key: 2,
214
- modelValue: p.value,
215
- "onUpdate:modelValue": h[3] || (h[3] = (L) => p.value = L),
216
- label: c.value.remember
217
- }, null, 8, ["modelValue", "label"])) : T("", !0),
218
- l(X, {
215
+ modelValue: _.value,
216
+ "onUpdate:modelValue": M[3] || (M[3] = (N) => _.value = N),
217
+ label: r.value.remember
218
+ }, null, 8, ["modelValue", "label"])) : P("", !0),
219
+ n($e, {
219
220
  type: "primary",
220
221
  "native-type": "submit",
221
222
  size: "lg",
222
223
  block: "",
223
- loading: g.value,
224
- disabled: z.value
224
+ loading: c.value,
225
+ disabled: m.value
225
226
  }, {
226
- default: n(() => [
227
- M($(c.value.submit), 1)
227
+ default: l(() => [
228
+ L(V(r.value.submit), 1)
228
229
  ]),
229
230
  _: 1
230
231
  }, 8, ["loading", "disabled"])
@@ -236,12 +237,12 @@ const ve = ["title", "aria-label", "aria-pressed"], fe = /* @__PURE__ */ q({
236
237
  });
237
238
  };
238
239
  }
239
- }), we = (e, o) => {
240
- const t = e.__vccOpts || e;
241
- for (const [a, i] of o)
242
- t[a] = i;
243
- return t;
244
- }, be = /* @__PURE__ */ we(fe, [["__scopeId", "data-v-1224c1f8"]]), _e = {
240
+ }), ke = (a, i) => {
241
+ const s = a.__vccOpts || a;
242
+ for (const [o, u] of i)
243
+ s[o] = u;
244
+ return s;
245
+ }, Ke = /* @__PURE__ */ ke(De, [["__scopeId", "data-v-1224c1f8"]]), Ve = {
245
246
  card: {
246
247
  email: "Email",
247
248
  password: "Password",
@@ -253,114 +254,810 @@ const ve = ["title", "aria-label", "aria-pressed"], fe = /* @__PURE__ */ q({
253
254
  throttled: "Too many attempts. Try again in :seconds s.",
254
255
  failed: "Those details do not match an account."
255
256
  },
257
+ admins: {
258
+ title: "Administrators",
259
+ search: "Search administrators",
260
+ new: "New administrator",
261
+ edit: "Edit administrator",
262
+ // The same two, short enough for a button on a phone and for a dialog's heading.
263
+ "new-short": "Add",
264
+ "edit-short": "Edit",
265
+ name: "Name",
266
+ email: "Email",
267
+ password: "Password",
268
+ "password-hint": "At least 12 characters",
269
+ "password-keep": "Leave blank to keep the current one",
270
+ avatar: "Photo",
271
+ roles: "Roles",
272
+ "no-roles": "No roles",
273
+ active: "Active",
274
+ super: "Super administrator",
275
+ "super-hint": "Answers yes to everything, whatever the roles say",
276
+ locale: "Panel language",
277
+ "locale-auto": "Follow the browser",
278
+ "last-login": "Last signed in",
279
+ never: "Never",
280
+ save: "Save",
281
+ cancel: "Cancel",
282
+ delete: "Delete",
283
+ "delete-title": "Delete :name?",
284
+ "delete-text": "They lose access at once. What they have written stays.",
285
+ "all-roles": "All roles",
286
+ "any-state": "Active and not",
287
+ "only-active": "Active only",
288
+ "only-inactive": "Switched off only",
289
+ empty: "Nobody matches that",
290
+ "select-one": "Choose an administrator",
291
+ "select-many": "Choose administrators",
292
+ chosen: "Chosen: :count",
293
+ created: "Administrator created",
294
+ updated: "Administrator saved",
295
+ deleted: "Administrator deleted"
296
+ },
297
+ errors: {
298
+ unauthenticated: "Unauthenticated.",
299
+ inactive: "This account is no longer active.",
300
+ forbidden: "This account may not do that.",
301
+ "not-yourself": "You cannot do that to your own account.",
302
+ "last-super": "There has to be one super administrator left."
303
+ },
256
304
  menu: {
257
305
  "sign-out": "Sign out",
258
306
  language: "Interface language"
259
307
  }
260
- }, ge = /* @__PURE__ */ q({
261
- __name: "UserMenu",
308
+ };
309
+ function se(a) {
310
+ const i = `${a.apiPath}/auth`, s = (o) => o.data;
311
+ return {
312
+ list: (o = {}) => a.http.get(`${i}/admins`, {
313
+ query: {
314
+ q: o.q || void 0,
315
+ role: o.role ?? void 0,
316
+ active: o.active ?? void 0,
317
+ sort: o.sort,
318
+ page: o.page,
319
+ per_page: o.per_page
320
+ }
321
+ }).then((u) => ({ ...u.meta, data: u.data })),
322
+ get: (o) => a.http.get(`${i}/admins/${o}`).then(s),
323
+ create: (o) => a.http.post(`${i}/admins`, o).then(s),
324
+ update: (o, u) => a.http.patch(`${i}/admins/${o}`, u).then(s),
325
+ remove: (o) => a.http.delete(`${i}/admins/${o}`),
326
+ roles: () => a.http.get(`${i}/roles`).then(s)
327
+ };
328
+ }
329
+ const ve = /* @__PURE__ */ new WeakSet();
330
+ function J() {
331
+ try {
332
+ const { i18n: a } = q();
333
+ ve.has(a) || (a.defaults("webx-auth", Ve), ve.add(a));
334
+ } catch {
335
+ }
336
+ }
337
+ const je = { class: "wx-admin-form" }, qe = { class: "wx-admin-form__grid" }, He = {
338
+ key: 0,
339
+ class: "wx-admin-form__aside"
340
+ }, Ye = { class: "wx-admin-form__fields" }, Ge = /* @__PURE__ */ I({
341
+ __name: "AdminDialog",
262
342
  props: {
263
- signOutLabel: { default: void 0 }
343
+ admin: { default: null },
344
+ avatarField: { default: void 0 }
264
345
  },
265
- setup(e) {
266
- const o = ie(), t = R(), a = ce(), i = K("webx-auth"), d = C(() => o.state.user), u = C(
267
- () => a.state.panelLocales.length > 1 ? a.state.panelLocales : []
268
- ), c = C(() => (d.value?.name ?? "").split(/\s+/).filter((p) => p !== "").slice(0, 2).map((p) => p[0]?.toUpperCase() ?? "").join(""));
269
- async function V(v) {
270
- v !== a.state.locale && await t.setLocale(v);
346
+ setup(a) {
347
+ const i = a, { resolve: s, dismiss: o, open: u } = ye(), b = q(), h = se(b), r = be();
348
+ J();
349
+ const d = R("webx-auth"), A = w([]), _ = w(!1), c = w({}), t = w({
350
+ name: "",
351
+ email: "",
352
+ password: "",
353
+ avatar: null,
354
+ is_active: !0,
355
+ is_super: !1,
356
+ locale: null,
357
+ roles: []
358
+ }), U = B({
359
+ get: () => t.value.avatar ? { path: t.value.avatar } : null,
360
+ set: (m) => {
361
+ t.value.avatar = m?.path ?? null;
362
+ }
363
+ }), C = B(() => i.admin !== null), $ = B(() => A.value.map((m) => ({ value: m.id, label: m.name }))), z = B(() => [
364
+ { value: "auto", label: d("admins.locale-auto") },
365
+ ...r.state.panelLocales.map((m) => ({ value: m.code, label: m.nativeName }))
366
+ ]);
367
+ h.roles().then((m) => A.value = m), oe(
368
+ () => i.admin,
369
+ (m) => {
370
+ t.value = {
371
+ name: m?.name ?? "",
372
+ email: m?.email ?? "",
373
+ password: "",
374
+ avatar: m?.avatar ?? null,
375
+ is_active: m?.is_active ?? !0,
376
+ is_super: m?.is_super ?? !1,
377
+ locale: m?.locale ?? "auto",
378
+ roles: m?.roles.map((v) => v.id) ?? []
379
+ }, c.value = {};
380
+ },
381
+ { immediate: !0 }
382
+ );
383
+ function F(m) {
384
+ return c.value[m]?.[0];
385
+ }
386
+ async function T() {
387
+ _.value = !0, c.value = {};
388
+ const m = {
389
+ name: t.value.name,
390
+ email: t.value.email,
391
+ avatar: t.value.avatar,
392
+ is_active: t.value.is_active,
393
+ is_super: t.value.is_super,
394
+ locale: t.value.locale === "auto" ? null : t.value.locale,
395
+ roles: t.value.roles ?? []
396
+ };
397
+ t.value.password && (m.password = t.value.password);
398
+ try {
399
+ const v = i.admin ? await h.update(i.admin.id, m) : await h.create(m);
400
+ G.success(d(C.value ? "admins.updated" : "admins.created")), s(v);
401
+ } catch (v) {
402
+ const f = v.body;
403
+ f?.errors ? c.value = f.errors : f?.message && G.danger(f.message);
404
+ } finally {
405
+ _.value = !1;
406
+ }
271
407
  }
272
- return (v, p) => {
273
- const g = r("wx-avatar"), f = r("wx-action"), S = r("wx-text"), m = r("wx-dropdown-item"), y = r("wx-divider"), w = r("wx-dropdown");
274
- return d.value !== null ? (x(), k(w, { key: 0 }, {
275
- trigger: n(() => [
276
- l(f, {
277
- title: d.value.name
408
+ return (m, v) => (k(), S(e(we), {
409
+ open: e(u),
410
+ "onUpdate:open": v[9] || (v[9] = (f) => pe(u) ? u.value = f : null),
411
+ title: C.value ? e(d)("admins.edit-short") : e(d)("admins.new-short"),
412
+ width: 720
413
+ }, {
414
+ footer: l(() => [
415
+ n(e(E), { size: "sm" }, {
416
+ default: l(() => [
417
+ n(e(j), {
418
+ variant: "outline",
419
+ onClick: v[8] || (v[8] = (f) => e(o)())
420
+ }, {
421
+ default: l(() => [
422
+ L(V(e(d)("admins.cancel")), 1)
423
+ ]),
424
+ _: 1
425
+ }),
426
+ n(e(j), {
427
+ type: "primary",
428
+ loading: _.value,
429
+ onClick: T
430
+ }, {
431
+ default: l(() => [
432
+ L(V(e(d)("admins.save")), 1)
433
+ ]),
434
+ _: 1
435
+ }, 8, ["loading"])
436
+ ]),
437
+ _: 1
438
+ })
439
+ ]),
440
+ default: l(() => [
441
+ O("div", je, [
442
+ O("div", qe, [
443
+ a.avatarField ? (k(), K("div", He, [
444
+ (k(), S(Be(a.avatarField), {
445
+ modelValue: U.value,
446
+ "onUpdate:modelValue": v[0] || (v[0] = (f) => U.value = f),
447
+ label: e(d)("admins.avatar"),
448
+ aspect: "1/1",
449
+ captions: !1
450
+ }, null, 8, ["modelValue", "label"]))
451
+ ])) : P("", !0),
452
+ O("div", Ye, [
453
+ n(e(D), {
454
+ label: e(d)("admins.name"),
455
+ error: F("name")
456
+ }, {
457
+ default: l(() => [
458
+ n(e(Z), {
459
+ modelValue: t.value.name,
460
+ "onUpdate:modelValue": v[1] || (v[1] = (f) => t.value.name = f),
461
+ name: "name"
462
+ }, null, 8, ["modelValue"])
463
+ ]),
464
+ _: 1
465
+ }, 8, ["label", "error"]),
466
+ n(e(D), {
467
+ label: e(d)("admins.email"),
468
+ error: F("email")
469
+ }, {
470
+ default: l(() => [
471
+ n(e(Z), {
472
+ modelValue: t.value.email,
473
+ "onUpdate:modelValue": v[2] || (v[2] = (f) => t.value.email = f),
474
+ type: "email",
475
+ name: "email",
476
+ autocomplete: "off"
477
+ }, null, 8, ["modelValue"])
478
+ ]),
479
+ _: 1
480
+ }, 8, ["label", "error"]),
481
+ n(e(D), {
482
+ label: e(d)("admins.password"),
483
+ error: F("password"),
484
+ help: C.value ? e(d)("admins.password-keep") : e(d)("admins.password-hint")
485
+ }, {
486
+ default: l(() => [
487
+ n(e(Z), {
488
+ modelValue: t.value.password,
489
+ "onUpdate:modelValue": v[3] || (v[3] = (f) => t.value.password = f),
490
+ type: "password",
491
+ name: "password",
492
+ autocomplete: "new-password"
493
+ }, null, 8, ["modelValue"])
494
+ ]),
495
+ _: 1
496
+ }, 8, ["label", "error", "help"]),
497
+ n(e(D), {
498
+ label: e(d)("admins.roles"),
499
+ error: F("roles")
500
+ }, {
501
+ default: l(() => [
502
+ n(e(H), {
503
+ modelValue: t.value.roles,
504
+ "onUpdate:modelValue": v[4] || (v[4] = (f) => t.value.roles = f),
505
+ options: $.value,
506
+ multiple: ""
507
+ }, null, 8, ["modelValue", "options"])
508
+ ]),
509
+ _: 1
510
+ }, 8, ["label", "error"]),
511
+ n(e(D), {
512
+ label: e(d)("admins.locale")
513
+ }, {
514
+ default: l(() => [
515
+ n(e(H), {
516
+ modelValue: t.value.locale,
517
+ "onUpdate:modelValue": v[5] || (v[5] = (f) => t.value.locale = f),
518
+ options: z.value
519
+ }, null, 8, ["modelValue", "options"])
520
+ ]),
521
+ _: 1
522
+ }, 8, ["label"]),
523
+ n(e(E), { size: "md" }, {
524
+ default: l(() => [
525
+ n(e(de), {
526
+ modelValue: t.value.is_active,
527
+ "onUpdate:modelValue": v[6] || (v[6] = (f) => t.value.is_active = f),
528
+ label: e(d)("admins.active")
529
+ }, null, 8, ["modelValue", "label"]),
530
+ n(e(de), {
531
+ modelValue: t.value.is_super,
532
+ "onUpdate:modelValue": v[7] || (v[7] = (f) => t.value.is_super = f),
533
+ label: e(d)("admins.super")
534
+ }, null, 8, ["modelValue", "label"])
535
+ ]),
536
+ _: 1
537
+ }),
538
+ n(e(Y), {
539
+ size: "sm",
540
+ tone: "muted"
541
+ }, {
542
+ default: l(() => [
543
+ L(V(e(d)("admins.super-hint")), 1)
544
+ ]),
545
+ _: 1
546
+ })
547
+ ])
548
+ ])
549
+ ])
550
+ ]),
551
+ _: 1
552
+ }, 8, ["open", "title"]));
553
+ }
554
+ }), Je = { class: "wx-admin-list" }, Ae = /* @__PURE__ */ I({
555
+ __name: "AdminList",
556
+ props: {
557
+ picking: { type: Boolean, default: !1 },
558
+ multiple: { type: Boolean, default: !1 },
559
+ removable: { type: Boolean, default: !1 },
560
+ filters: { type: Boolean, default: !1 },
561
+ resolveAvatar: { type: Function, default: void 0 }
562
+ },
563
+ emits: ["open", "chosen", "selection", "remove"],
564
+ setup(a, { expose: i, emit: s }) {
565
+ const o = a, u = s, b = q(), h = se(b);
566
+ J();
567
+ const r = R("webx-auth"), d = w(null), A = w([]), _ = w(!1), c = w("all"), t = w("any"), U = w([]), C = w({});
568
+ let $ = { page: 1, perPage: 20, sort: null, search: "" };
569
+ const z = B(() => [
570
+ { value: "all", label: r("admins.all-roles") },
571
+ ...A.value.map((y) => ({ value: y.slug, label: y.name }))
572
+ ]), F = B(() => [
573
+ { value: "any", label: r("admins.any-state") },
574
+ { value: "yes", label: r("admins.only-active") },
575
+ { value: "no", label: r("admins.only-inactive") }
576
+ ]), T = B(() => [
577
+ { key: "name", label: r("admins.name"), sortable: !0 },
578
+ { key: "email", label: r("admins.email"), sortable: !0, hideBelow: 560 },
579
+ { key: "roles", label: r("admins.roles"), hideBelow: 760 },
580
+ { key: "is_active", label: r("admins.active"), align: "center", hideBelow: 660 },
581
+ {
582
+ key: "last_login_at",
583
+ label: r("admins.last-login"),
584
+ sortable: !0,
585
+ hideBelow: 900,
586
+ // The first thing to go when a row becomes a card: it is a date somebody scans down a
587
+ // column, and a card has no column to scan.
588
+ hideOnCards: !0
589
+ },
590
+ {
591
+ key: "actions",
592
+ label: "",
593
+ width: 56,
594
+ align: "right",
595
+ hidden: !o.removable,
596
+ // A card puts them along its top instead, through the `card-actions` slot.
597
+ hideOnCards: !0
598
+ }
599
+ ]);
600
+ h.roles().then((y) => A.value = y), oe([c, t], () => m($));
601
+ async function m(y) {
602
+ $ = y, _.value = !0;
603
+ try {
604
+ d.value = await h.list({
605
+ q: y.search,
606
+ role: c.value === "all" ? null : c.value,
607
+ active: t.value === "any" ? null : t.value,
608
+ sort: y.sort ? `${y.sort.order === "desc" ? "-" : ""}${y.sort.key}` : "name",
609
+ page: y.page,
610
+ per_page: y.perPage
611
+ }), v();
612
+ } finally {
613
+ _.value = !1;
614
+ }
615
+ }
616
+ async function v() {
617
+ const y = o.resolveAvatar;
618
+ if (y)
619
+ for (const x of d.value?.data ?? []) {
620
+ if (!x.avatar || C.value[x.avatar]) continue;
621
+ const p = await y(x.avatar);
622
+ p && (C.value = { ...C.value, [x.avatar]: p });
623
+ }
624
+ }
625
+ function f(y) {
626
+ if (!o.picking) {
627
+ u("open", y);
628
+ return;
629
+ }
630
+ o.multiple || u("chosen", [y]);
631
+ }
632
+ function Q(y, x) {
633
+ U.value = x, u("selection", x);
634
+ }
635
+ return i({ reload: () => m($), chosen: () => U.value }), (y, x) => (k(), K("div", Je, [
636
+ n(e(Te), {
637
+ data: d.value,
638
+ columns: T.value,
639
+ "row-key": "id",
640
+ searchable: "",
641
+ hover: "",
642
+ flush: "",
643
+ loading: _.value,
644
+ "search-placeholder": e(r)("admins.search"),
645
+ "empty-text": e(r)("admins.empty"),
646
+ selectable: a.picking && a.multiple,
647
+ onStateChange: m,
648
+ onRowClick: f,
649
+ onSelectionChange: Q
650
+ }, ne({
651
+ "cell-name": l(({ row: p }) => [
652
+ n(e(E), {
653
+ size: "sm",
654
+ align: "center"
278
655
  }, {
279
- default: n(() => [
280
- l(g, {
281
- label: c.value,
656
+ default: l(() => [
657
+ n(e(Me), {
658
+ name: p.name,
659
+ src: p.avatar ? C.value[p.avatar] : void 0,
282
660
  size: "sm"
283
- }, null, 8, ["label"])
661
+ }, null, 8, ["name", "src"]),
662
+ O("span", null, V(p.name), 1),
663
+ p.is_super ? (k(), S(e(ee), {
664
+ key: 0,
665
+ type: "warning"
666
+ }, {
667
+ default: l(() => [
668
+ L(V(e(r)("admins.super")), 1)
669
+ ]),
670
+ _: 1
671
+ })) : P("", !0)
672
+ ]),
673
+ _: 2
674
+ }, 1024)
675
+ ]),
676
+ "cell-roles": l(({ row: p }) => [
677
+ p.roles.length > 0 ? (k(), S(e(E), {
678
+ key: 0,
679
+ size: "xs",
680
+ wrap: ""
681
+ }, {
682
+ default: l(() => [
683
+ (k(!0), K(te, null, fe(p.roles, (g) => (k(), S(e(ee), {
684
+ key: g.id
685
+ }, {
686
+ default: l(() => [
687
+ L(V(g.name), 1)
688
+ ]),
689
+ _: 2
690
+ }, 1024))), 128))
691
+ ]),
692
+ _: 2
693
+ }, 1024)) : (k(), S(e(Y), {
694
+ key: 1,
695
+ size: "sm",
696
+ tone: "muted"
697
+ }, {
698
+ default: l(() => [
699
+ L(V(e(r)("admins.no-roles")), 1)
700
+ ]),
701
+ _: 1
702
+ }))
703
+ ]),
704
+ "cell-is_active": l(({ row: p }) => [
705
+ n(e(ee), {
706
+ type: p.is_active ? "success" : "default",
707
+ dot: ""
708
+ }, {
709
+ default: l(() => [
710
+ L(V(p.is_active ? e(r)("admins.active") : e(r)("admins.only-inactive")), 1)
711
+ ]),
712
+ _: 2
713
+ }, 1032, ["type"])
714
+ ]),
715
+ "card-actions": l(({ row: p }) => [
716
+ a.removable ? (k(), S(e(ce), {
717
+ key: 0,
718
+ size: "sm",
719
+ onClick: x[2] || (x[2] = ae(() => {
720
+ }, ["stop"]))
721
+ }, {
722
+ default: l(() => [
723
+ n(e(me), {
724
+ type: "remove",
725
+ title: e(r)("admins.delete"),
726
+ onClick: (g) => u("remove", p)
727
+ }, null, 8, ["title", "onClick"])
728
+ ]),
729
+ _: 2
730
+ }, 1024)) : P("", !0)
731
+ ]),
732
+ "cell-actions": l(({ row: p }) => [
733
+ n(e(ce), {
734
+ size: "sm",
735
+ onClick: x[3] || (x[3] = ae(() => {
736
+ }, ["stop"]))
737
+ }, {
738
+ default: l(() => [
739
+ n(e(me), {
740
+ type: "remove",
741
+ title: e(r)("admins.delete"),
742
+ onClick: (g) => u("remove", p)
743
+ }, null, 8, ["title", "onClick"])
744
+ ]),
745
+ _: 2
746
+ }, 1024)
747
+ ]),
748
+ "cell-last_login_at": l(({ row: p }) => [
749
+ n(e(Y), {
750
+ size: "sm",
751
+ tone: p.last_login_at ? "default" : "muted"
752
+ }, {
753
+ default: l(() => [
754
+ L(V(p.last_login_at ? new Date(p.last_login_at).toLocaleString() : e(r)("admins.never")), 1)
755
+ ]),
756
+ _: 2
757
+ }, 1032, ["tone"])
758
+ ]),
759
+ _: 2
760
+ }, [
761
+ a.filters ? {
762
+ name: "actions",
763
+ fn: l(() => [
764
+ n(e(E), { size: "sm" }, {
765
+ default: l(() => [
766
+ n(e(H), {
767
+ modelValue: c.value,
768
+ "onUpdate:modelValue": x[0] || (x[0] = (p) => c.value = p),
769
+ options: z.value,
770
+ size: "sm",
771
+ style: { width: "180px" }
772
+ }, null, 8, ["modelValue", "options"]),
773
+ n(e(H), {
774
+ modelValue: t.value,
775
+ "onUpdate:modelValue": x[1] || (x[1] = (p) => t.value = p),
776
+ options: F.value,
777
+ size: "sm",
778
+ style: { width: "180px" }
779
+ }, null, 8, ["modelValue", "options"])
780
+ ]),
781
+ _: 1
782
+ })
783
+ ]),
784
+ key: "0"
785
+ } : void 0
786
+ ]), 1032, ["data", "columns", "loading", "search-placeholder", "empty-text", "selectable"])
787
+ ]));
788
+ }
789
+ }), Qe = /* @__PURE__ */ I({
790
+ __name: "AdminsPage",
791
+ props: {
792
+ avatarField: { default: void 0 },
793
+ resolveAvatar: { type: Function, default: void 0 }
794
+ },
795
+ setup(a) {
796
+ const i = a, s = q(), o = se(s);
797
+ J();
798
+ const u = R("webx-auth"), b = le("list"), h = w(null), r = ge(Ge), d = s.can("admins.manage");
799
+ async function A(c) {
800
+ h.value = c, await r({ admin: c, avatarField: i.avatarField }) && b.value?.reload();
801
+ }
802
+ async function _(c) {
803
+ if (await Ne({
804
+ title: u("admins.delete-title", { name: c.name }),
805
+ message: u("admins.delete-text"),
806
+ confirmText: u("admins.delete"),
807
+ cancelText: u("admins.cancel"),
808
+ tone: "danger"
809
+ }))
810
+ try {
811
+ await o.remove(c.id), G.success(u("admins.deleted")), b.value?.reload();
812
+ } catch (U) {
813
+ const C = U.body;
814
+ G.danger(C?.message ?? u("errors.forbidden"));
815
+ }
816
+ }
817
+ return (c, t) => (k(), S(e(Pe), null, ne({
818
+ header: l(() => [
819
+ L(V(e(u)("admins.title")), 1)
820
+ ]),
821
+ default: l(() => [
822
+ n(Ae, {
823
+ ref_key: "list",
824
+ ref: b,
825
+ removable: e(d),
826
+ "resolve-avatar": i.resolveAvatar,
827
+ onOpen: A,
828
+ onRemove: _
829
+ }, null, 8, ["removable", "resolve-avatar"])
830
+ ]),
831
+ _: 2
832
+ }, [
833
+ e(d) ? {
834
+ name: "extra",
835
+ fn: l(() => [
836
+ n(e(j), {
837
+ type: "primary",
838
+ icon: "add",
839
+ onClick: t[0] || (t[0] = (U) => A(null))
840
+ }, {
841
+ default: l(() => [
842
+ L(V(e(u)("admins.new-short")), 1)
284
843
  ]),
285
844
  _: 1
286
- }, 8, ["title"])
845
+ })
287
846
  ]),
288
- default: n(() => [
289
- l(m, { disabled: "" }, {
290
- default: n(() => [
291
- l(S, { size: "sm" }, {
292
- default: n(() => [
293
- M($(d.value.email), 1)
847
+ key: "0"
848
+ } : void 0
849
+ ]), 1024));
850
+ }
851
+ });
852
+ function oa(a = {}) {
853
+ const i = a.path ?? "/admins";
854
+ return {
855
+ id: "admins",
856
+ path: i,
857
+ routes: [
858
+ {
859
+ path: i,
860
+ name: "webx.admins",
861
+ component: {
862
+ render: () => he(Qe, {
863
+ avatarField: a.avatarField,
864
+ resolveAvatar: a.resolveAvatar
865
+ })
866
+ }
867
+ }
868
+ ]
869
+ };
870
+ }
871
+ const Xe = /* @__PURE__ */ I({
872
+ __name: "AdminPicker",
873
+ props: {
874
+ multiple: { type: Boolean, default: !1 },
875
+ title: { default: void 0 },
876
+ resolveAvatar: { type: Function, default: void 0 }
877
+ },
878
+ setup(a) {
879
+ const i = a, { open: s, resolve: o, dismiss: u } = ye();
880
+ J();
881
+ const b = R("webx-auth"), h = le("list"), r = w(0);
882
+ function d(_) {
883
+ o(_);
884
+ }
885
+ function A(_) {
886
+ r.value = _.length;
887
+ }
888
+ return (_, c) => (k(), S(e(we), {
889
+ open: e(s),
890
+ "onUpdate:open": c[2] || (c[2] = (t) => pe(s) ? s.value = t : null),
891
+ title: a.title ?? e(b)(a.multiple ? "admins.select-many" : "admins.select-one"),
892
+ width: 880
893
+ }, ne({
894
+ default: l(() => [
895
+ n(Ae, {
896
+ ref_key: "list",
897
+ ref: h,
898
+ picking: "",
899
+ multiple: a.multiple,
900
+ "resolve-avatar": i.resolveAvatar,
901
+ onChosen: d,
902
+ onSelection: A
903
+ }, null, 8, ["multiple", "resolve-avatar"])
904
+ ]),
905
+ _: 2
906
+ }, [
907
+ a.multiple ? {
908
+ name: "footer",
909
+ fn: l(() => [
910
+ n(e(E), {
911
+ size: "sm",
912
+ align: "center"
913
+ }, {
914
+ default: l(() => [
915
+ n(e(Y), {
916
+ size: "sm",
917
+ tone: "muted"
918
+ }, {
919
+ default: l(() => [
920
+ L(V(e(b)("admins.chosen", { count: r.value })), 1)
921
+ ]),
922
+ _: 1
923
+ }),
924
+ n(e(j), {
925
+ variant: "outline",
926
+ onClick: c[0] || (c[0] = (t) => e(u)())
927
+ }, {
928
+ default: l(() => [
929
+ L(V(e(b)("admins.cancel")), 1)
930
+ ]),
931
+ _: 1
932
+ }),
933
+ n(e(j), {
934
+ type: "primary",
935
+ disabled: r.value === 0,
936
+ onClick: c[1] || (c[1] = (t) => e(o)(h.value?.chosen() ?? []))
937
+ }, {
938
+ default: l(() => [
939
+ L(V(e(b)("admins.save")), 1)
940
+ ]),
941
+ _: 1
942
+ }, 8, ["disabled"])
943
+ ]),
944
+ _: 1
945
+ })
946
+ ]),
947
+ key: "0"
948
+ } : void 0
949
+ ]), 1032, ["open", "title"]));
950
+ }
951
+ }), Ce = ge(Xe);
952
+ async function na(a = {}) {
953
+ return (await Ce({ ...a, multiple: !1 }))?.[0];
954
+ }
955
+ function sa(a = {}) {
956
+ return Ce({ ...a, multiple: !0 });
957
+ }
958
+ const Ze = ["title"], ea = /* @__PURE__ */ I({
959
+ __name: "UserMenu",
960
+ props: {
961
+ signOutLabel: { default: void 0 }
962
+ },
963
+ setup(a) {
964
+ const i = q(), s = xe(), o = be(), u = R("webx-auth"), b = B(() => i.state.user), h = B(
965
+ () => o.state.panelLocales.length > 1 ? o.state.panelLocales : []
966
+ );
967
+ async function r(d) {
968
+ d !== o.state.locale && await s.setLocale(d);
969
+ }
970
+ return (d, A) => {
971
+ const _ = W("wx-avatar"), c = W("wx-text"), t = W("wx-dropdown-item"), U = W("wx-divider"), C = W("wx-dropdown");
972
+ return b.value !== null ? (k(), S(C, { key: 0 }, {
973
+ trigger: l(() => [
974
+ O("button", {
975
+ type: "button",
976
+ class: "wx-user-menu__trigger",
977
+ title: b.value.name
978
+ }, [
979
+ n(_, {
980
+ name: b.value.name,
981
+ size: "md"
982
+ }, null, 8, ["name"])
983
+ ], 8, Ze)
984
+ ]),
985
+ default: l(() => [
986
+ n(t, { disabled: "" }, {
987
+ default: l(() => [
988
+ n(c, { size: "sm" }, {
989
+ default: l(() => [
990
+ L(V(b.value.email), 1)
294
991
  ]),
295
992
  _: 1
296
993
  })
297
994
  ]),
298
995
  _: 1
299
996
  }),
300
- u.value.length > 0 ? (x(), W(j, { key: 0 }, [
301
- l(y, { spacing: 4 }),
302
- l(m, { disabled: "" }, {
303
- default: n(() => [
304
- l(S, {
997
+ h.value.length > 0 ? (k(), K(te, { key: 0 }, [
998
+ n(U, { spacing: 4 }),
999
+ n(t, { disabled: "" }, {
1000
+ default: l(() => [
1001
+ n(c, {
305
1002
  size: "sm",
306
1003
  tone: "muted"
307
1004
  }, {
308
- default: n(() => [
309
- M($(E(i)("menu.language")), 1)
1005
+ default: l(() => [
1006
+ L(V(e(u)("menu.language")), 1)
310
1007
  ]),
311
1008
  _: 1
312
1009
  })
313
1010
  ]),
314
1011
  _: 1
315
1012
  }),
316
- (x(!0), W(j, null, ne(u.value, (_) => (x(), k(m, {
317
- key: _.code,
318
- icon: _.code === E(a).state.locale ? "check" : void 0,
319
- onClick: (U) => V(_.code)
1013
+ (k(!0), K(te, null, fe(h.value, ($) => (k(), S(t, {
1014
+ key: $.code,
1015
+ icon: $.code === e(o).state.locale ? "check" : void 0,
1016
+ onClick: (z) => r($.code)
320
1017
  }, {
321
- default: n(() => [
322
- M($(_.nativeName), 1)
1018
+ default: l(() => [
1019
+ L(V($.nativeName), 1)
323
1020
  ]),
324
1021
  _: 2
325
1022
  }, 1032, ["icon", "onClick"]))), 128)),
326
- l(y, { spacing: 4 })
327
- ], 64)) : T("", !0),
328
- l(m, {
1023
+ n(U, { spacing: 4 })
1024
+ ], 64)) : P("", !0),
1025
+ n(t, {
329
1026
  icon: "logout",
330
- onClick: p[0] || (p[0] = (_) => E(t).logout())
1027
+ onClick: A[0] || (A[0] = ($) => e(s).logout())
331
1028
  }, {
332
- default: n(() => [
333
- M($(e.signOutLabel ?? E(i)("menu.sign-out")), 1)
1029
+ default: l(() => [
1030
+ L(V(a.signOutLabel ?? e(u)("menu.sign-out")), 1)
334
1031
  ]),
335
1032
  _: 1
336
1033
  })
337
1034
  ]),
338
1035
  _: 1
339
- })) : T("", !0);
1036
+ })) : P("", !0);
340
1037
  };
341
1038
  }
342
- });
343
- function ye(e = {}) {
344
- const o = e.path ?? "/login";
1039
+ }), ia = /* @__PURE__ */ ke(ea, [["__scopeId", "data-v-f4dbd95e"]]);
1040
+ function ra(a = {}) {
1041
+ const i = a.path ?? "/login";
345
1042
  return {
346
- install(t) {
347
- const a = de(t.context);
348
- t.i18n.defaults("webx-auth", _e), pe(t.app, a), t.context.useSessionLoader(() => a.me()), t.router.addRoute({
349
- path: o,
1043
+ install(s) {
1044
+ const o = Oe(s.context);
1045
+ s.i18n.defaults("webx-auth", Ve), Ee(s.app, o), s.context.useSessionLoader(() => o.me()), s.router.addRoute({
1046
+ path: i,
350
1047
  name: "webx.login",
351
1048
  meta: { public: !0 },
352
- component: { render: () => se(be, { ...e.card }) }
353
- }), t.router.beforeEach((i) => i.meta.public === !0 || t.context.state.status !== "unauthenticated" ? !0 : { path: o, query: i.fullPath === "/" ? {} : { next: i.fullPath } }), ue(
354
- () => t.context.state.status,
355
- (i) => {
356
- const d = t.router.currentRoute.value;
357
- if (i === "unauthenticated" && d.path !== o) {
358
- t.router.replace({ path: o, query: { next: d.fullPath } });
1049
+ component: { render: () => he(Ke, { ...a.card }) }
1050
+ }), s.router.beforeEach((u) => u.meta.public === !0 || s.context.state.status !== "unauthenticated" ? !0 : { path: i, query: u.fullPath === "/" ? {} : { next: u.fullPath } }), oe(
1051
+ () => s.context.state.status,
1052
+ (u) => {
1053
+ const b = s.router.currentRoute.value;
1054
+ if (u === "unauthenticated" && b.path !== i) {
1055
+ s.router.replace({ path: i, query: { next: b.fullPath } });
359
1056
  return;
360
1057
  }
361
- if (i === "ready" && d.path === o) {
362
- const u = d.query.next;
363
- t.router.replace(typeof u == "string" ? u : "/");
1058
+ if (u === "ready" && b.path === i) {
1059
+ const h = b.query.next;
1060
+ s.router.replace(typeof h == "string" ? h : "/");
364
1061
  }
365
1062
  }
366
1063
  );
@@ -368,13 +1065,19 @@ function ye(e = {}) {
368
1065
  };
369
1066
  }
370
1067
  export {
371
- be as WxLoginCard,
372
- ge as WxUserMenu,
373
- ye as auth,
374
- O as authKey,
375
- _e as authMessages,
376
- de as createAuthSession,
377
- pe as provideAuth,
378
- R as useAuth
1068
+ Ae as WxAdminList,
1069
+ Qe as WxAdminsPage,
1070
+ Ke as WxLoginCard,
1071
+ ia as WxUserMenu,
1072
+ oa as admins,
1073
+ ra as auth,
1074
+ _e as authKey,
1075
+ Ve as authMessages,
1076
+ se as createAdminsApi,
1077
+ Oe as createAuthSession,
1078
+ Ee as provideAuth,
1079
+ na as selectAdmin,
1080
+ sa as selectAdmins,
1081
+ xe as useAuth
379
1082
  };
380
1083
  //# sourceMappingURL=index.js.map