'use strict';

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

var _tslib = require('../../chunks/bundle-H3iUL9jU.js');
var React = require('react');
var index = require('../../chunks/bundle-eG-yFfLY.js');
var MessageInputWrapperView = require('../../chunks/bundle-o2O3PYyl.js');
var Channel_context = require('../context.js');
var useSendbirdStateContext = require('../../useSendbirdStateContext.js');
require('@sendbird/chat/groupChannel');
require('../../utils/message/getOutgoingMessageState.js');
require('../../chunks/bundle-eg9jnWPm.js');
require('../../chunks/bundle-hlZ6VwkW.js');
require('../../chunks/bundle-om7V4Kmd.js');
require('../../chunks/bundle-08DJamJs.js');
require('../../chunks/bundle-ubmIpm9y.js');
require('../../chunks/bundle-jUxjf8aL.js');
require('../../chunks/bundle-WWYVAaVT.js');
require('../../ui/Icon.js');
require('../../chunks/bundle-Kwa0c8dM.js');
require('../../chunks/bundle-mNGciuzV.js');
require('../../ui/ImageRenderer.js');
require('../../chunks/bundle-DgcTM2HW.js');
require('../../chunks/bundle-jP-1bn23.js');
require('../../chunks/bundle-Ok99sReN.js');
require('../../Message/hooks/useDirtyGetMentions.js');
require('../../ui/QuoteMessageInput.js');
require('../../chunks/bundle-r9E_mzs-.js');
require('../../VoicePlayer/useVoicePlayer.js');
require('../../chunks/bundle-X6IgWOv5.js');
require('../../chunks/bundle--yF0PJ6E.js');
require('../../VoiceRecorder/context.js');
require('../../chunks/bundle--t70CDfb.js');
require('react-dom');
require('../../chunks/bundle-lHnGN-3L.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../withSendbird.js');
require('../../VoiceRecorder/useVoiceRecorder.js');
require('../../chunks/bundle-p1TqI4uJ.js');
require('../../ui/PlaybackTime.js');
require('../../ui/ProgressBar.js');
require('../../ui/TextButton.js');
require('../../chunks/bundle-YxnuYJcD.js');
require('../../ui/MessageInput.js');
require('../../chunks/bundle-_vyDAzUb.js');
require('../../chunks/bundle-a3DGXthf.js');
require('dompurify');
require('../../chunks/bundle-dwD6gaHJ.js');
require('../../chunks/bundle-0LtiaxJx.js');
require('../../chunks/bundle-8XvxyLQN.js');
require('../../chunks/bundle-ZpJLlgNE.js');
require('../../hooks/useModal.js');
require('../../chunks/bundle-49TaYIAY.js');
require('../../chunks/bundle-uubJJzRW.js');
require('../../chunks/bundle-E1H3DQtB.js');
require('@sendbird/chat/message');
require('../../chunks/bundle-V4Gdewny.js');
require('../../chunks/bundle-0TRHdH1v.js');
require('../../chunks/bundle-m_0K8NXX.js');
require('../../chunks/bundle-EsJltkVm.js');
require('../hooks/useInitialMessagesFetch.js');
require('../../chunks/bundle-1CojrMYd.js');
require('../../chunks/bundle-BMB3xh2i.js');
require('../../chunks/bundle-qjc3EF_B.js');
require('../../chunks/bundle--zfwoPVm.js');
require('../../chunks/bundle-hzGTyicd.js');

var MessageInputWrapper = function (props) {
    var _a, _b;
    var config = useSendbirdStateContext.useSendbirdStateContext().config;
    var context = Channel_context.useChannelContext();
    var currentGroupChannel = context.currentGroupChannel, localMessages = context.localMessages, sendMessage = context.sendMessage, sendFileMessage = context.sendFileMessage, sendVoiceMessage = context.sendVoiceMessage, sendMultipleFilesMessage = context.sendMultipleFilesMessage;
    var lastMessage = currentGroupChannel === null || currentGroupChannel === void 0 ? void 0 : currentGroupChannel.lastMessage;
    var isLastMessageSuggestedRepliesEnabled = ((_a = config === null || config === void 0 ? void 0 : config.groupChannel) === null || _a === void 0 ? void 0 : _a.enableSuggestedReplies)
        && index.getSuggestedReplies(lastMessage).length > 0
        && (localMessages === null || localMessages === void 0 ? void 0 : localMessages.length) === 0;
    var disableMessageInput = props.disabled
        || isLastMessageSuggestedRepliesEnabled && !!((_b = lastMessage.extendedMessagePayload) === null || _b === void 0 ? void 0 : _b['disable_chat_input']);
    return (React.createElement(MessageInputWrapperView.MessageInputWrapperView, _tslib.__assign({}, props, { disabled: disableMessageInput }, context, { currentChannel: currentGroupChannel, quoteMessage: context.quoteMessage, sendUserMessage: function (params) { return (sendMessage(_tslib.__assign(_tslib.__assign({}, params), { quoteMessage: { messageId: params.parentMessageId } }))); }, sendFileMessage: function (params) { return (sendFileMessage(params.file, { messageId: params.parentMessageId })); }, sendVoiceMessage: function (_a, duration) {
            var file = _a.file, parentMessageId = _a.parentMessageId;
            return (sendVoiceMessage(file, duration, { parentMessageId: parentMessageId }));
        }, sendMultipleFilesMessage: function (_a) {
            var fileInfoList = _a.fileInfoList, parentMessageId = _a.parentMessageId;
            return (sendMultipleFilesMessage(fileInfoList.map(function (fileInfo) { return fileInfo.file; }), { parentMessageId: parentMessageId }));
        } })));
};

exports.MessageInputWrapper = MessageInputWrapper;
exports.default = MessageInputWrapper;
//# sourceMappingURL=MessageInput.js.map
