const require_rolldown_runtime = require('../../../../../../../_virtual/rolldown_runtime.js');
const require_ValidationExecutor$1 = require('./ValidationExecutor.js');

//#region ../../node_modules/.pnpm/class-validator@0.14.1/node_modules/class-validator/cjs/validation/Validator.js
var require_Validator = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/class-validator@0.14.1/node_modules/class-validator/cjs/validation/Validator.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	const ValidationExecutor_1 = require_ValidationExecutor$1.require_ValidationExecutor();
	/**
	* Validator performs validation of the given object based on its metadata.
	*/
	var Validator = class {
		/**
		* Performs validation of the given object based on decorators or validation schema.
		*/
		validate(objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions) {
			return this.coreValidate(objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions);
		}
		/**
		* Performs validation of the given object based on decorators or validation schema and reject on error.
		*/
		async validateOrReject(objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions) {
			const errors = await this.coreValidate(objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions);
			if (errors.length) return Promise.reject(errors);
		}
		/**
		* Performs validation of the given object based on decorators or validation schema.
		*/
		validateSync(objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions) {
			const object = typeof objectOrSchemaName === "string" ? objectOrValidationOptions : objectOrSchemaName;
			const options = typeof objectOrSchemaName === "string" ? maybeValidatorOptions : objectOrValidationOptions;
			const schema = typeof objectOrSchemaName === "string" ? objectOrSchemaName : void 0;
			const executor = new ValidationExecutor_1.ValidationExecutor(this, options);
			executor.ignoreAsyncValidations = true;
			const validationErrors = [];
			executor.execute(object, schema, validationErrors);
			return executor.stripEmptyErrors(validationErrors);
		}
		/**
		* Performs validation of the given object based on decorators or validation schema.
		* Common method for `validateOrReject` and `validate` methods.
		*/
		coreValidate(objectOrSchemaName, objectOrValidationOptions, maybeValidatorOptions) {
			const object = typeof objectOrSchemaName === "string" ? objectOrValidationOptions : objectOrSchemaName;
			const options = typeof objectOrSchemaName === "string" ? maybeValidatorOptions : objectOrValidationOptions;
			const schema = typeof objectOrSchemaName === "string" ? objectOrSchemaName : void 0;
			const executor = new ValidationExecutor_1.ValidationExecutor(this, options);
			const validationErrors = [];
			executor.execute(object, schema, validationErrors);
			return Promise.all(executor.awaitingPromises).then(() => {
				return executor.stripEmptyErrors(validationErrors);
			});
		}
	};
	exports.Validator = Validator;
}) });

//#endregion
Object.defineProperty(exports, 'default', {
  enumerable: true,
  get: function () {
    return require_Validator();
  }
});