import { getText } from "../../../../locales/index.js";
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import IconFont from "../../../iconfont/index.js";
import PisellModal from "../../../pisellModal/index.js";
import useEngineContext from "../../../../hooks/useEngineContext.js";
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
import PisellToast from "../../../pisellToast/index.js";
import PisellUpload from "../../../pisellUpload/index.js";
import { useIsShop } from "../../hooks/usePlatform.js";
import { SUPPORTED_LANGUAGES } from "./constants.js";
import { createMultilingualData, createMultilingualFileList, getBaseTime, getDefaultFileList, getFileMetadataParams, getFileType, getMediaMetadata, getPointSuffix, isValueEqual } from "./utils.js";
import CameraPopover from "./CameraPopover.js";
import { uploadFile } from "./shopUploadServe.js";
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { isBoolean, isMobile } from "@pisell/utils";
import { Image, Upload } from "antd";
import { PlusOutlined } from "@ant-design/icons";
import { useDebounceFn, useMemoizedFn } from "ahooks";
import fallback from "./fallback.png";
import "./index.less";
//#region src/components/dataSourceComponents/fields/Upload/BaseUpload.tsx
const _excluded = [
	"renderMode",
	"maxSize",
	"minCount",
	"maxCount",
	"multiple",
	"presetType",
	"customType",
	"enablePresetType",
	"enableCustomType",
	"allowPreview",
	"value",
	"typeMaxSizeMap",
	"enableMultilingual",
	"onChange",
	"mediaUploadUrl",
	"getHeaders",
	"allowCamera"
], _excluded2 = ["cover"];
const BaseUpload = (props) => {
	const { renderMode, maxSize, minCount, maxCount, multiple, presetType, customType, enablePresetType, enableCustomType, allowPreview, value, typeMaxSizeMap, enableMultilingual, onChange, mediaUploadUrl: propsMediaUploadUrl, getHeaders: propsGetHeaders, allowCamera } = props, restProps = _objectWithoutProperties(props, _excluded);
	const isShop = useIsShop();
	const [fileList, setFileList] = useState([]);
	const [previewImage, setPreviewImage] = useState("");
	const [previewOpen, setPreviewOpen] = useState(false);
	const [open, setOpen] = useState(false);
	const [editMultilingualFile, setEditMultilingualFile] = useState(null);
	const fileListRef = useRef([]);
	const uploadButtonRef = useRef(null);
	const uploadRef = useRef(null);
	useEffect(() => {
		fileListRef.current = fileList;
	}, [fileList]);
	const { appHelper } = useEngineContext();
	const { mediaUploadUrl, getHeaders } = (appHelper === null || appHelper === void 0 ? void 0 : appHelper.constants) || {};
	useEffect(() => {
		const currentValue = getValueFromFileList(fileListRef.current);
		if (!fileListRef.current.length || !isValueEqual(value, currentValue)) setFileList(getDefaultFileList(value, {
			enableMultilingual: !!enableMultilingual,
			multiple: !!multiple
		}));
	}, [
		value,
		enableMultilingual,
		multiple
	]);
	const getValueFromFileList = (fileList) => {
		if (!fileList.length) return multiple ? [] : "";
		if (enableMultilingual) {
			const multilingualValues = fileList.filter((file) => file.status === "done").map((file) => {
				var _file$response;
				return file.multilingual || createMultilingualData(((_file$response = file.response) === null || _file$response === void 0 || (_file$response = _file$response.data) === null || _file$response === void 0 ? void 0 : _file$response.url) || file.url || "");
			});
			return multiple ? multilingualValues : multilingualValues[0];
		}
		const urls = fileList.filter((file) => file.status === "done").map((file) => {
			var _file$response2;
			return ((_file$response2 = file.response) === null || _file$response2 === void 0 || (_file$response2 = _file$response2.data) === null || _file$response2 === void 0 ? void 0 : _file$response2.url) || file.url || "";
		});
		return multiple ? urls : urls[0] || "";
	};
	const calcMaxCount = useMemo(() => multiple ? maxCount || 9 : 1, [maxCount, multiple]);
	const accept = useMemo(() => {
		return [...enablePresetType ? presetType || [] : [], ...enableCustomType ? customType || [] : []].join(",");
	}, [
		presetType,
		customType,
		enableCustomType,
		enablePresetType
	]);
	const countError = useDebounceFn((msg) => PisellToast({ content: msg }), { wait: 500 });
	const typeError = useDebounceFn((msg) => PisellToast({ content: msg }), { wait: 500 });
	const sizeError = useDebounceFn((msg) => PisellToast({ content: msg }), { wait: 500 });
	const fileDoneSetMultilingualFileList = useMemoizedFn(() => {
		setFileList((prev) => {
			return prev.map((item) => {
				var _item$response, _item$response2;
				return _objectSpread2(_objectSpread2({}, item), {}, {
					multilingualFileList: item.multilingualFileList || createMultilingualFileList(((_item$response = item.response) === null || _item$response === void 0 || (_item$response = _item$response.data) === null || _item$response === void 0 ? void 0 : _item$response.url) || item.url || ""),
					multilingual: item.multilingual || createMultilingualData(((_item$response2 = item.response) === null || _item$response2 === void 0 || (_item$response2 = _item$response2.data) === null || _item$response2 === void 0 ? void 0 : _item$response2.url) || item.url || "")
				});
			});
		});
	});
	const handleChange = useCallback(({ file, fileList: newFileList }) => {
		var _file$response3, _file$response6, _file$response7;
		const updatedFileList = newFileList.map((item) => {
			var _item$response3;
			return _objectSpread2(_objectSpread2({}, item), {}, { status: item.status === "done" && item.response && !((_item$response3 = item.response) === null || _item$response3 === void 0 ? void 0 : _item$response3.status) ? "error" : item.status });
		});
		setFileList(updatedFileList);
		if (file.status === "done" && ((_file$response3 = file.response) === null || _file$response3 === void 0 ? void 0 : _file$response3.status)) if (multiple) if (enableMultilingual) {
			const multilingualUrls = updatedFileList.filter((item) => item.status === "done").map((item) => {
				var _item$response4;
				return item.multilingual || createMultilingualData(((_item$response4 = item.response) === null || _item$response4 === void 0 || (_item$response4 = _item$response4.data) === null || _item$response4 === void 0 ? void 0 : _item$response4.url) || item.url || "");
			});
			fileDoneSetMultilingualFileList();
			onChange === null || onChange === void 0 || onChange(multilingualUrls);
		} else {
			const urls = updatedFileList.filter((item) => item.status === "done").map((item) => {
				var _item$response5;
				return ((_item$response5 = item.response) === null || _item$response5 === void 0 || (_item$response5 = _item$response5.data) === null || _item$response5 === void 0 ? void 0 : _item$response5.url) || item.url || "";
			});
			onChange === null || onChange === void 0 || onChange(urls);
		}
		else if (enableMultilingual) {
			var _file$response4;
			const multilingualData = createMultilingualData(((_file$response4 = file.response) === null || _file$response4 === void 0 || (_file$response4 = _file$response4.data) === null || _file$response4 === void 0 ? void 0 : _file$response4.url) || "");
			fileDoneSetMultilingualFileList();
			onChange === null || onChange === void 0 || onChange(multilingualData);
		} else {
			var _file$response5;
			onChange === null || onChange === void 0 || onChange(((_file$response5 = file.response) === null || _file$response5 === void 0 || (_file$response5 = _file$response5.data) === null || _file$response5 === void 0 ? void 0 : _file$response5.url) || "");
		}
		else if (file.status === "error" || isBoolean((_file$response6 = file.response) === null || _file$response6 === void 0 ? void 0 : _file$response6.status) && ((_file$response7 = file.response) === null || _file$response7 === void 0 ? void 0 : _file$response7.status) === false) PisellToast({ content: getText("pisell-upload-error")(file.name) });
	}, [
		multiple,
		enableMultilingual,
		onChange
	]);
	const handlePreview = useCallback((file) => {
		var _file$response8;
		setPreviewImage(file.url || ((_file$response8 = file.response) === null || _file$response8 === void 0 || (_file$response8 = _file$response8.data) === null || _file$response8 === void 0 ? void 0 : _file$response8.url) || "");
		setPreviewOpen(true);
	}, []);
	const handleEditMultilingual = useCallback((file) => {
		setOpen(true);
		setEditMultilingualFile(file);
	}, []);
	const handleRemove = useCallback((file) => {
		setFileList((prev) => {
			const val = prev.filter((item) => item.uid !== file.uid);
			if (multiple) if (enableMultilingual) {
				const multilingualUrls = val.filter((item) => !!item.multilingual).map((item) => item.multilingual);
				onChange === null || onChange === void 0 || onChange(multilingualUrls);
			} else {
				const urls = val.map((item) => {
					var _item$response6;
					return ((_item$response6 = item.response) === null || _item$response6 === void 0 || (_item$response6 = _item$response6.data) === null || _item$response6 === void 0 ? void 0 : _item$response6.url) || item.url || "";
				});
				onChange === null || onChange === void 0 || onChange(urls);
			}
			else if (enableMultilingual) {
				const emptyMultilingualData = createMultilingualData("");
				onChange === null || onChange === void 0 || onChange(emptyMultilingualData);
			} else onChange === null || onChange === void 0 || onChange("");
			return val;
		});
	}, [
		multiple,
		enableMultilingual,
		onChange
	]);
	const handleGlobeIconClick = useCallback((e) => {
		e.stopPropagation();
		e.preventDefault();
		setEditMultilingualFile({
			uid: `-${Math.random().toString(36).substring(2, 15)}`,
			name: "",
			status: "done",
			multilingualFileList: createMultilingualFileList(""),
			multilingual: createMultilingualData("")
		});
		setOpen(true);
	}, []);
	const handleEditMultilingualChange = useCallback((info, lang) => {
		setEditMultilingualFile((prev) => {
			if (!prev) return null;
			const newFile = _objectSpread2({}, prev);
			newFile.multilingualFileList[lang] = info.fileList.map((item) => {
				var _item$response7;
				return _objectSpread2(_objectSpread2({}, item), {}, { status: item.status === "done" && !((_item$response7 = item.response) === null || _item$response7 === void 0 ? void 0 : _item$response7.status) ? "error" : item.status });
			});
			if (info.file.status === "done") {
				var _info$file$response;
				newFile.multilingual[lang] = (_info$file$response = info.file.response) === null || _info$file$response === void 0 || (_info$file$response = _info$file$response.data) === null || _info$file$response === void 0 ? void 0 : _info$file$response.url;
			}
			return newFile;
		});
	}, []);
	const handleEditMultilingualRemove = useCallback((file, lang) => {
		setEditMultilingualFile((prev) => {
			if (!prev) return null;
			return _objectSpread2(_objectSpread2({}, prev), {}, { multilingual: _objectSpread2(_objectSpread2({}, prev.multilingual), {}, { [lang]: "" }) });
		});
	}, []);
	const handleEditMultilingualOk = useCallback(() => {
		if (!editMultilingualFile) return;
		const { uid } = editMultilingualFile;
		setFileList((prev) => {
			const val = prev.map((item) => item.uid === uid ? _objectSpread2(_objectSpread2({}, item), editMultilingualFile) : item);
			if (!val.find((item) => item.uid === uid)) val.push(_objectSpread2({}, editMultilingualFile));
			if (multiple) onChange === null || onChange === void 0 || onChange(val.map((item) => item.multilingual));
			else {
				var _val$;
				onChange === null || onChange === void 0 || onChange((_val$ = val[0]) === null || _val$ === void 0 ? void 0 : _val$.multilingual);
			}
			return val;
		});
		setOpen(false);
	}, [
		editMultilingualFile,
		multiple,
		onChange
	]);
	const handleEditMultilingualCancel = useCallback(() => {
		setEditMultilingualFile(null);
		setOpen(false);
	}, []);
	const beforeUpload = useCallback(function() {
		var _ref = _asyncToGenerator(function* (file, newFileList) {
			console.log("beforeUpload000", file, newFileList);
			newFileList.forEach((item, index) => {
				if (item.uid === file.uid) index + 1;
			});
			const fileType = getFileType(file.name);
			const _maxSize = (typeMaxSizeMap === null || typeMaxSizeMap === void 0 ? void 0 : typeMaxSizeMap[fileType]) || maxSize || 10;
			if (file.size > _maxSize * 1024 * 1024) {
				sizeError.run(getText("pisell-upload-setting-size-error")(_maxSize));
				return Upload.LIST_IGNORE;
			}
			const pointSuffix = getPointSuffix(file.name);
			if (accept !== "" && !accept.includes(pointSuffix)) {
				typeError.run(getText("pisell-upload-setting-type-error")(pointSuffix));
				return Upload.LIST_IGNORE;
			}
			try {
				const metadata = yield getMediaMetadata(file);
				if (metadata) {
					const { cover } = metadata;
					file.metadata = _objectWithoutProperties(metadata, _excluded2);
					file.cover = cover;
				}
			} catch (error) {
				console.error("获取媒体元数据失败:", error);
			}
			return file;
		});
		return function(_x, _x2) {
			return _ref.apply(this, arguments);
		};
	}(), [
		accept,
		fileList.length,
		maxSize,
		minCount,
		maxCount,
		multiple,
		typeMaxSizeMap
	]);
	const renderUploadButton = useCallback((showGlobeIcon) => /* @__PURE__ */ React.createElement("button", {
		className: "pisell-upload-button",
		type: "button",
		disabled: restProps.disabled,
		ref: uploadButtonRef
	}, /* @__PURE__ */ React.createElement(PlusOutlined, null), /* @__PURE__ */ React.createElement("div", { className: "pisell-upload-text" }, getText("pisell-upload-button")), showGlobeIcon && /* @__PURE__ */ React.createElement(IconFont, {
		type: "pisell2-globe-02",
		className: "pisell-upload-globe-icon",
		onClick: handleGlobeIconClick
	})), [restProps.disabled, handleGlobeIconClick]);
	const customRequest = useMemo(() => {
		if (!isShop) return {};
		const handleUpload = (options) => {
			const { onSuccess, onError, onProgress, file } = options;
			const fileSize = file.size;
			const baseTime = getBaseTime(fileSize);
			let progress = 0;
			setTimeout(() => {
				onProgress === null || onProgress === void 0 || onProgress({ percent: 1 });
			}, 200);
			const timer = setInterval(() => {
				if (progress < 30) progress += 5;
				else if (progress < 60) progress += 3;
				else if (progress < 80) progress += 2;
				else if (progress < 90) progress += .5;
				if (progress >= 90) clearInterval(timer);
				onProgress === null || onProgress === void 0 || onProgress({ percent: Math.min(90, progress) });
			}, baseTime / 30);
			uploadFile(file).then((res) => {
				clearInterval(timer);
				onProgress === null || onProgress === void 0 || onProgress({ percent: 95 });
				setTimeout(() => {
					onProgress === null || onProgress === void 0 || onProgress({ percent: 100 });
					onSuccess === null || onSuccess === void 0 || onSuccess(res);
				}, 200);
			}).catch((err) => {
				clearInterval(timer);
				onError === null || onError === void 0 || onError(err);
			});
		};
		return { customRequest: handleUpload };
	}, [isShop]);
	const uploadProps = _objectSpread2(_objectSpread2({}, restProps), {}, {
		multiple,
		showUploadList: {
			showRemoveIcon: true,
			showPreviewIcon: allowPreview,
			showDownloadIcon: enableMultilingual,
			downloadIcon: (file) => /* @__PURE__ */ React.createElement(IconFont, {
				type: "pisell2-globe-02",
				className: "pisell-upload-multilingual-icon",
				onClick: () => handleEditMultilingual(file)
			})
		},
		uploadType: "custom",
		iconRender: () => /* @__PURE__ */ React.createElement(IconFont, { type: "pisell2-a-BlueFile1" }),
		listType: "picture-card",
		onChange: handleChange,
		action: propsMediaUploadUrl || mediaUploadUrl,
		method: "post",
		accept,
		name: "file",
		onPreview: handlePreview,
		onRemove: handleRemove,
		onDownload: () => {},
		data: (file) => _objectSpread2({ group_id: 0 }, getFileMetadataParams(file)),
		headers: (propsGetHeaders === null || propsGetHeaders === void 0 ? void 0 : propsGetHeaders()) || (getHeaders === null || getHeaders === void 0 ? void 0 : getHeaders()),
		beforeUpload,
		className: "pisell-data-source-upload"
	}, customRequest);
	const onCameraChange = (file) => {
		console.log("onCameraChange", file);
		if (fileList.length >= calcMaxCount) {
			countError.run(getText("pisell-upload-max-count-error")(calcMaxCount));
			return;
		}
		const fileType = getFileType(file.name);
		const _maxSize = (typeMaxSizeMap === null || typeMaxSizeMap === void 0 ? void 0 : typeMaxSizeMap[fileType]) || maxSize || 10;
		if (file.size > _maxSize * 1024 * 1024) {
			sizeError.run(getText("pisell-upload-setting-size-error")(_maxSize));
			return Upload.LIST_IGNORE;
		}
		const pointSuffix = getPointSuffix(file.name);
		if (accept !== "" && !accept.includes(pointSuffix)) {
			typeError.run(getText("pisell-upload-setting-type-error")(pointSuffix));
			return Upload.LIST_IGNORE;
		}
		const uploadFileObj = _objectSpread2({
			uid: file.uid || `camera-${Date.now()}`,
			name: file.name || `camera-${Date.now()}.jpg`,
			status: "uploading",
			url: file.url || file.thumbUrl,
			thumbUrl: file.thumbUrl || file.url,
			originFileObj: file.originFileObj || file,
			lastModified: file.lastModified || Date.now(),
			lastModifiedDate: file.lastModifiedDate || /* @__PURE__ */ new Date(),
			type: file.type || "image/jpeg",
			size: file.size
		}, enableMultilingual && {
			multilingualFileList: createMultilingualFileList(""),
			multilingual: createMultilingualData("")
		});
		setFileList((prev) => {
			const newFileList = [...prev, uploadFileObj];
			if (!multiple && newFileList.length > 1) return [uploadFileObj];
			return newFileList;
		});
		const fileObj = uploadFileObj.originFileObj;
		if (fileObj) if (isShop) uploadFile(fileObj).then((result) => {
			setFileList((prev) => prev.map((item) => {
				var _result$data, _result$data2, _result$data3, _result$data4;
				return item.uid === uploadFileObj.uid ? _objectSpread2(_objectSpread2({}, item), {}, {
					status: "done",
					response: result,
					url: ((_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.url) || item.url,
					thumbUrl: ((_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.url) || item.thumbUrl
				}, enableMultilingual && {
					multilingual: createMultilingualData(((_result$data3 = result.data) === null || _result$data3 === void 0 ? void 0 : _result$data3.url) || ""),
					multilingualFileList: createMultilingualFileList(((_result$data4 = result.data) === null || _result$data4 === void 0 ? void 0 : _result$data4.url) || "")
				}) : item;
			}));
			handleChange({
				file: _objectSpread2(_objectSpread2({}, uploadFileObj), {}, {
					status: "done",
					response: result
				}),
				fileList: [...fileList, _objectSpread2(_objectSpread2({}, uploadFileObj), {}, {
					status: "done",
					response: result
				})]
			});
		}).catch((error) => {
			console.error("Camera upload error:", error);
			setFileList((prev) => prev.map((item) => item.uid === uploadFileObj.uid ? _objectSpread2(_objectSpread2({}, item), {}, { status: "error" }) : item));
			PisellToast({ content: getText("pisell-upload-error")(uploadFileObj.name) });
		});
		else {
			const formData = new FormData();
			formData.append(uploadProps.name || "file", fileObj);
			const extraData = (() => {
				if (typeof uploadProps.data === "function") {
					const result = uploadProps.data(fileObj);
					return result instanceof Promise ? {} : result;
				}
				return uploadProps.data || {};
			})();
			Object.keys(extraData).forEach((key) => {
				formData.append(key, String(extraData[key]));
			});
			fetch(uploadProps.action, {
				method: uploadProps.method || "post",
				body: formData,
				headers: uploadProps.headers || {}
			}).then((response) => response.json()).then((result) => {
				console.log("Camera upload success:", result);
				setFileList((prev) => prev.map((item) => {
					var _result$data5, _result$data6, _result$data7, _result$data8;
					return item.uid === uploadFileObj.uid ? _objectSpread2(_objectSpread2({}, item), {}, {
						status: "done",
						response: result,
						url: ((_result$data5 = result.data) === null || _result$data5 === void 0 ? void 0 : _result$data5.url) || item.url,
						thumbUrl: ((_result$data6 = result.data) === null || _result$data6 === void 0 ? void 0 : _result$data6.url) || item.thumbUrl
					}, enableMultilingual && {
						multilingual: createMultilingualData(((_result$data7 = result.data) === null || _result$data7 === void 0 ? void 0 : _result$data7.url) || ""),
						multilingualFileList: createMultilingualFileList(((_result$data8 = result.data) === null || _result$data8 === void 0 ? void 0 : _result$data8.url) || "")
					}) : item;
				}));
				handleChange({
					file: _objectSpread2(_objectSpread2({}, uploadFileObj), {}, {
						status: "done",
						response: result
					}),
					fileList: [...fileList, _objectSpread2(_objectSpread2({}, uploadFileObj), {}, {
						status: "done",
						response: result
					})]
				});
			}).catch((error) => {
				console.error("Camera upload error:", error);
				setFileList((prev) => prev.map((item) => item.uid === uploadFileObj.uid ? _objectSpread2(_objectSpread2({}, item), {}, { status: "error" }) : item));
				PisellToast({ content: getText("pisell-upload-error")(uploadFileObj.name) });
			});
		}
	};
	return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Upload, _objectSpread2(_objectSpread2({ ref: uploadRef }, uploadProps), {}, { fileList }), fileList.length >= calcMaxCount ? null : /* @__PURE__ */ React.createElement(React.Fragment, null, allowCamera && !isMobile() && /* @__PURE__ */ React.createElement(CameraPopover, {
		onLocalFileClick: () => {
			var _uploadButtonRef$curr;
			return (_uploadButtonRef$curr = uploadButtonRef.current) === null || _uploadButtonRef$curr === void 0 ? void 0 : _uploadButtonRef$curr.click();
		},
		onCameraChange
	}), renderUploadButton(!!enableMultilingual))), /* @__PURE__ */ React.createElement(PisellModal, {
		title: getText("pisell-upload-multilingual-title"),
		open,
		onCancel: handleEditMultilingualCancel,
		onOk: handleEditMultilingualOk
	}, /* @__PURE__ */ React.createElement("div", { className: "pisell-upload-multilingual-container" }, SUPPORTED_LANGUAGES.map((lang) => {
		var _editMultilingualFile, _editMultilingualFile2;
		return /* @__PURE__ */ React.createElement("div", {
			key: lang,
			className: "pisell-upload-multilingual-item"
		}, /* @__PURE__ */ React.createElement("div", { className: "pisell-upload-multilingual-item-title" }, getText(`pisell-upload-multilingual-item-title-${lang}`)), /* @__PURE__ */ React.createElement("div", { className: "pisell-upload-multilingual-item-content" }, /* @__PURE__ */ React.createElement(PisellUpload, _objectSpread2(_objectSpread2({}, uploadProps), {}, {
			showUploadList: {
				showRemoveIcon: true,
				showPreviewIcon: true,
				showDownloadIcon: false
			},
			fileList: (editMultilingualFile === null || editMultilingualFile === void 0 || (_editMultilingualFile = editMultilingualFile.multilingualFileList) === null || _editMultilingualFile === void 0 ? void 0 : _editMultilingualFile[lang]) || [],
			onRemove: (file) => handleEditMultilingualRemove(file, lang),
			onChange: (info) => handleEditMultilingualChange(info, lang),
			multiple: false
		}), (editMultilingualFile === null || editMultilingualFile === void 0 || (_editMultilingualFile2 = editMultilingualFile.multilingualFileList) === null || _editMultilingualFile2 === void 0 || (_editMultilingualFile2 = _editMultilingualFile2[lang]) === null || _editMultilingualFile2 === void 0 ? void 0 : _editMultilingualFile2.length) ? null : renderUploadButton(false))));
	}))), previewImage && /* @__PURE__ */ React.createElement(Image, {
		wrapperStyle: { display: "none" },
		preview: {
			visible: previewOpen,
			onVisibleChange: (visible) => setPreviewOpen(visible),
			afterOpenChange: (visible) => !visible && setPreviewImage("")
		},
		src: previewImage,
		fallback
	}));
};
//#endregion
export { BaseUpload as default };
