import { _ as __assign, a as __awaiter, b as __generator } from '../../chunks/bundle-yl5d1NoZ.js';
import React__default from 'react';
import { u as useGroupChannel } from '../../chunks/bundle-CmmJVpwV.js';
import { F as FileViewerView } from '../../chunks/bundle-c7SN5XJA.js';
import { u as useSendbird } from '../../chunks/bundle-i_3w58Zd.js';
import '@sendbird/chat/message';
import '@sendbird/chat/groupChannel';
import '@sendbird/uikit-tools';
import '../../chunks/bundle-B0s_McF0.js';
import '../../chunks/bundle-D1nuDKhb.js';
import '../../chunks/bundle-BUYU9H94.js';
import '../../chunks/bundle-CqLLOVG5.js';
import '../../chunks/bundle-CzwYTfhQ.js';
import '../../chunks/bundle-BEx1sWnS.js';
import '../../chunks/bundle-BSy5MmTl.js';
import '../../chunks/bundle-DK3-aB7E.js';
import '../../chunks/bundle-BOykFtQ3.js';
import '../../chunks/bundle-BmoSvBYM.js';
import '../../chunks/bundle-MlG9piGf.js';
import '@sendbird/chat';
import '../../chunks/bundle-DEuCwnTn.js';
import 'react-dom';
import '../../chunks/bundle-CAEBoiEz.js';
import '../../ui/ImageRenderer.js';
import '../../chunks/bundle-Dl_v8XoN.js';
import '../../ui/Icon.js';
import '../../chunks/bundle-viBng0Kh.js';
import '../../chunks/bundle-C1dqPUnT.js';
import '../../chunks/bundle-vmZ9LoYK.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-DgosLQK9.js';
import '../../chunks/bundle-fdEQfX2s.js';
import '../../hooks/useModal.js';
import '../../chunks/bundle-CtQtfJlT.js';
import '../../chunks/bundle-Del33VzI.js';
import '../../chunks/bundle-BZGITC2g.js';
import '../../chunks/bundle-DBhJIxHw.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../chunks/bundle-DGh2T5IL.js';
import '@sendbird/chat/openChannel';

var FileViewer = function (props) {
    var _a = useGroupChannel(), onBeforeDownloadFileMessage = _a.state.onBeforeDownloadFileMessage, deleteMessage = _a.actions.deleteMessage;
    var logger = useSendbird().state.config.logger;
    return (React__default.createElement(FileViewerView, __assign({}, props, { deleteMessage: deleteMessage, onDownloadClick: function (e) { return __awaiter(void 0, void 0, void 0, function () {
            var allowDownload, err_1;
            var _a, _b;
            return __generator(this, function (_c) {
                switch (_c.label) {
                    case 0:
                        if (!onBeforeDownloadFileMessage)
                            return [2 /*return*/];
                        _c.label = 1;
                    case 1:
                        _c.trys.push([1, 3, , 4]);
                        return [4 /*yield*/, onBeforeDownloadFileMessage({ message: props.message })];
                    case 2:
                        allowDownload = _c.sent();
                        if (!allowDownload) {
                            e.preventDefault();
                            (_a = logger.info) === null || _a === void 0 ? void 0 : _a.call(logger, 'FileViewer: Not allowed to download.');
                        }
                        return [3 /*break*/, 4];
                    case 3:
                        err_1 = _c.sent();
                        (_b = logger.error) === null || _b === void 0 ? void 0 : _b.call(logger, 'FileViewer: Error occurred while determining download continuation:', err_1);
                        return [3 /*break*/, 4];
                    case 4: return [2 /*return*/];
                }
            });
        }); } })));
};

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