import React__default from 'react';
import { u as useOpenChannelContext } from '../../chunks/bundle-LQlIikHo.js';
import OpenChannelInput from './OpenChannelInput.js';
import FrozenNotification from './FrozenChannelNotification.js';
import OpenchannelConversationHeader from './OpenChannelHeader.js';
import PlaceHolder, { PlaceHolderTypes } from '../../ui/PlaceHolder.js';
import OpenChannelMessageList from './OpenChannelMessageList.js';
import '../../chunks/bundle-_hGurAcC.js';
import '../../chunks/bundle-KIf79auh.js';
import '../../chunks/bundle-C-Q3OKQW.js';
import '../../chunks/bundle-3E-IANjq.js';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import '../../chunks/bundle-hjFxrcMW.js';
import '../../chunks/bundle-y909vBn9.js';
import '../../chunks/bundle-Sl-oiala.js';
import '../../useSendbirdStateContext.js';
import '../../withSendbird.js';
import '../../hooks/useModal.js';
import '../../chunks/bundle-0QDb7-Y_.js';
import '../../chunks/bundle-DHw1C5gJ.js';
import '../../chunks/bundle-22Jw6ztq.js';
import 'react-dom';
import '../../chunks/bundle-wpc1Fted.js';
import '../../chunks/bundle-XDy3Cf54.js';
import '../../chunks/bundle-wWnN6K3w.js';
import '../../chunks/bundle-Y3ZVN9yF.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../chunks/bundle-9c5vLDe9.js';
import '../../ui/Icon.js';
import '../../chunks/bundle-xC7o7NLR.js';
import '../../ui/MessageInput.js';
import '../../chunks/bundle-AaDwp4eU.js';
import '../../chunks/bundle-yIputEl7.js';
import '../../chunks/bundle-zy69cX9t.js';
import 'dompurify';
import '../../chunks/bundle-9C7b_-hs.js';
import '../../chunks/bundle-0Vur_TKy.js';
import '../../chunks/bundle-4gcxTdvH.js';
import '../../chunks/bundle-LTiCF37t.js';
import '@sendbird/chat/groupChannel';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-Sm0-7tTm.js';
import '../../chunks/bundle-b2jLXyrm.js';
import '../../ui/ImageRenderer.js';
import '../../ui/Loader.js';
import '../../chunks/bundle-PYv4lPO3.js';
import '../../chunks/bundle-eC1SRuX3.js';
import './OpenChannelMessage.js';
import '../../ui/OpenchannelUserMessage.js';
import '../../ui/ContextMenu.js';
import '../../ui/SortByRow.js';
import '../../ui/UserProfile.js';
import '../../sendbirdSelectors.js';
import '../../chunks/bundle-BMZkoBS_.js';
import '../../chunks/bundle-JyjLgYxl.js';
import '../../chunks/bundle-lZq_XDzb.js';
import '../../ui/OpenChannelAdminMessage.js';
import '../../ui/OpenchannelOGMessage.js';
import '../../ui/LinkLabel.js';
import '../../chunks/bundle-BiPw1Sub.js';
import '../../Message/context.js';
import '../../ui/MentionLabel.js';
import '../../ui/OpenchannelThumbnailMessage.js';
import '../../ui/OpenchannelFileMessage.js';
import '../../ui/TextButton.js';
import '../../chunks/bundle-n2BmCgGV.js';
import '../../ui/DateSeparator.js';
import '../../chunks/bundle-6_zAh1Y3.js';
import '../../chunks/bundle-jqQY8n8G.js';
import '@sendbird/uikit-tools';
import '../../chunks/bundle-XjJUjhN1.js';
import '../../chunks/bundle-hAyHXo9f.js';
import '../../chunks/bundle-X7gl5vNX.js';
import '../../chunks/bundle-NQDEdVJA.js';
import '@sendbird/chat/message';
import '../../Channel/utils/compareMessagesForGrouping.js';

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

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