import React__default from 'react';
import { u as useOpenChannelContext } from '../../chunks/bundle-DHs6ktbB.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-DUd6AS_D.js';
import '../../chunks/bundle-B9I7KCZ2.js';
import '../../chunks/bundle-D-_vevD1.js';
import '../../chunks/bundle-D6I-uHp_.js';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import '../../chunks/bundle-B97onQ-B.js';
import '../../chunks/bundle-DjAkc3FK.js';
import '../../chunks/bundle-DVCGbhaI.js';
import '../../useSendbirdStateContext.js';
import '../../withSendbird.js';
import '../../chunks/bundle-DAF0GGlr.js';
import '../../chunks/bundle-BGoByD2z.js';
import '@sendbird/chat/groupChannel';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-ByuZy4m8.js';
import '../../chunks/bundle-DnVyKahm.js';
import '../../chunks/bundle-B628FXKZ.js';
import 'react-dom';
import '../../chunks/bundle-BPLoGpIy.js';
import '../../chunks/bundle-BwafidOs.js';
import '../../chunks/bundle-CMgJTzYH.js';
import '../../chunks/bundle-BydEbpDQ.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../chunks/bundle-B1gHpFXu.js';
import '../../ui/Icon.js';
import '@sendbird/uikit-tools';
import 'css-vars-ponyfill';
import '../../chunks/bundle-jVDgtxRn.js';
import '../../chunks/bundle-Mfnn12A9.js';
import '../../chunks/bundle-BfonFE4n.js';
import '../../ui/SortByRow.js';
import '../../ui/MessageInput.js';
import '../../chunks/bundle-DqJ40nCa.js';
import '../../chunks/bundle-De1BnkR0.js';
import '../../chunks/bundle-D3w6q-9W.js';
import 'dompurify';
import '../../chunks/bundle-BT8XMu5e.js';
import '../../chunks/bundle-CpcTBaG-.js';
import '../../chunks/bundle-BQqQX3na.js';
import '../../chunks/bundle-bbk4ulub.js';
import '../../chunks/bundle-D89r5O-w.js';
import '../../ui/ImageRenderer.js';
import '../../ui/Loader.js';
import '../../chunks/bundle-B3xAJZu1.js';
import './OpenChannelMessage.js';
import '../../chunks/bundle-Cme8jJ5D.js';
import '../../ui/OpenchannelUserMessage.js';
import '../../ui/UserProfile.js';
import '../../sendbirdSelectors.js';
import '../../chunks/bundle-BRJKqtvr.js';
import '../../chunks/bundle-TsBTbRzS.js';
import '../../chunks/bundle-C6OwelAY.js';
import '../../ui/OpenChannelAdminMessage.js';
import '../../ui/OpenchannelOGMessage.js';
import '../../ui/LinkLabel.js';
import '../../chunks/bundle-C8uZHDqp.js';
import '../../Message/context.js';
import '../../ui/MentionLabel.js';
import '../../ui/OpenchannelThumbnailMessage.js';
import '../../ui/OpenchannelFileMessage.js';
import '../../ui/TextButton.js';
import '../../chunks/bundle-DDIIh2iG.js';
import '../../ui/DateSeparator.js';
import '../../ui/FileViewer.js';
import '../../chunks/bundle-l8sVpQGm.js';
import '../../chunks/bundle-BiG6myo3.js';
import '../../chunks/bundle-C3ue0IHg.js';
import '../../chunks/bundle-B1rkq8k3.js';
import '../../chunks/bundle-CmAD8QUZ.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, renderPlaceHolderEmptyList = _a.renderPlaceHolderEmptyList, renderPlaceHolderError = _a.renderPlaceHolderError, renderPlaceHolderLoading = _a.renderPlaceHolderLoading, renderMessageInput = _a.renderMessageInput, renderInput = _a.renderInput;
    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 })));
    }
    var renderInputComponent = renderMessageInput || renderInput;
    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 }),
        (renderInputComponent === null || renderInputComponent === void 0 ? void 0 : renderInputComponent()) || React__default.createElement(OpenChannelInput, { ref: messageInputRef })));
};

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