@webx-ui/module-admin 0.12.2 → 0.13.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,64 +1,65 @@
1
- import { inject as te, reactive as oe, defineComponent as R, computed as x, openBlock as h, createBlock as w, unref as i, withModifiers as pe, withCtx as g, createElementBlock as k, Fragment as I, renderList as P, createCommentVNode as z, createVNode as _, createTextVNode as W, toDisplayString as C, useSlots as Le, useTemplateRef as ze, normalizeClass as H, renderSlot as L, createElementVNode as M, createSlots as ge, useModel as be, mergeModels as ie, mergeProps as We, watch as Y, resolveComponent as U, ref as A, watchEffect as Ae, onUnmounted as Re, isRef as Ee, createApp as Ue, h as G, onBeforeUnmount as Be, nextTick as Ie, withKeys as Me } from "vue";
2
- import { RouterLink as De, useRouter as we, useRoute as Ne, createRouter as Pe, createWebHistory as Ve } from "vue-router";
3
- import { WxAction as K, WxActions as Fe, WxDropdownItem as He, useElementWidth as Oe, WxHeading as je, WxText as q, WxButton as j, WxIcon as ye, WxTabs as qe, WxCard as me, WxRichText as Ye, WxResult as Ke, useResponsiveShell as Xe, shellLayoutFor as Ge, WxToaster as Je, WebxUI as Qe, dateLocaleKey as Ze, localesKey as et, WxAlert as tt, WxSkeleton as xe, WxBadge as nt, WxPopover as at, WxInput as lt, WxDialog as st, WxTooltip as ot, WxEmpty as it, WxAvatar as rt, WxTextarea as fe, toast as F, confirm as ut } from "@webx-ui/core";
4
- import { WxScreenRenderer as dt } from "@webx-ui/schema";
5
- const ne = /* @__PURE__ */ Symbol("webx-i18n");
6
- function Ln() {
7
- const e = te(ne, null);
1
+ import { inject as Y, reactive as ne, defineComponent as A, computed as y, openBlock as v, createBlock as x, unref as r, withModifiers as be, withCtx as g, createElementBlock as _, Fragment as U, renderList as F, createCommentVNode as L, createVNode as $, createTextVNode as z, toDisplayString as C, useSlots as Ee, useTemplateRef as Be, normalizeClass as K, renderSlot as W, createElementVNode as D, createSlots as ge, useModel as we, mergeModels as ie, mergeProps as Ie, watch as X, resolveComponent as B, ref as R, watchEffect as Ue, onUnmounted as De, isRef as Ne, createApp as Me, h as J, onBeforeUnmount as Fe, nextTick as Pe, withKeys as Ve } from "vue";
2
+ import { RouterLink as He, useRouter as ye, useRoute as Oe, createRouter as je, createWebHistory as Ke } from "vue-router";
3
+ import { WxAction as G, WxActions as qe, WxDropdownItem as Ye, useElementWidth as Xe, WxHeading as Ge, WxText as P, WxButton as q, WxIcon as xe, WxTabs as Je, WxCard as me, WxRichText as Qe, WxResult as Ze, useResponsiveShell as et, shellLayoutFor as tt, WxToaster as nt, WebxUI as at, dateLocaleKey as lt, localesKey as st, WxAlert as ke, WxSkeleton as _e, WxBadge as ot, WxPopover as it, WxInput as rt, WxDialog as ut, WxTooltip as ct, WxEmpty as dt, WxAvatar as mt, WxTextarea as fe, toast as j, confirm as ft } from "@webx-ui/core";
4
+ import { watchSystemTheme as vt, applyTheme as ht, systemTheme as pt } from "@webx-ui/tokens";
5
+ import { WxScreenRenderer as bt } from "@webx-ui/schema";
6
+ const ae = /* @__PURE__ */ Symbol("webx-i18n");
7
+ function Pn() {
8
+ const e = Y(ae, null);
8
9
  if (e === null)
9
10
  throw new Error("useI18n() was called outside a panel created by createAdmin().");
10
11
  return e;
11
12
  }
12
- function B(e) {
13
- const n = te(ne, null);
14
- return n === null ? de().scope(e) : n.scope(e);
13
+ function I(e) {
14
+ const n = Y(ae, null);
15
+ return n === null ? ce().scope(e) : n.scope(e);
15
16
  }
16
- function ct(e, n) {
17
- e.provide(ne, n);
17
+ function gt(e, n) {
18
+ e.provide(ae, n);
18
19
  }
19
- function de(e = {}) {
20
- const n = e.fallback ?? "en", t = oe({
20
+ function ce(e = {}) {
21
+ const n = e.fallback ?? "en", t = ne({
21
22
  locale: e.locale ?? n,
22
23
  fallback: n,
23
24
  panelLocales: [],
24
25
  contentLocales: []
25
- }), a = {}, u = oe({ value: {} });
26
- function s(o, r, m) {
27
- let v = o[r]?.[m[0] ?? ""];
28
- for (const f of m.slice(1)) {
29
- if (typeof v != "object" || v === null)
26
+ }), a = {}, o = ne({ value: {} });
27
+ function l(i, u, c) {
28
+ let f = i[u]?.[c[0] ?? ""];
29
+ for (const m of c.slice(1)) {
30
+ if (typeof f != "object" || f === null)
30
31
  return null;
31
- v = v[f];
32
+ f = f[m];
32
33
  }
33
- return typeof v == "string" ? v : null;
34
+ return typeof f == "string" ? f : null;
34
35
  }
35
- function l(o, r, m) {
36
- const [v, f] = r.includes("::") ? r.split("::", 2) : [o, r], d = f.split("."), p = s(u.value, v, d) ?? s(a, v, d) ?? // Not an empty string: a key on screen is ugly, but it says which key, and a blank
36
+ function s(i, u, c) {
37
+ const [f, m] = u.includes("::") ? u.split("::", 2) : [i, u], p = m.split("."), d = l(o.value, f, p) ?? l(a, f, p) ?? // Not an empty string: a key on screen is ugly, but it says which key, and a blank
37
38
  // label says nothing to anybody trying to fix it.
38
- r;
39
- return m === void 0 ? p : mt(p, m);
39
+ u;
40
+ return c === void 0 ? d : wt(d, c);
40
41
  }
41
42
  return {
42
43
  state: t,
43
- defaults(o, r) {
44
- a[o] = { ...a[o], ...r };
44
+ defaults(i, u) {
45
+ a[i] = { ...a[i], ...u };
45
46
  },
46
- load(o, r, m) {
47
- u.value = o ?? {}, t.locale = r ?? t.locale, m !== void 0 && (t.fallback = m);
47
+ load(i, u, c) {
48
+ o.value = i ?? {}, t.locale = u ?? t.locale, c !== void 0 && (t.fallback = c);
48
49
  },
49
- scope(o) {
50
- return (r, m) => l(o, r, m);
50
+ scope(i) {
51
+ return (u, c) => s(i, u, c);
51
52
  },
52
- t: (o, r) => l("", o, r)
53
+ t: (i, u) => s("", i, u)
53
54
  };
54
55
  }
55
- function mt(e, n) {
56
+ function wt(e, n) {
56
57
  let t = e;
57
- for (const [a, u] of Object.entries(n))
58
- t = t.replaceAll(`:${a}`, String(u));
58
+ for (const [a, o] of Object.entries(n))
59
+ t = t.replaceAll(`:${a}`, String(o));
59
60
  return t;
60
61
  }
61
- const ft = /* @__PURE__ */ R({
62
+ const yt = /* @__PURE__ */ A({
62
63
  __name: "BackButton",
63
64
  props: {
64
65
  to: {},
@@ -66,21 +67,21 @@ const ft = /* @__PURE__ */ R({
66
67
  size: { default: "sm" }
67
68
  },
68
69
  setup(e) {
69
- const n = e, t = B("webx-admin"), a = x(() => n.label ?? t("editor.back"));
70
- return (u, s) => (h(), w(i(K), {
70
+ const n = e, t = I("webx-admin"), a = y(() => n.label ?? t("editor.back"));
71
+ return (o, l) => (v(), x(r(G), {
71
72
  icon: "arrow-left",
72
73
  class: "wx-back-button",
73
- as: i(De),
74
+ as: r(He),
74
75
  to: e.to,
75
76
  title: a.value,
76
77
  size: e.size,
77
78
  "tooltip-side": "bottom"
78
79
  }, null, 8, ["as", "to", "title", "size"]));
79
80
  }
80
- }), vt = {
81
+ }), xt = {
81
82
  key: 0,
82
83
  class: "wx-dropdown__divider"
83
- }, ht = /* @__PURE__ */ R({
84
+ }, kt = /* @__PURE__ */ A({
84
85
  __name: "RowMenu",
85
86
  props: {
86
87
  actions: {},
@@ -88,65 +89,65 @@ const ft = /* @__PURE__ */ R({
88
89
  size: { default: "sm" }
89
90
  },
90
91
  setup(e) {
91
- const n = B("webx-admin"), t = e, a = x(() => [
92
- ...t.actions.filter((s) => !s.danger),
93
- ...t.actions.filter((s) => s.danger)
94
- ]), u = x(() => {
95
- const s = a.value.find((l) => l.danger);
96
- return s && a.value[0] !== s ? s.key : null;
92
+ const n = I("webx-admin"), t = e, a = y(() => [
93
+ ...t.actions.filter((l) => !l.danger),
94
+ ...t.actions.filter((l) => l.danger)
95
+ ]), o = y(() => {
96
+ const l = a.value.find((s) => s.danger);
97
+ return l && a.value[0] !== l ? l.key : null;
97
98
  });
98
- return (s, l) => a.value.length > 0 ? (h(), w(i(Fe), {
99
+ return (l, s) => a.value.length > 0 ? (v(), x(r(qe), {
99
100
  key: 0,
100
101
  class: "wx-row-menu",
101
102
  collapse: "always",
102
103
  align: "end",
103
104
  size: e.size,
104
105
  "aria-label": e.label,
105
- onClick: l[0] || (l[0] = pe(() => {
106
+ onClick: s[0] || (s[0] = be(() => {
106
107
  }, ["stop"]))
107
108
  }, {
108
109
  trigger: g(() => [
109
- _(i(K), {
110
+ $(r(G), {
110
111
  type: "more",
111
112
  size: e.size,
112
- title: i(n)("editor.more")
113
+ title: r(n)("editor.more")
113
114
  }, null, 8, ["size", "title"])
114
115
  ]),
115
116
  collapsed: g(() => [
116
- (h(!0), k(I, null, P(a.value, (o) => (h(), k(I, {
117
- key: o.key
117
+ (v(!0), _(U, null, F(a.value, (i) => (v(), _(U, {
118
+ key: i.key
118
119
  }, [
119
- o.key === u.value ? (h(), k("hr", vt)) : z("", !0),
120
- _(i(He), {
121
- icon: o.icon,
122
- tone: o.danger ? "danger" : "default",
123
- href: o.href,
124
- target: o.href ? o.target ?? "_blank" : void 0,
125
- disabled: o.disabled,
126
- onClick: (r) => o.run?.()
120
+ i.key === o.value ? (v(), _("hr", xt)) : L("", !0),
121
+ $(r(Ye), {
122
+ icon: i.icon,
123
+ tone: i.danger ? "danger" : "default",
124
+ href: i.href,
125
+ target: i.href ? i.target ?? "_blank" : void 0,
126
+ disabled: i.disabled,
127
+ onClick: (u) => i.run?.()
127
128
  }, {
128
129
  default: g(() => [
129
- W(C(o.label), 1)
130
+ z(C(i.label), 1)
130
131
  ]),
131
132
  _: 2
132
133
  }, 1032, ["icon", "tone", "href", "target", "disabled", "onClick"])
133
134
  ], 64))), 128))
134
135
  ]),
135
136
  _: 1
136
- }, 8, ["size", "aria-label"])) : z("", !0);
137
+ }, 8, ["size", "aria-label"])) : L("", !0);
137
138
  }
138
139
  }), N = (e, n) => {
139
140
  const t = e.__vccOpts || e;
140
- for (const [a, u] of n)
141
- t[a] = u;
141
+ for (const [a, o] of n)
142
+ t[a] = o;
142
143
  return t;
143
- }, ke = /* @__PURE__ */ N(ht, [["__scopeId", "data-v-cab01f7f"]]), pt = ["data-level"], gt = {
144
+ }, $e = /* @__PURE__ */ N(kt, [["__scopeId", "data-v-cab01f7f"]]), _t = ["data-level"], $t = {
144
145
  key: 0,
145
146
  class: "wx-screen-head__trail"
146
- }, bt = { class: "wx-screen-head__name" }, wt = {
147
+ }, Tt = { class: "wx-screen-head__name" }, St = {
147
148
  key: 4,
148
149
  class: "wx-screen-head__actions"
149
- }, yt = /* @__PURE__ */ R({
150
+ }, Ct = /* @__PURE__ */ A({
150
151
  __name: "ScreenHead",
151
152
  props: {
152
153
  title: { default: void 0 },
@@ -160,57 +161,57 @@ const ft = /* @__PURE__ */ R({
160
161
  },
161
162
  emits: ["back"],
162
163
  setup(e, { emit: n }) {
163
- const t = e, a = n, u = B("webx-admin"), s = Le(), l = ze("root"), o = Oe(l), r = x(() => o.value > 0 && o.value < t.collapseBelow), m = x(() => t.actions ?? []), v = x(
164
- () => m.value.find((c) => c.primary) ?? null
165
- ), f = x(() => r.value ? v.value ? [v.value] : [] : m.value.filter((c) => !c.menu && !c.danger)), d = x(() => r.value ? m.value.filter((c) => c !== v.value) : m.value.filter((c) => c.menu || c.danger)), p = x(
164
+ const t = e, a = n, o = I("webx-admin"), l = Ee(), s = Be("root"), i = Xe(s), u = y(() => i.value > 0 && i.value < t.collapseBelow), c = y(() => t.actions ?? []), f = y(
165
+ () => c.value.find((b) => b.primary) ?? null
166
+ ), m = y(() => u.value ? f.value ? [f.value] : [] : c.value.filter((b) => !b.menu && !b.danger)), p = y(() => u.value ? c.value.filter((b) => b !== f.value) : c.value.filter((b) => b.menu || b.danger)), d = y(
166
167
  () => t.back && t.back !== !0 ? t.back : null
167
- ), b = x(
168
- () => f.value.length > 0 || d.value.length > 0 || !!s.extra
168
+ ), k = y(
169
+ () => m.value.length > 0 || p.value.length > 0 || !!l.extra
169
170
  );
170
- return (c, y) => (h(), k("div", {
171
+ return (b, h) => (v(), _("div", {
171
172
  ref_key: "root",
172
- ref: l,
173
- class: H(["wx-screen-head", {
174
- "is-narrow": r.value,
175
- "has-button": f.value.length > 0,
176
- "has-trail": !!c.$slots.trail,
173
+ ref: s,
174
+ class: K(["wx-screen-head", {
175
+ "is-narrow": u.value,
176
+ "has-button": m.value.length > 0,
177
+ "has-trail": !!b.$slots.trail,
177
178
  "has-divider": e.divider
178
179
  }]),
179
180
  "data-level": e.level
180
181
  }, [
181
- c.$slots.trail ? (h(), k("div", gt, [
182
- L(c.$slots, "trail", {}, void 0, !0)
183
- ])) : z("", !0),
184
- p.value ? (h(), w(ft, {
182
+ b.$slots.trail ? (v(), _("div", $t, [
183
+ W(b.$slots, "trail", {}, void 0, !0)
184
+ ])) : L("", !0),
185
+ d.value ? (v(), x(yt, {
185
186
  key: 1,
186
187
  class: "wx-screen-head__back",
187
- to: p.value,
188
+ to: d.value,
188
189
  label: e.backLabel,
189
190
  "tooltip-side": "bottom"
190
- }, null, 8, ["to", "label"])) : e.back ? (h(), w(i(K), {
191
+ }, null, 8, ["to", "label"])) : e.back ? (v(), x(r(G), {
191
192
  key: 2,
192
193
  class: "wx-screen-head__back",
193
194
  icon: "arrow-left",
194
195
  size: "sm",
195
196
  "tooltip-side": "bottom",
196
- title: e.backLabel ?? i(u)("editor.back"),
197
- onClick: y[0] || (y[0] = ($) => a("back"))
198
- }, null, 8, ["title"])) : z("", !0),
199
- M("div", bt, [
200
- e.title ? (h(), w(i(je), {
197
+ title: e.backLabel ?? r(o)("editor.back"),
198
+ onClick: h[0] || (h[0] = (w) => a("back"))
199
+ }, null, 8, ["title"])) : L("", !0),
200
+ D("div", Tt, [
201
+ e.title ? (v(), x(r(Ge), {
201
202
  key: 0,
202
203
  level: e.level,
203
204
  truncate: "",
204
205
  class: "wx-screen-head__title"
205
206
  }, {
206
207
  default: g(() => [
207
- W(C(e.title), 1)
208
+ z(C(e.title), 1)
208
209
  ]),
209
210
  _: 1
210
- }, 8, ["level"])) : z("", !0),
211
- L(c.$slots, "title-after", {}, void 0, !0)
211
+ }, 8, ["level"])) : L("", !0),
212
+ W(b.$slots, "title-after", {}, void 0, !0)
212
213
  ]),
213
- e.subtitle || c.$slots.subtitle ? (h(), w(i(q), {
214
+ e.subtitle || b.$slots.subtitle ? (v(), x(r(P), {
214
215
  key: 3,
215
216
  class: "wx-screen-head__subtitle",
216
217
  size: "sm",
@@ -218,51 +219,51 @@ const ft = /* @__PURE__ */ R({
218
219
  truncate: ""
219
220
  }, {
220
221
  default: g(() => [
221
- L(c.$slots, "subtitle", {}, () => [
222
- W(C(e.subtitle), 1)
222
+ W(b.$slots, "subtitle", {}, () => [
223
+ z(C(e.subtitle), 1)
223
224
  ], !0)
224
225
  ]),
225
226
  _: 3
226
- })) : z("", !0),
227
- b.value ? (h(), k("div", wt, [
228
- L(c.$slots, "extra", {}, void 0, !0),
229
- (h(!0), k(I, null, P(f.value, ($) => (h(), w(i(j), {
230
- key: $.key,
231
- class: H(["wx-screen-head__button", { "is-primary": $.primary }]),
232
- type: $.primary ? "primary" : "default",
233
- variant: $.primary ? "solid" : $.variant ?? "outline",
234
- loading: $.loading,
235
- disabled: $.disabled,
236
- href: $.href,
237
- target: $.href ? $.target ?? "_blank" : void 0,
238
- rel: $.href ? "noopener" : void 0,
239
- onClick: (X) => $.run?.()
227
+ })) : L("", !0),
228
+ k.value ? (v(), _("div", St, [
229
+ W(b.$slots, "extra", {}, void 0, !0),
230
+ (v(!0), _(U, null, F(m.value, (w) => (v(), x(r(q), {
231
+ key: w.key,
232
+ class: K(["wx-screen-head__button", { "is-primary": w.primary }]),
233
+ type: w.primary ? "primary" : "default",
234
+ variant: w.primary ? "solid" : w.variant ?? "outline",
235
+ loading: w.loading,
236
+ disabled: w.disabled,
237
+ href: w.href,
238
+ target: w.href ? w.target ?? "_blank" : void 0,
239
+ rel: w.href ? "noopener" : void 0,
240
+ onClick: (H) => w.run?.()
240
241
  }, ge({
241
242
  default: g(() => [
242
- W(" " + C($.label), 1)
243
+ z(" " + C(w.label), 1)
243
244
  ]),
244
245
  _: 2
245
246
  }, [
246
- $.icon ? {
247
+ w.icon ? {
247
248
  name: "icon",
248
249
  fn: g(() => [
249
- _(i(ye), {
250
- name: $.icon
250
+ $(r(xe), {
251
+ name: w.icon
251
252
  }, null, 8, ["name"])
252
253
  ]),
253
254
  key: "0"
254
255
  } : void 0
255
256
  ]), 1032, ["class", "type", "variant", "loading", "disabled", "href", "target", "rel", "onClick"]))), 128)),
256
- d.value.length > 0 ? (h(), w(ke, {
257
+ p.value.length > 0 ? (v(), x($e, {
257
258
  key: 0,
258
- actions: d.value,
259
+ actions: p.value,
259
260
  size: "lg",
260
- label: e.title ?? i(u)("editor.more")
261
- }, null, 8, ["actions", "label"])) : z("", !0)
262
- ])) : z("", !0)
263
- ], 10, pt));
261
+ label: e.title ?? r(o)("editor.more")
262
+ }, null, 8, ["actions", "label"])) : L("", !0)
263
+ ])) : L("", !0)
264
+ ], 10, _t));
264
265
  }
265
- }), xt = /* @__PURE__ */ N(yt, [["__scopeId", "data-v-e27d184e"]]), kt = ["data-wx-fill"], _t = /* @__PURE__ */ R({
266
+ }), Lt = /* @__PURE__ */ N(Ct, [["__scopeId", "data-v-e27d184e"]]), zt = ["data-wx-fill"], Wt = /* @__PURE__ */ A({
266
267
  __name: "ListScreen",
267
268
  props: /* @__PURE__ */ ie({
268
269
  title: { default: void 0 },
@@ -281,12 +282,12 @@ const ft = /* @__PURE__ */ R({
281
282
  }),
282
283
  emits: ["update:view"],
283
284
  setup(e) {
284
- const n = be(e, "view");
285
- return (t, a) => (h(), k("div", {
286
- class: H(["wx-list-screen", { "is-fill": e.fill }]),
285
+ const n = we(e, "view");
286
+ return (t, a) => (v(), _("div", {
287
+ class: K(["wx-list-screen", { "is-fill": e.fill }]),
287
288
  "data-wx-fill": e.fill ? "" : void 0
288
289
  }, [
289
- e.title || e.actions || t.$slots.actions ? (h(), w(xt, {
290
+ e.title || e.actions || t.$slots.actions ? (v(), x(Lt, {
290
291
  key: 0,
291
292
  class: "wx-list-screen__head",
292
293
  title: e.title,
@@ -299,53 +300,53 @@ const ft = /* @__PURE__ */ R({
299
300
  t.$slots.actions ? {
300
301
  name: "extra",
301
302
  fn: g(() => [
302
- L(t.$slots, "actions", {}, void 0, !0)
303
+ W(t.$slots, "actions", {}, void 0, !0)
303
304
  ]),
304
305
  key: "0"
305
306
  } : void 0
306
- ]), 1032, ["title", "subtitle", "back", "back-label", "actions"])) : z("", !0),
307
- e.views && e.views.length > 0 ? (h(), w(i(qe), {
307
+ ]), 1032, ["title", "subtitle", "back", "back-label", "actions"])) : L("", !0),
308
+ e.views && e.views.length > 0 ? (v(), x(r(Je), {
308
309
  key: 1,
309
310
  modelValue: n.value,
310
- "onUpdate:modelValue": a[0] || (a[0] = (u) => n.value = u),
311
+ "onUpdate:modelValue": a[0] || (a[0] = (o) => n.value = o),
311
312
  class: "wx-list-screen__views",
312
313
  items: e.views,
313
314
  "collapse-below": e.collapseBelow,
314
315
  "aria-label": e.title
315
316
  }, {
316
317
  default: g(() => [
317
- e.card ? (h(), w(i(me), {
318
+ e.card ? (v(), x(r(me), {
318
319
  key: 0,
319
320
  class: "wx-list-screen__card",
320
321
  padding: e.padding
321
322
  }, {
322
323
  default: g(() => [
323
- L(t.$slots, "default", {}, void 0, !0)
324
+ W(t.$slots, "default", {}, void 0, !0)
324
325
  ]),
325
326
  _: 3
326
- }, 8, ["padding"])) : L(t.$slots, "default", {}, void 0, !0, 1)
327
+ }, 8, ["padding"])) : W(t.$slots, "default", {}, void 0, !0, 1)
327
328
  ]),
328
329
  _: 3
329
- }, 8, ["modelValue", "items", "collapse-below", "aria-label"])) : (h(), k(I, { key: 2 }, [
330
- e.card ? (h(), w(i(me), {
330
+ }, 8, ["modelValue", "items", "collapse-below", "aria-label"])) : (v(), _(U, { key: 2 }, [
331
+ e.card ? (v(), x(r(me), {
331
332
  key: 0,
332
333
  class: "wx-list-screen__card",
333
334
  padding: e.padding
334
335
  }, {
335
336
  default: g(() => [
336
- L(t.$slots, "default", {}, void 0, !0)
337
+ W(t.$slots, "default", {}, void 0, !0)
337
338
  ]),
338
339
  _: 3
339
- }, 8, ["padding"])) : L(t.$slots, "default", {}, void 0, !0, 1)
340
+ }, 8, ["padding"])) : W(t.$slots, "default", {}, void 0, !0, 1)
340
341
  ], 64))
341
- ], 10, kt));
342
+ ], 10, zt));
342
343
  }
343
- }), $t = /* @__PURE__ */ N(_t, [["__scopeId", "data-v-8c7e5ad1"]]), St = /* @__PURE__ */ R({
344
+ }), At = /* @__PURE__ */ N(Wt, [["__scopeId", "data-v-8c7e5ad1"]]), Rt = /* @__PURE__ */ A({
344
345
  name: "WxRichTextField",
345
346
  inheritAttrs: !1,
346
347
  __name: "RichTextField",
347
348
  setup(e) {
348
- const n = O(), t = B("webx-admin"), a = x(() => n.pickImage ?? void 0), u = x(() => ({
349
+ const n = V(), t = I("webx-admin"), a = y(() => n.pickImage ?? void 0), o = y(() => ({
349
350
  bold: t("rich-text.bold"),
350
351
  italic: t("rich-text.italic"),
351
352
  strike: t("rich-text.strike"),
@@ -378,108 +379,111 @@ const ft = /* @__PURE__ */ R({
378
379
  cancel: t("rich-text.cancel"),
379
380
  uploading: t("rich-text.uploading")
380
381
  }));
381
- return (s, l) => (h(), w(i(Ye), We(s.$attrs, {
382
- labels: u.value,
382
+ return (l, s) => (v(), x(r(Qe), Ie(l.$attrs, {
383
+ labels: o.value,
383
384
  "pick-image": a.value
384
385
  }), null, 16, ["labels", "pick-image"]));
385
386
  }
386
- }), Tt = {
387
- "wx-list": { component: $t, kind: "layout", labelProp: "title" },
387
+ }), Et = {
388
+ "wx-list": { component: At, kind: "layout", labelProp: "title" },
388
389
  // Full width: an editor shares a row with nothing, and a form of two columns would give it
389
390
  // half a line to write a page of text in.
390
- "wx-rich-text": { component: St, kind: "field", wide: !0 }
391
- }, _e = /* @__PURE__ */ Symbol("webx-admin");
392
- function O() {
393
- const e = te(_e, null);
391
+ "wx-rich-text": { component: Rt, kind: "field", wide: !0 }
392
+ }, Te = /* @__PURE__ */ Symbol("webx-admin");
393
+ function V() {
394
+ const e = Y(Te, null);
394
395
  if (e === null)
395
396
  throw new Error("useAdmin() was called outside a panel created by createAdmin().");
396
397
  return e;
397
398
  }
398
- function Ct(e) {
399
- const n = oe({
399
+ function Bt(e) {
400
+ const n = ne({
400
401
  status: "loading",
401
402
  manifest: null,
402
403
  user: null,
403
404
  error: null
404
- }), t = x(() => {
405
+ }), t = y(() => {
405
406
  const d = n.manifest;
406
407
  if (d === null)
407
408
  return [];
408
- const p = [];
409
+ const k = [];
409
410
  for (const b of d.modules) {
410
- const c = e.modules.find(($) => $.id === b.id);
411
- if (c === void 0)
411
+ const h = e.modules.find((H) => H.id === b.id);
412
+ if (h === void 0)
412
413
  continue;
413
- const y = c.path ?? c.routes?.[0]?.path;
414
- y !== void 0 && p.push({
414
+ const w = h.path ?? h.routes?.[0]?.path;
415
+ w !== void 0 && k.push({
415
416
  id: b.id,
416
417
  title: b.title,
417
418
  icon: b.icon,
418
- path: y,
419
+ path: w,
419
420
  group: b.group ?? null
420
421
  });
421
422
  }
422
- return p;
423
- }), a = x(() => {
424
- const d = n.manifest?.groups ?? [], p = [], b = /* @__PURE__ */ new Map();
425
- for (const c of t.value)
426
- if (c.group !== null && d.some((y) => y.id === c.group)) {
427
- const y = b.get(c.group) ?? [];
428
- y.push(c), b.set(c.group, y);
423
+ return k;
424
+ }), a = y(() => {
425
+ const d = n.manifest?.groups ?? [], k = [], b = /* @__PURE__ */ new Map();
426
+ for (const h of t.value)
427
+ if (h.group !== null && d.some((w) => w.id === h.group)) {
428
+ const w = b.get(h.group) ?? [];
429
+ w.push(h), b.set(h.group, w);
429
430
  } else
430
- p.push(c);
431
+ k.push(h);
431
432
  return {
432
- top: p,
433
- groups: d.filter((c) => b.has(c.id)).map((c) => ({
434
- id: c.id,
435
- title: c.title,
436
- icon: c.icon ?? null,
437
- entries: b.get(c.id) ?? []
433
+ top: k,
434
+ groups: d.filter((h) => b.has(h.id)).map((h) => ({
435
+ id: h.id,
436
+ title: h.title,
437
+ icon: h.icon ?? null,
438
+ entries: b.get(h.id) ?? []
438
439
  }))
439
440
  };
440
- }), u = { ...Tt };
441
+ }), o = { ...Et };
441
442
  for (const d of e.modules)
442
- Object.assign(u, d.types);
443
- Object.assign(u, e.types);
444
- const s = e.modules.find((d) => d.pickImage !== void 0)?.pickImage, l = /* @__PURE__ */ new Map();
445
- async function o(d) {
446
- const p = `${e.i18n.state.locale}:${d}`;
447
- let b = l.get(p);
448
- return b === void 0 && (b = e.http.get(`${e.apiPath}/screens/${d}`).then((c) => c.data.root).catch((c) => {
449
- throw l.delete(p), c;
450
- }), l.set(p, b)), b;
443
+ Object.assign(o, d.types);
444
+ Object.assign(o, e.types);
445
+ const l = e.modules.find((d) => d.pickImage !== void 0)?.pickImage, s = /* @__PURE__ */ new Map();
446
+ async function i(d) {
447
+ const k = `${e.i18n.state.locale}:${d}`;
448
+ let b = s.get(k);
449
+ return b === void 0 && (b = e.http.get(`${e.apiPath}/screens/${d}`).then((h) => h.data.root).catch((h) => {
450
+ throw s.delete(k), h;
451
+ }), s.set(k, b)), b;
451
452
  }
452
- let r = null;
453
- async function m() {
453
+ let u = null;
454
+ async function c() {
454
455
  n.status = "loading", n.error = null;
455
456
  try {
456
- if (r !== null && (n.user = await r(), n.user === null)) {
457
+ if (u !== null && (n.user = await u(), m(n.user), n.user === null)) {
457
458
  n.manifest = null, n.status = "unauthenticated";
458
459
  return;
459
460
  }
460
461
  const d = await e.loadManifest();
461
- n.manifest = d, e.i18n.state.contentLocales = d.locales ?? [], e.i18n.state.panelLocales = d.panelLocales ?? e.i18n.state.panelLocales, d.locale !== void 0 && d.locale !== e.i18n.state.locale && await f(d.locale), n.status = "ready";
462
+ n.manifest = d, e.i18n.state.contentLocales = d.locales ?? [], e.i18n.state.panelLocales = d.panelLocales ?? e.i18n.state.panelLocales, d.locale !== void 0 && d.locale !== e.i18n.state.locale && await p(d.locale), n.status = "ready";
462
463
  } catch (d) {
463
- if (zt(d)) {
464
+ if (Ut(d)) {
464
465
  n.manifest = null, n.user = null, n.status = "unauthenticated";
465
466
  return;
466
467
  }
467
468
  n.error = d instanceof Error ? d.message : String(d), n.status = "error";
468
469
  }
469
470
  }
470
- async function v() {
471
+ async function f() {
471
472
  if (n.manifest !== null)
472
473
  try {
473
474
  n.manifest = await e.loadManifest();
474
475
  } catch {
475
476
  }
476
477
  }
477
- async function f(d) {
478
+ function m(d) {
479
+ d !== null && e.theme?.adopt(d.theme);
480
+ }
481
+ async function p(d) {
478
482
  if (e.loadDictionary === void 0) {
479
483
  e.i18n.state.locale = d;
480
484
  return;
481
485
  }
482
- await e.loadDictionary(d), await v();
486
+ await e.loadDictionary(d), await f();
483
487
  }
484
488
  return {
485
489
  http: e.http,
@@ -490,98 +494,98 @@ function Ct(e) {
490
494
  modules: e.modules,
491
495
  nav: t,
492
496
  groups: a,
493
- types: u,
494
- pickImage: s ?? null,
495
- reload: m,
496
- refreshManifest: v,
497
- setLocale: f,
497
+ types: o,
498
+ pickImage: l ?? null,
499
+ reload: c,
500
+ refreshManifest: f,
501
+ setLocale: p,
498
502
  setUser(d) {
499
- n.user = d;
503
+ n.user = d, m(d);
500
504
  },
501
505
  useSessionLoader(d) {
502
- r = d;
506
+ u = d;
503
507
  },
504
508
  can(d) {
505
- const p = n.user;
506
- return p === null ? !1 : p.isSuper || p.permissions.includes(d);
509
+ const k = n.user;
510
+ return k === null ? !1 : k.isSuper || k.permissions.includes(d);
507
511
  },
508
- loadScreen: o,
512
+ loadScreen: i,
509
513
  screenPatch(d) {
510
514
  return e.screens?.[d] ?? [];
511
515
  }
512
516
  };
513
517
  }
514
- function Lt(e, n) {
515
- e.provide(_e, n);
518
+ function It(e, n) {
519
+ e.provide(Te, n);
516
520
  }
517
- function zt(e) {
521
+ function Ut(e) {
518
522
  return typeof e == "object" && e !== null && "status" in e && e.status === 401;
519
523
  }
520
- const Wt = /* @__PURE__ */ R({
524
+ const Dt = /* @__PURE__ */ A({
521
525
  __name: "AdminLanding",
522
526
  props: {
523
527
  landing: { default: null }
524
528
  },
525
529
  setup(e) {
526
- const n = e, t = O(), a = we(), u = B("webx-admin"), s = x(() => {
527
- const l = t.nav.value;
528
- return l.length === 0 ? null : ((n.landing === null ? void 0 : l.find((r) => r.path === n.landing)) ?? l[0])?.path ?? null;
530
+ const n = e, t = V(), a = ye(), o = I("webx-admin"), l = y(() => {
531
+ const s = t.nav.value;
532
+ return s.length === 0 ? null : ((n.landing === null ? void 0 : s.find((u) => u.path === n.landing)) ?? s[0])?.path ?? null;
529
533
  });
530
- return Y(
531
- s,
532
- (l) => {
533
- l !== null && a.replace(l);
534
+ return X(
535
+ l,
536
+ (s) => {
537
+ s !== null && a.replace(s);
534
538
  },
535
539
  { immediate: !0 }
536
- ), (l, o) => s.value === null && i(t).state.status === "ready" ? (h(), w(i(Ke), {
540
+ ), (s, i) => l.value === null && r(t).state.status === "ready" ? (v(), x(r(Ze), {
537
541
  key: 0,
538
542
  status: "info",
539
- title: i(u)("shell.empty-title"),
540
- description: i(u)("shell.empty-description")
541
- }, null, 8, ["title", "description"])) : z("", !0);
543
+ title: r(o)("shell.empty-title"),
544
+ description: r(o)("shell.empty-description")
545
+ }, null, 8, ["title", "description"])) : L("", !0);
542
546
  }
543
- }), At = /* @__PURE__ */ R({
547
+ }), Nt = /* @__PURE__ */ A({
544
548
  __name: "AdminNav",
545
549
  props: {
546
550
  collapsed: { type: Boolean }
547
551
  },
548
552
  emits: ["select"],
549
553
  setup(e, { emit: n }) {
550
- const t = n, a = O(), u = B("webx-admin"), s = we(), l = Ne(), o = x({
551
- get: () => a.nav.value.find((m) => l.path.startsWith(m.path))?.id ?? "",
552
- set: (r) => {
553
- const m = a.nav.value.find((v) => v.id === r);
554
- m !== void 0 && s.push(m.path);
554
+ const t = n, a = V(), o = I("webx-admin"), l = ye(), s = Oe(), i = y({
555
+ get: () => a.nav.value.find((c) => s.path.startsWith(c.path))?.id ?? "",
556
+ set: (u) => {
557
+ const c = a.nav.value.find((f) => f.id === u);
558
+ c !== void 0 && l.push(c.path);
555
559
  }
556
560
  });
557
- return (r, m) => {
558
- const v = U("wx-menu-item"), f = U("wx-submenu"), d = U("wx-menu");
559
- return h(), w(d, {
560
- modelValue: o.value,
561
- "onUpdate:modelValue": m[0] || (m[0] = (p) => o.value = p),
561
+ return (u, c) => {
562
+ const f = B("wx-menu-item"), m = B("wx-submenu"), p = B("wx-menu");
563
+ return v(), x(p, {
564
+ modelValue: i.value,
565
+ "onUpdate:modelValue": c[0] || (c[0] = (d) => i.value = d),
562
566
  collapsed: e.collapsed,
563
- label: i(u)("nav.sections"),
564
- onSelect: m[1] || (m[1] = (p) => t("select"))
567
+ label: r(o)("nav.sections"),
568
+ onSelect: c[1] || (c[1] = (d) => t("select"))
565
569
  }, {
566
570
  default: g(() => [
567
- (h(!0), k(I, null, P(i(a).groups.value.top, (p) => (h(), w(v, {
568
- key: p.id,
569
- value: p.id,
570
- icon: p.icon ?? void 0,
571
- label: p.title
571
+ (v(!0), _(U, null, F(r(a).groups.value.top, (d) => (v(), x(f, {
572
+ key: d.id,
573
+ value: d.id,
574
+ icon: d.icon ?? void 0,
575
+ label: d.title
572
576
  }, null, 8, ["value", "icon", "label"]))), 128)),
573
- (h(!0), k(I, null, P(i(a).groups.value.groups, (p) => (h(), w(f, {
574
- key: p.id,
575
- value: `group:${p.id}`,
576
- title: p.title,
577
- icon: p.icon ?? "gear"
577
+ (v(!0), _(U, null, F(r(a).groups.value.groups, (d) => (v(), x(m, {
578
+ key: d.id,
579
+ value: `group:${d.id}`,
580
+ title: d.title,
581
+ icon: d.icon ?? "gear"
578
582
  }, {
579
583
  default: g(() => [
580
- (h(!0), k(I, null, P(p.entries, (b) => (h(), w(v, {
581
- key: b.id,
582
- value: b.id,
583
- icon: b.icon ?? void 0,
584
- label: b.title
584
+ (v(!0), _(U, null, F(d.entries, (k) => (v(), x(f, {
585
+ key: k.id,
586
+ value: k.id,
587
+ icon: k.icon ?? void 0,
588
+ label: k.title
585
589
  }, null, 8, ["value", "icon", "label"]))), 128))
586
590
  ]),
587
591
  _: 2
@@ -591,68 +595,68 @@ const Wt = /* @__PURE__ */ R({
591
595
  }, 8, ["modelValue", "collapsed", "label"]);
592
596
  };
593
597
  }
594
- }), Rt = {
598
+ }), Mt = {
595
599
  key: 0,
596
600
  class: "wx-root wx-admin-plain"
597
- }, Et = {
601
+ }, Ft = {
598
602
  key: 1,
599
603
  class: "wx-root wx-admin-plain"
600
- }, Ut = {
604
+ }, Pt = {
601
605
  key: 2,
602
606
  class: "wx-root wx-admin-plain"
603
- }, Bt = ["src", "alt", "width", "height"], It = ["src", "alt", "width", "height"], Mt = ["src", "alt"], Dt = { class: "wx-admin__user" }, Nt = { class: "wx-admin__user wx-admin__user--drawer" }, Pt = /* @__PURE__ */ R({
607
+ }, Vt = ["src", "alt", "width", "height"], Ht = ["src", "alt", "width", "height"], Ot = ["src", "alt"], jt = { class: "wx-admin__user" }, Kt = { class: "wx-admin__user wx-admin__user--drawer" }, qt = /* @__PURE__ */ A({
604
608
  __name: "AdminShell",
605
609
  setup(e) {
606
- const n = O(), t = B("webx-admin"), a = A(null), { width: u, layout: s, collapsed: l, showAside: o, drawerOpen: r, toggle: m, close: v } = Xe(
610
+ const n = V(), t = I("webx-admin"), a = R(null), { width: o, layout: l, collapsed: s, showAside: i, drawerOpen: u, toggle: c, close: f } = et(
607
611
  a,
608
612
  { persist: "webx-admin-shell" }
609
- ), f = x(() => n.state.manifest?.title ?? ""), d = x(() => n.state.manifest?.branding?.logo ?? null), p = x(() => n.state.manifest?.branding?.mark ?? null), b = x(() => Ge(u.value, null));
610
- return Ae(() => {
611
- typeof document > "u" || (document.documentElement.dataset.wxShell = b.value);
612
- }), Re(() => {
613
+ ), m = y(() => n.state.manifest?.title ?? ""), p = y(() => n.state.manifest?.branding?.logo ?? null), d = y(() => n.state.manifest?.branding?.mark ?? null), k = y(() => tt(o.value, null));
614
+ return Ue(() => {
615
+ typeof document > "u" || (document.documentElement.dataset.wxShell = k.value);
616
+ }), De(() => {
613
617
  typeof document < "u" && delete document.documentElement.dataset.wxShell;
614
- }), (c, y) => {
615
- const $ = U("router-view"), X = U("wx-loading"), ae = U("wx-button"), le = U("wx-result"), V = U("wx-action"), S = U("wx-text"), E = U("wx-header"), T = U("wx-aside"), D = U("wx-main"), Te = U("wx-container"), Ce = U("wx-drawer");
616
- return h(), k(I, null, [
617
- _(i(Je)),
618
- i(n).state.status === "unauthenticated" ? (h(), k("div", Rt, [
619
- _($)
620
- ])) : i(n).state.status === "loading" ? (h(), k("div", Et, [
621
- _(X, {
622
- label: i(t)("shell.loading")
618
+ }), (b, h) => {
619
+ const w = B("router-view"), H = B("wx-loading"), le = B("wx-button"), se = B("wx-result"), O = B("wx-action"), T = B("wx-text"), E = B("wx-header"), S = B("wx-aside"), M = B("wx-main"), Ae = B("wx-container"), Re = B("wx-drawer");
620
+ return v(), _(U, null, [
621
+ $(r(nt)),
622
+ r(n).state.status === "unauthenticated" ? (v(), _("div", Mt, [
623
+ $(w)
624
+ ])) : r(n).state.status === "loading" ? (v(), _("div", Ft, [
625
+ $(H, {
626
+ label: r(t)("shell.loading")
623
627
  }, null, 8, ["label"])
624
- ])) : i(n).state.status === "error" ? (h(), k("div", Ut, [
625
- _(le, {
628
+ ])) : r(n).state.status === "error" ? (v(), _("div", Pt, [
629
+ $(se, {
626
630
  status: "error",
627
- title: i(t)("shell.error-title"),
628
- description: i(n).state.error
631
+ title: r(t)("shell.error-title"),
632
+ description: r(n).state.error
629
633
  }, {
630
634
  default: g(() => [
631
- _(ae, {
635
+ $(le, {
632
636
  type: "primary",
633
- onClick: y[0] || (y[0] = (ce) => i(n).reload())
637
+ onClick: h[0] || (h[0] = (de) => r(n).reload())
634
638
  }, {
635
639
  default: g(() => [
636
- W(C(i(t)("shell.retry")), 1)
640
+ z(C(r(t)("shell.retry")), 1)
637
641
  ]),
638
642
  _: 1
639
643
  })
640
644
  ]),
641
645
  _: 1
642
646
  }, 8, ["title", "description"])
643
- ])) : (h(), k("div", {
647
+ ])) : (v(), _("div", {
644
648
  key: 3,
645
649
  ref_key: "shellEl",
646
650
  ref: a,
647
- class: H(["wx-root wx-admin", `wx-admin--${b.value}`])
651
+ class: K(["wx-root wx-admin", `wx-admin--${k.value}`])
648
652
  }, [
649
- _(Te, {
650
- direction: i(s) === "drawer" ? "vertical" : "horizontal",
653
+ $(Ae, {
654
+ direction: r(l) === "drawer" ? "vertical" : "horizontal",
651
655
  "full-height": "",
652
656
  class: "wx-admin__frame"
653
657
  }, {
654
658
  default: g(() => [
655
- i(s) === "drawer" ? (h(), w(E, {
659
+ r(l) === "drawer" ? (v(), x(E, {
656
660
  key: 0,
657
661
  class: "wx-admin__header",
658
662
  floating: "",
@@ -662,126 +666,126 @@ const Wt = /* @__PURE__ */ R({
662
666
  height: "var(--wx-admin-header-height)"
663
667
  }, {
664
668
  end: g(() => [
665
- L(c.$slots, "user", { expanded: !1 }, void 0, !0)
669
+ W(b.$slots, "user", { expanded: !1 }, void 0, !0)
666
670
  ]),
667
671
  default: g(() => [
668
- _(V, {
672
+ $(O, {
669
673
  icon: "menu",
670
- title: i(t)("nav.menu"),
671
- onClick: i(m)
674
+ title: r(t)("nav.menu"),
675
+ onClick: r(c)
672
676
  }, null, 8, ["title", "onClick"]),
673
- L(c.$slots, "brand", {}, () => [
674
- d.value ? (h(), k("img", {
677
+ W(b.$slots, "brand", {}, () => [
678
+ p.value ? (v(), _("img", {
675
679
  key: 0,
676
680
  class: "wx-admin__logo",
677
- src: d.value.url,
678
- alt: f.value,
679
- width: d.value.width ?? void 0,
680
- height: d.value.height ?? void 0
681
- }, null, 8, Bt)) : (h(), w(S, {
681
+ src: p.value.url,
682
+ alt: m.value,
683
+ width: p.value.width ?? void 0,
684
+ height: p.value.height ?? void 0
685
+ }, null, 8, Vt)) : (v(), x(T, {
682
686
  key: 1,
683
687
  weight: "semibold",
684
688
  truncate: ""
685
689
  }, {
686
690
  default: g(() => [
687
- W(C(f.value), 1)
691
+ z(C(m.value), 1)
688
692
  ]),
689
693
  _: 1
690
694
  }))
691
695
  ], !0)
692
696
  ]),
693
697
  _: 3
694
- })) : z("", !0),
695
- i(o) ? (h(), w(T, {
698
+ })) : L("", !0),
699
+ r(i) ? (v(), x(S, {
696
700
  key: 1,
697
701
  class: "wx-admin__aside",
698
702
  sticky: "",
699
703
  floating: "",
700
704
  scroll: "",
701
705
  bordered: !1,
702
- collapsed: i(l),
706
+ collapsed: r(s),
703
707
  width: 220,
704
708
  "collapsed-width": 56
705
709
  }, {
706
710
  top: g(() => [
707
- M("div", {
708
- class: H(["wx-admin__brand", { "wx-admin__brand--stacked": i(l) && p.value }])
711
+ D("div", {
712
+ class: K(["wx-admin__brand", { "wx-admin__brand--stacked": r(s) && d.value }])
709
713
  }, [
710
- i(l) ? p.value ? (h(), k("img", {
714
+ r(s) ? d.value ? (v(), _("img", {
711
715
  key: 1,
712
716
  class: "wx-admin__mark",
713
- src: p.value.url,
714
- alt: f.value
715
- }, null, 8, Mt)) : z("", !0) : L(c.$slots, "brand", {}, () => [
716
- d.value ? (h(), k("img", {
717
+ src: d.value.url,
718
+ alt: m.value
719
+ }, null, 8, Ot)) : L("", !0) : W(b.$slots, "brand", {}, () => [
720
+ p.value ? (v(), _("img", {
717
721
  key: 0,
718
722
  class: "wx-admin__logo",
719
- src: d.value.url,
720
- alt: f.value,
721
- width: d.value.width ?? void 0,
722
- height: d.value.height ?? void 0
723
- }, null, 8, It)) : (h(), w(S, {
723
+ src: p.value.url,
724
+ alt: m.value,
725
+ width: p.value.width ?? void 0,
726
+ height: p.value.height ?? void 0
727
+ }, null, 8, Ht)) : (v(), x(T, {
724
728
  key: 1,
725
729
  weight: "semibold",
726
730
  truncate: "",
727
731
  class: "wx-admin__title"
728
732
  }, {
729
733
  default: g(() => [
730
- W(C(f.value), 1)
734
+ z(C(m.value), 1)
731
735
  ]),
732
736
  _: 1
733
737
  }))
734
738
  ], !0, 0),
735
- _(V, {
739
+ $(O, {
736
740
  icon: "sidebar",
737
- title: i(l) ? i(t)("nav.expand") : i(t)("nav.collapse"),
738
- onClick: i(m)
741
+ title: r(s) ? r(t)("nav.expand") : r(t)("nav.collapse"),
742
+ onClick: r(c)
739
743
  }, null, 8, ["title", "onClick"])
740
744
  ], 2)
741
745
  ]),
742
746
  bottom: g(() => [
743
- M("div", Dt, [
744
- L(c.$slots, "user", {
745
- expanded: !i(l)
747
+ D("div", jt, [
748
+ W(b.$slots, "user", {
749
+ expanded: !r(s)
746
750
  }, void 0, !0)
747
751
  ])
748
752
  ]),
749
753
  default: g(() => [
750
- L(c.$slots, "nav", { collapsed: i(l) }, void 0, !0)
754
+ W(b.$slots, "nav", { collapsed: r(s) }, void 0, !0)
751
755
  ]),
752
756
  _: 3
753
- }, 8, ["collapsed"])) : z("", !0),
754
- _(D, {
757
+ }, 8, ["collapsed"])) : L("", !0),
758
+ $(M, {
755
759
  padding: "none",
756
760
  class: "wx-admin__screen"
757
761
  }, {
758
762
  default: g(() => [
759
- _($)
763
+ $(w)
760
764
  ]),
761
765
  _: 1
762
766
  })
763
767
  ]),
764
768
  _: 3
765
769
  }, 8, ["direction"]),
766
- _(Ce, {
767
- open: i(r),
768
- "onUpdate:open": y[1] || (y[1] = (ce) => Ee(r) ? r.value = ce : null),
770
+ $(Re, {
771
+ open: r(u),
772
+ "onUpdate:open": h[1] || (h[1] = (de) => Ne(u) ? u.value = de : null),
769
773
  class: "wx-admin__drawer",
770
- title: f.value === "" ? i(t)("nav.menu") : f.value,
774
+ title: m.value === "" ? r(t)("nav.menu") : m.value,
771
775
  side: "left",
772
776
  size: 260,
773
777
  "full-screen": !1,
774
778
  closable: ""
775
779
  }, {
776
780
  footer: g(() => [
777
- M("div", Nt, [
778
- L(c.$slots, "user", { expanded: !0 }, void 0, !0)
781
+ D("div", Kt, [
782
+ W(b.$slots, "user", { expanded: !0 }, void 0, !0)
779
783
  ])
780
784
  ]),
781
785
  default: g(() => [
782
- L(c.$slots, "nav", {
786
+ W(b.$slots, "nav", {
783
787
  collapsed: !1,
784
- select: i(v)
788
+ select: r(f)
785
789
  }, void 0, !0)
786
790
  ]),
787
791
  _: 3
@@ -790,10 +794,10 @@ const Wt = /* @__PURE__ */ R({
790
794
  ], 64);
791
795
  };
792
796
  }
793
- }), Vt = /* @__PURE__ */ N(Pt, [["__scopeId", "data-v-309fdb9d"]]);
797
+ }), Yt = /* @__PURE__ */ N(qt, [["__scopeId", "data-v-309fdb9d"]]);
794
798
  class re extends Error {
795
- constructor(n, t, a = {}, u = null, s = null) {
796
- super(n), this.status = t, this.errors = a, this.retryAfter = u, this.body = s, this.name = "HttpError";
799
+ constructor(n, t, a = {}, o = null, l = null) {
800
+ super(n), this.status = t, this.errors = a, this.retryAfter = o, this.body = l, this.name = "HttpError";
797
801
  }
798
802
  status;
799
803
  errors;
@@ -810,74 +814,74 @@ class re extends Error {
810
814
  return this.status === 429;
811
815
  }
812
816
  }
813
- const Ft = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
814
- function Ht(e = {}) {
815
- const n = (e.baseUrl ?? "").replace(/\/$/, ""), t = e.csrfUrl ?? "/sanctum/csrf-cookie", a = e.fetch ?? globalThis.fetch.bind(globalThis), u = e.onUnauthenticated, s = e.headers;
816
- let l = !1;
817
- async function o(m = !1) {
818
- l && !m && ve("XSRF-TOKEN") !== null || (await a(t, { credentials: "same-origin" }), l = !0);
817
+ const Xt = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
818
+ function Gt(e = {}) {
819
+ const n = (e.baseUrl ?? "").replace(/\/$/, ""), t = e.csrfUrl ?? "/api/cms/auth/csrf-cookie", a = e.fetch ?? globalThis.fetch.bind(globalThis), o = e.onUnauthenticated, l = e.headers;
820
+ let s = !1;
821
+ async function i(c = !1) {
822
+ s && !c && ve("XSRF-TOKEN") !== null || (await a(t, { credentials: "same-origin" }), s = !0);
819
823
  }
820
- async function r(m, v, f, d = {}, p = !1) {
821
- const b = Ft.has(m);
822
- b && await o();
823
- const c = {
824
+ async function u(c, f, m, p = {}, d = !1) {
825
+ const k = Xt.has(c);
826
+ k && await i();
827
+ const b = {
824
828
  Accept: "application/json",
825
829
  "X-Requested-With": "XMLHttpRequest",
826
830
  // Standing headers first, so a caller can still override one for a single request.
827
- ...s?.(),
828
- ...d.headers
831
+ ...l?.(),
832
+ ...p.headers
829
833
  };
830
- if (b) {
831
- const $ = ve("XSRF-TOKEN");
832
- $ !== null && (c["X-XSRF-TOKEN"] = $);
834
+ if (k) {
835
+ const w = ve("XSRF-TOKEN");
836
+ w !== null && (b["X-XSRF-TOKEN"] = w);
833
837
  }
834
- f !== void 0 && (c["Content-Type"] = "application/json");
835
- const y = await a(jt(n, v, d.query), {
836
- method: m,
838
+ m !== void 0 && (b["Content-Type"] = "application/json");
839
+ const h = await a(Qt(n, f, p.query), {
840
+ method: c,
837
841
  credentials: "same-origin",
838
- headers: c,
839
- signal: d.signal,
840
- body: f === void 0 ? void 0 : JSON.stringify(f)
842
+ headers: b,
843
+ signal: p.signal,
844
+ body: m === void 0 ? void 0 : JSON.stringify(m)
841
845
  });
842
- if (y.status === 419 && b && !p)
843
- return await o(!0), r(m, v, f, d, !0);
844
- if (y.status === 401 && u?.(), !y.ok)
845
- throw await Ot(y);
846
- if (y.status !== 204)
847
- return await y.json();
846
+ if (h.status === 419 && k && !d)
847
+ return await i(!0), u(c, f, m, p, !0);
848
+ if (h.status === 401 && o?.(), !h.ok)
849
+ throw await Jt(h);
850
+ if (h.status !== 204)
851
+ return await h.json();
848
852
  }
849
853
  return {
850
- get: (m, v) => r("GET", m, void 0, v),
851
- post: (m, v, f) => r("POST", m, v, f),
852
- put: (m, v, f) => r("PUT", m, v, f),
853
- patch: (m, v, f) => r("PATCH", m, v, f),
854
- delete: (m, v) => r("DELETE", m, void 0, v)
854
+ get: (c, f) => u("GET", c, void 0, f),
855
+ post: (c, f, m) => u("POST", c, f, m),
856
+ put: (c, f, m) => u("PUT", c, f, m),
857
+ patch: (c, f, m) => u("PATCH", c, f, m),
858
+ delete: (c, f) => u("DELETE", c, void 0, f)
855
859
  };
856
860
  }
857
- async function Ot(e) {
861
+ async function Jt(e) {
858
862
  let n = null;
859
863
  try {
860
864
  n = await e.json();
861
865
  } catch {
862
866
  }
863
- const t = n ?? {}, a = typeof t.message == "string" && t.message !== "" ? t.message : e.statusText || `Request failed with ${e.status}`, u = t.errors !== null && typeof t.errors == "object" ? t.errors : {}, s = e.headers.get("Retry-After"), l = s === null ? null : Number.parseInt(s, 10);
867
+ const t = n ?? {}, a = typeof t.message == "string" && t.message !== "" ? t.message : e.statusText || `Request failed with ${e.status}`, o = t.errors !== null && typeof t.errors == "object" ? t.errors : {}, l = e.headers.get("Retry-After"), s = l === null ? null : Number.parseInt(l, 10);
864
868
  return new re(
865
869
  a,
866
870
  e.status,
867
- u,
868
- Number.isFinite(l) ? l : null,
871
+ o,
872
+ Number.isFinite(s) ? s : null,
869
873
  n
870
874
  );
871
875
  }
872
- function jt(e, n, t) {
873
- const u = /^https?:\/\//i.test(n) ? n : `${e}/${n.replace(/^\//, "")}`;
876
+ function Qt(e, n, t) {
877
+ const o = /^https?:\/\//i.test(n) ? n : `${e}/${n.replace(/^\//, "")}`;
874
878
  if (t === void 0)
875
- return u;
876
- const s = new URLSearchParams();
877
- for (const [o, r] of Object.entries(t))
878
- r != null && s.set(o, String(r));
879
- const l = s.toString();
880
- return l === "" ? u : `${u}${u.includes("?") ? "&" : "?"}${l}`;
879
+ return o;
880
+ const l = new URLSearchParams();
881
+ for (const [i, u] of Object.entries(t))
882
+ u != null && l.set(i, String(u));
883
+ const s = l.toString();
884
+ return s === "" ? o : `${o}${o.includes("?") ? "&" : "?"}${s}`;
881
885
  }
882
886
  function ve(e) {
883
887
  if (typeof document > "u")
@@ -889,7 +893,57 @@ function ve(e) {
889
893
  }
890
894
  return null;
891
895
  }
892
- const $e = {
896
+ const Zt = "webx.theme", Se = /* @__PURE__ */ Symbol("webx-theme");
897
+ function Vn() {
898
+ const e = Y(Se, null);
899
+ if (e === null)
900
+ throw new Error("useTheme() was called outside a panel created by createAdmin().");
901
+ return e;
902
+ }
903
+ function en(e, n) {
904
+ e.provide(Se, n);
905
+ }
906
+ function tn(e = {}) {
907
+ const n = e.storageKey === void 0 ? Zt : e.storageKey, t = ne({
908
+ preference: nn(n) ?? "system",
909
+ resolved: "light"
910
+ });
911
+ function a() {
912
+ ht(t.preference), t.resolved = t.preference === "system" ? pt() : t.preference;
913
+ }
914
+ return a(), vt((o) => {
915
+ t.preference === "system" && (t.resolved = o);
916
+ }), {
917
+ state: t,
918
+ set(o) {
919
+ t.preference = o, a(), he(n, o);
920
+ },
921
+ adopt(o) {
922
+ if (o === void 0)
923
+ return;
924
+ const l = o ?? "system";
925
+ l !== t.preference && (t.preference = l, a(), he(n, l));
926
+ }
927
+ };
928
+ }
929
+ function he(e, n) {
930
+ if (e !== null)
931
+ try {
932
+ localStorage.setItem(e, n);
933
+ } catch {
934
+ }
935
+ }
936
+ function nn(e) {
937
+ if (e === null)
938
+ return null;
939
+ try {
940
+ const n = localStorage.getItem(e);
941
+ return n === "light" || n === "dark" || n === "system" ? n : null;
942
+ } catch {
943
+ return null;
944
+ }
945
+ }
946
+ const Ce = {
893
947
  shell: {
894
948
  loading: "Loading the panel…",
895
949
  "error-title": "The panel could not start",
@@ -906,6 +960,15 @@ const $e = {
906
960
  // The one menu group the panel names itself; a module's own group is named by the module.
907
961
  system: "System"
908
962
  },
963
+ // The three words on the theme switch. They belong to the panel rather than to whoever
964
+ // places the switch: a core component ships English prop defaults and knows nothing about
965
+ // a dictionary, so the panel is the one that has to say them.
966
+ theme: {
967
+ label: "Theme",
968
+ light: "Light",
969
+ dark: "Dark",
970
+ system: "Follow the system"
971
+ },
909
972
  // What a screen that edits one record offers whatever the record is: the way out of it, and
910
973
  // the way to rename it. A module that opens an editor should not be inventing these.
911
974
  editor: {
@@ -939,6 +1002,14 @@ const $e = {
939
1002
  // whether the panel failed to load it.
940
1003
  never: "never"
941
1004
  },
1005
+ // The one line the panel says about the nightly database dump. It lives at the foot of the
1006
+ // settings screen, and the warning is the whole point of it: a backup whose breakage is
1007
+ // discovered on the day it was needed is not a backup.
1008
+ backup: {
1009
+ title: "Last database snapshot:",
1010
+ stale: "No database snapshot since :date. Check the schedule.",
1011
+ never: "The database has never been backed up. Check the schedule."
1012
+ },
942
1013
  // How a request fails, in the panel's words rather than the server's (§13.3). `errors.ts`
943
1014
  // decides which of these a status gets.
944
1015
  errors: {
@@ -1010,200 +1081,203 @@ const $e = {
1010
1081
  forbidden: "You may not read the notes of this record.",
1011
1082
  "not-yours": "A note is edited by whoever wrote it."
1012
1083
  }
1013
- }, Se = "webx.locale";
1014
- function zn(e = {}) {
1015
- const n = e.manifestUrl ?? Jt() ?? "/api/cms/manifest", t = e.apiPath ?? n.replace(/\/manifest\/?$/, ""), a = e.basePath ?? "/cms", u = e.modules ?? [], s = [...e.routes ?? []];
1016
- for (const c of u)
1017
- s.push(...c.routes ?? []);
1018
- if (!s.some((c) => c.path === "/")) {
1019
- const c = u.find((y) => y.landing === !0);
1020
- s.push({
1084
+ }, Le = "webx.locale";
1085
+ function Hn(e = {}) {
1086
+ const n = e.manifestUrl ?? un() ?? "/api/cms/manifest", t = e.apiPath ?? n.replace(/\/manifest\/?$/, ""), a = e.basePath ?? "/cms", o = e.modules ?? [], l = [...e.routes ?? []];
1087
+ for (const h of o)
1088
+ l.push(...h.routes ?? []);
1089
+ if (!l.some((h) => h.path === "/")) {
1090
+ const h = o.find((w) => w.landing === !0);
1091
+ l.push({
1021
1092
  path: "/",
1022
1093
  name: "webx.home",
1023
- component: Wt,
1024
- props: { landing: c?.path ?? c?.routes?.[0]?.path ?? null }
1094
+ component: Dt,
1095
+ props: { landing: h?.path ?? h?.routes?.[0]?.path ?? null }
1025
1096
  });
1026
1097
  }
1027
- const l = Pe({
1028
- history: Ve(a),
1029
- routes: s
1030
- }), o = de({ locale: e.locale ?? Yt() }), r = e.http ?? Ht({
1098
+ const s = je({
1099
+ history: Ke(a),
1100
+ routes: l
1101
+ }), i = ce({ locale: e.locale ?? ln() }), u = tn(), c = e.http ?? Gt({
1031
1102
  baseUrl: "",
1103
+ csrfUrl: `${t}/auth/csrf-cookie`,
1032
1104
  onUnauthenticated: () => {
1033
- v.setUser(null), v.state.status = "unauthenticated";
1105
+ m.setUser(null), m.state.status = "unauthenticated";
1034
1106
  },
1035
1107
  // Every request says which language the panel is currently showing. It decides what
1036
1108
  // the server writes its own messages in — a 422 under a field — for anybody who has
1037
1109
  // not stored a preference yet, which is everybody until they choose one. Without it,
1038
1110
  // signing in on a Russian sign-in screen lands in an English panel.
1039
- headers: () => ({ "X-Webx-Locale": o.state.locale })
1111
+ headers: () => ({ "X-Webx-Locale": i.state.locale })
1040
1112
  });
1041
- o.defaults("webx-admin", $e);
1042
- async function m(c) {
1043
- const y = await r.get(`${t}/translations/${c}`);
1044
- o.load(y.data.namespaces, y.data.locale, y.data.fallback), Kt(y.data.locale), Gt(y.data.locale, o.state.panelLocales);
1113
+ i.defaults("webx-admin", Ce);
1114
+ async function f(h) {
1115
+ const w = await c.get(`${t}/translations/${h}`);
1116
+ i.load(w.data.namespaces, w.data.locale, w.data.fallback), sn(w.data.locale), rn(w.data.locale, i.state.panelLocales);
1045
1117
  }
1046
- const v = Ct({
1047
- http: r,
1118
+ const m = Bt({
1119
+ http: c,
1120
+ theme: u,
1048
1121
  basePath: a,
1049
1122
  apiPath: t,
1050
- modules: u,
1051
- i18n: o,
1052
- loadDictionary: m,
1123
+ modules: o,
1124
+ i18n: i,
1125
+ loadDictionary: f,
1053
1126
  types: e.types,
1054
1127
  screens: e.screens,
1055
- loadManifest: async () => (await r.get(n)).data
1056
- }), f = Ue(qt(e));
1057
- f.use(Qe), Lt(f, v), ct(f, o);
1058
- const d = A("");
1059
- f.provide(
1060
- Ze,
1061
- x(() => o.state.locale)
1062
- ), f.provide(et, {
1063
- list: x(
1064
- () => o.state.contentLocales.map((c) => ({
1065
- code: c.code,
1066
- label: c.code.toUpperCase()
1128
+ loadManifest: async () => (await c.get(n)).data
1129
+ }), p = Me(an(e));
1130
+ p.use(at), It(p, m), gt(p, i), en(p, u);
1131
+ const d = R("");
1132
+ p.provide(
1133
+ lt,
1134
+ y(() => i.state.locale)
1135
+ ), p.provide(st, {
1136
+ list: y(
1137
+ () => i.state.contentLocales.map((h) => ({
1138
+ code: h.code,
1139
+ label: h.code.toUpperCase()
1067
1140
  }))
1068
1141
  ),
1069
- active: x({
1070
- get: () => d.value || (o.state.contentLocales[0]?.code ?? ""),
1071
- set: (c) => {
1072
- d.value = c;
1142
+ active: y({
1143
+ get: () => d.value || (i.state.contentLocales[0]?.code ?? ""),
1144
+ set: (h) => {
1145
+ d.value = h;
1073
1146
  }
1074
1147
  })
1075
1148
  });
1076
- const p = {
1077
- app: f,
1078
- router: l,
1079
- context: v,
1080
- i18n: o,
1149
+ const k = {
1150
+ app: p,
1151
+ router: s,
1152
+ context: m,
1153
+ i18n: i,
1154
+ theme: u,
1081
1155
  async mount() {
1082
- await Promise.all([b(), m(o.state.locale)]).catch(() => {
1083
- }), f.mount(e.el ?? "#webx-app"), await v.reload();
1156
+ await Promise.all([b(), f(i.state.locale)]).catch(() => {
1157
+ }), p.mount(e.el ?? "#webx-app"), await m.reload();
1084
1158
  }
1085
1159
  };
1086
1160
  async function b() {
1087
- const c = await r.get(`${t}/locales`);
1088
- o.state.panelLocales = c.data.panel, o.state.contentLocales = c.data.content;
1161
+ const h = await c.get(`${t}/locales`);
1162
+ i.state.panelLocales = h.data.panel, i.state.contentLocales = h.data.content;
1089
1163
  }
1090
- for (const c of e.plugins ?? [])
1091
- c.install(p);
1092
- return f.use(l), p;
1164
+ for (const h of e.plugins ?? [])
1165
+ h.install(k);
1166
+ return p.use(s), k;
1093
1167
  }
1094
- function qt(e) {
1168
+ function an(e) {
1095
1169
  const n = {
1096
1170
  // The menu is the panel's own: it is the manifest, drawn.
1097
1171
  // The shell hands in what a choice means where it drew the menu — in the drawer it is what
1098
1172
  // closes it, and a drawer that stays open over the section it just opened is a drawer the
1099
1173
  // reader has to dismiss by hand.
1100
- nav: (t) => G(At, { collapsed: t.collapsed === !0, onSelect: t.select })
1174
+ nav: (t) => J(Nt, { collapsed: t.collapsed === !0, onSelect: t.select })
1101
1175
  };
1102
- return e.brand !== void 0 && (n.brand = () => G(e.brand)), e.userMenu !== void 0 && (n.user = (t) => G(e.userMenu, { expanded: t.expanded === !0 })), { render: () => G(Vt, null, n) };
1176
+ return e.brand !== void 0 && (n.brand = () => J(e.brand)), e.userMenu !== void 0 && (n.user = (t) => J(e.userMenu, { expanded: t.expanded === !0 })), { render: () => J(Yt, null, n) };
1103
1177
  }
1104
- function Yt() {
1105
- const e = Xt(Se);
1178
+ function ln() {
1179
+ const e = on(Le);
1106
1180
  return e !== null ? e : typeof document < "u" && document.documentElement.lang !== "" ? document.documentElement.lang : typeof navigator > "u" ? "en" : navigator.language;
1107
1181
  }
1108
- function Kt(e) {
1182
+ function sn(e) {
1109
1183
  try {
1110
- localStorage.setItem(Se, e);
1184
+ localStorage.setItem(Le, e);
1111
1185
  } catch {
1112
1186
  }
1113
1187
  }
1114
- function Xt(e) {
1188
+ function on(e) {
1115
1189
  try {
1116
1190
  return localStorage.getItem(e);
1117
1191
  } catch {
1118
1192
  return null;
1119
1193
  }
1120
1194
  }
1121
- function Gt(e, n) {
1195
+ function rn(e, n) {
1122
1196
  typeof document > "u" || (document.documentElement.lang = e, document.documentElement.dir = n.find((t) => t.code === e)?.direction ?? "ltr");
1123
1197
  }
1124
- function Jt() {
1198
+ function un() {
1125
1199
  return typeof document > "u" ? null : document.querySelector('meta[name="webx-manifest"]')?.getAttribute("content") ?? null;
1126
1200
  }
1127
- function Qt(e) {
1201
+ function cn(e) {
1128
1202
  const n = e.replace(/\r\n?/g, `
1129
1203
  `).split(`
1130
1204
  `), t = [];
1131
1205
  let a = 0;
1132
1206
  for (; a < n.length; ) {
1133
- const u = n[a] ?? "";
1134
- if (u.trim() === "") {
1207
+ const o = n[a] ?? "";
1208
+ if (o.trim() === "") {
1135
1209
  a += 1;
1136
1210
  continue;
1137
1211
  }
1138
- if (/^```([\w-]*)\s*$/.exec(u)) {
1139
- const r = [];
1212
+ if (/^```([\w-]*)\s*$/.exec(o)) {
1213
+ const u = [];
1140
1214
  for (a += 1; a < n.length && !/^```\s*$/.test(n[a] ?? ""); )
1141
- r.push(n[a] ?? ""), a += 1;
1142
- a += 1, t.push(`<pre><code>${ue(r.join(`
1215
+ u.push(n[a] ?? ""), a += 1;
1216
+ a += 1, t.push(`<pre><code>${ue(u.join(`
1143
1217
  `))}</code></pre>`);
1144
1218
  continue;
1145
1219
  }
1146
- const l = /^(#{1,4})\s+(.*)$/.exec(u);
1147
- if (l) {
1148
- const r = Math.min(l[1].length + 1, 5);
1149
- t.push(`<h${r}>${se(l[2] ?? "")}</h${r}>`), a += 1;
1220
+ const s = /^(#{1,4})\s+(.*)$/.exec(o);
1221
+ if (s) {
1222
+ const u = Math.min(s[1].length + 1, 5);
1223
+ t.push(`<h${u}>${oe(s[2] ?? "")}</h${u}>`), a += 1;
1150
1224
  continue;
1151
1225
  }
1152
- if (Q(u)) {
1153
- const r = /^\s*\d+[.)]\s+/.test(u), m = [];
1154
- for (; a < n.length && Q(n[a] ?? ""); )
1155
- for (m.push((n[a] ?? "").replace(/^\s*(?:[-*+]|\d+[.)])\s+/, "")), a += 1; a < n.length; ) {
1156
- const f = n[a] ?? "";
1157
- if (f.trim() === "" || Q(f) || /^(#{1,4})\s/.test(f) || /^```/.test(f))
1226
+ if (Z(o)) {
1227
+ const u = /^\s*\d+[.)]\s+/.test(o), c = [];
1228
+ for (; a < n.length && Z(n[a] ?? ""); )
1229
+ for (c.push((n[a] ?? "").replace(/^\s*(?:[-*+]|\d+[.)])\s+/, "")), a += 1; a < n.length; ) {
1230
+ const m = n[a] ?? "";
1231
+ if (m.trim() === "" || Z(m) || /^(#{1,4})\s/.test(m) || /^```/.test(m))
1158
1232
  break;
1159
- m[m.length - 1] += ` ${f.trim()}`, a += 1;
1233
+ c[c.length - 1] += ` ${m.trim()}`, a += 1;
1160
1234
  }
1161
- const v = r ? "ol" : "ul";
1162
- t.push(`<${v}>${m.map((f) => `<li>${se(f)}</li>`).join("")}</${v}>`);
1235
+ const f = u ? "ol" : "ul";
1236
+ t.push(`<${f}>${c.map((m) => `<li>${oe(m)}</li>`).join("")}</${f}>`);
1163
1237
  continue;
1164
1238
  }
1165
- const o = [];
1239
+ const i = [];
1166
1240
  for (; a < n.length; ) {
1167
- const r = n[a] ?? "";
1168
- if (r.trim() === "" || Q(r) || /^(#{1,4})\s/.test(r) || /^```/.test(r)) break;
1169
- o.push(r.trim()), a += 1;
1241
+ const u = n[a] ?? "";
1242
+ if (u.trim() === "" || Z(u) || /^(#{1,4})\s/.test(u) || /^```/.test(u)) break;
1243
+ i.push(u.trim()), a += 1;
1170
1244
  }
1171
- t.push(`<p>${se(o.join(" "))}</p>`);
1245
+ t.push(`<p>${oe(i.join(" "))}</p>`);
1172
1246
  }
1173
1247
  return t.join("");
1174
1248
  }
1175
- const J = "\0";
1176
- function Q(e) {
1249
+ const Q = "\0";
1250
+ function Z(e) {
1177
1251
  return /^\s*(?:[-*+]|\d+[.)])\s+/.test(e);
1178
1252
  }
1179
- function se(e) {
1180
- const n = [], t = e.replace(/`([^`]+)`/g, (u, s) => (n.push(`<code>${ue(s)}</code>`), `${J}${n.length - 1}${J}`));
1253
+ function oe(e) {
1254
+ const n = [], t = e.replace(/`([^`]+)`/g, (o, l) => (n.push(`<code>${ue(l)}</code>`), `${Q}${n.length - 1}${Q}`));
1181
1255
  return ue(t).replace(
1182
1256
  /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,
1183
1257
  '<a href="$2" target="_blank" rel="noopener">$1</a>'
1184
1258
  ).replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(
1185
- new RegExp(`${J}(\\d+)${J}`, "g"),
1186
- (u, s) => n[Number(s)] ?? ""
1259
+ new RegExp(`${Q}(\\d+)${Q}`, "g"),
1260
+ (o, l) => n[Number(l)] ?? ""
1187
1261
  );
1188
1262
  }
1189
1263
  function ue(e) {
1190
1264
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1191
1265
  }
1192
- function Zt(e) {
1266
+ function dn(e) {
1193
1267
  const n = e.scope("webx-admin"), t = /* @__PURE__ */ new Map();
1194
- function a(s, l, o) {
1195
- const r = e.state.locale, m = `${r}:${s}`;
1196
- let v = t.get(m);
1197
- return v === void 0 && (v = new Intl.DateTimeFormat(r, l), t.set(m, v)), v.format(o);
1268
+ function a(l, s, i) {
1269
+ const u = e.state.locale, c = `${u}:${l}`;
1270
+ let f = t.get(c);
1271
+ return f === void 0 && (f = new Intl.DateTimeFormat(u, s), t.set(c, f)), f.format(i);
1198
1272
  }
1199
- const u = (s) => a("time", { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }, s);
1273
+ const o = (l) => a("time", { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }, l);
1200
1274
  return {
1201
- short(s) {
1202
- const l = ee(s);
1203
- if (l === null)
1275
+ short(l) {
1276
+ const s = te(l);
1277
+ if (s === null)
1204
1278
  return n("dates.never");
1205
- const o = /* @__PURE__ */ new Date(), r = he(l, o);
1206
- return r === 0 ? n("dates.today", { time: u(l) }) : r === -1 ? n("dates.yesterday", { time: u(l) }) : l.getFullYear() === o.getFullYear() ? a(
1279
+ const i = /* @__PURE__ */ new Date(), u = pe(s, i);
1280
+ return u === 0 ? n("dates.today", { time: o(s) }) : u === -1 ? n("dates.yesterday", { time: o(s) }) : s.getFullYear() === i.getFullYear() ? a(
1207
1281
  "this-year",
1208
1282
  {
1209
1283
  day: "numeric",
@@ -1212,81 +1286,81 @@ function Zt(e) {
1212
1286
  minute: "2-digit",
1213
1287
  hourCycle: "h23"
1214
1288
  },
1215
- l
1216
- ) : a("earlier", { day: "numeric", month: "long", year: "numeric" }, l);
1289
+ s
1290
+ ) : a("earlier", { day: "numeric", month: "long", year: "numeric" }, s);
1217
1291
  },
1218
- compact(s) {
1219
- const l = ee(s);
1220
- if (l === null)
1292
+ compact(l) {
1293
+ const s = te(l);
1294
+ if (s === null)
1221
1295
  return n("dates.never");
1222
- const o = /* @__PURE__ */ new Date();
1223
- return he(l, o) === 0 ? u(l) : l.getFullYear() === o.getFullYear() ? a("compact", { day: "numeric", month: "short" }, l) : a("compact-earlier", { dateStyle: "short" }, l);
1296
+ const i = /* @__PURE__ */ new Date();
1297
+ return pe(s, i) === 0 ? o(s) : s.getFullYear() === i.getFullYear() ? a("compact", { day: "numeric", month: "short" }, s) : a("compact-earlier", { dateStyle: "short" }, s);
1224
1298
  },
1225
- exact(s) {
1226
- const l = ee(s);
1227
- return l === null ? "" : a("exact", { dateStyle: "long", timeStyle: "medium", hourCycle: "h23" }, l);
1299
+ exact(l) {
1300
+ const s = te(l);
1301
+ return s === null ? "" : a("exact", { dateStyle: "long", timeStyle: "medium", hourCycle: "h23" }, s);
1228
1302
  },
1229
- iso(s) {
1230
- const l = ee(s);
1231
- return l === null ? "" : l.toISOString();
1303
+ iso(l) {
1304
+ const s = te(l);
1305
+ return s === null ? "" : s.toISOString();
1232
1306
  }
1233
1307
  };
1234
1308
  }
1235
- function en() {
1236
- const e = te(ne, null);
1237
- return Zt(e ?? tn());
1309
+ function ze() {
1310
+ const e = Y(ae, null);
1311
+ return dn(e ?? mn());
1238
1312
  }
1239
- let Z = null;
1240
- function tn() {
1241
- return Z === null && (Z = de(), Z.defaults("webx-admin", $e)), Z;
1313
+ let ee = null;
1314
+ function mn() {
1315
+ return ee === null && (ee = ce(), ee.defaults("webx-admin", Ce)), ee;
1242
1316
  }
1243
- function ee(e) {
1317
+ function te(e) {
1244
1318
  if (e == null || e === "")
1245
1319
  return null;
1246
1320
  const n = e instanceof Date ? e : new Date(e);
1247
1321
  return Number.isNaN(n.getTime()) ? null : n;
1248
1322
  }
1249
- function he(e, n) {
1323
+ function pe(e, n) {
1250
1324
  const t = (a) => Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
1251
1325
  return Math.round((t(e) - t(n)) / 864e5);
1252
1326
  }
1253
- function nn(e, n, t) {
1254
- const a = e instanceof re ? e.status : ln(e);
1327
+ function fn(e, n, t) {
1328
+ const a = e instanceof re ? e.status : hn(e);
1255
1329
  if (a === 422)
1256
- return sn(e) ?? t ?? n("errors.unknown");
1330
+ return pn(e) ?? t ?? n("errors.unknown");
1257
1331
  if (a === 401) return n("errors.signed-out");
1258
1332
  if (a === 403) return n("errors.forbidden");
1259
1333
  if (a === 404) return n("errors.gone");
1260
1334
  if (a === 409) return n("errors.conflict");
1261
1335
  if (a === 429) {
1262
- const u = e instanceof re ? e.retryAfter : null;
1263
- return u === null ? n("errors.throttled") : n("errors.throttled-in", { seconds: u });
1336
+ const o = e instanceof re ? e.retryAfter : null;
1337
+ return o === null ? n("errors.throttled") : n("errors.throttled-in", { seconds: o });
1264
1338
  }
1265
1339
  return a !== null && a >= 500 ? n("errors.server") : a === null ? n("errors.offline") : t ?? n("errors.unknown");
1266
1340
  }
1267
- function an() {
1268
- const e = B("webx-admin");
1269
- return (n, t) => nn(n, e, t);
1341
+ function vn() {
1342
+ const e = I("webx-admin");
1343
+ return (n, t) => fn(n, e, t);
1270
1344
  }
1271
- function ln(e) {
1345
+ function hn(e) {
1272
1346
  const n = e?.status;
1273
1347
  return typeof n == "number" ? n : null;
1274
1348
  }
1275
- function sn(e) {
1349
+ function pn(e) {
1276
1350
  const t = e?.body?.message;
1277
1351
  return typeof t == "string" && t !== "" ? t : null;
1278
1352
  }
1279
- function on(e, n, t) {
1280
- const a = `${e.apiPath}/entities/${n}/${t}/notes`, u = (l) => `${e.apiPath}/notes/${l}`, s = (l) => l.data;
1353
+ function bn(e, n, t) {
1354
+ const a = `${e.apiPath}/entities/${n}/${t}/notes`, o = (s) => `${e.apiPath}/notes/${s}`, l = (s) => s.data;
1281
1355
  return {
1282
- list: () => e.http.get(a).then(s),
1283
- add: (l) => e.http.post(a, { body: l }).then(s),
1284
- save: (l, o) => e.http.put(u(l), { body: o }).then(s),
1285
- remove: (l) => e.http.delete(u(l)).then(() => {
1356
+ list: () => e.http.get(a).then(l),
1357
+ add: (s) => e.http.post(a, { body: s }).then(l),
1358
+ save: (s, i) => e.http.put(o(s), { body: i }).then(l),
1359
+ remove: (s) => e.http.delete(o(s)).then(() => {
1286
1360
  })
1287
1361
  };
1288
1362
  }
1289
- const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1363
+ const gn = { class: "wx-screen-host" }, On = /* @__PURE__ */ A({
1290
1364
  __name: "Screen",
1291
1365
  props: /* @__PURE__ */ ie({
1292
1366
  name: {},
@@ -1301,37 +1375,37 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1301
1375
  }),
1302
1376
  emits: /* @__PURE__ */ ie(["loaded"], ["update:modelValue"]),
1303
1377
  setup(e, { expose: n, emit: t }) {
1304
- const a = e, u = t, s = be(e, "modelValue"), l = O(), o = B("webx-admin"), r = A(null), m = A(null);
1305
- async function v() {
1306
- r.value = null, m.value = null;
1378
+ const a = e, o = t, l = we(e, "modelValue"), s = V(), i = I("webx-admin"), u = R(null), c = R(null);
1379
+ async function f() {
1380
+ u.value = null, c.value = null;
1307
1381
  try {
1308
- const f = await l.loadScreen(a.name);
1309
- r.value = f, u("loaded", f);
1310
- } catch (f) {
1311
- m.value = f instanceof Error ? f.message : String(f);
1382
+ const m = await s.loadScreen(a.name);
1383
+ u.value = m, o("loaded", m);
1384
+ } catch (m) {
1385
+ c.value = m instanceof Error ? m.message : String(m);
1312
1386
  }
1313
1387
  }
1314
- return Y([() => a.name, () => l.i18n.state.locale], () => {
1315
- v();
1316
- }, { immediate: !0 }), n({ reload: v }), (f, d) => (h(), k("div", rn, [
1317
- m.value ? (h(), w(i(tt), {
1388
+ return X([() => a.name, () => s.i18n.state.locale], () => {
1389
+ f();
1390
+ }, { immediate: !0 }), n({ reload: f }), (m, p) => (v(), _("div", gn, [
1391
+ c.value ? (v(), x(r(ke), {
1318
1392
  key: 0,
1319
1393
  type: "danger",
1320
- title: i(o)("shell.error-title"),
1321
- description: m.value
1322
- }, null, 8, ["title", "description"])) : r.value === null ? (h(), w(i(xe), {
1394
+ title: r(i)("shell.error-title"),
1395
+ description: c.value
1396
+ }, null, 8, ["title", "description"])) : u.value === null ? (v(), x(r(_e), {
1323
1397
  key: 1,
1324
1398
  rows: 4
1325
- })) : (h(), w(i(dt), {
1399
+ })) : (v(), x(r(bt), {
1326
1400
  key: 2,
1327
- modelValue: s.value,
1328
- "onUpdate:modelValue": d[0] || (d[0] = (p) => s.value = p),
1329
- root: r.value,
1330
- patch: i(l).screenPatch(e.name),
1331
- types: i(l).types,
1401
+ modelValue: l.value,
1402
+ "onUpdate:modelValue": p[0] || (p[0] = (d) => l.value = d),
1403
+ root: u.value,
1404
+ patch: r(s).screenPatch(e.name),
1405
+ types: r(s).types,
1332
1406
  errors: e.errors,
1333
- translate: i(l).i18n.t,
1334
- can: i(l).can,
1407
+ translate: r(s).i18n.t,
1408
+ can: r(s).can,
1335
1409
  disabled: e.disabled,
1336
1410
  "label-position": e.labelPosition,
1337
1411
  "label-width": e.labelWidth,
@@ -1339,63 +1413,63 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1339
1413
  }, null, 8, ["modelValue", "root", "patch", "types", "errors", "translate", "can", "disabled", "label-position", "label-width", "size"]))
1340
1414
  ]));
1341
1415
  }
1342
- }), An = 76, un = {
1416
+ }), jn = 76, wn = {
1343
1417
  class: "wx-save-state",
1344
1418
  role: "status",
1345
1419
  "aria-live": "polite"
1346
- }, dn = /* @__PURE__ */ R({
1420
+ }, yn = /* @__PURE__ */ A({
1347
1421
  __name: "SaveState",
1348
1422
  props: {
1349
1423
  state: {},
1350
1424
  linger: { default: 2e3 }
1351
1425
  },
1352
1426
  setup(e) {
1353
- const n = e, t = B("webx-admin"), a = A(!1);
1354
- let u = null;
1355
- Y(
1427
+ const n = e, t = I("webx-admin"), a = R(!1);
1428
+ let o = null;
1429
+ X(
1356
1430
  () => n.state,
1357
- (l, o) => {
1358
- u !== null && clearTimeout(u), a.value = o === "saving" && l === "saved", a.value && (u = window.setTimeout(() => {
1359
- a.value = !1, u = null;
1431
+ (s, i) => {
1432
+ o !== null && clearTimeout(o), a.value = i === "saving" && s === "saved", a.value && (o = window.setTimeout(() => {
1433
+ a.value = !1, o = null;
1360
1434
  }, n.linger));
1361
1435
  }
1362
1436
  );
1363
- const s = x(
1437
+ const l = y(
1364
1438
  () => n.state === "saving" ? "saving" : a.value ? "saved" : null
1365
1439
  );
1366
- return Be(() => {
1367
- u !== null && clearTimeout(u);
1368
- }), (l, o) => (h(), k("span", un, [
1369
- s.value ? (h(), w(i(ye), {
1440
+ return Fe(() => {
1441
+ o !== null && clearTimeout(o);
1442
+ }), (s, i) => (v(), _("span", wn, [
1443
+ l.value ? (v(), x(r(xe), {
1370
1444
  key: 0,
1371
- class: H(["wx-save-state__mark", { "is-saved": s.value === "saved" }]),
1372
- name: s.value === "saving" ? "loader" : "check",
1373
- spin: s.value === "saving",
1374
- label: i(t)(`editor.${s.value}`)
1375
- }, null, 8, ["class", "name", "spin", "label"])) : z("", !0)
1445
+ class: K(["wx-save-state__mark", { "is-saved": l.value === "saved" }]),
1446
+ name: l.value === "saving" ? "loader" : "check",
1447
+ spin: l.value === "saving",
1448
+ label: r(t)(`editor.${l.value}`)
1449
+ }, null, 8, ["class", "name", "spin", "label"])) : L("", !0)
1376
1450
  ]));
1377
1451
  }
1378
- }), Rn = /* @__PURE__ */ N(dn, [["__scopeId", "data-v-216e5e44"]]), En = /* @__PURE__ */ R({
1452
+ }), Kn = /* @__PURE__ */ N(yn, [["__scopeId", "data-v-216e5e44"]]), qn = /* @__PURE__ */ A({
1379
1453
  __name: "FilterChips",
1380
1454
  props: {
1381
1455
  filters: {}
1382
1456
  },
1383
1457
  setup(e) {
1384
- return (n, t) => (h(!0), k(I, null, P(e.filters, (a) => (h(), w(i(nt), {
1458
+ return (n, t) => (v(!0), _(U, null, F(e.filters, (a) => (v(), x(r(ot), {
1385
1459
  key: a.key,
1386
1460
  class: "wx-filter-chip",
1387
1461
  size: "sm",
1388
1462
  round: "",
1389
1463
  closable: "",
1390
- onClose: (u) => a.clear()
1464
+ onClose: (o) => a.clear()
1391
1465
  }, {
1392
1466
  default: g(() => [
1393
- W(C(a.label), 1)
1467
+ z(C(a.label), 1)
1394
1468
  ]),
1395
1469
  _: 2
1396
1470
  }, 1032, ["onClose"]))), 128));
1397
1471
  }
1398
- }), cn = { class: "wx-rename__footer" }, mn = /* @__PURE__ */ R({
1472
+ }), xn = { class: "wx-rename__footer" }, kn = /* @__PURE__ */ A({
1399
1473
  __name: "RenameButton",
1400
1474
  props: {
1401
1475
  name: { default: "" },
@@ -1406,57 +1480,57 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1406
1480
  },
1407
1481
  emits: ["rename"],
1408
1482
  setup(e, { emit: n }) {
1409
- const t = e, a = n, u = B("webx-admin"), s = A(!1), l = A(t.name), o = A(null), r = x(() => t.label ?? u("editor.rename"));
1410
- Y(s, async (v) => {
1411
- v && (l.value = t.name, await Ie(), o.value?.focus(), o.value?.select());
1483
+ const t = e, a = n, o = I("webx-admin"), l = R(!1), s = R(t.name), i = R(null), u = y(() => t.label ?? o("editor.rename"));
1484
+ X(l, async (f) => {
1485
+ f && (s.value = t.name, await Pe(), i.value?.focus(), i.value?.select());
1412
1486
  });
1413
- function m() {
1414
- const v = l.value.trim();
1415
- if (v === "" || v === t.name) {
1416
- s.value = !1;
1487
+ function c() {
1488
+ const f = s.value.trim();
1489
+ if (f === "" || f === t.name) {
1490
+ l.value = !1;
1417
1491
  return;
1418
1492
  }
1419
- a("rename", v), s.value = !1;
1493
+ a("rename", f), l.value = !1;
1420
1494
  }
1421
- return (v, f) => (h(), w(i(at), {
1422
- open: s.value,
1423
- "onUpdate:open": f[2] || (f[2] = (d) => s.value = d),
1424
- title: r.value,
1495
+ return (f, m) => (v(), x(r(it), {
1496
+ open: l.value,
1497
+ "onUpdate:open": m[2] || (m[2] = (p) => l.value = p),
1498
+ title: u.value,
1425
1499
  width: 320,
1426
1500
  side: "bottom",
1427
1501
  align: "start",
1428
1502
  teleport: ""
1429
1503
  }, {
1430
1504
  trigger: g(() => [
1431
- _(i(K), {
1505
+ $(r(G), {
1432
1506
  type: "edit",
1433
- title: r.value,
1507
+ title: u.value,
1434
1508
  size: e.size,
1435
1509
  disabled: e.disabled
1436
1510
  }, null, 8, ["title", "size", "disabled"])
1437
1511
  ]),
1438
1512
  default: g(() => [
1439
- M("form", {
1513
+ D("form", {
1440
1514
  class: "wx-rename",
1441
- onSubmit: pe(m, ["prevent"])
1515
+ onSubmit: be(c, ["prevent"])
1442
1516
  }, [
1443
- _(i(lt), {
1517
+ $(r(rt), {
1444
1518
  ref_key: "field",
1445
- ref: o,
1446
- modelValue: l.value,
1447
- "onUpdate:modelValue": f[0] || (f[0] = (d) => l.value = d),
1448
- "aria-label": r.value,
1519
+ ref: i,
1520
+ modelValue: s.value,
1521
+ "onUpdate:modelValue": m[0] || (m[0] = (p) => s.value = p),
1522
+ "aria-label": u.value,
1449
1523
  placeholder: e.placeholder,
1450
- onKeydown: f[1] || (f[1] = Me((d) => s.value = !1, ["esc"]))
1524
+ onKeydown: m[1] || (m[1] = Ve((p) => l.value = !1, ["esc"]))
1451
1525
  }, null, 8, ["modelValue", "aria-label", "placeholder"]),
1452
- M("div", cn, [
1453
- _(i(j), {
1526
+ D("div", xn, [
1527
+ $(r(q), {
1454
1528
  type: "primary",
1455
1529
  size: "sm",
1456
1530
  "native-type": "submit"
1457
1531
  }, {
1458
1532
  default: g(() => [
1459
- W(C(i(u)("editor.save")), 1)
1533
+ z(C(r(o)("editor.save")), 1)
1460
1534
  ]),
1461
1535
  _: 1
1462
1536
  })
@@ -1466,7 +1540,7 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1466
1540
  _: 1
1467
1541
  }, 8, ["open", "title"]));
1468
1542
  }
1469
- }), Un = /* @__PURE__ */ N(mn, [["__scopeId", "data-v-d879e8d3"]]), fn = ["innerHTML"], vn = /* @__PURE__ */ R({
1543
+ }), Yn = /* @__PURE__ */ N(kn, [["__scopeId", "data-v-d879e8d3"]]), _n = ["innerHTML"], $n = /* @__PURE__ */ A({
1470
1544
  __name: "HelpButton",
1471
1545
  props: {
1472
1546
  body: {},
@@ -1476,33 +1550,33 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1476
1550
  width: { default: 720 }
1477
1551
  },
1478
1552
  setup(e) {
1479
- const n = e, t = B("webx-admin"), a = A(!1), u = x(() => n.title ?? t("help.title")), s = x(() => Qt(n.body));
1480
- return (l, o) => (h(), k(I, null, [
1481
- _(i(K), {
1553
+ const n = e, t = I("webx-admin"), a = R(!1), o = y(() => n.title ?? t("help.title")), l = y(() => cn(n.body));
1554
+ return (s, i) => (v(), _(U, null, [
1555
+ $(r(G), {
1482
1556
  type: "details",
1483
1557
  icon: "question",
1484
1558
  tone: "neutral",
1485
1559
  size: e.size,
1486
- title: e.label ?? u.value,
1487
- onClick: o[0] || (o[0] = (r) => a.value = !0)
1560
+ title: e.label ?? o.value,
1561
+ onClick: i[0] || (i[0] = (u) => a.value = !0)
1488
1562
  }, null, 8, ["size", "title"]),
1489
- _(i(st), {
1563
+ $(r(ut), {
1490
1564
  open: a.value,
1491
- "onUpdate:open": o[1] || (o[1] = (r) => a.value = r),
1492
- title: u.value,
1565
+ "onUpdate:open": i[1] || (i[1] = (u) => a.value = u),
1566
+ title: o.value,
1493
1567
  width: e.width
1494
1568
  }, {
1495
1569
  default: g(() => [
1496
- M("div", {
1570
+ D("div", {
1497
1571
  class: "wx-help",
1498
- innerHTML: s.value
1499
- }, null, 8, fn)
1572
+ innerHTML: l.value
1573
+ }, null, 8, _n)
1500
1574
  ]),
1501
1575
  _: 1
1502
1576
  }, 8, ["open", "title", "width"])
1503
1577
  ], 64));
1504
1578
  }
1505
- }), Bn = /* @__PURE__ */ N(vn, [["__scopeId", "data-v-6c280d42"]]), hn = /* @__PURE__ */ R({
1579
+ }), Xn = /* @__PURE__ */ N($n, [["__scopeId", "data-v-6c280d42"]]), We = /* @__PURE__ */ A({
1506
1580
  name: "WxDate",
1507
1581
  __name: "DateText",
1508
1582
  props: {
@@ -1512,46 +1586,46 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1512
1586
  tone: { default: "muted" }
1513
1587
  },
1514
1588
  setup(e) {
1515
- const n = e, t = en(), a = x(() => n.compact ? t.compact(n.value) : t.short(n.value)), u = x(() => t.exact(n.value)), s = x(() => t.iso(n.value));
1516
- return (l, o) => u.value ? (h(), w(i(ot), {
1589
+ const n = e, t = ze(), a = y(() => n.compact ? t.compact(n.value) : t.short(n.value)), o = y(() => t.exact(n.value)), l = y(() => t.iso(n.value));
1590
+ return (s, i) => o.value ? (v(), x(r(ct), {
1517
1591
  key: 0,
1518
- content: u.value
1592
+ content: o.value
1519
1593
  }, {
1520
1594
  default: g(() => [
1521
- _(i(q), {
1595
+ $(r(P), {
1522
1596
  as: "time",
1523
- datetime: s.value,
1597
+ datetime: l.value,
1524
1598
  size: e.size,
1525
1599
  tone: e.tone
1526
1600
  }, {
1527
1601
  default: g(() => [
1528
- W(C(a.value), 1)
1602
+ z(C(a.value), 1)
1529
1603
  ]),
1530
1604
  _: 1
1531
1605
  }, 8, ["datetime", "size", "tone"])
1532
1606
  ]),
1533
1607
  _: 1
1534
- }, 8, ["content"])) : (h(), w(i(q), {
1608
+ }, 8, ["content"])) : (v(), x(r(P), {
1535
1609
  key: 1,
1536
1610
  size: e.size,
1537
1611
  tone: e.tone
1538
1612
  }, {
1539
1613
  default: g(() => [
1540
- W(C(a.value), 1)
1614
+ z(C(a.value), 1)
1541
1615
  ]),
1542
1616
  _: 1
1543
1617
  }, 8, ["size", "tone"]));
1544
1618
  }
1545
- }), pn = { class: "wx-notes" }, gn = {
1619
+ }), Tn = { class: "wx-notes" }, Sn = {
1546
1620
  key: 3,
1547
1621
  class: "wx-notes__list"
1548
- }, bn = { class: "wx-note__body" }, wn = { class: "wx-note__head" }, yn = { class: "wx-note__buttons" }, xn = {
1622
+ }, Cn = { class: "wx-note__body" }, Ln = { class: "wx-note__head" }, zn = { class: "wx-note__buttons" }, Wn = {
1549
1623
  key: 1,
1550
1624
  class: "wx-note__text"
1551
- }, kn = {
1625
+ }, An = {
1552
1626
  key: 4,
1553
1627
  class: "wx-notes__new"
1554
- }, _n = /* @__PURE__ */ R({
1628
+ }, Rn = /* @__PURE__ */ A({
1555
1629
  name: "WxNotes",
1556
1630
  __name: "NotesFeed",
1557
1631
  props: {
@@ -1562,221 +1636,284 @@ const rn = { class: "wx-screen-host" }, Wn = /* @__PURE__ */ R({
1562
1636
  },
1563
1637
  emits: ["change"],
1564
1638
  setup(e, { emit: n }) {
1565
- const t = e, a = n, u = O(), s = B("webx-admin"), l = an(), o = A([]), r = A(!0), m = A(""), v = A(!1), f = A(null), d = A(""), p = x(() => on(u, t.type, t.id)), b = x(() => t.title ?? s("notes.title"));
1566
- async function c() {
1567
- r.value = !0;
1639
+ const t = e, a = n, o = V(), l = I("webx-admin"), s = vn(), i = R([]), u = R(!0), c = R(""), f = R(!1), m = R(null), p = R(""), d = y(() => bn(o, t.type, t.id)), k = y(() => t.title ?? l("notes.title"));
1640
+ async function b() {
1641
+ u.value = !0;
1568
1642
  try {
1569
- o.value = await p.value.list();
1570
- } catch (S) {
1571
- F.danger(l(S));
1643
+ i.value = await d.value.list();
1644
+ } catch (T) {
1645
+ j.danger(s(T));
1572
1646
  } finally {
1573
- r.value = !1;
1647
+ u.value = !1;
1574
1648
  }
1575
1649
  }
1576
- Y(
1650
+ X(
1577
1651
  () => [t.type, t.id],
1578
1652
  () => {
1579
- f.value = null, m.value = "", c();
1653
+ m.value = null, c.value = "", b();
1580
1654
  },
1581
1655
  { immediate: !0 }
1582
1656
  );
1583
- async function y() {
1584
- const S = m.value.trim();
1585
- if (!(S === "" || v.value)) {
1586
- v.value = !0;
1657
+ async function h() {
1658
+ const T = c.value.trim();
1659
+ if (!(T === "" || f.value)) {
1660
+ f.value = !0;
1587
1661
  try {
1588
- o.value = [...o.value, await p.value.add(S)], m.value = "", a("change");
1662
+ i.value = [...i.value, await d.value.add(T)], c.value = "", a("change");
1589
1663
  } catch (E) {
1590
- F.danger(l(E));
1664
+ j.danger(s(E));
1591
1665
  } finally {
1592
- v.value = !1;
1666
+ f.value = !1;
1593
1667
  }
1594
1668
  }
1595
1669
  }
1596
- function $(S) {
1597
- f.value = S.id, d.value = S.body;
1670
+ function w(T) {
1671
+ m.value = T.id, p.value = T.body;
1598
1672
  }
1599
- async function X(S) {
1600
- const E = d.value.trim();
1673
+ async function H(T) {
1674
+ const E = p.value.trim();
1601
1675
  if (E !== "")
1602
1676
  try {
1603
- const T = await p.value.save(S.id, E);
1604
- o.value = o.value.map((D) => D.id === T.id ? T : D), f.value = null, F.success(s("notes.saved")), a("change");
1605
- } catch (T) {
1606
- F.danger(l(T));
1677
+ const S = await d.value.save(T.id, E);
1678
+ i.value = i.value.map((M) => M.id === S.id ? S : M), m.value = null, j.success(l("notes.saved")), a("change");
1679
+ } catch (S) {
1680
+ j.danger(s(S));
1607
1681
  }
1608
1682
  }
1609
- async function ae(S) {
1610
- if (await ut({
1611
- title: s("notes.delete-title"),
1612
- message: s("notes.delete-text"),
1613
- confirmText: s("notes.delete"),
1614
- cancelText: s("notes.cancel"),
1683
+ async function le(T) {
1684
+ if (await ft({
1685
+ title: l("notes.delete-title"),
1686
+ message: l("notes.delete-text"),
1687
+ confirmText: l("notes.delete"),
1688
+ cancelText: l("notes.cancel"),
1615
1689
  tone: "danger"
1616
1690
  }))
1617
1691
  try {
1618
- await p.value.remove(S.id), o.value = o.value.filter((T) => T.id !== S.id), F.success(s("notes.deleted")), a("change");
1619
- } catch (T) {
1620
- F.danger(l(T));
1692
+ await d.value.remove(T.id), i.value = i.value.filter((S) => S.id !== T.id), j.success(l("notes.deleted")), a("change");
1693
+ } catch (S) {
1694
+ j.danger(s(S));
1621
1695
  }
1622
1696
  }
1623
- function le(S) {
1624
- return !t.can || !S.is_mine ? [] : [
1625
- { key: "edit", icon: "edit", label: s("notes.edit"), run: () => $(S) },
1697
+ function se(T) {
1698
+ return !t.can || !T.is_mine ? [] : [
1699
+ { key: "edit", icon: "edit", label: l("notes.edit"), run: () => w(T) },
1626
1700
  {
1627
1701
  key: "delete",
1628
1702
  icon: "trash",
1629
- label: s("notes.delete"),
1703
+ label: l("notes.delete"),
1630
1704
  danger: !0,
1631
1705
  run: () => {
1632
- ae(S);
1706
+ le(T);
1633
1707
  }
1634
1708
  }
1635
1709
  ];
1636
1710
  }
1637
- function V(S) {
1638
- return S.author?.name ?? s("notes.unknown-author");
1711
+ function O(T) {
1712
+ return T.author?.name ?? l("notes.unknown-author");
1639
1713
  }
1640
- return (S, E) => (h(), k("section", pn, [
1641
- b.value ? (h(), w(i(q), {
1714
+ return (T, E) => (v(), _("section", Tn, [
1715
+ k.value ? (v(), x(r(P), {
1642
1716
  key: 0,
1643
1717
  weight: "medium",
1644
1718
  class: "wx-notes__title"
1645
1719
  }, {
1646
1720
  default: g(() => [
1647
- W(C(b.value), 1)
1721
+ z(C(k.value), 1)
1648
1722
  ]),
1649
1723
  _: 1
1650
- })) : z("", !0),
1651
- r.value ? (h(), w(i(xe), {
1724
+ })) : L("", !0),
1725
+ u.value ? (v(), x(r(_e), {
1652
1726
  key: 1,
1653
1727
  rows: 2
1654
- })) : o.value.length === 0 ? (h(), w(i(it), {
1728
+ })) : i.value.length === 0 ? (v(), x(r(dt), {
1655
1729
  key: 2,
1656
1730
  size: "sm",
1657
- description: i(s)("notes.empty")
1658
- }, null, 8, ["description"])) : (h(), k("ul", gn, [
1659
- (h(!0), k(I, null, P(o.value, (T) => (h(), k("li", {
1660
- key: T.id,
1731
+ description: r(l)("notes.empty")
1732
+ }, null, 8, ["description"])) : (v(), _("ul", Sn, [
1733
+ (v(!0), _(U, null, F(i.value, (S) => (v(), _("li", {
1734
+ key: S.id,
1661
1735
  class: "wx-note"
1662
1736
  }, [
1663
- _(i(rt), {
1664
- name: V(T),
1737
+ $(r(mt), {
1738
+ name: O(S),
1665
1739
  size: "sm",
1666
1740
  tone: "auto"
1667
1741
  }, null, 8, ["name"]),
1668
- M("div", bn, [
1669
- M("div", wn, [
1670
- _(i(q), {
1742
+ D("div", Cn, [
1743
+ D("div", Ln, [
1744
+ $(r(P), {
1671
1745
  size: "sm",
1672
1746
  weight: "medium",
1673
1747
  truncate: ""
1674
1748
  }, {
1675
1749
  default: g(() => [
1676
- W(C(V(T)), 1)
1750
+ z(C(O(S)), 1)
1677
1751
  ]),
1678
1752
  _: 2
1679
1753
  }, 1024),
1680
- _(hn, {
1681
- value: T.created_at
1754
+ $(We, {
1755
+ value: S.created_at
1682
1756
  }, null, 8, ["value"]),
1683
- _(ke, {
1684
- actions: le(T),
1685
- label: V(T)
1757
+ $($e, {
1758
+ actions: se(S),
1759
+ label: O(S)
1686
1760
  }, null, 8, ["actions", "label"])
1687
1761
  ]),
1688
- f.value === T.id ? (h(), k(I, { key: 0 }, [
1689
- _(i(fe), {
1690
- modelValue: d.value,
1691
- "onUpdate:modelValue": E[0] || (E[0] = (D) => d.value = D),
1762
+ m.value === S.id ? (v(), _(U, { key: 0 }, [
1763
+ $(r(fe), {
1764
+ modelValue: p.value,
1765
+ "onUpdate:modelValue": E[0] || (E[0] = (M) => p.value = M),
1692
1766
  autosize: { minRows: 2, maxRows: 10 }
1693
1767
  }, null, 8, ["modelValue"]),
1694
- M("div", yn, [
1695
- _(i(j), {
1768
+ D("div", zn, [
1769
+ $(r(q), {
1696
1770
  size: "sm",
1697
1771
  type: "primary",
1698
- onClick: (D) => X(T)
1772
+ onClick: (M) => H(S)
1699
1773
  }, {
1700
1774
  default: g(() => [
1701
- W(C(i(s)("notes.save")), 1)
1775
+ z(C(r(l)("notes.save")), 1)
1702
1776
  ]),
1703
1777
  _: 1
1704
1778
  }, 8, ["onClick"]),
1705
- _(i(j), {
1779
+ $(r(q), {
1706
1780
  size: "sm",
1707
1781
  variant: "text",
1708
- onClick: E[1] || (E[1] = (D) => f.value = null)
1782
+ onClick: E[1] || (E[1] = (M) => m.value = null)
1709
1783
  }, {
1710
1784
  default: g(() => [
1711
- W(C(i(s)("notes.cancel")), 1)
1785
+ z(C(r(l)("notes.cancel")), 1)
1712
1786
  ]),
1713
1787
  _: 1
1714
1788
  })
1715
1789
  ])
1716
- ], 64)) : (h(), k("p", xn, C(T.body), 1))
1790
+ ], 64)) : (v(), _("p", Wn, C(S.body), 1))
1717
1791
  ])
1718
1792
  ]))), 128))
1719
1793
  ])),
1720
- e.can ? (h(), k("div", kn, [
1721
- _(i(fe), {
1722
- modelValue: m.value,
1723
- "onUpdate:modelValue": E[2] || (E[2] = (T) => m.value = T),
1724
- placeholder: i(s)("notes.placeholder"),
1794
+ e.can ? (v(), _("div", An, [
1795
+ $(r(fe), {
1796
+ modelValue: c.value,
1797
+ "onUpdate:modelValue": E[2] || (E[2] = (S) => c.value = S),
1798
+ placeholder: r(l)("notes.placeholder"),
1725
1799
  autosize: { minRows: 2, maxRows: 8 }
1726
1800
  }, null, 8, ["modelValue", "placeholder"]),
1727
- _(i(j), {
1801
+ $(r(q), {
1728
1802
  size: "sm",
1729
1803
  type: "primary",
1730
- disabled: m.value.trim() === "",
1731
- loading: v.value,
1732
- onClick: y
1804
+ disabled: c.value.trim() === "",
1805
+ loading: f.value,
1806
+ onClick: h
1733
1807
  }, {
1734
1808
  default: g(() => [
1735
- W(C(i(s)("notes.add")), 1)
1809
+ z(C(r(l)("notes.add")), 1)
1736
1810
  ]),
1737
1811
  _: 1
1738
1812
  }, 8, ["disabled", "loading"])
1739
- ])) : z("", !0)
1813
+ ])) : L("", !0)
1740
1814
  ]));
1741
1815
  }
1742
- }), In = /* @__PURE__ */ N(_n, [["__scopeId", "data-v-71004c1a"]]);
1816
+ }), Gn = /* @__PURE__ */ N(Rn, [["__scopeId", "data-v-71004c1a"]]), En = {
1817
+ key: 1,
1818
+ class: "wx-backup-note"
1819
+ }, Bn = 48, In = /* @__PURE__ */ A({
1820
+ name: "WxBackupNote",
1821
+ __name: "BackupNote",
1822
+ setup(e) {
1823
+ const n = V(), t = ze(), a = I("webx-admin"), o = y(() => n.state.manifest?.backup ?? null), l = y(() => o.value !== null && n.can("settings.view")), s = y(() => {
1824
+ const c = o.value?.at;
1825
+ if (c == null) return !0;
1826
+ const f = new Date(c).getTime();
1827
+ return Number.isNaN(f) || Date.now() - f > Bn * 36e5;
1828
+ }), i = y(() => {
1829
+ const c = o.value?.bytes;
1830
+ if (c == null) return "";
1831
+ const f = ["byte", "kilobyte", "megabyte", "gigabyte", "terabyte"];
1832
+ let m = c, p = 0;
1833
+ for (; m >= 1024 && p < f.length - 1; )
1834
+ m /= 1024, p++;
1835
+ return new Intl.NumberFormat(n.i18n.state.locale, {
1836
+ style: "unit",
1837
+ unit: f[p],
1838
+ unitDisplay: "short",
1839
+ maximumFractionDigits: m >= 10 || p === 0 ? 0 : 1
1840
+ }).format(m);
1841
+ }), u = y(
1842
+ () => o.value?.at == null ? a("backup.never") : a("backup.stale", { date: t.short(o.value.at) })
1843
+ );
1844
+ return (c, f) => l.value && s.value ? (v(), x(r(ke), {
1845
+ key: 0,
1846
+ type: "warning",
1847
+ variant: "soft",
1848
+ description: u.value
1849
+ }, null, 8, ["description"])) : l.value ? (v(), _("p", En, [
1850
+ $(r(P), {
1851
+ size: "sm",
1852
+ tone: "muted"
1853
+ }, {
1854
+ default: g(() => [
1855
+ z(C(r(a)("backup.title")), 1)
1856
+ ]),
1857
+ _: 1
1858
+ }),
1859
+ $(We, {
1860
+ value: o.value?.at
1861
+ }, null, 8, ["value"]),
1862
+ i.value ? (v(), x(r(P), {
1863
+ key: 0,
1864
+ size: "sm",
1865
+ tone: "muted"
1866
+ }, {
1867
+ default: g(() => [
1868
+ z("· " + C(i.value), 1)
1869
+ ]),
1870
+ _: 1
1871
+ })) : L("", !0)
1872
+ ])) : L("", !0);
1873
+ }
1874
+ }), Jn = /* @__PURE__ */ N(In, [["__scopeId", "data-v-beeee67e"]]);
1743
1875
  export {
1744
- Wt as AdminLanding,
1745
- At as AdminNav,
1746
- Vt as AdminShell,
1876
+ Dt as AdminLanding,
1877
+ Nt as AdminNav,
1878
+ Yt as AdminShell,
1747
1879
  re as HttpError,
1748
- ft as WxBackButton,
1749
- hn as WxDate,
1750
- En as WxFilterChips,
1751
- Bn as WxHelpButton,
1752
- $t as WxListScreen,
1753
- In as WxNotes,
1754
- Un as WxRenameButton,
1755
- St as WxRichTextField,
1756
- ke as WxRowMenu,
1757
- Rn as WxSaveState,
1758
- Wn as WxScreen,
1759
- xt as WxScreenHead,
1760
- _e as adminKey,
1761
- $e as adminMessages,
1762
- Tt as adminTypes,
1763
- zn as createAdmin,
1764
- Ct as createAdminContext,
1765
- Zt as createDates,
1766
- Ht as createHttp,
1767
- de as createI18n,
1768
- on as createNotesApi,
1769
- nn as errorText,
1770
- ne as i18nKey,
1771
- Lt as provideAdmin,
1772
- ct as provideI18n,
1880
+ yt as WxBackButton,
1881
+ Jn as WxBackupNote,
1882
+ We as WxDate,
1883
+ qn as WxFilterChips,
1884
+ Xn as WxHelpButton,
1885
+ At as WxListScreen,
1886
+ Gn as WxNotes,
1887
+ Yn as WxRenameButton,
1888
+ Rt as WxRichTextField,
1889
+ $e as WxRowMenu,
1890
+ Kn as WxSaveState,
1891
+ On as WxScreen,
1892
+ Lt as WxScreenHead,
1893
+ Te as adminKey,
1894
+ Ce as adminMessages,
1895
+ Et as adminTypes,
1896
+ Hn as createAdmin,
1897
+ Bt as createAdminContext,
1898
+ dn as createDates,
1899
+ Gt as createHttp,
1900
+ ce as createI18n,
1901
+ bn as createNotesApi,
1902
+ tn as createTheme,
1903
+ fn as errorText,
1904
+ ae as i18nKey,
1905
+ It as provideAdmin,
1906
+ gt as provideI18n,
1907
+ en as provideTheme,
1773
1908
  ve as readCookie,
1774
- Qt as renderMarkdown,
1775
- An as rowMenuWidth,
1776
- O as useAdmin,
1777
- en as useDates,
1778
- an as useErrorText,
1779
- Ln as useI18n,
1780
- B as useTranslate
1909
+ cn as renderMarkdown,
1910
+ jn as rowMenuWidth,
1911
+ Se as themeKey,
1912
+ V as useAdmin,
1913
+ ze as useDates,
1914
+ vn as useErrorText,
1915
+ Pn as useI18n,
1916
+ Vn as useTheme,
1917
+ I as useTranslate
1781
1918
  };
1782
1919
  //# sourceMappingURL=index.js.map