import React__default, { useContext } from 'react';
import { g as getChannelTitle } from '../../utils-f1b4b34b.js';
import { L as Label, a as LabelTypography, b as LabelColors } from '../../index-f50d7ab0.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-1701e5c8.js';
import useSendbirdStateContext from '../../useSendbirdStateContext.js';
import { u as useChannelContext } from '../../ChannelProvider-1dc36682.js';
import { u as useMediaQueryContext } from '../../MediaQueryContext-e5b401d0.js';
import { n as noop } from '../../utils-05aa9060.js';
import 'prop-types';
import '../../stringSet-e9bb0333.js';
import '../../_rollupPluginBabelHelpers-cc035350.js';
import '../../ui/Avatar.js';
import '../../ui/ImageRenderer.js';
import '../../uuid-8b344dd2.js';
import '../../utils-cd7ab927.js';
import '../../index-ff8f2f61.js';
import '../../withSendbird.js';
import '../../UserProfileContext-74e9a128.js';
import '../../const-7c266a95.js';
import '../../index-5a62f6b7.js';
import '../../topics-0b30f52b.js';
import '../../index-99ab01f6.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../compareIds-367bb030.js';
import '@sendbird/chat/groupChannel';
import '@sendbird/chat/message';
import '../../consts-44eaef6b.js';
import '../../resolvedReplyType-6bb8f548.js';

const ChannelHeader = _ref => {
  var _globalStore$config, _globalStore$config2, _currentGroupChannel$;
  let {
    className = ''
  } = _ref;
  const globalStore = useSendbirdStateContext();
  const userId = globalStore === null || globalStore === void 0 ? void 0 : (_globalStore$config = globalStore.config) === null || _globalStore$config === void 0 ? void 0 : _globalStore$config.userId;
  const theme = globalStore === null || globalStore === void 0 ? void 0 : (_globalStore$config2 = globalStore.config) === null || _globalStore$config2 === void 0 ? void 0 : _globalStore$config2.theme;
  const channelStore = useChannelContext();
  const {
    isMobile
  } = useMediaQueryContext();
  const {
    currentGroupChannel,
    showSearchIcon,
    onSearchClick,
    onChatHeaderActionClick,
    onBackClick = noop
  } = channelStore;
  const subTitle = (currentGroupChannel === null || currentGroupChannel === void 0 ? void 0 : currentGroupChannel.members) && (currentGroupChannel === null || currentGroupChannel === void 0 ? void 0 : (_currentGroupChannel$ = currentGroupChannel.members) === null || _currentGroupChannel$ === void 0 ? void 0 : _currentGroupChannel$.length) !== 2;
  const isMuted = (currentGroupChannel === null || currentGroupChannel === void 0 ? void 0 : currentGroupChannel.myMutedState) === 'muted';
  const {
    stringSet
  } = useContext(LocalizationContext);
  return /*#__PURE__*/React__default.createElement("div", {
    className: `sendbird-chat-header ${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 && 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
