import { defineComponent, openBlock, createElementBlock, createVNode, unref, isRef, withCtx, createTextVNode, toDisplayString, createElementVNode, Fragment, renderList } from "vue";
import ApplyStageLabelIcon from "../../../common/icons/ApplyStageLabelIcon.vue.mjs";
import useMasterApplyControl from "../../../../hooks/useMasterApplyControl.mjs";
import Avatar from "../../../common/Avatar.vue.mjs";
import Dialog from "../../../common/base/Dialog/index.mjs";
import SvgIcon from "../../../common/base/SvgIcon.vue.mjs";
import TuiButton from "../../../common/base/Button.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";
const _hoisted_1 = {
  key: 0,
  class: "apply-list"
};
const _hoisted_2 = { class: "apply-list-title" };
const _hoisted_3 = { class: "apply-list-name" };
const _hoisted_4 = { class: "apply-list-operate" };
const _hoisted_5 = { class: "user-info" };
const _hoisted_6 = ["title"];
const _hoisted_7 = { class: "control-container" };
const _hoisted_8 = {
  key: 1,
  class: "apply-nobody"
};
const _hoisted_9 = { class: "apply-text" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "MasterApplyControlPC",
  setup(__props) {
    const {
      t,
      showApplyUserList,
      hideApplyList,
      applyToAnchorUserCount,
      applyToAnchorList,
      handleAllUserApply,
      handleUserApply
    } = useMasterApplyControl();
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", null, [
        createVNode(unref(Dialog), {
          modelValue: unref(showApplyUserList),
          "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(showApplyUserList) ? showApplyUserList.value = $event : null),
          title: unref(t)("Member Onstage Application"),
          modal: true,
          "show-close": true,
          "close-on-click-modal": true,
          "before-close": unref(hideApplyList),
          width: "500px",
          "append-to-room-container": true
        }, {
          footer: withCtx(() => [
            createVNode(TuiButton, {
              size: "default",
              disabled: unref(applyToAnchorUserCount) === 0,
              onClick: _cache[0] || (_cache[0] = ($event) => unref(handleAllUserApply)(true))
            }, {
              default: withCtx(() => [
                createTextVNode(toDisplayString(unref(t)("Agree All")), 1)
              ]),
              _: 1
            }, 8, ["disabled"]),
            createVNode(TuiButton, {
              class: "cancel-button",
              size: "default",
              disabled: unref(applyToAnchorUserCount) === 0,
              onClick: _cache[1] || (_cache[1] = ($event) => unref(handleAllUserApply)(false))
            }, {
              default: withCtx(() => [
                createTextVNode(toDisplayString(unref(t)("Reject All")), 1)
              ]),
              _: 1
            }, 8, ["disabled"])
          ]),
          default: withCtx(() => [
            unref(applyToAnchorUserCount) ? (openBlock(), createElementBlock("div", _hoisted_1, [
              createElementVNode("div", _hoisted_2, [
                createElementVNode("span", _hoisted_3, toDisplayString(unref(t)("Members")), 1),
                createElementVNode("span", _hoisted_4, toDisplayString(unref(t)("Operate")), 1)
              ]),
              (openBlock(true), createElementBlock(Fragment, null, renderList(unref(applyToAnchorList), (item) => {
                return openBlock(), createElementBlock("div", {
                  key: item.userId,
                  class: "apply-item"
                }, [
                  createElementVNode("div", _hoisted_5, [
                    createVNode(Avatar, {
                      class: "avatar-url",
                      "img-src": item.avatarUrl
                    }, null, 8, ["img-src"]),
                    createElementVNode("span", {
                      class: "user-name",
                      title: unref(roomService).getDisplayName(item)
                    }, toDisplayString(unref(roomService).getDisplayName(item)), 9, _hoisted_6)
                  ]),
                  createElementVNode("div", _hoisted_7, [
                    createVNode(TuiButton, {
                      size: "default",
                      class: "agree",
                      onClick: ($event) => unref(handleUserApply)(item.userId, true)
                    }, {
                      default: withCtx(() => [
                        createTextVNode(toDisplayString(unref(t)("Agree to the stage")), 1)
                      ]),
                      _: 2
                    }, 1032, ["onClick"]),
                    createVNode(TuiButton, {
                      size: "default",
                      class: "reject",
                      onClick: ($event) => unref(handleUserApply)(item.userId, false)
                    }, {
                      default: withCtx(() => [
                        createTextVNode(toDisplayString(unref(t)("Reject")), 1)
                      ]),
                      _: 2
                    }, 1032, ["onClick"])
                  ])
                ]);
              }), 128))
            ])) : (openBlock(), createElementBlock("div", _hoisted_8, [
              createVNode(SvgIcon, { icon: ApplyStageLabelIcon }),
              createElementVNode("span", _hoisted_9, toDisplayString(unref(t)("Currently no member has applied to go on stage")), 1)
            ]))
          ]),
          _: 1
        }, 8, ["modelValue", "title", "before-close"])
      ]);
    };
  }
});
export {
  _sfc_main as default
};
