'use strict';

var React = require('react');
var ui_Modal = require('../../ui/Modal.js');
var ui_Button = require('../../ui/Button.js');
var LocalizationContext = require('../../LocalizationContext-bc6af64a.js');
var Channel_context = require('../../ChannelProvider-e2f422cf.js');
require('react-dom');
require('../../index-09573a50.js');
require('../../ui/Icon.js');
require('prop-types');
require('../../ui/IconButton.js');
require('../../_rollupPluginBabelHelpers-00480ba8.js');
require('../../index-902525e0.js');
require('../../stringSet-812981b5.js');
require('../../MediaQueryContext-8be571f9.js');
require('../../index-c08c7ef8.js');
require('../../UserProfileContext-268ad0d1.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../const-f1c7b0cf.js');
require('../../index-a9099968.js');
require('../../topics-623a82c5.js');
require('../../index-609a0bf5.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../compareIds-a65972c5.js');
require('@sendbird/chat/groupChannel');
require('../../uuid-43555bb8.js');
require('@sendbird/chat/message');
require('../../consts-d0461d4c.js');
require('../../resolvedReplyType-ab4bb8af.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

const RemoveMessage = props => {
  var _message$threadInfo;
  const {
    onSubmit = () => {/* noop */},
    onCancel,
    message
  } = props;
  const {
    stringSet
  } = React.useContext(LocalizationContext.LocalizationContext);
  const {
    deleteMessage
  } = Channel_context.useChannelContext();
  return /*#__PURE__*/React__default["default"].createElement(ui_Modal["default"], {
    type: ui_Button.ButtonTypes.DANGER,
    disabled: (message === null || message === void 0 ? void 0 : (_message$threadInfo = message.threadInfo) === null || _message$threadInfo === void 0 ? void 0 : _message$threadInfo.replyCount) > 0,
    onCancel: onCancel,
    onSubmit: () => {
      deleteMessage(message).then(() => {
        onSubmit();
        onCancel();
      });
    },
    submitText: stringSet.MESSAGE_MENU__DELETE,
    titleText: stringSet.MODAL__DELETE_MESSAGE__TITLE
  });
};

module.exports = RemoveMessage;
//# sourceMappingURL=RemoveMessageModal.js.map
