import { _ as __assign } from '../../chunks/bundle-KIf79auh.js';
import React__default from 'react';
import { useIIFE } from '@sendbird/uikit-tools';
import { useSendbirdStateContext } from '../../useSendbirdStateContext.js';
import { g as getSuggestedReplies, e as isSendableMessage } from '../../chunks/bundle-LTiCF37t.js';
import { i as isDisabledBecauseFrozen, a as isDisabledBecauseMuted } from '../../chunks/bundle-39Y3yv8j.js';
import { useGroupChannelContext } from '../context.js';
import { M as MessageView } from '../../chunks/bundle-a73hFmUC.js';
import { FileViewer } from './FileViewer.js';
import { RemoveMessageModal } from './RemoveMessageModal.js';
import '../../withSendbird.js';
import '@sendbird/chat/groupChannel';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-0QDb7-Y_.js';
import '@sendbird/chat/message';
import '../../chunks/bundle-_hGurAcC.js';
import '../../chunks/bundle-npMrmwG6.js';
import '../../chunks/bundle-9QigDxkR.js';
import '../../chunks/bundle-Ueye8-sz.js';
import '../../chunks/bundle-xC7o7NLR.js';
import '../../chunks/bundle-NQDEdVJA.js';
import '../../chunks/bundle-X7gl5vNX.js';
import '../../chunks/bundle-PdtvfqJT.js';
import '../../chunks/bundle-3E-IANjq.js';
import '../../chunks/bundle-eC1SRuX3.js';
import '../../chunks/bundle-wWnN6K3w.js';
import '../../chunks/bundle-wpc1Fted.js';
import '../../chunks/bundle-XDy3Cf54.js';
import '../../chunks/bundle-yIputEl7.js';
import '../../Message/hooks/useDirtyGetMentions.js';
import '../../ui/DateSeparator.js';
import '../../chunks/bundle-n2BmCgGV.js';
import '../../chunks/bundle-9c5vLDe9.js';
import '../../ui/MessageInput.js';
import '../../chunks/bundle-AaDwp4eU.js';
import '../../ui/IconButton.js';
import '../../ui/Button.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 '../../ui/Icon.js';
import '../../chunks/bundle-DHw1C5gJ.js';
import '../../chunks/bundle-Sm0-7tTm.js';
import '../../ui/MessageContent.js';
import '../../chunks/bundle-qouYngqR.js';
import '../../ui/Loader.js';
import '../../chunks/bundle-ubVU4exZ.js';
import '../../chunks/bundle-PYv4lPO3.js';
import '../../ui/MessageItemMenu.js';
import '../../ui/ContextMenu.js';
import 'react-dom';
import '../../ui/SortByRow.js';
import '../../chunks/bundle-hjFxrcMW.js';
import '../../chunks/bundle-0DTNrbOf.js';
import '../../ui/MessageItemReactionMenu.js';
import '../../ui/ImageRenderer.js';
import '../../ui/ReactionButton.js';
import '../../chunks/bundle-lZq_XDzb.js';
import '../../chunks/bundle-Y3ZVN9yF.js';
import '../../ui/EmojiReactions.js';
import '../../ui/ReactionBadge.js';
import '../../ui/BottomSheet.js';
import '../../hooks/useModal.js';
import '../../chunks/bundle-22Jw6ztq.js';
import '../../ui/UserListItem.js';
import '../../chunks/bundle-b2jLXyrm.js';
import '../../chunks/bundle-Sl-oiala.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-2AR3a1T9.js';
import '../../chunks/bundle-bgVMRm8v.js';
import '../../ui/ThreadReplies.js';
import '../../ui/OGMessageItemBody.js';
import '../../chunks/bundle-BiPw1Sub.js';
import '../../ui/MentionLabel.js';
import '../../ui/LinkLabel.js';
import '../../ui/TextMessageItemBody.js';
import '../../ui/FileMessageItemBody.js';
import '../../ui/TextButton.js';
import '../../chunks/bundle-y9VJsc3H.js';
import '../../chunks/bundle-6_zAh1Y3.js';
import '../../chunks/bundle-jqQY8n8G.js';
import '../../ui/VoiceMessageItemBody.js';
import '../../ui/ProgressBar.js';
import '../../VoicePlayer/useVoicePlayer.js';
import '../../chunks/bundle-bg3dRlK7.js';
import '../../VoiceRecorder/context.js';
import '../../ui/PlaybackTime.js';
import '../../ui/ThumbnailMessageItemBody.js';
import '../../ui/UnknownMessageItemBody.js';
import '../../ui/TemplateMessageItemBody.js';
import '../../chunks/bundle-6KFri-1A.js';
import '../../ui/FallbackTemplateMessageItemBody.tsx.js';
import '../../ui/LoadingTemplateMessageItemBody.tsx.js';
import '../../ui/FeedbackIconButton.js';
import '../../ui/MobileFeedbackMenu.js';
import '../../Channel/components/MessageFeedbackModal.js';
import '../../ui/Input.js';
import './SuggestedReplies.js';
import '../../chunks/bundle-NntyZyeL.js';
import '../../chunks/bundle-da60Z7l5.js';
import '../../chunks/bundle--WETJA_c.js';
import '../../chunks/bundle-XjJUjhN1.js';

var Message = function (props) {
    var _a = useSendbirdStateContext(), config = _a.config, emojiManager = _a.emojiManager;
    var _b = useGroupChannelContext(), loading = _b.loading, currentChannel = _b.currentChannel, animatedMessageId = _b.animatedMessageId, setAnimatedMessageId = _b.setAnimatedMessageId, scrollToMessage = _b.scrollToMessage, replyType = _b.replyType, threadReplySelectType = _b.threadReplySelectType, isReactionEnabled = _b.isReactionEnabled, toggleReaction = _b.toggleReaction, nicknamesMap = _b.nicknamesMap, setQuoteMessage = _b.setQuoteMessage, renderUserMentionItem = _b.renderUserMentionItem, onQuoteMessageClick = _b.onQuoteMessageClick, onReplyInThreadClick = _b.onReplyInThreadClick, onMessageAnimated = _b.onMessageAnimated, messages = _b.messages, updateUserMessage = _b.updateUserMessage, sendUserMessage = _b.sendUserMessage, resendMessage = _b.resendMessage, deleteMessage = _b.deleteMessage;
    var message = props.message;
    var initialized = !loading && Boolean(currentChannel);
    var groupChannelConfig = config === null || config === void 0 ? void 0 : config.groupChannel;
    var shouldRenderSuggestedReplies = useIIFE(function () {
        var _a;
        if (!groupChannelConfig)
            return false;
        var enableSuggestedReplies = groupChannelConfig.enableSuggestedReplies, showSuggestedRepliesFor = groupChannelConfig.showSuggestedRepliesFor;
        if (!enableSuggestedReplies)
            return false;
        if ((!showSuggestedRepliesFor || showSuggestedRepliesFor === 'last_message_only')
            && message.messageId === ((_a = currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.lastMessage) === null || _a === void 0 ? void 0 : _a.messageId))
            return false;
        if (getSuggestedReplies(message).length === 0)
            return false;
        var lastMessage = messages[messages.length - 1];
        if (lastMessage && isSendableMessage(lastMessage) && lastMessage.sendingStatus !== 'succeeded')
            return false;
        return true;
    });
    return (React__default.createElement(MessageView, __assign({}, props, { channel: currentChannel, emojiContainer: emojiManager.emojiContainer, editInputDisabled: !initialized || isDisabledBecauseFrozen(currentChannel) || isDisabledBecauseMuted(currentChannel) || !config.isOnline, shouldRenderSuggestedReplies: shouldRenderSuggestedReplies, isReactionEnabled: isReactionEnabled, replyType: replyType, threadReplySelectType: threadReplySelectType, nicknamesMap: nicknamesMap, renderUserMentionItem: renderUserMentionItem, scrollToMessage: scrollToMessage, toggleReaction: toggleReaction, setQuoteMessage: setQuoteMessage, onQuoteMessageClick: onQuoteMessageClick, onReplyInThreadClick: onReplyInThreadClick, sendUserMessage: sendUserMessage, updateUserMessage: updateUserMessage, 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, Message as default };
//# sourceMappingURL=Message.js.map
