import { computed as n, onMounted as d, onBeforeUnmount as m } from "vue";
import { u as c } from "./index.vue_vue_type_script_setup_true_lang-BMVa5UfU.js";
import "@feedmepos/mf-common";
import "@feedmepos/ui-library";
function p() {
  const e = c(), o = n(() => !e.state.currentSchedulerId), s = n(() => !e.state.currentCatalogId), u = n(() => {
    const r = e.categorizedItems;
    return s.value && o.value ? r : r.filter((t) => !!t.items.length);
  }), a = n(() => u.value.slice().sort((t, i) => t.id ? i.id ? 0 : -1 : 1)), l = n(() => e.state.currentCategoryIds ? a.value.filter((r) => {
    var t;
    return (t = e.state.currentCategoryIds) == null ? void 0 : t.includes(r.id);
  }) : a.value ?? []);
  return { categories: a, selectedCategories: l };
}
function v() {
  const e = c(), o = () => {
    e.selectCatalog(null), e.selectCategory(null), e.selectScheduler(null), e.setRestaurantAttrParams({});
  };
  function s() {
    m(() => {
      o();
    });
  }
  function u() {
    d(() => {
      o();
    });
  }
  return { resetOnUnmount: s, resetOnMount: u };
}
export {
  v as a,
  p as u
};
