import { c } from "react-compiler-runtime";
import React, { Fragment } from "react";
//#region src/shell/ui/user/PasswordValidator.jsx
const validatePassword = (password, lengthRestriction = 0, upperCaseRestriction = false, specialCharacterRestriction = false, numberRestriction = false, lowerCaseRestriction = false) => {
	let issues = [];
	if (!password) return [];
	if (lengthRestriction && password.length < lengthRestriction) issues.push(`Password must be at least ${lengthRestriction} characters long.`);
	if (upperCaseRestriction && !/[A-Z]/.test(password)) issues.push("Password must contain at least one uppercase letter.");
	if (specialCharacterRestriction && !/[!@#$%^&*(),.?":{}|<>]/.test(password)) issues.push("Password must contain at least one special character.");
	if (numberRestriction && !/\d/.test(password)) issues.push("Password must contain at least one number.");
	if (lowerCaseRestriction && !/[a-z]/.test(password)) issues.push("Password must contain at least one lowercase letter.");
	return issues;
};
const isPasswordValid = (password, lengthRestriction = 0, upperCaseRestriction = false, specialCharacterRestriction = false, numberRestriction = false, lowerCaseRestriction = false) => {
	return validatePassword(password, lengthRestriction, upperCaseRestriction, specialCharacterRestriction, numberRestriction, lowerCaseRestriction).length === 0;
};
const PasswordValidator = (t0) => {
	const $ = c(12);
	const { password, lengthRestriction, upperCaseRestriction, specialCharacterRestriction, numberRestriction, lowerCaseRestriction } = t0;
	let t1;
	if ($[0] !== lengthRestriction || $[1] !== lowerCaseRestriction || $[2] !== numberRestriction || $[3] !== password || $[4] !== specialCharacterRestriction || $[5] !== upperCaseRestriction) {
		t1 = validatePassword(password, lengthRestriction, upperCaseRestriction, specialCharacterRestriction, numberRestriction, lowerCaseRestriction);
		$[0] = lengthRestriction;
		$[1] = lowerCaseRestriction;
		$[2] = numberRestriction;
		$[3] = password;
		$[4] = specialCharacterRestriction;
		$[5] = upperCaseRestriction;
		$[6] = t1;
	} else t1 = $[6];
	const issues = t1;
	if (!password || issues.length === 0) return null;
	let t2;
	if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = { color: "red" };
		$[7] = t2;
	} else t2 = $[7];
	let t3;
	if ($[8] !== issues) {
		t3 = issues.map(_temp);
		$[8] = issues;
		$[9] = t3;
	} else t3 = $[9];
	let t4;
	if ($[10] !== t3) {
		t4 = /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("p", { style: t2 }, t3));
		$[10] = t3;
		$[11] = t4;
	} else t4 = $[11];
	return t4;
};
function _temp(issue, index) {
	return /* @__PURE__ */ React.createElement(Fragment, { key: `${issue}-${index}` }, issue, /* @__PURE__ */ React.createElement("br", null));
}
//#endregion
export { PasswordValidator as default, isPasswordValid };

//# sourceMappingURL=PasswordValidator.mjs.map