import { _ as __assign, b as __awaiter, c as __generator } from '../../chunks/bundle-B8Grfnrx.js';
import React__default from 'react';
import { u as useGroupChannel } from '../../chunks/bundle-D4BlmM5H.js';
import { F as FileViewerView } from '../../chunks/bundle-BGj68IUE.js';
import { u as useSendbird } from '../../chunks/bundle-I25ah_Bv.js';
import '@sendbird/chat/message';
import '@sendbird/chat/groupChannel';
import '@sendbird/uikit-tools';
import '../../chunks/bundle-BYqblmEM.js';
import '../../chunks/bundle-Dx4-1s0A.js';
import '../../chunks/bundle-C4OmfIXk.js';
import '../../chunks/bundle-Ob7Cw3V-.js';
import '../../chunks/bundle-D8xAej93.js';
import '../../chunks/bundle-BciLDE6M.js';
import '../../chunks/bundle-C6Hk5xTT.js';
import '../../chunks/bundle-B5_aP8LE.js';
import '../../chunks/bundle--1cImOGd.js';
import '../../chunks/bundle-C5Pz6wMm.js';
import '../../chunks/bundle-De-3zaYV.js';
import '../../chunks/bundle-CDcu1I4f.js';
import 'react-dom';
import '../../chunks/bundle-DgFzcADJ.js';
import '../../ui/ImageRenderer.js';
import '../../chunks/bundle-C_ngoQD_.js';
import '../../ui/Icon.js';
import '../../chunks/bundle-HspRRkmy.js';
import '../../chunks/bundle-Y2KBbxRr.js';
import '../../chunks/bundle-CgLhYjm5.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-BTxw_tIt.js';
import '../../chunks/bundle-DYBTopZK.js';
import '../../hooks/useModal.js';
import '../../chunks/bundle-LnGQMQVt.js';
import '../../chunks/bundle-l_QLKq1Y.js';
import '../../chunks/bundle-BYOddwmS.js';
import '../../chunks/bundle-yKqHFFfz.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../chunks/bundle-CTkGIdt8.js';
import '@sendbird/chat';
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
