import ImageIcon from "./ImageIcon.js";
import usePercent from "./usePercent.js";
import { computed, createVNode, defineComponent, mergeProps } from "vue";
import { Flex, Skeleton, Spin } from "antdv-next";
//#region components/file-card/components/ImageLoading.tsx
var ImageLoading = /* @__PURE__ */ defineComponent({
	name: "FileCardImageLoading",
	props: {
		prefixCls: {
			type: String,
			default: "antd-file-card"
		},
		style: {
			type: Object,
			default: void 0
		},
		class: {
			type: String,
			default: ""
		},
		spinProps: {
			type: Object,
			default: void 0
		}
	},
	setup(props) {
		const [mergedPercent, percentText] = usePercent(true, typeof props.spinProps?.percent === "undefined" ? "auto" : props.spinProps?.percent);
		const mergedSpinProps = computed(() => ({
			size: props.spinProps?.size ?? "medium",
			showText: props.spinProps?.showText ?? true,
			icon: props.spinProps?.icon ?? createVNode(ImageIcon, {
				"color": "rgba(0,0,0,.45)",
				"size": props.spinProps?.size ?? "middle"
			}, null)
		}));
		const spinProps = computed(() => {
			const { showText: _showText, icon: _icon, ...rest } = props.spinProps ?? {};
			return rest;
		});
		return () => createVNode("div", {
			"class": [`${props.prefixCls}-image-loading`, props.class],
			"style": props.style
		}, [createVNode(Skeleton.Node, {
			"styles": {
				root: {
					width: "100%",
					height: "100%"
				},
				content: {
					width: "100%",
					height: "100%"
				}
			},
			"class": `${props.prefixCls}-image-skeleton`,
			"active": true
		}, { default: () => [createVNode(Flex, {
			"class": [`${props.prefixCls}-image-spin`, `${props.prefixCls}-image-spin-${mergedSpinProps.value.size}`],
			"align": "center",
			"gap": "small"
		}, { default: () => [createVNode(Spin, mergeProps({ "percent": mergedPercent.value }, spinProps.value), null), mergedSpinProps.value.showText ? createVNode("div", { "class": `${props.prefixCls}-image-spin-text` }, [percentText.value]) : null] }), mergedSpinProps.value.icon] })]);
	}
});
//#endregion
export { ImageLoading as default };
