'use strict';

var React = require('react');
var ui_Modal = require('../../ui/Modal.js');
var ui_Button = require('../../ui/Button.js');
var LocalizationContext = require('../../LocalizationContext-1f669b3c.js');
var Channel_context = require('../../ChannelProvider-b1290e55.js');
require('react-dom');
require('../../index-577c9a9b.js');
require('../../ui/Icon.js');
require('prop-types');
require('../../ui/IconButton.js');
require('../../tslib.es6-d2ba1a6b.js');
require('../../index-1b11bb85.js');
require('../../stringSet-ddd351f0.js');
require('../../MediaQueryContext-130143d7.js');
require('../../index-f5502150.js');
require('../../UserProfileContext-cde95db8.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../_rollupPluginBabelHelpers-32557b21.js');
require('../../index-81e19961.js');
require('../../topics-5edbb1b2.js');
require('../../index-b32fce67.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../compareIds-32f97a73.js');
require('../../const-77194948.js');
require('@sendbird/chat/groupChannel');
require('../../uuid-28e4a814.js');
require('@sendbird/chat/message');
require('../../ui/ContextMenu.js');
require('../../ui/SortByRow.js');
require('../../ui/ReactionButton.js');
require('../../ui/ImageRenderer.js');
require('../../consts-f82aaae9.js');

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

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

var RemoveMessage = function (props) {
  var _a;

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

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