'use strict';

var React = require('react');
var LocalizationContext = require('../../LocalizationContext-9eda9144.js');
var ui_MessageInput = require('../../ui/MessageInput.js');
var OpenChannel_context = require('../../OpenChannelProvider-b1e1151c.js');
require('../../stringSet-85aa5de9.js');
require('../../index-3a0cfa58.js');
require('../../_rollupPluginBabelHelpers-09eba4f3.js');
require('prop-types');
require('../../const-696b9e9c.js');
require('../../const-85f621b6.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../index-4efb56bf.js');
require('dompurify');
require('../../consts-049a4487.js');
require('../../ui/Icon.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../index-cf37de8c.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../consts-a9db3fc2.js');
require('../../consts-47c8eee1.js');
require('../../tokenize-398af65e.js');
require('../../index.module-b62197d5.js');
require('../../index-0ffaa79b.js');
require('../../UserProfileContext-3a37e911.js');
require('../../compareIds-c82fb274.js');
require('../../topics-b3f004b2.js');
require('@sendbird/chat');
require('@sendbird/chat/openChannel');
require('../../uuid-f2b80298.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
