"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const render = require("../../../constants/render.js");
const basic = require("../../../stores/basic.js");
const room = require("../../../stores/room.js");
const pinia = require("pinia");
const index = require("../../../locales/index.js");
const room$1 = require("../../../constants/room.js");
const IconButton = require("../../common/base/IconButton.vue.js");
const LayoutIcon = require("../../common/icons/LayoutIcon.vue.js");
const vClickOutside = require("../../../directives/vClickOutside.js");
require("../../../services/main.js");
const roomService = require("../../../services/roomService.js");
require("@tencentcloud/tuiroom-engine-js");
require("mitt");
require("../../../services/manager/roomActionManager.js");
require("@tencentcloud/tui-core");
const _hoisted_1 = {
  key: 0,
  class: "layout-container"
};
const _hoisted_2 = {
  key: 0,
  class: "layout-list"
};
const _hoisted_3 = { class: "layout-block-container" };
const _hoisted_4 = { class: "layout-title" };
const _hoisted_5 = { class: "layout-block-container" };
const _hoisted_6 = { class: "right-container" };
const _hoisted_7 = { class: "layout-title" };
const _hoisted_8 = { class: "layout-block-container" };
const _hoisted_9 = { class: "top-container" };
const _hoisted_10 = { class: "layout-title" };
const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
  __name: "LayoutControl",
  setup(__props) {
    const { t } = index.useI18n();
    const basicStore = basic.useBasicStore();
    const { layout } = pinia.storeToRefs(basicStore);
    const roomStore = room.useRoomStore();
    const { streamNumber } = pinia.storeToRefs(roomStore);
    const showLayoutList = Vue.ref(false);
    const isStreamNumberLessThanTwo = Vue.computed(() => streamNumber.value < 2);
    const layoutControlConfig = roomService.roomService.getComponentConfig("LayoutControl");
    function handleClick(layout2) {
      basicStore.setLayout(layout2);
    }
    function handleClickLayoutIcon() {
      if (isStreamNumberLessThanTwo.value) {
        return;
      }
      showLayoutList.value = !showLayoutList.value;
    }
    function handleClickOutSide() {
      if (showLayoutList.value) {
        showLayoutList.value = false;
      }
    }
    return (_ctx, _cache) => {
      return Vue.unref(layoutControlConfig).visible ? Vue.withDirectives((Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
        Vue.createVNode(IconButton.default, {
          title: Vue.unref(t)("Layout"),
          disabled: isStreamNumberLessThanTwo.value,
          layout: Vue.unref(room$1.IconButtonLayout).HORIZONTAL,
          onClickIcon: handleClickLayoutIcon
        }, {
          default: Vue.withCtx(() => [
            Vue.createVNode(LayoutIcon.default)
          ]),
          _: 1
        }, 8, ["title", "disabled", "layout"]),
        showLayoutList.value ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_2, [
          Vue.createElementVNode("div", {
            class: Vue.normalizeClass([
              "layout1",
              "layout-item",
              `${Vue.unref(layout) === Vue.unref(render.LAYOUT).NINE_EQUAL_POINTS ? "checked" : ""}`
            ]),
            onClick: _cache[0] || (_cache[0] = ($event) => handleClick(Vue.unref(render.LAYOUT).NINE_EQUAL_POINTS))
          }, [
            Vue.createElementVNode("div", _hoisted_3, [
              (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(new Array(9).fill(""), (item, index2) => {
                return Vue.openBlock(), Vue.createElementBlock("div", {
                  key: index2,
                  class: "layout-block"
                });
              }), 128))
            ]),
            Vue.createElementVNode("span", _hoisted_4, Vue.toDisplayString(Vue.unref(t)("Grid")), 1)
          ], 2),
          Vue.createElementVNode("div", {
            class: Vue.normalizeClass([
              "layout2",
              "layout-item",
              `${Vue.unref(layout) === Vue.unref(render.LAYOUT).RIGHT_SIDE_LIST ? "checked" : ""}`
            ]),
            onClick: _cache[1] || (_cache[1] = ($event) => handleClick(Vue.unref(render.LAYOUT).RIGHT_SIDE_LIST))
          }, [
            Vue.createElementVNode("div", _hoisted_5, [
              _cache[3] || (_cache[3] = Vue.createElementVNode("div", { class: "left-container" }, null, -1)),
              Vue.createElementVNode("div", _hoisted_6, [
                (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(new Array(3).fill(""), (item, index2) => {
                  return Vue.openBlock(), Vue.createElementBlock("div", {
                    key: index2,
                    class: "layout-block"
                  });
                }), 128))
              ])
            ]),
            Vue.createElementVNode("span", _hoisted_7, Vue.toDisplayString(Vue.unref(t)("Gallery on right")), 1)
          ], 2),
          Vue.createElementVNode("div", {
            class: Vue.normalizeClass([
              "layout3",
              "layout-item",
              `${Vue.unref(layout) === Vue.unref(render.LAYOUT).TOP_SIDE_LIST ? "checked" : ""}`
            ]),
            onClick: _cache[2] || (_cache[2] = ($event) => handleClick(Vue.unref(render.LAYOUT).TOP_SIDE_LIST))
          }, [
            Vue.createElementVNode("div", _hoisted_8, [
              Vue.createElementVNode("div", _hoisted_9, [
                (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(new Array(3).fill(""), (item, index2) => {
                  return Vue.openBlock(), Vue.createElementBlock("div", {
                    key: index2,
                    class: "layout-block"
                  });
                }), 128))
              ]),
              _cache[4] || (_cache[4] = Vue.createElementVNode("div", { class: "bottom-container" }, null, -1))
            ]),
            Vue.createElementVNode("span", _hoisted_10, Vue.toDisplayString(Vue.unref(t)("Gallery at top")), 1)
          ], 2)
        ])) : Vue.createCommentVNode("", true)
      ])), [
        [Vue.unref(vClickOutside.default), handleClickOutSide]
      ]) : Vue.createCommentVNode("", true);
    };
  }
});
exports.default = _sfc_main;
