@webx-ui/module-recipes 0.1.1 → 0.1.3

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