import { defineComponent, openBlock, createElementBlock, createElementVNode, createVNode, withDirectives, isRef, unref, vModelText, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode, createBlock, withCtx, createTextVNode, vShow } from "vue";
import { storeToRefs } from "pinia";
import index from "./MemberItem/index.mjs";
import SvgIcon from "../common/base/SvgIcon.vue.mjs";
import SearchIcon from "../common/icons/SearchIcon.vue.mjs";
import ApplyTipsIcon from "../common/icons/ApplyTipsIcon.vue.mjs";
import Dialog from "../common/base/Dialog/index.mjs";
import { useRoomStore } from "../../stores/room.mjs";
import useIndex from "./useIndexHooks.mjs";
import TuiButton from "../common/base/Button.vue.mjs";
import ArrowUpIcon from "../common/icons/ArrowUpIcon.vue.mjs";
import vClickOutside from "../../directives/vClickOutside.mjs";
import { USERS_STATUS } from "../../constants/room.mjs";
const _hoisted_1 = { class: "manage-member-container" };
const _hoisted_2 = { class: "manage-member-header" };
const _hoisted_3 = { class: "search-container" };
const _hoisted_4 = ["placeholder"];
const _hoisted_5 = { class: "apply-count" };
const _hoisted_6 = { class: "user-status" };
const _hoisted_7 = ["onClick"];
const _hoisted_8 = { class: "apply-staged" };
const _hoisted_9 = {
  key: 0,
  class: "apply-on-stage-info"
};
const _hoisted_10 = { class: "apply-info" };
const _hoisted_11 = {
  id: "memberListContainer",
  class: "member-list-container"
};
const _hoisted_12 = {
  key: 1,
  class: "global-setting"
};
const _hoisted_13 = { class: "more-container" };
const _hoisted_14 = {
  class: /* @__PURE__ */ normalizeClass(["tui-theme-white", "drop-down"])
};
const _hoisted_15 = ["onClick"];
const _hoisted_16 = { class: "operate-text" };
const _hoisted_17 = {
  key: 2,
  class: "global-setting"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "indexPC",
  setup(__props) {
    const roomStore = useRoomStore();
    const { applyToAnchorList, isGeneralUser } = storeToRefs(roomStore);
    const {
      t,
      searchText,
      showApplyUserList,
      showManageAllUserDialog,
      dialogTitle,
      dialogContent,
      toggleManageAllMember,
      doToggleManageAllMember,
      ManageControlType,
      handleToggleStaged,
      applyToAnchorUserContent,
      audioManageInfo,
      videoManageInfo,
      toggleClickMoreBtn,
      showMoreControl,
      moreControlList,
      userStatusList,
      currentActiveTabName,
      filteredUserStatusList,
      handleCallAllInvitee
    } = useIndex();
    const handleShowMoreControl = () => {
      if (showMoreControl.value) {
        showMoreControl.value = false;
      }
    };
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createElementVNode("div", _hoisted_2, [
          createElementVNode("div", _hoisted_3, [
            createVNode(SvgIcon, { icon: SearchIcon }),
            withDirectives(createElementVNode("input", {
              "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(searchText) ? searchText.value = $event : null),
              class: "search-input",
              placeholder: unref(t)("Search Member")
            }, null, 8, _hoisted_4), [
              [vModelText, unref(searchText)]
            ])
          ])
        ]),
        createElementVNode("div", _hoisted_5, [
          createElementVNode("div", _hoisted_6, [
            (openBlock(true), createElementBlock(Fragment, null, renderList(unref(userStatusList), (item, index2) => {
              return openBlock(), createElementBlock("div", {
                class: normalizeClass([
                  "user-status-container",
                  {
                    "apply-count-active": item.status === unref(currentActiveTabName)
                  }
                ]),
                key: index2,
                onClick: ($event) => unref(handleToggleStaged)(item)
              }, [
                createElementVNode("span", _hoisted_8, toDisplayString(item.title), 1)
              ], 10, _hoisted_7);
            }), 128))
          ])
        ]),
        unref(applyToAnchorList).length > 0 && !unref(isGeneralUser) ? (openBlock(), createElementBlock("div", _hoisted_9, [
          createVNode(SvgIcon, {
            icon: ApplyTipsIcon,
            class: "apply-icon"
          }),
          createElementVNode("div", _hoisted_10, toDisplayString(unref(applyToAnchorUserContent)), 1),
          createElementVNode("div", {
            class: "apply-check",
            onClick: _cache[1] || (_cache[1] = //@ts-ignore
            (...args) => unref(showApplyUserList) && unref(showApplyUserList)(...args))
          }, toDisplayString(unref(t)("Check")), 1)
        ])) : createCommentVNode("", true),
        createElementVNode("div", _hoisted_11, [
          (openBlock(true), createElementBlock(Fragment, null, renderList(unref(filteredUserStatusList), (userInfo) => {
            return openBlock(), createBlock(unref(index), {
              key: userInfo.userId,
              "user-info": userInfo,
              "user-current-status": unref(currentActiveTabName)
            }, null, 8, ["user-info", "user-current-status"]);
          }), 128))
        ]),
        !unref(isGeneralUser) && unref(currentActiveTabName) !== unref(USERS_STATUS).NOT_ENTER ? (openBlock(), createElementBlock("div", _hoisted_12, [
          createVNode(TuiButton, {
            class: "button",
            size: "default",
            onClick: _cache[2] || (_cache[2] = ($event) => unref(toggleManageAllMember)(unref(ManageControlType).AUDIO))
          }, {
            default: withCtx(() => [
              createTextVNode(toDisplayString(unref(audioManageInfo)), 1)
            ]),
            _: 1
          }),
          createVNode(TuiButton, {
            class: "button",
            size: "default",
            onClick: _cache[3] || (_cache[3] = ($event) => unref(toggleManageAllMember)(unref(ManageControlType).VIDEO))
          }, {
            default: withCtx(() => [
              createTextVNode(toDisplayString(unref(videoManageInfo)), 1)
            ]),
            _: 1
          }),
          withDirectives((openBlock(), createElementBlock("div", _hoisted_13, [
            createVNode(TuiButton, {
              class: "button",
              size: "default",
              onClick: unref(toggleClickMoreBtn)
            }, {
              default: withCtx(() => [
                createTextVNode(toDisplayString(unref(t)("More")) + " ", 1),
                createVNode(SvgIcon, {
                  size: "12",
                  class: normalizeClass(["more-arrow", unref(showMoreControl) ? "up" : "down"]),
                  icon: ArrowUpIcon
                }, null, 8, ["class"])
              ]),
              _: 1
            }, 8, ["onClick"]),
            withDirectives(createElementVNode("div", _hoisted_14, [
              (openBlock(true), createElementBlock(Fragment, null, renderList(unref(moreControlList), (item) => {
                return openBlock(), createElementBlock("div", {
                  key: item.type,
                  class: "user-operate-item",
                  onClick: ($event) => item.func(item.type)
                }, [
                  createVNode(SvgIcon, {
                    icon: item.icon
                  }, null, 8, ["icon"]),
                  createElementVNode("span", _hoisted_16, toDisplayString(item.title), 1)
                ], 8, _hoisted_15);
              }), 128))
            ], 512), [
              [vShow, unref(showMoreControl)]
            ])
          ])), [
            [unref(vClickOutside), handleShowMoreControl]
          ])
        ])) : createCommentVNode("", true),
        unref(currentActiveTabName) === unref(USERS_STATUS).NOT_ENTER ? (openBlock(), createElementBlock("div", _hoisted_17, [
          unref(filteredUserStatusList).length > 0 ? (openBlock(), createBlock(TuiButton, {
            key: 0,
            class: "button-bottom",
            size: "default",
            onClick: unref(handleCallAllInvitee)
          }, {
            default: withCtx(() => [
              createTextVNode(toDisplayString(unref(t)("Call all")), 1)
            ]),
            _: 1
          }, 8, ["onClick"])) : createCommentVNode("", true)
        ])) : createCommentVNode("", true),
        createVNode(unref(Dialog), {
          modelValue: unref(showManageAllUserDialog),
          "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(showManageAllUserDialog) ? showManageAllUserDialog.value = $event : null),
          title: unref(dialogTitle),
          width: "480px",
          modal: true,
          "append-to-room-container": true
        }, {
          footer: withCtx(() => [
            createVNode(TuiButton, {
              size: "default",
              onClick: unref(doToggleManageAllMember)
            }, {
              default: withCtx(() => [
                createTextVNode(toDisplayString(unref(t)("Confirm")), 1)
              ]),
              _: 1
            }, 8, ["onClick"]),
            createVNode(TuiButton, {
              class: "cancel-button",
              size: "default",
              type: "primary",
              onClick: _cache[4] || (_cache[4] = ($event) => showManageAllUserDialog.value = false)
            }, {
              default: withCtx(() => [
                createTextVNode(toDisplayString(unref(t)("Cancel")), 1)
              ]),
              _: 1
            })
          ]),
          default: withCtx(() => [
            createElementVNode("span", null, toDisplayString(unref(dialogContent)), 1)
          ]),
          _: 1
        }, 8, ["modelValue", "title"])
      ]);
    };
  }
});
export {
  _sfc_main as default
};
