"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const room = require("../../../../stores/room.js");
const Avatar = require("../../../common/Avatar.vue.js");
const AudioIcon = require("../../../common/AudioIcon.vue.js");
const SvgIcon = require("../../../common/base/SvgIcon.vue.js");
const UserIcon = require("../../../common/icons/UserIcon.vue.js");
const index = require("../../../../locales/index.js");
const TUIRoomEngine = require("@tencentcloud/tuiroom-engine-js");
const constants = require("../../../../utils/constants.js");
const ScreenOpenIcon = require("../../../common/icons/ScreenOpenIcon.vue.js");
const environment = require("../../../../utils/environment.js");
const pinia = require("pinia");
const LoadingIcon = require("../../../common/icons/LoadingIcon.vue.js");
const _hoisted_1 = {
  key: 0,
  class: "loading-region"
};
const _hoisted_2 = {
  key: 1,
  class: "center-user-info-container"
};
const _hoisted_3 = { class: "corner-user-info-container" };
const _hoisted_4 = ["title"];
const _hoisted_5 = { key: 3 };
const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
  __name: "index",
  props: {
    streamInfo: {},
    enlargeDomId: {},
    changeLargeStream: { type: Boolean }
  },
  setup(__props) {
    const roomStore = room.useRoomStore();
    const { t } = index.useI18n();
    const props = __props;
    const { userVolumeObj } = pinia.storeToRefs(roomStore);
    const userInfo = Vue.computed(() => roomStore.userInfoObj[props.streamInfo.userId]);
    const displayName = Vue.computed(() => {
      if (constants.isInnerScene) {
        return `${roomStore.getDisplayName(props.streamInfo.userId)} | ${props.streamInfo.userId}`;
      }
      return roomStore.getDisplayName(props.streamInfo.userId);
    });
    const showMasterIcon = Vue.computed(() => {
      const { userId, streamType } = props.streamInfo;
      return userId === roomStore.masterUserId && streamType === TUIRoomEngine.TUIVideoStreamType.kCameraStream;
    });
    const showAdminIcon = Vue.computed(() => {
      const { userId, streamType } = props.streamInfo;
      return roomStore.getUserRole(userId) === TUIRoomEngine.TUIRole.kAdministrator && streamType === TUIRoomEngine.TUIVideoStreamType.kCameraStream;
    });
    const showVoiceBorder = Vue.computed(() => {
      if (environment.isPC) {
        return false;
      }
      return props.streamInfo.hasAudioStream && userVolumeObj.value[props.streamInfo.userId] !== 0;
    });
    const showIcon = Vue.computed(() => showMasterIcon.value || showAdminIcon.value);
    const isScreenStream = Vue.computed(
      () => props.streamInfo.streamType === TUIRoomEngine.TUIVideoStreamType.kScreenStream
    );
    return (_ctx, _cache) => {
      var _a;
      return Vue.openBlock(), Vue.createElementBlock("div", {
        class: Vue.normalizeClass(["stream-cover-container", [showVoiceBorder.value ? "border" : ""]])
      }, [
        _ctx.streamInfo.isLoading ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
          Vue.createVNode(SvgIcon.default, {
            icon: LoadingIcon.default,
            class: "loading"
          })
        ])) : Vue.createCommentVNode("", true),
        !_ctx.streamInfo.hasVideoStream ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_2, [
          Vue.createVNode(Avatar.default, {
            class: "avatar-region",
            "img-src": (_a = userInfo.value) == null ? void 0 : _a.avatarUrl
          }, null, 8, ["img-src"])
        ])) : Vue.createCommentVNode("", true),
        Vue.createElementVNode("div", _hoisted_3, [
          showIcon.value ? (Vue.openBlock(), Vue.createElementBlock("div", {
            key: 0,
            class: Vue.normalizeClass(showMasterIcon.value ? "master-icon" : "admin-icon")
          }, [
            Vue.createVNode(UserIcon.default)
          ], 2)) : Vue.createCommentVNode("", true),
          !isScreenStream.value ? (Vue.openBlock(), Vue.createBlock(AudioIcon.default, {
            key: 1,
            class: Vue.normalizeClass(["audio-icon", { "is-mobile": Vue.unref(environment.isMobile) }]),
            "user-id": _ctx.streamInfo.userId,
            "is-muted": !_ctx.streamInfo.hasAudioStream,
            size: "small"
          }, null, 8, ["class", "user-id", "is-muted"])) : Vue.createCommentVNode("", true),
          isScreenStream.value ? (Vue.openBlock(), Vue.createBlock(SvgIcon.default, {
            key: 2,
            icon: ScreenOpenIcon.default,
            class: "screen-icon"
          })) : Vue.createCommentVNode("", true),
          Vue.createElementVNode("span", {
            class: Vue.normalizeClass(["user-name", Vue.unref(environment.isPC) ? "is-pc" : "is-mobile"]),
            title: displayName.value
          }, Vue.toDisplayString(displayName.value), 11, _hoisted_4),
          isScreenStream.value ? (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_5, Vue.toDisplayString(Vue.unref(t)("is sharing their screen")), 1)) : Vue.createCommentVNode("", true)
        ])
      ], 2);
    };
  }
});
exports.default = _sfc_main;
