'use strict';

var React = require('react');
var LocalizationContext = require('../../LocalizationContext-b42fa07d.js');
var ui_MessageInput = require('../../ui/MessageInput.js');
var OpenChannel_context = require('../../OpenChannelProvider-94eb45b4.js');
require('../../stringSet-4f30313f.js');
require('../../index-97005534.js');
require('../../_rollupPluginBabelHelpers-3a9d1641.js');
require('prop-types');
require('../../const-3ab3e45c.js');
require('../../const-68cf2709.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../index-72e412f7.js');
require('dompurify');
require('../../consts-bb2a67c7.js');
require('../../ui/Icon.js');
require('../../index-0b8a1074.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../consts-ad8ba629.js');
require('../../consts-26d4668c.js');
require('../../tokenize-e944d548.js');
require('../../index-849f44b0.js');
require('../../UserProfileContext-c87514d3.js');
require('../../compareIds-a7029d6a.js');
require('../../topics-3226c6ee.js');
require('@sendbird/chat');
require('@sendbird/chat/openChannel');
require('../../uuid-5ab4f88b.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.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, {
    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
