"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const room = require("tuikit-atomicx-vue3/room");
const index_vue_vue_type_script_setup_true_lang = require("./StandardParticipantViewUI/index.vue.js");
const index = require("./WebinarParticipantViewUI/index.vue2.js");
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  __name: "index",
  props: {
    layoutTemplate: {}
  },
  emits: ["update:layoutTemplate"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const { currentRoom } = room.useRoomState();
    const { participantList, participantWithScreen } = room.useRoomParticipantState();
    vue.watch(participantWithScreen, (newVal, oldVal) => {
      var _a;
      if (((_a = currentRoom.value) == null ? void 0 : _a.roomType) === room.RoomType.Standard && newVal && !oldVal) {
        emits("update:layoutTemplate", room.RoomLayoutTemplate.SidebarLayout);
      }
    });
    vue.watch(
      () => participantList.value.length + (participantWithScreen.value ? 1 : 0),
      (val) => {
        var _a;
        if (((_a = currentRoom.value) == null ? void 0 : _a.roomType) === room.RoomType.Standard && val === 1 && props.layoutTemplate !== room.RoomLayoutTemplate.GridLayout) {
          emits("update:layoutTemplate", room.RoomLayoutTemplate.GridLayout);
        }
      }
    );
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createBlock(vue.unref(room.RoomView), { "layout-template": __props.layoutTemplate }, {
        participantViewUI: vue.withCtx(({ participant, streamType }) => {
          var _a, _b;
          return [
            ((_a = vue.unref(currentRoom)) == null ? void 0 : _a.roomType) === vue.unref(room.RoomType).Standard ? (vue.openBlock(), vue.createBlock(index_vue_vue_type_script_setup_true_lang.default, {
              key: 0,
              participant,
              "stream-type": streamType
            }, null, 8, ["participant", "stream-type"])) : vue.createCommentVNode("", true),
            ((_b = vue.unref(currentRoom)) == null ? void 0 : _b.roomType) === vue.unref(room.RoomType).Webinar ? (vue.openBlock(), vue.createBlock(index.default, {
              key: 1,
              participant,
              "stream-type": streamType
            }, null, 8, ["participant", "stream-type"])) : vue.createCommentVNode("", true)
          ];
        }),
        _: 1
      }, 8, ["layout-template"]);
    };
  }
});
exports.default = _sfc_main;
