import { defineComponent, computed, resolveComponent, openBlock, createElementBlock, Fragment, renderList, createBlock, withCtx, createVNode, createElementVNode, toDisplayString, createCommentVNode, withModifiers, createTextVNode } from 'vue';
import '../../../../hooks/index.mjs';
import { useFormEvents } from '../../../../hooks/composables/useDialogEvents.mjs';

const _hoisted_1 = {
  key: 0,
  class: "menu-text-badge"
};
const _hoisted_2 = ["onClick"];
var _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "subItem",
  props: {
    // 菜单列表
    chil: {
      type: Array,
      default: () => []
    }
  },
  setup(__props) {
    const props = __props;
    const events = useFormEvents();
    const chils = computed(() => {
      return props.chil;
    });
    const onALinkClick = (val) => {
      events.onFormDialogOpen({
        name: "setFOpenLink",
        data: val
      });
    };
    return (_ctx, _cache) => {
      const _component_SvgIcon = resolveComponent("SvgIcon");
      const _component_sub_item = resolveComponent("sub-item", true);
      const _component_el_sub_menu = resolveComponent("el-sub-menu");
      const _component_el_menu_item = resolveComponent("el-menu-item");
      return openBlock(true), createElementBlock(
        Fragment,
        null,
        renderList(chils.value, (val) => {
          return openBlock(), createElementBlock(
            Fragment,
            null,
            [
              val.children && val.children.length > 0 ? (openBlock(), createBlock(_component_el_sub_menu, {
                index: val.path,
                key: val.path
              }, {
                title: withCtx(() => [
                  createVNode(_component_SvgIcon, {
                    name: val.meta.icon,
                    style: { "font-size": "16px" }
                  }, null, 8, ["name"]),
                  createElementVNode(
                    "span",
                    null,
                    toDisplayString(_ctx.$t(`message.menu.${val.meta.title}`)),
                    1
                    /* TEXT */
                  )
                ]),
                default: withCtx(() => [
                  createVNode(_component_sub_item, {
                    chil: val.children
                  }, null, 8, ["chil"])
                ]),
                _: 2
                /* DYNAMIC */
              }, 1032, ["index"])) : (openBlock(), createBlock(_component_el_menu_item, {
                index: val.path,
                key: val.path
              }, {
                default: withCtx(() => [
                  !val.meta.isLink || val.meta.isLink && val.meta.isIframe ? (openBlock(), createElementBlock(
                    Fragment,
                    { key: 0 },
                    [
                      createVNode(_component_SvgIcon, {
                        name: val.meta.icon,
                        style: { "font-size": "16px" }
                      }, null, 8, ["name"]),
                      createElementVNode(
                        "span",
                        null,
                        toDisplayString(_ctx.$t(`message.menu.${val.meta.title}`)),
                        1
                        /* TEXT */
                      ),
                      val.meta.showTextBadge ? (openBlock(), createElementBlock(
                        "span",
                        _hoisted_1,
                        toDisplayString(val.meta.showTextBadge),
                        1
                        /* TEXT */
                      )) : createCommentVNode("v-if", true)
                    ],
                    64
                    /* STABLE_FRAGMENT */
                  )) : (openBlock(), createElementBlock("a", {
                    key: 1,
                    class: "w100",
                    onClick: withModifiers(($event) => onALinkClick(val), ["prevent"])
                  }, [
                    createVNode(_component_SvgIcon, {
                      name: val.meta.icon,
                      style: { "font-size": "16px" }
                    }, null, 8, ["name"]),
                    createTextVNode(
                      " " + toDisplayString(_ctx.$t(`message.menu.${val.meta.title}`)),
                      1
                      /* TEXT */
                    )
                  ], 8, _hoisted_2))
                ]),
                _: 2
                /* DYNAMIC */
              }, 1032, ["index"]))
            ],
            64
            /* STABLE_FRAGMENT */
          );
        }),
        256
        /* UNKEYED_FRAGMENT */
      );
    };
  }
});

export { _sfc_main as default };
