'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _tslib = require('../../chunks/bundle-HGbi-rCv.js');
var React = require('react');
var MessageInputWrapperView = require('../../chunks/bundle-DMGpM9Ye.js');
var GroupChannel_context = require('../context.js');
var uikitTools = require('@sendbird/uikit-tools');
var index = require('../../chunks/bundle-wl1uuzU7.js');
var useSendbirdStateContext = require('../../useSendbirdStateContext.js');
require('../../chunks/bundle-DQy218lT.js');
require('../../chunks/bundle-oeWNUdCB.js');
require('../../chunks/bundle-gtkPlUrw.js');
require('../../chunks/bundle-BWGOXLHb.js');
require('./SuggestedMentionList.js');
require('../../chunks/bundle-BaM5Ed34.js');
require('../../chunks/bundle-5_kPn4wU.js');
require('../../ui/Icon.js');
require('../../chunks/bundle-BoLhr7Ko.js');
require('../../chunks/bundle-DxSB9NRz.js');
require('../../ui/ImageRenderer.js');
require('../../chunks/bundle-C93-onMF.js');
require('../../chunks/bundle-1XtsxT8L.js');
require('../../chunks/bundle-CR04Yhbr.js');
require('../../chunks/bundle-CmpLg1_S.js');
require('../../withSendbird.js');
require('../../Message/hooks/useDirtyGetMentions.js');
require('../../ui/QuoteMessageInput.js');
require('../../chunks/bundle-DcSTnNI0.js');
require('../../VoicePlayer/useVoicePlayer.js');
require('../../chunks/bundle-L3FEqZsK.js');
require('../../chunks/bundle-DfcEln0Z.js');
require('../../chunks/bundle-CZfcXYaX.js');
require('react-dom');
require('../../chunks/bundle-BwQ4BJif.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('css-vars-ponyfill');
require('@sendbird/chat');
require('@sendbird/chat/openChannel');
require('@sendbird/chat/groupChannel');
require('../../chunks/bundle-BTU876jx.js');
require('../../VoiceRecorder/useVoiceRecorder.js');
require('../../chunks/bundle-BTod-EOk.js');
require('../../ui/PlaybackTime.js');
require('../../ui/ProgressBar.js');
require('../../ui/TextButton.js');
require('../../chunks/bundle-DAxedY0T.js');
require('../../ui/MessageInput.js');
require('../../chunks/bundle-BLc7P6Sp.js');
require('dompurify');
require('../../chunks/bundle-D4aDRH9m.js');
require('../../chunks/bundle-8VyIP0TE.js');
require('../../chunks/bundle-DdxJqNSP.js');
require('../../chunks/bundle-CLOaQmX9.js');
require('../../chunks/bundle-Q4icQ1qH.js');
require('@sendbird/chat/message');
require('../../chunks/bundle-CAUMYdVU.js');
require('../../chunks/bundle-BaQc9oOW.js');
require('../../chunks/bundle-BjgfoBVC.js');
require('../../chunks/bundle-C1XVsHlE.js');
require('../../chunks/bundle-CE6bFQmu.js');
require('../../chunks/bundle-Com-Z-XI.js');
require('../../chunks/bundle-BOkZUm8a.js');
require('../../chunks/bundle-Dehhi1FZ.js');
require('../../chunks/bundle-Dww6fCVQ.js');
require('../../utils/message/getOutgoingMessageState.js');

var MessageInputWrapper = function (props) {
    var _a;
    var config = useSendbirdStateContext.useSendbirdStateContext().config;
    var context = GroupChannel_context.useGroupChannelContext();
    var messages = context.messages, currentChannel = context.currentChannel;
    var lastMessage = currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.lastMessage;
    var isLastMessageSuggestedRepliesEnabled = uikitTools.useIIFE(function () {
        var _a;
        if (!((_a = config === null || config === void 0 ? void 0 : config.groupChannel) === null || _a === void 0 ? void 0 : _a.enableSuggestedReplies))
            return false;
        if (index.getSuggestedReplies(lastMessage).length === 0)
            return false;
        var lastMessageInContext = messages[messages.length - 1];
        if (index.isSendableMessage(lastMessageInContext) && lastMessageInContext.sendingStatus !== 'succeeded')
            return false;
        return true;
    });
    var disableMessageInput = props.disabled
        || isLastMessageSuggestedRepliesEnabled && !!((_a = lastMessage.extendedMessagePayload) === null || _a === void 0 ? void 0 : _a['disable_chat_input']);
    return (React.createElement(MessageInputWrapperView.MessageInputWrapperView, _tslib.__assign({}, props, context, { disabled: disableMessageInput })));
};

exports.VoiceMessageInputWrapper = MessageInputWrapperView.VoiceMessageInputWrapper;
exports.MessageInputWrapper = MessageInputWrapper;
exports.default = MessageInputWrapper;
//# sourceMappingURL=MessageInputWrapper.js.map
