@webx-ui/module-admin 0.6.0 → 0.7.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,16 +1,16 @@
1
- import { defineComponent as T, useModel as se, openBlock as p, createElementBlock as y, normalizeClass as F, createBlock as b, unref as f, withCtx as w, createTextVNode as L, toDisplayString as E, createCommentVNode as z, renderSlot as S, Fragment as C, mergeModels as K, inject as V, reactive as q, computed as k, resolveComponent as $, renderList as I, ref as W, createVNode as _, createElementVNode as A, isRef as ye, createApp as be, h as P, watch as oe, withModifiers as ie, nextTick as xe, withKeys as _e } from "vue";
2
- import { useRouter as ke, useRoute as $e, createRouter as Se, createWebHistory as Te, RouterLink as Le } from "vue-router";
3
- import { WxHeading as Ee, WxTabs as ze, WxCard as ne, useResponsiveShell as Ce, shellLayoutFor as We, WxToaster as Ue, WebxUI as Ae, localesKey as Me, WxAlert as Pe, WxSkeleton as Re, WxActions as Be, WxDropdownItem as De, WxAction as G, WxPopover as Ie, WxInput as Ve, WxButton as Ne, WxDialog as je, WxTooltip as He, WxText as ae } from "@webx-ui/core";
4
- import { WxScreenRenderer as Oe } from "@webx-ui/schema";
5
- const Fe = ["data-wx-fill"], Ke = {
1
+ import { defineComponent as U, useModel as he, openBlock as f, createElementBlock as b, normalizeClass as le, createBlock as x, unref as d, withCtx as w, createTextVNode as L, toDisplayString as A, createCommentVNode as E, renderSlot as W, Fragment as R, mergeModels as se, inject as G, reactive as oe, computed as S, watch as J, resolveComponent as z, renderList as I, ref as C, createVNode as y, createElementVNode as M, isRef as $e, createApp as Se, h as O, withModifiers as pe, nextTick as Te, withKeys as ze } from "vue";
2
+ import { useRouter as ge, useRoute as Ae, createRouter as Ce, createWebHistory as Le, RouterLink as We } from "vue-router";
3
+ import { WxHeading as Ee, WxTabs as Ue, WxCard as me, WxResult as Re, useResponsiveShell as Me, shellLayoutFor as Ne, WxToaster as Pe, WebxUI as Ve, localesKey as De, WxAlert as Be, WxSkeleton as we, WxActions as Ie, WxDropdownItem as je, WxAction as ue, WxPopover as He, WxInput as Oe, WxButton as X, WxDialog as Fe, WxTooltip as Ke, WxText as Y, WxEmpty as qe, WxAvatar as Xe, WxTextarea as fe, toast as B, confirm as Ye } from "@webx-ui/core";
4
+ import { WxScreenRenderer as Ge } from "@webx-ui/schema";
5
+ const Je = ["data-wx-fill"], Qe = {
6
6
  key: 0,
7
7
  class: "wx-list-screen__head"
8
- }, qe = {
8
+ }, Ze = {
9
9
  key: 1,
10
10
  class: "wx-list-screen__actions"
11
- }, Xe = /* @__PURE__ */ T({
11
+ }, et = /* @__PURE__ */ U({
12
12
  __name: "ListScreen",
13
- props: /* @__PURE__ */ K({
13
+ props: /* @__PURE__ */ se({
14
14
  title: { default: void 0 },
15
15
  views: { default: void 0 },
16
16
  card: { type: Boolean, default: !0 },
@@ -23,160 +23,160 @@ const Fe = ["data-wx-fill"], Ke = {
23
23
  }),
24
24
  emits: ["update:view"],
25
25
  setup(e) {
26
- const t = se(e, "view");
27
- return (n, a) => (p(), y("div", {
28
- class: F(["wx-list-screen", { "is-fill": e.fill }]),
26
+ const t = he(e, "view");
27
+ return (n, a) => (f(), b("div", {
28
+ class: le(["wx-list-screen", { "is-fill": e.fill }]),
29
29
  "data-wx-fill": e.fill ? "" : void 0
30
30
  }, [
31
- e.title || n.$slots.actions ? (p(), y("div", Ke, [
32
- e.title ? (p(), b(f(Ee), {
31
+ e.title || n.$slots.actions ? (f(), b("div", Qe, [
32
+ e.title ? (f(), x(d(Ee), {
33
33
  key: 0,
34
34
  level: 2,
35
35
  class: "wx-list-screen__title"
36
36
  }, {
37
37
  default: w(() => [
38
- L(E(e.title), 1)
38
+ L(A(e.title), 1)
39
39
  ]),
40
40
  _: 1
41
- })) : z("", !0),
42
- n.$slots.actions ? (p(), y("div", qe, [
43
- S(n.$slots, "actions", {}, void 0, !0)
44
- ])) : z("", !0)
45
- ])) : z("", !0),
46
- e.views && e.views.length > 0 ? (p(), b(f(ze), {
41
+ })) : E("", !0),
42
+ n.$slots.actions ? (f(), b("div", Ze, [
43
+ W(n.$slots, "actions", {}, void 0, !0)
44
+ ])) : E("", !0)
45
+ ])) : E("", !0),
46
+ e.views && e.views.length > 0 ? (f(), x(d(Ue), {
47
47
  key: 1,
48
48
  modelValue: t.value,
49
- "onUpdate:modelValue": a[0] || (a[0] = (i) => t.value = i),
49
+ "onUpdate:modelValue": a[0] || (a[0] = (r) => t.value = r),
50
50
  class: "wx-list-screen__views",
51
51
  items: e.views,
52
52
  "collapse-below": e.collapseBelow,
53
53
  "aria-label": e.title
54
54
  }, {
55
55
  default: w(() => [
56
- e.card ? (p(), b(f(ne), {
56
+ e.card ? (f(), x(d(me), {
57
57
  key: 0,
58
58
  class: "wx-list-screen__card",
59
59
  padding: e.padding
60
60
  }, {
61
61
  default: w(() => [
62
- S(n.$slots, "default", {}, void 0, !0)
62
+ W(n.$slots, "default", {}, void 0, !0)
63
63
  ]),
64
64
  _: 3
65
- }, 8, ["padding"])) : S(n.$slots, "default", {}, void 0, !0, 1)
65
+ }, 8, ["padding"])) : W(n.$slots, "default", {}, void 0, !0, 1)
66
66
  ]),
67
67
  _: 3
68
- }, 8, ["modelValue", "items", "collapse-below", "aria-label"])) : (p(), y(C, { key: 2 }, [
69
- e.card ? (p(), b(f(ne), {
68
+ }, 8, ["modelValue", "items", "collapse-below", "aria-label"])) : (f(), b(R, { key: 2 }, [
69
+ e.card ? (f(), x(d(me), {
70
70
  key: 0,
71
71
  class: "wx-list-screen__card",
72
72
  padding: e.padding
73
73
  }, {
74
74
  default: w(() => [
75
- S(n.$slots, "default", {}, void 0, !0)
75
+ W(n.$slots, "default", {}, void 0, !0)
76
76
  ]),
77
77
  _: 3
78
- }, 8, ["padding"])) : S(n.$slots, "default", {}, void 0, !0, 1)
78
+ }, 8, ["padding"])) : W(n.$slots, "default", {}, void 0, !0, 1)
79
79
  ], 64))
80
- ], 10, Fe));
80
+ ], 10, Je));
81
81
  }
82
- }), N = (e, t) => {
82
+ }), j = (e, t) => {
83
83
  const n = e.__vccOpts || e;
84
- for (const [a, i] of t)
85
- n[a] = i;
84
+ for (const [a, r] of t)
85
+ n[a] = r;
86
86
  return n;
87
- }, Ye = /* @__PURE__ */ N(Xe, [["__scopeId", "data-v-7586ed04"]]), Ge = {
88
- "wx-list": { component: Ye, kind: "layout", labelProp: "title" }
89
- }, re = /* @__PURE__ */ Symbol("webx-admin");
90
- function J() {
91
- const e = V(re, null);
87
+ }, tt = /* @__PURE__ */ j(et, [["__scopeId", "data-v-7586ed04"]]), nt = {
88
+ "wx-list": { component: tt, kind: "layout", labelProp: "title" }
89
+ }, ye = /* @__PURE__ */ Symbol("webx-admin");
90
+ function H() {
91
+ const e = G(ye, null);
92
92
  if (e === null)
93
93
  throw new Error("useAdmin() was called outside a panel created by createAdmin().");
94
94
  return e;
95
95
  }
96
- function Je(e) {
97
- const t = q({
96
+ function at(e) {
97
+ const t = oe({
98
98
  status: "loading",
99
99
  manifest: null,
100
100
  user: null,
101
101
  error: null
102
- }), n = k(() => {
102
+ }), n = S(() => {
103
103
  const l = t.manifest;
104
104
  if (l === null)
105
105
  return [];
106
- const m = [];
106
+ const v = [];
107
107
  for (const h of l.modules) {
108
- const g = e.modules.find((x) => x.id === h.id);
108
+ const g = e.modules.find((_) => _.id === h.id);
109
109
  if (g === void 0)
110
110
  continue;
111
- const v = g.path ?? g.routes?.[0]?.path;
112
- v !== void 0 && m.push({
111
+ const p = g.path ?? g.routes?.[0]?.path;
112
+ p !== void 0 && v.push({
113
113
  id: h.id,
114
114
  title: h.title,
115
115
  icon: h.icon,
116
- path: v,
116
+ path: p,
117
117
  group: h.group ?? null
118
118
  });
119
119
  }
120
- return m;
121
- }), a = k(() => {
122
- const l = t.manifest?.groups ?? [], m = [], h = /* @__PURE__ */ new Map();
120
+ return v;
121
+ }), a = S(() => {
122
+ const l = t.manifest?.groups ?? [], v = [], h = /* @__PURE__ */ new Map();
123
123
  for (const g of n.value)
124
- if (g.group !== null && l.some((v) => v.id === g.group)) {
125
- const v = h.get(g.group) ?? [];
126
- v.push(g), h.set(g.group, v);
124
+ if (g.group !== null && l.some((p) => p.id === g.group)) {
125
+ const p = h.get(g.group) ?? [];
126
+ p.push(g), h.set(g.group, p);
127
127
  } else
128
- m.push(g);
128
+ v.push(g);
129
129
  return {
130
- top: m,
130
+ top: v,
131
131
  groups: l.filter((g) => h.has(g.id)).map((g) => ({
132
132
  id: g.id,
133
133
  title: g.title,
134
134
  entries: h.get(g.id) ?? []
135
135
  }))
136
136
  };
137
- }), i = { ...Ge };
137
+ }), r = { ...nt };
138
138
  for (const l of e.modules)
139
- Object.assign(i, l.types);
140
- Object.assign(i, e.types);
141
- const d = /* @__PURE__ */ new Map();
142
- async function o(l) {
143
- const m = `${e.i18n.state.locale}:${l}`;
144
- let h = d.get(m);
139
+ Object.assign(r, l.types);
140
+ Object.assign(r, e.types);
141
+ const o = /* @__PURE__ */ new Map();
142
+ async function s(l) {
143
+ const v = `${e.i18n.state.locale}:${l}`;
144
+ let h = o.get(v);
145
145
  return h === void 0 && (h = e.http.get(`${e.apiPath}/screens/${l}`).then((g) => g.data.root).catch((g) => {
146
- throw d.delete(m), g;
147
- }), d.set(m, h)), h;
146
+ throw o.delete(v), g;
147
+ }), o.set(v, h)), h;
148
148
  }
149
- let r = null;
150
- async function s() {
149
+ let u = null;
150
+ async function i() {
151
151
  t.status = "loading", t.error = null;
152
152
  try {
153
- if (r !== null && (t.user = await r(), t.user === null)) {
153
+ if (u !== null && (t.user = await u(), t.user === null)) {
154
154
  t.manifest = null, t.status = "unauthenticated";
155
155
  return;
156
156
  }
157
157
  const l = await e.loadManifest();
158
- t.manifest = l, e.i18n.state.contentLocales = l.locales ?? [], e.i18n.state.panelLocales = l.panelLocales ?? e.i18n.state.panelLocales, l.locale !== void 0 && l.locale !== e.i18n.state.locale && await c(l.locale), t.status = "ready";
158
+ t.manifest = l, e.i18n.state.contentLocales = l.locales ?? [], e.i18n.state.panelLocales = l.panelLocales ?? e.i18n.state.panelLocales, l.locale !== void 0 && l.locale !== e.i18n.state.locale && await m(l.locale), t.status = "ready";
159
159
  } catch (l) {
160
- if (Ze(l)) {
160
+ if (st(l)) {
161
161
  t.manifest = null, t.user = null, t.status = "unauthenticated";
162
162
  return;
163
163
  }
164
164
  t.error = l instanceof Error ? l.message : String(l), t.status = "error";
165
165
  }
166
166
  }
167
- async function u() {
167
+ async function c() {
168
168
  if (t.manifest !== null)
169
169
  try {
170
170
  t.manifest = await e.loadManifest();
171
171
  } catch {
172
172
  }
173
173
  }
174
- async function c(l) {
174
+ async function m(l) {
175
175
  if (e.loadDictionary === void 0) {
176
176
  e.i18n.state.locale = l;
177
177
  return;
178
178
  }
179
- await e.loadDictionary(l), await u();
179
+ await e.loadDictionary(l), await c();
180
180
  }
181
181
  return {
182
182
  http: e.http,
@@ -187,126 +187,149 @@ function Je(e) {
187
187
  modules: e.modules,
188
188
  nav: n,
189
189
  groups: a,
190
- types: i,
191
- reload: s,
192
- refreshManifest: u,
193
- setLocale: c,
190
+ types: r,
191
+ reload: i,
192
+ refreshManifest: c,
193
+ setLocale: m,
194
194
  setUser(l) {
195
195
  t.user = l;
196
196
  },
197
197
  useSessionLoader(l) {
198
- r = l;
198
+ u = l;
199
199
  },
200
200
  can(l) {
201
- const m = t.user;
202
- return m === null ? !1 : m.isSuper || m.permissions.includes(l);
201
+ const v = t.user;
202
+ return v === null ? !1 : v.isSuper || v.permissions.includes(l);
203
203
  },
204
- loadScreen: o,
204
+ loadScreen: s,
205
205
  screenPatch(l) {
206
206
  return e.screens?.[l] ?? [];
207
207
  }
208
208
  };
209
209
  }
210
- function Qe(e, t) {
211
- e.provide(re, t);
210
+ function lt(e, t) {
211
+ e.provide(ye, t);
212
212
  }
213
- function Ze(e) {
213
+ function st(e) {
214
214
  return typeof e == "object" && e !== null && "status" in e && e.status === 401;
215
215
  }
216
- const j = /* @__PURE__ */ Symbol("webx-i18n");
217
- function Nt() {
218
- const e = V(j, null);
216
+ const Q = /* @__PURE__ */ Symbol("webx-i18n");
217
+ function on() {
218
+ const e = G(Q, null);
219
219
  if (e === null)
220
220
  throw new Error("useI18n() was called outside a panel created by createAdmin().");
221
221
  return e;
222
222
  }
223
- function U(e) {
224
- const t = V(j, null);
225
- return t === null ? Q().scope(e) : t.scope(e);
223
+ function N(e) {
224
+ const t = G(Q, null);
225
+ return t === null ? de().scope(e) : t.scope(e);
226
226
  }
227
- function et(e, t) {
228
- e.provide(j, t);
227
+ function ot(e, t) {
228
+ e.provide(Q, t);
229
229
  }
230
- function Q(e = {}) {
231
- const t = e.fallback ?? "en", n = q({
230
+ function de(e = {}) {
231
+ const t = e.fallback ?? "en", n = oe({
232
232
  locale: e.locale ?? t,
233
233
  fallback: t,
234
234
  panelLocales: [],
235
235
  contentLocales: []
236
- }), a = {}, i = q({ value: {} });
237
- function d(r, s, u) {
238
- let c = r[s]?.[u[0] ?? ""];
239
- for (const l of u.slice(1)) {
240
- if (typeof c != "object" || c === null)
236
+ }), a = {}, r = oe({ value: {} });
237
+ function o(u, i, c) {
238
+ let m = u[i]?.[c[0] ?? ""];
239
+ for (const l of c.slice(1)) {
240
+ if (typeof m != "object" || m === null)
241
241
  return null;
242
- c = c[l];
242
+ m = m[l];
243
243
  }
244
- return typeof c == "string" ? c : null;
244
+ return typeof m == "string" ? m : null;
245
245
  }
246
- function o(r, s, u) {
247
- const [c, l] = s.includes("::") ? s.split("::", 2) : [r, s], m = l.split("."), h = d(i.value, c, m) ?? d(a, c, m) ?? // Not an empty string: a key on screen is ugly, but it says which key, and a blank
246
+ function s(u, i, c) {
247
+ const [m, l] = i.includes("::") ? i.split("::", 2) : [u, i], v = l.split("."), h = o(r.value, m, v) ?? o(a, m, v) ?? // Not an empty string: a key on screen is ugly, but it says which key, and a blank
248
248
  // label says nothing to anybody trying to fix it.
249
- s;
250
- return u === void 0 ? h : tt(h, u);
249
+ i;
250
+ return c === void 0 ? h : it(h, c);
251
251
  }
252
252
  return {
253
253
  state: n,
254
- defaults(r, s) {
255
- a[r] = { ...a[r], ...s };
254
+ defaults(u, i) {
255
+ a[u] = { ...a[u], ...i };
256
256
  },
257
- load(r, s, u) {
258
- i.value = r ?? {}, n.locale = s ?? n.locale, u !== void 0 && (n.fallback = u);
257
+ load(u, i, c) {
258
+ r.value = u ?? {}, n.locale = i ?? n.locale, c !== void 0 && (n.fallback = c);
259
259
  },
260
- scope(r) {
261
- return (s, u) => o(r, s, u);
260
+ scope(u) {
261
+ return (i, c) => s(u, i, c);
262
262
  },
263
- t: (r, s) => o("", r, s)
263
+ t: (u, i) => s("", u, i)
264
264
  };
265
265
  }
266
- function tt(e, t) {
266
+ function it(e, t) {
267
267
  let n = e;
268
- for (const [a, i] of Object.entries(t))
269
- n = n.replaceAll(`:${a}`, String(i));
268
+ for (const [a, r] of Object.entries(t))
269
+ n = n.replaceAll(`:${a}`, String(r));
270
270
  return n;
271
271
  }
272
- const nt = /* @__PURE__ */ T({
272
+ const rt = /* @__PURE__ */ U({
273
+ __name: "AdminLanding",
274
+ props: {
275
+ landing: { default: null }
276
+ },
277
+ setup(e) {
278
+ const t = e, n = H(), a = ge(), r = N("webx-admin"), o = S(() => {
279
+ const s = n.nav.value;
280
+ return s.length === 0 ? null : ((t.landing === null ? void 0 : s.find((i) => i.path === t.landing)) ?? s[0])?.path ?? null;
281
+ });
282
+ return J(
283
+ o,
284
+ (s) => {
285
+ s !== null && a.replace(s);
286
+ },
287
+ { immediate: !0 }
288
+ ), (s, u) => o.value === null && d(n).state.status === "ready" ? (f(), x(d(Re), {
289
+ key: 0,
290
+ status: "info",
291
+ title: d(r)("shell.empty-title"),
292
+ description: d(r)("shell.empty-description")
293
+ }, null, 8, ["title", "description"])) : E("", !0);
294
+ }
295
+ }), ut = /* @__PURE__ */ U({
273
296
  __name: "AdminNav",
274
297
  props: {
275
298
  collapsed: { type: Boolean }
276
299
  },
277
300
  emits: ["select"],
278
301
  setup(e, { emit: t }) {
279
- const n = t, a = J(), i = U("webx-admin"), d = ke(), o = $e(), r = k({
280
- get: () => a.nav.value.find((u) => o.path.startsWith(u.path))?.id ?? "",
281
- set: (s) => {
282
- const u = a.nav.value.find((c) => c.id === s);
283
- u !== void 0 && d.push(u.path);
302
+ const n = t, a = H(), r = N("webx-admin"), o = ge(), s = Ae(), u = S({
303
+ get: () => a.nav.value.find((c) => s.path.startsWith(c.path))?.id ?? "",
304
+ set: (i) => {
305
+ const c = a.nav.value.find((m) => m.id === i);
306
+ c !== void 0 && o.push(c.path);
284
307
  }
285
308
  });
286
- return (s, u) => {
287
- const c = $("wx-menu-item"), l = $("wx-submenu"), m = $("wx-menu");
288
- return p(), b(m, {
289
- modelValue: r.value,
290
- "onUpdate:modelValue": u[0] || (u[0] = (h) => r.value = h),
309
+ return (i, c) => {
310
+ const m = z("wx-menu-item"), l = z("wx-submenu"), v = z("wx-menu");
311
+ return f(), x(v, {
312
+ modelValue: u.value,
313
+ "onUpdate:modelValue": c[0] || (c[0] = (h) => u.value = h),
291
314
  collapsed: e.collapsed,
292
- label: f(i)("nav.sections"),
293
- onSelect: u[1] || (u[1] = (h) => n("select"))
315
+ label: d(r)("nav.sections"),
316
+ onSelect: c[1] || (c[1] = (h) => n("select"))
294
317
  }, {
295
318
  default: w(() => [
296
- (p(!0), y(C, null, I(f(a).groups.value.top, (h) => (p(), b(c, {
319
+ (f(!0), b(R, null, I(d(a).groups.value.top, (h) => (f(), x(m, {
297
320
  key: h.id,
298
321
  value: h.id,
299
322
  icon: h.icon ?? void 0,
300
323
  label: h.title
301
324
  }, null, 8, ["value", "icon", "label"]))), 128)),
302
- (p(!0), y(C, null, I(f(a).groups.value.groups, (h) => (p(), b(l, {
325
+ (f(!0), b(R, null, I(d(a).groups.value.groups, (h) => (f(), x(l, {
303
326
  key: h.id,
304
327
  value: `group:${h.id}`,
305
328
  title: h.title,
306
329
  icon: "gear"
307
330
  }, {
308
331
  default: w(() => [
309
- (p(!0), y(C, null, I(h.entries, (g) => (p(), b(c, {
332
+ (f(!0), b(R, null, I(h.entries, (g) => (f(), x(m, {
310
333
  key: g.id,
311
334
  value: g.id,
312
335
  icon: g.icon ?? void 0,
@@ -320,64 +343,64 @@ const nt = /* @__PURE__ */ T({
320
343
  }, 8, ["modelValue", "collapsed", "label"]);
321
344
  };
322
345
  }
323
- }), at = {
346
+ }), dt = {
324
347
  key: 0,
325
348
  class: "wx-root wx-admin-plain"
326
- }, lt = {
349
+ }, ct = {
327
350
  key: 1,
328
351
  class: "wx-root wx-admin-plain"
329
- }, st = {
352
+ }, mt = {
330
353
  key: 2,
331
354
  class: "wx-root wx-admin-plain"
332
- }, ot = ["src", "alt", "width", "height"], it = ["src", "alt", "width", "height"], rt = ["src", "alt"], ut = { class: "wx-admin__user" }, dt = { class: "wx-admin__user wx-admin__user--drawer" }, ct = /* @__PURE__ */ T({
355
+ }, ft = ["src", "alt", "width", "height"], vt = ["src", "alt", "width", "height"], ht = ["src", "alt"], pt = { class: "wx-admin__user" }, gt = { class: "wx-admin__user wx-admin__user--drawer" }, wt = /* @__PURE__ */ U({
333
356
  __name: "AdminShell",
334
357
  setup(e) {
335
- const t = J(), n = U("webx-admin"), a = W(null), { width: i, layout: d, collapsed: o, showAside: r, drawerOpen: s, toggle: u, close: c } = Ce(
358
+ const t = H(), n = N("webx-admin"), a = C(null), { width: r, layout: o, collapsed: s, showAside: u, drawerOpen: i, toggle: c, close: m } = Me(
336
359
  a,
337
360
  { persist: "webx-admin-shell" }
338
- ), l = k(() => t.state.manifest?.title ?? ""), m = k(() => t.state.manifest?.branding?.logo ?? null), h = k(() => t.state.manifest?.branding?.mark ?? null), g = k(() => We(i.value, null));
339
- return (v, x) => {
340
- const M = $("router-view"), ce = $("wx-loading"), fe = $("wx-button"), me = $("wx-result"), Z = $("wx-action"), ee = $("wx-text"), he = $("wx-header"), pe = $("wx-aside"), ve = $("wx-main"), ge = $("wx-container"), we = $("wx-drawer");
341
- return p(), y(C, null, [
342
- _(f(Ue)),
343
- f(t).state.status === "unauthenticated" ? (p(), y("div", at, [
344
- _(M)
345
- ])) : f(t).state.status === "loading" ? (p(), y("div", lt, [
346
- _(ce, {
347
- label: f(n)("shell.loading")
361
+ ), l = S(() => t.state.manifest?.title ?? ""), v = S(() => t.state.manifest?.branding?.logo ?? null), h = S(() => t.state.manifest?.branding?.mark ?? null), g = S(() => Ne(r.value, null));
362
+ return (p, _) => {
363
+ const V = z("router-view"), Z = z("wx-loading"), ee = z("wx-button"), te = z("wx-result"), D = z("wx-action"), k = z("wx-text"), T = z("wx-header"), $ = z("wx-aside"), P = z("wx-main"), _e = z("wx-container"), ke = z("wx-drawer");
364
+ return f(), b(R, null, [
365
+ y(d(Pe)),
366
+ d(t).state.status === "unauthenticated" ? (f(), b("div", dt, [
367
+ y(V)
368
+ ])) : d(t).state.status === "loading" ? (f(), b("div", ct, [
369
+ y(Z, {
370
+ label: d(n)("shell.loading")
348
371
  }, null, 8, ["label"])
349
- ])) : f(t).state.status === "error" ? (p(), y("div", st, [
350
- _(me, {
372
+ ])) : d(t).state.status === "error" ? (f(), b("div", mt, [
373
+ y(te, {
351
374
  status: "error",
352
- title: f(n)("shell.error-title"),
353
- description: f(t).state.error
375
+ title: d(n)("shell.error-title"),
376
+ description: d(t).state.error
354
377
  }, {
355
378
  default: w(() => [
356
- _(fe, {
379
+ y(ee, {
357
380
  type: "primary",
358
- onClick: x[0] || (x[0] = (te) => f(t).reload())
381
+ onClick: _[0] || (_[0] = (ce) => d(t).reload())
359
382
  }, {
360
383
  default: w(() => [
361
- L(E(f(n)("shell.retry")), 1)
384
+ L(A(d(n)("shell.retry")), 1)
362
385
  ]),
363
386
  _: 1
364
387
  })
365
388
  ]),
366
389
  _: 1
367
390
  }, 8, ["title", "description"])
368
- ])) : (p(), y("div", {
391
+ ])) : (f(), b("div", {
369
392
  key: 3,
370
393
  ref_key: "shellEl",
371
394
  ref: a,
372
- class: F(["wx-root wx-admin", `wx-admin--${g.value}`])
395
+ class: le(["wx-root wx-admin", `wx-admin--${g.value}`])
373
396
  }, [
374
- _(ge, {
375
- direction: f(d) === "drawer" ? "vertical" : "horizontal",
397
+ y(_e, {
398
+ direction: d(o) === "drawer" ? "vertical" : "horizontal",
376
399
  "full-height": "",
377
400
  class: "wx-admin__frame"
378
401
  }, {
379
402
  default: w(() => [
380
- f(d) === "drawer" ? (p(), b(he, {
403
+ d(o) === "drawer" ? (f(), x(T, {
381
404
  key: 0,
382
405
  class: "wx-admin__header",
383
406
  floating: "",
@@ -387,125 +410,125 @@ const nt = /* @__PURE__ */ T({
387
410
  height: "var(--wx-admin-header-height)"
388
411
  }, {
389
412
  end: w(() => [
390
- S(v.$slots, "user", { expanded: !1 }, void 0, !0)
413
+ W(p.$slots, "user", { expanded: !1 }, void 0, !0)
391
414
  ]),
392
415
  default: w(() => [
393
- _(Z, {
416
+ y(D, {
394
417
  icon: "menu",
395
- title: f(n)("nav.menu"),
396
- onClick: f(u)
418
+ title: d(n)("nav.menu"),
419
+ onClick: d(c)
397
420
  }, null, 8, ["title", "onClick"]),
398
- S(v.$slots, "brand", {}, () => [
399
- m.value ? (p(), y("img", {
421
+ W(p.$slots, "brand", {}, () => [
422
+ v.value ? (f(), b("img", {
400
423
  key: 0,
401
424
  class: "wx-admin__logo",
402
- src: m.value.url,
425
+ src: v.value.url,
403
426
  alt: l.value,
404
- width: m.value.width ?? void 0,
405
- height: m.value.height ?? void 0
406
- }, null, 8, ot)) : (p(), b(ee, {
427
+ width: v.value.width ?? void 0,
428
+ height: v.value.height ?? void 0
429
+ }, null, 8, ft)) : (f(), x(k, {
407
430
  key: 1,
408
431
  weight: "semibold",
409
432
  truncate: ""
410
433
  }, {
411
434
  default: w(() => [
412
- L(E(l.value), 1)
435
+ L(A(l.value), 1)
413
436
  ]),
414
437
  _: 1
415
438
  }))
416
439
  ], !0)
417
440
  ]),
418
441
  _: 3
419
- })) : z("", !0),
420
- f(r) ? (p(), b(pe, {
442
+ })) : E("", !0),
443
+ d(u) ? (f(), x($, {
421
444
  key: 1,
422
445
  class: "wx-admin__aside",
423
446
  sticky: "",
424
447
  floating: "",
425
448
  scroll: "",
426
449
  bordered: !1,
427
- collapsed: f(o),
450
+ collapsed: d(s),
428
451
  width: 220,
429
452
  "collapsed-width": 56
430
453
  }, {
431
454
  top: w(() => [
432
- A("div", {
433
- class: F(["wx-admin__brand", { "wx-admin__brand--stacked": f(o) && h.value }])
455
+ M("div", {
456
+ class: le(["wx-admin__brand", { "wx-admin__brand--stacked": d(s) && h.value }])
434
457
  }, [
435
- f(o) ? h.value ? (p(), y("img", {
458
+ d(s) ? h.value ? (f(), b("img", {
436
459
  key: 1,
437
460
  class: "wx-admin__mark",
438
461
  src: h.value.url,
439
462
  alt: l.value
440
- }, null, 8, rt)) : z("", !0) : S(v.$slots, "brand", {}, () => [
441
- m.value ? (p(), y("img", {
463
+ }, null, 8, ht)) : E("", !0) : W(p.$slots, "brand", {}, () => [
464
+ v.value ? (f(), b("img", {
442
465
  key: 0,
443
466
  class: "wx-admin__logo",
444
- src: m.value.url,
467
+ src: v.value.url,
445
468
  alt: l.value,
446
- width: m.value.width ?? void 0,
447
- height: m.value.height ?? void 0
448
- }, null, 8, it)) : (p(), b(ee, {
469
+ width: v.value.width ?? void 0,
470
+ height: v.value.height ?? void 0
471
+ }, null, 8, vt)) : (f(), x(k, {
449
472
  key: 1,
450
473
  weight: "semibold",
451
474
  truncate: "",
452
475
  class: "wx-admin__title"
453
476
  }, {
454
477
  default: w(() => [
455
- L(E(l.value), 1)
478
+ L(A(l.value), 1)
456
479
  ]),
457
480
  _: 1
458
481
  }))
459
482
  ], !0, 0),
460
- _(Z, {
483
+ y(D, {
461
484
  icon: "sidebar",
462
- title: f(o) ? f(n)("nav.expand") : f(n)("nav.collapse"),
463
- onClick: f(u)
485
+ title: d(s) ? d(n)("nav.expand") : d(n)("nav.collapse"),
486
+ onClick: d(c)
464
487
  }, null, 8, ["title", "onClick"])
465
488
  ], 2)
466
489
  ]),
467
490
  bottom: w(() => [
468
- A("div", ut, [
469
- S(v.$slots, "user", {
470
- expanded: !f(o)
491
+ M("div", pt, [
492
+ W(p.$slots, "user", {
493
+ expanded: !d(s)
471
494
  }, void 0, !0)
472
495
  ])
473
496
  ]),
474
497
  default: w(() => [
475
- S(v.$slots, "nav", { collapsed: f(o) }, void 0, !0)
498
+ W(p.$slots, "nav", { collapsed: d(s) }, void 0, !0)
476
499
  ]),
477
500
  _: 3
478
- }, 8, ["collapsed"])) : z("", !0),
479
- _(ve, {
501
+ }, 8, ["collapsed"])) : E("", !0),
502
+ y(P, {
480
503
  padding: "none",
481
504
  class: "wx-admin__screen"
482
505
  }, {
483
506
  default: w(() => [
484
- _(M)
507
+ y(V)
485
508
  ]),
486
509
  _: 1
487
510
  })
488
511
  ]),
489
512
  _: 3
490
513
  }, 8, ["direction"]),
491
- _(we, {
492
- open: f(s),
493
- "onUpdate:open": x[1] || (x[1] = (te) => ye(s) ? s.value = te : null),
494
- title: l.value === "" ? f(n)("nav.menu") : l.value,
514
+ y(ke, {
515
+ open: d(i),
516
+ "onUpdate:open": _[1] || (_[1] = (ce) => $e(i) ? i.value = ce : null),
517
+ title: l.value === "" ? d(n)("nav.menu") : l.value,
495
518
  side: "left",
496
519
  size: 260,
497
520
  "full-screen": !1,
498
521
  closable: ""
499
522
  }, {
500
523
  footer: w(() => [
501
- A("div", dt, [
502
- S(v.$slots, "user", { expanded: !0 }, void 0, !0)
524
+ M("div", gt, [
525
+ W(p.$slots, "user", { expanded: !0 }, void 0, !0)
503
526
  ])
504
527
  ]),
505
528
  default: w(() => [
506
- S(v.$slots, "nav", {
529
+ W(p.$slots, "nav", {
507
530
  collapsed: !1,
508
- select: f(c)
531
+ select: d(m)
509
532
  }, void 0, !0)
510
533
  ]),
511
534
  _: 3
@@ -514,10 +537,10 @@ const nt = /* @__PURE__ */ T({
514
537
  ], 64);
515
538
  };
516
539
  }
517
- }), ft = /* @__PURE__ */ N(ct, [["__scopeId", "data-v-ebc6adf3"]]);
518
- class X extends Error {
519
- constructor(t, n, a = {}, i = null, d = null) {
520
- super(t), this.status = n, this.errors = a, this.retryAfter = i, this.body = d, this.name = "HttpError";
540
+ }), yt = /* @__PURE__ */ j(wt, [["__scopeId", "data-v-ebc6adf3"]]);
541
+ class ie extends Error {
542
+ constructor(t, n, a = {}, r = null, o = null) {
543
+ super(t), this.status = n, this.errors = a, this.retryAfter = r, this.body = o, this.name = "HttpError";
521
544
  }
522
545
  status;
523
546
  errors;
@@ -534,76 +557,76 @@ class X extends Error {
534
557
  return this.status === 429;
535
558
  }
536
559
  }
537
- const mt = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
538
- function ht(e = {}) {
539
- const t = (e.baseUrl ?? "").replace(/\/$/, ""), n = e.csrfUrl ?? "/sanctum/csrf-cookie", a = e.fetch ?? globalThis.fetch.bind(globalThis), i = e.onUnauthenticated, d = e.headers;
540
- let o = !1;
541
- async function r(u = !1) {
542
- o && !u && le("XSRF-TOKEN") !== null || (await a(n, { credentials: "same-origin" }), o = !0);
560
+ const bt = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
561
+ function xt(e = {}) {
562
+ const t = (e.baseUrl ?? "").replace(/\/$/, ""), n = e.csrfUrl ?? "/sanctum/csrf-cookie", a = e.fetch ?? globalThis.fetch.bind(globalThis), r = e.onUnauthenticated, o = e.headers;
563
+ let s = !1;
564
+ async function u(c = !1) {
565
+ s && !c && ve("XSRF-TOKEN") !== null || (await a(n, { credentials: "same-origin" }), s = !0);
543
566
  }
544
- async function s(u, c, l, m = {}, h = !1) {
545
- const g = mt.has(u);
546
- g && await r();
547
- const v = {
567
+ async function i(c, m, l, v = {}, h = !1) {
568
+ const g = bt.has(c);
569
+ g && await u();
570
+ const p = {
548
571
  Accept: "application/json",
549
572
  "X-Requested-With": "XMLHttpRequest",
550
573
  // Standing headers first, so a caller can still override one for a single request.
551
- ...d?.(),
552
- ...m.headers
574
+ ...o?.(),
575
+ ...v.headers
553
576
  };
554
577
  if (g) {
555
- const M = le("XSRF-TOKEN");
556
- M !== null && (v["X-XSRF-TOKEN"] = M);
578
+ const V = ve("XSRF-TOKEN");
579
+ V !== null && (p["X-XSRF-TOKEN"] = V);
557
580
  }
558
- l !== void 0 && (v["Content-Type"] = "application/json");
559
- const x = await a(vt(t, c, m.query), {
560
- method: u,
581
+ l !== void 0 && (p["Content-Type"] = "application/json");
582
+ const _ = await a(kt(t, m, v.query), {
583
+ method: c,
561
584
  credentials: "same-origin",
562
- headers: v,
563
- signal: m.signal,
585
+ headers: p,
586
+ signal: v.signal,
564
587
  body: l === void 0 ? void 0 : JSON.stringify(l)
565
588
  });
566
- if (x.status === 419 && g && !h)
567
- return await r(!0), s(u, c, l, m, !0);
568
- if (x.status === 401 && i?.(), !x.ok)
569
- throw await pt(x);
570
- if (x.status !== 204)
571
- return await x.json();
589
+ if (_.status === 419 && g && !h)
590
+ return await u(!0), i(c, m, l, v, !0);
591
+ if (_.status === 401 && r?.(), !_.ok)
592
+ throw await _t(_);
593
+ if (_.status !== 204)
594
+ return await _.json();
572
595
  }
573
596
  return {
574
- get: (u, c) => s("GET", u, void 0, c),
575
- post: (u, c, l) => s("POST", u, c, l),
576
- put: (u, c, l) => s("PUT", u, c, l),
577
- patch: (u, c, l) => s("PATCH", u, c, l),
578
- delete: (u, c) => s("DELETE", u, void 0, c)
597
+ get: (c, m) => i("GET", c, void 0, m),
598
+ post: (c, m, l) => i("POST", c, m, l),
599
+ put: (c, m, l) => i("PUT", c, m, l),
600
+ patch: (c, m, l) => i("PATCH", c, m, l),
601
+ delete: (c, m) => i("DELETE", c, void 0, m)
579
602
  };
580
603
  }
581
- async function pt(e) {
604
+ async function _t(e) {
582
605
  let t = null;
583
606
  try {
584
607
  t = await e.json();
585
608
  } catch {
586
609
  }
587
- 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 : {}, d = e.headers.get("Retry-After"), o = d === null ? null : Number.parseInt(d, 10);
588
- return new X(
610
+ const n = t ?? {}, a = typeof n.message == "string" && n.message !== "" ? n.message : e.statusText || `Request failed with ${e.status}`, r = n.errors !== null && typeof n.errors == "object" ? n.errors : {}, o = e.headers.get("Retry-After"), s = o === null ? null : Number.parseInt(o, 10);
611
+ return new ie(
589
612
  a,
590
613
  e.status,
591
- i,
592
- Number.isFinite(o) ? o : null,
614
+ r,
615
+ Number.isFinite(s) ? s : null,
593
616
  t
594
617
  );
595
618
  }
596
- function vt(e, t, n) {
597
- const i = /^https?:\/\//i.test(t) ? t : `${e}/${t.replace(/^\//, "")}`;
619
+ function kt(e, t, n) {
620
+ const r = /^https?:\/\//i.test(t) ? t : `${e}/${t.replace(/^\//, "")}`;
598
621
  if (n === void 0)
599
- return i;
600
- const d = new URLSearchParams();
601
- for (const [r, s] of Object.entries(n))
602
- s != null && d.set(r, String(s));
603
- const o = d.toString();
604
- return o === "" ? i : `${i}${i.includes("?") ? "&" : "?"}${o}`;
622
+ return r;
623
+ const o = new URLSearchParams();
624
+ for (const [u, i] of Object.entries(n))
625
+ i != null && o.set(u, String(i));
626
+ const s = o.toString();
627
+ return s === "" ? r : `${r}${r.includes("?") ? "&" : "?"}${s}`;
605
628
  }
606
- function le(e) {
629
+ function ve(e) {
607
630
  if (typeof document > "u")
608
631
  return null;
609
632
  for (const t of document.cookie.split(";")) {
@@ -613,7 +636,7 @@ function le(e) {
613
636
  }
614
637
  return null;
615
638
  }
616
- const ue = {
639
+ const be = {
617
640
  shell: {
618
641
  loading: "Loading the panel…",
619
642
  "error-title": "The panel could not start",
@@ -663,189 +686,221 @@ const ue = {
663
686
  server: "The server could not do that. Try again in a moment.",
664
687
  offline: "The server did not answer. Check the connection and try again.",
665
688
  unknown: "That did not work."
689
+ },
690
+ // What one administrator writes on a record for the next one. Not the property of any
691
+ // section: the same feed hangs off a submission, an order and a client, so the words are
692
+ // the panel's own.
693
+ notes: {
694
+ title: "Notes",
695
+ placeholder: "A note for whoever picks this up next…",
696
+ add: "Add a note",
697
+ empty: "No notes yet.",
698
+ edit: "Edit",
699
+ delete: "Delete",
700
+ save: "Save",
701
+ cancel: "Cancel",
702
+ saved: "Saved.",
703
+ deleted: "Deleted.",
704
+ "delete-title": "Delete this note?",
705
+ "delete-text": "It goes for everybody. This cannot be undone.",
706
+ "unknown-author": "A deleted account",
707
+ // The three the server says and the browser only ever repeats.
708
+ "no-type": "That kind of record does not carry notes.",
709
+ missing: "That record no longer exists.",
710
+ forbidden: "You may not read the notes of this record.",
711
+ "not-yours": "A note is edited by whoever wrote it."
666
712
  }
667
- }, de = "webx.locale";
668
- function jt(e = {}) {
669
- const t = e.manifestUrl ?? _t() ?? "/api/cms/manifest", n = e.apiPath ?? t.replace(/\/manifest\/?$/, ""), a = e.basePath ?? "/cms", i = e.modules ?? [], d = [...e.routes ?? []];
670
- for (const v of i)
671
- d.push(...v.routes ?? []);
672
- const o = Se({
673
- history: Te(a),
674
- routes: d
675
- }), r = Q({ locale: e.locale ?? wt() }), s = e.http ?? ht({
713
+ }, xe = "webx.locale";
714
+ function rn(e = {}) {
715
+ const t = e.manifestUrl ?? Ct() ?? "/api/cms/manifest", n = e.apiPath ?? t.replace(/\/manifest\/?$/, ""), a = e.basePath ?? "/cms", r = e.modules ?? [], o = [...e.routes ?? []];
716
+ for (const p of r)
717
+ o.push(...p.routes ?? []);
718
+ if (!o.some((p) => p.path === "/")) {
719
+ const p = r.find((_) => _.landing === !0);
720
+ o.push({
721
+ path: "/",
722
+ name: "webx.home",
723
+ component: rt,
724
+ props: { landing: p?.path ?? p?.routes?.[0]?.path ?? null }
725
+ });
726
+ }
727
+ const s = Ce({
728
+ history: Le(a),
729
+ routes: o
730
+ }), u = de({ locale: e.locale ?? St() }), i = e.http ?? xt({
676
731
  baseUrl: "",
677
732
  onUnauthenticated: () => {
678
- c.setUser(null), c.state.status = "unauthenticated";
733
+ m.setUser(null), m.state.status = "unauthenticated";
679
734
  },
680
735
  // Every request says which language the panel is currently showing. It decides what
681
736
  // the server writes its own messages in — a 422 under a field — for anybody who has
682
737
  // not stored a preference yet, which is everybody until they choose one. Without it,
683
738
  // signing in on a Russian sign-in screen lands in an English panel.
684
- headers: () => ({ "X-Webx-Locale": r.state.locale })
739
+ headers: () => ({ "X-Webx-Locale": u.state.locale })
685
740
  });
686
- r.defaults("webx-admin", ue);
687
- async function u(v) {
688
- const x = await s.get(`${n}/translations/${v}`);
689
- r.load(x.data.namespaces, x.data.locale, x.data.fallback), yt(x.data.locale), xt(x.data.locale, r.state.panelLocales);
741
+ u.defaults("webx-admin", be);
742
+ async function c(p) {
743
+ const _ = await i.get(`${n}/translations/${p}`);
744
+ u.load(_.data.namespaces, _.data.locale, _.data.fallback), Tt(_.data.locale), At(_.data.locale, u.state.panelLocales);
690
745
  }
691
- const c = Je({
692
- http: s,
746
+ const m = at({
747
+ http: i,
693
748
  basePath: a,
694
749
  apiPath: n,
695
- modules: i,
696
- i18n: r,
697
- loadDictionary: u,
750
+ modules: r,
751
+ i18n: u,
752
+ loadDictionary: c,
698
753
  types: e.types,
699
754
  screens: e.screens,
700
- loadManifest: async () => (await s.get(t)).data
701
- }), l = be(gt(e));
702
- l.use(Ae), Qe(l, c), et(l, r);
703
- const m = W("");
704
- l.provide(Me, {
705
- list: k(
706
- () => r.state.contentLocales.map((v) => ({
707
- code: v.code,
708
- label: v.code.toUpperCase()
755
+ loadManifest: async () => (await i.get(t)).data
756
+ }), l = Se($t(e));
757
+ l.use(Ve), lt(l, m), ot(l, u);
758
+ const v = C("");
759
+ l.provide(De, {
760
+ list: S(
761
+ () => u.state.contentLocales.map((p) => ({
762
+ code: p.code,
763
+ label: p.code.toUpperCase()
709
764
  }))
710
765
  ),
711
- active: k({
712
- get: () => m.value || (r.state.contentLocales[0]?.code ?? ""),
713
- set: (v) => {
714
- m.value = v;
766
+ active: S({
767
+ get: () => v.value || (u.state.contentLocales[0]?.code ?? ""),
768
+ set: (p) => {
769
+ v.value = p;
715
770
  }
716
771
  })
717
772
  });
718
773
  const h = {
719
774
  app: l,
720
- router: o,
721
- context: c,
722
- i18n: r,
775
+ router: s,
776
+ context: m,
777
+ i18n: u,
723
778
  async mount() {
724
- await Promise.all([g(), u(r.state.locale)]).catch(() => {
725
- }), l.mount(e.el ?? "#webx-app"), await c.reload();
779
+ await Promise.all([g(), c(u.state.locale)]).catch(() => {
780
+ }), l.mount(e.el ?? "#webx-app"), await m.reload();
726
781
  }
727
782
  };
728
783
  async function g() {
729
- const v = await s.get(`${n}/locales`);
730
- r.state.panelLocales = v.data.panel, r.state.contentLocales = v.data.content;
784
+ const p = await i.get(`${n}/locales`);
785
+ u.state.panelLocales = p.data.panel, u.state.contentLocales = p.data.content;
731
786
  }
732
- for (const v of e.plugins ?? [])
733
- v.install(h);
734
- return l.use(o), h;
787
+ for (const p of e.plugins ?? [])
788
+ p.install(h);
789
+ return l.use(s), h;
735
790
  }
736
- function gt(e) {
791
+ function $t(e) {
737
792
  const t = {
738
793
  // The menu is the panel's own: it is the manifest, drawn.
739
794
  // The shell hands in what a choice means where it drew the menu — in the drawer it is what
740
795
  // closes it, and a drawer that stays open over the section it just opened is a drawer the
741
796
  // reader has to dismiss by hand.
742
- nav: (n) => P(nt, { collapsed: n.collapsed === !0, onSelect: n.select })
797
+ nav: (n) => O(ut, { collapsed: n.collapsed === !0, onSelect: n.select })
743
798
  };
744
- return e.brand !== void 0 && (t.brand = () => P(e.brand)), e.userMenu !== void 0 && (t.user = (n) => P(e.userMenu, { expanded: n.expanded === !0 })), { render: () => P(ft, null, t) };
799
+ return e.brand !== void 0 && (t.brand = () => O(e.brand)), e.userMenu !== void 0 && (t.user = (n) => O(e.userMenu, { expanded: n.expanded === !0 })), { render: () => O(yt, null, t) };
745
800
  }
746
- function wt() {
747
- const e = bt(de);
801
+ function St() {
802
+ const e = zt(xe);
748
803
  return e !== null ? e : typeof document < "u" && document.documentElement.lang !== "" ? document.documentElement.lang : typeof navigator > "u" ? "en" : navigator.language;
749
804
  }
750
- function yt(e) {
805
+ function Tt(e) {
751
806
  try {
752
- localStorage.setItem(de, e);
807
+ localStorage.setItem(xe, e);
753
808
  } catch {
754
809
  }
755
810
  }
756
- function bt(e) {
811
+ function zt(e) {
757
812
  try {
758
813
  return localStorage.getItem(e);
759
814
  } catch {
760
815
  return null;
761
816
  }
762
817
  }
763
- function xt(e, t) {
818
+ function At(e, t) {
764
819
  typeof document > "u" || (document.documentElement.lang = e, document.documentElement.dir = t.find((n) => n.code === e)?.direction ?? "ltr");
765
820
  }
766
- function _t() {
821
+ function Ct() {
767
822
  return typeof document > "u" ? null : document.querySelector('meta[name="webx-manifest"]')?.getAttribute("content") ?? null;
768
823
  }
769
- function kt(e) {
824
+ function Lt(e) {
770
825
  const t = e.replace(/\r\n?/g, `
771
826
  `).split(`
772
827
  `), n = [];
773
828
  let a = 0;
774
829
  for (; a < t.length; ) {
775
- const i = t[a] ?? "";
776
- if (i.trim() === "") {
830
+ const r = t[a] ?? "";
831
+ if (r.trim() === "") {
777
832
  a += 1;
778
833
  continue;
779
834
  }
780
- if (/^```([\w-]*)\s*$/.exec(i)) {
781
- const s = [];
835
+ if (/^```([\w-]*)\s*$/.exec(r)) {
836
+ const i = [];
782
837
  for (a += 1; a < t.length && !/^```\s*$/.test(t[a] ?? ""); )
783
- s.push(t[a] ?? ""), a += 1;
784
- a += 1, n.push(`<pre><code>${Y(s.join(`
838
+ i.push(t[a] ?? ""), a += 1;
839
+ a += 1, n.push(`<pre><code>${re(i.join(`
785
840
  `))}</code></pre>`);
786
841
  continue;
787
842
  }
788
- const o = /^(#{1,4})\s+(.*)$/.exec(i);
789
- if (o) {
790
- const s = Math.min(o[1].length + 1, 5);
791
- n.push(`<h${s}>${H(o[2] ?? "")}</h${s}>`), a += 1;
843
+ const s = /^(#{1,4})\s+(.*)$/.exec(r);
844
+ if (s) {
845
+ const i = Math.min(s[1].length + 1, 5);
846
+ n.push(`<h${i}>${ne(s[2] ?? "")}</h${i}>`), a += 1;
792
847
  continue;
793
848
  }
794
- if (B(i)) {
795
- const s = /^\s*\d+[.)]\s+/.test(i), u = [];
796
- for (; a < t.length && B(t[a] ?? ""); )
797
- for (u.push((t[a] ?? "").replace(/^\s*(?:[-*+]|\d+[.)])\s+/, "")), a += 1; a < t.length; ) {
849
+ if (K(r)) {
850
+ const i = /^\s*\d+[.)]\s+/.test(r), c = [];
851
+ for (; a < t.length && K(t[a] ?? ""); )
852
+ for (c.push((t[a] ?? "").replace(/^\s*(?:[-*+]|\d+[.)])\s+/, "")), a += 1; a < t.length; ) {
798
853
  const l = t[a] ?? "";
799
- if (l.trim() === "" || B(l) || /^(#{1,4})\s/.test(l) || /^```/.test(l))
854
+ if (l.trim() === "" || K(l) || /^(#{1,4})\s/.test(l) || /^```/.test(l))
800
855
  break;
801
- u[u.length - 1] += ` ${l.trim()}`, a += 1;
856
+ c[c.length - 1] += ` ${l.trim()}`, a += 1;
802
857
  }
803
- const c = s ? "ol" : "ul";
804
- n.push(`<${c}>${u.map((l) => `<li>${H(l)}</li>`).join("")}</${c}>`);
858
+ const m = i ? "ol" : "ul";
859
+ n.push(`<${m}>${c.map((l) => `<li>${ne(l)}</li>`).join("")}</${m}>`);
805
860
  continue;
806
861
  }
807
- const r = [];
862
+ const u = [];
808
863
  for (; a < t.length; ) {
809
- const s = t[a] ?? "";
810
- if (s.trim() === "" || B(s) || /^(#{1,4})\s/.test(s) || /^```/.test(s)) break;
811
- r.push(s.trim()), a += 1;
864
+ const i = t[a] ?? "";
865
+ if (i.trim() === "" || K(i) || /^(#{1,4})\s/.test(i) || /^```/.test(i)) break;
866
+ u.push(i.trim()), a += 1;
812
867
  }
813
- n.push(`<p>${H(r.join(" "))}</p>`);
868
+ n.push(`<p>${ne(u.join(" "))}</p>`);
814
869
  }
815
870
  return n.join("");
816
871
  }
817
- const R = "\0";
818
- function B(e) {
872
+ const F = "\0";
873
+ function K(e) {
819
874
  return /^\s*(?:[-*+]|\d+[.)])\s+/.test(e);
820
875
  }
821
- function H(e) {
822
- const t = [], n = e.replace(/`([^`]+)`/g, (i, d) => (t.push(`<code>${Y(d)}</code>`), `${R}${t.length - 1}${R}`));
823
- return Y(n).replace(
876
+ function ne(e) {
877
+ const t = [], n = e.replace(/`([^`]+)`/g, (r, o) => (t.push(`<code>${re(o)}</code>`), `${F}${t.length - 1}${F}`));
878
+ return re(n).replace(
824
879
  /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,
825
880
  '<a href="$2" target="_blank" rel="noopener">$1</a>'
826
881
  ).replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(
827
- new RegExp(`${R}(\\d+)${R}`, "g"),
828
- (i, d) => t[Number(d)] ?? ""
882
+ new RegExp(`${F}(\\d+)${F}`, "g"),
883
+ (r, o) => t[Number(o)] ?? ""
829
884
  );
830
885
  }
831
- function Y(e) {
886
+ function re(e) {
832
887
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
833
888
  }
834
- function $t(e) {
889
+ function Wt(e) {
835
890
  const t = e.scope("webx-admin"), n = /* @__PURE__ */ new Map();
836
- function a(d, o, r) {
837
- const s = e.state.locale, u = `${s}:${d}`;
838
- let c = n.get(u);
839
- return c === void 0 && (c = new Intl.DateTimeFormat(s, o), n.set(u, c)), c.format(r);
891
+ function a(o, s, u) {
892
+ const i = e.state.locale, c = `${i}:${o}`;
893
+ let m = n.get(c);
894
+ return m === void 0 && (m = new Intl.DateTimeFormat(i, s), n.set(c, m)), m.format(u);
840
895
  }
841
- const i = (d) => a("time", { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }, d);
896
+ const r = (o) => a("time", { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }, o);
842
897
  return {
843
- short(d) {
844
- const o = O(d);
845
- if (o === null)
898
+ short(o) {
899
+ const s = ae(o);
900
+ if (s === null)
846
901
  return t("dates.never");
847
- const r = /* @__PURE__ */ new Date(), s = Lt(o, r);
848
- return s === 0 ? t("dates.today", { time: i(o) }) : s === -1 ? t("dates.yesterday", { time: i(o) }) : o.getFullYear() === r.getFullYear() ? a(
902
+ const u = /* @__PURE__ */ new Date(), i = Rt(s, u);
903
+ return i === 0 ? t("dates.today", { time: r(s) }) : i === -1 ? t("dates.yesterday", { time: r(s) }) : s.getFullYear() === u.getFullYear() ? a(
849
904
  "this-year",
850
905
  {
851
906
  day: "numeric",
@@ -854,66 +909,76 @@ function $t(e) {
854
909
  minute: "2-digit",
855
910
  hourCycle: "h23"
856
911
  },
857
- o
858
- ) : a("earlier", { day: "numeric", month: "long", year: "numeric" }, o);
912
+ s
913
+ ) : a("earlier", { day: "numeric", month: "long", year: "numeric" }, s);
859
914
  },
860
- exact(d) {
861
- const o = O(d);
862
- return o === null ? "" : a("exact", { dateStyle: "long", timeStyle: "medium", hourCycle: "h23" }, o);
915
+ exact(o) {
916
+ const s = ae(o);
917
+ return s === null ? "" : a("exact", { dateStyle: "long", timeStyle: "medium", hourCycle: "h23" }, s);
863
918
  },
864
- iso(d) {
865
- const o = O(d);
866
- return o === null ? "" : o.toISOString();
919
+ iso(o) {
920
+ const s = ae(o);
921
+ return s === null ? "" : s.toISOString();
867
922
  }
868
923
  };
869
924
  }
870
- function St() {
871
- const e = V(j, null);
872
- return $t(e ?? Tt());
925
+ function Et() {
926
+ const e = G(Q, null);
927
+ return Wt(e ?? Ut());
873
928
  }
874
- let D = null;
875
- function Tt() {
876
- return D === null && (D = Q(), D.defaults("webx-admin", ue)), D;
929
+ let q = null;
930
+ function Ut() {
931
+ return q === null && (q = de(), q.defaults("webx-admin", be)), q;
877
932
  }
878
- function O(e) {
933
+ function ae(e) {
879
934
  if (e == null || e === "")
880
935
  return null;
881
936
  const t = e instanceof Date ? e : new Date(e);
882
937
  return Number.isNaN(t.getTime()) ? null : t;
883
938
  }
884
- function Lt(e, t) {
939
+ function Rt(e, t) {
885
940
  const n = (a) => Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
886
941
  return Math.round((n(e) - n(t)) / 864e5);
887
942
  }
888
- function Et(e, t, n) {
889
- const a = e instanceof X ? e.status : zt(e);
943
+ function Mt(e, t, n) {
944
+ const a = e instanceof ie ? e.status : Pt(e);
890
945
  if (a === 422)
891
- return Ct(e) ?? n ?? t("errors.unknown");
946
+ return Vt(e) ?? n ?? t("errors.unknown");
892
947
  if (a === 401) return t("errors.signed-out");
893
948
  if (a === 403) return t("errors.forbidden");
894
949
  if (a === 404) return t("errors.gone");
895
950
  if (a === 409) return t("errors.conflict");
896
951
  if (a === 429) {
897
- const i = e instanceof X ? e.retryAfter : null;
898
- return i === null ? t("errors.throttled") : t("errors.throttled-in", { seconds: i });
952
+ const r = e instanceof ie ? e.retryAfter : null;
953
+ return r === null ? t("errors.throttled") : t("errors.throttled-in", { seconds: r });
899
954
  }
900
955
  return a !== null && a >= 500 ? t("errors.server") : a === null ? t("errors.offline") : n ?? t("errors.unknown");
901
956
  }
902
- function Ht() {
903
- const e = U("webx-admin");
904
- return (t, n) => Et(t, e, n);
957
+ function Nt() {
958
+ const e = N("webx-admin");
959
+ return (t, n) => Mt(t, e, n);
905
960
  }
906
- function zt(e) {
961
+ function Pt(e) {
907
962
  const t = e?.status;
908
963
  return typeof t == "number" ? t : null;
909
964
  }
910
- function Ct(e) {
965
+ function Vt(e) {
911
966
  const n = e?.body?.message;
912
967
  return typeof n == "string" && n !== "" ? n : null;
913
968
  }
914
- const Wt = { class: "wx-screen-host" }, Ot = /* @__PURE__ */ T({
969
+ function Dt(e, t, n) {
970
+ const a = `${e.apiPath}/entities/${t}/${n}/notes`, r = (s) => `${e.apiPath}/notes/${s}`, o = (s) => s.data;
971
+ return {
972
+ list: () => e.http.get(a).then(o),
973
+ add: (s) => e.http.post(a, { body: s }).then(o),
974
+ save: (s, u) => e.http.put(r(s), { body: u }).then(o),
975
+ remove: (s) => e.http.delete(r(s)).then(() => {
976
+ })
977
+ };
978
+ }
979
+ const Bt = { class: "wx-screen-host" }, un = /* @__PURE__ */ U({
915
980
  __name: "Screen",
916
- props: /* @__PURE__ */ K({
981
+ props: /* @__PURE__ */ se({
917
982
  name: {},
918
983
  errors: { default: void 0 },
919
984
  disabled: { type: Boolean, default: !1 },
@@ -924,39 +989,39 @@ const Wt = { class: "wx-screen-host" }, Ot = /* @__PURE__ */ T({
924
989
  modelValue: { default: () => ({}) },
925
990
  modelModifiers: {}
926
991
  }),
927
- emits: /* @__PURE__ */ K(["loaded"], ["update:modelValue"]),
992
+ emits: /* @__PURE__ */ se(["loaded"], ["update:modelValue"]),
928
993
  setup(e, { expose: t, emit: n }) {
929
- const a = e, i = n, d = se(e, "modelValue"), o = J(), r = U("webx-admin"), s = W(null), u = W(null);
930
- async function c() {
931
- s.value = null, u.value = null;
994
+ const a = e, r = n, o = he(e, "modelValue"), s = H(), u = N("webx-admin"), i = C(null), c = C(null);
995
+ async function m() {
996
+ i.value = null, c.value = null;
932
997
  try {
933
- const l = await o.loadScreen(a.name);
934
- s.value = l, i("loaded", l);
998
+ const l = await s.loadScreen(a.name);
999
+ i.value = l, r("loaded", l);
935
1000
  } catch (l) {
936
- u.value = l instanceof Error ? l.message : String(l);
1001
+ c.value = l instanceof Error ? l.message : String(l);
937
1002
  }
938
1003
  }
939
- return oe([() => a.name, () => o.i18n.state.locale], () => {
940
- c();
941
- }, { immediate: !0 }), t({ reload: c }), (l, m) => (p(), y("div", Wt, [
942
- u.value ? (p(), b(f(Pe), {
1004
+ return J([() => a.name, () => s.i18n.state.locale], () => {
1005
+ m();
1006
+ }, { immediate: !0 }), t({ reload: m }), (l, v) => (f(), b("div", Bt, [
1007
+ c.value ? (f(), x(d(Be), {
943
1008
  key: 0,
944
1009
  type: "danger",
945
- title: f(r)("shell.error-title"),
946
- description: u.value
947
- }, null, 8, ["title", "description"])) : s.value === null ? (p(), b(f(Re), {
1010
+ title: d(u)("shell.error-title"),
1011
+ description: c.value
1012
+ }, null, 8, ["title", "description"])) : i.value === null ? (f(), x(d(we), {
948
1013
  key: 1,
949
1014
  rows: 4
950
- })) : (p(), b(f(Oe), {
1015
+ })) : (f(), x(d(Ge), {
951
1016
  key: 2,
952
- modelValue: d.value,
953
- "onUpdate:modelValue": m[0] || (m[0] = (h) => d.value = h),
954
- root: s.value,
955
- patch: f(o).screenPatch(e.name),
956
- types: f(o).types,
1017
+ modelValue: o.value,
1018
+ "onUpdate:modelValue": v[0] || (v[0] = (h) => o.value = h),
1019
+ root: i.value,
1020
+ patch: d(s).screenPatch(e.name),
1021
+ types: d(s).types,
957
1022
  errors: e.errors,
958
- translate: f(o).i18n.t,
959
- can: f(o).can,
1023
+ translate: d(s).i18n.t,
1024
+ can: d(s).can,
960
1025
  disabled: e.disabled,
961
1026
  "label-position": e.labelPosition,
962
1027
  "label-width": e.labelWidth,
@@ -964,10 +1029,10 @@ const Wt = { class: "wx-screen-host" }, Ot = /* @__PURE__ */ T({
964
1029
  }, null, 8, ["modelValue", "root", "patch", "types", "errors", "translate", "can", "disabled", "label-position", "label-width", "size"]))
965
1030
  ]));
966
1031
  }
967
- }), Ut = {
1032
+ }), It = {
968
1033
  key: 0,
969
1034
  class: "wx-dropdown__divider"
970
- }, Ft = /* @__PURE__ */ T({
1035
+ }, jt = /* @__PURE__ */ U({
971
1036
  __name: "RowMenu",
972
1037
  props: {
973
1038
  actions: {},
@@ -975,46 +1040,46 @@ const Wt = { class: "wx-screen-host" }, Ot = /* @__PURE__ */ T({
975
1040
  size: { default: "sm" }
976
1041
  },
977
1042
  setup(e) {
978
- const t = e, n = k(() => [
979
- ...t.actions.filter((i) => !i.danger),
980
- ...t.actions.filter((i) => i.danger)
981
- ]), a = k(() => {
982
- const i = n.value.find((d) => d.danger);
983
- return i && n.value[0] !== i ? i.key : null;
1043
+ const t = e, n = S(() => [
1044
+ ...t.actions.filter((r) => !r.danger),
1045
+ ...t.actions.filter((r) => r.danger)
1046
+ ]), a = S(() => {
1047
+ const r = n.value.find((o) => o.danger);
1048
+ return r && n.value[0] !== r ? r.key : null;
984
1049
  });
985
- return (i, d) => n.value.length > 0 ? (p(), b(f(Be), {
1050
+ return (r, o) => n.value.length > 0 ? (f(), x(d(Ie), {
986
1051
  key: 0,
987
1052
  collapse: "always",
988
1053
  align: "end",
989
1054
  size: e.size,
990
1055
  "aria-label": e.label,
991
- onClick: d[0] || (d[0] = ie(() => {
1056
+ onClick: o[0] || (o[0] = pe(() => {
992
1057
  }, ["stop"]))
993
1058
  }, {
994
1059
  collapsed: w(() => [
995
- (p(!0), y(C, null, I(n.value, (o) => (p(), y(C, {
996
- key: o.key
1060
+ (f(!0), b(R, null, I(n.value, (s) => (f(), b(R, {
1061
+ key: s.key
997
1062
  }, [
998
- o.key === a.value ? (p(), y("hr", Ut)) : z("", !0),
999
- _(f(De), {
1000
- icon: o.icon,
1001
- tone: o.danger ? "danger" : "default",
1002
- href: o.href,
1003
- target: o.href ? o.target ?? "_blank" : void 0,
1004
- disabled: o.disabled,
1005
- onClick: (r) => o.run?.()
1063
+ s.key === a.value ? (f(), b("hr", It)) : E("", !0),
1064
+ y(d(je), {
1065
+ icon: s.icon,
1066
+ tone: s.danger ? "danger" : "default",
1067
+ href: s.href,
1068
+ target: s.href ? s.target ?? "_blank" : void 0,
1069
+ disabled: s.disabled,
1070
+ onClick: (u) => s.run?.()
1006
1071
  }, {
1007
1072
  default: w(() => [
1008
- L(E(o.label), 1)
1073
+ L(A(s.label), 1)
1009
1074
  ]),
1010
1075
  _: 2
1011
1076
  }, 1032, ["icon", "tone", "href", "target", "disabled", "onClick"])
1012
1077
  ], 64))), 128))
1013
1078
  ]),
1014
1079
  _: 1
1015
- }, 8, ["size", "aria-label"])) : z("", !0);
1080
+ }, 8, ["size", "aria-label"])) : E("", !0);
1016
1081
  }
1017
- }), Kt = /* @__PURE__ */ T({
1082
+ }), dn = /* @__PURE__ */ U({
1018
1083
  __name: "BackButton",
1019
1084
  props: {
1020
1085
  to: {},
@@ -1022,18 +1087,18 @@ const Wt = { class: "wx-screen-host" }, Ot = /* @__PURE__ */ T({
1022
1087
  size: { default: "sm" }
1023
1088
  },
1024
1089
  setup(e) {
1025
- const t = e, n = U("webx-admin"), a = k(() => t.label ?? n("editor.back"));
1026
- return (i, d) => (p(), b(f(G), {
1090
+ const t = e, n = N("webx-admin"), a = S(() => t.label ?? n("editor.back"));
1091
+ return (r, o) => (f(), x(d(ue), {
1027
1092
  icon: "arrow-left",
1028
1093
  class: "wx-back-button",
1029
- as: f(Le),
1094
+ as: d(We),
1030
1095
  to: e.to,
1031
1096
  title: a.value,
1032
1097
  size: e.size,
1033
1098
  "tooltip-side": "bottom"
1034
1099
  }, null, 8, ["as", "to", "title", "size"]));
1035
1100
  }
1036
- }), At = { class: "wx-rename__footer" }, Mt = /* @__PURE__ */ T({
1101
+ }), Ht = { class: "wx-rename__footer" }, Ot = /* @__PURE__ */ U({
1037
1102
  __name: "RenameButton",
1038
1103
  props: {
1039
1104
  name: { default: "" },
@@ -1044,57 +1109,57 @@ const Wt = { class: "wx-screen-host" }, Ot = /* @__PURE__ */ T({
1044
1109
  },
1045
1110
  emits: ["rename"],
1046
1111
  setup(e, { emit: t }) {
1047
- const n = e, a = t, i = U("webx-admin"), d = W(!1), o = W(n.name), r = W(null), s = k(() => n.label ?? i("editor.rename"));
1048
- oe(d, async (c) => {
1049
- c && (o.value = n.name, await xe(), r.value?.focus(), r.value?.select());
1112
+ const n = e, a = t, r = N("webx-admin"), o = C(!1), s = C(n.name), u = C(null), i = S(() => n.label ?? r("editor.rename"));
1113
+ J(o, async (m) => {
1114
+ m && (s.value = n.name, await Te(), u.value?.focus(), u.value?.select());
1050
1115
  });
1051
- function u() {
1052
- const c = o.value.trim();
1053
- if (c === "" || c === n.name) {
1054
- d.value = !1;
1116
+ function c() {
1117
+ const m = s.value.trim();
1118
+ if (m === "" || m === n.name) {
1119
+ o.value = !1;
1055
1120
  return;
1056
1121
  }
1057
- a("rename", c), d.value = !1;
1122
+ a("rename", m), o.value = !1;
1058
1123
  }
1059
- return (c, l) => (p(), b(f(Ie), {
1060
- open: d.value,
1061
- "onUpdate:open": l[2] || (l[2] = (m) => d.value = m),
1062
- title: s.value,
1124
+ return (m, l) => (f(), x(d(He), {
1125
+ open: o.value,
1126
+ "onUpdate:open": l[2] || (l[2] = (v) => o.value = v),
1127
+ title: i.value,
1063
1128
  width: 320,
1064
1129
  side: "bottom",
1065
1130
  align: "start",
1066
1131
  teleport: ""
1067
1132
  }, {
1068
1133
  trigger: w(() => [
1069
- _(f(G), {
1134
+ y(d(ue), {
1070
1135
  type: "edit",
1071
- title: s.value,
1136
+ title: i.value,
1072
1137
  size: e.size,
1073
1138
  disabled: e.disabled
1074
1139
  }, null, 8, ["title", "size", "disabled"])
1075
1140
  ]),
1076
1141
  default: w(() => [
1077
- A("form", {
1142
+ M("form", {
1078
1143
  class: "wx-rename",
1079
- onSubmit: ie(u, ["prevent"])
1144
+ onSubmit: pe(c, ["prevent"])
1080
1145
  }, [
1081
- _(f(Ve), {
1146
+ y(d(Oe), {
1082
1147
  ref_key: "field",
1083
- ref: r,
1084
- modelValue: o.value,
1085
- "onUpdate:modelValue": l[0] || (l[0] = (m) => o.value = m),
1086
- "aria-label": s.value,
1148
+ ref: u,
1149
+ modelValue: s.value,
1150
+ "onUpdate:modelValue": l[0] || (l[0] = (v) => s.value = v),
1151
+ "aria-label": i.value,
1087
1152
  placeholder: e.placeholder,
1088
- onKeydown: l[1] || (l[1] = _e((m) => d.value = !1, ["esc"]))
1153
+ onKeydown: l[1] || (l[1] = ze((v) => o.value = !1, ["esc"]))
1089
1154
  }, null, 8, ["modelValue", "aria-label", "placeholder"]),
1090
- A("div", At, [
1091
- _(f(Ne), {
1155
+ M("div", Ht, [
1156
+ y(d(X), {
1092
1157
  type: "primary",
1093
1158
  size: "sm",
1094
1159
  "native-type": "submit"
1095
1160
  }, {
1096
1161
  default: w(() => [
1097
- L(E(f(i)("editor.save")), 1)
1162
+ L(A(d(r)("editor.save")), 1)
1098
1163
  ]),
1099
1164
  _: 1
1100
1165
  })
@@ -1104,7 +1169,7 @@ const Wt = { class: "wx-screen-host" }, Ot = /* @__PURE__ */ T({
1104
1169
  _: 1
1105
1170
  }, 8, ["open", "title"]));
1106
1171
  }
1107
- }), qt = /* @__PURE__ */ N(Mt, [["__scopeId", "data-v-d879e8d3"]]), Pt = ["innerHTML"], Rt = /* @__PURE__ */ T({
1172
+ }), cn = /* @__PURE__ */ j(Ot, [["__scopeId", "data-v-d879e8d3"]]), Ft = ["innerHTML"], Kt = /* @__PURE__ */ U({
1108
1173
  __name: "HelpButton",
1109
1174
  props: {
1110
1175
  body: {},
@@ -1114,33 +1179,33 @@ const Wt = { class: "wx-screen-host" }, Ot = /* @__PURE__ */ T({
1114
1179
  width: { default: 720 }
1115
1180
  },
1116
1181
  setup(e) {
1117
- const t = e, n = U("webx-admin"), a = W(!1), i = k(() => t.title ?? n("help.title")), d = k(() => kt(t.body));
1118
- return (o, r) => (p(), y(C, null, [
1119
- _(f(G), {
1182
+ const t = e, n = N("webx-admin"), a = C(!1), r = S(() => t.title ?? n("help.title")), o = S(() => Lt(t.body));
1183
+ return (s, u) => (f(), b(R, null, [
1184
+ y(d(ue), {
1120
1185
  type: "details",
1121
1186
  icon: "question",
1122
1187
  tone: "neutral",
1123
1188
  size: e.size,
1124
- title: e.label ?? i.value,
1125
- onClick: r[0] || (r[0] = (s) => a.value = !0)
1189
+ title: e.label ?? r.value,
1190
+ onClick: u[0] || (u[0] = (i) => a.value = !0)
1126
1191
  }, null, 8, ["size", "title"]),
1127
- _(f(je), {
1192
+ y(d(Fe), {
1128
1193
  open: a.value,
1129
- "onUpdate:open": r[1] || (r[1] = (s) => a.value = s),
1130
- title: i.value,
1194
+ "onUpdate:open": u[1] || (u[1] = (i) => a.value = i),
1195
+ title: r.value,
1131
1196
  width: e.width
1132
1197
  }, {
1133
1198
  default: w(() => [
1134
- A("div", {
1199
+ M("div", {
1135
1200
  class: "wx-help",
1136
- innerHTML: d.value
1137
- }, null, 8, Pt)
1201
+ innerHTML: o.value
1202
+ }, null, 8, Ft)
1138
1203
  ]),
1139
1204
  _: 1
1140
1205
  }, 8, ["open", "title", "width"])
1141
1206
  ], 64));
1142
1207
  }
1143
- }), Xt = /* @__PURE__ */ N(Rt, [["__scopeId", "data-v-6c280d42"]]), Yt = /* @__PURE__ */ T({
1208
+ }), mn = /* @__PURE__ */ j(Kt, [["__scopeId", "data-v-6c280d42"]]), qt = /* @__PURE__ */ U({
1144
1209
  name: "WxDate",
1145
1210
  __name: "DateText",
1146
1211
  props: {
@@ -1149,66 +1214,266 @@ const Wt = { class: "wx-screen-host" }, Ot = /* @__PURE__ */ T({
1149
1214
  tone: { default: "muted" }
1150
1215
  },
1151
1216
  setup(e) {
1152
- const t = e, n = St(), a = k(() => n.short(t.value)), i = k(() => n.exact(t.value)), d = k(() => n.iso(t.value));
1153
- return (o, r) => i.value ? (p(), b(f(He), {
1217
+ const t = e, n = Et(), a = S(() => n.short(t.value)), r = S(() => n.exact(t.value)), o = S(() => n.iso(t.value));
1218
+ return (s, u) => r.value ? (f(), x(d(Ke), {
1154
1219
  key: 0,
1155
- content: i.value
1220
+ content: r.value
1156
1221
  }, {
1157
1222
  default: w(() => [
1158
- _(f(ae), {
1223
+ y(d(Y), {
1159
1224
  as: "time",
1160
- datetime: d.value,
1225
+ datetime: o.value,
1161
1226
  size: e.size,
1162
1227
  tone: e.tone
1163
1228
  }, {
1164
1229
  default: w(() => [
1165
- L(E(a.value), 1)
1230
+ L(A(a.value), 1)
1166
1231
  ]),
1167
1232
  _: 1
1168
1233
  }, 8, ["datetime", "size", "tone"])
1169
1234
  ]),
1170
1235
  _: 1
1171
- }, 8, ["content"])) : (p(), b(f(ae), {
1236
+ }, 8, ["content"])) : (f(), x(d(Y), {
1172
1237
  key: 1,
1173
1238
  size: e.size,
1174
1239
  tone: e.tone
1175
1240
  }, {
1176
1241
  default: w(() => [
1177
- L(E(a.value), 1)
1242
+ L(A(a.value), 1)
1178
1243
  ]),
1179
1244
  _: 1
1180
1245
  }, 8, ["size", "tone"]));
1181
1246
  }
1182
- });
1247
+ }), Xt = { class: "wx-notes" }, Yt = {
1248
+ key: 3,
1249
+ class: "wx-notes__list"
1250
+ }, Gt = { class: "wx-note__body" }, Jt = { class: "wx-note__head" }, Qt = { class: "wx-note__buttons" }, Zt = {
1251
+ key: 1,
1252
+ class: "wx-note__text"
1253
+ }, en = {
1254
+ key: 4,
1255
+ class: "wx-notes__new"
1256
+ }, tn = /* @__PURE__ */ U({
1257
+ name: "WxNotes",
1258
+ __name: "NotesFeed",
1259
+ props: {
1260
+ type: {},
1261
+ id: {},
1262
+ can: { type: Boolean, default: !0 },
1263
+ title: { default: void 0 }
1264
+ },
1265
+ emits: ["change"],
1266
+ setup(e, { emit: t }) {
1267
+ const n = e, a = t, r = H(), o = N("webx-admin"), s = Nt(), u = C([]), i = C(!0), c = C(""), m = C(!1), l = C(null), v = C(""), h = S(() => Dt(r, n.type, n.id)), g = S(() => n.title ?? o("notes.title"));
1268
+ async function p() {
1269
+ i.value = !0;
1270
+ try {
1271
+ u.value = await h.value.list();
1272
+ } catch (k) {
1273
+ B.danger(s(k));
1274
+ } finally {
1275
+ i.value = !1;
1276
+ }
1277
+ }
1278
+ J(
1279
+ () => [n.type, n.id],
1280
+ () => {
1281
+ l.value = null, c.value = "", p();
1282
+ },
1283
+ { immediate: !0 }
1284
+ );
1285
+ async function _() {
1286
+ const k = c.value.trim();
1287
+ if (!(k === "" || m.value)) {
1288
+ m.value = !0;
1289
+ try {
1290
+ u.value = [...u.value, await h.value.add(k)], c.value = "", a("change");
1291
+ } catch (T) {
1292
+ B.danger(s(T));
1293
+ } finally {
1294
+ m.value = !1;
1295
+ }
1296
+ }
1297
+ }
1298
+ function V(k) {
1299
+ l.value = k.id, v.value = k.body;
1300
+ }
1301
+ async function Z(k) {
1302
+ const T = v.value.trim();
1303
+ if (T !== "")
1304
+ try {
1305
+ const $ = await h.value.save(k.id, T);
1306
+ u.value = u.value.map((P) => P.id === $.id ? $ : P), l.value = null, B.success(o("notes.saved")), a("change");
1307
+ } catch ($) {
1308
+ B.danger(s($));
1309
+ }
1310
+ }
1311
+ async function ee(k) {
1312
+ if (await Ye({
1313
+ title: o("notes.delete-title"),
1314
+ message: o("notes.delete-text"),
1315
+ confirmText: o("notes.delete"),
1316
+ cancelText: o("notes.cancel"),
1317
+ tone: "danger"
1318
+ }))
1319
+ try {
1320
+ await h.value.remove(k.id), u.value = u.value.filter(($) => $.id !== k.id), B.success(o("notes.deleted")), a("change");
1321
+ } catch ($) {
1322
+ B.danger(s($));
1323
+ }
1324
+ }
1325
+ function te(k) {
1326
+ return !n.can || !k.is_mine ? [] : [
1327
+ { key: "edit", icon: "edit", label: o("notes.edit"), run: () => V(k) },
1328
+ {
1329
+ key: "delete",
1330
+ icon: "trash",
1331
+ label: o("notes.delete"),
1332
+ danger: !0,
1333
+ run: () => {
1334
+ ee(k);
1335
+ }
1336
+ }
1337
+ ];
1338
+ }
1339
+ function D(k) {
1340
+ return k.author?.name ?? o("notes.unknown-author");
1341
+ }
1342
+ return (k, T) => (f(), b("section", Xt, [
1343
+ g.value ? (f(), x(d(Y), {
1344
+ key: 0,
1345
+ weight: "medium",
1346
+ class: "wx-notes__title"
1347
+ }, {
1348
+ default: w(() => [
1349
+ L(A(g.value), 1)
1350
+ ]),
1351
+ _: 1
1352
+ })) : E("", !0),
1353
+ i.value ? (f(), x(d(we), {
1354
+ key: 1,
1355
+ rows: 2
1356
+ })) : u.value.length === 0 ? (f(), x(d(qe), {
1357
+ key: 2,
1358
+ size: "sm",
1359
+ description: d(o)("notes.empty")
1360
+ }, null, 8, ["description"])) : (f(), b("ul", Yt, [
1361
+ (f(!0), b(R, null, I(u.value, ($) => (f(), b("li", {
1362
+ key: $.id,
1363
+ class: "wx-note"
1364
+ }, [
1365
+ y(d(Xe), {
1366
+ name: D($),
1367
+ size: "sm",
1368
+ tone: "auto"
1369
+ }, null, 8, ["name"]),
1370
+ M("div", Gt, [
1371
+ M("div", Jt, [
1372
+ y(d(Y), {
1373
+ size: "sm",
1374
+ weight: "medium",
1375
+ truncate: ""
1376
+ }, {
1377
+ default: w(() => [
1378
+ L(A(D($)), 1)
1379
+ ]),
1380
+ _: 2
1381
+ }, 1024),
1382
+ y(qt, {
1383
+ value: $.created_at
1384
+ }, null, 8, ["value"]),
1385
+ y(jt, {
1386
+ actions: te($),
1387
+ label: D($)
1388
+ }, null, 8, ["actions", "label"])
1389
+ ]),
1390
+ l.value === $.id ? (f(), b(R, { key: 0 }, [
1391
+ y(d(fe), {
1392
+ modelValue: v.value,
1393
+ "onUpdate:modelValue": T[0] || (T[0] = (P) => v.value = P),
1394
+ autosize: { minRows: 2, maxRows: 10 }
1395
+ }, null, 8, ["modelValue"]),
1396
+ M("div", Qt, [
1397
+ y(d(X), {
1398
+ size: "sm",
1399
+ type: "primary",
1400
+ onClick: (P) => Z($)
1401
+ }, {
1402
+ default: w(() => [
1403
+ L(A(d(o)("notes.save")), 1)
1404
+ ]),
1405
+ _: 1
1406
+ }, 8, ["onClick"]),
1407
+ y(d(X), {
1408
+ size: "sm",
1409
+ variant: "text",
1410
+ onClick: T[1] || (T[1] = (P) => l.value = null)
1411
+ }, {
1412
+ default: w(() => [
1413
+ L(A(d(o)("notes.cancel")), 1)
1414
+ ]),
1415
+ _: 1
1416
+ })
1417
+ ])
1418
+ ], 64)) : (f(), b("p", Zt, A($.body), 1))
1419
+ ])
1420
+ ]))), 128))
1421
+ ])),
1422
+ e.can ? (f(), b("div", en, [
1423
+ y(d(fe), {
1424
+ modelValue: c.value,
1425
+ "onUpdate:modelValue": T[2] || (T[2] = ($) => c.value = $),
1426
+ placeholder: d(o)("notes.placeholder"),
1427
+ autosize: { minRows: 2, maxRows: 8 }
1428
+ }, null, 8, ["modelValue", "placeholder"]),
1429
+ y(d(X), {
1430
+ size: "sm",
1431
+ type: "primary",
1432
+ disabled: c.value.trim() === "",
1433
+ loading: m.value,
1434
+ onClick: _
1435
+ }, {
1436
+ default: w(() => [
1437
+ L(A(d(o)("notes.add")), 1)
1438
+ ]),
1439
+ _: 1
1440
+ }, 8, ["disabled", "loading"])
1441
+ ])) : E("", !0)
1442
+ ]));
1443
+ }
1444
+ }), fn = /* @__PURE__ */ j(tn, [["__scopeId", "data-v-4ce005b1"]]);
1183
1445
  export {
1184
- nt as AdminNav,
1185
- ft as AdminShell,
1186
- X as HttpError,
1187
- Kt as WxBackButton,
1188
- Yt as WxDate,
1189
- Xt as WxHelpButton,
1190
- Ye as WxListScreen,
1191
- qt as WxRenameButton,
1192
- Ft as WxRowMenu,
1193
- Ot as WxScreen,
1194
- re as adminKey,
1195
- ue as adminMessages,
1196
- Ge as adminTypes,
1197
- jt as createAdmin,
1198
- Je as createAdminContext,
1199
- $t as createDates,
1200
- ht as createHttp,
1201
- Q as createI18n,
1202
- Et as errorText,
1203
- j as i18nKey,
1204
- Qe as provideAdmin,
1205
- et as provideI18n,
1206
- le as readCookie,
1207
- kt as renderMarkdown,
1208
- J as useAdmin,
1209
- St as useDates,
1210
- Ht as useErrorText,
1211
- Nt as useI18n,
1212
- U as useTranslate
1446
+ rt as AdminLanding,
1447
+ ut as AdminNav,
1448
+ yt as AdminShell,
1449
+ ie as HttpError,
1450
+ dn as WxBackButton,
1451
+ qt as WxDate,
1452
+ mn as WxHelpButton,
1453
+ tt as WxListScreen,
1454
+ fn as WxNotes,
1455
+ cn as WxRenameButton,
1456
+ jt as WxRowMenu,
1457
+ un as WxScreen,
1458
+ ye as adminKey,
1459
+ be as adminMessages,
1460
+ nt as adminTypes,
1461
+ rn as createAdmin,
1462
+ at as createAdminContext,
1463
+ Wt as createDates,
1464
+ xt as createHttp,
1465
+ de as createI18n,
1466
+ Dt as createNotesApi,
1467
+ Mt as errorText,
1468
+ Q as i18nKey,
1469
+ lt as provideAdmin,
1470
+ ot as provideI18n,
1471
+ ve as readCookie,
1472
+ Lt as renderMarkdown,
1473
+ H as useAdmin,
1474
+ Et as useDates,
1475
+ Nt as useErrorText,
1476
+ on as useI18n,
1477
+ N as useTranslate
1213
1478
  };
1214
1479
  //# sourceMappingURL=index.js.map