'use strict';

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

var _tslib = require('../../chunks/bundle-5ru_FO5x.js');
var React = require('react');
var index = require('../../chunks/bundle-Ce6jCnmC.js');
var MessageInputWrapperView = require('../../chunks/bundle-B9GhSdVG.js');
var Channel_context = require('../context.js');
var useSendbirdStateContext = require('../../useSendbirdStateContext.js');
require('@sendbird/chat/groupChannel');
require('../../utils/message/getOutgoingMessageState.js');
require('../../chunks/bundle-BFtlkbFV.js');
require('../../chunks/bundle-MOn9SqMU.js');
require('../../chunks/bundle-BLV9zZk1.js');
require('../../chunks/bundle-Ck_8lQa-.js');
require('../../chunks/bundle-V-_XUHW5.js');
require('../../GroupChannel/components/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('../../Message/hooks/useDirtyGetMentions.js');
require('../../ui/QuoteMessageInput.js');
require('../../chunks/bundle-DqRKg94l.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('../../withSendbird.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('../../chunks/bundle-Cgk-lpZZ.js');
require('../../chunks/bundle-Bi2wvpu_.js');
require('@sendbird/chat/message');
require('../../chunks/bundle-CGX-vhe9.js');
require('../../chunks/bundle-De62SpYH.js');
require('../../chunks/bundle-CIO_k2aH.js');
require('../../chunks/bundle-C0PM57R_.js');
require('../../chunks/bundle-D0Tt_yWl.js');
require('../../chunks/bundle-Ca2tfuK5.js');
require('../../chunks/bundle-BedaAirg.js');
require('../../chunks/bundle-Dv4YKtdL.js');
require('../../chunks/bundle-ghdvllVc.js');
require('../../chunks/bundle-D1GC3Mlw.js');

var MessageInputWrapper = function (props) {
    var _a, _b;
    var config = useSendbirdStateContext.useSendbirdStateContext().config;
    var context = Channel_context.useChannelContext();
    var quoteMessage = context.quoteMessage, localMessages = context.localMessages, currentGroupChannel = context.currentGroupChannel, 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, context, { disabled: disableMessageInput, currentChannel: currentGroupChannel, sendUserMessage: function (params) {
            return sendMessage({
                message: params.message,
                mentionTemplate: params.mentionedMessageTemplate,
                mentionedUsers: params.mentionedUsers,
                quoteMessage: quoteMessage,
            });
        }, sendFileMessage: function (params) {
            return sendFileMessage(params.file, quoteMessage);
        }, sendVoiceMessage: function (_a, duration) {
            var file = _a.file;
            return sendVoiceMessage(file, duration, quoteMessage);
        }, sendMultipleFilesMessage: function (_a) {
            var fileInfoList = _a.fileInfoList;
            return sendMultipleFilesMessage(fileInfoList.map(function (fileInfo) { return fileInfo.file; }), quoteMessage);
        } })));
};

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