import { defineComponent, ref, withDirectives, createElementBlock, openBlock, createVNode, createCommentVNode, unref, withCtx, createElementVNode, normalizeClass, Fragment, renderList, toDisplayString } from "vue";
import { useUIKit, IconLayout } from "@tencentcloud/uikit-base-component-vue3";
import { useRoomParticipantState, RoomLayoutTemplate } from "tuikit-atomicx-vue3/room";
import IconButton from "../base/IconButton.vue2.mjs";
import vClickOutside from "../base/vClickOutside.mjs";
const _hoisted_1 = { 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__ */ defineComponent({
  __name: "index",
  props: {
    layout: {}
  },
  emits: ["update:layout"],
  setup(__props, { emit: __emit }) {
    const { t } = useUIKit();
    const { participantList } = useRoomParticipantState();
    const showLayoutList = ref(false);
    const emit = __emit;
    function handleClick(changeLayout) {
      emit("update:layout", changeLayout);
    }
    function handleClickLayoutIcon() {
      var _a;
      if (((_a = participantList.value) == null ? void 0 : _a.length) < 2) {
        return;
      }
      showLayoutList.value = !showLayoutList.value;
    }
    function handleClickOutSide() {
      if (showLayoutList.value) {
        showLayoutList.value = false;
      }
    }
    return (_ctx, _cache) => {
      return withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
        createVNode(IconButton, {
          title: unref(t)("Layout.Title"),
          disabled: unref(participantList).length < 2,
          layout: "horizontal",
          onClickIcon: handleClickLayoutIcon
        }, {
          default: withCtx(() => [
            createVNode(unref(IconLayout), { size: "20" })
          ]),
          _: 1
        }, 8, ["title", "disabled"]),
        showLayoutList.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
          createElementVNode("div", {
            class: normalizeClass([
              "layout1",
              "layout-item",
              `${__props.layout === unref(RoomLayoutTemplate).GridLayout ? "checked" : ""}`
            ]),
            onClick: _cache[0] || (_cache[0] = ($event) => handleClick(unref(RoomLayoutTemplate).GridLayout))
          }, [
            createElementVNode("div", _hoisted_3, [
              (openBlock(true), createElementBlock(Fragment, null, renderList(new Array(9).fill(""), (item, index) => {
                return openBlock(), createElementBlock("div", {
                  key: index,
                  class: "layout-block"
                });
              }), 128))
            ]),
            createElementVNode("span", _hoisted_4, toDisplayString(unref(t)("Layout.Grid")), 1)
          ], 2),
          createElementVNode("div", {
            class: normalizeClass([
              "layout2",
              "layout-item",
              `${__props.layout === unref(RoomLayoutTemplate).SidebarLayout ? "checked" : ""}`
            ]),
            onClick: _cache[1] || (_cache[1] = ($event) => handleClick(unref(RoomLayoutTemplate).SidebarLayout))
          }, [
            createElementVNode("div", _hoisted_5, [
              _cache[3] || (_cache[3] = createElementVNode("div", { class: "left-container" }, null, -1)),
              createElementVNode("div", _hoisted_6, [
                (openBlock(true), createElementBlock(Fragment, null, renderList(new Array(3).fill(""), (item, index) => {
                  return openBlock(), createElementBlock("div", {
                    key: index,
                    class: "layout-block"
                  });
                }), 128))
              ])
            ]),
            createElementVNode("span", _hoisted_7, toDisplayString(unref(t)("Layout.GalleryRight")), 1)
          ], 2),
          createElementVNode("div", {
            class: normalizeClass([
              "layout3",
              "layout-item",
              `${__props.layout === unref(RoomLayoutTemplate).CinemaLayout ? "checked" : ""}`
            ]),
            onClick: _cache[2] || (_cache[2] = ($event) => handleClick(unref(RoomLayoutTemplate).CinemaLayout))
          }, [
            createElementVNode("div", _hoisted_8, [
              createElementVNode("div", _hoisted_9, [
                (openBlock(true), createElementBlock(Fragment, null, renderList(new Array(3).fill(""), (item, index) => {
                  return openBlock(), createElementBlock("div", {
                    key: index,
                    class: "layout-block"
                  });
                }), 128))
              ]),
              _cache[4] || (_cache[4] = createElementVNode("div", { class: "bottom-container" }, null, -1))
            ]),
            createElementVNode("span", _hoisted_10, toDisplayString(unref(t)("Layout.GalleryTop")), 1)
          ], 2)
        ])) : createCommentVNode("", true)
      ])), [
        [unref(vClickOutside), handleClickOutSide]
      ]);
    };
  }
});
export {
  _sfc_main as default
};
