@webx-ui/module-services 0.1.17 → 0.2.1

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,38 +1,38 @@
1
- import { reorderItems as De, useAdmin as ie, useDates as Me, useTranslate as ae, useErrorText as me, provideRecordAddress as Le, WxScreenHead as Re, WxScreen as Ue, WxSaveState as He, WxDate as Fe, useItemOrder as Ke, WxListScreen as Ge, WxRowMenu as Je, WxAddressNote as je, categoryRoutes as Qe } from "@webx-ui/module-admin";
2
- import { provide as Xe, inject as Ye, defineComponent as oe, computed as y, ref as b, watch as re, onMounted as Te, onBeforeUnmount as Se, openBlock as d, createElementBlock as B, Fragment as Y, createVNode as h, unref as e, withCtx as c, createTextVNode as _, toDisplayString as w, createBlock as k, createCommentVNode as D, createElementVNode as A, renderList as $e, normalizeClass as ye, useTemplateRef as Ze, nextTick as et, isRef as tt, withKeys as st, resolveDynamicComponent as at, mergeProps as rt } from "vue";
3
- import { useRoute as We, useRouter as Ce, onBeforeRouteLeave as it } from "vue-router";
4
- import { provideBlocksPreview as lt } from "@webx-ui/module-blocks";
5
- import { useLocales as nt, localizedValue as ot, confirm as j, WxSkeleton as ne, WxCard as ct, WxBadge as Q, WxBreadcrumb as ut, WxBreadcrumbItem as xe, WxAlert as Ve, WxButton as X, WxActionBar as dt, toast as S, WxEmpty as qe, WxText as vt, useModal as pt, WxDialog as ht, WxFormItem as ft, WxInput as Ie, WxSpace as yt, createModal as gt, WxIcon as _e, WxSelect as mt, WxSortableList as bt, WxTooltip as wt } from "@webx-ui/core";
6
- const ge = "services";
7
- function ce(u) {
8
- const o = `${u.apiPath}/${ge}`, g = (a) => a.data;
1
+ import { reorderItems as Re, useAdmin as le, useDates as Le, useTranslate as ae, useErrorText as me, useEditing as Me, provideRecordAddress as Ue, WxScreenHead as He, WxEditingAlerts as Fe, WxScreen as Ke, WxSaveState as Je, WxDate as Ge, WxDrafts as je, useItemOrder as Qe, WxListScreen as Xe, WxRowMenu as Ye, WxAddressNote as Ze, categoryRoutes as et } from "@webx-ui/module-admin";
2
+ import { provide as tt, inject as st, defineComponent as ce, computed as y, ref as w, watch as re, onMounted as $e, onBeforeUnmount as We, openBlock as v, createElementBlock as P, Fragment as Y, createVNode as f, unref as e, withCtx as d, createTextVNode as C, toDisplayString as x, createBlock as _, createCommentVNode as M, createElementVNode as A, renderList as Ce, normalizeClass as ge, useTemplateRef as at, nextTick as rt, isRef as it, withKeys as lt, resolveDynamicComponent as nt, mergeProps as ot } from "vue";
3
+ import { useRoute as Ve, useRouter as qe, onBeforeRouteLeave as ut } from "vue-router";
4
+ import { provideBlocksPreview as ct } from "@webx-ui/module-blocks";
5
+ import { useLocales as dt, localizedValue as vt, confirm as te, WxSkeleton as ue, WxCard as pt, WxBadge as X, WxBreadcrumb as ht, WxBreadcrumbItem as ke, WxActionBar as ft, WxButton as ie, toast as W, WxEmpty as Ie, WxText as yt, useModal as gt, WxDialog as bt, WxFormItem as mt, WxInput as Ee, WxSpace as wt, createModal as xt, WxIcon as Te, WxSelect as _t, WxSortableList as kt, WxTooltip as Tt, WxAlert as St } from "@webx-ui/core";
6
+ const be = "services";
7
+ function de(c) {
8
+ const o = `${c.apiPath}/${be}`, g = (s) => s.data;
9
9
  return {
10
- list: (a = {}) => {
11
- const l = new URLSearchParams();
12
- return a.q && l.set("q", a.q), a.category != null && l.set("category", String(a.category)), a.status && l.set("status", a.status), a.trashed && l.set("trashed", "1"), u.http.get(l.size > 0 ? `${o}?${l}` : o);
10
+ list: (s = {}) => {
11
+ const n = new URLSearchParams();
12
+ return s.q && n.set("q", s.q), s.category != null && n.set("category", String(s.category)), s.status && n.set("status", s.status), s.trashed && n.set("trashed", "1"), c.http.get(n.size > 0 ? `${o}?${n}` : o);
13
13
  },
14
- get: (a) => u.http.get(`${o}/${a}`).then(g),
15
- create: (a) => u.http.post(o, a).then(g),
16
- save: (a, l) => u.http.put(`${o}/${a}`, l).then(g),
17
- discard: (a) => u.http.post(`${o}/${a}/discard`, {}).then(g),
18
- publish: (a) => u.http.post(`${o}/${a}/publish`, {}).then(g),
19
- unpublish: (a) => u.http.post(`${o}/${a}/unpublish`, {}).then(g),
20
- remove: (a) => u.http.delete(`${o}/${a}`).then(() => {
14
+ get: (s) => c.http.get(`${o}/${s}`).then(g),
15
+ create: (s) => c.http.post(o, s).then(g),
16
+ save: (s, n) => c.http.put(`${o}/${s}`, n).then(g),
17
+ discard: (s) => c.http.post(`${o}/${s}/discard`, {}).then(g),
18
+ publish: (s, n) => c.http.post(`${o}/${s}/publish`, n ? { revision: n } : {}).then(g),
19
+ unpublish: (s) => c.http.post(`${o}/${s}/unpublish`, {}).then(g),
20
+ remove: (s) => c.http.delete(`${o}/${s}`).then(() => {
21
21
  }),
22
- restore: (a) => u.http.post(`${o}/${a}/restore`, {}).then(g),
23
- versions: (a) => u.http.get(`${o}/${a}/versions`).then(g),
24
- restoreVersion: (a, l) => u.http.post(`${o}/${a}/versions/${l}/restore`, {}).then(g),
25
- reorder: (a, l = null) => De(u, ge, a, l)
22
+ restore: (s) => c.http.post(`${o}/${s}/restore`, {}).then(g),
23
+ versions: (s) => c.http.get(`${o}/${s}/versions`).then(g),
24
+ restoreVersion: (s, n) => c.http.post(`${o}/${s}/versions/${n}/restore`, {}).then(g),
25
+ reorder: (s, n = null) => Re(c, be, s, n)
26
26
  };
27
27
  }
28
- const ze = /* @__PURE__ */ Symbol("wx-service-editor");
29
- function xt(u) {
30
- Xe(ze, u);
28
+ const Ne = /* @__PURE__ */ Symbol("wx-service-editor");
29
+ function $t(c) {
30
+ tt(Ne, c);
31
31
  }
32
- function _t() {
33
- return Ye(ze, null);
32
+ function Wt() {
33
+ return st(Ne, null);
34
34
  }
35
- const kt = {
35
+ const Ct = {
36
36
  module: {
37
37
  group: "Services",
38
38
  services: "Services",
@@ -137,245 +137,270 @@ const kt = {
137
137
  saved: "The category is saved.",
138
138
  "address-moving": "The address is changing. The old one keeps working and leads to the new one."
139
139
  }
140
- }, ke = /* @__PURE__ */ new WeakSet();
141
- function ue() {
140
+ }, Se = /* @__PURE__ */ new WeakSet();
141
+ function ve() {
142
142
  try {
143
- const { i18n: u } = ie();
144
- ke.has(u) || (u.defaults("webx-services", kt), ke.add(u));
143
+ const { i18n: c } = le();
144
+ Se.has(c) || (c.defaults("webx-services", Ct), Se.add(c));
145
145
  } catch {
146
146
  }
147
147
  }
148
- const Tt = { class: "wx-service-editor__screen" }, St = 1200, $t = /* @__PURE__ */ oe({
148
+ const Vt = { class: "wx-service-editor__screen" }, qt = 1200, It = /* @__PURE__ */ ce({
149
149
  __name: "ServiceEditorPage",
150
150
  props: {
151
151
  base: { default: "/services" }
152
152
  },
153
- setup(u) {
154
- const o = u, g = ie(), a = ce(g), l = We(), O = Ce(), r = nt(), W = Me();
155
- ue();
156
- const s = ae("webx-services"), x = ae("webx-admin"), T = me(), M = y(() => Number(l.params.id)), V = y(() => o.base), n = b(null), f = b({}), p = b(""), z = b(null), E = b(null), F = b(!0), K = b(!1), N = b(!1), Z = b({}), q = b(null), L = b(""), ee = b(0), P = y(() => g.can("services.manage")), le = y(() => !P.value || N.value), R = y(() => JSON.stringify(f.value)), I = y(() => L.value !== "" && R.value !== L.value), de = y(() => K.value ? "saving" : I.value ? "unsaved" : "saved"), te = y(() => {
157
- const i = f.value.title;
158
- return ot(i, r.active.value, n.value?.title ?? "");
159
- }), ve = y(() => {
160
- const i = n.value;
161
- return !i || i.status !== "published" && i.status !== "modified" ? "" : s("service.live-since", { date: W.short(i.published_at) });
153
+ setup(c) {
154
+ const o = c, g = le(), s = de(g), n = Ve(), B = qe(), a = dt(), V = Le();
155
+ ve();
156
+ const r = ae("webx-services"), m = ae("webx-admin"), k = me(), D = y(() => Number(n.params.id)), q = y(() => o.base), l = w(null), p = w({}), h = w(""), I = w(null), E = w(null), G = w(!0), H = w(!1), O = w(!1), Z = w({}), j = w(""), F = w(0), N = y(() => g.can("services.manage")), T = Me({
157
+ entity: "services",
158
+ id: () => l.value?.id,
159
+ values: p,
160
+ revision: h,
161
+ read: async () => {
162
+ const i = await s.get(D.value);
163
+ return { values: i.values, revision: i.revision };
164
+ },
165
+ adopt: (i) => {
166
+ j.value = JSON.stringify(i.values), F.value += 1;
167
+ },
168
+ // Published or restored by somebody else: the badge and the address follow, and the form
169
+ // stays as it is.
170
+ refresh: () => fe(),
171
+ restore: async () => {
172
+ l.value && await s.restore(l.value.id);
173
+ },
174
+ canWrite: () => N.value,
175
+ busy: () => H.value || u !== void 0,
176
+ screen: "services.form"
177
+ }), U = T.conflict, pe = y(() => !N.value || O.value), K = y(() => JSON.stringify(p.value)), z = y(() => j.value !== "" && K.value !== j.value), he = y(() => H.value ? "saving" : z.value ? "unsaved" : "saved"), se = y(() => {
178
+ const i = p.value.title;
179
+ return vt(i, a.active.value, l.value?.title ?? "");
180
+ }), ee = y(() => {
181
+ const i = l.value;
182
+ return !i || i.status !== "published" && i.status !== "modified" ? "" : r("service.live-since", { date: V.short(i.published_at) });
162
183
  });
163
- lt({ url: y(() => E.value), reload: ee }), Le({
164
- values: f,
165
- prefix: z,
166
- path: y(() => n.value?.path),
167
- moving: () => s("service.address-moving")
168
- }), xt({ service: n, canManage: P.value, reload: () => U(!0) });
169
- function G(i) {
170
- n.value = i.service, f.value = i.values, p.value = i.revision, z.value = i.prefix, E.value = i.preview_url, L.value = JSON.stringify(i.values), q.value = null;
184
+ ct({ url: y(() => E.value), reload: F }), Ue({
185
+ values: p,
186
+ prefix: I,
187
+ path: y(() => l.value?.path),
188
+ moving: () => r("service.address-moving")
189
+ }), $t({ service: l, canManage: N.value, reload: () => J(!0) });
190
+ function ne(i) {
191
+ l.value = i.service, p.value = i.values, h.value = i.revision, I.value = i.prefix, E.value = i.preview_url, j.value = JSON.stringify(i.values), T.opened(i.values), U.value = null;
171
192
  }
172
- async function U(i = !1) {
173
- i || (F.value = !0);
193
+ async function J(i = !1) {
194
+ i || (G.value = !0);
174
195
  try {
175
- G(await a.get(M.value));
176
- } catch ($) {
177
- S.danger(T($)), O.push(V.value);
196
+ ne(await s.get(D.value));
197
+ } catch (b) {
198
+ W.danger(k(b)), B.push(q.value);
178
199
  } finally {
179
- F.value = !1;
200
+ G.value = !1;
201
+ }
202
+ }
203
+ async function fe() {
204
+ try {
205
+ const i = await s.get(D.value);
206
+ l.value = i.service, I.value = i.prefix, E.value = i.preview_url;
207
+ } catch {
180
208
  }
181
209
  }
182
- let J;
183
- function pe() {
184
- !P.value || q.value || !I.value || (clearTimeout(J), J = setTimeout(() => {
185
- m();
186
- }, St));
210
+ let Q;
211
+ function t() {
212
+ !N.value || U.value || !z.value || T.stopped.value || (clearTimeout(Q), Q = setTimeout(() => {
213
+ R();
214
+ }, qt));
187
215
  }
188
- function he() {
189
- !P.value || q.value || !I.value || K.value || (clearTimeout(J), m());
216
+ function S() {
217
+ !N.value || U.value || !z.value || H.value || T.stopped.value || (clearTimeout(Q), R());
190
218
  }
191
- let t;
192
- async function m() {
193
- for (; t; ) {
194
- const { carried: C, done: H } = t;
195
- if (await H, !I.value || q.value || R.value === C) return;
219
+ let u;
220
+ async function R() {
221
+ for (; u; ) {
222
+ const { carried: $, done: L } = u;
223
+ if (await L, !z.value || U.value || K.value === $) return;
196
224
  }
197
- const i = R.value, $ = v();
198
- t = { carried: i, done: $ };
225
+ const i = K.value, b = ye();
226
+ u = { carried: i, done: b };
199
227
  try {
200
- await $;
228
+ await b;
201
229
  } finally {
202
- t?.done === $ && (t = void 0);
230
+ u?.done === b && (u = void 0);
203
231
  }
204
232
  }
205
- async function v() {
206
- if (!n.value || !P.value) return;
207
- clearTimeout(J);
208
- const i = R.value, $ = f.value;
209
- K.value = !0, Z.value = {};
233
+ async function ye() {
234
+ if (!l.value || !N.value) return;
235
+ clearTimeout(Q);
236
+ const i = K.value, b = p.value;
237
+ H.value = !0, Z.value = {};
210
238
  try {
211
- const C = await a.save(n.value.id, { values: $, revision: p.value });
212
- n.value = C.service, p.value = C.revision, z.value = C.prefix, E.value = C.preview_url, q.value = null, R.value === i && (L.value = i), ee.value += 1;
213
- } catch (C) {
214
- const H = C;
215
- H.status === 409 && H.body?.data ? q.value = H.body : H.body?.errors ? (Z.value = H.body.errors, S.danger(s("service.save-failed"))) : S.danger(T(C));
239
+ const $ = await s.save(l.value.id, { values: b, revision: h.value });
240
+ l.value = $.service, h.value = $.revision, I.value = $.prefix, E.value = $.preview_url, U.value = null, K.value === i && (j.value = i), T.opened(b), F.value += 1;
241
+ } catch ($) {
242
+ const L = $;
243
+ if (L.status === 409 && L.body?.data) {
244
+ const oe = L.body.data;
245
+ T.refused({
246
+ values: oe.values,
247
+ revision: oe.revision,
248
+ changed: L.body.changed
249
+ }) && (l.value = oe.service, R());
250
+ } else L.body?.errors ? (Z.value = L.body.errors, W.danger(r("service.save-failed"))) : await T.failed($) || W.danger(k($));
216
251
  } finally {
217
- K.value = !1;
252
+ H.value = !1;
218
253
  }
219
254
  }
220
- async function se() {
221
- await j({
222
- title: s("service.conflict-theirs-title"),
223
- message: s("service.conflict-theirs-text"),
224
- confirmText: s("service.conflict-theirs"),
225
- cancelText: s("panel.cancel"),
226
- tone: "danger"
227
- }) && await U(!0);
228
- }
229
- async function fe() {
230
- const i = q.value;
231
- i && (p.value = i.data.revision, q.value = null, await m());
255
+ async function ze() {
256
+ await J(!0);
232
257
  }
233
- async function Ee() {
234
- if (!(!n.value || !await j({
235
- title: x("editor.discard-title"),
236
- message: x("editor.discard-text"),
237
- confirmText: s("service.discard"),
258
+ async function Ae() {
259
+ if (!(!l.value || !await te({
260
+ title: m("editor.discard-title"),
261
+ message: m("editor.discard-text"),
262
+ confirmText: r("service.discard"),
238
263
  // Not «Cancel»: beside «Discard changes» the two read as the same word.
239
- cancelText: x("editor.keep-changes"),
264
+ cancelText: m("editor.keep-changes"),
240
265
  tone: "danger"
241
266
  }))) {
242
- N.value = !0;
267
+ O.value = !0;
243
268
  try {
244
- G(await a.discard(n.value.id)), S.success(s("service.discarded"));
245
- } catch ($) {
246
- S.danger(T($));
269
+ ne(await s.discard(l.value.id)), W.success(r("service.discarded"));
270
+ } catch (b) {
271
+ W.danger(k(b));
247
272
  } finally {
248
- N.value = !1;
273
+ O.value = !1;
249
274
  }
250
275
  }
251
276
  }
252
- async function Ne() {
253
- if (I.value && await m(), q.value || I.value) return;
254
- const i = n.value;
277
+ async function Oe() {
278
+ if (z.value && await R(), U.value || z.value || !l.value) return;
279
+ const i = await T.beforePublish();
255
280
  if (!i) return;
256
- const $ = i.next_path ?? i.path, C = i.next_path != null && i.path !== null ? ` ${x("editor.publish-moves", { old: `/${i.path}` })}` : "";
257
- if (await j({
258
- title: s("service.publish-title", { title: te.value || i.title }),
259
- message: $ === null ? s("service.publish-nowhere") : s("service.publish-text", { address: `/${$}` }) + C,
260
- confirmText: s("panel.publish"),
261
- cancelText: s("panel.cancel")
281
+ const b = l.value, $ = b.next_path ?? b.path, L = b.next_path != null && b.path !== null ? ` ${m("editor.publish-moves", { old: `/${b.path}` })}` : "";
282
+ if (i.asked || await te({
283
+ title: r("service.publish-title", { title: se.value || b.title }),
284
+ message: $ === null ? r("service.publish-nowhere") : r("service.publish-text", { address: `/${$}` }) + L,
285
+ confirmText: r("panel.publish"),
286
+ cancelText: r("panel.cancel")
262
287
  })) {
263
- N.value = !0;
288
+ O.value = !0;
264
289
  try {
265
- await a.publish(i.id), await U(!0), S.success(s("panel.published"));
266
- } catch (Pe) {
267
- S.danger(T(Pe));
290
+ await s.publish(b.id, i.revision), await J(!0), W.success(r("panel.published"));
291
+ } catch (_e) {
292
+ await T.failed(_e) || W.danger(k(_e));
268
293
  } finally {
269
- N.value = !1;
294
+ O.value = !1;
270
295
  }
271
296
  }
272
297
  }
273
- async function Ae() {
274
- const i = n.value;
275
- if (!(!i || !await j({
276
- title: x("editor.unpublish-title"),
277
- message: x("editor.unpublish-text"),
278
- confirmText: x("editor.unpublish"),
279
- cancelText: x("editor.keep-published")
298
+ async function Pe() {
299
+ const i = l.value;
300
+ if (!(!i || !await te({
301
+ title: m("editor.unpublish-title"),
302
+ message: m("editor.unpublish-text"),
303
+ confirmText: m("editor.unpublish"),
304
+ cancelText: m("editor.keep-published")
280
305
  }))) {
281
- N.value = !0;
306
+ O.value = !0;
282
307
  try {
283
- await a.unpublish(i.id), await U(!0), S.success(x("editor.unpublished"));
284
- } catch (C) {
285
- S.danger(T(C));
308
+ await s.unpublish(i.id), await J(!0), W.success(m("editor.unpublished"));
309
+ } catch ($) {
310
+ W.danger(k($));
286
311
  } finally {
287
- N.value = !1;
312
+ O.value = !1;
288
313
  }
289
314
  }
290
315
  }
291
316
  function Be() {
292
- const i = n.value?.status;
317
+ const i = l.value?.status;
293
318
  return i === "published" || i === "modified" ? "success" : "default";
294
319
  }
295
- function we(i) {
296
- I.value && i.preventDefault();
320
+ function xe(i) {
321
+ z.value && i.preventDefault();
297
322
  }
298
- re(R, pe), re(M, () => {
299
- U();
300
- }), Te(() => {
301
- U(), window.addEventListener("beforeunload", we);
302
- }), Se(() => {
303
- clearTimeout(J), window.removeEventListener("beforeunload", we);
304
- }), it(async () => !I.value || !P.value || (await m(), !I.value) ? !0 : await j({
305
- title: s("service.leave-title"),
306
- message: s("service.leave-text"),
307
- confirmText: s("service.leave"),
308
- cancelText: s("panel.cancel"),
323
+ re(K, t), re(D, () => {
324
+ J();
325
+ }), $e(() => {
326
+ J(), window.addEventListener("beforeunload", xe);
327
+ }), We(() => {
328
+ clearTimeout(Q), window.removeEventListener("beforeunload", xe);
329
+ }), ut(async () => !z.value || !N.value || (await R(), !z.value) ? !0 : await te({
330
+ title: r("service.leave-title"),
331
+ message: r("service.leave-text"),
332
+ confirmText: r("service.leave"),
333
+ cancelText: r("panel.cancel"),
309
334
  tone: "danger"
310
335
  }));
311
- const Oe = y(() => {
336
+ const De = y(() => {
312
337
  const i = [];
313
- return E.value && i.push({ key: "preview", label: s("service.preview"), icon: "eye", href: E.value }), n.value?.url && n.value.status !== "draft" && i.push({
338
+ return E.value && i.push({ key: "preview", label: r("service.preview"), icon: "eye", href: E.value }), l.value?.url && l.value.status !== "draft" && i.push({
314
339
  key: "site",
315
- label: s("panel.open-on-site"),
340
+ label: r("panel.open-on-site"),
316
341
  icon: "link",
317
- href: n.value.url
318
- }), P.value && (n.value?.status === "published" || n.value?.status === "modified") && i.push({
342
+ href: l.value.url
343
+ }), N.value && (l.value?.status === "published" || l.value?.status === "modified") && i.push({
319
344
  key: "unpublish",
320
- label: x("editor.unpublish"),
345
+ label: m("editor.unpublish"),
321
346
  icon: "eye-off",
322
347
  run: () => {
323
- Ae();
348
+ Pe();
324
349
  }
325
- }), n.value?.status === "modified" && i.push({
350
+ }), l.value?.status === "modified" && i.push({
326
351
  key: "discard",
327
- label: s("service.discard"),
352
+ label: r("service.discard"),
328
353
  icon: "refresh",
329
354
  danger: !0,
330
355
  menu: !0,
331
356
  run: () => {
332
- Ee();
357
+ Ae();
333
358
  }
334
359
  }), i;
335
360
  });
336
- return (i, $) => (d(), B("div", {
361
+ return (i, b) => (v(), P("div", {
337
362
  class: "wx-service-editor",
338
- onFocusout: he
363
+ onFocusout: S
339
364
  }, [
340
- F.value || !n.value ? (d(), B(Y, { key: 0 }, [
341
- h(e(ne), {
365
+ G.value || !l.value ? (v(), P(Y, { key: 0 }, [
366
+ f(e(ue), {
342
367
  class: "wx-service-editor__ghost",
343
368
  title: "",
344
369
  rows: 1
345
370
  }),
346
- h(e(ct), null, {
347
- default: c(() => [
348
- h(e(ne), { rows: 8 })
371
+ f(e(pt), null, {
372
+ default: d(() => [
373
+ f(e(ue), { rows: 8 })
349
374
  ]),
350
375
  _: 1
351
376
  })
352
- ], 64)) : (d(), B(Y, { key: 1 }, [
353
- h(e(Re), {
377
+ ], 64)) : (v(), P(Y, { key: 1 }, [
378
+ f(e(He), {
354
379
  divider: "",
355
- back: V.value,
356
- "back-label": e(s)("module.services"),
357
- title: te.value || e(s)("service.untitled"),
358
- subtitle: ve.value,
359
- actions: Oe.value
380
+ back: q.value,
381
+ "back-label": e(r)("module.services"),
382
+ title: se.value || e(r)("service.untitled"),
383
+ subtitle: ee.value,
384
+ actions: De.value
360
385
  }, {
361
- trail: c(() => [
362
- h(e(ut), {
386
+ trail: d(() => [
387
+ f(e(ht), {
363
388
  size: "sm",
364
- label: e(s)("service.trail")
389
+ label: e(r)("service.trail")
365
390
  }, {
366
- default: c(() => [
367
- h(e(xe), {
391
+ default: d(() => [
392
+ f(e(ke), {
368
393
  as: "router-link",
369
- to: V.value
394
+ to: q.value
370
395
  }, {
371
- default: c(() => [
372
- _(w(e(s)("module.services")), 1)
396
+ default: d(() => [
397
+ C(x(e(r)("module.services")), 1)
373
398
  ]),
374
399
  _: 1
375
400
  }, 8, ["to"]),
376
- h(e(xe), { current: "" }, {
377
- default: c(() => [
378
- _(w(te.value || e(s)("service.untitled")), 1)
401
+ f(e(ke), { current: "" }, {
402
+ default: d(() => [
403
+ C(x(se.value || e(r)("service.untitled")), 1)
379
404
  ]),
380
405
  _: 1
381
406
  })
@@ -383,253 +408,243 @@ const Tt = { class: "wx-service-editor__screen" }, St = 1200, $t = /* @__PURE__
383
408
  _: 1
384
409
  }, 8, ["label"])
385
410
  ]),
386
- "title-after": c(() => [
387
- h(e(Q), {
411
+ "title-after": d(() => [
412
+ f(e(X), {
388
413
  type: Be(),
389
414
  dot: ""
390
415
  }, {
391
- default: c(() => [
392
- _(w(e(s)(`panel.status-${n.value.status}`)), 1)
416
+ default: d(() => [
417
+ C(x(e(r)(`panel.status-${l.value.status}`)), 1)
393
418
  ]),
394
419
  _: 1
395
420
  }, 8, ["type"]),
396
- n.value.status === "modified" ? (d(), k(e(Q), {
421
+ l.value.status === "modified" ? (v(), _(e(X), {
397
422
  key: 0,
398
423
  type: "primary",
399
424
  round: ""
400
425
  }, {
401
- default: c(() => [
402
- _(w(e(s)("panel.edits")), 1)
426
+ default: d(() => [
427
+ C(x(e(r)("panel.edits")), 1)
403
428
  ]),
404
429
  _: 1
405
- })) : D("", !0)
430
+ })) : M("", !0)
406
431
  ]),
407
432
  _: 1
408
433
  }, 8, ["back", "back-label", "title", "subtitle", "actions"]),
409
- q.value ? (d(), k(e(Ve), {
410
- key: 0,
411
- type: "warning",
412
- title: e(s)("service.conflict-title"),
413
- description: q.value.message
414
- }, {
415
- actions: c(() => [
416
- h(e(X), {
417
- size: "sm",
418
- variant: "outline",
419
- onClick: se
420
- }, {
421
- default: c(() => [
422
- _(w(e(s)("service.conflict-theirs")), 1)
423
- ]),
424
- _: 1
425
- }),
426
- h(e(X), {
427
- size: "sm",
428
- type: "primary",
429
- onClick: fe
430
- }, {
431
- default: c(() => [
432
- _(w(e(s)("service.conflict-mine")), 1)
433
- ]),
434
- _: 1
435
- })
436
- ]),
437
- _: 1
438
- }, 8, ["title", "description"])) : D("", !0),
439
- A("div", Tt, [
440
- h(e(Ue), {
441
- modelValue: f.value,
442
- "onUpdate:modelValue": $[0] || ($[0] = (C) => f.value = C),
434
+ f(e(Fe), {
435
+ editing: e(T),
436
+ onSave: R,
437
+ onTheirs: ze
438
+ }, null, 8, ["editing"]),
439
+ A("div", Vt, [
440
+ f(e(Ke), {
441
+ modelValue: p.value,
442
+ "onUpdate:modelValue": b[0] || (b[0] = ($) => p.value = $),
443
443
  name: "services.form",
444
444
  errors: Z.value,
445
- disabled: le.value
445
+ disabled: pe.value
446
446
  }, null, 8, ["modelValue", "errors", "disabled"])
447
447
  ]),
448
- P.value ? (d(), k(e(dt), { key: 1 }, {
449
- state: c(() => [
450
- h(e(He), { state: de.value }, null, 8, ["state"])
448
+ N.value ? (v(), _(e(ft), { key: 0 }, {
449
+ state: d(() => [
450
+ e(T).stopped.value ? M("", !0) : (v(), _(e(Je), {
451
+ key: 0,
452
+ state: he.value
453
+ }, null, 8, ["state"]))
451
454
  ]),
452
- default: c(() => [
453
- h(e(X), {
455
+ default: d(() => [
456
+ f(e(ie), {
454
457
  variant: "outline",
455
- loading: K.value,
456
- disabled: !I.value,
457
- onClick: m
458
+ loading: H.value,
459
+ disabled: !z.value || e(T).stopped.value,
460
+ title: e(T).blocked.value,
461
+ onClick: R
458
462
  }, {
459
- default: c(() => [
460
- _(w(e(s)("service.save")), 1)
463
+ default: d(() => [
464
+ C(x(e(r)("service.save")), 1)
461
465
  ]),
462
466
  _: 1
463
- }, 8, ["loading", "disabled"]),
464
- h(e(X), {
467
+ }, 8, ["loading", "disabled", "title"]),
468
+ f(e(ie), {
465
469
  type: "primary",
466
- loading: N.value,
467
- disabled: n.value.status === "published" && !I.value,
468
- onClick: Ne
470
+ loading: O.value,
471
+ disabled: e(T).stopped.value || l.value.status === "published" && !z.value,
472
+ title: e(T).blocked.value,
473
+ onClick: Oe
469
474
  }, {
470
- default: c(() => [
471
- _(w(e(s)("panel.publish")), 1)
475
+ default: d(() => [
476
+ C(x(e(r)("panel.publish")), 1)
472
477
  ]),
473
478
  _: 1
474
- }, 8, ["loading", "disabled"])
479
+ }, 8, ["loading", "disabled", "title"])
475
480
  ]),
476
481
  _: 1
477
- })) : D("", !0)
482
+ })) : M("", !0)
478
483
  ], 64))
479
484
  ], 32));
480
485
  }
481
- }), be = (u, o) => {
482
- const g = u.__vccOpts || u;
483
- for (const [a, l] of o)
484
- g[a] = l;
486
+ }), we = (c, o) => {
487
+ const g = c.__vccOpts || c;
488
+ for (const [s, n] of o)
489
+ g[s] = n;
485
490
  return g;
486
- }, Wt = /* @__PURE__ */ be($t, [["__scopeId", "data-v-13029584"]]), Ct = { class: "wx-service-history" }, Vt = { class: "wx-service-history__number" }, qt = { class: "wx-service-history__who" }, It = /* @__PURE__ */ oe({
491
+ }, Et = /* @__PURE__ */ we(It, [["__scopeId", "data-v-dedea503"]]), Nt = { class: "wx-service-history-tab" }, zt = { class: "wx-service-history" }, At = { class: "wx-service-history__number" }, Ot = { class: "wx-service-history__who" }, Pt = /* @__PURE__ */ ce({
487
492
  name: "WxServiceHistory",
488
493
  __name: "ServiceHistory",
489
- setup(u) {
490
- const o = ie(), g = ce(o), a = _t();
491
- ue();
492
- const l = ae("webx-services"), O = me(), r = b(null), W = b(!1), s = y(() => a?.service.value ?? null), x = y(() => a?.canManage ?? !1), T = y(
493
- () => s.value?.status === "published" || s.value?.status === "modified" ? r.value?.[0]?.number ?? null : null
494
+ setup(c) {
495
+ const o = le(), g = de(o), s = Wt();
496
+ ve();
497
+ const n = ae("webx-services"), B = me(), a = w(null), V = w(!1), r = y(() => s?.service.value ?? null), m = y(() => s?.canManage ?? !1), k = y(
498
+ () => r.value?.status === "published" || r.value?.status === "modified" ? a.value?.[0]?.number ?? null : null
494
499
  );
495
- async function M() {
496
- const n = s.value;
497
- if (n)
500
+ async function D() {
501
+ const l = r.value;
502
+ if (l)
498
503
  try {
499
- r.value = await g.versions(n.id);
500
- } catch (f) {
501
- r.value = [], S.danger(O(f));
504
+ a.value = await g.versions(l.id);
505
+ } catch (p) {
506
+ a.value = [], W.danger(B(p));
502
507
  }
503
508
  }
504
- async function V(n) {
505
- const f = s.value;
506
- if (!(!f || !await j({
507
- title: l("service.restore-title", { number: n.number }),
508
- message: l("service.restore-text"),
509
- confirmText: l("service.restore-version"),
510
- cancelText: l("panel.cancel")
509
+ async function q(l) {
510
+ const p = r.value;
511
+ if (!(!p || !await te({
512
+ title: n("service.restore-title", { number: l.number }),
513
+ message: n("service.restore-text"),
514
+ confirmText: n("service.restore-version"),
515
+ cancelText: n("panel.cancel")
511
516
  }))) {
512
- W.value = !0;
517
+ V.value = !0;
513
518
  try {
514
- await g.restoreVersion(f.id, n.number), await a?.reload(), S.success(l("service.restored-version", { number: n.number }));
515
- } catch (z) {
516
- S.danger(O(z));
519
+ await g.restoreVersion(p.id, l.number), await s?.reload(), W.success(n("service.restored-version", { number: l.number }));
520
+ } catch (I) {
521
+ W.danger(B(I));
517
522
  } finally {
518
- W.value = !1;
523
+ V.value = !1;
519
524
  }
520
525
  }
521
526
  }
522
527
  return re(
523
- () => [s.value?.id, s.value?.published_at, s.value?.updated_at],
528
+ () => [r.value?.id, r.value?.published_at, r.value?.updated_at],
524
529
  () => {
525
- M();
530
+ D();
526
531
  },
527
532
  { immediate: !0 }
528
- ), (n, f) => (d(), B("div", Ct, [
529
- r.value === null ? (d(), k(e(ne), {
530
- key: 0,
531
- class: "wx-service-history__ghost",
532
- rows: 3
533
- })) : r.value.length === 0 ? (d(), k(e(qe), {
534
- key: 1,
535
- description: e(l)("service.history-empty")
536
- }, null, 8, ["description"])) : (d(!0), B(Y, { key: 2 }, $e(r.value, (p) => (d(), B("div", {
537
- key: p.number,
538
- class: ye(["wx-service-history__row", { "is-live": p.number === T.value }])
539
- }, [
540
- A("code", Vt, w(e(l)("service.version", { number: p.number })), 1),
541
- A("div", qt, [
542
- p.created_at ? (d(), k(e(Fe), {
533
+ ), (l, p) => (v(), P("div", Nt, [
534
+ A("div", zt, [
535
+ a.value === null ? (v(), _(e(ue), {
536
+ key: 0,
537
+ class: "wx-service-history__ghost",
538
+ rows: 3
539
+ })) : a.value.length === 0 ? (v(), _(e(Ie), {
540
+ key: 1,
541
+ description: e(n)("service.history-empty")
542
+ }, null, 8, ["description"])) : (v(!0), P(Y, { key: 2 }, Ce(a.value, (h) => (v(), P("div", {
543
+ key: h.number,
544
+ class: ge(["wx-service-history__row", { "is-live": h.number === k.value }])
545
+ }, [
546
+ A("code", At, x(e(n)("service.version", { number: h.number })), 1),
547
+ A("div", Ot, [
548
+ h.created_at ? (v(), _(e(Ge), {
549
+ key: 0,
550
+ value: h.created_at,
551
+ size: "md",
552
+ tone: "default"
553
+ }, null, 8, ["value"])) : M("", !0),
554
+ f(e(yt), {
555
+ size: "sm",
556
+ tone: "muted"
557
+ }, {
558
+ default: d(() => [
559
+ C(x(h.author ?? e(n)(`service.source-${h.source}`)) + " ", 1),
560
+ h.comment ? (v(), P(Y, { key: 0 }, [
561
+ C(" · " + x(h.comment), 1)
562
+ ], 64)) : M("", !0)
563
+ ]),
564
+ _: 2
565
+ }, 1024)
566
+ ]),
567
+ h.number === k.value ? (v(), _(e(X), {
543
568
  key: 0,
544
- value: p.created_at,
545
- size: "md",
546
- tone: "default"
547
- }, null, 8, ["value"])) : D("", !0),
548
- h(e(vt), {
569
+ type: "success",
570
+ dot: ""
571
+ }, {
572
+ default: d(() => [
573
+ C(x(e(n)("service.version-live")), 1)
574
+ ]),
575
+ _: 1
576
+ })) : M("", !0),
577
+ m.value && h.number !== k.value ? (v(), _(e(ie), {
578
+ key: 1,
549
579
  size: "sm",
550
- tone: "muted"
580
+ variant: "outline",
581
+ loading: V.value,
582
+ onClick: (I) => q(h)
551
583
  }, {
552
- default: c(() => [
553
- _(w(p.author ?? e(l)(`service.source-${p.source}`)) + " ", 1),
554
- p.comment ? (d(), B(Y, { key: 0 }, [
555
- _(" · " + w(p.comment), 1)
556
- ], 64)) : D("", !0)
584
+ default: d(() => [
585
+ C(x(e(n)("service.restore-version")), 1)
557
586
  ]),
558
- _: 2
559
- }, 1024)
560
- ]),
561
- p.number === T.value ? (d(), k(e(Q), {
562
- key: 0,
563
- type: "success",
564
- dot: ""
565
- }, {
566
- default: c(() => [
567
- _(w(e(l)("service.version-live")), 1)
568
- ]),
569
- _: 1
570
- })) : D("", !0),
571
- x.value && p.number !== T.value ? (d(), k(e(X), {
572
- key: 1,
573
- size: "sm",
574
- variant: "outline",
575
- loading: W.value,
576
- onClick: (z) => V(p)
577
- }, {
578
- default: c(() => [
579
- _(w(e(l)("service.restore-version")), 1)
580
- ]),
581
- _: 1
582
- }, 8, ["loading", "onClick"])) : D("", !0)
583
- ], 2))), 128))
587
+ _: 1
588
+ }, 8, ["loading", "onClick"])) : M("", !0)
589
+ ], 2))), 128))
590
+ ]),
591
+ f(e(je), {
592
+ id: r.value?.id,
593
+ entity: "services",
594
+ screen: "services.form",
595
+ "can-restore": m.value,
596
+ stamp: [r.value?.published_at, r.value?.updated_at],
597
+ onRestored: p[0] || (p[0] = (h) => e(s)?.reload())
598
+ }, null, 8, ["id", "can-restore", "stamp"])
584
599
  ]));
585
600
  }
586
- }), zt = /* @__PURE__ */ be(It, [["__scopeId", "data-v-72dccbb1"]]), Et = /* @__PURE__ */ oe({
601
+ }), Bt = /* @__PURE__ */ we(Pt, [["__scopeId", "data-v-3391d602"]]), Dt = /* @__PURE__ */ ce({
587
602
  __name: "ServiceCreateDialog",
588
- setup(u) {
589
- const { open: o, resolve: g, dismiss: a } = pt(), l = ie(), O = ce(l);
590
- ue();
591
- const r = ae("webx-services"), W = b(""), s = b(!1), x = b({}), T = Ze("field");
592
- Te(async () => {
593
- await et(), T.value?.querySelector("input")?.focus();
603
+ setup(c) {
604
+ const { open: o, resolve: g, dismiss: s } = gt(), n = le(), B = de(n);
605
+ ve();
606
+ const a = ae("webx-services"), V = w(""), r = w(!1), m = w({}), k = at("field");
607
+ $e(async () => {
608
+ await rt(), k.value?.querySelector("input")?.focus();
594
609
  });
595
- async function M() {
596
- if (!(W.value.trim() === "" || s.value)) {
597
- s.value = !0, x.value = {};
610
+ async function D() {
611
+ if (!(V.value.trim() === "" || r.value)) {
612
+ r.value = !0, m.value = {};
598
613
  try {
599
- g(await O.create({ title: W.value.trim() }));
600
- } catch (V) {
601
- x.value = V.body?.errors ?? {};
614
+ g(await B.create({ title: V.value.trim() }));
615
+ } catch (q) {
616
+ m.value = q.body?.errors ?? {};
602
617
  } finally {
603
- s.value = !1;
618
+ r.value = !1;
604
619
  }
605
620
  }
606
621
  }
607
- return (V, n) => (d(), k(e(ht), {
622
+ return (q, l) => (v(), _(e(bt), {
608
623
  open: e(o),
609
- "onUpdate:open": n[2] || (n[2] = (f) => tt(o) ? o.value = f : null),
610
- title: e(r)("panel.new-title"),
624
+ "onUpdate:open": l[2] || (l[2] = (p) => it(o) ? o.value = p : null),
625
+ title: e(a)("panel.new-title"),
611
626
  width: 440
612
627
  }, {
613
- footer: c(() => [
614
- h(e(yt), { size: "sm" }, {
615
- default: c(() => [
616
- h(e(X), {
628
+ footer: d(() => [
629
+ f(e(wt), { size: "sm" }, {
630
+ default: d(() => [
631
+ f(e(ie), {
617
632
  variant: "outline",
618
- onClick: n[1] || (n[1] = (f) => e(a)())
633
+ onClick: l[1] || (l[1] = (p) => e(s)())
619
634
  }, {
620
- default: c(() => [
621
- _(w(e(r)("panel.cancel")), 1)
635
+ default: d(() => [
636
+ C(x(e(a)("panel.cancel")), 1)
622
637
  ]),
623
638
  _: 1
624
639
  }),
625
- h(e(X), {
640
+ f(e(ie), {
626
641
  type: "primary",
627
- loading: s.value,
628
- disabled: W.value.trim() === "",
629
- onClick: M
642
+ loading: r.value,
643
+ disabled: V.value.trim() === "",
644
+ onClick: D
630
645
  }, {
631
- default: c(() => [
632
- _(w(e(r)("panel.create")), 1)
646
+ default: d(() => [
647
+ C(x(e(a)("panel.create")), 1)
633
648
  ]),
634
649
  _: 1
635
650
  }, 8, ["loading", "disabled"])
@@ -637,22 +652,22 @@ const Tt = { class: "wx-service-editor__screen" }, St = 1200, $t = /* @__PURE__
637
652
  _: 1
638
653
  })
639
654
  ]),
640
- default: c(() => [
641
- h(e(ft), {
642
- label: e(r)("panel.field-title"),
643
- error: x.value.title?.[0] ?? x.value.slug?.[0],
655
+ default: d(() => [
656
+ f(e(mt), {
657
+ label: e(a)("panel.field-title"),
658
+ error: m.value.title?.[0] ?? m.value.slug?.[0],
644
659
  required: ""
645
660
  }, {
646
- default: c(() => [
661
+ default: d(() => [
647
662
  A("div", {
648
663
  ref_key: "field",
649
- ref: T
664
+ ref: k
650
665
  }, [
651
- h(e(Ie), {
652
- modelValue: W.value,
653
- "onUpdate:modelValue": n[0] || (n[0] = (f) => W.value = f),
654
- "aria-label": e(r)("panel.field-title"),
655
- onKeyup: st(M, ["enter"])
666
+ f(e(Ee), {
667
+ modelValue: V.value,
668
+ "onUpdate:modelValue": l[0] || (l[0] = (p) => V.value = p),
669
+ "aria-label": e(a)("panel.field-title"),
670
+ onKeyup: lt(D, ["enter"])
656
671
  }, null, 8, ["modelValue", "aria-label"])
657
672
  ], 512)
658
673
  ]),
@@ -662,357 +677,357 @@ const Tt = { class: "wx-service-editor__screen" }, St = 1200, $t = /* @__PURE__
662
677
  _: 1
663
678
  }, 8, ["open", "title"]));
664
679
  }
665
- }), Nt = { class: "wx-services" }, At = { class: "wx-services__bar" }, Bt = ["src"], Ot = { class: "wx-service-row__name" }, Pt = { class: "wx-service-row__title" }, Dt = { class: "wx-service-row__address" }, Mt = { class: "wx-service-row__facts" }, Lt = { class: "wx-service-row__chips" }, Rt = { class: "wx-service-row__state" }, Ut = /* @__PURE__ */ oe({
680
+ }), Rt = { class: "wx-services" }, Lt = { class: "wx-services__bar" }, Mt = ["src"], Ut = { class: "wx-service-row__name" }, Ht = { class: "wx-service-row__title" }, Ft = { class: "wx-service-row__address" }, Kt = { class: "wx-service-row__facts" }, Jt = { class: "wx-service-row__chips" }, Gt = { class: "wx-service-row__state" }, jt = /* @__PURE__ */ ce({
666
681
  __name: "ServicesPage",
667
682
  props: {
668
683
  base: { default: "/services" }
669
684
  },
670
- setup(u) {
671
- const o = u, g = ie(), a = ce(g), l = We(), O = Ce();
672
- ue();
673
- const r = ae("webx-services"), W = me(), s = b([]), x = b([]), T = b(!0), M = gt(Et), V = y(() => g.can("services.manage")), n = y(
674
- () => g.state.manifest?.modules.find((t) => t.id === "services")?.title ?? r("module.services")
675
- ), f = y({
676
- get: () => typeof l.query.view == "string" ? l.query.view : "",
685
+ setup(c) {
686
+ const o = c, g = le(), s = de(g), n = Ve(), B = qe();
687
+ ve();
688
+ const a = ae("webx-services"), V = me(), r = w([]), m = w([]), k = w(!0), D = xt(Dt), q = y(() => g.can("services.manage")), l = y(
689
+ () => g.state.manifest?.modules.find((t) => t.id === "services")?.title ?? a("module.services")
690
+ ), p = y({
691
+ get: () => typeof n.query.view == "string" ? n.query.view : "",
677
692
  set: (t) => {
678
- O.replace({
679
- query: { ...l.query, view: t === "" ? void 0 : String(t) }
693
+ B.replace({
694
+ query: { ...n.query, view: t === "" ? void 0 : String(t) }
680
695
  });
681
696
  }
682
- }), p = y(() => f.value === "trashed"), z = y(() => {
683
- const t = l.query.category;
697
+ }), h = y(() => p.value === "trashed"), I = y(() => {
698
+ const t = n.query.category;
684
699
  return typeof t == "string" && t !== "" && Number(t) || null;
685
- }), E = y(() => typeof l.query.q == "string" ? l.query.q : ""), F = b(E.value), K = y(() => [
686
- { value: "", label: r("panel.view-all") },
687
- { value: "published", label: r("panel.view-published") },
688
- { value: "draft", label: r("panel.view-draft") },
689
- { value: "unpublished", label: r("panel.view-unpublished") },
690
- { value: "trashed", label: r("panel.bin"), icon: "trash" }
691
- ]), N = Ke(ge, () => ({
700
+ }), E = y(() => typeof n.query.q == "string" ? n.query.q : ""), G = w(E.value), H = y(() => [
701
+ { value: "", label: a("panel.view-all") },
702
+ { value: "published", label: a("panel.view-published") },
703
+ { value: "draft", label: a("panel.view-draft") },
704
+ { value: "unpublished", label: a("panel.view-unpublished") },
705
+ { value: "trashed", label: a("panel.bin"), icon: "trash" }
706
+ ]), O = Qe(be, () => ({
692
707
  q: E.value,
693
- category: z.value,
694
- filtered: f.value !== ""
695
- })), Z = y(() => V.value && N.sortable.value), q = y(() => E.value !== "" ? r("panel.empty-search") : p.value ? r("panel.empty-bin") : r("panel.empty"));
696
- async function L() {
697
- T.value = !0;
708
+ category: I.value,
709
+ filtered: p.value !== ""
710
+ })), Z = y(() => q.value && O.sortable.value), j = y(() => E.value !== "" ? a("panel.empty-search") : h.value ? a("panel.empty-bin") : a("panel.empty"));
711
+ async function F() {
712
+ k.value = !0;
698
713
  try {
699
- const t = await a.list({
714
+ const t = await s.list({
700
715
  q: E.value,
701
- category: z.value,
702
- status: p.value ? "" : f.value,
703
- trashed: p.value
716
+ category: I.value,
717
+ status: h.value ? "" : p.value,
718
+ trashed: h.value
704
719
  });
705
- s.value = t.data, x.value = t.filters.categories;
720
+ r.value = t.data, m.value = t.filters.categories;
706
721
  } catch (t) {
707
- S.danger(W(t));
722
+ W.danger(V(t));
708
723
  } finally {
709
- T.value = !1;
724
+ k.value = !1;
710
725
  }
711
726
  }
712
727
  re(
713
- () => [f.value, z.value, E.value],
728
+ () => [p.value, I.value, E.value],
714
729
  () => {
715
- L();
730
+ F();
716
731
  }
717
- ), L();
718
- let ee;
719
- re(F, (t) => {
720
- clearTimeout(ee), ee = setTimeout(() => {
721
- O.replace({ query: { ...l.query, q: t.trim() === "" ? void 0 : t } });
732
+ ), F();
733
+ let N;
734
+ re(G, (t) => {
735
+ clearTimeout(N), N = setTimeout(() => {
736
+ B.replace({ query: { ...n.query, q: t.trim() === "" ? void 0 : t } });
722
737
  }, 300);
723
- }), Se(() => clearTimeout(ee));
724
- function P(t) {
725
- O.replace({
726
- query: { ...l.query, category: typeof t == "number" ? String(t) : void 0 }
738
+ }), We(() => clearTimeout(N));
739
+ function T(t) {
740
+ B.replace({
741
+ query: { ...n.query, category: typeof t == "number" ? String(t) : void 0 }
727
742
  });
728
743
  }
729
- function le(t) {
730
- O.push({ path: `${o.base}/${t.id}`, query: { ...l.query } });
744
+ function U(t) {
745
+ B.push({ path: `${o.base}/${t.id}`, query: { ...n.query } });
731
746
  }
732
- async function R() {
733
- const t = await M({});
734
- t && le(t);
747
+ async function pe() {
748
+ const t = await D({});
749
+ t && U(t);
735
750
  }
736
- async function I() {
751
+ async function K() {
737
752
  try {
738
- await N.move(s.value.map((t) => t.id));
753
+ await O.move(r.value.map((t) => t.id));
739
754
  } catch (t) {
740
- S.danger(W(t, r("panel.reorder-failed"))), await L();
755
+ W.danger(V(t, a("panel.reorder-failed"))), await F();
741
756
  }
742
757
  }
743
- function de(t) {
744
- if (!V.value) return [];
745
- if (p.value)
758
+ function z(t) {
759
+ if (!q.value) return [];
760
+ if (h.value)
746
761
  return [
747
762
  {
748
763
  key: "restore",
749
764
  icon: "refresh",
750
- label: r("panel.restore"),
765
+ label: a("panel.restore"),
751
766
  run: () => {
752
- ve(t);
767
+ se(t);
753
768
  }
754
769
  }
755
770
  ];
756
- const m = [
757
- { key: "open", icon: "edit", label: r("panel.open"), run: () => le(t) }
771
+ const S = [
772
+ { key: "open", icon: "edit", label: a("panel.open"), run: () => U(t) }
758
773
  ];
759
- return t.url && t.status !== "draft" && m.push({
774
+ return t.url && t.status !== "draft" && S.push({
760
775
  key: "site",
761
776
  icon: "external-link",
762
- label: r("panel.open-on-site"),
777
+ label: a("panel.open-on-site"),
763
778
  href: t.url
764
- }), t.url && m.push({
779
+ }), t.url && S.push({
765
780
  key: "copy",
766
781
  icon: "copy",
767
- label: r("panel.copy-address"),
782
+ label: a("panel.copy-address"),
768
783
  run: () => {
769
- U(t);
784
+ ne(t);
770
785
  }
771
- }), m.push(
786
+ }), S.push(
772
787
  t.status === "published" || t.status === "modified" ? {
773
788
  key: "unpublish",
774
789
  icon: "eye-off",
775
- label: r("panel.unpublish"),
790
+ label: a("panel.unpublish"),
776
791
  run: () => {
777
- G(() => a.unpublish(t.id), r("panel.unpublished-done"));
792
+ ee(() => s.unpublish(t.id), a("panel.unpublished-done"));
778
793
  }
779
794
  } : {
780
795
  key: "publish",
781
796
  icon: "upload",
782
- label: r("panel.publish"),
797
+ label: a("panel.publish"),
783
798
  run: () => {
784
- G(() => a.publish(t.id), r("panel.published"));
799
+ ee(() => s.publish(t.id), a("panel.published"));
785
800
  }
786
801
  }
787
- ), m.push({
802
+ ), S.push({
788
803
  key: "delete",
789
804
  icon: "trash",
790
- label: r("panel.delete"),
805
+ label: a("panel.delete"),
791
806
  danger: !0,
792
807
  run: () => {
793
- te(t);
808
+ he(t);
794
809
  }
795
- }), m;
810
+ }), S;
796
811
  }
797
- async function te(t) {
798
- await j({
799
- title: r("panel.delete-title", { title: t.title }),
800
- message: r("panel.delete-text"),
801
- confirmText: r("panel.delete"),
802
- cancelText: r("panel.cancel"),
812
+ async function he(t) {
813
+ await te({
814
+ title: a("panel.delete-title", { title: t.title }),
815
+ message: a("panel.delete-text"),
816
+ confirmText: a("panel.delete"),
817
+ cancelText: a("panel.cancel"),
803
818
  tone: "danger"
804
- }) && await G(() => a.remove(t.id), r("panel.deleted"));
819
+ }) && await ee(() => s.remove(t.id), a("panel.deleted"));
805
820
  }
806
- async function ve(t) {
807
- await G(() => a.restore(t.id), r("panel.restored"));
821
+ async function se(t) {
822
+ await ee(() => s.restore(t.id), a("panel.restored"));
808
823
  }
809
- async function G(t, m) {
824
+ async function ee(t, S) {
810
825
  try {
811
- await t(), S.success(m);
812
- } catch (v) {
813
- S.danger(W(v));
826
+ await t(), W.success(S);
827
+ } catch (u) {
828
+ W.danger(V(u));
814
829
  } finally {
815
- await L();
830
+ await F();
816
831
  }
817
832
  }
818
- async function U(t) {
833
+ async function ne(t) {
819
834
  if (t.url)
820
835
  try {
821
- await navigator.clipboard.writeText(t.url), S.success(r("panel.address-copied"));
836
+ await navigator.clipboard.writeText(t.url), W.success(a("panel.address-copied"));
822
837
  } catch {
823
838
  }
824
839
  }
825
840
  function J(t) {
826
841
  return t === "published" || t === "modified" ? "success" : "default";
827
842
  }
828
- function pe(t) {
829
- return p.value ? "—" : t.path === null ? r("panel.no-address") : `/${t.path}`;
843
+ function fe(t) {
844
+ return h.value ? "—" : t.path === null ? a("panel.no-address") : `/${t.path}`;
830
845
  }
831
- const he = y(
832
- () => V.value ? [{ key: "new", label: r("panel.new"), icon: "plus", primary: !0, run: () => {
833
- R();
846
+ const Q = y(
847
+ () => q.value ? [{ key: "new", label: a("panel.new"), icon: "plus", primary: !0, run: () => {
848
+ pe();
834
849
  } }] : []
835
850
  );
836
- return (t, m) => (d(), B("div", Nt, [
837
- h(e(Ge), {
838
- view: f.value,
839
- "onUpdate:view": m[2] || (m[2] = (v) => f.value = v),
840
- title: n.value,
841
- views: K.value,
842
- actions: he.value,
851
+ return (t, S) => (v(), P("div", Rt, [
852
+ f(e(Xe), {
853
+ view: p.value,
854
+ "onUpdate:view": S[2] || (S[2] = (u) => p.value = u),
855
+ title: l.value,
856
+ views: H.value,
857
+ actions: Q.value,
843
858
  padding: "sm"
844
859
  }, {
845
- default: c(() => [
846
- A("div", At, [
847
- h(e(Ie), {
848
- modelValue: F.value,
849
- "onUpdate:modelValue": m[0] || (m[0] = (v) => F.value = v),
860
+ default: d(() => [
861
+ A("div", Lt, [
862
+ f(e(Ee), {
863
+ modelValue: G.value,
864
+ "onUpdate:modelValue": S[0] || (S[0] = (u) => G.value = u),
850
865
  class: "wx-services__search",
851
866
  size: "sm",
852
867
  clearable: "",
853
- placeholder: e(r)("panel.search"),
854
- "aria-label": e(r)("panel.search")
868
+ placeholder: e(a)("panel.search"),
869
+ "aria-label": e(a)("panel.search")
855
870
  }, {
856
- prefix: c(() => [
857
- h(e(_e), {
871
+ prefix: d(() => [
872
+ f(e(Te), {
858
873
  name: "search",
859
874
  size: "sm"
860
875
  })
861
876
  ]),
862
877
  _: 1
863
878
  }, 8, ["modelValue", "placeholder", "aria-label"]),
864
- h(e(mt), {
879
+ f(e(_t), {
865
880
  class: "wx-services__category",
866
- "model-value": z.value,
867
- options: x.value.map((v) => ({ value: v.id, label: v.title })),
868
- placeholder: e(r)("panel.any-category"),
869
- "aria-label": e(r)("panel.filter-category"),
881
+ "model-value": I.value,
882
+ options: m.value.map((u) => ({ value: u.id, label: u.title })),
883
+ placeholder: e(a)("panel.any-category"),
884
+ "aria-label": e(a)("panel.filter-category"),
870
885
  clearable: "",
871
886
  size: "sm",
872
- "onUpdate:modelValue": P
887
+ "onUpdate:modelValue": T
873
888
  }, null, 8, ["model-value", "options", "placeholder", "aria-label"])
874
889
  ]),
875
- T.value && s.value.length === 0 ? (d(), k(e(ne), {
890
+ k.value && r.value.length === 0 ? (v(), _(e(ue), {
876
891
  key: 0,
877
892
  class: "wx-services__loading",
878
893
  rows: 5
879
- })) : s.value.length === 0 ? (d(), k(e(qe), {
894
+ })) : r.value.length === 0 ? (v(), _(e(Ie), {
880
895
  key: 1,
881
- title: q.value,
882
- description: f.value === "" && E.value === "" && z.value === null ? e(r)("panel.empty-help") : void 0
883
- }, null, 8, ["title", "description"])) : (d(), B(Y, { key: 2 }, [
884
- h(e(bt), {
885
- modelValue: s.value,
886
- "onUpdate:modelValue": m[1] || (m[1] = (v) => s.value = v),
887
- class: ye(["wx-services__list", { "is-loading": T.value }]),
896
+ title: j.value,
897
+ description: p.value === "" && E.value === "" && I.value === null ? e(a)("panel.empty-help") : void 0
898
+ }, null, 8, ["title", "description"])) : (v(), P(Y, { key: 2 }, [
899
+ f(e(kt), {
900
+ modelValue: r.value,
901
+ "onUpdate:modelValue": S[1] || (S[1] = (u) => r.value = u),
902
+ class: ge(["wx-services__list", { "is-loading": k.value }]),
888
903
  plain: "",
889
904
  "item-key": "id",
890
905
  handle: Z.value ? "grip" : "row",
891
- "item-label": (v) => v.title,
906
+ "item-label": (u) => u.title,
892
907
  disabled: !Z.value,
893
- onMove: I
908
+ onMove: K
894
909
  }, {
895
- default: c(({ item: v }) => [
896
- (d(), k(at(p.value ? "div" : "router-link"), rt({ class: "wx-service-row" }, p.value ? {} : { to: { path: `${o.base}/${v.id}`, query: e(l).query } }), {
897
- default: c(() => [
910
+ default: d(({ item: u }) => [
911
+ (v(), _(nt(h.value ? "div" : "router-link"), ot({ class: "wx-service-row" }, h.value ? {} : { to: { path: `${o.base}/${u.id}`, query: e(n).query } }), {
912
+ default: d(() => [
898
913
  A("span", {
899
- class: ye(["wx-service-row__cover", { "is-empty": !v.cover }])
914
+ class: ge(["wx-service-row__cover", { "is-empty": !u.cover }])
900
915
  }, [
901
- v.cover?.thumb ? (d(), B("img", {
916
+ u.cover?.thumb ? (v(), P("img", {
902
917
  key: 0,
903
- src: v.cover.thumb,
918
+ src: u.cover.thumb,
904
919
  alt: "",
905
920
  loading: "lazy"
906
- }, null, 8, Bt)) : (d(), k(e(_e), {
921
+ }, null, 8, Mt)) : (v(), _(e(Te), {
907
922
  key: 1,
908
923
  name: "image",
909
924
  size: "sm"
910
925
  }))
911
926
  ], 2),
912
- A("span", Ot, [
913
- A("span", Pt, w(v.title), 1),
914
- A("span", Dt, [
915
- _(w(pe(v)), 1),
916
- p.value ? D("", !0) : (d(), k(e(je), {
927
+ A("span", Ut, [
928
+ A("span", Ht, x(u.title), 1),
929
+ A("span", Ft, [
930
+ C(x(fe(u)), 1),
931
+ h.value ? M("", !0) : (v(), _(e(Ze), {
917
932
  key: 0,
918
- locale: v.address_locale
933
+ locale: u.address_locale
919
934
  }, null, 8, ["locale"]))
920
935
  ])
921
936
  ]),
922
- A("span", Mt, [
923
- A("span", Lt, [
924
- (d(!0), B(Y, null, $e(v.categories, (se, fe) => (d(), B(Y, {
925
- key: se.id
937
+ A("span", Kt, [
938
+ A("span", Jt, [
939
+ (v(!0), P(Y, null, Ce(u.categories, (R, ye) => (v(), P(Y, {
940
+ key: R.id
926
941
  }, [
927
- fe === 0 ? (d(), k(e(wt), {
942
+ ye === 0 ? (v(), _(e(Tt), {
928
943
  key: 0,
929
- content: e(r)("panel.main-category")
944
+ content: e(a)("panel.main-category")
930
945
  }, {
931
- default: c(() => [
932
- h(e(Q), {
946
+ default: d(() => [
947
+ f(e(X), {
933
948
  size: "sm",
934
949
  round: "",
935
950
  type: "primary"
936
951
  }, {
937
- default: c(() => [
938
- _(w(se.title), 1)
952
+ default: d(() => [
953
+ C(x(R.title), 1)
939
954
  ]),
940
955
  _: 2
941
956
  }, 1024)
942
957
  ]),
943
958
  _: 2
944
- }, 1032, ["content"])) : (d(), k(e(Q), {
959
+ }, 1032, ["content"])) : (v(), _(e(X), {
945
960
  key: 1,
946
961
  size: "sm",
947
962
  round: ""
948
963
  }, {
949
- default: c(() => [
950
- _(w(se.title), 1)
964
+ default: d(() => [
965
+ C(x(R.title), 1)
951
966
  ]),
952
967
  _: 2
953
968
  }, 1024))
954
969
  ], 64))), 128))
955
970
  ]),
956
- A("span", Rt, [
957
- h(e(Q), {
958
- type: J(v.status),
971
+ A("span", Gt, [
972
+ f(e(X), {
973
+ type: J(u.status),
959
974
  dot: "",
960
975
  size: "sm"
961
976
  }, {
962
- default: c(() => [
963
- _(w(e(r)(`panel.status-${v.status}`)), 1)
977
+ default: d(() => [
978
+ C(x(e(a)(`panel.status-${u.status}`)), 1)
964
979
  ]),
965
980
  _: 2
966
981
  }, 1032, ["type"]),
967
- v.status === "modified" ? (d(), k(e(Q), {
982
+ u.status === "modified" ? (v(), _(e(X), {
968
983
  key: 0,
969
984
  type: "primary",
970
985
  size: "sm",
971
986
  round: ""
972
987
  }, {
973
- default: c(() => [
974
- _(w(e(r)("panel.edits")), 1)
988
+ default: d(() => [
989
+ C(x(e(a)("panel.edits")), 1)
975
990
  ]),
976
991
  _: 1
977
- })) : D("", !0)
992
+ })) : M("", !0)
978
993
  ])
979
994
  ])
980
995
  ]),
981
996
  _: 2
982
997
  }, 1040))
983
998
  ]),
984
- actions: c(({ item: v }) => [
985
- h(e(Je), {
986
- actions: de(v),
987
- label: v.title
999
+ actions: d(({ item: u }) => [
1000
+ f(e(Ye), {
1001
+ actions: z(u),
1002
+ label: u.title
988
1003
  }, null, 8, ["actions", "label"])
989
1004
  ]),
990
1005
  _: 1
991
1006
  }, 8, ["modelValue", "class", "handle", "item-label", "disabled"]),
992
- V.value && !p.value ? (d(), k(e(Ve), {
1007
+ q.value && !h.value ? (v(), _(e(St), {
993
1008
  key: 0,
994
1009
  class: "wx-services__note",
995
1010
  type: "info",
996
- description: e(N).hint.value
997
- }, null, 8, ["description"])) : D("", !0)
1011
+ description: e(O).hint.value
1012
+ }, null, 8, ["description"])) : M("", !0)
998
1013
  ], 64))
999
1014
  ]),
1000
1015
  _: 1
1001
1016
  }, 8, ["view", "title", "views", "actions"])
1002
1017
  ]));
1003
1018
  }
1004
- }), Ht = /* @__PURE__ */ be(Ut, [["__scopeId", "data-v-b32f9ad4"]]);
1005
- function Ft(u = "/services") {
1019
+ }), Qt = /* @__PURE__ */ we(jt, [["__scopeId", "data-v-b32f9ad4"]]);
1020
+ function Xt(c = "/services") {
1006
1021
  return {
1007
1022
  api: "services/categories",
1008
- path: `${u}/categories`,
1023
+ path: `${c}/categories`,
1009
1024
  name: "webx.services.categories",
1010
1025
  module: "service-categories",
1011
1026
  screen: "services.category-form",
1012
1027
  manage: "services.categories.manage",
1013
1028
  count: "services_count",
1014
1029
  // The list narrowed to one category is also where its own order is dragged.
1015
- items: (o) => ({ path: u, query: { category: String(o) } }),
1030
+ items: (o) => ({ path: c, query: { category: String(o) } }),
1016
1031
  words: {
1017
1032
  new: "webx-services::category.new",
1018
1033
  empty: "webx-services::category.empty",
@@ -1032,18 +1047,18 @@ function Ft(u = "/services") {
1032
1047
  }
1033
1048
  };
1034
1049
  }
1035
- function Xt(u = {}) {
1036
- const o = u.path ?? "/services";
1050
+ function as(c = {}) {
1051
+ const o = c.path ?? "/services";
1037
1052
  return [
1038
1053
  {
1039
1054
  id: "services",
1040
1055
  path: o,
1041
1056
  routes: [
1042
- { path: o, name: "webx.services", component: Ht, props: { base: o } },
1057
+ { path: o, name: "webx.services", component: Qt, props: { base: o } },
1043
1058
  {
1044
1059
  path: `${o}/:id(\\d+)`,
1045
1060
  name: "webx.services.edit",
1046
- component: Wt,
1061
+ component: Et,
1047
1062
  props: { base: o }
1048
1063
  }
1049
1064
  ],
@@ -1053,28 +1068,28 @@ function Xt(u = {}) {
1053
1068
  * particular is shared, and reads the prefix from the editor hosting the screen.
1054
1069
  */
1055
1070
  types: {
1056
- "wx-service-history": { component: zt, kind: "display" }
1071
+ "wx-service-history": { component: Bt, kind: "display" }
1057
1072
  }
1058
1073
  },
1059
1074
  {
1060
1075
  id: "service-categories",
1061
1076
  path: `${o}/categories`,
1062
- routes: Qe(Ft(o))
1077
+ routes: et(Xt(o))
1063
1078
  }
1064
1079
  ];
1065
1080
  }
1066
1081
  export {
1067
- ge as SERVICES_API,
1068
- Et as WxServiceCreateDialog,
1069
- Wt as WxServiceEditorPage,
1070
- zt as WxServiceHistory,
1071
- Ht as WxServicesPage,
1072
- ce as createServicesApi,
1073
- xt as provideServiceEditor,
1074
- Ft as serviceCategoriesOptions,
1075
- ze as serviceEditorKey,
1076
- Xt as services,
1077
- kt as servicesMessages,
1078
- _t as useServiceEditor
1082
+ be as SERVICES_API,
1083
+ Dt as WxServiceCreateDialog,
1084
+ Et as WxServiceEditorPage,
1085
+ Bt as WxServiceHistory,
1086
+ Qt as WxServicesPage,
1087
+ de as createServicesApi,
1088
+ $t as provideServiceEditor,
1089
+ Xt as serviceCategoriesOptions,
1090
+ Ne as serviceEditorKey,
1091
+ as as services,
1092
+ Ct as servicesMessages,
1093
+ Wt as useServiceEditor
1079
1094
  };
1080
1095
  //# sourceMappingURL=index.js.map