function _array_like_to_array(arr, len) {
    if (len == null || len > arr.length) len = arr.length;
    for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
    return arr2;
}
function _array_with_holes(arr) {
    if (Array.isArray(arr)) return arr;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
    try {
        var info = gen[key](arg);
        var value = info.value;
    } catch (error) {
        reject(error);
        return;
    }
    if (info.done) {
        resolve(value);
    } else {
        Promise.resolve(value).then(_next, _throw);
    }
}
function _async_to_generator(fn) {
    return function() {
        var self = this, args = arguments;
        return new Promise(function(resolve, reject) {
            var gen = fn.apply(self, args);
            function _next(value) {
                asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
            }
            function _throw(err) {
                asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
            }
            _next(undefined);
        });
    };
}
function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _iterable_to_array_limit(arr, i) {
    var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
    if (_i == null) return;
    var _arr = [];
    var _n = true;
    var _d = false;
    var _s, _e;
    try {
        for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
            _arr.push(_s.value);
            if (i && _arr.length === i) break;
        }
    } catch (err) {
        _d = true;
        _e = err;
    } finally{
        try {
            if (!_n && _i["return"] != null) _i["return"]();
        } finally{
            if (_d) throw _e;
        }
    }
    return _arr;
}
function _non_iterable_rest() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _object_spread(target) {
    for(var i = 1; i < arguments.length; i++){
        var source = arguments[i] != null ? arguments[i] : {};
        var ownKeys = Object.keys(source);
        if (typeof Object.getOwnPropertySymbols === "function") {
            ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
                return Object.getOwnPropertyDescriptor(source, sym).enumerable;
            }));
        }
        ownKeys.forEach(function(key) {
            _define_property(target, key, source[key]);
        });
    }
    return target;
}
function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);
    if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);
        if (enumerableOnly) {
            symbols = symbols.filter(function(sym) {
                return Object.getOwnPropertyDescriptor(object, sym).enumerable;
            });
        }
        keys.push.apply(keys, symbols);
    }
    return keys;
}
function _object_spread_props(target, source) {
    source = source != null ? source : {};
    if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
        ownKeys(Object(source)).forEach(function(key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
    }
    return target;
}
function _sliced_to_array(arr, i) {
    return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
}
function _type_of(obj) {
    "@swc/helpers - typeof";
    return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
}
function _unsupported_iterable_to_array(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _array_like_to_array(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(n);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
}
function _ts_generator(thisArg, body) {
    var f, y, t, _ = {
        label: 0,
        sent: function() {
            if (t[0] & 1) throw t[1];
            return t[1];
        },
        trys: [],
        ops: []
    }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
    return d(g, "next", {
        value: verb(0)
    }), d(g, "throw", {
        value: verb(1)
    }), d(g, "return", {
        value: verb(2)
    }), typeof Symbol === "function" && d(g, Symbol.iterator, {
        value: function() {
            return this;
        }
    }), g;
    function verb(n) {
        return function(v) {
            return step([
                n,
                v
            ]);
        };
    }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while(g && (g = 0, op[0] && (_ = 0)), _)try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [
                op[0] & 2,
                t.value
            ];
            switch(op[0]){
                case 0:
                case 1:
                    t = op;
                    break;
                case 4:
                    _.label++;
                    return {
                        value: op[1],
                        done: false
                    };
                case 5:
                    _.label++;
                    y = op[1];
                    op = [
                        0
                    ];
                    continue;
                case 7:
                    op = _.ops.pop();
                    _.trys.pop();
                    continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
                        _ = 0;
                        continue;
                    }
                    if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
                        _.label = op[1];
                        break;
                    }
                    if (op[0] === 6 && _.label < t[1]) {
                        _.label = t[1];
                        t = op;
                        break;
                    }
                    if (t && _.label < t[2]) {
                        _.label = t[2];
                        _.ops.push(op);
                        break;
                    }
                    if (t[2]) _.ops.pop();
                    _.trys.pop();
                    continue;
            }
            op = body.call(thisArg, _);
        } catch (e) {
            op = [
                6,
                e
            ];
            y = 0;
        } finally{
            f = t = 0;
        }
        if (op[0] & 5) throw op[1];
        return {
            value: op[0] ? op[1] : void 0,
            done: true
        };
    }
}
import { ConfigProvider, Empty, Image, Spin, Typography } from "antd";
import classNames from "clsx";
import React, { useContext, useEffect, useRef, useState } from "react";
import { useRefFunction } from "../../Hooks/useRefFunction";
import { I18nContext, compileTemplate } from "../../I18n";
import { FileGroup, GROUP_INITIAL_PAGE_SIZE, GROUP_PAGE_SIZE_INCREMENT } from "./components/FileGroup";
import { FileItem } from "./components/FileItem";
import { SearchInput } from "./components/SearchInput";
import { isImageFile } from "./FileTypeProcessor";
import { getPreviewSource, handleDefaultShare, handleFileDownload } from "./handlers";
import { PreviewComponent } from "./PreviewComponent";
import { useFileStyle } from "./style";
import { generateUniqueId } from "./utils";
/**
 * 检查 onPreview 返回值是否是 FileNode（最小可信判定：是非 ReactElement 的对象 + 含 `name` 字符串字段）
 */ var isFileNodeReturn = function isFileNodeReturn(value) {
    if (!value || (typeof value === "undefined" ? "undefined" : _type_of(value)) !== 'object') return false;
    if (/*#__PURE__*/ React.isValidElement(value)) return false;
    return typeof value.name === 'string';
};
/**
 * 文件主组件：列表 / 分组 / 搜索 / 预览路由 + 渐进展示 + actionRef
 */ export var FileComponent = function FileComponent(param) {
    var nodes = param.nodes, onGroupDownload = param.onGroupDownload, onDownload = param.onDownload, onShare = param.onShare, onFileClick = param.onFileClick, onLocate = param.onLocate, onToggleGroup = param.onToggleGroup, onGroupToggle = param.onGroupToggle, onPreview = param.onPreview, onBack = param.onBack, resetKey = param.resetKey, markdownEditorProps = param.markdownEditorProps, customActions = param.customActions, actionRef = param.actionRef, loading = param.loading, loadingRender = param.loadingRender, emptyRender = param.emptyRender, keyword = param.keyword, onChange = param.onChange, _param_showSearch = param.showSearch, showSearch = _param_showSearch === void 0 ? false : _param_showSearch, searchPlaceholder = param.searchPlaceholder, _param_bindDomId = param.bindDomId, bindDomId = _param_bindDomId === void 0 ? false : _param_bindDomId;
    var _useState = _sliced_to_array(useState(null), 2), previewFile = _useState[0], setPreviewFile = _useState[1];
    var _useState1 = _sliced_to_array(useState(null), 2), customPreviewContent = _useState1[0], setCustomPreviewContent = _useState1[1];
    var _useState2 = _sliced_to_array(useState(null), 2), customPreviewHeader = _useState2[0], setCustomPreviewHeader = _useState2[1];
    var _useState3 = _sliced_to_array(useState(null), 2), headerFileOverride = _useState3[0], setHeaderFileOverride = _useState3[1];
    var _useState4 = _sliced_to_array(useState({
        visible: false,
        src: ''
    }), 2), imagePreview = _useState4[0], setImagePreview = _useState4[1];
    var _useState5 = _sliced_to_array(useState({}), 2), collapsedGroups = _useState5[0], setCollapsedGroups = _useState5[1];
    var _useState6 = _sliced_to_array(useState(GROUP_INITIAL_PAGE_SIZE), 2), flatVisibleCount = _useState6[0], setFlatVisibleCount = _useState6[1];
    // nodes / keyword 变化时重置扁平列表分页
    useEffect(function() {
        setFlatVisibleCount(GROUP_INITIAL_PAGE_SIZE);
    }, [
        nodes,
        keyword
    ]);
    // 异步预览请求序号，避免竞态
    var previewRequestIdRef = useRef(0);
    // 节点 ID 缓存：WeakMap 自动回收，避免每次渲染重生成
    var nodeIdCacheRef = useRef(new WeakMap());
    var safeNodes = nodes || [];
    var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
    var locale = useContext(I18nContext).locale;
    var prefixCls = getPrefixCls('workspace-file');
    var _useFileStyle = useFileStyle(prefixCls), wrapSSR = _useFileStyle.wrapSSR, hashId = _useFileStyle.hashId;
    // 注入稳定 ID（基于 WeakMap 缓存）
    var ensureNodeWithStableId = useRefFunction(function(node) {
        if (node.id) return _object_spread({}, node);
        var cachedId = nodeIdCacheRef.current.get(node);
        if (!cachedId) {
            cachedId = generateUniqueId(node);
            nodeIdCacheRef.current.set(node, cachedId);
        }
        return _object_spread_props(_object_spread({}, node), {
            id: cachedId
        });
    });
    // 返回列表（供预览页/外部调用）
    var handleBackToList = useRefFunction(function() {
        previewRequestIdRef.current++;
        setPreviewFile(null);
        setCustomPreviewContent(null);
        setCustomPreviewHeader(null);
        setHeaderFileOverride(null);
    });
    // resetKey 变化 → 重置预览
    useEffect(function() {
        if (resetKey !== undefined && previewFile) {
            handleBackToList();
        }
    // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [
        resetKey,
        previewFile
    ]);
    // nodes 变化 → 同步更新 previewFile（保持预览内容跟随外部数据）
    useEffect(function() {
        if (!previewFile) return;
        var findUpdatedFile = function findUpdatedFile1(nodesList) {
            var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
            try {
                for(var _iterator = nodesList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
                    var node = _step.value;
                    if ('children' in node) {
                        var found = findUpdatedFile(node.children);
                        if (found) return found;
                    } else if (node.id && node.id === previewFile.id || node.name === previewFile.name && node.type === previewFile.type) {
                        return node;
                    }
                }
            } catch (err) {
                _didIteratorError = true;
                _iteratorError = err;
            } finally{
                try {
                    if (!_iteratorNormalCompletion && _iterator.return != null) {
                        _iterator.return();
                    }
                } finally{
                    if (_didIteratorError) {
                        throw _iteratorError;
                    }
                }
            }
            return null;
        };
        var updatedFile = findUpdatedFile(safeNodes);
        if (updatedFile) {
            setPreviewFile(updatedFile);
        }
    // 故意使用 nodes 而非 safeNodes 作为依赖：safeNodes 每次渲染都是新引用
    // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [
        nodes,
        previewFile === null || previewFile === void 0 ? void 0 : previewFile.id,
        previewFile === null || previewFile === void 0 ? void 0 : previewFile.name,
        previewFile === null || previewFile === void 0 ? void 0 : previewFile.type
    ]);
    // 分组折叠/展开
    var handleToggleGroup = useRefFunction(function(groupId, type, collapsed) {
        setCollapsedGroups(function(prev) {
            return _object_spread_props(_object_spread({}, prev), _define_property({}, groupId, collapsed));
        });
        if (onGroupToggle) {
            onGroupToggle(type, collapsed);
        } else if (onToggleGroup) {
            onToggleGroup(type, collapsed);
        }
    });
    // 包装的返回逻辑：支持外部 onBack 拦截（返回 false 阻止）
    var handleBack = useRefFunction(function() {
        return _async_to_generator(function() {
            var result, unused;
            return _ts_generator(this, function(_state) {
                switch(_state.label){
                    case 0:
                        if (!previewFile) return [
                            3,
                            4
                        ];
                        _state.label = 1;
                    case 1:
                        _state.trys.push([
                            1,
                            3,
                            ,
                            4
                        ]);
                        return [
                            4,
                            Promise.resolve(onBack === null || onBack === void 0 ? void 0 : onBack(previewFile))
                        ];
                    case 2:
                        result = _state.sent();
                        if (result === false) return [
                            2
                        ];
                        return [
                            3,
                            4
                        ];
                    case 3:
                        unused = _state.sent();
                        return [
                            3,
                            4
                        ];
                    case 4:
                        handleBackToList();
                        return [
                            2
                        ];
                }
            });
        })();
    });
    // 预览页内的下载
    var handleDownloadInPreview = useRefFunction(function(file) {
        if (onDownload) {
            onDownload(file);
            return;
        }
        handleFileDownload(file);
    });
    // 文件预览处理：支持自定义预览（onPreview 返回 false / ReactNode / FileNode / void）
    var handlePreview = useRefFunction(function(file) {
        return _async_to_generator(function() {
            var currentCallId, previewData, content, unused;
            return _ts_generator(this, function(_state) {
                switch(_state.label){
                    case 0:
                        if (!onPreview) return [
                            3,
                            4
                        ];
                        currentCallId = ++previewRequestIdRef.current;
                        _state.label = 1;
                    case 1:
                        _state.trys.push([
                            1,
                            3,
                            ,
                            4
                        ]);
                        return [
                            4,
                            onPreview(file)
                        ];
                    case 2:
                        previewData = _state.sent();
                        if (previewRequestIdRef.current !== currentCallId) return [
                            2
                        ];
                        // 用户返回 false：阻止内部预览，交由外部处理
                        if (previewData === false) {
                            setCustomPreviewContent(null);
                            setCustomPreviewHeader(null);
                            setPreviewFile(null);
                            return [
                                2
                            ];
                        }
                        if (previewData) {
                            // ReactNode / 字符串 / 数字 / 布尔 → 自定义内容渲染
                            if (/*#__PURE__*/ React.isValidElement(previewData) || typeof previewData === 'string' || typeof previewData === 'number' || typeof previewData === 'boolean') {
                                setPreviewFile(file);
                                content = /*#__PURE__*/ React.isValidElement(previewData) ? /*#__PURE__*/ React.cloneElement(previewData, {
                                    setPreviewHeader: function setPreviewHeader(header) {
                                        return setCustomPreviewHeader(header);
                                    },
                                    back: handleBackToList,
                                    download: function download() {
                                        return handleDownloadInPreview(file);
                                    },
                                    share: function share() {
                                        if (onShare) {
                                            onShare(file, undefined);
                                        } else {
                                            handleDefaultShare(file);
                                        }
                                    }
                                }) : previewData;
                                setCustomPreviewHeader(null);
                                setCustomPreviewContent(content);
                            } else if (isFileNodeReturn(previewData)) {
                                // FileNode → 切换到该文件的默认预览
                                setCustomPreviewContent(null);
                                setCustomPreviewHeader(null);
                                setPreviewFile(previewData);
                            } else {
                                setCustomPreviewContent(null);
                                setCustomPreviewHeader(null);
                                setPreviewFile(file);
                            }
                            return [
                                2
                            ];
                        }
                        // previewData === undefined / null → 走默认预览
                        setCustomPreviewContent(null);
                        setPreviewFile(file);
                        return [
                            2
                        ];
                    case 3:
                        unused = _state.sent();
                        if (previewRequestIdRef.current !== currentCallId) return [
                            2
                        ];
                        setCustomPreviewContent(null);
                        setPreviewFile(file);
                        return [
                            2
                        ];
                    case 4:
                        // 默认内部预览：图片走 antd Image preview，其他走 PreviewComponent
                        if (isImageFile(file)) {
                            setImagePreview({
                                visible: true,
                                src: getPreviewSource(file)
                            });
                            return [
                                2
                            ];
                        }
                        setCustomPreviewContent(null);
                        setPreviewFile(file);
                        return [
                            2
                        ];
                }
            });
        })();
    });
    // 通过 actionRef 暴露可编程接口
    useEffect(function() {
        if (!actionRef) return;
        actionRef.current = {
            openPreview: function openPreview(file) {
                var fileWithId = ensureNodeWithStableId(file);
                void handlePreview(fileWithId);
            },
            backToList: function backToList() {
                return handleBackToList();
            },
            updatePreviewHeader: function updatePreviewHeader(partial) {
                setHeaderFileOverride(function(prev) {
                    return _object_spread({}, prev || {}, partial);
                });
            }
        };
        return function() {
            actionRef.current = null;
        };
    }, [
        actionRef,
        handlePreview,
        handleBackToList
    ]);
    var hasKeyword = Boolean((keyword !== null && keyword !== void 0 ? keyword : '').trim());
    var renderSearchInput = useRefFunction(function() {
        if (!showSearch) return null;
        return /*#__PURE__*/ React.createElement(SearchInput, {
            keyword: keyword,
            onChange: onChange,
            searchPlaceholder: searchPlaceholder,
            prefixCls: prefixCls,
            hashId: hashId,
            locale: locale
        });
    });
    var renderEmptyContent = useRefFunction(function() {
        if (hasKeyword) {
            return /*#__PURE__*/ React.createElement(Typography.Text, {
                type: "secondary"
            }, compileTemplate((locale === null || locale === void 0 ? void 0 : locale['workspace.noResultsFor']) || '未找到与「${keyword}」匹配的结果', {
                keyword: String(keyword)
            }));
        }
        if (typeof emptyRender === 'function') {
            return emptyRender();
        }
        return emptyRender !== null && emptyRender !== void 0 ? emptyRender : /*#__PURE__*/ React.createElement(Empty, {
            description: (locale === null || locale === void 0 ? void 0 : locale['workspace.empty']) || 'No data'
        });
    });
    var handleFlatShowMore = useRefFunction(function() {
        setFlatVisibleCount(function(prev) {
            return prev + GROUP_PAGE_SIZE_INCREMENT;
        });
    });
    var handleFlatShowMoreKeyDown = useRefFunction(function(e) {
        if (e.key === 'Enter' || e.key === ' ') {
            e.preventDefault();
            handleFlatShowMore();
        }
    });
    var renderFileContent = useRefFunction(function() {
        if (safeNodes.length === 0 && !loading) {
            return /*#__PURE__*/ React.createElement("div", {
                className: classNames("".concat(prefixCls, "-empty"), hashId)
            }, renderEmptyContent());
        }
        // 纯扁平列表（无 group）才走分页
        var isFlat = safeNodes.every(function(n) {
            return !('children' in n);
        });
        var nodesToRender = isFlat ? safeNodes.slice(0, flatVisibleCount) : safeNodes;
        var flatRemaining = isFlat ? safeNodes.length - flatVisibleCount : 0;
        var flatHasMore = flatRemaining > 0;
        var items = nodesToRender.map(function(node) {
            var nodeWithId = ensureNodeWithStableId(node);
            if ('children' in nodeWithId) {
                var _collapsedGroups_nodeWithId_id;
                var groupNode = _object_spread_props(_object_spread({}, nodeWithId), {
                    collapsed: (_collapsedGroups_nodeWithId_id = collapsedGroups[nodeWithId.id]) !== null && _collapsedGroups_nodeWithId_id !== void 0 ? _collapsedGroups_nodeWithId_id : nodeWithId.collapsed,
                    children: nodeWithId.children.map(ensureNodeWithStableId)
                });
                return /*#__PURE__*/ React.createElement(FileGroup, {
                    key: nodeWithId.id,
                    group: groupNode,
                    onToggle: handleToggleGroup,
                    onGroupDownload: onGroupDownload,
                    onDownload: onDownload,
                    onFileClick: onFileClick,
                    onPreview: handlePreview,
                    onShare: onShare,
                    onLocate: onLocate,
                    prefixCls: prefixCls,
                    hashId: hashId,
                    locale: locale,
                    bindDomId: bindDomId
                });
            }
            return /*#__PURE__*/ React.createElement(FileItem, {
                key: nodeWithId.id,
                file: nodeWithId,
                onClick: onFileClick,
                onDownload: onDownload,
                onShare: onShare,
                onPreview: handlePreview,
                onLocate: onLocate,
                prefixCls: prefixCls,
                hashId: hashId,
                locale: locale,
                bindDomId: bindDomId
            });
        });
        if (!flatHasMore) return items;
        var flatShowMoreLabel = compileTemplate((locale === null || locale === void 0 ? void 0 : locale['workspace.file.showMore']) || '查看更多（还有 ${count} 个）', {
            count: String(flatRemaining)
        });
        return /*#__PURE__*/ React.createElement(React.Fragment, null, items, /*#__PURE__*/ React.createElement("div", {
            role: "button",
            tabIndex: 0,
            className: classNames("".concat(prefixCls, "-show-more"), hashId),
            onClick: handleFlatShowMore,
            onKeyDown: handleFlatShowMoreKeyDown,
            "aria-label": flatShowMoreLabel
        }, flatShowMoreLabel));
    });
    // 隐藏的 antd Image，用于触发图片预览
    var ImagePreviewComponent = /*#__PURE__*/ React.createElement(Image, {
        className: classNames("".concat(prefixCls, "-hidden-image"), hashId),
        src: imagePreview.src,
        preview: {
            visible: imagePreview.visible,
            onVisibleChange: function onVisibleChange(visible) {
                setImagePreview(function(prev) {
                    return _object_spread_props(_object_spread({}, prev), {
                        visible: visible
                    });
                });
            }
        }
    });
    // 预览页路由
    if (previewFile) {
        return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(PreviewComponent, {
            file: previewFile,
            onBack: handleBack,
            onDownload: handleDownloadInPreview,
            onShare: function onShare1(file, options) {
                if (onShare) {
                    onShare(file, {
                        anchorEl: options === null || options === void 0 ? void 0 : options.anchorEl,
                        origin: 'preview'
                    });
                } else {
                    handleDefaultShare(file);
                }
            },
            onLocate: onLocate,
            customContent: customPreviewContent || undefined,
            customHeader: customPreviewHeader || undefined,
            customActions: typeof customActions === 'function' ? customActions(previewFile) : customActions,
            headerFileOverride: headerFileOverride || undefined,
            markdownEditorProps: markdownEditorProps
        }), ImagePreviewComponent);
    }
    // 列表页路由：自定义 loading 渲染 vs 默认 Spin
    return wrapSSR(/*#__PURE__*/ React.createElement(React.Fragment, null, loading && loadingRender ? /*#__PURE__*/ React.createElement("div", {
        className: classNames("".concat(prefixCls, "-container"), hashId),
        "data-testid": "file-component"
    }, renderSearchInput(), loadingRender()) : /*#__PURE__*/ React.createElement(Spin, {
        spinning: !!loading
    }, /*#__PURE__*/ React.createElement("div", {
        className: classNames("".concat(prefixCls, "-container"), hashId),
        "data-testid": "file-component"
    }, renderSearchInput(), renderFileContent())), ImagePreviewComponent));
};
