'use strict';

var React = require('react');
var ui_Modal = require('../../ui/Modal.js');
var ui_Button = require('../../ui/Button.js');
var LocalizationContext = require('../../LocalizationContext-6adf6aa8.js');
var Channel_context = require('../../ChannelProvider-5e48d37b.js');
require('react-dom');
require('../../index-f84d188a.js');
require('../../ui/Icon.js');
require('prop-types');
require('../../ui/IconButton.js');
require('../../_rollupPluginBabelHelpers-ea66c137.js');
require('../../index-bff918b2.js');
require('../../stringSet-5157206d.js');
require('../../MediaQueryContext-1dd78ce3.js');
require('../../index-6a7f94de.js');
require('../../UserProfileContext-2ff8462c.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../const-f6c8086e.js');
require('../../index-358554d2.js');
require('../../topics-2fe6fef6.js');
require('../../index-86e680cb.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../compareIds-7b0e4960.js');
require('@sendbird/chat/groupChannel');
require('../../uuid-f1d9be11.js');
require('@sendbird/chat/message');
require('../../consts-a6f34df8.js');
require('../../resolvedReplyType-fb851d3a.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
