import "../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.mjs";
import { renderIcon } from "../../utils/utils.mjs";
import "../../../node_modules/.pnpm/crypto-js@4.1.1/node_modules/crypto-js/index.mjs";
import { logout } from "../../utils/router.mjs";
import "../../store/modules/designStore/designStore.mjs";
import "../../../node_modules/.pnpm/vue3-lazyload@0.2.5-beta_a6dezdz3je235ci4e3tu4rayna/node_modules/vue3-lazyload/dist/vue3-lazyload.esm.mjs";
import "../GoSkeleton/index.vue.mjs";
import "../GoLoading/index.mjs";
import { icon } from "../../plugins/icon.mjs";
import "../../settings/designSetting.mjs";
import GoSystemSet from "../GoSystemSet/index.vue.mjs";
import GoSystemInfo from "../GoSystemInfo/index.vue.mjs";
import Person from "./person.png.mjs";
import { defineComponent, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createElementVNode as createBaseVNode, createBlock, createCommentVNode, Fragment, h } from "../../../node_modules/.pnpm/@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.mjs";
import { ref, unref } from "../../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.mjs";
import NAvatar from "../../../node_modules/.pnpm/naive-ui@2.34.3_vue@3.3.4/node_modules/naive-ui/es/avatar/src/Avatar.mjs";
import NText from "../../../node_modules/.pnpm/naive-ui@2.34.3_vue@3.3.4/node_modules/naive-ui/es/typography/src/text.mjs";
const _hoisted_1 = { class: "user-info-box" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  setup(__props) {
    const { ChatboxEllipsesIcon, PersonIcon, LogOutOutlineIcon, SettingsSharpIcon } = icon.ionicons5;
    const modelShowInfo = ref(false);
    const modelShow = ref(false);
    const fallback = ref(false);
    const renderUserInfo = () => {
      return h(
        "div",
        {
          style: "display: flex; align-items: center; padding: 8px 12px;"
        },
        [
          h(NAvatar, {
            round: true,
            style: "margin-right: 12px;",
            src: Person
          }),
          h("div", null, [h("div", null, [h(NText, { depth: 2 }, { default: () => "奔跑的面条" })])])
        ]
      );
    };
    const options = ref([
      {
        label: "我的信息",
        key: "info",
        type: "render",
        render: renderUserInfo
      },
      {
        type: "divider",
        key: "d1"
      },
      {
        label: "系统设置",
        key: "sysSet",
        icon: renderIcon(SettingsSharpIcon)
      },
      {
        label: "联系",
        key: "contact",
        icon: renderIcon(ChatboxEllipsesIcon)
      },
      {
        type: "divider",
        key: "d3"
      },
      {
        label: "退出登录",
        key: "logout",
        icon: renderIcon(LogOutOutlineIcon)
      }
    ]);
    const errorHandle = (e) => {
      fallback.value = true;
    };
    const sysSetHandle = () => {
      modelShow.value = true;
    };
    const sysInfoHandle = () => {
      modelShowInfo.value = true;
    };
    const handleSelect = (key) => {
      switch (key) {
        case "contact":
          sysInfoHandle();
          break;
        case "sysSet":
          sysSetHandle();
          break;
        case "logout":
          logout();
          break;
      }
    };
    return (_ctx, _cache) => {
      const _component_n_dropdown = resolveComponent("n-dropdown");
      return openBlock(), createElementBlock(Fragment, null, [
        createVNode(_component_n_dropdown, {
          trigger: "hover",
          onSelect: handleSelect,
          "show-arrow": true,
          options: options.value
        }, {
          default: withCtx(() => [
            createBaseVNode("div", _hoisted_1, [
              fallback.value ? (openBlock(), createBlock(unref(PersonIcon), { key: 0 })) : createCommentVNode("", true),
              !fallback.value ? (openBlock(), createBlock(unref(NAvatar), {
                key: 1,
                round: "",
                "object-fit": "cover",
                size: "medium",
                src: unref(Person),
                onError: errorHandle
              }, null, 8, ["src"])) : createCommentVNode("", true)
            ])
          ]),
          _: 1
        }, 8, ["options"]),
        createVNode(unref(GoSystemSet), {
          modelShow: modelShow.value,
          "onUpdate:modelShow": _cache[0] || (_cache[0] = ($event) => modelShow.value = $event)
        }, null, 8, ["modelShow"]),
        createVNode(unref(GoSystemInfo), {
          modelShow: modelShowInfo.value,
          "onUpdate:modelShow": _cache[1] || (_cache[1] = ($event) => modelShowInfo.value = $event)
        }, null, 8, ["modelShow"])
      ], 64);
    };
  }
});
export {
  _sfc_main as default
};
