const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.js');
const require_merge$1 = require('./util/merge.js');

//#region ../../node_modules/.pnpm/validator@13.12.0/node_modules/validator/lib/normalizeEmail.js
var require_normalizeEmail = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/validator@13.12.0/node_modules/validator/lib/normalizeEmail.js": ((exports, module) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	exports.default = normalizeEmail;
	var _merge = _interopRequireDefault(require_merge$1.require_merge());
	function _interopRequireDefault(obj) {
		return obj && obj.__esModule ? obj : { default: obj };
	}
	var default_normalize_email_options = {
		all_lowercase: true,
		gmail_lowercase: true,
		gmail_remove_dots: true,
		gmail_remove_subaddress: true,
		gmail_convert_googlemaildotcom: true,
		outlookdotcom_lowercase: true,
		outlookdotcom_remove_subaddress: true,
		yahoo_lowercase: true,
		yahoo_remove_subaddress: true,
		yandex_lowercase: true,
		icloud_lowercase: true,
		icloud_remove_subaddress: true
	};
	var icloud_domains = ["icloud.com", "me.com"];
	var outlookdotcom_domains = [
		"hotmail.at",
		"hotmail.be",
		"hotmail.ca",
		"hotmail.cl",
		"hotmail.co.il",
		"hotmail.co.nz",
		"hotmail.co.th",
		"hotmail.co.uk",
		"hotmail.com",
		"hotmail.com.ar",
		"hotmail.com.au",
		"hotmail.com.br",
		"hotmail.com.gr",
		"hotmail.com.mx",
		"hotmail.com.pe",
		"hotmail.com.tr",
		"hotmail.com.vn",
		"hotmail.cz",
		"hotmail.de",
		"hotmail.dk",
		"hotmail.es",
		"hotmail.fr",
		"hotmail.hu",
		"hotmail.id",
		"hotmail.ie",
		"hotmail.in",
		"hotmail.it",
		"hotmail.jp",
		"hotmail.kr",
		"hotmail.lv",
		"hotmail.my",
		"hotmail.ph",
		"hotmail.pt",
		"hotmail.sa",
		"hotmail.sg",
		"hotmail.sk",
		"live.be",
		"live.co.uk",
		"live.com",
		"live.com.ar",
		"live.com.mx",
		"live.de",
		"live.es",
		"live.eu",
		"live.fr",
		"live.it",
		"live.nl",
		"msn.com",
		"outlook.at",
		"outlook.be",
		"outlook.cl",
		"outlook.co.il",
		"outlook.co.nz",
		"outlook.co.th",
		"outlook.com",
		"outlook.com.ar",
		"outlook.com.au",
		"outlook.com.br",
		"outlook.com.gr",
		"outlook.com.pe",
		"outlook.com.tr",
		"outlook.com.vn",
		"outlook.cz",
		"outlook.de",
		"outlook.dk",
		"outlook.es",
		"outlook.fr",
		"outlook.hu",
		"outlook.id",
		"outlook.ie",
		"outlook.in",
		"outlook.it",
		"outlook.jp",
		"outlook.kr",
		"outlook.lv",
		"outlook.my",
		"outlook.ph",
		"outlook.pt",
		"outlook.sa",
		"outlook.sg",
		"outlook.sk",
		"passport.com"
	];
	var yahoo_domains = [
		"rocketmail.com",
		"yahoo.ca",
		"yahoo.co.uk",
		"yahoo.com",
		"yahoo.de",
		"yahoo.fr",
		"yahoo.in",
		"yahoo.it",
		"ymail.com"
	];
	var yandex_domains = [
		"yandex.ru",
		"yandex.ua",
		"yandex.kz",
		"yandex.com",
		"yandex.by",
		"ya.ru"
	];
	function dotsReplacer(match) {
		if (match.length > 1) return match;
		return "";
	}
	function normalizeEmail(email, options) {
		options = (0, _merge.default)(options, default_normalize_email_options);
		var raw_parts = email.split("@");
		var domain = raw_parts.pop();
		var parts = [raw_parts.join("@"), domain];
		parts[1] = parts[1].toLowerCase();
		if (parts[1] === "gmail.com" || parts[1] === "googlemail.com") {
			if (options.gmail_remove_subaddress) parts[0] = parts[0].split("+")[0];
			if (options.gmail_remove_dots) parts[0] = parts[0].replace(/\.+/g, dotsReplacer);
			if (!parts[0].length) return false;
			if (options.all_lowercase || options.gmail_lowercase) parts[0] = parts[0].toLowerCase();
			parts[1] = options.gmail_convert_googlemaildotcom ? "gmail.com" : parts[1];
		} else if (icloud_domains.indexOf(parts[1]) >= 0) {
			if (options.icloud_remove_subaddress) parts[0] = parts[0].split("+")[0];
			if (!parts[0].length) return false;
			if (options.all_lowercase || options.icloud_lowercase) parts[0] = parts[0].toLowerCase();
		} else if (outlookdotcom_domains.indexOf(parts[1]) >= 0) {
			if (options.outlookdotcom_remove_subaddress) parts[0] = parts[0].split("+")[0];
			if (!parts[0].length) return false;
			if (options.all_lowercase || options.outlookdotcom_lowercase) parts[0] = parts[0].toLowerCase();
		} else if (yahoo_domains.indexOf(parts[1]) >= 0) {
			if (options.yahoo_remove_subaddress) {
				var components = parts[0].split("-");
				parts[0] = components.length > 1 ? components.slice(0, -1).join("-") : components[0];
			}
			if (!parts[0].length) return false;
			if (options.all_lowercase || options.yahoo_lowercase) parts[0] = parts[0].toLowerCase();
		} else if (yandex_domains.indexOf(parts[1]) >= 0) {
			if (options.all_lowercase || options.yandex_lowercase) parts[0] = parts[0].toLowerCase();
			parts[1] = "yandex.ru";
		} else if (options.all_lowercase) parts[0] = parts[0].toLowerCase();
		return parts.join("@");
	}
	module.exports = exports.default;
	module.exports.default = exports.default;
}) });

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