import React__default from 'react';
import { u as useOpenChannelContext } from '../../OpenChannelProvider-b9104634.js';
import OpenChannelInput from './OpenChannelInput.js';
import FrozenNotification from './FrozenChannelNotification.js';
import OpenchannelConversationHeader from './OpenChannelHeader.js';
import { P as PlaceHolder, a as PlaceHolderTypes } from '../../index-2cfab646.js';
import OpenChannelMessageList from './OpenChannelMessageList.js';
import '../../index-ccef08fe.js';
import '../../index-6add7940.js';
import '../../UserProfileContext-f3f446d2.js';
import 'prop-types';
import '../../_rollupPluginBabelHelpers-05128ded.js';
import '../../compareIds-2e50e905.js';
import '../../topics-eb548880.js';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import '../../uuid-717930b4.js';
import '../../useSendbirdStateContext.js';
import '../../withSendbird.js';
import '../../LocalizationContext-a82461b5.js';
import '../../stringSet-b60e9529.js';
import '../../ui/MessageInput.js';
import '../../const-3a34a127.js';
import '../../const-72f012b6.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../index-6420013c.js';
import 'dompurify';
import '../../consts-b4cb83cf.js';
import '../../ui/Icon.js';
import '../../index-579ca9d7.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../consts-7693b8d3.js';
import '../../consts-9469111b.js';
import '../../tokenize-c718324d.js';
import '../../index.module-4f1cd64e.js';
import '../../ui/Avatar.js';
import '../../ui/ImageRenderer.js';
import '../../MediaQueryContext-d6110905.js';
import '../../ui/Loader.js';
import '../../index-ad50e2c0.js';
import './OpenChannelMessage.js';
import '../../ui/OpenchannelUserMessage.js';
import '../../ui/ContextMenu.js';
import 'react-dom';
import '../../ui/SortByRow.js';
import '../../ui/UserProfile.js';
import '../../sendbirdSelectors.js';
import '../../utils-e0c7329c.js';
import '../../utils-f610bf03.js';
import '../../index-629b2439.js';
import '../../useLongPress-12280c78.js';
import '../../ui/OpenChannelAdminMessage.js';
import '../../ui/OpenchannelOGMessage.js';
import '../../ui/LinkLabel.js';
import '../../index-a2bb2783.js';
import '../../Message/context.js';
import '../../ui/MentionLabel.js';
import '../../ui/OpenchannelThumbnailMessage.js';
import '../../ui/OpenchannelFileMessage.js';
import '../../ui/TextButton.js';
import '../../color-91e43dce.js';
import '../../ui/DateSeparator.js';
import '../../ui/FileViewer.js';
import '../../index-a9101009.js';
import '../../ui/Modal.js';
import '../../index-dd5a8777.js';
import '../../consts-fa6ab3c0.js';

const COMPONENT_CLASS_NAME = 'sendbird-openchannel-conversation';
const OpenChannelUI = _ref => {
  let {
    renderMessage,
    renderHeader,
    renderInput,
    renderPlaceHolderEmptyList,
    renderPlaceHolderError,
    renderPlaceHolderLoading
  } = _ref;
  const {
    currentOpenChannel,
    amIBanned,
    loading,
    isInvalid,
    messageInputRef,
    conversationScrollRef
  } = useOpenChannelContext();
  if (!currentOpenChannel || !(currentOpenChannel !== null && currentOpenChannel !== void 0 && currentOpenChannel.url) || amIBanned) {
    return (renderPlaceHolderError === null || renderPlaceHolderError === void 0 ? void 0 : renderPlaceHolderError()) || /*#__PURE__*/React__default.createElement("div", {
      className: COMPONENT_CLASS_NAME
    }, /*#__PURE__*/React__default.createElement(PlaceHolder, {
      type: PlaceHolderTypes.NO_CHANNELS
    }));
  }
  if (loading) {
    return (renderPlaceHolderLoading === null || renderPlaceHolderLoading === void 0 ? void 0 : renderPlaceHolderLoading()) || /*#__PURE__*/React__default.createElement("div", {
      className: COMPONENT_CLASS_NAME
    }, /*#__PURE__*/React__default.createElement(PlaceHolder, {
      type: PlaceHolderTypes.LOADING
    }));
  }
  if (isInvalid) {
    return (renderPlaceHolderError === null || renderPlaceHolderError === void 0 ? void 0 : renderPlaceHolderError()) || /*#__PURE__*/React__default.createElement("div", {
      className: COMPONENT_CLASS_NAME
    }, /*#__PURE__*/React__default.createElement(PlaceHolder, {
      type: PlaceHolderTypes.WRONG
    }));
  }
  return /*#__PURE__*/React__default.createElement("div", {
    className: COMPONENT_CLASS_NAME
  }, (renderHeader === null || renderHeader === void 0 ? void 0 : renderHeader()) || /*#__PURE__*/React__default.createElement(OpenchannelConversationHeader, null), (currentOpenChannel === null || currentOpenChannel === void 0 ? void 0 : currentOpenChannel.isFrozen) && /*#__PURE__*/React__default.createElement(FrozenNotification, null), /*#__PURE__*/React__default.createElement(OpenChannelMessageList, {
    ref: conversationScrollRef,
    renderMessage: renderMessage,
    renderPlaceHolderEmptyList: renderPlaceHolderEmptyList
  }), (renderInput === null || renderInput === void 0 ? void 0 : renderInput()) || /*#__PURE__*/React__default.createElement(OpenChannelInput, {
    ref: messageInputRef
  }));
};

export { OpenChannelUI as default };
//# sourceMappingURL=OpenChannelUI.js.map
