'use strict';

var React = require('react');
var LocalizationContext = require('../../LocalizationContext-44d2f61b.js');
var ui_MessageInput = require('../../ui/MessageInput.js');
var OpenChannel_context = require('../../OpenChannelProvider-ecae68c8.js');
require('../../stringSet-7aebf034.js');
require('../../index-88e8fdfa.js');
require('../../_rollupPluginBabelHelpers-21ae158b.js');
require('prop-types');
require('../../const-bd02657f.js');
require('../../const-1ea78727.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../index-2bfd366f.js');
require('dompurify');
require('../../consts-867f1ae6.js');
require('../../ui/Icon.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../index-1b3c69da.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../consts-b93ef9ea.js');
require('../../consts-bce71b24.js');
require('../../tokenize-44139f1e.js');
require('../../index.module-5a6a79b6.js');
require('../../index-892b4b7f.js');
require('../../UserProfileContext-9d843d68.js');
require('../../compareIds-a846891d.js');
require('../../topics-373d2156.js');
require('@sendbird/chat');
require('@sendbird/chat/openChannel');
require('../../uuid-dee74248.js');

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

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

const MessageInputWrapper = (props, ref) => {
  const {
    currentOpenChannel,
    disabled,
    handleSendMessage,
    handleFileUpload,
    amIMuted
  } = OpenChannel_context.useOpenChannelContext();
  const channel = currentOpenChannel;
  const {
    stringSet
  } = React.useContext(LocalizationContext.LocalizationContext);
  const {
    value
  } = props;
  function getPlaceHolderString() {
    if (amIMuted) {
      return stringSet.MESSAGE_INPUT__PLACE_HOLDER__MUTED;
    }
    if (disabled) {
      return stringSet.MESSAGE_INPUT__PLACE_HOLDER__DISABLED;
    }
    return '';
  }
  if (!channel) {
    return null;
  }
  return /*#__PURE__*/React__default["default"].createElement("div", {
    className: "sendbird-openchannel-footer"
  }, /*#__PURE__*/React__default["default"].createElement(ui_MessageInput, {
    channel: currentOpenChannel,
    ref: ref,
    value: value,
    disabled: disabled,
    isVoiceMessageEnabled: false,
    onSendMessage: handleSendMessage,
    onFileUpload: handleFileUpload,
    placeholder: getPlaceHolderString()
  }));
};
var OpenChannelInput = /*#__PURE__*/React__default["default"].forwardRef(MessageInputWrapper);

module.exports = OpenChannelInput;
//# sourceMappingURL=OpenChannelInput.js.map
