import { ref as d, reactive as u, watch as m, onMounted as i, openBlock as _, createElementBlock as y, createElementVNode as h, createVNode as K } from "vue";
import { c as f } from "./routeConvert.js";
import { r as v, aM as M, aN as w } from "./index2.js";
const E = { class: "s-menu-common" }, k = { class: "menu-wrap" }, S = {
  __name: "STopMenu",
  emits: ["collapsed"],
  setup(T, { emit: b }) {
    const c = d([]), l = d(""), n = u({
      collapsed: !1,
      selectedKeys: ["1"],
      openKeys: ["sub1"],
      preOpenKeys: ["sub1"]
    });
    m(
      () => n.openKeys,
      (o, s) => {
        n.preOpenKeys = s;
      }
    );
    const r = (o) => o.map((e) => {
      const t = {
        key: e.path,
        // icon: item.icon ? () => h(item.icon) : null,
        icon: null,
        label: e.name || e.meta.title,
        title: e.name || e,
        path: e.path
      };
      return e.children && (t.children = r(e.children)), t;
    }), p = (o) => {
      window.$push(o.key);
    };
    return i(() => {
      l.value = window.$utils.env.VITE_APP_MENU_THEME || "dark";
      const s = M().dynamics, e = f(s.find((a) => a.path === "/")), t = e && e.children || [];
      c.value = r(t.filter((a) => !a.meta.hidden));
    }), (o, s) => {
      const e = w;
      return _(), y("div", E, [
        h("div", k, [
          K(e, {
            openKeys: n.openKeys,
            "onUpdate:openKeys": s[0] || (s[0] = (t) => n.openKeys = t),
            selectedKeys: n.selectedKeys,
            "onUpdate:selectedKeys": s[1] || (s[1] = (t) => n.selectedKeys = t),
            mode: "horizontal",
            theme: l.value,
            items: c.value,
            onSelect: p
          }, null, 8, ["openKeys", "selectedKeys", "theme", "items"])
        ])
      ]);
    };
  }
}, V = /* @__PURE__ */ v(S, [["__scopeId", "data-v-d34b8d4d"]]);
export {
  V as default
};
