import React__default, { useContext } from 'react';
import { g as getChannelTitle } from '../../utils-b10ed497.js';
import { L as Label, a as LabelTypography, b as LabelColors } from '../../index-e121c395.js';
import Icon, { IconColors, IconTypes } from '../../ui/Icon.js';
import IconButton from '../../ui/IconButton.js';
import ChannelAvatar from '../../ui/ChannelAvatar.js';
import { a as LocalizationContext } from '../../LocalizationContext-8725e9b2.js';
import useSendbirdStateContext from '../../useSendbirdStateContext.js';
import { u as useChannelContext } from '../../ChannelProvider-c1c00018.js';
import { u as useMediaQueryContext } from '../../MediaQueryContext-ceb727c7.js';
import { n as noop } from '../../utils-b439eac3.js';
import 'prop-types';
import '../../stringSet-a513039b.js';
import '../../tslib.es6-e1c2b6be.js';
import '../../ui/Avatar.js';
import '../../ui/ImageRenderer.js';
import '../../uuid-d072af26.js';
import '../../utils-5cc87999.js';
import '../../index-c10fcd31.js';
import '../../withSendbird.js';
import '../../_rollupPluginBabelHelpers-945410b2.js';
import '../../UserProfileContext-cc71f901.js';
import '../../index-99933718.js';
import '../../topics-a581acbb.js';
import '../../index-43834bc0.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../compareIds-87972c5f.js';
import '../../const-85535a89.js';
import '@sendbird/chat/groupChannel';
import '@sendbird/chat/message';
import '../../ui/ContextMenu.js';
import 'react-dom';
import '../../ui/SortByRow.js';
import '../../ui/ReactionButton.js';
import '../../consts-59f719d8.js';

var ChannelHeader = function (_a) {
  var _b, _c, _d;

  var _e = _a.className,
      className = _e === void 0 ? '' : _e;
  var globalStore = useSendbirdStateContext();
  var userId = (_b = globalStore === null || globalStore === void 0 ? void 0 : globalStore.config) === null || _b === void 0 ? void 0 : _b.userId;
  var theme = (_c = globalStore === null || globalStore === void 0 ? void 0 : globalStore.config) === null || _c === void 0 ? void 0 : _c.theme;
  var channelStore = useChannelContext();
  var isMobile = useMediaQueryContext().isMobile;
  var currentGroupChannel = channelStore.currentGroupChannel,
      showSearchIcon = channelStore.showSearchIcon,
      onSearchClick = channelStore.onSearchClick,
      onChatHeaderActionClick = channelStore.onChatHeaderActionClick,
      _f = channelStore.onBackClick,
      onBackClick = _f === void 0 ? noop : _f;
  var subTitle = (currentGroupChannel === null || currentGroupChannel === void 0 ? void 0 : currentGroupChannel.members) && ((_d = currentGroupChannel === null || currentGroupChannel === void 0 ? void 0 : currentGroupChannel.members) === null || _d === void 0 ? void 0 : _d.length) !== 2;
  var isMuted = (currentGroupChannel === null || currentGroupChannel === void 0 ? void 0 : currentGroupChannel.myMutedState) === "muted";
  var stringSet = useContext(LocalizationContext).stringSet;
  return /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-chat-header ".concat(className)
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-chat-header__left"
  }, isMobile && /*#__PURE__*/React__default.createElement(Icon, {
    className: "sendbird-chat-header__icon_back",
    onClick: onBackClick,
    fillColor: IconColors.PRIMARY,
    width: "24px",
    height: "24px",
    type: IconTypes.ARROW_LEFT
  }), /*#__PURE__*/React__default.createElement(ChannelAvatar, {
    theme: theme,
    channel: currentGroupChannel,
    userId: userId,
    height: 32,
    width: 32
  }), /*#__PURE__*/React__default.createElement(Label, {
    className: "sendbird-chat-header__left__title",
    type: LabelTypography.H_2,
    color: LabelColors.ONBACKGROUND_1
  }, getChannelTitle(currentGroupChannel, userId, stringSet)), /*#__PURE__*/React__default.createElement(Label, {
    className: "sendbird-chat-header__left__subtitle",
    type: LabelTypography.BODY_1,
    color: LabelColors.ONBACKGROUND_2
  }, subTitle)), /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-chat-header__right"
  }, (typeof isMuted === 'string' && isMuted === 'true' || typeof isMuted === 'boolean' && isMuted) && /*#__PURE__*/React__default.createElement(Icon, {
    className: "sendbird-chat-header__right__mute",
    type: IconTypes.NOTIFICATIONS_OFF_FILLED,
    fillColor: IconColors.ON_BACKGROUND_2,
    width: "24px",
    height: "24px"
  }), showSearchIcon && !(currentGroupChannel === null || currentGroupChannel === void 0 ? void 0 : currentGroupChannel.isEphemeral) && /*#__PURE__*/React__default.createElement(IconButton, {
    className: "sendbird-chat-header__right__search",
    width: "32px",
    height: "32px",
    onClick: onSearchClick
  }, /*#__PURE__*/React__default.createElement(Icon, {
    type: IconTypes.SEARCH,
    fillColor: IconColors.PRIMARY,
    width: "24px",
    height: "24px"
  })), /*#__PURE__*/React__default.createElement(IconButton, {
    className: "sendbird-chat-header__right__info",
    width: "32px",
    height: "32px",
    onClick: onChatHeaderActionClick
  }, /*#__PURE__*/React__default.createElement(Icon, {
    type: IconTypes.INFO,
    fillColor: IconColors.PRIMARY,
    width: "24px",
    height: "24px"
  }))));
};

export { ChannelHeader as default };
//# sourceMappingURL=ChannelHeader.js.map
