'use strict';

var React = require('react');
var ui_Modal = require('../../ui/Modal.js');
var ui_Button = require('../../ui/Button.js');
var LocalizationContext = require('../../LocalizationContext-b42fa07d.js');
var Channel_context = require('../../ChannelProvider-2bfafa25.js');
require('react-dom');
require('../../index-e8b83547.js');
require('../../ui/Icon.js');
require('prop-types');
require('../../ui/IconButton.js');
require('../../_rollupPluginBabelHelpers-3a9d1641.js');
require('../../index-72e412f7.js');
require('../../stringSet-4f30313f.js');
require('../../MediaQueryContext-372b55a6.js');
require('../../index-97005534.js');
require('../../UserProfileContext-c87514d3.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../index-849f44b0.js');
require('../../topics-3226c6ee.js');
require('../../index-0b8a1074.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../compareIds-a7029d6a.js');
require('../../const-68cf2709.js');
require('@sendbird/chat/groupChannel');
require('../../uuid-5ab4f88b.js');
require('@sendbird/chat/message');
require('../../consts-f71467c8.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
