"use strict";Object.defineProperty(exports, "__esModule", {value: true});

var _chunkAEPQK527js = require('./chunk-AEPQK527.js');


var _chunk2O3BHEC4js = require('./chunk-2O3BHEC4.js');


var _chunkP4FHXATLjs = require('./chunk-P4FHXATL.js');



var _chunk37JY6JLJjs = require('./chunk-37JY6JLJ.js');


var _chunkCJYU5QIMjs = require('./chunk-CJYU5QIM.js');

// tmp-babel/messages/web/ChatRoom/index.js
var _react = require('react');
var _displays = require('@baseapp-frontend/design-system/components/web/displays');
var _material = require('@mui/material');
var _reactrelay = require('react-relay');
var _jsxruntime = require('react/jsx-runtime');
function _typeof(o) {
  "@babel/helpers - typeof";
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
    return typeof o2;
  } : function(o2) {
    return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
  }, _typeof(o);
}
function ownKeys(e, r) {
  var t = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var o = Object.getOwnPropertySymbols(e);
    r && (o = o.filter(function(r2) {
      return Object.getOwnPropertyDescriptor(e, r2).enumerable;
    })), t.push.apply(t, o);
  }
  return t;
}
function _objectSpread(e) {
  for (var r = 1; r < arguments.length; r++) {
    var t = null != arguments[r] ? arguments[r] : {};
    r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
      _defineProperty(e, r2, t[r2]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
      Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
    });
  }
  return e;
}
function _defineProperty(e, r, t) {
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
}
function _toPropertyKey(t) {
  var i = _toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}
function _toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}
var ChatRoom = function ChatRoom2(_ref) {
  var roomId = _ref.roomId, _ref$MessagesList = _ref.MessagesList, MessagesList = _ref$MessagesList === void 0 ? _chunkP4FHXATLjs.MessagesList_default : _ref$MessagesList, _ref$MessagesListProp = _ref.MessagesListProps, MessagesListProps = _ref$MessagesListProp === void 0 ? {} : _ref$MessagesListProp, _ref$SendMessage = _ref.SendMessage, SendMessage = _ref$SendMessage === void 0 ? _chunk2O3BHEC4js.SendMessage_default : _ref$SendMessage, _ref$SendMessageProps = _ref.SendMessageProps, SendMessageProps = _ref$SendMessageProps === void 0 ? {} : _ref$SendMessageProps, onDisplayGroupDetailsClicked = _ref.onDisplayGroupDetailsClicked;
  var _useLazyLoadQuery = _reactrelay.useLazyLoadQuery.call(void 0, _chunkCJYU5QIMjs.ChatRoomQuery, {
    roomId
  }, {
    fetchPolicy: "store-and-network",
    fetchKey: roomId
  }), chatRoom = _useLazyLoadQuery.chatRoom;
  if (!chatRoom) {
    return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
      children: "Chat room not found"
    });
  }
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk37JY6JLJjs.ChatRoomContainer, {
    children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAEPQK527js.ChatRoomHeader_default, {
      isArchived: !!chatRoom.isArchived,
      participantsCount: chatRoom.participantsCount,
      roomTitleRef: chatRoom,
      onDisplayGroupDetailsClicked,
      roomId
    }), /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk37JY6JLJjs.ChatBodyContainer, {
      children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, MessagesList, _objectSpread({
        roomRef: chatRoom
      }, MessagesListProps)), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Box, {
        paddingRight: 2,
        children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SendMessage, _objectSpread({
          roomId
        }, SendMessageProps))
      })]
    })]
  });
};
var SuspendedChatRoom = function SuspendedChatRoom2(props) {
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Suspense, {
    fallback: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _displays.LoadingState, {}),
    children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChatRoom, _objectSpread({}, props))
  });
};
var ChatRoom_default = SuspendedChatRoom;



exports.ChatRoom_default = ChatRoom_default;
//# sourceMappingURL=chunk-4TAG75BZ.js.map