@feedmepos/mf-menu-portal 1.0.4-dev.3 → 1.0.4

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.
Files changed (80) hide show
  1. package/dist/{App-nS46pByh.js → App-CgYpEYgp.js} +3 -3
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-C9OSr8ft.js → ApplyProduct.vue_vue_type_script_setup_true_lang-Hdsnu29V.js} +1 -1
  3. package/dist/{BindingTable.vue_vue_type_script_setup_true_lang-DnvN5R5w.js → BindingTable.vue_vue_type_script_setup_true_lang-CWe5_Sm5.js} +1 -1
  4. package/dist/{Catalog-B4RS8T29.js → Catalog-BrHGEI3p.js} +4 -4
  5. package/dist/{CatalogBinding-6_783kbu.js → CatalogBinding-BjTeOA91.js} +3 -3
  6. package/dist/{CatalogEditTabs.vue_vue_type_script_setup_true_lang-BawCLY5-.js → CatalogEditTabs.vue_vue_type_script_setup_true_lang-doB3hsWD.js} +3 -3
  7. package/dist/{CatalogEditor.vue_vue_type_script_setup_true_lang-BjP8ZXyb.js → CatalogEditor.vue_vue_type_script_setup_true_lang-BpBR-N_x.js} +7 -7
  8. package/dist/{CatalogLinkProductAction.vue_vue_type_script_setup_true_lang-Diapahfp.js → CatalogLinkProductAction.vue_vue_type_script_setup_true_lang-P59vHZEn.js} +14 -14
  9. package/dist/{Category-CqneIGq4.js → Category-6-ppsSmZ.js} +5 -5
  10. package/dist/{Category-DNQH1CI7.js → Category-CdsbuUqi.js} +2 -2
  11. package/dist/CategoryList.vue_vue_type_script_setup_true_lang-DlNUOgyu.js +847 -0
  12. package/dist/{CookingGuide-DTAiFmEL.js → CookingGuide-CRyRlBeV.js} +5 -5
  13. package/dist/{Group-5xO2j3CL.js → Group-DVrUlq4i.js} +2 -2
  14. package/dist/{Group-DeUqUomY.js → Group-DqyBHSFx.js} +5 -5
  15. package/dist/GroupList.vue_vue_type_script_setup_true_lang-oGNs8e8f.js +1807 -0
  16. package/dist/Ingredient-CGLfhbvN.js +505 -0
  17. package/dist/LinkProductSideSheet.vue_vue_type_script_setup_true_lang-C0rc1FRO.js +782 -0
  18. package/dist/{MenuSetting-DdekHsQy.js → MenuSetting-Oct3vbHj.js} +4 -4
  19. package/dist/OrderPacing-BDkzflgE.js +769 -0
  20. package/dist/{OrderPacingFields.vue_vue_type_script_setup_true_lang-C3SqQPSr.js → OrderPacingFields.vue_vue_type_script_setup_true_lang-B259anSs.js} +2 -2
  21. package/dist/{Preview-DGTw0POk.js → Preview-V9cSpevb.js} +1 -1
  22. package/dist/{PriceTierNotice.vue_vue_type_script_setup_true_lang-DffhFv0Y.js → PriceTierNotice.vue_vue_type_script_setup_true_lang-k5S4mGCN.js} +1 -1
  23. package/dist/PrintRoute-3UwiMoBU.js +518 -0
  24. package/dist/{Product-CsbcyIgD.js → Product-LaB-YRTQ.js} +4 -4
  25. package/dist/ProductAttributeFilter.vue_vue_type_script_setup_true_lang-B2KdolJS.js +7931 -0
  26. package/dist/{ProductEditorHost.vue_vue_type_script_setup_true_lang--rBKdKV7.js → ProductEditorHost.vue_vue_type_script_setup_true_lang-BBXGnZtc.js} +9 -9
  27. package/dist/ProductGroupCreateSheet.vue_vue_type_script_setup_true_lang-BUC6qUnG.js +2011 -0
  28. package/dist/{ProductImageEditorDialog.vue_vue_type_script_setup_true_lang-DtCzHjpN.js → ProductImageEditorDialog.vue_vue_type_script_setup_true_lang-CjQRRqBx.js} +1 -1
  29. package/dist/{ProductInlineCreateHost.vue_vue_type_script_setup_true_lang-aDx01-WW.js → ProductInlineCreateHost.vue_vue_type_script_setup_true_lang-3yzUcogQ.js} +630 -587
  30. package/dist/{ProductInternalTools-Ccd4dAmx.js → ProductInternalTools-DWCgC825.js} +2 -2
  31. package/dist/{ProductInventoryDialog-DYcKdKHi.js → ProductInventoryDialog-D0d5RywR.js} +1 -1
  32. package/dist/{ProductInventoryDialog.vue_vue_type_script_setup_true_lang-DySFcCJz.js → ProductInventoryDialog.vue_vue_type_script_setup_true_lang-CmYKO0ZX.js} +1 -1
  33. package/dist/ProductList.vue_vue_type_script_setup_true_lang-DeX8Exly.js +2765 -0
  34. package/dist/{ProductVariantTranslationSheet.vue_vue_type_script_setup_true_lang-Dw2xiPYX.js → ProductVariantTranslationSheet.vue_vue_type_script_setup_true_lang-BFD6_Sbb.js} +1 -1
  35. package/dist/{Products-phZwCZhU.js → Products-BLUhwFT-.js} +3 -3
  36. package/dist/Publish-Dkjnls7p.js +1337 -0
  37. package/dist/Recipe-BGfofjHT.js +388 -0
  38. package/dist/{Scheduler-C-A5m92O.js → Scheduler-BL7t8aS7.js} +314 -254
  39. package/dist/ServingSequence-CDFXMCiN.js +374 -0
  40. package/dist/{Setting-C24V-lps.js → Setting-gYZoZxQG.js} +6 -6
  41. package/dist/Subcategory-CnlrVwCy.js +459 -0
  42. package/dist/{Takeaway-BFP2ohJn.js → Takeaway-BWVzwWnh.js} +5 -5
  43. package/dist/{Takeaway-DywX5BiX.js → Takeaway-D8FzvC2w.js} +2 -2
  44. package/dist/{TakeawayList.vue_vue_type_script_setup_true_lang-B3QS7o1v.js → TakeawayList.vue_vue_type_script_setup_true_lang-igS-FXq5.js} +4 -4
  45. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-B8nXazx6.js +1291 -0
  46. package/dist/Unit-Do7Tt8U8.js +424 -0
  47. package/dist/{Variant-BBfWhH-s.js → Variant-D1kLupxx.js} +5 -5
  48. package/dist/{_id_-BooM3FX1.js → _id_-DomaBHrh.js} +3 -3
  49. package/dist/{app-Bmgb8ACe.js → app-C_XNYz8_.js} +312 -312
  50. package/dist/app.js +1 -1
  51. package/dist/apps/mf-menu/src/app.d.ts +60 -0
  52. package/dist/apps/mf-menu/src/components/Product/BulkCategorySelect.vue.d.ts +37 -0
  53. package/dist/apps/mf-menu/src/components/Product/ProductAttributeFilter.vue.d.ts +11 -1
  54. package/dist/apps/mf-menu/src/components/ProductList.vue.d.ts +2 -2
  55. package/dist/apps/mf-menu/src/components/feature/NestedGroupManager/NestedGroupOverrideSheets.vue.d.ts +27 -0
  56. package/dist/apps/mf-menu/src/components/feature/RestaurantAttributesFilter.vue.d.ts +20 -0
  57. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  58. package/dist/assets/{menu-compute-CG-fX5pi.js → menu-compute-Did75Kp9.js} +2 -2
  59. package/dist/assets/{validate-menu-BeGMWVns.js → validate-menu-DVMOLygB.js} +2 -2
  60. package/dist/mf-menu-portal.css +1 -1
  61. package/dist/{provide-CfF0FmUz.js → provide-Bwf3KcOV.js} +67991 -66892
  62. package/dist/{useActionFeedback-DyUCQl2x.js → useActionFeedback-CXx7dOVc.js} +1 -1
  63. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-pY-_msnM.js → vuedraggable-CBtQLb_S.js} +140 -139
  64. package/package.json +2 -2
  65. package/dist/CategoryList.vue_vue_type_script_setup_true_lang-Bt_onPrP.js +0 -797
  66. package/dist/GroupList.vue_vue_type_script_setup_true_lang-Dgya_JLB.js +0 -2183
  67. package/dist/Ingredient-BlDW3TfZ.js +0 -463
  68. package/dist/LinkProductSideSheet.vue_vue_type_script_setup_true_lang-0tCpJlOf.js +0 -709
  69. package/dist/OrderPacing-Bb2n5wmI.js +0 -698
  70. package/dist/PrintRoute-CJB4gIP2.js +0 -473
  71. package/dist/ProductChipSummary.vue_vue_type_script_setup_true_lang-D8DygCBl.js +0 -110
  72. package/dist/ProductGroupCreateSheet.vue_vue_type_script_setup_true_lang-J6LpJ5wT.js +0 -1257
  73. package/dist/ProductList.vue_vue_type_script_setup_true_lang-DTLslTpK.js +0 -10353
  74. package/dist/Publish-BeKIXu3z.js +0 -1261
  75. package/dist/Recipe-Fo4tBkBv.js +0 -350
  76. package/dist/ServingSequence-BrCwLSO7.js +0 -336
  77. package/dist/Subcategory-B0oZIKbw.js +0 -412
  78. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-D7mhnrXx.js +0 -1213
  79. package/dist/Unit-NhEwH-kr.js +0 -385
  80. package/dist/apps/mf-menu/src/views/MenuManagementEditor/RestaurantAttributesFilter.vue.d.ts +0 -2
@@ -0,0 +1,1291 @@
1
+ import { defineComponent as W, computed as F, ref as j, resolveComponent as D, openBlock as p, createElementBlock as R, createVNode as d, withKeys as ie, withModifiers as H, unref as e, normalizeClass as X, withCtx as $, createElementVNode as V, toDisplayString as K, createCommentVNode as U, h as ve, shallowRef as Q, watch as ee, onBeforeUnmount as le, createBlock as B, Fragment as Z, onUnmounted as fe, mergeProps as ge, renderList as oe, onMounted as me, nextTick as ye, renderSlot as be } from "vue";
2
+ import { useI18n as Y } from "@feedmepos/mf-common";
3
+ import { components as _e, useSnackbar as ke, useDialog as we } from "@feedmepos/ui-library";
4
+ import { _ as he } from "./ProductImageEditorDialog.vue_vue_type_script_setup_true_lang-CjQRRqBx.js";
5
+ import { u as xe } from "./useActionFeedback-CXx7dOVc.js";
6
+ import { e as te, u as J, b as pe, N as ue, f as Ce, a as Fe } from "./provide-Bwf3KcOV.js";
7
+ import { _ as $e, b as Ie } from "./ProductInlineCreateHost.vue_vue_type_script_setup_true_lang-3yzUcogQ.js";
8
+ import { _ as de } from "./vuedraggable-CBtQLb_S.js";
9
+ import { _ as ce } from "./ProductFilterMenu.vue_vue_type_script_setup_true_lang-Cgc0Ms_n.js";
10
+ import { _ as Se } from "./TranslationLanguageSelector.vue_vue_type_script_setup_true_lang-BJZ6VcrT.js";
11
+ import { _ as ze } from "./TranslationSideSheet.vue_vue_type_script_setup_true_lang-B0j2PNih.js";
12
+ import { u as Te } from "./useEditorValidation-Ctef5Bxt.js";
13
+ import { O as Ee } from "./LinkProductSideSheet.vue_vue_type_script_setup_true_lang-C0rc1FRO.js";
14
+ import { _ as Re } from "./CatalogLinkProductAction.vue_vue_type_script_setup_true_lang-P59vHZEn.js";
15
+ const Be = { key: 0 }, Le = { class: "fm-typo-en-body-md-600 text-fm-color-neutral-gray-400" }, De = { class: "fm-typo-en-title-sm-600" }, Me = { class: "max-h-[60vh] min-h-0 flex-1 overflow-y-auto" }, Ve = /* @__PURE__ */ W({
16
+ __name: "RestaurantAttributesFilter",
17
+ props: {
18
+ filter: {},
19
+ fullWidth: { type: Boolean, default: !1 }
20
+ },
21
+ emits: ["confirm"],
22
+ setup(A, { emit: _ }) {
23
+ const o = A, l = _, { t } = Y(), c = F(() => o.filter ?? null), m = j(!1), r = j({}), y = j({});
24
+ function x() {
25
+ var b;
26
+ (b = c.value) != null && b.available && (r.value = { ...c.value.selectedCustom }, y.value = { ...c.value.selectedStandard }, m.value = !0);
27
+ }
28
+ function T() {
29
+ l("confirm", {
30
+ custom: r.value,
31
+ standard: y.value
32
+ }), m.value = !1;
33
+ }
34
+ const S = F(
35
+ () => {
36
+ var b;
37
+ return (((b = c.value) == null ? void 0 : b.custom) ?? []).map((v) => ({ ...v, kind: "custom" }));
38
+ }
39
+ ), E = F(
40
+ () => {
41
+ var b;
42
+ return (((b = c.value) == null ? void 0 : b.standard) ?? []).map((v) => ({ ...v, kind: "standard" }));
43
+ }
44
+ ), f = [
45
+ {
46
+ header: () => t("portalshell.customAttributes.form.key"),
47
+ accessorKey: "key",
48
+ enableSorting: !1
49
+ },
50
+ {
51
+ header: () => t("portalshell.customAttributes.form.value"),
52
+ accessorKey: "values",
53
+ enableSorting: !1,
54
+ cell: (b) => {
55
+ const v = b.row.original, M = v.kind === "custom" ? r : y, a = t("menu.common.labels.a11y_labelled_name", {
56
+ label: t(
57
+ v.kind === "custom" ? "menu.link_product.rules.restaurant_custom_attributes_filter" : "menu.link_product.rules.restaurant_filter"
58
+ ),
59
+ name: v.key
60
+ }), g = (k) => {
61
+ var O;
62
+ k.el instanceof HTMLElement && ((O = k.el.querySelector("input")) == null || O.setAttribute("aria-label", a));
63
+ };
64
+ return ve(_e.FmSelect, {
65
+ "aria-label": a,
66
+ modelValue: M.value[v.key] ?? null,
67
+ onVnodeMounted: g,
68
+ onVnodeUpdated: g,
69
+ placeholder: t("portalshell.customAttributes.form.valuePlaceholder"),
70
+ items: v.values.map((k) => ({ label: k, value: k })),
71
+ clearable: !0,
72
+ searchable: !0,
73
+ "onUpdate:modelValue": (k) => {
74
+ M.value = { ...M.value, [v.key]: k ?? "" };
75
+ }
76
+ });
77
+ }
78
+ }
79
+ ];
80
+ return (b, v) => {
81
+ var i;
82
+ const M = D("FmIcon"), a = D("FmChip"), g = D("FmTable"), k = D("FmSpacer"), O = D("FmButton"), n = D("FmDialog");
83
+ return (i = c.value) != null && i.available ? (p(), R("div", Be, [
84
+ d(a, {
85
+ class: X(["cursor-pointer", b.fullWidth ? "w-full justify-between" : ""]),
86
+ role: "button",
87
+ tabindex: "0",
88
+ "aria-label": e(t)("menu.catalog.form.restaurant_attributes_title"),
89
+ onClick: x,
90
+ onKeydown: [
91
+ ie(H(x, ["prevent"]), ["enter"]),
92
+ ie(H(x, ["prevent"]), ["space"])
93
+ ]
94
+ }, {
95
+ default: $(() => [
96
+ V("span", Le, K(e(t)("menu.catalog.form.restaurant_attributes_title")), 1),
97
+ d(M, {
98
+ color: "neutral-gray-400",
99
+ name: "launch",
100
+ size: "sm"
101
+ })
102
+ ]),
103
+ _: 1
104
+ }, 8, ["class", "aria-label", "onKeydown"]),
105
+ d(n, {
106
+ modelValue: m.value,
107
+ "onUpdate:modelValue": v[1] || (v[1] = (z) => m.value = z),
108
+ overlay: !0,
109
+ "min-width": "min(calc(100% - 48px), 560px)"
110
+ }, {
111
+ "dialog-header": $(() => [
112
+ V("div", De, K(e(t)("menu.catalog.form.restaurant_attributes_title")), 1)
113
+ ]),
114
+ "dialog-footer": $(() => [
115
+ d(k),
116
+ d(O, {
117
+ label: e(t)("menu.common.actions.confirm"),
118
+ size: "lg",
119
+ type: "submit",
120
+ variant: "primary",
121
+ onClick: T
122
+ }, null, 8, ["label"]),
123
+ d(O, {
124
+ label: e(t)("menu.common.actions.cancel"),
125
+ size: "lg",
126
+ variant: "tertiary",
127
+ onClick: v[0] || (v[0] = (z) => m.value = !1)
128
+ }, null, 8, ["label"])
129
+ ]),
130
+ default: $(() => [
131
+ V("div", Me, [
132
+ d(de, {
133
+ title: e(t)("menu.link_product.rules.restaurant_custom_attributes_filter")
134
+ }, {
135
+ default: $(() => [
136
+ d(g, {
137
+ "column-defs": f,
138
+ "row-data": S.value,
139
+ "shrink-at": !1,
140
+ "page-size": S.value.length,
141
+ "hide-footer": ""
142
+ }, null, 8, ["row-data", "page-size"])
143
+ ]),
144
+ _: 1
145
+ }, 8, ["title"]),
146
+ d(de, {
147
+ title: e(t)("menu.link_product.rules.restaurant_filter")
148
+ }, {
149
+ default: $(() => [
150
+ d(g, {
151
+ "column-defs": f,
152
+ "row-data": E.value,
153
+ "shrink-at": !1,
154
+ "page-size": E.value.length,
155
+ "hide-footer": ""
156
+ }, null, 8, ["row-data", "page-size"])
157
+ ]),
158
+ _: 1
159
+ }, 8, ["title"])
160
+ ])
161
+ ]),
162
+ _: 1
163
+ }, 8, ["modelValue"])
164
+ ])) : U("", !0);
165
+ };
166
+ }
167
+ }), Ue = { class: "h-full overflow-auto pl-[25px]" }, Ae = {
168
+ key: 1,
169
+ class: "fm-typo-en-body-md-400 p-24 text-center text-fm-color-neutral-gray-400"
170
+ }, Oe = /* @__PURE__ */ W({
171
+ __name: "DetailPane",
172
+ props: {
173
+ selected: {}
174
+ },
175
+ setup(A, { expose: _ }) {
176
+ const o = A, l = te(), { t } = Y(), c = Q(null), m = Q(null), r = Q({ status: "loading" });
177
+ let y = null, x = null;
178
+ const T = F(
179
+ () => r.value.status === "ready" ? r.value.value : null
180
+ );
181
+ function S() {
182
+ var a;
183
+ (a = c.value) == null || a.open("category");
184
+ }
185
+ function E() {
186
+ var g, k;
187
+ const a = (k = (g = o.selected) == null ? void 0 : g.selection) == null ? void 0 : k.itemId;
188
+ f(), a && v(a);
189
+ }
190
+ _({ openCategoryCreate: S, refreshSelected: E });
191
+ function f() {
192
+ var a;
193
+ y == null || y(), y = null, (a = m.value) == null || a.dispose(), m.value = null, r.value = { status: "loading" };
194
+ }
195
+ function b() {
196
+ f(), x == null || x.dispose(), x = null;
197
+ }
198
+ function v(a) {
199
+ x ?? (x = l.item.editorScope());
200
+ const g = l.item.editor(a);
201
+ m.value = g, r.value = g.get(), y = g.subscribe((k) => {
202
+ r.value = k;
203
+ });
204
+ }
205
+ function M(a) {
206
+ var k;
207
+ const g = ((k = T.value) == null ? void 0 : k.itemId) ?? null;
208
+ f(), x == null || x.select(a), g && v(g);
209
+ }
210
+ return ee(
211
+ () => o.selected,
212
+ (a) => {
213
+ var k;
214
+ if (a && !a.selectable) return;
215
+ const g = a == null ? void 0 : a.selection;
216
+ (g == null ? void 0 : g.itemId) !== ((k = T.value) == null ? void 0 : k.itemId) && (f(), g && v(g.itemId));
217
+ },
218
+ { immediate: !0 }
219
+ ), le(b), (a, g) => {
220
+ var k, O, n;
221
+ return p(), R("div", Ue, [
222
+ T.value && m.value ? (p(), B($e, {
223
+ key: 0,
224
+ sdk: e(l),
225
+ session: m.value,
226
+ view: T.value,
227
+ "tree-selection": (k = a.selected) == null ? void 0 : k.selection,
228
+ "item-breadcrumb": (O = a.selected) == null ? void 0 : O.itemBreadcrumb,
229
+ presentation: "tree",
230
+ onCreateEntity: g[0] || (g[0] = (i) => {
231
+ var z;
232
+ return (z = c.value) == null ? void 0 : z.open(i);
233
+ }),
234
+ onSelectScope: g[1] || (g[1] = (i) => M(i))
235
+ }, null, 8, ["sdk", "session", "view", "tree-selection", "item-breadcrumb"])) : (p(), R("p", Ae, K(e(t)("menu.tree_editor.labels.please_select_a_product_to_edit")), 1)),
236
+ d(Ie, {
237
+ ref_key: "inlineCreate",
238
+ ref: c,
239
+ "item-id": ((n = T.value) == null ? void 0 : n.itemId) ?? null,
240
+ presentation: "tree",
241
+ sdk: e(l)
242
+ }, null, 8, ["item-id", "sdk"])
243
+ ]);
244
+ };
245
+ }
246
+ }), Ne = /* @__PURE__ */ W({
247
+ __name: "EditorHistoryControls",
248
+ props: {
249
+ canUndo: { type: Boolean },
250
+ canRedo: { type: Boolean },
251
+ committing: { type: Boolean }
252
+ },
253
+ emits: ["undo", "redo"],
254
+ setup(A, { emit: _ }) {
255
+ const o = _, { t: l } = Y();
256
+ return (t, c) => {
257
+ const m = D("FmButton");
258
+ return p(), R(Z, null, [
259
+ d(m, {
260
+ "aria-label": e(l)("menu.tree_editor.actions.undo"),
261
+ disabled: !t.canUndo || t.committing,
262
+ icon: "undo",
263
+ variant: "tertiary",
264
+ onClick: c[0] || (c[0] = (r) => o("undo"))
265
+ }, null, 8, ["aria-label", "disabled"]),
266
+ d(m, {
267
+ "aria-label": e(l)("menu.tree_editor.actions.redo"),
268
+ disabled: !t.canRedo || t.committing,
269
+ icon: "redo",
270
+ variant: "tertiary",
271
+ onClick: c[1] || (c[1] = (r) => o("redo"))
272
+ }, null, 8, ["aria-label", "disabled"])
273
+ ], 64);
274
+ };
275
+ }
276
+ }), Pe = { class: "space-y-8" }, je = /* @__PURE__ */ W({
277
+ __name: "ScopeSwitcher",
278
+ setup(A) {
279
+ const _ = te(), { t: o } = Y(), l = J(_.context.current), t = J(_.catalog.list), c = J(_.scheduler.list), m = J(_.tree.view), r = F(
280
+ () => l.value.status === "ready" ? l.value.value : { catalogId: null, schedulerId: null }
281
+ ), y = F(() => [
282
+ { label: o("menu.tree_editor.labels.main_catalog"), value: null },
283
+ ...t.value.status === "ready" ? t.value.value.rows.map((f) => ({
284
+ label: f.name,
285
+ value: f.id
286
+ })) : []
287
+ ]), x = F(() => [
288
+ { label: o("menu.tree_editor.labels.all_time"), value: null },
289
+ ...c.value.status === "ready" ? c.value.value.rows.map((f) => ({
290
+ label: f.name,
291
+ value: f.id
292
+ })) : []
293
+ ]), T = F(() => {
294
+ const f = y.value.find(
295
+ (b) => b.value === r.value.catalogId
296
+ );
297
+ return o("menu.common.labels.a11y_labelled_name", {
298
+ label: o("menu.common.labels.catalog"),
299
+ name: (f == null ? void 0 : f.label) ?? o("menu.tree_editor.labels.main_catalog")
300
+ });
301
+ }), S = F(() => {
302
+ const f = x.value.find(
303
+ (b) => b.value === r.value.schedulerId
304
+ );
305
+ return o("menu.common.labels.a11y_labelled_name", {
306
+ label: o("menu.common.labels.scheduler"),
307
+ name: (f == null ? void 0 : f.label) ?? o("menu.tree_editor.labels.all_time")
308
+ });
309
+ }), E = F(
310
+ () => m.value.status === "ready" && m.value.value.schedulerScopeAvailable
311
+ );
312
+ return (f, b) => (p(), R("div", Pe, [
313
+ d(ce, {
314
+ "model-value": r.value.catalogId,
315
+ options: y.value,
316
+ title: T.value,
317
+ "full-width": "",
318
+ "onUpdate:modelValue": b[0] || (b[0] = (v) => e(_).context.select({ catalogId: v }))
319
+ }, null, 8, ["model-value", "options", "title"]),
320
+ E.value ? (p(), B(ce, {
321
+ key: 0,
322
+ "model-value": r.value.schedulerId,
323
+ options: x.value,
324
+ title: S.value,
325
+ "full-width": "",
326
+ "onUpdate:modelValue": b[1] || (b[1] = (v) => e(_).context.select({ schedulerId: v }))
327
+ }, null, 8, ["model-value", "options", "title"])) : U("", !0)
328
+ ]));
329
+ }
330
+ }), Ke = { class: "space-y-8" }, He = /* @__PURE__ */ W({
331
+ __name: "TreeFilter",
332
+ setup(A) {
333
+ const _ = te(), { t: o } = Y(), l = J(_.tree.view), t = F(
334
+ () => l.value.status === "ready" ? l.value.value.restaurantFilter : null
335
+ ), c = j("");
336
+ let m;
337
+ return ee(c, (r) => {
338
+ m && clearTimeout(m), m = setTimeout(() => _.tree.setQuery(r), 300);
339
+ }), fe(() => {
340
+ m && clearTimeout(m);
341
+ }), (r, y) => {
342
+ const x = D("FmSearch");
343
+ return p(), R("div", Ke, [
344
+ d(je),
345
+ d(Ve, {
346
+ filter: t.value,
347
+ "full-width": "",
348
+ onConfirm: y[0] || (y[0] = (T) => e(_).tree.setRestaurantFilter(T))
349
+ }, null, 8, ["filter"]),
350
+ y[2] || (y[2] = V("div", { class: "h-[1px] bg-fm-color-neutral-gray-100" }, null, -1)),
351
+ d(x, {
352
+ modelValue: c.value,
353
+ "onUpdate:modelValue": y[1] || (y[1] = (T) => c.value = T),
354
+ placeholder: e(o)("menu.tree_editor.labels.search")
355
+ }, null, 8, ["modelValue", "placeholder"])
356
+ ]);
357
+ };
358
+ }
359
+ }), We = { class: "fm-typo-en-title-sm-600" }, qe = /* @__PURE__ */ W({
360
+ __name: "CategoryRenameDialog",
361
+ props: {
362
+ categoryId: {}
363
+ },
364
+ emits: ["close"],
365
+ setup(A, { emit: _ }) {
366
+ const o = A, l = _, t = te(), { t: c } = Y(), m = pe(), r = Q(null), y = Q({
367
+ status: "loading"
368
+ }), x = F(
369
+ () => y.value.status === "ready" ? y.value.value : null
370
+ ), T = Te(() => r.value), S = F(
371
+ () => x.value ? T.issue(x.value.fieldIssues, "name") ?? x.value.nameIssue : null
372
+ );
373
+ let E = null;
374
+ const f = Q(null), b = Q(
375
+ null
376
+ ), v = F(
377
+ () => {
378
+ var w;
379
+ return ((w = b.value) == null ? void 0 : w.status) === "ready" ? b.value.value : null;
380
+ }
381
+ ), M = Q(!1);
382
+ let a = null;
383
+ function g(w) {
384
+ var C;
385
+ a == null || a(), a = null, w && ((C = f.value) == null || C.dispose()), f.value = null, b.value = null, M.value = !1;
386
+ }
387
+ function k(w) {
388
+ var C, h;
389
+ g(!0), E == null || E(), E = null, w ? (C = r.value) == null || C.discard() : (h = r.value) == null || h.dispose(), r.value = null, y.value = { status: "loading" };
390
+ }
391
+ ee(
392
+ () => o.categoryId,
393
+ (w) => {
394
+ if (r.value && k(!0), !w) return;
395
+ const C = t.category.editor(w);
396
+ r.value = C, y.value = C.get(), E = C.subscribe((h) => {
397
+ y.value = h;
398
+ });
399
+ },
400
+ { immediate: !0 }
401
+ ), le(() => k(!0));
402
+ async function O() {
403
+ const w = r.value;
404
+ !w || (await T.submit(() => w.submit())).kind !== "success" || (k(!1), l("close"));
405
+ }
406
+ function n() {
407
+ k(!0), l("close");
408
+ }
409
+ function i() {
410
+ var h;
411
+ const w = r.value;
412
+ if (!w || ((h = x.value) == null ? void 0 : h.translation.state) !== "allowed") return;
413
+ g(!0);
414
+ const C = w.translationEditor();
415
+ f.value = C, b.value = C.get(), a = C.subscribe((I) => {
416
+ b.value = I;
417
+ }), M.value = !0;
418
+ }
419
+ function z(w) {
420
+ var I;
421
+ const C = f.value, h = (I = v.value) == null ? void 0 : I.nameLocale;
422
+ if (!(!C || !h)) {
423
+ for (const q of Object.keys(h))
424
+ q in w || C.removeLocale(q);
425
+ for (const [q, u] of Object.entries(w))
426
+ q in h || C.addLocale(q), C.setNameLocale(q, u);
427
+ }
428
+ }
429
+ function P() {
430
+ const w = f.value;
431
+ w && w.apply().kind === "success" && g(!1);
432
+ }
433
+ return (w, C) => {
434
+ const h = D("FmButton"), I = D("FmForm"), q = D("FmSpacer"), u = D("FmDialog");
435
+ return p(), R(Z, null, [
436
+ d(u, {
437
+ "model-value": w.categoryId !== null,
438
+ overlay: !0,
439
+ "min-width": "min(calc(100% - 48px), 480px)",
440
+ "onUpdate:modelValue": C[0] || (C[0] = (s) => !s && n())
441
+ }, {
442
+ "dialog-header": $(() => [
443
+ V("div", We, K(e(c)("menu.category.manager.dialog.update.title")), 1)
444
+ ]),
445
+ "dialog-footer": $(() => [
446
+ d(q),
447
+ d(h, {
448
+ label: e(c)("menu.common.actions.cancel"),
449
+ size: "md",
450
+ variant: "tertiary",
451
+ onClick: n
452
+ }, null, 8, ["label"]),
453
+ d(h, {
454
+ label: e(c)("menu.category.manager.dialog.update.action"),
455
+ size: "md",
456
+ variant: "primary"
457
+ }, null, 8, ["label"])
458
+ ]),
459
+ default: $(() => [
460
+ d(I, { onValidationSuccess: O }, {
461
+ default: $(() => {
462
+ var s;
463
+ return [
464
+ d(Se, ge(
465
+ {
466
+ autofocus: "",
467
+ "error-messages": S.value ? [e(m)(S.value)] : [],
468
+ label: e(c)("menu.category.dialog.add.name.label"),
469
+ placeholder: e(c)("menu.category.dialog.add.name.placeholder"),
470
+ "model-value": ((s = x.value) == null ? void 0 : s.name) ?? ""
471
+ },
472
+ e(T).field("name", (L) => {
473
+ var G;
474
+ return (G = r.value) == null ? void 0 : G.setName(L);
475
+ })
476
+ ), {
477
+ append: $(() => {
478
+ var L;
479
+ return [
480
+ d(h, {
481
+ "aria-label": e(c)("menu.common.translation.translation_label"),
482
+ disabled: ((L = x.value) == null ? void 0 : L.translation.state) !== "allowed",
483
+ icon: "g_translate",
484
+ variant: "tertiary",
485
+ onClick: i
486
+ }, null, 8, ["aria-label", "disabled"])
487
+ ];
488
+ }),
489
+ _: 1
490
+ }, 16, ["error-messages", "label", "placeholder", "model-value"])
491
+ ];
492
+ }),
493
+ _: 1
494
+ })
495
+ ]),
496
+ _: 1
497
+ }, 8, ["model-value"]),
498
+ v.value ? (p(), B(ze, {
499
+ key: 0,
500
+ "model-value": M.value,
501
+ dirty: v.value.dirty,
502
+ name: v.value.name,
503
+ "name-locale": v.value.nameLocale,
504
+ "supported-locales": v.value.supportedLocales,
505
+ title: e(c)("menu.common.translation.sheet_title", {
506
+ entity: e(c)("menu.category.entity")
507
+ }),
508
+ "name-section-label": e(c)("menu.common.translation.name_section", {
509
+ entity: e(c)("menu.category.entity")
510
+ }),
511
+ "z-index": 200,
512
+ onDiscard: C[1] || (C[1] = (s) => g(!0)),
513
+ onSave: P,
514
+ "onUpdate:modelValue": C[2] || (C[2] = (s) => !s && g(!0)),
515
+ "onUpdate:name": C[3] || (C[3] = (s) => {
516
+ var L;
517
+ return (L = f.value) == null ? void 0 : L.setName(s);
518
+ }),
519
+ "onUpdate:nameLocale": z
520
+ }, null, 8, ["model-value", "dirty", "name", "name-locale", "supported-locales", "title", "name-section-label"])) : U("", !0)
521
+ ], 64);
522
+ };
523
+ }
524
+ }), ne = /* @__PURE__ */ W({
525
+ __name: "TextChip",
526
+ props: {
527
+ label: {},
528
+ variant: {},
529
+ border: { type: Boolean },
530
+ bold: { type: Boolean, default: !0 },
531
+ size: { default: "md" }
532
+ },
533
+ setup(A) {
534
+ const _ = A, o = {
535
+ neutral: "text-fm-color-typo-neutral bg-fm-color-neutral-gray-100",
536
+ primary: "text-fm-color-typo-primary bg-fm-color-system-primary-100",
537
+ secondary: "text-fm-color-typo-secondary bg-fm-color-system-secondary-100",
538
+ success: "text-fm-color-typo-success bg-fm-color-system-success-100",
539
+ warning: "text-fm-color-primary bg-fm-color-system-warning-100",
540
+ error: "text-fm-color-typo-error bg-fm-color-system-error-100",
541
+ info: "text-fm-color-typo-info bg-fm-color-system-info-100"
542
+ }, l = F(() => _.size === "xs" ? "text-[8px] tracking-wide leading-[10px] no-underline" : _.size === "sm" ? _.bold ? "fm-typo-en-body-sm-600" : "fm-typo-en-body-sm-400" : _.bold ? "fm-typo-en-body-md-600" : "fm-typo-en-body-md-400");
543
+ return (t, c) => (p(), R("span", {
544
+ class: X(["inline-block fm-corner-radius-md px-4 py-[2px] text-nowrap max-w-full", [
545
+ l.value,
546
+ o[t.variant],
547
+ t.border ? "border border-fm-color-neutral-gray-400" : ""
548
+ ]])
549
+ }, K(t.label), 3));
550
+ }
551
+ }), Qe = ["aria-selected", "aria-expanded", "aria-label"], Ye = ["draggable", "data-node-id", "data-testid"], Ge = { class: "flex min-w-0 flex-1 items-center gap-4" }, Je = { class: "flex min-w-0 items-center gap-4" }, Xe = {
552
+ key: 2,
553
+ class: "w-24 shrink-0"
554
+ }, Ze = { class: "flex shrink-0 items-center gap-4" }, et = { class: "tree-right-area relative flex shrink-0 items-center gap-4" }, tt = { class: "absolute right-full flex items-center opacity-0 group-hover:static group-hover:opacity-100 focus-within:static focus-within:opacity-100" }, at = {
555
+ key: 0,
556
+ role: "group"
557
+ }, nt = /* @__PURE__ */ W({
558
+ __name: "TreeRow",
559
+ props: {
560
+ node: {},
561
+ depth: {},
562
+ expanded: {},
563
+ selectedId: {},
564
+ draggingId: {},
565
+ currencySymbol: {}
566
+ },
567
+ emits: ["toggle", "select", "remove", "add-item", "rename", "catalog-link", "drag-start", "drag-end", "drop"],
568
+ setup(A, { emit: _ }) {
569
+ const o = A, l = _, { t, n: c } = Y(), m = F(() => o.expanded.has(o.node.id)), r = F(() => o.node.remove.state === "allowed"), y = F(() => o.node.kind === "item"), x = F(() => o.node.addItem.state === "allowed"), T = F(() => {
570
+ var n;
571
+ return ((n = o.node.rename) == null ? void 0 : n.state) === "allowed";
572
+ }), S = F(
573
+ () => {
574
+ var n;
575
+ return ((n = o.node.linkToCatalog) == null ? void 0 : n.state) === "allowed";
576
+ }
577
+ ), E = F(
578
+ () => {
579
+ var n;
580
+ return ((n = o.node.unlinkFromCatalog) == null ? void 0 : n.state) === "allowed";
581
+ }
582
+ ), f = F(() => o.node.children.length > 0);
583
+ function b(n) {
584
+ l("catalog-link", { node: o.node, linked: n }), y.value && o.node.selectable && l("select", o.node);
585
+ }
586
+ const v = F(
587
+ () => o.node.labelMessage ? t(o.node.labelMessage.code) : o.node.label
588
+ ), M = F(() => {
589
+ const n = o.node.highlight.filter(Boolean);
590
+ if (!n.length) return [{ text: v.value, highlighted: !1 }];
591
+ const i = n.map((z) => z.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
592
+ return v.value.split(new RegExp(`(${i})`, "gi")).map((z, P) => ({
593
+ text: z,
594
+ highlighted: P % 2 === 1
595
+ }));
596
+ }), a = F(() => v.value.trim()), g = F(
597
+ () => ["pl-12", "pl-32", "pl-[52px]", "pl-72", "pl-[92px]", "pl-112"][Math.min(o.depth, 5)]
598
+ ), k = F(() => o.node.kind === "category" || o.node.kind === "subCategory" ? "view_list" : o.node.kind === "group" ? "database" : o.node.kind === "variant" ? "lunch_dining" : "fastfood");
599
+ function O(n) {
600
+ const i = n.currentTarget.getBoundingClientRect(), z = (n.clientY - i.top) / i.height;
601
+ return z < 0.25 ? "before" : z > 0.75 ? "after" : f.value || o.node.kind !== "item" ? "inside" : "after";
602
+ }
603
+ return (n, i) => {
604
+ const z = D("FmIcon"), P = D("FmButton"), w = D("FmTooltip"), C = D("TreeRow", !0);
605
+ return p(), R("li", {
606
+ role: "treeitem",
607
+ "aria-selected": n.node.selectable ? n.selectedId === n.node.id : void 0,
608
+ "aria-expanded": f.value ? m.value : void 0,
609
+ "aria-label": a.value,
610
+ onClick: i[19] || (i[19] = H((h) => n.node.selectable && l("select", n.node), ["stop"]))
611
+ }, [
612
+ V("div", {
613
+ class: X(["tree-row group relative flex max-w-full select-none items-center gap-4 rounded min-h-[32px] py-4 pr-8 hover:bg-fm-color-opacity-sm", [
614
+ g.value,
615
+ n.node.selectable ? "cursor-pointer" : void 0,
616
+ n.selectedId === n.node.id ? "bg-fm-color-system-warning-100" : void 0
617
+ ]]),
618
+ draggable: n.node.draggable,
619
+ "data-node-id": n.node.id,
620
+ "data-testid": `tree-row-${n.node.id}`,
621
+ onDragstart: i[6] || (i[6] = (h) => l("drag-start", n.node)),
622
+ onDragend: i[7] || (i[7] = (h) => l("drag-end")),
623
+ onDragover: i[8] || (i[8] = H(() => {
624
+ }, ["prevent"])),
625
+ onDrop: i[9] || (i[9] = H((h) => l("drop", { node: n.node, position: O(h) }), ["prevent"]))
626
+ }, [
627
+ V("div", Ge, [
628
+ V("div", Je, [
629
+ n.node.draggable ? (p(), B(z, {
630
+ key: 0,
631
+ class: "invisible absolute left-0 shrink-0 text-fm-color-neutral-gray-400 group-hover:visible",
632
+ name: "drag_indicator",
633
+ outline: "",
634
+ size: "sm"
635
+ })) : U("", !0),
636
+ f.value ? (p(), B(P, {
637
+ key: 1,
638
+ class: "shrink-0 !h-24 !w-24 !p-4",
639
+ label: a.value,
640
+ "aria-label": e(t)("menu.common.labels.a11y_labelled_name", {
641
+ label: m.value ? e(t)("menu.tree_editor.actions.collapse_row") : e(t)("menu.tree_editor.actions.expand_row"),
642
+ name: a.value
643
+ }),
644
+ size: "md",
645
+ variant: "tertiary",
646
+ onClick: i[0] || (i[0] = H((h) => l("toggle", n.node.id), ["stop"]))
647
+ }, {
648
+ default: $(() => [
649
+ d(z, {
650
+ name: m.value ? "expand_more" : "chevron_right",
651
+ color: "neutral-gray-400",
652
+ outline: "",
653
+ size: "sm"
654
+ }, null, 8, ["name"])
655
+ ]),
656
+ _: 1
657
+ }, 8, ["label", "aria-label"])) : (p(), R("span", Xe)),
658
+ d(z, {
659
+ name: k.value,
660
+ class: "shrink-0 text-fm-color-neutral-gray-400",
661
+ outline: "",
662
+ size: "sm"
663
+ }, null, 8, ["name"]),
664
+ V("span", {
665
+ class: X([
666
+ "fm-typo-en-body-md-400 min-w-0 flex-1 truncate",
667
+ n.selectedId === n.node.id ? "text-fm-color-primary" : void 0
668
+ ])
669
+ }, [
670
+ (p(!0), R(Z, null, oe(M.value, (h, I) => (p(), R("span", {
671
+ key: I,
672
+ class: X(
673
+ h.highlighted ? "bg-fm-color-system-warning-100" : void 0
674
+ )
675
+ }, K(h.text), 3))), 128))
676
+ ], 2)
677
+ ]),
678
+ V("div", Ze, [
679
+ n.node.kind === "category" && n.node.itemCount > 0 ? (p(), B(ne, {
680
+ key: 0,
681
+ label: e(t)("menu.tree_editor.labels.products", { count: n.node.itemCount }),
682
+ class: "shrink-0",
683
+ size: "xs",
684
+ variant: "neutral"
685
+ }, null, 8, ["label"])) : U("", !0),
686
+ y.value && n.node.groupCount > 0 ? (p(), B(ne, {
687
+ key: 1,
688
+ label: e(t)("menu.tree_editor.labels.groups", { count: n.node.groupCount }),
689
+ class: "shrink-0",
690
+ size: "xs",
691
+ variant: "neutral"
692
+ }, null, 8, ["label"])) : U("", !0),
693
+ y.value && n.node.variantCount > 0 ? (p(), B(ne, {
694
+ key: 2,
695
+ label: e(t)("menu.tree_editor.labels.variants", {
696
+ count: n.node.variantCount
697
+ }),
698
+ class: "shrink-0",
699
+ size: "xs",
700
+ variant: "neutral"
701
+ }, null, 8, ["label"])) : U("", !0),
702
+ n.node.orderFrom ? (p(), B(ne, {
703
+ key: 3,
704
+ label: e(t)(e(Ee)[n.node.orderFrom]),
705
+ border: "",
706
+ class: "shrink-0",
707
+ size: "xs",
708
+ variant: "neutral"
709
+ }, null, 8, ["label"])) : U("", !0)
710
+ ])
711
+ ]),
712
+ V("div", et, [
713
+ V("div", tt, [
714
+ x.value ? (p(), B(w, {
715
+ key: 0,
716
+ class: "shrink-0",
717
+ content: e(t)("menu.tree_editor.actions.add_product"),
718
+ placement: "top",
719
+ "z-index": 999
720
+ }, {
721
+ default: $(() => [
722
+ d(P, {
723
+ "aria-label": e(t)("menu.common.labels.a11y_labelled_name", {
724
+ label: e(t)("menu.tree_editor.actions.add_product"),
725
+ name: a.value
726
+ }),
727
+ class: "shrink-0 !h-24 !w-24 !p-4 opacity-0 focus-visible:opacity-100 group-hover:opacity-100",
728
+ label: a.value,
729
+ size: "md",
730
+ variant: "tertiary",
731
+ onClick: i[1] || (i[1] = H((h) => l("add-item", n.node), ["stop"]))
732
+ }, {
733
+ default: $(() => [
734
+ d(z, {
735
+ name: "add",
736
+ color: "neutral-gray-400",
737
+ outline: "",
738
+ size: "sm"
739
+ })
740
+ ]),
741
+ _: 1
742
+ }, 8, ["aria-label", "label"])
743
+ ]),
744
+ _: 1
745
+ }, 8, ["content"])) : U("", !0),
746
+ T.value ? (p(), B(w, {
747
+ key: 1,
748
+ class: "shrink-0",
749
+ content: e(t)("menu.tree_editor.actions.edit_category"),
750
+ placement: "top",
751
+ "z-index": 999
752
+ }, {
753
+ default: $(() => [
754
+ d(P, {
755
+ "aria-label": e(t)("menu.common.labels.a11y_labelled_name", {
756
+ label: e(t)("menu.tree_editor.actions.edit_category"),
757
+ name: a.value
758
+ }),
759
+ class: "shrink-0 !h-24 !w-24 !p-4 opacity-0 focus-visible:opacity-100 group-hover:opacity-100",
760
+ label: a.value,
761
+ size: "md",
762
+ variant: "tertiary",
763
+ onClick: i[2] || (i[2] = H((h) => l("rename", n.node), ["stop"]))
764
+ }, {
765
+ default: $(() => [
766
+ d(z, {
767
+ name: "edit",
768
+ color: "neutral-gray-400",
769
+ outline: "",
770
+ size: "sm"
771
+ })
772
+ ]),
773
+ _: 1
774
+ }, 8, ["aria-label", "label"])
775
+ ]),
776
+ _: 1
777
+ }, 8, ["content"])) : U("", !0),
778
+ r.value ? (p(), B(w, {
779
+ key: 2,
780
+ class: "shrink-0",
781
+ content: y.value ? e(t)("menu.tree_editor.actions.delete_product") : e(t)("menu.tree_editor.actions.delete_category"),
782
+ placement: "top",
783
+ "z-index": 999
784
+ }, {
785
+ default: $(() => [
786
+ d(P, {
787
+ "aria-label": e(t)("menu.common.labels.a11y_labelled_name", {
788
+ label: y.value ? e(t)("menu.tree_editor.actions.delete_product") : e(t)("menu.tree_editor.actions.delete_category"),
789
+ name: a.value
790
+ }),
791
+ class: "shrink-0 !h-24 !w-24 !p-4 opacity-0 focus-visible:opacity-100 group-hover:opacity-100",
792
+ label: a.value,
793
+ size: "md",
794
+ variant: "tertiary",
795
+ onClick: i[3] || (i[3] = H((h) => l("remove", n.node), ["stop"]))
796
+ }, {
797
+ default: $(() => [
798
+ d(z, {
799
+ name: "delete",
800
+ color: "neutral-gray-400",
801
+ outline: "",
802
+ size: "sm"
803
+ })
804
+ ]),
805
+ _: 1
806
+ }, 8, ["aria-label", "label"])
807
+ ]),
808
+ _: 1
809
+ }, 8, ["content"])) : U("", !0),
810
+ S.value ? (p(), B(w, {
811
+ key: 3,
812
+ class: "shrink-0",
813
+ content: y.value ? e(t)("menu.tree_editor.actions.link_product_to_catalog") : e(t)("menu.tree_editor.actions.link_category_to_catalog"),
814
+ placement: "top",
815
+ "z-index": 999
816
+ }, {
817
+ default: $(() => [
818
+ d(P, {
819
+ "aria-label": e(t)("menu.common.labels.a11y_labelled_name", {
820
+ label: y.value ? e(t)("menu.tree_editor.actions.link_product_to_catalog") : e(t)("menu.tree_editor.actions.link_category_to_catalog"),
821
+ name: a.value
822
+ }),
823
+ class: "shrink-0 !h-24 !w-24 !p-4 opacity-0 focus-visible:opacity-100 group-hover:opacity-100",
824
+ label: a.value,
825
+ size: "md",
826
+ variant: "tertiary",
827
+ onClick: i[4] || (i[4] = H((h) => b(!0), ["stop"]))
828
+ }, {
829
+ default: $(() => [
830
+ d(z, {
831
+ name: "add_link",
832
+ color: "neutral-gray-400",
833
+ outline: "",
834
+ size: "sm"
835
+ })
836
+ ]),
837
+ _: 1
838
+ }, 8, ["aria-label", "label"])
839
+ ]),
840
+ _: 1
841
+ }, 8, ["content"])) : U("", !0),
842
+ E.value ? (p(), B(w, {
843
+ key: 4,
844
+ class: "shrink-0",
845
+ content: e(t)("menu.tree_editor.actions.unlink_product_from_catalog"),
846
+ placement: "top",
847
+ "z-index": 999
848
+ }, {
849
+ default: $(() => [
850
+ d(P, {
851
+ "aria-label": e(t)("menu.common.labels.a11y_labelled_name", {
852
+ label: e(t)(
853
+ "menu.tree_editor.actions.unlink_product_from_catalog"
854
+ ),
855
+ name: a.value
856
+ }),
857
+ class: "shrink-0 !h-24 !w-24 !p-4 opacity-0 focus-visible:opacity-100 group-hover:opacity-100",
858
+ label: a.value,
859
+ size: "md",
860
+ variant: "tertiary",
861
+ onClick: i[5] || (i[5] = H((h) => b(!1), ["stop"]))
862
+ }, {
863
+ default: $(() => [
864
+ d(z, {
865
+ name: "link_off",
866
+ color: "neutral-gray-400",
867
+ outline: "",
868
+ size: "sm"
869
+ })
870
+ ]),
871
+ _: 1
872
+ }, 8, ["aria-label", "label"])
873
+ ]),
874
+ _: 1
875
+ }, 8, ["content"])) : U("", !0)
876
+ ]),
877
+ n.node.price ? (p(), R("span", {
878
+ key: 0,
879
+ class: X([
880
+ "fm-typo-en-body-md-400 shrink-0",
881
+ n.node.priceTone === "primary" ? "text-fm-color-primary" : "text-fm-color-typo-secondary"
882
+ ])
883
+ }, K(n.currencySymbol) + K(e(c)(n.node.price.amount, {
884
+ minimumFractionDigits: n.node.price.precision,
885
+ maximumFractionDigits: n.node.price.precision
886
+ })), 3)) : U("", !0)
887
+ ])
888
+ ], 42, Ye),
889
+ m.value && f.value ? (p(), R("ul", at, [
890
+ (p(!0), R(Z, null, oe(n.node.children, (h) => (p(), B(C, {
891
+ key: h.id,
892
+ depth: n.depth + 1,
893
+ "dragging-id": n.draggingId,
894
+ expanded: n.expanded,
895
+ "currency-symbol": n.currencySymbol,
896
+ node: h,
897
+ "selected-id": n.selectedId,
898
+ onAddItem: i[10] || (i[10] = (I) => l("add-item", I)),
899
+ onRename: i[11] || (i[11] = (I) => l("rename", I)),
900
+ onCatalogLink: i[12] || (i[12] = (I) => l("catalog-link", I)),
901
+ onRemove: i[13] || (i[13] = (I) => l("remove", I)),
902
+ onDragEnd: i[14] || (i[14] = (I) => l("drag-end")),
903
+ onDragStart: i[15] || (i[15] = (I) => l("drag-start", I)),
904
+ onDrop: i[16] || (i[16] = (I) => l("drop", I)),
905
+ onSelect: i[17] || (i[17] = (I) => l("select", I)),
906
+ onToggle: i[18] || (i[18] = (I) => l("toggle", I))
907
+ }, null, 8, ["depth", "dragging-id", "expanded", "currency-symbol", "node", "selected-id"]))), 128))
908
+ ])) : U("", !0)
909
+ ], 8, Qe);
910
+ };
911
+ }
912
+ }), lt = { class: "relative flex h-full min-h-0 flex-col gap-4 p-8" }, ot = { class: "mt-12 flex items-center justify-between gap-4" }, rt = { class: "fm-typo-en-body-md-400 flex items-center" }, st = { class: "ml-auto flex items-center" }, it = {
913
+ key: 1,
914
+ class: "fm-typo-en-body-md-400 p-16 text-fm-color-neutral-gray-400",
915
+ role: "alert"
916
+ }, ut = {
917
+ key: 2,
918
+ class: "fm-typo-en-body-md-400 p-16 text-fm-color-neutral-gray-400",
919
+ role: "status"
920
+ }, dt = {
921
+ key: 3,
922
+ class: "fm-typo-en-body-md-400 p-16 text-fm-color-neutral-gray-400"
923
+ }, ct = ["aria-label"], mt = {
924
+ key: 0,
925
+ class: "tree-overlay absolute inset-0 flex items-center justify-center bg-white/50"
926
+ }, pt = /* @__PURE__ */ W({
927
+ __name: "TreePanel",
928
+ emits: ["select", "create-category"],
929
+ setup(A, { emit: _ }) {
930
+ const o = te(), { t: l } = Y(), t = ke(), c = pe(), m = _, r = J(o.tree.view), y = J(o.category.list), x = F(
931
+ () => r.value.status === "ready" ? r.value.value : null
932
+ ), T = F(
933
+ () => y.value.status === "ready" && y.value.value.create.state === "allowed"
934
+ ), S = j(/* @__PURE__ */ new Set()), E = j(null), f = j(null), b = j(null), v = j(null), M = j(!1);
935
+ let a = null, g = null;
936
+ function k() {
937
+ const u = v.value;
938
+ M.value = !!u && u.scrollHeight > u.clientHeight + 1;
939
+ }
940
+ function O() {
941
+ var s;
942
+ const u = ((s = v.value) == null ? void 0 : s.querySelector('ul[role="tree"]')) ?? null;
943
+ u !== g && (g && (a == null || a.unobserve(g)), u && (a == null || a.observe(u)), g = u), k();
944
+ }
945
+ me(() => {
946
+ a = new ResizeObserver(O), v.value && a.observe(v.value), O();
947
+ }), le(() => a == null ? void 0 : a.disconnect()), ee([x, S], async () => {
948
+ await ye(), O();
949
+ }), ee(
950
+ () => {
951
+ var u;
952
+ return (u = x.value) == null ? void 0 : u.autoExpandIds;
953
+ },
954
+ (u) => {
955
+ if (!(u != null && u.length)) return;
956
+ const s = new Set(S.value);
957
+ for (const L of u) s.add(L);
958
+ S.value = s;
959
+ },
960
+ // The first published view can already carry a query's matches, so this has
961
+ // to run on mount rather than only on the next change.
962
+ { immediate: !0 }
963
+ );
964
+ function n(u) {
965
+ const s = new Set(S.value);
966
+ s.has(u) ? s.delete(u) : s.add(u), S.value = s;
967
+ }
968
+ function i() {
969
+ var u;
970
+ S.value = new Set(((u = x.value) == null ? void 0 : u.expandableIds) ?? []);
971
+ }
972
+ function z() {
973
+ S.value = /* @__PURE__ */ new Set();
974
+ }
975
+ function P(u) {
976
+ u.selectable && (E.value = u.id, m("select", u));
977
+ }
978
+ function w(u) {
979
+ const s = u.kind === "rejected" ? c(u.issues[0]) : u.kind === "failure" ? c(u.error.message) : null;
980
+ s !== null && t.open({
981
+ type: "error",
982
+ title: l("menu.tree_editor.feedback.update_failed"),
983
+ message: s
984
+ });
985
+ }
986
+ async function C(u) {
987
+ if (!u.entityId) return;
988
+ const s = u.kind === "item" ? await o.item.remove(u.entityId) : await o.category.remove(u.entityId);
989
+ w(s);
990
+ }
991
+ async function h(u) {
992
+ w(
993
+ await o.tree.setCatalogLink(u.node.id, u.linked)
994
+ );
995
+ }
996
+ async function I(u) {
997
+ if (!u.entityId) return;
998
+ const s = o.item.editor(void 0, { loadInventoryCatalogue: !1 });
999
+ try {
1000
+ s.setName(ue), s.setCategory(u.entityId);
1001
+ const L = await s.submit();
1002
+ if (L.kind === "success") {
1003
+ const G = new Set(S.value);
1004
+ G.add(u.id), S.value = G, t.open({
1005
+ type: "success",
1006
+ title: l("menu.tree_editor.feedback.product_created", {
1007
+ name: ue
1008
+ })
1009
+ });
1010
+ return;
1011
+ }
1012
+ w(L);
1013
+ } finally {
1014
+ s.dispose();
1015
+ }
1016
+ }
1017
+ async function q(u) {
1018
+ const s = f.value;
1019
+ if (f.value = null, !s || s === u.node.id) return;
1020
+ const L = await o.tree.rearrange({
1021
+ draggedNodeId: s,
1022
+ targetNodeId: u.node.id,
1023
+ position: u.position
1024
+ });
1025
+ L.kind === "rejected" ? t.open({ message: l(L.issues[0].code), type: "warning" }) : w(L);
1026
+ }
1027
+ return (u, s) => {
1028
+ const L = D("FmButton"), G = D("FmIcon"), re = D("FmTooltip"), se = D("FmCircularProgress");
1029
+ return p(), R("div", lt, [
1030
+ d(He),
1031
+ V("div", ot, [
1032
+ T.value ? (p(), B(L, {
1033
+ key: 0,
1034
+ label: e(l)("menu.tree_editor.actions.add_category"),
1035
+ "prepend-icon": "add",
1036
+ class: "!h-32 shrink-0 !gap-4 !px-8 !py-4",
1037
+ "text-color": "primary",
1038
+ variant: "plain",
1039
+ onClick: s[0] || (s[0] = (ae) => m("create-category"))
1040
+ }, {
1041
+ default: $(() => [
1042
+ V("span", rt, K(e(l)("menu.tree_editor.actions.add_category")), 1)
1043
+ ]),
1044
+ _: 1
1045
+ }, 8, ["label"])) : (p(), B(Re, {
1046
+ key: 1,
1047
+ sdk: e(o),
1048
+ presentation: "tree"
1049
+ }, null, 8, ["sdk"])),
1050
+ V("div", st, [
1051
+ d(re, {
1052
+ content: e(l)("menu.tree_editor.actions.expand_all"),
1053
+ placement: "top",
1054
+ "z-index": 999
1055
+ }, {
1056
+ default: $(() => [
1057
+ d(L, {
1058
+ "aria-label": e(l)("menu.tree_editor.actions.expand_all"),
1059
+ label: e(l)("menu.tree_editor.actions.expand_all"),
1060
+ class: "shrink-0 !h-24 !w-24 !p-4",
1061
+ variant: "tertiary",
1062
+ onClick: i
1063
+ }, {
1064
+ default: $(() => [
1065
+ d(G, {
1066
+ name: "expand_all",
1067
+ color: "neutral-gray-400",
1068
+ outline: "",
1069
+ size: "sm"
1070
+ })
1071
+ ]),
1072
+ _: 1
1073
+ }, 8, ["aria-label", "label"])
1074
+ ]),
1075
+ _: 1
1076
+ }, 8, ["content"]),
1077
+ d(re, {
1078
+ content: e(l)("menu.tree_editor.actions.collapse_all"),
1079
+ placement: "top",
1080
+ "z-index": 999
1081
+ }, {
1082
+ default: $(() => [
1083
+ d(L, {
1084
+ "aria-label": e(l)("menu.tree_editor.actions.collapse_all"),
1085
+ label: e(l)("menu.tree_editor.actions.collapse_all"),
1086
+ class: "shrink-0 !h-24 !w-24 !p-4",
1087
+ variant: "tertiary",
1088
+ onClick: z
1089
+ }, {
1090
+ default: $(() => [
1091
+ d(G, {
1092
+ name: "collapse_all",
1093
+ color: "neutral-gray-400",
1094
+ outline: "",
1095
+ size: "sm"
1096
+ })
1097
+ ]),
1098
+ _: 1
1099
+ }, 8, ["aria-label", "label"])
1100
+ ]),
1101
+ _: 1
1102
+ }, 8, ["content"])
1103
+ ])
1104
+ ]),
1105
+ V("div", {
1106
+ ref_key: "scrollElement",
1107
+ ref: v,
1108
+ class: X(["menu-tree-scroll min-h-0 flex-1 overflow-auto", M.value ? "pr-[14px]" : void 0])
1109
+ }, [
1110
+ e(r).status === "loading" ? (p(), B(se, {
1111
+ key: 0,
1112
+ size: "lg"
1113
+ })) : e(r).status === "error" ? (p(), R("p", it, K(e(c)(e(r).error.message)), 1)) : e(r).status === "unavailable" ? (p(), R("p", ut, K(e(c)(e(r).reason)), 1)) : e(r).status === "ready" && e(r).value.nodes.length === 0 ? (p(), R("p", dt, K(e(l)("menu.tree_editor.labels.no_items")), 1)) : e(r).status === "ready" ? (p(), R("ul", {
1114
+ key: 4,
1115
+ "aria-label": e(l)("menu.tree_editor.labels.tree"),
1116
+ role: "tree"
1117
+ }, [
1118
+ (p(!0), R(Z, null, oe(e(r).value.nodes, (ae) => (p(), B(nt, {
1119
+ key: ae.id,
1120
+ depth: 0,
1121
+ "dragging-id": f.value,
1122
+ expanded: S.value,
1123
+ node: ae,
1124
+ "currency-symbol": e(r).value.currencySymbol,
1125
+ "selected-id": E.value,
1126
+ onAddItem: s[1] || (s[1] = (N) => I(N)),
1127
+ onRename: s[2] || (s[2] = (N) => b.value = N.entityId),
1128
+ onCatalogLink: s[3] || (s[3] = (N) => h(N)),
1129
+ onRemove: s[4] || (s[4] = (N) => C(N)),
1130
+ onDragEnd: s[5] || (s[5] = (N) => f.value = null),
1131
+ onDragStart: s[6] || (s[6] = (N) => f.value = N.id),
1132
+ onDrop: s[7] || (s[7] = (N) => q(N)),
1133
+ onSelect: s[8] || (s[8] = (N) => P(N)),
1134
+ onToggle: s[9] || (s[9] = (N) => n(N))
1135
+ }, null, 8, ["dragging-id", "expanded", "node", "currency-symbol", "selected-id"]))), 128))
1136
+ ], 8, ct)) : U("", !0)
1137
+ ], 2),
1138
+ e(r).status === "ready" && e(r).stale ? (p(), R("div", mt, [
1139
+ d(se, { size: "lg" })
1140
+ ])) : U("", !0),
1141
+ d(qe, {
1142
+ "category-id": b.value,
1143
+ onClose: s[10] || (s[10] = (ae) => b.value = null)
1144
+ }, null, 8, ["category-id"])
1145
+ ]);
1146
+ };
1147
+ }
1148
+ }), vt = { class: "-mx-24 flex min-h-0 flex-1" }, ft = ["aria-label"], gt = ["aria-label"], yt = /* @__PURE__ */ W({
1149
+ __name: "MenuManagementEditor",
1150
+ props: {
1151
+ draft: {}
1152
+ },
1153
+ emits: ["close"],
1154
+ setup(A, { emit: _ }) {
1155
+ const o = A, l = _, { t } = Y(), { run: c } = xe(), m = j(null), r = j(null);
1156
+ function y() {
1157
+ var a;
1158
+ (a = r.value) == null || a.openCategoryCreate();
1159
+ }
1160
+ function x() {
1161
+ var a;
1162
+ o.draft.undo(), (a = r.value) == null || a.refreshSelected();
1163
+ }
1164
+ function T() {
1165
+ var a;
1166
+ o.draft.redo(), (a = r.value) == null || a.refreshSelected();
1167
+ }
1168
+ Ce(o.draft);
1169
+ const S = J(o.draft.state), E = F(
1170
+ () => S.value.status === "ready" ? S.value.value : {
1171
+ dirty: !1,
1172
+ canUndo: !1,
1173
+ canRedo: !1,
1174
+ committing: !1,
1175
+ invalidated: !0
1176
+ }
1177
+ ), f = we();
1178
+ async function b() {
1179
+ (await c(() => o.draft.commit(), {
1180
+ loadingTitle: t("menu.tree_editor.feedback.saving"),
1181
+ successMessage: t("menu.tree_editor.feedback.saved")
1182
+ })).kind === "success" && l("close");
1183
+ }
1184
+ async function v() {
1185
+ (await c(() => o.draft.discard(), {
1186
+ showLoading: !1
1187
+ })).kind === "success" && l("close");
1188
+ }
1189
+ function M() {
1190
+ if (!E.value.dirty) return void v();
1191
+ f.open({
1192
+ title: t("menu.tree_editor.actions.confirm_discard_title"),
1193
+ message: t("menu.tree_editor.actions.confirm_discard_message"),
1194
+ primaryActions: {
1195
+ text: t("menu.tree_editor.actions.discard"),
1196
+ variant: "primary",
1197
+ close: !0
1198
+ },
1199
+ secondaryActions: {
1200
+ text: t("menu.tree_editor.actions.keep_editing"),
1201
+ variant: "tertiary",
1202
+ close: !0
1203
+ }
1204
+ }).onPrimary(() => void v());
1205
+ }
1206
+ return (a, g) => (p(), B(he, {
1207
+ "primary-action": {
1208
+ label: e(t)("menu.tree_editor.actions.save"),
1209
+ disabled: E.value.committing
1210
+ },
1211
+ "secondary-actions": [
1212
+ { label: e(t)("menu.tree_editor.actions.cancel"), click: M }
1213
+ ],
1214
+ show: !0,
1215
+ title: e(t)("menu.tree_editor.title"),
1216
+ onOnCancel: M,
1217
+ onOnPrimary: b
1218
+ }, {
1219
+ "append-title": $(() => [
1220
+ d(Ne, {
1221
+ "can-redo": E.value.canRedo,
1222
+ "can-undo": E.value.canUndo,
1223
+ committing: E.value.committing,
1224
+ onRedo: T,
1225
+ onUndo: x
1226
+ }, null, 8, ["can-redo", "can-undo", "committing"])
1227
+ ]),
1228
+ default: $(() => [
1229
+ V("div", vt, [
1230
+ V("aside", {
1231
+ "aria-label": e(t)("menu.tree_editor.labels.tree"),
1232
+ class: "w-[300px] shrink-0 overflow-hidden border-r bg-fm-color-neutral-white pl-24"
1233
+ }, [
1234
+ d(pt, {
1235
+ onCreateCategory: y,
1236
+ onSelect: g[0] || (g[0] = (k) => m.value = k)
1237
+ })
1238
+ ], 8, ft),
1239
+ V("section", {
1240
+ "aria-label": e(t)("menu.tree_editor.labels.detail"),
1241
+ class: "min-h-0 min-w-0 flex-1 overflow-hidden pr-24",
1242
+ "data-testid": "menu-management-editor-detail-host"
1243
+ }, [
1244
+ d(Oe, {
1245
+ ref_key: "detailPane",
1246
+ ref: r,
1247
+ selected: m.value
1248
+ }, null, 8, ["selected"])
1249
+ ], 8, gt)
1250
+ ])
1251
+ ]),
1252
+ _: 1
1253
+ }, 8, ["primary-action", "secondary-actions", "title"]));
1254
+ }
1255
+ }), bt = "treeEditorOpen", Bt = /* @__PURE__ */ W({
1256
+ __name: "TreeEditorOpenner",
1257
+ props: {
1258
+ canOpen: { type: Boolean },
1259
+ listenForMessage: { type: Boolean, default: !0 }
1260
+ },
1261
+ setup(A) {
1262
+ const _ = A, o = Fe(), l = Q(null);
1263
+ function t() {
1264
+ if (!_.canOpen || l.value) return;
1265
+ const m = o.drafts.open();
1266
+ m.kind === "success" && (l.value = m.value);
1267
+ }
1268
+ function c(m) {
1269
+ var r;
1270
+ _.canOpen && ((r = m.data) == null ? void 0 : r.type) === bt && t();
1271
+ }
1272
+ return me(() => {
1273
+ _.listenForMessage && window.addEventListener("message", c);
1274
+ }), le(() => {
1275
+ var m;
1276
+ _.listenForMessage && window.removeEventListener("message", c), (m = l.value) == null || m.dispose();
1277
+ }), (m, r) => (p(), R(Z, null, [
1278
+ be(m.$slots, "default", { trigger: t }),
1279
+ l.value ? (p(), B(yt, {
1280
+ key: 0,
1281
+ draft: l.value,
1282
+ onClose: r[0] || (r[0] = (y) => l.value = null)
1283
+ }, null, 8, ["draft"])) : U("", !0)
1284
+ ], 64));
1285
+ }
1286
+ });
1287
+ export {
1288
+ Bt as _,
1289
+ ne as a,
1290
+ Ve as b
1291
+ };