import { defineComponent, openBlock, createElementBlock, createVNode, unref, withCtx, withDirectives, vShow } from "vue";
import { storeToRefs } from "pinia";
import IconButton from "../common/base/IconButton.vue.mjs";
import StageApplicationIcon from "../common/icons/StageApplicationIcon.vue.mjs";
import { useBasicStore } from "../../stores/basic.mjs";
import { useRoomStore } from "../../stores/room.mjs";
import { useI18n } from "../../locales/index.mjs";
import TuiBadge from "../common/base/Badge.vue.mjs";
import { isMobile } from "../../utils/environment.mjs";
import MasterApplyControl from "./ApplyControl/MasterApplyControl/index.mjs";
import useMasterApplyControl from "../../hooks/useMasterApplyControl.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "ManageStageControl",
  setup(__props) {
    const { t } = useI18n();
    const basicStore = useBasicStore();
    const roomStore = useRoomStore();
    const { handleShowNotification } = useMasterApplyControl();
    const { sidebarName, showApplyUserList } = storeToRefs(basicStore);
    const { applyToAnchorList } = storeToRefs(roomStore);
    function toggleManageStage() {
      if (!isMobile) {
        basicStore.setShowApplyUserList(!showApplyUserList.value);
      } else {
        if (basicStore.isSidebarOpen && basicStore.sidebarName === "apply") {
          basicStore.setSidebarOpenStatus(false);
          basicStore.setSidebarName("");
          return;
        }
        basicStore.setSidebarOpenStatus(true);
        basicStore.setSidebarName("apply");
      }
    }
    handleShowNotification();
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", null, [
        createVNode(TuiBadge, {
          hidden: unref(applyToAnchorList).length === 0,
          value: unref(applyToAnchorList).length,
          max: 10,
          type: "danger"
        }, {
          default: withCtx(() => [
            createVNode(IconButton, {
              title: unref(t)("Apply to stage"),
              icon: StageApplicationIcon,
              "is-active": unref(sidebarName) === "apply",
              onClickIcon: toggleManageStage
            }, null, 8, ["title", "is-active"])
          ]),
          _: 1
        }, 8, ["hidden", "value"]),
        withDirectives(createVNode(unref(MasterApplyControl), null, null, 512), [
          [vShow, unref(showApplyUserList)]
        ])
      ]);
    };
  }
});
export {
  _sfc_main as default
};
