import { defineComponent, unref, openBlock, createElementBlock, createElementVNode, createVNode, toDisplayString, normalizeClass, createCommentVNode } from "vue";
import SvgIcon from "../../common/base/SvgIcon.vue.mjs";
import ArrowStrokeSelectDownIcon from "../../common/icons/ArrowStrokeSelectDownIcon.vue.mjs";
import useUserInfo from "./useUserInfoHooks.mjs";
import Avatar from "../../common/Avatar.vue.mjs";
import "../../../services/main.mjs";
import { roomService } from "../../../services/roomService.mjs";
import "../../../locales/index.mjs";
import "@tencentcloud/tuiroom-engine-js";
import "mitt";
import "../../../services/manager/roomActionManager.mjs";
import "@tencentcloud/tui-core";
import { useBasicStore } from "../../../stores/basic.mjs";
import { useRoomStore } from "../../../stores/room.mjs";
const _hoisted_1 = { class: "name" };
const _hoisted_2 = {
  key: 0,
  class: "user-control-container"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "UserInfoPC",
  props: {
    userId: {},
    userName: {},
    avatarUrl: {}
  },
  emits: ["log-out", "update-user-name"],
  setup(__props, { emit: __emit }) {
    const userInfoConfig = roomService.getComponentConfig("UserInfo");
    useBasicStore();
    useRoomStore();
    const {
      t,
      showUserControl,
      userInfoRef,
      handleUserControl,
      closeEditUserNameDialog
    } = useUserInfo();
    return (_ctx, _cache) => {
      return unref(userInfoConfig).visible ? (openBlock(), createElementBlock("div", {
        key: 0,
        ref_key: "userInfoRef",
        ref: userInfoRef,
        class: "user-info-container"
      }, [
        createElementVNode("div", {
          class: "user-info-content",
          onClick: _cache[0] || (_cache[0] = //@ts-ignore
          (...args) => unref(handleUserControl) && unref(handleUserControl)(...args))
        }, [
          createVNode(Avatar, {
            class: "avatar",
            "img-src": _ctx.avatarUrl
          }, null, 8, ["img-src"]),
          createElementVNode("div", _hoisted_1, toDisplayString(_ctx.userName || _ctx.userId), 1),
          createVNode(SvgIcon, {
            class: normalizeClass([unref(showUserControl) ? "up-icon" : "down-icon"]),
            icon: ArrowStrokeSelectDownIcon
          }, null, 8, ["class"])
        ]),
        unref(showUserControl) ? (openBlock(), createElementBlock("div", _hoisted_2, [
          createElementVNode("div", {
            class: "user-control-item-foot",
            onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("log-out"))
          }, toDisplayString(unref(t)("Log out")), 1)
        ])) : createCommentVNode("", true)
      ], 512)) : createCommentVNode("", true);
    };
  }
});
export {
  _sfc_main as default
};
