'use strict';

var React = require('react');
var ui_Modal = require('../../ui/Modal.js');
var ui_Button = require('../../ui/Button.js');
var LocalizationContext = require('../../LocalizationContext-8cc9717d.js');
var Channel_context = require('../../ChannelProvider-39d1e9a4.js');
require('react-dom');
require('../../index-8029e07a.js');
require('../../ui/Icon.js');
require('prop-types');
require('../../ui/IconButton.js');
require('../../_rollupPluginBabelHelpers-acf412a3.js');
require('../../index-35633fb6.js');
require('../../stringSet-ce782136.js');
require('../../MediaQueryContext-fad211ad.js');
require('../../index-d749c4c2.js');
require('../../UserProfileContext-d993c96b.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../const-a3e169f4.js');
require('../../index-3fc4f7d7.js');
require('../../topics-e24ef339.js');
require('../../index-a91b85d9.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../compareIds-784d9a4e.js');
require('@sendbird/chat/groupChannel');
require('../../uuid-1eceb0c8.js');
require('@sendbird/chat/message');
require('../../consts-9641990e.js');
require('../../resolvedReplyType-930f5b54.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
