'use strict';

var React = require('react');
var LocalizationContext = require('../../chunks/bundle-DPDyqKIJ.js');
var ChannelList_context = require('../../chunks/bundle-DX8YvrpL.js');
var ui_MessageStatus = require('../../chunks/bundle-DO5FgbkI.js');
var GroupChannelListItemView = require('../../chunks/bundle-CYACBqrn.js');
var useSendbird = require('../../chunks/bundle-Bq15P9qk.js');
require('../../chunks/bundle-Conb-pOy.js');
require('../../chunks/bundle-BbrBawlX.js');
require('../../chunks/bundle-Cyl6_qLo.js');
require('@sendbird/chat/groupChannel');
require('../../chunks/bundle-dUH189qO.js');
require('../../chunks/bundle-t8BQsgL5.js');
require('../../chunks/bundle-CkQrhwR6.js');
require('../../chunks/bundle-Cfh78Xnm.js');
require('../../chunks/bundle-Bnb8seJF.js');
require('../../chunks/bundle-Dobj18FB.js');
require('../../chunks/bundle-fYxs1lss.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../chunks/bundle-DAdgL6r8.js');
require('../../chunks/bundle-CVJwHwWn.js');
require('../../chunks/bundle-C8INNeGk.js');
require('../../chunks/bundle-CHAKEXIJ.js');
require('../../ui/Icon.js');
require('../../chunks/bundle-zgmRG2KL.js');
require('../../ui/Loader.js');
require('../../chunks/bundle-ptQgj0WJ.js');
require('../../chunks/bundle-DQaXgp8o.js');
require('../../chunks/bundle-C5p82xwC.js');
require('../../chunks/bundle-Fv6PNPGZ.js');
require('../../GroupChannel/components/TypingIndicator.js');
require('../../ui/Badge.js');
require('../../ui/ChannelAvatar.js');
require('../../chunks/bundle-B7KG10z2.js');
require('../../ui/ImageRenderer.js');
require('../../chunks/bundle-C99t7tzf.js');
require('../../chunks/bundle-Bvjprr6O.js');
require('../../ui/MentionUserLabel.js');
require('../../chunks/bundle-DHuNGmIj.js');
require('../../chunks/bundle-DZlJeh0V.js');
require('react-dom');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../ui/TextButton.js');
require('../../chunks/bundle-DurllD3r.js');
require('../../chunks/bundle-CzkEKbFB.js');
require('../../chunks/bundle-B19RHFpR.js');
require('@sendbird/chat');
require('@sendbird/chat/openChannel');

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

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

/**
 * @deprecated This component is deprecated and will be removed in the next major update.
 * Please use the `GroupChannel` component from '@sendbird/uikit-react/GroupChannel' instead.
 * For more information, please refer to the migration guide:
 * https://docs.sendbird.com/docs/chat/uikit/v3/react/introduction/group-channel-migration-guide
 */
var ChannelPreview = function (_a) {
    var _b, _c, _d, _e;
    var channel = _a.channel, _f = _a.isActive, isActive = _f === void 0 ? false : _f, _g = _a.isSelected, isSelected = _g === void 0 ? false : _g, _h = _a.isTyping, isTyping = _h === void 0 ? false : _h, renderChannelAction = _a.renderChannelAction, onLeaveChannel = _a.onLeaveChannel, onClick = _a.onClick, tabIndex = _a.tabIndex;
    var state = useSendbird.useSendbird().state;
    var config = state.config;
    var stringSet = LocalizationContext.useLocalization().stringSet;
    var _j = ChannelList_context.useChannelListContext(), _k = _j.isTypingIndicatorEnabled, isTypingIndicatorEnabled = _k === void 0 ? false : _k, _l = _j.isMessageReceiptStatusEnabled, isMessageReceiptStatusEnabled = _l === void 0 ? false : _l;
    var userId = config.userId;
    var isMessageStatusEnabled = isMessageReceiptStatusEnabled
        && (((_b = channel === null || channel === void 0 ? void 0 : channel.lastMessage) === null || _b === void 0 ? void 0 : _b.messageType) === 'user' || ((_c = channel === null || channel === void 0 ? void 0 : channel.lastMessage) === null || _c === void 0 ? void 0 : _c.messageType) === 'file')
        && ((_e = (_d = channel === null || channel === void 0 ? void 0 : channel.lastMessage) === null || _d === void 0 ? void 0 : _d.sender) === null || _e === void 0 ? void 0 : _e.userId) === userId;
    return (React__default.default.createElement(GroupChannelListItemView.GroupChannelListItemView, { channel: channel, tabIndex: tabIndex, isTyping: isTypingIndicatorEnabled && isTyping, isSelected: isSelected !== null && isSelected !== void 0 ? isSelected : isActive, channelName: ui_MessageStatus.getChannelTitle(channel, userId, stringSet), isMessageStatusEnabled: isMessageStatusEnabled, onClick: onClick, onLeaveChannel: onLeaveChannel, renderChannelAction: renderChannelAction }));
};

module.exports = ChannelPreview;
//# sourceMappingURL=ChannelPreview.js.map
