import React__default from 'react';
import { u as useOpenChannelContext } from '../../chunks/bundle-C3_a0vzo.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-C_RTy-wB.js';
import '../../chunks/bundle-CyKcXwxv.js';
import '../../chunks/bundle-xzHlqm91.js';
import '../../chunks/bundle-DV19ISeX.js';
import '@sendbird/uikit-tools';
import '../../withSendbird.js';
import '../../chunks/bundle-DIM08oup.js';
import '../../chunks/bundle-DCvGHvPz.js';
import '@sendbird/chat/groupChannel';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-BFKFmP-d.js';
import '../../chunks/bundle-DAYMi6vw.js';
import '../../chunks/bundle-vddg8rUR.js';
import '../../chunks/bundle-B43BrwWe.js';
import 'react-dom';
import '../../chunks/bundle-yFfkfO0O.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../chunks/bundle-bz4PqMYo.js';
import '../../ui/Icon.js';
import 'css-vars-ponyfill';
import '@sendbird/chat';
import '../../chunks/bundle-BUQ58hWb.js';
import '@sendbird/chat/openChannel';
import '../../chunks/bundle-CKwMZR9c.js';
import '../../useSendbirdStateContext.js';
import '../../chunks/bundle-Bien0gJP.js';
import '../../ui/SortByRow.js';
import '../../chunks/bundle-ByOQ0ql4.js';
import '../../chunks/bundle-BCRvYX9G.js';
import '../../chunks/bundle-BAACXDmZ.js';
import '../../chunks/bundle-Dmj05jBl.js';
import '../../ui/MessageInput.js';
import '../../chunks/bundle-NEplso7H.js';
import '../../chunks/bundle-N7XRO_Ma.js';
import '../../chunks/bundle-CdOhleNh.js';
import 'dompurify';
import '../../chunks/bundle-2Qim3Dap.js';
import '../../chunks/bundle-fX_liw7W.js';
import '../../chunks/bundle-rk3bNfCF.js';
import '../../chunks/bundle-CXmeegua.js';
import '../../chunks/bundle-BUD_vgZ5.js';
import '../../ui/ImageRenderer.js';
import '../../ui/Loader.js';
import '../../chunks/bundle-DDXgauuR.js';
import './OpenChannelMessage.js';
import '../../chunks/bundle-rAzWFbt-.js';
import '../../ui/OpenchannelUserMessage.js';
import '../../ui/UserProfile.js';
import '../../sendbirdSelectors.js';
import '../../chunks/bundle-BHF2w0ue.js';
import '../../chunks/bundle-TehC8jIr.js';
import '../../chunks/bundle-D91-xsQ4.js';
import '../../ui/OpenChannelAdminMessage.js';
import '../../ui/OpenchannelOGMessage.js';
import '../../ui/LinkLabel.js';
import '../../chunks/bundle-DK6h-KUk.js';
import '../../Message/context.js';
import '../../ui/MentionLabel.js';
import '../../ui/OpenchannelThumbnailMessage.js';
import '../../ui/OpenchannelFileMessage.js';
import '../../ui/TextButton.js';
import '../../chunks/bundle-GXXt0WAx.js';
import '../../ui/DateSeparator.js';
import '../../ui/FileViewer.js';
import '../../chunks/bundle-RRVvccZ1.js';
import '../../chunks/bundle-DVRTAl51.js';
import '../../chunks/bundle-DM3bor9c.js';
import '../../chunks/bundle-DCJ4e4g-.js';
import '../../chunks/bundle-15-msoxy.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
