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