import { defineComponent, ref, openBlock, createElementBlock, createElementVNode, normalizeClass, createVNode, toDisplayString, unref, withCtx, createTextVNode } from "vue";
import SvgIcon from "../../../common/base/SvgIcon.vue.mjs";
import ScreenSharingIcon from "../../../common/icons/ScreenSharingIcon.vue.mjs";
import TuiButton from "../../../common/base/Button.vue.mjs";
import Dialog from "../../../common/base/Dialog/index.mjs";
import bus from "../../../../hooks/useMitt.mjs";
import { useI18n } from "../../../../locales/index.mjs";
const _hoisted_1 = { class: "local-screen-container" };
const _hoisted_2 = { class: "local-screen-info" };
const _hoisted_3 = { class: "text" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    isMiniRegion: { type: Boolean }
  },
  setup(__props) {
    const { t } = useI18n();
    const showStopShareRegion = ref(false);
    function openStopConfirmDialog() {
      showStopShareRegion.value = true;
    }
    function stopScreenSharing() {
      showStopShareRegion.value = false;
      bus.emit("ScreenShare:stopScreenShare");
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createElementVNode("div", {
          class: normalizeClass(["local-screen-control-container", { mini: _ctx.isMiniRegion }])
        }, [
          createElementVNode("div", _hoisted_2, [
            createVNode(SvgIcon, { icon: ScreenSharingIcon }),
            createElementVNode("span", _hoisted_3, toDisplayString(unref(t)("You are sharing the screen...")), 1)
          ]),
          createVNode(TuiButton, {
            size: "default",
            class: "stop-button",
            onClick: openStopConfirmDialog
          }, {
            default: withCtx(() => [
              createTextVNode(toDisplayString(unref(t)("End sharing")), 1)
            ]),
            _: 1
          }),
          createVNode(unref(Dialog), {
            modelValue: showStopShareRegion.value,
            "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => showStopShareRegion.value = $event),
            width: "420px",
            title: unref(t)("End sharing"),
            modal: true,
            "close-on-click-modal": true,
            "append-to-room-container": true
          }, {
            footer: withCtx(() => [
              createElementVNode("span", null, [
                createVNode(TuiButton, {
                  class: "dialog-button",
                  size: "default",
                  onClick: stopScreenSharing
                }, {
                  default: withCtx(() => [
                    createTextVNode(toDisplayString(unref(t)("End sharing")), 1)
                  ]),
                  _: 1
                }),
                createVNode(TuiButton, {
                  type: "primary",
                  size: "default",
                  onClick: _cache[0] || (_cache[0] = ($event) => showStopShareRegion.value = false)
                }, {
                  default: withCtx(() => [
                    createTextVNode(toDisplayString(unref(t)("Cancel")), 1)
                  ]),
                  _: 1
                })
              ])
            ]),
            default: withCtx(() => [
              createElementVNode("span", null, toDisplayString(unref(t)(
                "Others will no longer see your screen after you stop sharing. Are you sure you want to stop?"
              )), 1)
            ]),
            _: 1
          }, 8, ["modelValue", "title"])
        ], 2)
      ]);
    };
  }
});
export {
  _sfc_main as default
};
