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/array/ArrayUnique.js
var require_ArrayUnique = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/class-validator@0.14.1/node_modules/class-validator/cjs/decorator/array/ArrayUnique.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	exports.ArrayUnique = exports.arrayUnique = exports.ARRAY_UNIQUE = void 0;
	const ValidateBy_1 = require_ValidateBy$1.require_ValidateBy();
	exports.ARRAY_UNIQUE = "arrayUnique";
	/**
	* Checks if all array's values are unique. Comparison for objects is reference-based.
	* If null or undefined is given then this function returns false.
	*/
	function arrayUnique(array, identifier) {
		if (!Array.isArray(array)) return false;
		if (identifier) array = array.map((o) => o != null ? identifier(o) : o);
		const uniqueItems = array.filter((a, b, c) => c.indexOf(a) === b);
		return array.length === uniqueItems.length;
	}
	exports.arrayUnique = arrayUnique;
	/**
	* Checks if all array's values are unique. Comparison for objects is reference-based.
	* If null or undefined is given then this function returns false.
	*/
	function ArrayUnique(identifierOrOptions, validationOptions) {
		const identifier = typeof identifierOrOptions === "function" ? identifierOrOptions : void 0;
		const options = typeof identifierOrOptions !== "function" ? identifierOrOptions : validationOptions;
		return (0, ValidateBy_1.ValidateBy)({
			name: exports.ARRAY_UNIQUE,
			validator: {
				validate: (value, args) => arrayUnique(value, identifier),
				defaultMessage: (0, ValidateBy_1.buildMessage)((eachPrefix) => eachPrefix + "All $property's elements must be unique", options)
			}
		}, options);
	}
	exports.ArrayUnique = ArrayUnique;
}) });

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