'use strict';

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

var _tslib = require('../../chunks/bundle-9l41IWgC.js');
var React = require('react');
var MessageInputWrapperView = require('../../chunks/bundle-sYYqa58y.js');
var GroupChannel_context = require('../context.js');
var uikitTools = require('@sendbird/uikit-tools');
var index = require('../../chunks/bundle-Gw-7KmmG.js');
var useSendbirdStateContext = require('../../useSendbirdStateContext.js');
require('../../chunks/bundle-0FJbDLYK.js');
require('../../chunks/bundle-2dTv415Y.js');
require('../../chunks/bundle-xtUT3duD.js');
require('../../chunks/bundle-qYN98FNj.js');
require('./SuggestedMentionList.js');
require('../../chunks/bundle-NSfuzonk.js');
require('../../chunks/bundle-5i9-ntZ5.js');
require('../../ui/Icon.js');
require('../../chunks/bundle-BdWL3kB4.js');
require('../../chunks/bundle-Sxjv83JD.js');
require('../../ui/ImageRenderer.js');
require('../../chunks/bundle-xbuS1NJI.js');
require('../../chunks/bundle-5zZ25-q8.js');
require('../../chunks/bundle-wbFvXCMi.js');
require('../../chunks/bundle-A45IMFSi.js');
require('../../withSendbird.js');
require('../../Message/hooks/useDirtyGetMentions.js');
require('../../ui/QuoteMessageInput.js');
require('../../chunks/bundle-EIBGC5ds.js');
require('../../chunks/bundle-SWOq3kxG.js');
require('../../VoicePlayer/useVoicePlayer.js');
require('../../chunks/bundle-xe1wuNko.js');
require('../../chunks/bundle-qD5w2tyR.js');
require('../../VoiceRecorder/context.js');
require('../../chunks/bundle-Myh0hGtf.js');
require('react-dom');
require('../../chunks/bundle-UOOPIGjG.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../VoiceRecorder/useVoiceRecorder.js');
require('../../chunks/bundle-DKAurwqI.js');
require('../../ui/PlaybackTime.js');
require('../../ui/ProgressBar.js');
require('../../ui/TextButton.js');
require('../../chunks/bundle-yQR_oAnV.js');
require('../../ui/MessageInput.js');
require('../../chunks/bundle-rdAhtJum.js');
require('dompurify');
require('../../chunks/bundle-ctM9C4Ol.js');
require('../../chunks/bundle-nNgkSlET.js');
require('../../chunks/bundle-RK7_ZCh1.js');
require('../../chunks/bundle-QvRptclZ.js');
require('../../hooks/useModal.js');
require('../../chunks/bundle-0Io7rZH6.js');
require('@sendbird/chat/message');
require('@sendbird/chat/groupChannel');
require('../../chunks/bundle-bOij3dXU.js');
require('../../chunks/bundle-FYiANS7I.js');
require('../../chunks/bundle-_Hwf9prH.js');
require('../../chunks/bundle-b3QK79hX.js');
require('../../chunks/bundle-tBuSzzHI.js');
require('../../chunks/bundle-aggH3_MP.js');
require('../../chunks/bundle-OypRlCX4.js');
require('../../chunks/bundle-1BET8ZYY.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
