const require_utils = require("../../dataSourceForm/utils.js");
const require_utils$1 = require("./utils.js");
const require_WithMode = require("./WithMode.js");
//#region src/components/dataSourceComponents/fields/Upload/index.tsx
const Upload = require_utils.withFormItem(require_WithMode.default, { otherFormItemProps: (props, others) => {
	let rule = {};
	if (props.multiple) {
		rule = { validator(_, value) {
			const { success, message } = require_utils$1.checkFileCount({
				minCount: props.minCount || 0,
				maxCount: props.maxCount || 9,
				valueLength: (value === null || value === void 0 ? void 0 : value.length) || 0,
				multiple: !!props.multiple
			});
			if (!success) return Promise.reject(new Error(message));
			else return Promise.resolve();
		} };
		return { rules: [...(others === null || others === void 0 ? void 0 : others.rules) || [], rule] };
	}
	return {};
} });
//#endregion
exports.default = Upload;
