import { defineComponent as X, computed as g, resolveComponent as M, createBlock as I, openBlock as m, withCtx as x, createElementBlock as C, Fragment as T, renderList as oe, createElementVNode as d, normalizeClass as W, toDisplayString as G, createVNode as s, ref as E, renderSlot as Ne, unref as r, createCommentVNode as U, watch as Re, h as pe, mergeProps as Ee, createSlots as Se, withModifiers as Ue, isRef as J, nextTick as fe } from "vue";
import { J as H, u as ne, Q as Ie, G as Te, A as v, D as $e, a5 as Ye, B as Le, M as ze } from "./index.vue_vue_type_script_setup_true_lang-BMVa5UfU.js";
import { d as Be } from "./vuedraggable-CK8z7qA8.js";
import { b as ve, H as je } from "./app-5fxKLAzS.js";
import { useI18n as le, useCoreStore as Ke, useCustomAttributes as He } from "@feedmepos/mf-common";
import { useBreakpoints as ye, components as _e, useSnackbar as qe, useDialog as Qe, FmButtonVariant as Je } from "@feedmepos/ui-library";
import { _ as We, a as Xe } from "./CustomAttributeChip.vue_vue_type_script_setup_true_lang-BrZhfy-j.js";
import { _ as Ze } from "./app-D-J2cjak.js";
import { _ as et, a as tt } from "./BottomSheetMenuItem.vue_vue_type_script_setup_true_lang-DhrXKy3b.js";
import { c as ot } from "./object-DVUNCr7w.js";
import { u as nt } from "./discardConfirm-BHni0LNu.js";
import { _ as lt } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-B8Tcqib_.js";
import { c as at } from "./check-C9mY6LiX.js";
import { M as ge, x as rt, y as ut, A as st, e as it, i as ct, r as mt } from "./item-BZS28ZS_.js";
import { u as dt } from "./search-BAPEUu1R.js";
import { C as pt } from "./catalog-rNLjUMn-.js";
import { c as ft } from "./menuV2-Da02vc32.js";
const vt = /* @__PURE__ */ X({
  __name: "ResponsiveContextMenu",
  props: {
    items: {}
  },
  setup(L) {
    const S = ye(), u = g(() => S.breakpoints.value.xs);
    return (R, V) => {
      const k = M("FmButton"), f = M("FmMenuItem"), y = M("FmMenu");
      return u.value ? (m(), I(et, { key: 0 }, {
        default: x(() => [
          (m(!0), C(T, null, oe(R.items, ({ icon: h, label: D, disabled: w, itemClass: A, onClick: _ }) => (m(), I(tt, {
            key: D,
            icon: h,
            label: D,
            disabled: w,
            itemClass: A,
            onClick: () => {
              !w && (_ == null || _());
            }
          }, null, 8, ["icon", "label", "disabled", "itemClass", "onClick"]))), 128))
        ]),
        _: 1
      })) : (m(), I(y, {
        key: 1,
        "stop-click-propagation": "",
        shift: !0
      }, {
        "menu-button": x(() => [
          s(k, {
            type: "button",
            variant: "tertiary",
            icon: "more_vert",
            "text-color": "neutral-gray-400",
            size: "md"
          })
        ]),
        default: x(() => [
          (m(!0), C(T, null, oe(R.items, ({ icon: h, label: D, disabled: w, itemClass: A, onClick: _ }) => (m(), I(f, {
            key: D,
            disabled: w,
            onClick: () => {
              !w && (_ == null || _());
            },
            label: D
          }, {
            label: x(() => [
              d("span", {
                class: W(w ? "text-fm-color-typo-disabled" : A)
              }, G(D), 3)
            ]),
            _: 2
          }, 1032, ["disabled", "onClick", "label"]))), 128))
        ]),
        _: 1
      }));
    };
  }
}), gt = { class: "fm-typo-en-title-md-600" }, yt = { class: "flex gap-8 items-center justify-start" }, _t = /* @__PURE__ */ X({
  __name: "ApplyProductDialog",
  props: {
    title: {},
    initialValue: {},
    group: {},
    editable: { type: Boolean }
  },
  emits: ["apply:product"],
  setup(L, { emit: S }) {
    const u = L, R = S, { t: V } = le(), k = u.initialValue.map((A) => ({ _id: A })), f = E(H.clone(k)), y = nt(
      () => !H.isEqual(f.value, k),
      () => {
        h.value = !1;
      }
    ), h = E(!1), D = (A) => {
      at.isBoolean(A) ? h.value = A : h.value = !h.value, h.value && (f.value = u.initialValue.map((_) => ({ _id: _ })));
    }, w = ne();
    return (A, _) => {
      const b = M("fm-button"), q = M("fm-side-sheet");
      return m(), C(T, null, [
        Ne(A.$slots, "default", { trigger: D }),
        s(q, {
          id: "group-form",
          modelValue: h.value,
          "onUpdate:modelValue": _[1] || (_[1] = (N) => h.value = N),
          "is-container": r(_e).FmForm,
          "is-container-props": {
            onValidationSuccess: () => {
              R("apply:product", f.value), D(!1);
            },
            blameFormChildOnValidationFailed: !0
          },
          "max-width": 560,
          "onOn:clickedAway": r(y)
        }, {
          "side-sheet-header": x(() => [
            d("p", gt, G(A.title), 1)
          ]),
          "side-sheet-footer": x(() => [
            d("div", yt, [
              s(b, {
                label: r(V)("common.save"),
                size: "lg",
                type: "submit",
                variant: "primary"
              }, null, 8, ["label"]),
              s(b, {
                label: "Cancel",
                size: "lg",
                variant: "tertiary",
                onClick: D
              })
            ])
          ]),
          default: x(() => [
            s(lt, {
              overrides: f.value,
              "onUpdate:overrides": _[0] || (_[0] = (N) => f.value = N),
              "categorized-items": r(w).categorizedItems,
              editable: A.editable,
              "select-variant": !1,
              "show-variant": !1,
              "link-button-label": r(V)("menu.group.actions.apply_product"),
              title: "Product"
            }, null, 8, ["overrides", "categorized-items", "editable", "link-button-label"])
          ]),
          _: 1
        }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"])
      ], 64);
    };
  }
}), bt = {
  key: 0,
  class: "mt-4"
}, kt = { class: "text-fm-color-typo-secondary mb-2" }, ht = { class: "list-disc list-inside text-fm-color-typo-secondary ml-4 space-y-1" }, Ct = /* @__PURE__ */ X({
  __name: "DeleteGroupDialog",
  props: {
    group: {}
  },
  setup(L) {
    const S = L, { t: u } = le(), R = ne(), V = g(() => S.group.itemsLinked.map((k) => {
      const f = R.state.menu.modules.item.find((y) => y._id === k);
      return (f == null ? void 0 : f.name) || k;
    }).filter(Boolean));
    return (k, f) => (m(), C("div", null, [
      d("div", null, G(r(u)("menu.group.dialogs.delete.message", { name: k.group.name })), 1),
      V.value.length > 0 ? (m(), C("div", bt, [
        d("div", kt, G(r(u)("menu.group.dialogs.delete.unlink_warning", { count: V.value.length })), 1),
        d("ul", ht, [
          (m(!0), C(T, null, oe(V.value, (y) => (m(), C("li", {
            key: y,
            class: "text-sm"
          }, G(y), 1))), 128))
        ])
      ])) : U("", !0)
    ]));
  }
}), wt = {
  key: 1,
  class: "xs:pt-24"
}, Ot = {
  key: 0,
  class: /* @__PURE__ */ W(["flex-1 overflow-hidden", "space-y-8", "flex flex-col", "overflow-hidden", "pt-16"])
}, xt = {
  class: "flex justify-between items-center space-x-8"
}, Dt = {
  class: "w-[320px]"
}, At = {
  key: 0
}, Ft = {
  class: "px-16 py-8"
}, Mt = {
  class: "py-8 px-16"
}, Gt = {
  key: 0,
  class: "px-16 py-8"
}, Pt = {
  class: "flex items-center flex-1"
}, Vt = {
  class: "flex-1 space-y-4"
}, Nt = {
  class: "fm-typo-en-body-lg-600"
}, Rt = {
  key: 0,
  class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
}, Et = {
  class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
}, Zt = /* @__PURE__ */ X({
  __name: "Group",
  emits: ["update:count"],
  setup(L, {
    emit: S
  }) {
    const u = ne(), R = Ke(), V = qe(), k = Ie(Te(V)), f = Qe(), y = g(() => u.rules.group), h = g(() => new ge(u, k.updateMenu, f)), D = g(() => h.value.mapGroups(u.groups, !1)), {
      searchKey: w,
      filter: A
    } = dt(), _ = E(!1), b = E(null), {
      attributes: q,
      filterRule: N,
      mongoQuery: ae
    } = He({
      valueSource: D,
      entity: "group"
    }), z = g(() => {
      const t = (a) => A([a.name, ...Object.values(a.items).flatMap((n) => `${n.code} ${n.name ?? n.fallbackName} ${Le.Dinero.fromFdoDinero(n.price).toFormat()}`), a.type]), e = (a) => !a.customAttributes && !ae.value ? !0 : je(a.customAttributes ?? {}, ae.value);
      return D.value.filter((a) => t(a) && e(a)).filter((a) => !b.value || a.type === b.value);
    }), be = S;
    Re(() => z.value.length, () => {
      be("update:count", z.value.length);
    }, {
      immediate: !0
    });
    const c = g(() => !!u.state.currentCatalogId || !!u.state.currentSchedulerId);
    function re(t) {
      var Y, o;
      const e = !u.state.currentCatalogId, a = !u.state.currentSchedulerId, n = ((Y = u.currentCatalog) == null ? void 0 : Y.priceTierRules) ?? ((o = u.currentCatalog) == null ? void 0 : o.usePriceTiers), i = u.rules.item.bindToVariant, F = u.rules.group.type, p = u.version === v.F_MENU_VERSION.enum.v3, P = u.rules.item.orderFromActiveOnly;
      return {
        link: (O) => !c.value && (!O || i),
        name: (O) => !c.value && !O,
        isDefault: (O) => !c.value,
        type: F && !t._id && !c.value,
        price: !p || t.type !== v.F_ADDON_GROUP_TYPE.enum.DYNAMIC,
        priceEdit: !(n && n.length > 0 && !p && a),
        priceTier: !p && a && e,
        inventory: a ? p ? !c.value && t.type === v.F_ADDON_GROUP_TYPE.enum.NORMAL : !c.value : !1,
        orderFrom: (O) => a ? p ? t.type === v.F_ADDON_GROUP_TYPE.enum.DYNAMIC ? c.value : !!c.value == !O : c.value : !1,
        orderFromActiveOnly: P,
        showOrderFrom: a ? p ? c.value ? !0 : t.type === v.F_ADDON_GROUP_TYPE.enum.PRODUCT : !0 : !1,
        bindToVariant: i,
        isOverride: c.value,
        isItemGroup: !1,
        isV4: !p
      };
    }
    const ke = g(() => {
      const t = !u.state.currentSchedulerId, e = u.rules.group.type, a = u.version === v.F_MENU_VERSION.enum.v3, n = u.rules.item.orderFromActiveOnly, i = u.rules.item.bindToVariant;
      return function(p) {
        return {
          link: (P) => !c.value && (!P || i),
          name: (P) => !c.value && !P,
          isDefault: (P) => !c.value,
          type: e && !p._id && !c.value,
          price: p.type !== v.F_ADDON_GROUP_TYPE.enum.DYNAMIC,
          priceEdit: !0,
          priceTier: u.isV4,
          inventory: t ? a ? !c.value && p.type === v.F_ADDON_GROUP_TYPE.enum.NORMAL : !c.value : !1,
          orderFrom: (P) => t ? a ? p.type === v.F_ADDON_GROUP_TYPE.enum.DYNAMIC ? c.value : !!c.value == !P : c.value : !1,
          orderFromActiveOnly: n,
          showOrderFrom: t ? a ? c.value ? !0 : p.type === v.F_ADDON_GROUP_TYPE.enum.PRODUCT : c.value : !1,
          bindToVariant: i,
          isOverride: c.value,
          isItemGroup: !1,
          isV4: !a
        };
      };
    }), he = g(() => ({
      ...$e.generator.initMenuV4Group(),
      type: u.version === v.F_MENU_VERSION.enum.v4 ? v.F_ADDON_GROUP_TYPE.enum.PRODUCT : v.F_ADDON_GROUP_TYPE.enum.NORMAL,
      items: {},
      position: u.groups.length - 1,
      itemsLinked: []
    })), Z = g(() => ke.value(he.value).type);
    function ue(t) {
      h.value.sortGroups(t);
    }
    function Ce(t) {
      f.open({
        title: l("menu.group.actions.duplicate.title"),
        message: l("menu.group.actions.duplicate.message", {
          name: t.name
        }),
        primaryActions: {
          text: l("menu.common.actions.yes"),
          close: !0
        },
        secondaryActions: {
          text: l("menu.common.actions.cancel"),
          close: !0
        }
      }).onPrimary(() => h.value.duplicateGroup(t));
    }
    const ee = g(() => u.currentCatalog), B = g(() => u.currentScheduler), j = g(() => new pt(ee.value, u, k.updateMenu, f)), te = g(() => new rt(B.value, u, k.updateMenu, f)), we = (t) => {
      let e = t;
      function a(n) {
        const F = u.state.menu.modules.group.find((o) => o._id === n._id), p = (n.items ?? []).reduce((o, O) => (o[O._id] = [...o[O._id] || [], O.combinationKey || ""], o), {}), Y = (F.items ?? []).filter((o) => {
          var O;
          return !((O = p[o._id]) != null && O.includes(o.combinationKey || ""));
        }).map((o) => ({
          _id: o._id,
          combinationKey: o.combinationKey,
          selection: o.selection
        })).filter((o) => !!u.mergedMenu.modules.item.find((O) => O._id === o._id));
        return {
          ...F,
          ...Object.fromEntries(Object.entries(n).filter(([, o]) => !!o)),
          items: [...n.items ?? [], ...Y]
        };
      }
      if (c.value) {
        let n;
        ee.value ? B.value ? n = j.value.getCatalogSchedulerGroup(t._id, B.value._id) : n = j.value.getCatalogGroup(t._id) : n = te.value.getSchedulerGroup(t._id);
        const i = a(n);
        e = new ge(u, k.updateMenu, f).mapGroups([i], !0)[0];
      }
      return {
        group: e,
        config: re,
        categorizedItems: u.categorizedItems
      };
    };
    function Oe(t) {
      f.open({
        title: l("menu.group.dialogs.delete.title"),
        contentComponent: Ct,
        contentComponentProps: {
          group: t
        },
        primaryActions: {
          text: l("menu.common.actions.delete"),
          close: !0,
          variant: Je.Destructive
        },
        secondaryActions: {
          text: l("menu.common.actions.cancel"),
          close: !0
        }
      }).onPrimary(async () => {
        await h.value.deleteGroup(t);
      });
    }
    function se(t, e) {
      return pe(_t, {
        key: t._id,
        initialValue: t.itemsLinked,
        group: it(t),
        editable: y.value.applyProduct,
        "onApply:product": async (a) => {
          var n;
          for (const i of a)
            if (ft(u.state.menu, t._id, i._id)) {
              const F = (n = u.state.menu.modules.item.find((p) => p._id === i._id)) == null ? void 0 : n.name;
              V.open({
                type: "error",
                message: l("menu.product.form.group.circularError", {
                  groupName: t.name,
                  productName: F
                })
              });
              return;
            }
          await h.value.applyItems(t, a.map((i) => i._id));
        }
      }, {
        default: e
      });
    }
    const ie = (t) => {
      const e = t.group;
      return se(e, ({
        trigger: n
      }) => {
        const i = [{
          label: l("menu.common.actions.edit"),
          onClick: () => me(e)
        }, {
          label: l("menu.group.actions.apply_product"),
          disable: !y.value.applyProduct,
          onClick: n
        }, {
          label: l("menu.group.actions.duplicate_action"),
          disabled: !y.value.create,
          onClick: () => Ce(e)
        }, {
          label: l("menu.common.actions.delete"),
          itemClass: "text-fm-color-typo-error",
          disabled: !y.value.delete,
          onClick: () => Oe(e)
        }];
        return s(vt, {
          class: t.className,
          items: i
        }, null);
      });
    }, xe = g(() => [{
      accessorKey: "name",
      header: () => l("menu.group.list.columns.name"),
      enableSorting: !1
    }, {
      accessorKey: "items",
      header: () => l("menu.group.list.columns.products"),
      enableSorting: !1,
      cell: (t) => {
        const e = t.getValue(), a = Object.values(e).map((n) => {
          var F;
          const i = [(n == null ? void 0 : n.code) || "", n.name || n.fallbackName].join(" ").trim();
          return (n.items || []).length > 1 ? `${i} (${l("menu.group.list.variants", {
            count: (F = n.items) == null ? void 0 : F.length
          })})` : i;
        });
        return a.length > 5 ? `${a.slice(0, 5).join(", ")} ${l("menu.group.list.more_items", {
          count: a.length - 5
        })}` : a.join(", ");
      }
    }, {
      accessorKey: "type",
      header: () => l("menu.group.list.columns.type"),
      enableSorting: !1,
      cell: (t) => {
        const e = t.row.original;
        return {
          [v.F_ADDON_GROUP_TYPE.enum.NORMAL]: l("menu.group.list.types.normal"),
          [v.F_ADDON_GROUP_TYPE.enum.PRODUCT]: l("menu.group.list.types.product"),
          [v.F_ADDON_GROUP_TYPE.enum.DYNAMIC]: l("menu.group.list.types.dynamic")
        }[e.type] || "-";
      },
      meta: {
        width: "80px"
      }
    }, {
      id: "tagging",
      accessorKey: "tagging",
      header: () => l("menu.product.table.columns.tagging"),
      enableSorting: !1,
      size: 140,
      cell: (t) => {
        const e = t.row.original;
        return pe(We, {
          // FIXME:FdoCustomAttribute under "@feedmepos/custom-attributes" is not compatible
          // with FdoCustomAttribute from "@feedmepos/core", ! mark should be removed when fixed
          customAttributes: e.customAttributes
        });
      }
    }, {
      accessorKey: "itemsLinked",
      header: () => l("menu.group.list.columns.applied_products"),
      enableSorting: !1,
      cell: (t) => {
        const e = t.getValue(), a = l("menu.group.list.items_linked", {
          count: e.length
        });
        return se(t.row.original, ({
          trigger: n
        }) => s("div", {
          class: "w-fit cursor-pointer border-b border-dashed border-fm-color-neutral-gray-300 hover:border-fm-color-neutral-gray-400",
          onClick: (i) => {
            i.stopPropagation(), n(i);
          }
        }, [a]));
      }
    }, {
      id: "action",
      meta: {
        cellClass: "pl-16",
        headerContentClass: "-mx-16"
      },
      cell: (t) => {
        const e = t.row.original;
        return ie({
          group: e,
          className: "flex justify-end w-full"
        });
      }
    }]), De = g(() => {
      var t;
      return {
        itemsLinked: y.value.showAppliedProduct,
        type: y.value.type,
        tagging: ((t = R.groupAttributeSettings) == null ? void 0 : t.value.length) > 0
      };
    }), Ae = async (t) => {
      const e = ct(t), a = e.group, n = mt(a, re(t));
      if (c.value)
        ee.value ? (B.value ? j.value.overrideCatalogSchedulerGroups([n], B.value._id) : j.value.overrideCatalogGroups([n]), await j.value.update()) : (te.value.overrideSchedulerGroups([n]), await te.value.update());
      else {
        const i = {
          module: v.F_MENU_MODULE_V4_KEY.enum.group,
          operation: ze.F_OPERATION_TYPE.update,
          data: n,
          link: [{
            module: v.F_MENU_MODULE_V4_KEY.enum.item,
            id: "",
            data: e.linkItems
          }]
        };
        await k.updateMenu(i, n.name);
      }
    }, $ = E(null), ce = E(null), me = async (t) => {
      var e;
      $.value = ot(t), await fe(), (e = ce.value) == null || e.trigger(!0);
    };
    function Fe(t) {
      me(t.original);
    }
    const Me = ye(), Ge = g(() => Me.breakpoints.value.xs), {
      t: l
    } = le(), Pe = g(() => {
      var t;
      return ((t = R.groupAttributeSettings) == null ? void 0 : t.value.length) > 0;
    }), K = E(!1), Q = E(null);
    async function Ve() {
      K.value = !K.value, K.value && (await fe(), Q.value && Q.value.toggleProperty(!0));
    }
    const de = () => y.value.multiScheduler ? s(Xe, null, {
      append: () => Pe.value ? s("div", {
        class: "pl-8 flex items-center justify-center border-l border-fm-color-neutral-gray-200",
        onClick: (t) => {
          t.stopPropagation(), Ve();
        }
      }, [s(_e.FmIcon, {
        name: "filter_alt",
        outline: !0,
        color: "neutral-gray-400",
        size: "sm"
      }, null)]) : null
    }) : null;
    return (t, e) => {
      const a = M("fm-button"), n = M("fm-chip"), i = M("fm-menu-item"), F = M("fm-menu"), p = M("fm-search"), P = M("fm-table"), Y = M("fm-bottom-sheet");
      return m(), C(T, null, [$.value ? (m(), I(ut, Ee({
        ref_key: "groupManagerFormRef",
        ref: ce,
        key: $.value._id
      }, we($.value), {
        action: "update",
        title: r(l)("menu.group.dialogs.update.title"),
        group: $.value,
        "onUpdate:group": e[0] || (e[0] = (o) => $.value = o),
        "onSubmit:group": e[1] || (e[1] = (o) => Ae(o))
      }), null, 16, ["title", "group"])) : U("", !0), D.value.length === 0 ? (m(), C("div", wt, [s(Ye, {
        subtitle: r(l)("menu.group.empty.subtitle"),
        title: r(l)("menu.group.empty.title")
      }, Se({
        _: 2
      }, [y.value.create ? {
        name: "action",
        fn: x(() => [s(r(st), null, {
          default: x(({
            trigger: o
          }) => [s(a, {
            "prepend-icon": "add",
            label: r(l)("menu.group.actions.add"),
            onClick: Ue(o, ["stop"])
          }, null, 8, ["label", "onClick"])]),
          _: 1
        })]),
        key: "0"
      } : void 0]), 1032, ["subtitle", "title"])])) : (m(), C(T, {
        key: 2
      }, [Ge.value ? (m(), C(T, {
        key: 1
      }, [d("div", Ft, [s(p, {
        autofocus: "",
        modelValue: r(w),
        "onUpdate:modelValue": e[9] || (e[9] = (o) => J(w) ? w.value = o : null),
        placeholder: r(l)("menu.group.search.placeholder")
      }, null, 8, ["modelValue", "placeholder"])]), e[17] || (e[17] = d("div", {
        class: "bg-fm-color-neutral-gray-100 w-full h-px rounded-md"
      }, null, -1)), d("div", Mt, [s(de), Z.value ? (m(), I(Y, {
        key: 0,
        modelValue: _.value,
        "onUpdate:modelValue": e[14] || (e[14] = (o) => _.value = o)
      }, {
        "bottom-sheet-button": x(() => [s(n, {
          label: r(l)("menu.group.type.title", {
            type: b.value ? r(H.capitalize)(b.value) : r(l)("menu.common.labels.all")
          }),
          class: "text-fm-color-typo-secondary",
          "right-icon": "keyboard_arrow_down"
        }, null, 8, ["label"])]),
        default: x(() => [d("div", null, [d("div", {
          class: "px-16 py-8",
          onClick: e[10] || (e[10] = (o) => b.value = null)
        }, G(r(l)("menu.group.type.all")), 1), d("div", {
          class: "px-16 py-8",
          onClick: e[11] || (e[11] = (o) => b.value = "NORMAL")
        }, G(r(l)("menu.group.type.normal")), 1), d("div", {
          class: "px-16 py-8",
          onClick: e[12] || (e[12] = (o) => b.value = "PRODUCT")
        }, G(r(l)("menu.group.type.product")), 1), d("div", {
          class: "px-16 py-8",
          onClick: e[13] || (e[13] = (o) => b.value = "DYNAMIC")
        }, G(r(l)("menu.group.type.dynamic")), 1)])]),
        _: 1
      }, 8, ["modelValue"])) : U("", !0)]), K.value ? (m(), C("div", Gt, [s(r(ve), {
        ref_key: "attributeFilterRef",
        ref: Q,
        attributes: r(q),
        modelValue: r(N),
        "onUpdate:modelValue": e[15] || (e[15] = (o) => J(N) ? N.value = o : null)
      }, null, 8, ["attributes", "modelValue"])])) : U("", !0), s(r(Be), {
        class: W(["flex-1", "overflow-scroll", "divide-y divide-fm-color-neutral-gray-100", "pb-64"]),
        "model-value": z.value,
        group: "categories",
        handle: ".handle",
        "item-key": "_id",
        "onUpdate:modelValue": e[16] || (e[16] = (o) => ue(o))
      }, {
        item: x(({
          element: o
        }) => [(m(), C("div", {
          key: o._id,
          class: W(["py-12 px-16", "flex  space-x-16", "items-center"])
        }, [d("div", Pt, [d("div", Vt, [d("p", Nt, G(o.name), 1), d("div", null, [Z.value ? (m(), C("p", Rt, G(r(H.capitalize)(o.type)) + " type ", 1)) : U("", !0), d("p", Et, G(r(l)("menu.group.list.products_linked", {
          count: o.itemsLinked.length
        })), 1)])]), s(ie, {
          group: o
        }, null, 8, ["group"])])]))]),
        _: 1
      }, 8, ["model-value"])], 64)) : (m(), C("div", Ot, [d("div", xt, [s(de), Z.value ? (m(), I(F, {
        key: 0
      }, {
        "menu-button": x(() => [s(n, {
          label: r(l)("menu.group.type.title", {
            type: b.value ? r(H.capitalize)(b.value) : r(l)("menu.common.labels.all")
          }),
          class: "text-fm-color-typo-secondary",
          "right-icon": "keyboard_arrow_down"
        }, null, 8, ["label"])]),
        default: x(() => [d("div", null, [s(i, {
          class: "px-16 py-8",
          label: r(l)("menu.group.type.all"),
          onClick: e[2] || (e[2] = (o) => b.value = null)
        }, null, 8, ["label"]), s(i, {
          class: "px-16 py-8",
          label: r(l)("menu.group.type.normal"),
          onClick: e[3] || (e[3] = (o) => b.value = "NORMAL")
        }, null, 8, ["label"]), s(i, {
          class: "px-16 py-8",
          label: r(l)("menu.group.type.product"),
          onClick: e[4] || (e[4] = (o) => b.value = "PRODUCT")
        }, null, 8, ["label"]), s(i, {
          class: "px-16 py-8",
          label: r(l)("menu.group.type.dynamic"),
          onClick: e[5] || (e[5] = (o) => b.value = "DYNAMIC")
        }, null, 8, ["label"])])]),
        _: 1
      })) : U("", !0), d("div", Dt, [s(p, {
        autofocus: "",
        modelValue: r(w),
        "onUpdate:modelValue": e[6] || (e[6] = (o) => J(w) ? w.value = o : null),
        placeholder: r(l)("menu.group.search.placeholder")
      }, null, 8, ["modelValue", "placeholder"])])]), K.value ? (m(), C("div", At, [s(r(ve), {
        ref_key: "attributeFilterRef",
        ref: Q,
        attributes: r(q),
        modelValue: r(N),
        "onUpdate:modelValue": e[7] || (e[7] = (o) => J(N) ? N.value = o : null)
      }, null, 8, ["attributes", "modelValue"])])) : U("", !0), s(Ze, null, {
        default: x(() => [s(P, {
          "column-defs": xe.value,
          "column-visibility": De.value,
          loading: r(k).checkMenuIsLoading(),
          "page-size": z.value.length,
          "row-data": z.value,
          "shrink-at": !1,
          class: "flex-1 overflow-hidden",
          draggable: "",
          "hide-footer": "",
          "pin-header-row": "",
          onRowClick: Fe,
          onDndChanged: e[8] || (e[8] = (o) => ue(o))
        }, null, 8, ["column-defs", "column-visibility", "loading", "page-size", "row-data"])]),
        _: 1
      })]))], 64))], 64);
    };
  }
});
export {
  Zt as _
};
