import { createElementBlock as R, openBlock as i, createElementVNode as F, defineComponent as ae, ref as A, computed as j, resolveComponent as x, createBlock as T, unref as u, withCtx as M, createVNode as y, toDisplayString as E, Fragment as z, renderList as X, createCommentVNode as J, withModifiers as oe, watch as re, renderSlot as pe } from "vue";
import { u as le, A as ue, I as ee, a5 as ve, J as ie } from "./index.vue_vue_type_script_setup_true_lang-BMVa5UfU.js";
import { useI18n as se, ItemSelector as fe } from "@feedmepos/mf-common";
import { components as de, FmButtonVariant as Z } from "@feedmepos/ui-library";
import { u as _e } from "./discardConfirm-BHni0LNu.js";
import { u as ye } from "./menuV2-Da02vc32.js";
import { _ as ce } from "./_plugin-vue_export-helper-CHgC5LLL.js";
import { m as O, g as Re, h as be, b as ge, u as he, f as te } from "./RuleView.vue_vue_type_script_setup_true_lang-DRUQOy4h.js";
import { c as Ce } from "./check-C9mY6LiX.js";
/* empty css                                                                              */
const Ae = {};
function ke(h, U) {
  return i(), R("div", null, U[0] || (U[0] = [
    F("div", { class: "h-px w-full bg-fm-color-neutral-gray-100" }, null, -1)
  ]));
}
const Fe = /* @__PURE__ */ ce(Ae, [["render", ke]]), Ie = { class: "flex items-center gap-24" }, we = { key: 0 }, Ve = { key: 1 }, xe = { class: "flex flex-col gap-24 h-full" }, $e = { class: "flex flex-col gap-24 overflow-y-auto flex-1" }, Se = { class: "flex flex-col gap-16" }, Ne = { class: "text-fm-color-typo-primary fm-typo-en-body-lg-600" }, Ge = { class: "flex justify-between" }, Oe = { class: "text-fm-color-neutral-gray-400 fm-typo-en-body-lg-600" }, De = { key: 0 }, Me = {
  key: 0,
  class: "text-fm-color-neutral-gray-300 p-16 ml-16"
}, Be = { class: "flex justify-end gap-16" }, Le = /* @__PURE__ */ ae({
  __name: "CatalogLinkItemRuleForm",
  props: {
    isEditMode: {
      type: Boolean,
      default: !0
    },
    orderFrom: {
      type: String,
      required: !0
    },
    existingRuleGroups: {
      type: Array,
      required: !0
    },
    groupCustomRule: {
      type: Object,
      required: !0
    },
    convertCategoryIdToName: {
      type: Function,
      required: !0
    }
  },
  emits: ["update:modelValue", "close-form"],
  setup(h, { emit: U }) {
    const { t: a } = se(), L = h, v = A(!0), $ = U, q = A(L.orderFrom), b = A(""), C = A(
      L.existingRuleGroups.reduce(
        (o, s) => (o[s.id] = !0, o),
        {}
      )
    ), w = A({}), P = j(
      () => {
        var o;
        return (((o = le().state.menu.ruleGroupSettings) == null ? void 0 : o.groups) || []).map((s) => ({
          label: s.name,
          value: s._id
        }));
      }
    ), V = j(() => {
      const o = P.value;
      if (b.value) {
        const s = b.value.toLowerCase(), n = o.filter((r) => C.value[r.value]), p = o.filter(
          (r) => !C.value[r.value] && r.label.toLowerCase().includes(s)
        );
        return [...n, ...p];
      }
      return o.sort((s, n) => {
        const p = C.value[s.value] || !1, r = C.value[n.value] || !1;
        return p && !r ? -1 : !p && r ? 1 : 0;
      });
    }), Y = j(() => {
      var n;
      const o = Object.entries(C.value).filter(([p, r]) => r).map(([p]) => p), s = ((n = le().state.menu.ruleGroupSettings) == null ? void 0 : n.groups) || [];
      return o.map((p) => {
        const r = s.find((c) => c._id === p);
        return {
          ...r,
          rules: (r == null ? void 0 : r.rules.map((c) => {
            var k, S, N, _;
            return {
              ...c,
              _id: c._id,
              restaurantRule: {
                restaurantAttributes: O(
                  (k = c.restaurantRule) == null ? void 0 : k.restaurantAttributes
                ),
                restaurantCustomAttributes: O(
                  (S = c.restaurantRule) == null ? void 0 : S.restaurantCustomAttributes
                )
              },
              itemRule: {
                itemAttributes: L.convertCategoryIdToName(
                  O((N = c.itemRule) == null ? void 0 : N.itemAttributes)
                ),
                itemCustomAttributes: O((_ = c.itemRule) == null ? void 0 : _.itemCustomAttributes)
              }
            };
          })) || []
        };
      }).filter((p) => p !== null);
    }), d = A([]);
    function g(o) {
      var c, k, S, N;
      const s = ((c = o.restaurantRule) == null ? void 0 : c.restaurantAttributes.rules) ?? [], n = ((k = o.restaurantRule) == null ? void 0 : k.restaurantCustomAttributes.rules) ?? [], p = ((S = o.itemRule) == null ? void 0 : S.itemAttributes.rules) ?? [], r = ((N = o.itemRule) == null ? void 0 : N.itemCustomAttributes.rules) ?? [];
      return [
        ...s.map((_) => ({
          ..._,
          property: `${a("menu.catalog.usage.restaurant")} ${_.property}`
        })),
        ...n.map((_) => ({
          ..._,
          property: `${a("menu.catalog.usage.restaurant")} ${_.property}`
        })),
        ...p.map((_) => ({
          ..._,
          property: `${a("menu.product.title")} ${_.property}`
        })),
        ...r.map((_) => ({
          ..._,
          property: `${a("menu.product.title")} ${_.property}`
        }))
      ];
    }
    function I() {
      var k, S, N, _, W, m, t, l;
      const o = L.groupCustomRule, s = Object.entries(C.value).filter(([e, G]) => G).map(([e]) => e), n = [], p = [], r = [], c = [];
      d.value.length > 0 && (d.value.forEach((e) => {
        e.property.startsWith("restaurant_attr") ? n.push({
          property: e.property.replace("restaurant_attr_", ""),
          operator: e.operator,
          value: e.value,
          type: e.type
        }) : e.property.startsWith("restaurant_custom") ? p.push({
          property: e.property.replace("restaurant_custom_", ""),
          operator: e.operator,
          value: e.value,
          type: e.type
        }) : e.property.startsWith("item_attr") ? r.push({
          property: e.property.replace("item_attr_", ""),
          operator: e.operator,
          value: e.value,
          type: e.type
        }) : e.property.startsWith("item_custom") && c.push({
          property: e.property.replace("item_custom_", ""),
          operator: e.operator,
          value: e.value,
          type: e.type
        });
      }), o.restaurantRule = {
        restaurantAttributes: {
          logic: ((S = (k = o.restaurantRule) == null ? void 0 : k.restaurantAttributes) == null ? void 0 : S.logic) ?? "AND",
          rules: n
        },
        restaurantCustomAttributes: {
          logic: ((_ = (N = o.restaurantRule) == null ? void 0 : N.restaurantCustomAttributes) == null ? void 0 : _.logic) ?? "AND",
          rules: p
        }
      }, o.itemRule = {
        itemAttributes: {
          logic: ((m = (W = o.itemRule) == null ? void 0 : W.itemAttributes) == null ? void 0 : m.logic) ?? "AND",
          rules: r
        },
        itemCustomAttributes: {
          logic: ((l = (t = o.itemRule) == null ? void 0 : t.itemCustomAttributes) == null ? void 0 : l.logic) ?? "AND",
          rules: c
        }
      }), $("update:modelValue", {
        orderFrom: q.value,
        ruleGroupIds: s,
        restaurantRule: o.restaurantRule,
        itemRule: o.itemRule
      }), f();
    }
    function f() {
      v.value = !1, $("close-form");
    }
    return (o, s) => {
      const n = x("FmButton"), p = x("FmRadio"), r = x("FmRadioGroup"), c = x("FmIcon"), k = x("FmCard"), S = x("FmSearch"), N = x("FmMenuItem"), _ = x("FmMenu"), W = x("FmSideSheet");
      return i(), T(W, {
        modelValue: v.value,
        "onUpdate:modelValue": s[3] || (s[3] = (m) => v.value = m),
        "max-width": 760,
        "close-button": !1,
        "is-container": u(de).FmForm,
        "is-container-props": {
          onValidationSuccess: I,
          blameFormChildOnValidationFailed: !0
        }
      }, {
        "side-sheet-header": M(() => [
          F("div", Ie, [
            y(n, {
              variant: u(Z).Tertiary,
              "prepend-icon": "arrow_back",
              onClick: oe(f, ["stop"])
            }, null, 8, ["variant"]),
            h.isEditMode ? (i(), R("p", we, E(u(a)("menu.link_product.rules.edit_rule")), 1)) : (i(), R("p", Ve, E(u(a)("menu.link_product.rules.add_rule")), 1))
          ])
        ]),
        "side-sheet-footer": M(() => [
          F("div", Be, [
            y(n, {
              variant: u(Z).Secondary,
              label: u(a)("common.cancel"),
              onClick: oe(f, ["stop"])
            }, null, 8, ["variant", "label"]),
            y(n, {
              variant: u(Z).Primary,
              label: u(a)("common.save"),
              type: "submit"
            }, null, 8, ["variant", "label"])
          ])
        ]),
        default: M(() => [
          F("div", xe, [
            y(r, {
              modelValue: q.value,
              "onUpdate:modelValue": s[0] || (s[0] = (m) => q.value = m),
              label: u(a)("menu.link_product.rules.availability")
            }, {
              default: M(() => [
                y(p, {
                  label: "All",
                  value: u(ue.F_ORDER_FROM).Enum.ALL
                }, null, 8, ["value"]),
                y(p, {
                  label: "POS Only",
                  value: u(ue.F_ORDER_FROM).Enum.POS_ONLY
                }, null, 8, ["value"]),
                y(p, {
                  label: "None",
                  value: u(ue.F_ORDER_FROM).Enum.NONE
                }, null, 8, ["value"])
              ]),
              _: 1
            }, 8, ["modelValue", "label"]),
            y(Fe),
            F("div", $e, [
              F("div", Se, [
                F("p", Ne, E(u(a)("menu.link_product.rules.use_rule_group")), 1),
                (i(!0), R(z, null, X(Y.value, (m) => (i(), R("div", {
                  key: m._id
                }, [
                  y(k, {
                    variant: "outlined",
                    class: "p-24 gap-24 space-y-16"
                  }, {
                    default: M(() => [
                      F("div", Ge, [
                        F("p", Oe, E(m.name), 1),
                        y(c, {
                          name: w.value[m._id] ? "expand_less" : "expand_more",
                          onClick: oe((t) => w.value[m._id] = !w.value[m._id], ["stop", "prevent"])
                        }, null, 8, ["name", "onClick"])
                      ]),
                      w.value[m._id] ? (i(), R("div", De, [
                        (i(!0), R(z, null, X(m.rules, (t, l) => (i(), R("div", {
                          key: t._id
                        }, [
                          (i(!0), R(z, null, X(g(t), (e, G) => (i(), T(Re, {
                            key: G,
                            number: G + 1,
                            property: e.property,
                            operator: e.operator,
                            value: e.value
                          }, null, 8, ["number", "property", "operator", "value"]))), 128)),
                          l < m.rules.length - 1 ? (i(), R("p", Me, E(u(a)("menu.link_product.rules.or")), 1)) : J("", !0)
                        ]))), 128))
                      ])) : J("", !0)
                    ]),
                    _: 2
                  }, 1024)
                ]))), 128)),
                y(_, { "close-on-click": !1 }, {
                  "menu-button": M(() => [
                    y(n, {
                      variant: u(Z).Plain,
                      "prepend-icon": "add",
                      label: u(a)("menu.link_product.rules.add_rule_group")
                    }, null, 8, ["variant", "label"])
                  ]),
                  default: M(() => [
                    y(S, {
                      "model-value": b.value,
                      "onUpdate:modelValue": s[1] || (s[1] = (m) => b.value = m),
                      class: "w-[200px]",
                      placeholder: u(a)("menu.link_product.rules.filter_result")
                    }, null, 8, ["model-value", "placeholder"]),
                    (i(!0), R(z, null, X(V.value, (m) => (i(), T(N, {
                      key: m.value,
                      label: m.label,
                      "has-checkbox": "",
                      "model-value": C.value[m.value],
                      onClick: () => {
                        C.value[m.value] = !C.value[m.value];
                      }
                    }, null, 8, ["label", "model-value", "onClick"]))), 128))
                  ]),
                  _: 1
                })
              ]),
              y(be, {
                "model-value": h.groupCustomRule,
                "onUpdate:modelValue": s[2] || (s[2] = (m) => {
                  d.value = m;
                })
              }, null, 8, ["model-value"])
            ])
          ])
        ]),
        _: 1
      }, 8, ["modelValue", "is-container", "is-container-props"]);
    };
  }
}), me = /* @__PURE__ */ ae({
  __name: "CatalogLinkItemRuleView",
  props: {
    modelValue: {
      type: Object,
      required: !0
    },
    index: {
      type: Number,
      required: !0
    },
    convertCategoryIdToName: {
      type: Function,
      required: !0
    },
    showForm: {
      type: Boolean,
      default: !1
    },
    isDraft: {
      type: Boolean,
      default: !1
    }
  },
  emits: ["update:model-value", "delete-rule"],
  setup(h, {
    expose: U,
    emit: a
  }) {
    const {
      t: L
    } = se(), v = h, $ = a, q = j(() => {
      var d;
      return ((d = le().state.menu.ruleGroupSettings) == null ? void 0 : d.groups) || [];
    });
    function b(d) {
      return d.flatMap((g) => {
        var o, s;
        const I = ((o = q.value.find((n) => n._id === g)) == null ? void 0 : o.rules) || [], f = ((s = q.value.find((n) => n._id === g)) == null ? void 0 : s.name) || "";
        return {
          id: g,
          name: f,
          rules: I.map((n) => {
            var p, r, c, k;
            return {
              ...n,
              restaurantRule: {
                restaurantAttributes: O((p = n.restaurantRule) == null ? void 0 : p.restaurantAttributes),
                restaurantCustomAttributes: O((r = n.restaurantRule) == null ? void 0 : r.restaurantCustomAttributes)
              },
              itemRule: {
                itemAttributes: v.convertCategoryIdToName(O((c = n.itemRule) == null ? void 0 : c.itemAttributes)),
                itemCustomAttributes: O((k = n.itemRule) == null ? void 0 : k.itemCustomAttributes)
              }
            };
          })
        };
      });
    }
    const C = A(b(v.modelValue.ruleGroupIds ?? [])), w = A({
      _id: "customRule",
      restaurantRule: v.modelValue.restaurantRule,
      itemRule: v.modelValue.itemRule
    }), P = A(v.modelValue.orderFrom);
    re(() => v.modelValue, (d) => {
      C.value = b(d.ruleGroupIds ?? []), w.value = {
        _id: "customRule",
        restaurantRule: d.restaurantRule,
        itemRule: d.itemRule
      };
    }, {
      deep: !0
    });
    const V = A(v.showForm);
    U({
      showForm: V
    }), re(() => V.value, (d, g) => {
      v.isDraft && g === !0 && d === !1 && $("delete-rule");
    });
    function Y(d) {
      P.value = d.orderFrom, w.value.restaurantRule = d.restaurantRule, w.value.itemRule = d.itemRule, C.value = b(d.ruleGroupIds ?? []), $("update:model-value", d);
    }
    return (d, g) => V.value ? (i(), T(Le, {
      key: 1,
      "is-edit-mode": !h.isDraft,
      "order-from": P.value,
      "existing-rule-groups": C.value,
      "group-custom-rule": w.value,
      "convert-category-id-to-name": h.convertCategoryIdToName,
      onCloseForm: g[2] || (g[2] = (I) => V.value = !1),
      "onUpdate:modelValue": g[3] || (g[3] = (I) => Y(I))
    }, null, 8, ["is-edit-mode", "order-from", "existing-rule-groups", "group-custom-rule", "convert-category-id-to-name"])) : (i(), T(ge, {
      key: 0,
      "model-value": w.value,
      title: `${u(L)("menu.rule_groups.condition_view.rule")} ${h.index + 1}`,
      "is-catalog-link-item-rule-view": !0,
      "rule-group-names": C.value.map((I) => I.name).filter((I) => I !== ""),
      "order-from": P.value,
      onOpenCatalogLinkItemRuleForm: g[0] || (g[0] = (I) => V.value = !0),
      onDeleteRule: g[1] || (g[1] = (I) => d.$emit("delete-rule"))
    }, null, 8, ["model-value", "title", "rule-group-names", "order-from"]));
  }
});
var D = /* @__PURE__ */ ((h) => (h[h.Normal = 0] = "Normal", h[h.Rules = 1] = "Rules", h))(D || {});
const Ee = { class: "fm-typo-en-title-md-600 mr-auto" }, Te = {
  key: 1,
  class: "flex items-center gap-12"
}, Ue = { class: "flex items-center gap-8" }, qe = { class: "text-neutral-600 fm-typo-body-sm" }, je = {
  key: 1,
  class: "space-y-16"
}, ze = { class: "flex-1 relative border border-fm-color-neutral-gray-200 rounded-md p-16" }, Pe = { class: "absolute -top-[10px] left-[50px] bg-white px-2 fm-typo-en-body-lg-400 text-fm-color-typo-secondary select-none z-10" }, We = {
  key: 0,
  class: "flex items-center select-none"
}, He = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Qe = { class: "flex gap-8 items-center justify-start" }, Je = /* @__PURE__ */ ae({
  __name: "LinkProductSideSheet",
  props: {
    initialValue: { default: () => [] },
    linkItemRules: {},
    menuItems: {},
    categories: {},
    noScheduler: { type: Boolean },
    isLocalOnly: { type: Boolean, default: !1 },
    categorizedItems: { default: () => [] },
    selectVariant: { type: Boolean, default: !1 },
    showVariant: { type: Boolean, default: !1 },
    showAddon: { type: Boolean, default: !0 },
    title: { default: void 0 },
    useCloseBtn: { type: Boolean }
  },
  emits: ["submit"],
  setup(h, { emit: U }) {
    const a = h, L = U, { t: v } = se(), $ = A(D.Normal);
    function q(t) {
      $.value = t;
    }
    const b = A(!1), C = (t) => {
      Ce.isBoolean(t) ? b.value = t : b.value = !b.value;
    };
    function w(t) {
      return t.reduce((l, e) => (l[e._id] = [...l[e._id] ?? [], e], l), {});
    }
    const P = a.initialValue, V = A(w(ee(P))), Y = j(() => Object.values(V.value).flatMap((t) => t)), { convertCategoryIdToName: d, convertCategoryNameToId: g } = he({
      menuItems: j(() => a.menuItems || []),
      categories: j(() => a.categories || [])
    }), I = A(
      ee(a.linkItemRules)
    ), f = A();
    function o() {
      var t;
      return (t = I.value) == null ? void 0 : t.map((l) => {
        var e, G, H, Q;
        return {
          ...l,
          restaurantRule: {
            restaurantAttributes: O((e = l.restaurantRule) == null ? void 0 : e.restaurantAttributes),
            restaurantCustomAttributes: O((G = l.restaurantRule) == null ? void 0 : G.restaurantCustomAttributes)
          },
          itemRule: {
            itemAttributes: d(O((H = l.itemRule) == null ? void 0 : H.itemAttributes)),
            itemCustomAttributes: O((Q = l.itemRule) == null ? void 0 : Q.itemCustomAttributes)
          }
        };
      });
    }
    f.value = o();
    function s() {
      var t;
      return (t = f.value) == null ? void 0 : t.map((l) => {
        var e, G, H, Q;
        return {
          ...l,
          restaurantRule: {
            restaurantAttributes: te((e = l.restaurantRule) == null ? void 0 : e.restaurantAttributes),
            restaurantCustomAttributes: te((G = l.restaurantRule) == null ? void 0 : G.restaurantCustomAttributes)
          },
          itemRule: {
            itemAttributes: te(g((H = l.itemRule) == null ? void 0 : H.itemAttributes)),
            itemCustomAttributes: te((Q = l.itemRule) == null ? void 0 : Q.itemCustomAttributes)
          }
        };
      });
    }
    const n = _e(
      () => {
        const t = s() ?? null;
        return !ie.isEqual(w(a.initialValue), V.value) || !ie.isEqual(a.linkItemRules, t);
      },
      () => {
        b.value = !1;
      }
    );
    function p() {
      $.value === D.Rules ? L("submit", {
        mode: D.Rules,
        linkItemRules: s() ?? []
      }) : L("submit", {
        mode: D.Normal,
        items: Y.value
      }), b.value = !1;
    }
    re(
      () => b.value,
      () => {
        V.value = w(ee(a.initialValue)), I.value = ee(a.linkItemRules), f.value = o(), r.value = null, c.value = !1, $.value = a.noScheduler && a.linkItemRules && a.linkItemRules.length > 0 ? D.Rules : D.Normal;
      }
    );
    const r = A(null), c = A(!1), k = () => {
      r.value = {
        orderFrom: ue.F_ORDER_FROM.enum.ALL,
        restaurantRule: {
          restaurantAttributes: null,
          restaurantCustomAttributes: null
        },
        itemRule: {
          itemAttributes: null,
          itemCustomAttributes: null
        }
      }, c.value = !0;
    };
    function S(t) {
      f.value = [...f.value || [], t], r.value = null, c.value = !1;
    }
    function N() {
      r.value = null, c.value = !1;
    }
    function _(t) {
      if (!f.value) return;
      const l = [...f.value];
      l.splice(t, 1), f.value = l.length ? l : [];
    }
    const W = j(() => {
      const t = a.isLocalOnly ? ye() : le();
      return a.noScheduler && t.currentCatalog;
    });
    function m(t, l) {
      if (!f.value) return;
      const e = [...f.value];
      e[t] = l, f.value = e;
    }
    return (t, l) => {
      const e = x("fm-button"), G = x("fm-switch"), H = x("FmCard"), Q = x("fm-side-sheet");
      return i(), R(z, null, [
        pe(t.$slots, "default", { trigger: C }, void 0, !0),
        y(Q, {
          id: "group-form",
          modelValue: b.value,
          "onUpdate:modelValue": l[3] || (l[3] = (B) => b.value = B),
          "close-button": t.useCloseBtn,
          "is-container": u(de).FmForm,
          "is-container-props": {
            onValidationSuccess: p,
            blameFormChildOnValidationFailed: !0
          },
          "max-width": 760,
          "onOn:clickedAway": u(n)
        }, {
          "side-sheet-header": M(() => [
            t.useCloseBtn ? J("", !0) : (i(), T(e, {
              key: 0,
              variant: u(Z).Tertiary,
              class: "cursor-pointer mr-4",
              "prepend-icon": "arrow_back",
              onClick: C
            }, null, 8, ["variant"])),
            F("p", Ee, E(t.title || u(v)("menu.link_product.title")), 1),
            W.value ? (i(), R("div", Te, [
              F("div", Ue, [
                y(G, {
                  label: u(v)("menu.link_product.rules.section_title"),
                  "model-value": $.value === u(D).Rules,
                  "onUpdate:modelValue": l[0] || (l[0] = (B) => q(B ? u(D).Rules : u(D).Normal))
                }, null, 8, ["label", "model-value"])
              ])
            ])) : J("", !0)
          ]),
          "side-sheet-footer": M(() => [
            F("div", Qe, [
              y(e, {
                label: u(v)("menu.common.actions.confirm"),
                size: "lg",
                type: "submit",
                variant: "primary"
              }, null, 8, ["label"]),
              y(e, {
                label: u(v)("menu.common.actions.cancel"),
                size: "lg",
                variant: "tertiary",
                onClick: l[2] || (l[2] = () => b.value = !1)
              }, null, 8, ["label"])
            ])
          ]),
          default: M(() => [
            (i(), R("div", {
              class: "py-8 px-8 overflow-y-auto space-y-24",
              key: $.value
            }, [
              $.value === u(D).Normal ? (i(), T(u(fe), {
                key: 0,
                "auto-focus-search": !0,
                "categorized-items": t.categorizedItems,
                data: V.value,
                "select-variant": t.selectVariant,
                "selected-items": Y.value,
                "show-variant": t.showVariant,
                "show-addon": t.showAddon,
                "onUpdate:data": l[1] || (l[1] = (B) => V.value = B)
              }, null, 8, ["categorized-items", "data", "select-variant", "selected-items", "show-variant", "show-addon"])) : W.value ? (i(), R(z, { key: 1 }, [
                F("p", qe, E(u(v)("menu.link_product.rules.hint")), 1),
                (!f.value || f.value.length <= 0) && !c.value ? (i(), T(u(ve), {
                  key: 0,
                  title: u(v)("menu.rule_groups.condition_view.empty_data.no_rules_added"),
                  subtitle: u(v)("menu.rule_groups.condition_view.empty_data.subtitle"),
                  action: {
                    text: u(v)("menu.link_product.rules.add_rule"),
                    icon: "add",
                    callback: k
                  }
                }, null, 8, ["title", "subtitle", "action"])) : (i(), R("div", je, [
                  c.value && r.value ? (i(), T(H, {
                    key: 0,
                    class: "p-16 space-y-16",
                    variant: "outlined"
                  }, {
                    default: M(() => {
                      var B;
                      return [
                        y(me, {
                          "model-value": r.value,
                          index: ((B = f.value) == null ? void 0 : B.length) ?? 0,
                          convertCategoryIdToName: u(d),
                          "show-form": !0,
                          "is-draft": !0,
                          onDeleteRule: N,
                          "onUpdate:modelValue": S
                        }, null, 8, ["model-value", "index", "convertCategoryIdToName"])
                      ];
                    }),
                    _: 1
                  })) : J("", !0),
                  (i(!0), R(z, null, X(f.value, (B, K) => (i(), R(z, { key: K }, [
                    F("div", ze, [
                      F("span", Pe, E(u(v)("menu.rule_groups.condition_view.and")), 1),
                      y(me, {
                        "model-value": B,
                        index: K,
                        convertCategoryIdToName: u(d),
                        onDeleteRule: (ne) => _(K),
                        "onUpdate:modelValue": (ne) => m(K, ne)
                      }, null, 8, ["model-value", "index", "convertCategoryIdToName", "onDeleteRule", "onUpdate:modelValue"])
                    ]),
                    f.value && f.value.length > 1 && K < f.value.length - 1 ? (i(), R("div", We, [
                      F("span", He, E(u(v)("menu.rule_groups.condition_view.or")), 1)
                    ])) : J("", !0)
                  ], 64))), 128)),
                  y(e, {
                    label: u(v)("menu.link_product.rules.add_rule"),
                    onClick: k
                  }, null, 8, ["label"])
                ]))
              ], 64)) : J("", !0)
            ]))
          ]),
          _: 1
        }, 8, ["modelValue", "close-button", "is-container", "is-container-props", "onOn:clickedAway"])
      ], 64);
    };
  }
}), at = /* @__PURE__ */ ce(Je, [["__scopeId", "data-v-60163177"]]);
export {
  Fe as H,
  at as L,
  D as a
};
