'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var React = require('react');
var ui_IconButton = require('../../ui/IconButton.js');
var ui_Icon = require('../../ui/Icon.js');
var CreateChannel = require('../../CreateChannel.js');
var useSendbirdStateContext = require('../../useSendbirdStateContext.js');
var ChannelList_context = require('../../ChannelListProvider-84fdbeba.js');
require('../../_rollupPluginBabelHelpers-acf412a3.js');
require('prop-types');
require('../../CreateChannel/components/CreateChannelUI.js');
require('../../CreateChannelProvider-36e598db.js');
require('../../sendbirdSelectors.js');
require('../../topics-e24ef339.js');
require('../../utils-5aa0708e.js');
require('../../CreateChannel/components/InviteUsers.js');
require('../../LocalizationContext-8cc9717d.js');
require('../../stringSet-ce782136.js');
require('../../index-d749c4c2.js');
require('../../ui/Modal.js');
require('react-dom');
require('../../index-8029e07a.js');
require('../../ui/Button.js');
require('../../index-35633fb6.js');
require('../../MediaQueryContext-fad211ad.js');
require('../../ui/UserListItem.js');
require('../../UserProfileContext-d993c96b.js');
require('../../ui/Avatar.js');
require('../../ui/ImageRenderer.js');
require('../../uuid-1eceb0c8.js');
require('../../ui/MutedAvatarOverlay.js');
require('../../ui/Checkbox.js');
require('../../ui/UserProfile.js');
require('../../ui/ContextMenu.js');
require('../../ui/SortByRow.js');
require('../../index-a91b85d9.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../CreateChannel/components/SelectChannelType.js');
require('../../withSendbird.js');
require('@sendbird/chat/groupChannel');

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

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

const AddChannel = () => {
  var _state$config;
  const [showModal, setShowModal] = React.useState(false);
  const state = useSendbirdStateContext();
  const isOnline = state === null || state === void 0 ? void 0 : (_state$config = state.config) === null || _state$config === void 0 ? void 0 : _state$config.isOnline;
  const disabled = !isOnline;
  const {
    overrideInviteUser,
    onBeforeCreateChannel
  } = ChannelList_context.useChannelListContext();
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(ui_IconButton, {
    height: "32px",
    width: "32px",
    onClick: () => {
      setShowModal(true);
    },
    disabled: disabled
  }, /*#__PURE__*/React__default["default"].createElement(ui_Icon["default"], {
    type: ui_Icon.IconTypes.CREATE,
    fillColor: ui_Icon.IconColors.PRIMARY,
    width: "24px",
    height: "24px"
  })), showModal && /*#__PURE__*/React__default["default"].createElement(CreateChannel, {
    onCancel: () => {
      setShowModal(false);
    },
    overrideInviteUser: overrideInviteUser,
    onCreateChannel: () => {
      setShowModal(false);
    },
    onBeforeCreateChannel: onBeforeCreateChannel
  }));
};

exports.AddChannel = AddChannel;
exports["default"] = AddChannel;
//# sourceMappingURL=AddChannel.js.map
