import { resolveComponent as h, createElementBlock as l, openBlock as c, Fragment as w, renderList as b, createElementVNode as p, withDirectives as N, normalizeClass as C, createVNode as _, createTextVNode as k, toDisplayString as $, renderSlot as S, vShow as E, withCtx as A, ref as L, computed as v } from "vue";
import { _ as g } from "./install-BuMO14Rb.js";
const V = { class: "nav-menu__category nav-menu-lvl-1" }, B = ["onClick"], D = {
  __name: "nav-menu-lvl-1",
  props: {
    categories: {
      type: Array,
      default: () => []
    },
    selected: {
      type: Object,
      default: () => ({})
    },
    icons: {
      type: Array,
      default: () => []
    }
  },
  emits: [
    "select"
  ],
  setup(n, { emit: r }) {
    const s = r;
    function u(a) {
      s("select", a);
    }
    return (a, i) => {
      const d = h("wt-icon");
      return c(), l("ul", V, [
        (c(!0), l(w, null, b(n.categories, (o, f) => (c(), l("li", {
          key: f,
          class: "nav-menu__option"
        }, [
          p("button", {
            class: C([{
              "nav-menu__item--selected": n.selected.value === o.value
            }, "typo-body-1 nav-menu__item nav-menu__item--active"]),
            onClick: (e) => u(o)
          }, [
            _(d, {
              color: n.selected.value === o.value ? "on-primary" : "default",
              icon: n.icons.find((e) => e.includes(o.value))
            }, null, 8, ["color", "icon"]),
            k(" " + $(o.name), 1)
          ], 10, B),
          N(p("div", null, [
            S(a.$slots, "default", {}, void 0, !0)
          ], 512), [
            [E, n.selected.value === o.value]
          ])
        ]))), 128))
      ]);
    };
  }
}, j = /* @__PURE__ */ g(D, [["__scopeId", "data-v-dd3e01a2"]]), q = { class: "nav-menu__category nav-menu-lvl-2" }, z = {
  __name: "nav-menu-lvl-2",
  props: {
    categories: {
      type: Array,
      default: () => []
    }
  },
  setup(n) {
    return (r, s) => {
      const u = h("router-link");
      return c(), l("ul", q, [
        (c(!0), l(w, null, b(n.categories, (a, i) => (c(), l("li", {
          key: i,
          class: "typo-body-1 nav-menu__option nav-menu__item nav-menu-lvl-2--inner"
        }, [
          s[0] || (s[0] = p("span", { class: "nav-menu-lvl-2__indicator" }, null, -1)),
          _(u, {
            to: a.route,
            class: "nav-menu-lvl-2__link"
          }, {
            default: A(() => [
              k($(a.name), 1)
            ], void 0, !0),
            _: 2
          }, 1032, ["to"])
        ]))), 128))
      ]);
    };
  }
}, y = /* @__PURE__ */ g(z, [["__scopeId", "data-v-d3104e61"]]), F = { class: "wt-navigation-menu" }, O = { class: "wt-navigation-menu__wrapper" }, R = {
  __name: "wt-navigation-menu",
  props: {
    /** entire navigation hierarchy. Value: `{ value: string, name: string, subNav: [{ value: string, route: string, name: string}] }`
     **/
    nav: {
      type: Array,
      required: !0
    },
    /** array icons to display in 1 level menu
     */
    icons: {
      type: Array,
      default: () => []
    }
  },
  setup(n) {
    const r = n, s = L(""), u = v(() => {
      const e = /* @__PURE__ */ new Map();
      return r.nav.forEach((t) => {
        e.set(t.value, {
          ...t,
          name: t.name
        });
      }), e;
    }), a = v(() => {
      const e = /* @__PURE__ */ new Map();
      return r.nav.forEach((t) => {
        if (t.subNav) {
          const M = t.subNav.map((m) => {
            const x = t.route ? `${t.route}/${m.route}` : m.route;
            return {
              ...m,
              name: m.name,
              route: x
            };
          });
          e.set(t.value, M);
        } else
          e.set(t.value, []);
      }), e;
    }), i = v(() => Array.from(u.value.values()).filter((e) => {
      const t = a.value.get(e.value);
      return t && t.length > 0;
    })), d = v(() => a.value.get(o.value?.value) || []), o = v(() => u.value.get(s.value) || i.value[0]);
    function f(e) {
      s.value = e.value;
    }
    return (e, t) => (c(), l("section", F, [
      p("article", O, [
        _(j, {
          categories: i.value,
          icons: n.icons,
          selected: o.value,
          onSelect: f
        }, {
          default: A(() => [
            _(y, {
              categories: d.value,
              class: "wt-navigation-menu__categories--display"
            }, null, 8, ["categories"])
          ], void 0, !0),
          _: 1
        }, 8, ["categories", "icons", "selected"]),
        _(y, {
          categories: d.value,
          class: "wt-navigation-menu__categories--hidden"
        }, null, 8, ["categories"])
      ])
    ]));
  }
}, G = /* @__PURE__ */ g(R, [["__scopeId", "data-v-fcbc24f4"]]);
export {
  G as default
};
