const require_rolldown_runtime = require('../../../../../../../_virtual/rolldown_runtime.js');

//#region ../../node_modules/.pnpm/validator@13.12.0/node_modules/validator/lib/util/algorithms.js
var require_algorithms = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/validator@13.12.0/node_modules/validator/lib/util/algorithms.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	exports.iso7064Check = iso7064Check;
	exports.luhnCheck = luhnCheck;
	exports.reverseMultiplyAndSum = reverseMultiplyAndSum;
	exports.verhoeffCheck = verhoeffCheck;
	/**
	* Algorithmic validation functions
	* May be used as is or implemented in the workflow of other validators.
	*/
	function iso7064Check(str) {
		var checkvalue = 10;
		for (var i = 0; i < str.length - 1; i++) checkvalue = (parseInt(str[i], 10) + checkvalue) % 10 === 0 ? 20 % 11 : (parseInt(str[i], 10) + checkvalue) % 10 * 2 % 11;
		checkvalue = checkvalue === 1 ? 0 : 11 - checkvalue;
		return checkvalue === parseInt(str[10], 10);
	}
	function luhnCheck(str) {
		var checksum = 0;
		var second = false;
		for (var i = str.length - 1; i >= 0; i--) {
			if (second) {
				var product = parseInt(str[i], 10) * 2;
				if (product > 9) checksum += product.toString().split("").map(function(a) {
					return parseInt(a, 10);
				}).reduce(function(a, b) {
					return a + b;
				}, 0);
				else checksum += product;
			} else checksum += parseInt(str[i], 10);
			second = !second;
		}
		return checksum % 10 === 0;
	}
	function reverseMultiplyAndSum(digits, base) {
		var total = 0;
		for (var i = 0; i < digits.length; i++) total += digits[i] * (base - i);
		return total;
	}
	function verhoeffCheck(str) {
		var d_table = [
			[
				0,
				1,
				2,
				3,
				4,
				5,
				6,
				7,
				8,
				9
			],
			[
				1,
				2,
				3,
				4,
				0,
				6,
				7,
				8,
				9,
				5
			],
			[
				2,
				3,
				4,
				0,
				1,
				7,
				8,
				9,
				5,
				6
			],
			[
				3,
				4,
				0,
				1,
				2,
				8,
				9,
				5,
				6,
				7
			],
			[
				4,
				0,
				1,
				2,
				3,
				9,
				5,
				6,
				7,
				8
			],
			[
				5,
				9,
				8,
				7,
				6,
				0,
				4,
				3,
				2,
				1
			],
			[
				6,
				5,
				9,
				8,
				7,
				1,
				0,
				4,
				3,
				2
			],
			[
				7,
				6,
				5,
				9,
				8,
				2,
				1,
				0,
				4,
				3
			],
			[
				8,
				7,
				6,
				5,
				9,
				3,
				2,
				1,
				0,
				4
			],
			[
				9,
				8,
				7,
				6,
				5,
				4,
				3,
				2,
				1,
				0
			]
		];
		var p_table = [
			[
				0,
				1,
				2,
				3,
				4,
				5,
				6,
				7,
				8,
				9
			],
			[
				1,
				5,
				7,
				6,
				2,
				8,
				3,
				0,
				9,
				4
			],
			[
				5,
				8,
				0,
				3,
				7,
				9,
				6,
				1,
				4,
				2
			],
			[
				8,
				9,
				1,
				6,
				0,
				4,
				3,
				5,
				2,
				7
			],
			[
				9,
				4,
				5,
				3,
				1,
				2,
				6,
				8,
				7,
				0
			],
			[
				4,
				2,
				8,
				6,
				5,
				7,
				3,
				9,
				0,
				1
			],
			[
				2,
				7,
				9,
				3,
				8,
				0,
				6,
				4,
				1,
				5
			],
			[
				7,
				0,
				4,
				6,
				9,
				1,
				3,
				2,
				5,
				8
			]
		];
		var str_copy = str.split("").reverse().join("");
		var checksum = 0;
		for (var i = 0; i < str_copy.length; i++) checksum = d_table[checksum][p_table[i % 8][parseInt(str_copy[i], 10)]];
		return checksum === 0;
	}
}) });

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