'use strict';

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

var _tslib = require('../../chunks/bundle-5ru_FO5x.js');
var React = require('react');
var MessageInputWrapperView = require('../../chunks/bundle-B9GhSdVG.js');
var GroupChannel_context = require('../context.js');
var uikitTools = require('@sendbird/uikit-tools');
var index = require('../../chunks/bundle-Ce6jCnmC.js');
var useSendbirdStateContext = require('../../useSendbirdStateContext.js');
require('../../chunks/bundle-MOn9SqMU.js');
require('../../chunks/bundle-BLV9zZk1.js');
require('../../chunks/bundle-Ck_8lQa-.js');
require('../../chunks/bundle-V-_XUHW5.js');
require('./SuggestedMentionList.js');
require('../../chunks/bundle-DrPY0rWx.js');
require('../../chunks/bundle-DCPc6-Im.js');
require('../../ui/Icon.js');
require('../../chunks/bundle-Cd8aIDXf.js');
require('../../chunks/bundle-BFWd_LLn.js');
require('../../ui/ImageRenderer.js');
require('../../chunks/bundle-Bvh9LUfE.js');
require('../../chunks/bundle-slS7A2f9.js');
require('../../chunks/bundle-DrCmmE89.js');
require('../../chunks/bundle-DrV1GooU.js');
require('../../withSendbird.js');
require('../../Message/hooks/useDirtyGetMentions.js');
require('../../ui/QuoteMessageInput.js');
require('../../chunks/bundle-DqRKg94l.js');
require('../../chunks/bundle-BFtlkbFV.js');
require('../../VoicePlayer/useVoicePlayer.js');
require('../../chunks/bundle-BMU1Zuos.js');
require('../../chunks/bundle-MDcnM2N1.js');
require('../../VoiceRecorder/context.js');
require('../../chunks/bundle-CHERnV8x.js');
require('react-dom');
require('../../chunks/bundle-DqTUSoNi.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../VoiceRecorder/useVoiceRecorder.js');
require('../../chunks/bundle-CN06fWST.js');
require('../../ui/PlaybackTime.js');
require('../../ui/ProgressBar.js');
require('../../ui/TextButton.js');
require('../../chunks/bundle-xUIqwbO0.js');
require('../../ui/MessageInput.js');
require('../../chunks/bundle-D0hE0g6d.js');
require('dompurify');
require('../../chunks/bundle-B20ESzEn.js');
require('../../chunks/bundle-9ogjIkrJ.js');
require('../../chunks/bundle-B3qxP7Hx.js');
require('../../chunks/bundle-lBIlhpy4.js');
require('../../hooks/useModal.js');
require('../../chunks/bundle-CFOCblXb.js');
require('@sendbird/chat/message');
require('@sendbird/chat/groupChannel');
require('../../chunks/bundle-Cgk-lpZZ.js');
require('../../chunks/bundle-Dv4YKtdL.js');
require('../../chunks/bundle-ghdvllVc.js');
require('../../chunks/bundle-3dML2VBI.js');
require('../../chunks/bundle-Bi2wvpu_.js');
require('../../chunks/bundle-Dpfab45s.js');
require('../../chunks/bundle-BMEm0fE7.js');
require('../../chunks/bundle-BedaAirg.js');
require('../../chunks/bundle-CGX-vhe9.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
