import { _ as __assign } from '../../chunks/bundle-B8Grfnrx.js';
import React__default from 'react';
import { useChannelContext } from '../context.js';
import { g as getSuggestedReplies } from '../../chunks/bundle-CgLhYjm5.js';
import { b as isDisabledBecauseFrozen, c as isDisabledBecauseMuted } from '../../chunks/bundle-D_tSqvX6.js';
import { M as MessageView } from '../../chunks/bundle-CuP5OWwY.js';
import { FileViewer } from './FileViewer.js';
import RemoveMessageModal from './RemoveMessageModal.js';
import { u as useSendbird } from '../../chunks/bundle-I25ah_Bv.js';
import '../../chunks/bundle-BYqblmEM.js';
import '../../chunks/bundle-BciLDE6M.js';
import '../../chunks/bundle-C6Hk5xTT.js';
import '../../chunks/bundle-Dy1IZ181.js';
import '../../chunks/bundle-DYBTopZK.js';
import '../../chunks/bundle-BYOddwmS.js';
import '@sendbird/chat/message';
import '../../chunks/bundle-De-3zaYV.js';
import '../../chunks/bundle-YbXrJewH.js';
import '../../chunks/bundle-Ob7Cw3V-.js';
import '../../chunks/bundle-Djq12iSf.js';
import '../../chunks/bundle-l_QLKq1Y.js';
import '../../chunks/bundle-Y2KBbxRr.js';
import '@sendbird/chat/groupChannel';
import '../../chunks/bundle-CTkGIdt8.js';
import '../../chunks/bundle-BqjbaVLO.js';
import '../../chunks/bundle--1cImOGd.js';
import '../../chunks/bundle-B5_aP8LE.js';
import '../../chunks/bundle-BCGcsRu2.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-BTxw_tIt.js';
import '../../chunks/bundle-D8xAej93.js';
import '../../Message/hooks/useDirtyGetMentions.js';
import '../../ui/DateSeparator.js';
import '../../chunks/bundle-DED6q4Ti.js';
import '../../chunks/bundle-HspRRkmy.js';
import '../../ui/MessageInput.js';
import '../../chunks/bundle-DXneAdAp.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../chunks/bundle-DwLTEVMK.js';
import 'dompurify';
import '../../chunks/bundle-Dp_oW1ks.js';
import '../../chunks/bundle-Cn2czFA-.js';
import '../../chunks/bundle-4w9Y7uxA.js';
import '../../ui/Icon.js';
import '../../chunks/bundle-CDcu1I4f.js';
import '../../chunks/bundle-DT1VcdMs.js';
import '../../ui/MessageContent.js';
import '../../chunks/bundle-Dd7rgmeQ.js';
import '../../ui/Loader.js';
import '../../chunks/bundle-Dhf37wzM.js';
import '../../chunks/bundle-C8TP-mjp.js';
import '../../chunks/bundle-CQAiZVNS.js';
import '../../chunks/bundle-QCH8CZT8.js';
import 'react-dom';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import '../../ui/SortByRow.js';
import '../../chunks/bundle-C4OmfIXk.js';
import '../../ui/MessageItemReactionMenu.js';
import '../../ui/ImageRenderer.js';
import '../../ui/ReactionButton.js';
import '../../chunks/bundle-CJmXP56m.js';
import '../../chunks/bundle-yKqHFFfz.js';
import '../../ui/EmojiReactions.js';
import '../../ui/ReactionBadge.js';
import '../../ui/BottomSheet.js';
import '../../hooks/useModal.js';
import '../../chunks/bundle-LnGQMQVt.js';
import '../../ui/UserListItem.js';
import '../../chunks/bundle-DgFzcADJ.js';
import '../../chunks/bundle-C_ngoQD_.js';
import '../../ui/MutedAvatarOverlay.js';
import '../../ui/Checkbox.js';
import '../../ui/UserProfile.js';
import '../../sendbirdSelectors.js';
import '../../ui/Tooltip.js';
import '../../ui/TooltipWrapper.js';
import '../../Message/context.js';
import '../../ui/AdminMessage.js';
import '../../ui/QuoteMessage.js';
import '../../chunks/bundle-tFnb24Id.js';
import '../../ui/MobileMenu.js';
import '../../ui/ThreadReplies.js';
import '../../chunks/bundle-CEE3GJSk.js';
import '../../ui/OGMessageItemBody.js';
import '../../chunks/bundle-Do9UFGCD.js';
import '../../ui/MentionLabel.js';
import '../../ui/LinkLabel.js';
import '../../ui/TextMessageItemBody.js';
import '../../ui/FileMessageItemBody.js';
import '../../ui/TextButton.js';
import '../../chunks/bundle-BFJ4ctRk.js';
import '../../ui/FileViewer.js';
import '../../chunks/bundle-DgpfIrde.js';
import '@sendbird/uikit-tools';
import '../../ui/VoiceMessageItemBody.js';
import '../../ui/ProgressBar.js';
import '../../VoicePlayer/useVoicePlayer.js';
import '../../chunks/bundle-zOZq2Vpt.js';
import '../../VoiceRecorder/context.js';
import '../../ui/PlaybackTime.js';
import '../../ui/ThumbnailMessageItemBody.js';
import '../../ui/UnknownMessageItemBody.js';
import '../../ui/TemplateMessageItemBody.js';
import '../../chunks/bundle-CwHldvb8.js';
import '../../ui/FallbackTemplateMessageItemBody.tsx.js';
import '../../ui/LoadingTemplateMessageItemBody.tsx.js';
import '../../ui/MessageFeedbackFailedModal.js';
import '../../ui/FeedbackIconButton.js';
import '../../ui/MobileFeedbackMenu.js';
import '../../ui/MessageFeedbackModal.js';
import '../../ui/Input.js';
import '../../chunks/bundle-CFXaZ31h.js';
import '../../GroupChannel/components/SuggestedReplies.js';
import '../../chunks/bundle-CF8V-ET_.js';
import '../../chunks/bundle-BGj68IUE.js';
import '../../chunks/bundle-C60pq62Y.js';
import '../../chunks/bundle-DDZn5buS.js';

/**
 * @deprecated This component is deprecated and will be removed in the next major update.
 * Please use the `GroupChannel` component from '@sendbird/uikit-react/GroupChannel' instead.
 * For more information, please refer to the migration guide:
 * https://docs.sendbird.com/docs/chat/uikit/v3/react/introduction/group-channel-migration-guide
 */
var Message = function (props) {
    var _a, _b;
    var config = useSendbird().state.config;
    var _c = useChannelContext(), initialized = _c.initialized, currentGroupChannel = _c.currentGroupChannel, animatedMessageId = _c.animatedMessageId, setAnimatedMessageId = _c.setAnimatedMessageId, updateMessage = _c.updateMessage, scrollToMessage = _c.scrollToMessage, replyType = _c.replyType, threadReplySelectType = _c.threadReplySelectType, isReactionEnabled = _c.isReactionEnabled, toggleReaction = _c.toggleReaction, emojiContainer = _c.emojiContainer, nicknamesMap = _c.nicknamesMap, setQuoteMessage = _c.setQuoteMessage, resendMessage = _c.resendMessage, deleteMessage = _c.deleteMessage, renderUserMentionItem = _c.renderUserMentionItem, onReplyInThread = _c.onReplyInThread, onQuoteMessageClick = _c.onQuoteMessageClick, onMessageAnimated = _c.onMessageAnimated, sendMessage = _c.sendMessage, localMessages = _c.localMessages, allMessages = _c.allMessages;
    var message = props.message;
    if (!currentGroupChannel)
        return null;
    return (React__default.createElement(MessageView, __assign({}, props, { channel: currentGroupChannel, emojiContainer: emojiContainer, editInputDisabled: !initialized || isDisabledBecauseFrozen(currentGroupChannel) || isDisabledBecauseMuted(currentGroupChannel) || !config.isOnline, shouldRenderSuggestedReplies: ((_a = config === null || config === void 0 ? void 0 : config.groupChannel) === null || _a === void 0 ? void 0 : _a.enableSuggestedReplies)
            && (((_b = config === null || config === void 0 ? void 0 : config.groupChannel) === null || _b === void 0 ? void 0 : _b.showSuggestedRepliesFor) === 'all_messages'
                ? true
                : message.messageId === allMessages[allMessages.length - 1].messageId
            // Use `allMessages[allMessages.length - 1]` instead of `currentGroupChannel.lastMessage`
            // because lastMessage is not updated when **Bot** sends messages
            )
            // the options should appear only when there's no failed or pending messages
            && (localMessages === null || localMessages === void 0 ? void 0 : localMessages.length) === 0
            && getSuggestedReplies(message).length > 0, isReactionEnabled: isReactionEnabled, replyType: replyType, threadReplySelectType: threadReplySelectType, nicknamesMap: nicknamesMap, renderUserMentionItem: renderUserMentionItem, scrollToMessage: scrollToMessage, toggleReaction: toggleReaction, setQuoteMessage: setQuoteMessage, onQuoteMessageClick: onQuoteMessageClick, onReplyInThreadClick: onReplyInThread, sendUserMessage: function (params) {
            sendMessage({
                message: params.message,
                mentionedUsers: params.mentionedUsers,
                mentionTemplate: params.mentionedMessageTemplate,
            });
        }, updateUserMessage: function (messageId, params) {
            var _a;
            updateMessage({
                messageId: messageId,
                message: (_a = params.message) !== null && _a !== void 0 ? _a : '',
                mentionedUsers: params.mentionedUsers,
                mentionTemplate: params.mentionedMessageTemplate,
            });
        }, resendMessage: resendMessage, deleteMessage: deleteMessage, animatedMessageId: animatedMessageId, setAnimatedMessageId: setAnimatedMessageId, onMessageAnimated: onMessageAnimated, renderFileViewer: function (props) { return React__default.createElement(FileViewer, __assign({}, props)); }, renderRemoveMessageModal: function (props) { return React__default.createElement(RemoveMessageModal, __assign({}, props)); } })));
};

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