@webx-ui/module-recipes 0.1.9 → 0.1.11

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