import { ref as u, reactive as g, watch as O, onMounted as M, resolveComponent as y, openBlock as d, createElementBlock as S, createElementVNode as m, createVNode as E, normalizeStyle as C, createBlock as K } from "vue";
import { l as $, aE as x, aF as _, aG as D } from "./index2.js";
import "./index20.js";
const U = { class: "s-menu-slide-common" }, B = { class: "menu-wrap" }, N = {
  __name: "SSideMenu",
  emits: ["collapsed"],
  setup(R, { emit: h }) {
    const f = x(), v = h, p = u([]), c = u(""), e = g({
      collapsed: !1,
      selectedKeys: [],
      openKeys: [],
      preOpenKeys: []
    });
    O(
      () => e.openKeys,
      (t, o) => {
        e.preOpenKeys = o;
      }
    );
    const r = (t) => t.map((s) => {
      var n;
      const l = {
        key: s.path,
        // icon: item.icon ? () => h(item.icon) : null,
        icon: null,
        label: s.name || ((n = s.meta) == null ? void 0 : n.title),
        title: s.name || s,
        path: s.path
      };
      return s.children && (l.children = r(s.children)), l;
    }), k = () => {
      e.collapsed = !e.collapsed, e.openKeys = e.collapsed ? [] : e.preOpenKeys, v("collapsed", e.collapsed);
    }, b = (t) => {
      f.push(t.key), e.selectedKeys = [t.key], window.$utils.ls.set("selectedKeys", e.selectedKeys);
    }, w = (t) => {
      e.openKeys = t, _().setMenuOpenKeys(e.openKeys);
    };
    return M(() => {
      var n;
      c.value = window.$utils.env.VITE_APP_MENU_THEME || "dark";
      const t = _(), o = ((n = t.dynamics[0]) == null ? void 0 : n.children) || [];
      p.value = r([...o].filter((a) => {
        var i;
        return !((i = a.meta) != null && i.hidden);
      }));
      const s = location.pathname;
      window.$utils.ls.set("selectedKeys", [s]), e.selectedKeys = window.$utils.ls.get("selectedKeys") || [];
      const l = t.openKeys || [];
      e.openKeys = l;
    }), (t, o) => {
      const s = D, l = y("DoubleRightOutlined"), n = y("DoubleLeftOutlined");
      return d(), S("div", U, [
        m("div", B, [
          E(s, {
            openKeys: e.openKeys,
            "onUpdate:openKeys": o[0] || (o[0] = (a) => e.openKeys = a),
            selectedKeys: e.selectedKeys,
            "onUpdate:selectedKeys": o[1] || (o[1] = (a) => e.selectedKeys = a),
            mode: "inline",
            items: p.value,
            theme: c.value,
            onSelect: b,
            onOpenChange: w
          }, null, 8, ["openKeys", "selectedKeys", "items", "theme"])
        ]),
        m("div", {
          class: "right-border-btn",
          style: C({
            backgroundColor: c.value === "dark" ? "#001529" : "#fff",
            color: c.value === "dark" ? "#fff" : "#000000A6",
            border: `1px solid ${c.value === "dark" ? "#001529" : "#ececec"}`
          }),
          onClick: k
        }, [
          e.collapsed ? (d(), K(l, { key: 0 })) : (d(), K(n, { key: 1 }))
        ], 4)
      ]);
    };
  }
}, I = /* @__PURE__ */ $(N, [["__scopeId", "data-v-c1f2ab13"]]);
export {
  I as default
};
