const require_rolldown_runtime = require('../../../../../../../../_virtual/rolldown_runtime.js');
const require_ValidateBy$1 = require('../common/ValidateBy.js');

//#region ../../node_modules/.pnpm/class-validator@0.14.1/node_modules/class-validator/cjs/decorator/object/IsInstance.js
var require_IsInstance = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/class-validator@0.14.1/node_modules/class-validator/cjs/decorator/object/IsInstance.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	exports.IsInstance = exports.isInstance = exports.IS_INSTANCE = void 0;
	const ValidateBy_1 = require_ValidateBy$1.require_ValidateBy();
	exports.IS_INSTANCE = "isInstance";
	/**
	* Checks if the value is an instance of the specified object.
	*/
	function isInstance(object, targetTypeConstructor) {
		return targetTypeConstructor && typeof targetTypeConstructor === "function" && object instanceof targetTypeConstructor;
	}
	exports.isInstance = isInstance;
	/**
	* Checks if the value is an instance of the specified object.
	*/
	function IsInstance(targetType, validationOptions) {
		return (0, ValidateBy_1.ValidateBy)({
			name: exports.IS_INSTANCE,
			constraints: [targetType],
			validator: {
				validate: (value, args) => isInstance(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
				defaultMessage: (0, ValidateBy_1.buildMessage)((eachPrefix, args) => {
					if (args === null || args === void 0 ? void 0 : args.constraints[0]) return eachPrefix + `$property must be an instance of ${args === null || args === void 0 ? void 0 : args.constraints[0].name}`;
					else return eachPrefix + `${exports.IS_INSTANCE} decorator expects and object as value, but got falsy value.`;
				}, validationOptions)
			}
		}, validationOptions);
	}
	exports.IsInstance = IsInstance;
}) });

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