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

//#region ../../node_modules/.pnpm/validator@13.12.0/node_modules/validator/lib/isISO6346.js
var require_isISO6346 = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/validator@13.12.0/node_modules/validator/lib/isISO6346.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	exports.isISO6346 = isISO6346;
	var _assertString = _interopRequireDefault(require_assertString$1.require_assertString());
	function _interopRequireDefault(obj) {
		return obj && obj.__esModule ? obj : { default: obj };
	}
	var isISO6346Str = /^[A-Z]{3}(U[0-9]{7})|([J,Z][0-9]{6,7})$/;
	var isDigit = /^[0-9]$/;
	function isISO6346(str) {
		(0, _assertString.default)(str);
		str = str.toUpperCase();
		if (!isISO6346Str.test(str)) return false;
		if (str.length === 11) {
			var sum = 0;
			for (var i = 0; i < str.length - 1; i++) if (!isDigit.test(str[i])) {
				var convertedCode = void 0;
				var letterCode = str.charCodeAt(i) - 55;
				if (letterCode < 11) convertedCode = letterCode;
				else if (letterCode >= 11 && letterCode <= 20) convertedCode = 12 + letterCode % 11;
				else if (letterCode >= 21 && letterCode <= 30) convertedCode = 23 + letterCode % 21;
				else convertedCode = 34 + letterCode % 31;
				sum += convertedCode * Math.pow(2, i);
			} else sum += str[i] * Math.pow(2, i);
			var checkSumDigit = sum % 11;
			return Number(str[str.length - 1]) === checkSumDigit;
		}
		return true;
	}
	exports.isFreightContainerID = isISO6346;
}) });

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