{"version":3,"file":"index-$$2.js","sources":["../../node_modules/ip-num/dist/src/BinaryUtils.js","../../node_modules/ip-num/dist/src/IPv6Utils.js","../../node_modules/ip-num/dist/src/HexadecimalUtils.js","../../node_modules/ip-num/dist/src/Validator.js","../../node_modules/ip-num/dist/src/Hexadecatet.js","../../node_modules/ip-num/dist/src/Octet.js","../../node_modules/ip-num/dist/src/IPNumber.js","../../node_modules/ip-num/dist/src/IPNumType.js","../../node_modules/ip-num/dist/src/Prefix.js","../../node_modules/ip-num/dist/src/IPRange.js","../../node_modules/ip-num/dist/src/IPPool.js","../../node_modules/ip-num/dist/src/index.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.matchingBitCount = exports.intLog2 = exports.cidrPrefixToMaskBinaryString = exports.leftPadWithZeroBit = exports.dottedDecimalNotationToBinaryString = exports.parseBinaryStringToBigInt = exports.decimalNumberToOctetString = exports.numberToBinaryString = void 0;\n/**\n * Converts a decimal number to binary string\n *\n * @param num number to parse\n * @returns {string} the binary string representation of number\n */\nlet numberToBinaryString = (num) => {\n return num.toString(2);\n};\nexports.numberToBinaryString = numberToBinaryString;\n/**\n * Converts a decimal number to binary octet (8 bit) string. If needed the octet will be padded with zeros\n * to make it up to 8 bits\n *\n * @param {number} num to convert to octet string\n * @returns {string} the octet string representation of given number\n */\nlet decimalNumberToOctetString = (num) => {\n let binaryString = (0, exports.numberToBinaryString)(num);\n let length = binaryString.length;\n if (length > 8) {\n throw new Error(\"Given decimal in binary contains digits greater than an octet\");\n }\n return (0, exports.leftPadWithZeroBit)(binaryString, 8);\n};\nexports.decimalNumberToOctetString = decimalNumberToOctetString;\n/**\n * Parses number in binary to number in BigInt\n *\n * @param num binary number in string to parse\n * @returns {number} binary number in BigInt\n */\nlet parseBinaryStringToBigInt = (num) => {\n return BigInt(`0b${num}`);\n};\nexports.parseBinaryStringToBigInt = parseBinaryStringToBigInt;\n/**\n * Given an IPv4 number in dot-decimal notated string, e.g 192.168.0.1 converts it to\n * binary string, e.g. '11000000101010000000000000000001'\n *\n * @param dottedDecimal IPv4 string in dot-decimal notation\n * @returns {string} the binary value of the given ipv4 number in string\n */\nlet dottedDecimalNotationToBinaryString = (dottedDecimal) => {\n let stringOctets = dottedDecimal.split(\".\");\n return stringOctets.reduce((binaryAsString, octet) => {\n return binaryAsString.concat((0, exports.decimalNumberToOctetString)(parseInt(octet)));\n }, '');\n};\nexports.dottedDecimalNotationToBinaryString = dottedDecimalNotationToBinaryString;\n/**\n * Given a binary string, adds a number of zero to the left until string is as long as the given string length\n * @param {string} binaryString the string to pad\n * @param {number} finalStringLength the final length of string after padding\n * @returns {string}\n */\nlet leftPadWithZeroBit = (binaryString, finalStringLength) => {\n if (binaryString.length > finalStringLength) {\n throw new Error(`Given string is already longer than given final length after padding: ${finalStringLength}`);\n }\n return \"0\".repeat(finalStringLength - binaryString.length).concat(binaryString);\n};\nexports.leftPadWithZeroBit = leftPadWithZeroBit;\n/**\n * Given the prefix portion of a cidr notation and the type of IP number, returns the mask in binary string\n *\n * @param {number} cidrPrefix the prefix part of a cidr notation\n * @param {IPNumType.IPv4 | IPNumType.IPv6} ipType the type of the ip number in the range the cidr represents\n */\nlet cidrPrefixToMaskBinaryString = (cidrPrefix, ipType) => {\n let cidrUpperValue;\n if (ipType == \"IPv4\" /* IPNumType.IPv4 */) {\n cidrUpperValue = 32;\n }\n else {\n cidrUpperValue = 128;\n }\n if (cidrPrefix > cidrUpperValue)\n throw Error(`Value is greater than ${cidrUpperValue}`);\n let onBits = '1'.repeat(cidrPrefix);\n let offBits = '0'.repeat(cidrUpperValue - cidrPrefix);\n return `${onBits}${offBits}`;\n};\nexports.cidrPrefixToMaskBinaryString = cidrPrefixToMaskBinaryString;\n/**\n * Calculates the log, to base 2 of given number.\n *\n * @throws Error if number cannot be converted to log base 2\n * @param givenNumber the number to calculate log base 2\n * @return the log base 2 of given number\n */\nlet intLog2 = (givenNumber) => {\n let result = 0;\n while (givenNumber % 2n === 0n) {\n if (givenNumber === 2n) {\n result++;\n break;\n }\n givenNumber = givenNumber >> 1n;\n if (givenNumber % 2n !== 0n) {\n result = 0;\n break;\n }\n result++;\n }\n if (result == 0) {\n throw new Error(`The value of log2 for ${givenNumber.toString()} is not an integer`);\n }\n return result;\n};\nexports.intLog2 = intLog2;\n/**\n * Starting from the most significant bit (from left) returns the number of first bits from both string that are equal\n * @param firstBinaryString first binary string\n * @param secondBinaryString second binary string\n */\nlet matchingBitCount = (firstBinaryString, secondBinaryString) => {\n let longerString;\n let otherString;\n if (firstBinaryString.length >= secondBinaryString.length) {\n longerString = firstBinaryString;\n otherString = secondBinaryString;\n }\n else {\n longerString = secondBinaryString;\n otherString = firstBinaryString;\n }\n let count = 0;\n for (; count < longerString.length; count++) {\n if (longerString.charAt(count) === otherString.charAt(count)) {\n continue;\n }\n break;\n }\n return count;\n};\nexports.matchingBitCount = matchingBitCount;\n//# sourceMappingURL=BinaryUtils.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.collapseIPv6Number = exports.expandIPv6Number = void 0;\nconst BinaryUtils_1 = require(\"./BinaryUtils\");\nconst Validator_1 = require(\"./Validator\");\nlet extractPrefix = (ipv6String) => {\n return ipv6String.includes(\"/\") ? `/${ipv6String.split(\"/\")[1]}` : \"\";\n};\nlet expandIPv6Number = (ipv6String) => {\n let expandWithZero = (hexadecimalArray) => {\n let paddedArray = hexadecimalArray.map((hexadecimal) => {\n return (0, BinaryUtils_1.leftPadWithZeroBit)(hexadecimal, 4);\n });\n return paddedArray.join(\":\");\n };\n let expandDoubleColon = (gapCount) => {\n let pads = [];\n for (let count = 0; count < gapCount; count++) {\n pads.push(\"0000\");\n }\n return pads.join(\":\");\n };\n if (/(:){3,}/.test(ipv6String))\n throw \"given IPv6 contains consecutive : more than two\";\n const prefix = extractPrefix(ipv6String);\n if (ipv6String.includes(\"/\")) {\n ipv6String = ipv6String.split(\"/\")[0];\n }\n let isValid = Validator_1.Validator.IPV6_PATTERN.test(ipv6String);\n if (!isValid) {\n throw Error(Validator_1.Validator.invalidIPv6PatternMessage);\n }\n if (ipv6String.includes(\"::\")) {\n let split = ipv6String.split(\"::\");\n let leftPortion = split[0];\n let rightPortion = split[1];\n let leftPortionSplit = leftPortion.split(\":\").filter(hexadecimal => { return hexadecimal !== \"\"; });\n let rightPortionSplit = rightPortion.split(\":\").filter(hexadecimal => { return hexadecimal !== \"\"; });\n let doublePortion = expandDoubleColon(8 - (leftPortionSplit.length + rightPortionSplit.length));\n let leftString = expandWithZero(leftPortionSplit);\n if (leftString !== \"\") {\n leftString += \":\";\n }\n let rightString = expandWithZero(rightPortionSplit);\n if (rightString !== \"\") {\n rightString = \":\" + rightString;\n }\n return `${leftString}${doublePortion}${rightString}${prefix}`;\n }\n else {\n return `${expandWithZero(ipv6String.split(\":\"))}${prefix}`;\n }\n};\nexports.expandIPv6Number = expandIPv6Number;\n// Helper function to shorten hexadecatets\nconst shortenHexadecatet = (hex) => {\n // Input hex is expected to be like \"0000\", \"0DB8\", \"001A\" from expanded form\n const withoutLeadingZero = hex.replace(/^0+/, '');\n // If hex was \"0000\", withoutLeadingZero is \"\", so return \"0\"\n // Otherwise, return the string without leading zeros.\n return withoutLeadingZero === '' ? '0' : withoutLeadingZero;\n};\nlet collapseIPv6Number = (ipv6String) => {\n const originalPrefix = extractPrefix(ipv6String);\n const processedIPv6String = ipv6String.includes(\"/\") ? ipv6String.split(\"/\")[0] : ipv6String;\n let expandedIPv6 = \"\";\n try {\n // Expand to full 8 segments, no prefix internally for processing\n let tempExpanded = (0, exports.expandIPv6Number)(processedIPv6String);\n if (tempExpanded.includes(\"/\")) {\n expandedIPv6 = tempExpanded.split(\"/\")[0];\n }\n else {\n expandedIPv6 = tempExpanded;\n }\n }\n catch (e) {\n // Propagate error if expansion fails (e.g. invalid IPv6 format)\n throw e;\n }\n let hexadecatets = expandedIPv6.split(\":\");\n if (hexadecatets.length !== 8) {\n // This case should ideally be prevented by expandIPv6Number's validation or structure.\n // If expandIPv6Number guarantees 8 segments or throws, this might not be strictly needed.\n // However, as a safeguard:\n throw new Error(`Invalid IPv6 structure after expansion: ${expandedIPv6}. Expected 8 segments.`);\n }\n let zeroSequences = [];\n let currentSequenceStart = -1;\n let currentSequenceLength = 0;\n for (let i = 0; i < 8; i++) {\n // Segments from expandIPv6Number are 4-char 0-padded, e.g., \"0000\"\n if (hexadecatets[i] === \"0000\") {\n if (currentSequenceStart === -1) {\n currentSequenceStart = i;\n }\n currentSequenceLength++;\n }\n else {\n if (currentSequenceLength > 0) {\n zeroSequences.push({ start: currentSequenceStart, length: currentSequenceLength });\n }\n currentSequenceStart = -1;\n currentSequenceLength = 0;\n }\n }\n if (currentSequenceLength > 0) { // Capture any trailing zero sequence\n zeroSequences.push({ start: currentSequenceStart, length: currentSequenceLength });\n }\n if (zeroSequences.length === 0) {\n // No zero segments at all, just shorten each hexadecatet\n return hexadecatets.map(shortenHexadecatet).join(\":\") + originalPrefix;\n }\n // Sort sequences: longest first, then earliest start first\n zeroSequences.sort((a, b) => {\n if (b.length !== a.length) {\n return b.length - a.length;\n }\n return a.start - b.start;\n });\n const bestSequence = zeroSequences[0];\n if (bestSequence.length === 8) { // All 8 segments are zero\n return \"::\" + originalPrefix;\n }\n // RFC 5952: \"The symbol \"::\" MUST NOT be used to shorten just one 16-bit 0 field.\"\n // So, length must be > 1 for \"::\" compression.\n if (bestSequence.length < 2) {\n // No \"::\" compression is applied (e.g. \"1:2:0:4:5:6:7:8\")\n return hexadecatets.map(shortenHexadecatet).join(\":\") + originalPrefix;\n }\n // Apply \"::\" compression using the bestSequence\n let leftPartSegments = hexadecatets.slice(0, bestSequence.start);\n let rightPartSegments = hexadecatets.slice(bestSequence.start + bestSequence.length);\n let leftString = leftPartSegments.map(shortenHexadecatet).join(\":\");\n let rightString = rightPartSegments.map(shortenHexadecatet).join(\":\");\n let finalStr = \"\";\n if (bestSequence.start === 0) { // Compression at the beginning: \"::...\"\n finalStr = \"::\" + rightString;\n }\n else if (bestSequence.start + bestSequence.length === 8) { // Compression at the end: \"...::\"\n // Ensure that if leftString is empty (which shouldn't happen here if start > 0), it's handled.\n // However, if bestSequence.start > 0, leftPartSegments won't be empty unless bestSequence.start is 0.\n finalStr = leftString + \"::\";\n }\n else { // Compression in the middle: \"...::...\"\n finalStr = leftString + \"::\" + rightString;\n }\n return finalStr + originalPrefix;\n};\nexports.collapseIPv6Number = collapseIPv6Number;\n//# sourceMappingURL=IPv6Utils.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.hexadectetNotationToBinaryString = exports.binaryStringToHexadecimalString = exports.colonHexadecimalNotationToBinaryString = exports.hexadecimalStringToHexadecatetString = exports.hexadecimalStringToBinaryString = exports.bigIntToHexadecimalString = void 0;\nconst IPv6Utils_1 = require(\"./IPv6Utils\");\nconst BinaryUtils_1 = require(\"./BinaryUtils\");\n/**\n * Converts a given bigint number to a hexadecimal string\n * @param num the bigint number\n * @returns {string} the hexadeciaml string\n */\nlet bigIntToHexadecimalString = (num) => {\n return num.toString(16);\n};\nexports.bigIntToHexadecimalString = bigIntToHexadecimalString;\n/**\n * Converts a number in hexadecimal (base 16) to binary string\n * @param {string} hexadecimalString the number in base 16\n * @returns {string} the number converted to base 2\n */\nlet hexadecimalStringToBinaryString = (hexadecimalString) => {\n let inDecimal = BigInt(`0x${hexadecimalString}`);\n return inDecimal.toString(2);\n};\nexports.hexadecimalStringToBinaryString = hexadecimalStringToBinaryString;\n/**\n * Converts a number in hexadecimal (base 16) to binary hexadecatet string.\n * This means the bits in the output cannot be more than 16\n *\n * @param hexadecimalString {string} the number converted to binary hexadecatet string\n */\nlet hexadecimalStringToHexadecatetString = (hexadecimalString) => {\n let binaryString = (0, exports.hexadecimalStringToBinaryString)(hexadecimalString);\n let length = binaryString.length;\n if (length > 16) {\n throw new Error(\"Given decimal in binary contains digits greater than an Hexadecatet\");\n }\n return (0, BinaryUtils_1.leftPadWithZeroBit)(binaryString, 16);\n};\nexports.hexadecimalStringToHexadecatetString = hexadecimalStringToHexadecatetString;\n/**\n * Given an IPv6 number in hexadecimal notated string, e.g 2001:0db8:0000:0000:0000:0000:0000:0000 converts it to\n * binary string\n *\n * @param hexadecimalString IPv6 string\n * @returns {string} the binary value of the given ipv6 number in string\n */\nlet colonHexadecimalNotationToBinaryString = (hexadecimalString) => {\n let expandedIPv6 = (0, IPv6Utils_1.expandIPv6Number)(hexadecimalString);\n let stringHexadecimal = expandedIPv6.split(\":\");\n return stringHexadecimal.reduce((binaryAsString, hexidecimal) => {\n return binaryAsString.concat((0, exports.hexadecimalStringToHexadecatetString)(hexidecimal));\n }, '');\n};\nexports.colonHexadecimalNotationToBinaryString = colonHexadecimalNotationToBinaryString;\n/**\n * Converts number in binary string to hexadecimal string\n * @param {string} num in binary string\n * @returns {string} num in hexadecimal string\n */\nlet binaryStringToHexadecimalString = (num) => {\n // first convert to binary string to decimal (big Integer)\n let inDecimal = BigInt(`0b${num}`);\n return inDecimal.toString(16);\n};\nexports.binaryStringToHexadecimalString = binaryStringToHexadecimalString;\n/**\n * Converts a given IPv6 number expressed in the hexadecimal string notation into a 16 bit binary number in string\n * @param {string} hexadectetString the IPv6 number\n * @returns {string} the IPv6 number converted to binary string\n */\nlet hexadectetNotationToBinaryString = (hexadectetString) => {\n let expand = (0, IPv6Utils_1.expandIPv6Number)(hexadectetString);\n let hexadecimals = expand.split(\":\");\n return hexadecimals.reduce((hexadecimalAsString, hexavalue) => {\n return hexadecimalAsString.concat((0, BinaryUtils_1.leftPadWithZeroBit)((0, exports.hexadecimalStringToBinaryString)(hexavalue), 16));\n }, '');\n};\nexports.hexadectetNotationToBinaryString = hexadectetNotationToBinaryString;\n//# sourceMappingURL=HexadecimalUtils.js.map","'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Validator = void 0;\nconst BinaryUtils_1 = require(\"./BinaryUtils\");\nconst BinaryUtils_2 = require(\"./BinaryUtils\");\nconst IPv6Utils_1 = require(\"./IPv6Utils\");\nconst HexadecimalUtils_1 = require(\"./HexadecimalUtils\");\nconst HexadecimalUtils_2 = require(\"./HexadecimalUtils\");\nclass Validator {\n /**\n * Checks if given ipNumber is in between the given lower and upper bound\n *\n * @param ipNumber ipNumber to check\n * @param lowerBound lower bound\n * @param upperBound upper bound\n * @returns {boolean} true if ipNumber is between lower and upper bound\n */\n static isWithinRange(ipNumber, lowerBound, upperBound) {\n return ipNumber >= lowerBound && ipNumber <= upperBound;\n }\n /**\n * Checks if the number given is within the value considered valid for an ASN number\n *\n * @param asnNumber the asn number to validate\n * @returns {[boolean , string]} first value is true if valid ASN, false otherwise. Second value contains\n * \"valid\" or an error message when value is invalid\n */\n static isValidAsnNumber(asnNumber) {\n let isValid = this.isWithinRange(asnNumber, 0n, this.THIRTY_TWO_BIT_SIZE);\n return [isValid, isValid ? [] : [Validator.invalidAsnRangeMessage]];\n }\n /**\n * Checks if the given ASN number is a 16bit ASN number\n *\n * @param {bigint} asnNumber to check if 16bit or not\n * @returns {[boolean , string]} first value is true if valid 16bit ASN, false otherwise. Second value contains\n * \"valid\" or an error message when value is invalid\n */\n static isValid16BitAsnNumber(asnNumber) {\n let isValid = Validator.isWithinRange(asnNumber, 0n, Validator.SIXTEEN_BIT_SIZE);\n return [isValid, isValid ? [] : [Validator.invalid16BitAsnRangeMessage]];\n }\n /**\n * Checks if the number given is within the value considered valid for an IPv4 number\n *\n * @param ipv4Number the asn number to validate\n * @returns {[boolean , string]} first value is true if valid IPv4 number, false otherwise. Second value contains\n * \"valid\" or an error message when value is invalid\n */\n static isValidIPv4Number(ipv4Number) {\n ipv4Number = typeof ipv4Number === \"bigint\" ? ipv4Number : BigInt(ipv4Number);\n let isValid = this.isWithinRange(ipv4Number, 0n, this.THIRTY_TWO_BIT_SIZE);\n return isValid ? [isValid, []] : [isValid, [Validator.invalidIPv4NumberMessage]];\n }\n /**\n * Checks if the number given is within the value considered valid for an IPv6 number\n *\n * @param ipv6Number the asn number to validate\n * @returns {[boolean , string]} first value is true if valid IPv6 number, false otherwise. Second value contains\n * \"valid\" or an error message when value is invalid\n */\n static isValidIPv6Number(ipv6Number) {\n let isValid = this.isWithinRange(ipv6Number, 0n, this.ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_SIZE);\n return isValid ? [isValid, []] : [isValid, [Validator.invalidIPv6NumberMessage]];\n }\n /**\n * Checks if the number given is valid for an IPv4 octet\n *\n * @param octetNumber the octet value\n * @returns {boolean} true if valid octet, false otherwise\n */\n static isValidIPv4Octet(octetNumber) {\n let withinRange = this.isWithinRange(octetNumber, 0n, this.EIGHT_BIT_SIZE);\n return [withinRange, withinRange ? [] : [Validator.invalidOctetRangeMessage]];\n }\n /**\n * Checks if the number given is valid for an IPv6 hexadecatet\n *\n * @param {bigint} hexadecatetNum the hexadecatet value\n * @returns {[boolean , string]} first value is true if valid hexadecatet, false otherwise. Second value contains\n * \"valid\" or an error message when value is invalid\n */\n static isValidIPv6Hexadecatet(hexadecatetNum) {\n let isValid = this.isWithinRange(hexadecatetNum, 0n, this.SIXTEEN_BIT_SIZE);\n return isValid ? [isValid, []] : [isValid, [Validator.invalidHexadecatetMessage]];\n }\n /**\n * Checks if given string is a valid IPv4 value.\n *\n * @param {string} ipv4String the IPv4 string to validate\n * @returns {[boolean , string]} result of validation, first value represents if is valid IPv4, second value\n * contains error message if invalid IPv4\n */\n static isValidIPv4String(ipv4String) {\n let rawOctets = ipv4String.split(\".\");\n if (rawOctets.length != 4 || rawOctets.includes('')) {\n return [false, [Validator.invalidOctetCountMessage]];\n }\n let isValid = rawOctets.every(octet => {\n return Validator.isNumeric(octet) ? Validator.isValidIPv4Octet(BigInt(octet))[0] : false;\n });\n if (!isValid) {\n return [false, [Validator.invalidOctetRangeMessage]];\n }\n isValid = Validator.IPV4_PATTERN.test(ipv4String);\n return [isValid, isValid ? [] : [Validator.invalidIPv4PatternMessage]];\n }\n /**\n * Checks if given string is a valid IPv6 value.\n *\n * @param {string} ipv6String the IPv6 string to validate\n * @returns {[boolean , string]} result of validation, first value represents if is valid IPv6, second value\n * contains error message if invalid IPv6\n */\n static isValidIPv6String(ipv6String) {\n try {\n let hexadecimals = (0, IPv6Utils_1.expandIPv6Number)(ipv6String).split(\":\");\n if (hexadecimals.length != 8) {\n return [false, [Validator.invalidHexadecatetCountMessage]];\n }\n let isValid = hexadecimals.every(hexadecimal => {\n return Validator.isHexadecatet(hexadecimal) ?\n Validator.isValidIPv6Hexadecatet(BigInt(`0x${hexadecimal}`))[0] : false;\n });\n if (!isValid) {\n return [false, [Validator.invalidHexadecatetMessage]];\n }\n isValid = Validator.IPV6_PATTERN.test(ipv6String);\n return [isValid, isValid ? [] : [Validator.invalidIPv6PatternMessage]];\n }\n catch (error) {\n return [false, [String(error)]];\n }\n }\n /**\n * Checks if given value is a valid prefix value\n *\n * @param prefixValue value to check\n * @param ipNumType The type of IP number\n * @returns {(boolean|string)[]} a tuple representing if valid or not and corresponding message\n */\n static isValidPrefixValue(prefixValue, ipNumType) {\n if (\"IPv4\" /* IPNumType.IPv4 */ === ipNumType) {\n let withinRange = Validator.isWithinRange(BigInt(prefixValue), 0n, 32n);\n return [withinRange, withinRange ? [] : [Validator.invalidPrefixValueMessage]];\n }\n if (\"IPv6\" /* IPNumType.IPv6 */ === ipNumType) {\n let withinRange = Validator.isWithinRange(BigInt(prefixValue), 0n, 128n);\n return [withinRange, withinRange ? [] : [Validator.invalidPrefixValueMessage]];\n }\n return [false, [Validator.invalidInetNumType]];\n }\n /**\n * Checks if given string is a valid IPv4 mask\n *\n * @param {string} ipv4MaskString the given IPv4 mask string\n * @returns {[boolean , string]} first value is true if valid IPv4 mask string, false otherwise. Second value\n * contains \"valid\" or an error message when value is invalid\n */\n static isValidIPv4Mask(ipv4MaskString) {\n let ipv4InBinary = (0, BinaryUtils_1.dottedDecimalNotationToBinaryString)(ipv4MaskString);\n let isValid = Validator.IPV4_CONTIGUOUS_MASK_BIT_PATTERN.test(ipv4InBinary);\n return isValid ? [isValid, []] : [isValid, [Validator.invalidMaskMessage]];\n }\n /**\n * Checks if given string is a valid IPv6 mask\n *\n * @param {string} ipv6MaskString the given IPv6 mask string\n * @returns {[boolean , string]} first value is true if valid IPv6 mask string, false otherwise. Second value\n * contains \"valid\" or an error message when value is invalid\n */\n static isValidIPv6Mask(ipv6MaskString) {\n let ipv6InBinary = (0, HexadecimalUtils_2.hexadectetNotationToBinaryString)(ipv6MaskString);\n let isValid = Validator.IPV6_CONTIGUOUS_MASK_BIT_PATTERN.test(ipv6InBinary);\n return isValid ? [isValid, []] : [isValid, [Validator.invalidMaskMessage]];\n }\n /**\n * Checks if the given string is a valid IPv4 range in Cidr notation\n *\n * @param {string} ipv4RangeAsCidrString the IPv4 range in Cidr notation\n *\n * @returns {[boolean , string[]]} first value is true if valid IPv4 range in Cidr notation, false otherwise. Second\n * value contains \"valid\" or an error message when value is invalid\n */\n static isValidIPv4CidrNotation(ipv4RangeAsCidrString) {\n let cidrComponents = ipv4RangeAsCidrString.split(\"/\");\n if (cidrComponents.length !== 2 || (cidrComponents[0].length === 0 || cidrComponents[1].length === 0)) {\n return [false, [Validator.invalidIPv4CidrNotationMessage]];\n }\n let ip = cidrComponents[0];\n let range = cidrComponents[1];\n if (!/^\\d+$/.test(range)) {\n return [false, [Validator.invalidIPv4CidrNotationMessage]];\n }\n if (isNaN(Number(range))) {\n return [false, [Validator.invalidIPv4CidrNotationMessage]];\n }\n let [validIpv4, invalidIpv4Message] = Validator.isValidIPv4String(ip);\n let [validPrefix, invalidPrefixMessage] = Validator.isValidPrefixValue(BigInt(range), \"IPv4\" /* IPNumType.IPv4 */);\n let isValid = validIpv4 && validPrefix;\n let invalidMessage = invalidIpv4Message.concat(invalidPrefixMessage);\n return isValid ? [isValid, []] : [isValid, invalidMessage];\n }\n /**\n * Checks if the given string is a valid IPv4 range in Cidr notation, with the ip number in the cidr notation\n * being the start of the range\n *\n * @param {string} ipv4CidrNotation the IPv4 range in Cidr notation\n *\n * * @returns {[boolean , string[]]} first value is true if valid Cidr notation, false otherwise. Second\n * value contains [] or an array of error message when invalid\n */\n static isValidIPv4CidrRange(ipv4CidrNotation) {\n return Validator.isValidCidrRange(ipv4CidrNotation, Validator.isValidIPv4CidrNotation, BinaryUtils_1.dottedDecimalNotationToBinaryString, (value) => (0, BinaryUtils_2.cidrPrefixToMaskBinaryString)(value, \"IPv4\" /* IPNumType.IPv4 */));\n }\n /**\n * Checks if the given string is a valid IPv6 range in Cidr notation, with the ip number in the cidr notation\n * being the start of the range\n *\n * @param {string} ipv6CidrNotation the IPv6 range in Cidr notation\n *\n * * @returns {[boolean , string[]]} first value is true if valid Cidr notation, false otherwise. Second\n * value contains [] or an array of error message when invalid\n */\n static isValidIPv6CidrRange(ipv6CidrNotation) {\n return Validator.isValidCidrRange(ipv6CidrNotation, Validator.isValidIPv6CidrNotation, HexadecimalUtils_1.colonHexadecimalNotationToBinaryString, (value) => (0, BinaryUtils_2.cidrPrefixToMaskBinaryString)(value, \"IPv6\" /* IPNumType.IPv6 */));\n }\n static isValidCidrRange(rangeString, cidrNotationValidator, toBinaryStringConverter, prefixFactory) {\n let validationResult = cidrNotationValidator(rangeString);\n if (!validationResult[0]) {\n return validationResult;\n }\n let cidrComponents = rangeString.split(\"/\");\n let ip = cidrComponents[0];\n let range = cidrComponents[1];\n let ipNumber = BigInt(`0b${toBinaryStringConverter(ip)}`);\n let mask = BigInt(`0b${prefixFactory(parseInt(range))}`);\n let isValid = (ipNumber & (mask)) === (ipNumber);\n return isValid ? [isValid, []] : [isValid, [Validator.InvalidIPCidrRangeMessage]];\n }\n static isValidIPv4RangeString(ipv4RangeString) {\n let firstLastValidator = (firstIP, lastIP) => BigInt(`0b${(0, BinaryUtils_1.dottedDecimalNotationToBinaryString)(firstIP)}`)\n >= BigInt(`0b${(0, BinaryUtils_1.dottedDecimalNotationToBinaryString)(lastIP)}`);\n return this.isValidRange(ipv4RangeString, Validator.isValidIPv4String, firstLastValidator);\n }\n static isValidIPv6RangeString(ipv6RangeString) {\n let firstLastValidator = (firstIP, lastIP) => BigInt(`0b${(0, HexadecimalUtils_2.hexadectetNotationToBinaryString)(firstIP)}`)\n >= BigInt(`0b${(0, HexadecimalUtils_2.hexadectetNotationToBinaryString)(lastIP)}`);\n return this.isValidRange(ipv6RangeString, Validator.isValidIPv6String, firstLastValidator);\n }\n static isValidRange(rangeString, validator, firstLastValidator) {\n let rangeComponents = rangeString.split(\"-\").map(component => component.trim());\n if (rangeComponents.length !== 2 || (rangeComponents[0].length === 0 || rangeComponents[1].length === 0)) {\n return [false, [Validator.invalidRangeNotationMessage]];\n }\n let firstIP = rangeComponents[0];\n let lastIP = rangeComponents[1];\n let [validFirstIP, invalidFirstIPMessage] = validator(firstIP);\n let [validLastIP, invalidLastIPMessage] = validator(lastIP);\n let isValid = validFirstIP && validLastIP;\n if (isValid && firstLastValidator(firstIP, lastIP)) {\n return [false, [Validator.invalidRangeFirstNotGreaterThanLastMessage]];\n }\n let invalidMessage = invalidFirstIPMessage.concat(invalidLastIPMessage);\n return isValid ? [isValid, []] : [isValid, invalidMessage];\n }\n /**\n * Checks if the given string is a valid IPv6 range in Cidr notation\n *\n * @param {string} ipv6RangeAsCidrString the IPv6 range in Cidr notation\n *\n * @returns {[boolean , string]} first value is true if valid IPv6 range in Cidr notation, false otherwise.\n * Second value contains \"valid\" or an error message when value is invalid\n */\n // TODO change to be like isValidIPv4CidrNotation where validation is done on the component of the cidr notation\n // instead of a single regex check\n static isValidIPv6CidrNotation(ipv6RangeAsCidrString) {\n let isValid = Validator.IPV6_RANGE_PATTERN.test(ipv6RangeAsCidrString);\n return isValid ? [isValid, []] : [isValid, [Validator.invalidIPv6CidrNotationString]];\n }\n /**\n * Checks if the given string is a binary string. That is contains only contiguous 1s and 0s\n *\n * @param {string} binaryString the binary string\n * @returns {(boolean|string)[]} a tuple representing if valid or not and corresponding message\n */\n static isValidBinaryString(binaryString) {\n if (/^([10])+$/.test(binaryString)) {\n return [true, []];\n }\n else {\n return [false, [Validator.invalidBinaryStringErrorMessage]];\n }\n }\n static isNumeric(value) {\n return /^(\\d+)$/.test(value);\n }\n static isHexadecatet(value) {\n return /^[0-9A-Fa-f]{4}$/.test(value);\n }\n}\nexports.Validator = Validator;\nValidator.IPV4_PATTERN = new RegExp(/^(0?[0-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.(0?[0-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.(0?[0-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.(0?[0-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$/);\n// source: https://community.helpsystems.com/forums/intermapper/miscellaneous-topics/5acc4fcf-fa83-e511-80cf-0050568460e4\nValidator.IPV6_PATTERN = new RegExp(/^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((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|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?$/);\nValidator.IPV4_CONTIGUOUS_MASK_BIT_PATTERN = new RegExp(/^(1){0,32}(0){0,32}$/);\nValidator.IPV6_CONTIGUOUS_MASK_BIT_PATTERN = new RegExp(/^(1){0,128}(0){0,128}$/);\nValidator.EIGHT_BIT_SIZE = BigInt(`0b${\"1\".repeat(8)}`);\nValidator.SIXTEEN_BIT_SIZE = BigInt(`0b${\"1\".repeat(16)}`);\nValidator.THIRTY_TWO_BIT_SIZE = BigInt(`0b${\"1\".repeat(32)}`);\nValidator.ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_SIZE = BigInt(`0b${\"1\".repeat(128)}`);\nValidator.IPV4_SIZE = BigInt(\"4294967296\");\nValidator.IPV6_SIZE = BigInt(\"340282366920938463463374607431768211456\");\nValidator.invalidAsnRangeMessage = \"ASN number given less than zero or is greater than 32bit\";\nValidator.invalid16BitAsnRangeMessage = \"ASN number given less than zero or is greater than 16bit\";\nValidator.invalidIPv4NumberMessage = \"IPv4 number given less than zero or is greater than 32bit\";\nValidator.invalidIPv6NumberMessage = \"IPv6 number given less than zero or is greater than 128bit\";\nValidator.invalidOctetRangeMessage = \"Value given contains an invalid Octet; Value is less than zero or is greater than 8bit\";\nValidator.invalidHexadecatetMessage = \"The value given is less than zero or is greater than 16bit\";\nValidator.invalidOctetCountMessage = \"An IP4 number cannot have less or greater than 4 octets\";\nValidator.invalidHexadecatetCountMessage = \"An IP6 number must have exactly 8 hexadecatet\";\nValidator.invalidMaskMessage = \"The Mask is invalid\";\nValidator.invalidPrefixValueMessage = \"A Prefix value cannot be less than 0 or greater than 32\";\nValidator.invalidIPv4CidrNotationMessage = \"Cidr notation should be in the form [ip number]/[range]\";\nValidator.InvalidIPCidrRangeMessage = \"Given IP number portion must is not the start of the range\";\nValidator.invalidRangeNotationMessage = \"Range notation should be in the form [first ip]-[last ip]\";\nValidator.invalidRangeFirstNotGreaterThanLastMessage = \"First IP in [first ip]-[last ip] must be less than Last IP\";\nValidator.invalidIPv6CidrNotationString = \"A Cidr notation string should contain an IPv6 number and prefix\";\nValidator.takeOutOfRangeSizeMessage = \"$count is greater than $size, the size of the range\";\nValidator.cannotSplitSingleRangeErrorMessage = \"Cannot split an IP range with a single IP number\";\nValidator.invalidInetNumType = \"Given ipNumType must be either InetNumType.IPv4 or InetNumType.IPv6\";\nValidator.invalidBinaryStringErrorMessage = \"Binary string should contain only contiguous 1s and 0s\";\nValidator.invalidIPRangeSizeMessage = \"Given size is zero or greater than maximum size of $iptype\";\nValidator.invalidIPRangeSizeForCidrMessage = \"Given size can't be created via cidr prefix\";\nValidator.invalidIPv4PatternMessage = \"Given IPv4 is not confirm to a valid IPv6 address\";\nValidator.invalidIPv6PatternMessage = \"Given IPv6 is not confirm to a valid IPv6 address\";\n//# sourceMappingURL=Validator.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Hexadecatet = void 0;\nconst Validator_1 = require(\"./Validator\");\n/**\n * A representation of a 4-digit hexadecimal number.\n *\n * It consists of four (base 16) number. ie FFFF\n *\n * It is used to represents the components of an IPv6 address\n */\nclass Hexadecatet {\n /**\n * A convenience method for constructing an instance of {@link Hexadecatet} from a four (base 16) number\n * representation of a 16bit value.\n *\n * @param {string} rawValue the four (base 16) number\n * @returns {Hexadecatet} an instance of {@link Hexadecatet}\n */\n static fromString(rawValue) {\n return new Hexadecatet(rawValue);\n }\n ;\n /**\n * A convenience method for constructing an instance of {@link Hexadecatet} from a decimal number representation\n * of a 16 bit value\n *\n * @param {number} rawValue decimal number representation of a 16 bit value\n * @returns {Hexadecatet} an instance of {@link Hexadecatet}\n */\n static fromNumber(rawValue) {\n return new Hexadecatet(rawValue);\n }\n ;\n /**\n * Constructor for creating an instance of {@link Hexadecatet}\n *\n * @param {string | number} givenValue a string or numeric value. If given value is a string then it should be a\n * four (base 16) number representation of a 16bit value. If it is a number, then it should be a decimal number\n * representation of a 16 bit value\n */\n constructor(givenValue) {\n let hexadecatetValue;\n if (typeof givenValue === 'string') {\n hexadecatetValue = parseInt(givenValue, 16);\n }\n else {\n hexadecatetValue = parseInt(String(givenValue), 16);\n }\n let [isValid, message] = Validator_1.Validator.isValidIPv6Hexadecatet(BigInt(hexadecatetValue));\n if (!isValid) {\n throw Error(message.filter(msg => { return msg !== ''; }).toString());\n }\n this.value = hexadecatetValue;\n }\n /**\n * Returns the numeric value in base 10 (ie decimal)\n *\n * @returns {number} the numeric value in base 10 (ie decimal)\n */\n getValue() {\n return this.value;\n }\n /**\n * Returns the string representation of the base 16 representation of the value\n * @returns {string} the string representation of the base 16 representation of the value\n */\n // TODO pad with a zero if digit is less than 4\n toString() {\n return this.value.toString(16);\n }\n}\nexports.Hexadecatet = Hexadecatet;\n//# sourceMappingURL=Hexadecatet.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Octet = void 0;\nconst Validator_1 = require(\"./Validator\");\n/**\n * A binary representation of a 8 bit value.\n *\n * {@see https://en.wikipedia.org/wiki/Octet_(computing)} for more information on Octets\n *\n * An octet is used in the textual representation of an {@link IPv4} number, where the IP number value is divided\n * into 4 octets\n */\nclass Octet {\n /**\n * Convenience method for creating an Octet out of a string value representing the value of the octet\n *\n * @param {string} rawValue the octet value in string\n * @returns {Octet} the Octet instance\n */\n static fromString(rawValue) {\n return new Octet(rawValue);\n }\n ;\n /**\n * Convenience method for creating an Octet out of a numeric value representing the value of the octet\n *\n * @param {number} rawValue the octet value in number\n * @returns {Octet} the Octet instance\n */\n static fromNumber(rawValue) {\n return new Octet(rawValue);\n }\n ;\n /**\n * Constructor for creating an instance of an Octet.\n *\n * The constructor parameter given could either be a string or number.\n *\n * If a string, it is the string representation of the numeric value of the octet\n * If a number, it is the numeric representation of the value of the octet\n *\n * @param {string | number} givenValue value of the octet to be created.\n */\n constructor(givenValue) {\n let octetValue;\n if (typeof givenValue === 'string') {\n octetValue = parseInt(givenValue);\n }\n else {\n octetValue = givenValue;\n }\n let [isValid, message] = Validator_1.Validator.isValidIPv4Octet(BigInt(octetValue));\n if (!isValid) {\n throw Error(message.filter(msg => { return msg !== ''; }).toString());\n }\n this.value = octetValue;\n }\n /**\n * Method to get the numeric value of the octet\n *\n * @returns {number} the numeric value of the octet\n */\n getValue() {\n return this.value;\n }\n /**\n * Returns a decimal representation of the value of the octet in string\n *\n * @returns {string} a decimal representation of the value of the octet in string\n */\n toString() {\n return this.value.toString(10);\n }\n}\nexports.Octet = Octet;\n//# sourceMappingURL=Octet.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.IPv6Mask = exports.IPv4Mask = exports.IPv6 = exports.Asn = exports.IPv4 = exports.AbstractIPNum = void 0;\nexports.isIPv4 = isIPv4;\nconst Octet_1 = require(\"./Octet\");\nconst Validator_1 = require(\"./Validator\");\nconst BinaryUtils_1 = require(\"./BinaryUtils\");\nconst BinaryUtils_2 = require(\"./BinaryUtils\");\nconst BinaryUtils_3 = require(\"./BinaryUtils\");\nconst BinaryUtils_4 = require(\"./BinaryUtils\");\nconst Hexadecatet_1 = require(\"./Hexadecatet\");\nconst HexadecimalUtils_1 = require(\"./HexadecimalUtils\");\nconst IPv6Utils_1 = require(\"./IPv6Utils\");\nconst HexadecimalUtils_2 = require(\"./HexadecimalUtils\");\n/**\n * Provides the implementation of functionality that are common\n * to {@link IPv4}, {@link IPv6}, {@link IPv4Mask} and {@link IPv6Mask}\n */\nclass AbstractIPNum {\n /**\n * Gets the numeric value of an IP number as {@link BigInt}\n *\n * @returns bigInt the numeric value of an IP number.\n */\n getValue() {\n return this.value;\n }\n /**\n * Gets the binary string representation of an IP number.\n *\n * @returns {string} the string binary representation.\n */\n toBinaryString() {\n return (0, BinaryUtils_3.leftPadWithZeroBit)(this.value.toString(2), this.bitSize);\n }\n /**\n * Checks if an IP number has a value greater than the present value\n * @returns {boolean} true, if there is a value greater than the present value. Returns false otherwise.\n */\n hasNext() {\n return this.value < this.maximumBitSize;\n }\n /**\n * Checks if an IP number has a value lesser than the present value\n * @returns {boolean} true, if there is a value lesser than the present value. Returns false otherwise.\n */\n hasPrevious() {\n return this.value > 0n;\n }\n /**\n * Checks if the given IP number, is equals to the current IP number\n *\n * @param {AbstractIPNum} anotherIPNum the other IP number to compare with\n * @returns {boolean} true if the given IP number is equals\n */\n isEquals(anotherIPNum) {\n return this.value === anotherIPNum.value;\n }\n /**\n * Checks if the given IP number is lesser than this current IP number\n *\n * @param {AbstractIPNum} anotherIPNum the other IP number to compare with\n * @returns {boolean} true if the given IP number is less than this current one. False otherwise.\n */\n isLessThan(anotherIPNum) {\n return this.value < anotherIPNum.value;\n }\n /**\n * Checks if the given IP number is greater than this current IP number\n *\n * @param {AbstractIPNum} anotherIPNum the other IP number to compare with\n * @returns {boolean} true if the given IP number is greater than this current one. False otherwise.\n */\n isGreaterThan(anotherIPNum) {\n return this.value > anotherIPNum.value;\n }\n /**\n * Checks if the given IP number is less than or equals to this current IP number\n *\n * @param {AbstractIPNum} anotherIPNum the other IP number to compare with\n * @returns {boolean} true if the given IP number is less than or equals to this current one. False otherwise.\n */\n isLessThanOrEquals(anotherIPNum) {\n return this.value <= anotherIPNum.value;\n }\n /**\n * Checks if the given IP number is greater than or equals to this current IP number\n *\n * @param {AbstractIPNum} anotherIPNum the other IP number to compare with\n * @returns {boolean} {boolean} true if the given IP number is greater than or equals to this current one. False\n * otherwise.\n */\n isGreaterThanOrEquals(anotherIPNum) {\n return this.value >= anotherIPNum.value;\n }\n}\nexports.AbstractIPNum = AbstractIPNum;\n/**\n * Represents an IPv4 number. A 32 bit number that is used to uniquely identify a device that is part of a computer\n * network that uses the internet protocol for communication.\n *\n * @see https://en.wikipedia.org/wiki/IPv4\n * @see https://www.rfc-editor.org/info/rfc791\n */\nclass IPv4 extends AbstractIPNum {\n /**\n * A convenience method for creating an {@link IPv4} by providing the decimal value of the IP number in BigInt\n *\n * @param {bigint} bigIntValue the decimal value of the IP number in BigInt\n * @returns {IPv4} the IPv4 instance\n */\n static fromNumber(bigIntValue) {\n return new IPv4(bigIntValue);\n }\n /**\n * A convenience method for creating an {@link IPv4} by providing the IP number in dot-decimal notation. E.g\n * \"10.1.1.10\"\n *\n * {@see https://en.wikipedia.org/wiki/Dot-decimal_notation} for more information on dot-decimal notation.\n *\n * @param {string} ipString the IP number in dot-decimal notation\n * @returns {IPv4} the IPv4 instance\n */\n static fromDecimalDottedString(ipString) {\n return new IPv4(ipString);\n }\n /**\n * Alias for IPv4.fromDecimalDottedString.\n *\n * @param {string} ipString the IP number in dot-decimal notation\n * @returns {IPv4} the IPv4 instance\n */\n static fromString(ipString) {\n return IPv4.fromDecimalDottedString(ipString);\n }\n /**\n * A convenience method for creating an {@link IPv4} from binary string\n *\n * @param {string} ipBinaryString the binary string representing the IPv4 number to be created\n * @returns {IPv4} the IPv4 instance\n */\n static fromBinaryString(ipBinaryString) {\n let validationResult = Validator_1.Validator.isValidBinaryString(ipBinaryString);\n if (validationResult[0]) {\n return new IPv4((0, BinaryUtils_2.parseBinaryStringToBigInt)(ipBinaryString));\n }\n else {\n throw Error(validationResult[1].join(','));\n }\n }\n /**\n * Constructor for an IPv4 number.\n *\n * @param {string | bigint} ipValue value to construct an IPv4 from. The given value can either be\n * numeric or string. If a string is given then it needs to be in dot-decimal notation\n */\n constructor(ipValue) {\n super();\n /**\n * The number of bits needed to represents the value of the IPv4 number\n */\n this.bitSize = 32;\n /**\n * The maximum bit size (i.e. binary value) of the IPv4 number in BigInt\n */\n this.maximumBitSize = Validator_1.Validator.THIRTY_TWO_BIT_SIZE;\n /**\n * The type of IP number. Value is one of the values of the {@link IPNumType} enum\n * @type {IPNumType} the type of IP number\n */\n this.type = \"IPv4\" /* IPNumType.IPv4 */;\n /**\n * An array of {@link Octet}'s\n *\n * @type {Array} the octets that makes up the IPv4 number\n */\n this.octets = [];\n /**\n * The string character used to separate the individual octets when the IPv4 is rendered as strings\n *\n * @type {string} The string character used to separate the individual octets when rendered as strings\n */\n this.separator = \".\";\n if (typeof ipValue === \"string\") {\n let [value, octets] = this.constructFromDecimalDottedString(ipValue);\n this.value = value;\n this.octets = octets;\n }\n else {\n let [value, octets] = this.constructFromBigIntValue(ipValue);\n this.value = value;\n this.octets = octets;\n }\n }\n /**\n * A string representation of the IPv4 number. The string representation is in dot-decimal notation\n *\n * @returns {string} The string representation in dot-decimal notation\n */\n toString() {\n return this.octets.map((value) => { return value.toString(); }).join(this.separator);\n }\n /**\n * Gets the individual {@link Octet} that makes up the IPv4 number\n *\n * @returns {Array} The individual {@link Octet} that makes up the IPv4 number\n */\n getOctets() {\n return this.octets;\n }\n /**\n * Returns the next IPv4 number\n *\n * @returns {IPv4} the next IPv4 number\n */\n nextIPNumber() {\n return IPv4.fromNumber(this.getValue() + 1n);\n }\n /**\n * Returns the previous IPv4 number\n *\n * @returns {IPv4} the previous IPv4 number\n */\n previousIPNumber() {\n return IPv4.fromNumber(this.getValue() - 1n);\n }\n /**\n * Returns this IPv4 number as a IPv4-Mapped IPv6 Address\n *\n * The IPv4-Mapped IPv6 Address allows an IPv4 number to be embedded within an IPv6 number\n *\n * {@see https://tools.ietf.org/html/rfc4291#section-2.5.5} for more information on the IPv4-Mapped IPv6 Address\n *\n * @returns {IPv6} an IPv6 number with the IPv4 embedded within it\n */\n toIPv4MappedIPv6() {\n let binary = '1'.repeat(16) + this.toBinaryString();\n return IPv6.fromBinaryString(binary);\n }\n constructFromDecimalDottedString(ipString) {\n let octets;\n let value;\n let [isValid, message] = Validator_1.Validator.isValidIPv4String(ipString);\n if (!isValid) {\n throw new Error(message.filter(msg => { return msg !== ''; }).toString());\n }\n let stringOctets = ipString.split(\".\");\n octets = stringOctets.map((rawOctet) => {\n return Octet_1.Octet.fromString(rawOctet);\n });\n value = BigInt(`0b${(0, BinaryUtils_1.dottedDecimalNotationToBinaryString)(ipString)}`);\n return [value, octets];\n }\n constructFromBigIntValue(ipv4Number) {\n let [isValid, message] = Validator_1.Validator.isValidIPv4Number(ipv4Number);\n if (!isValid) {\n throw new Error(message.filter(msg => { return msg !== ''; }).toString());\n }\n let binaryString = (0, BinaryUtils_4.numberToBinaryString)(ipv4Number);\n ipv4Number = typeof ipv4Number === \"bigint\" ? ipv4Number : BigInt(ipv4Number);\n return [ipv4Number, this.binaryStringToDecimalOctets(binaryString)];\n }\n binaryStringToDecimalOctets(ipv4BinaryString) {\n if (ipv4BinaryString.length < 32) {\n ipv4BinaryString = (0, BinaryUtils_3.leftPadWithZeroBit)(ipv4BinaryString, 32);\n }\n let octets = ipv4BinaryString.match(/.{1,8}/g);\n return octets.map((octet) => {\n return Octet_1.Octet.fromString((0, BinaryUtils_2.parseBinaryStringToBigInt)(octet).toString());\n });\n }\n}\nexports.IPv4 = IPv4;\n/**\n * Represents an Autonomous System Number. Which is a number that is used to identify\n * a group of IP addresses with a common, clearly defined routing policy.\n *\n * @see https://en.wikipedia.org/wiki/Autonomous_system_(Internet)\n * @see https://tools.ietf.org/html/rfc5396\n */\nclass Asn extends AbstractIPNum {\n /**\n * A convenience method for creating an instance of {@link Asn} from a string\n *\n * The given string can be in asplain, asdot or asdot+ representation format.\n * {@see https://tools.ietf.org/html/rfc5396} for more information on\n * the different ASN string representation\n *\n * @param {string} rawValue the asn string. In either asplain, asdot or asdot+ format\n * @returns {Asn} the constructed ASN instance\n */\n static fromString(rawValue) {\n return new Asn(rawValue);\n }\n ;\n /**\n * A convenience method for creating an instance of {@link Asn} from a numeric value\n *\n * @param {number} rawValue the asn numeric value\n * @returns {Asn} the constructed ASN instance\n */\n static fromNumber(rawValue) {\n return new Asn(rawValue);\n }\n ;\n /**\n * A convenience method for creating an instance of {@link Asn} from a binary string\n *\n * @param {string} binaryString to create an ASN instance from\n * @returns {Asn} the constructed ASN instance\n */\n static fromBinaryString(binaryString) {\n let validationResult = Validator_1.Validator.isValidBinaryString(binaryString);\n if (validationResult[0]) {\n return new Asn(parseInt(binaryString, 2));\n }\n else {\n throw Error(validationResult[1].join(','));\n }\n }\n /**\n * Constructor for an instance of {@link ASN}\n *\n * @param {string | number} rawValue value to construct an ASN from. The given value can either be numeric or\n * string. If in string then it can be in asplain, asdot or asdot+ string representation format\n */\n constructor(rawValue) {\n super();\n /**\n * The number of bits needed to represents the value of the ASN number\n */\n this.bitSize = 32;\n /**\n * The maximum bit size (i.e. binary value) of the ASN number in BigInt\n */\n this.maximumBitSize = Validator_1.Validator.THIRTY_TWO_BIT_SIZE;\n this.type = \"ASN\" /* IPNumType.ASN */;\n if (typeof rawValue === 'string') {\n if (Asn.startWithASPrefix(rawValue)) {\n this.value = BigInt(parseInt(rawValue.substring(2)));\n }\n else if (rawValue.indexOf(\".\") != -1) {\n this.value = BigInt(this.parseFromDotNotation(rawValue));\n }\n else {\n this.value = BigInt(parseInt(rawValue));\n }\n }\n else {\n let valueAsBigInt = BigInt(rawValue);\n let [isValid, message] = Validator_1.Validator.isValidAsnNumber(valueAsBigInt);\n if (!isValid) {\n throw Error(message.filter(msg => { return msg !== ''; }).toString());\n }\n this.value = valueAsBigInt;\n }\n }\n /**\n * A string representation where the asn value is prefixed by \"ASN\". For example \"AS65526\"\n *\n * @returns {string} A string representation where the asn value is prefixed by \"ASN\"\n */\n toString() {\n let stringValue = this.value.toString();\n return `${Asn.AS_PREFIX}${stringValue}`;\n }\n /**\n * A string representation where the ASN numeric value of is represented as a string. For example \"65526\"\n *\n * @returns {string} A string representation where the ASN numeric value of is represented as a string\n */\n toASPlain() {\n return this.value.toString();\n }\n /**\n * A string representation where the ASN value is represented using the asplain notation if the ASN value is\n * less than 65536 and uses asdot+ notation when the value is greater than 65536.\n *\n * For example 65526 will be represented as \"65526\" while 65546 will be represented as \"1.10\"\n *\n *\n * @returns {string} A string representation of the ASN in either asplain or asdot+ notation depending on\n * whether the numeric value of the ASN number is greater than 65526 or not.\n */\n toASDot() {\n if (this.value.valueOf() >= 65536n) {\n return this.toASDotPlus();\n }\n return this.toASPlain();\n }\n /**\n * A string representation where the ASN value is represented using the asdot+ notation\n *\n * @returns {string} A string representation where the ASN value is represented using the asdot+ notation\n *\n */\n toASDotPlus() {\n let high = this.value.valueOf() / 65535n;\n let low = (this.value.valueOf() % 65535n) - high;\n return `${high}.${low}`;\n }\n /**\n * Converts the ASN value to binary numbers represented with strings\n *\n * @returns {string} a binary string representation of the value of the ASN number\n */\n toBinaryString() {\n return (0, BinaryUtils_4.numberToBinaryString)(this.value);\n }\n /**\n * Checks if the ASN value is 16bit\n *\n * @returns {boolean} true if the ASN is a 16bit value. False otherwise.\n */\n is16Bit() {\n let [valid16BitAsnNumber,] = Validator_1.Validator.isValid16BitAsnNumber(this.value);\n return valid16BitAsnNumber;\n }\n /**\n * Checks if the ASN value is 32bit\n *\n * @returns {boolean} true if the ASN is a 32bit value. False otherwise.\n */\n is32Bit() {\n return !this.is16Bit();\n }\n /**\n * Returns the next ASN number\n *\n * @returns {AbstractIPNum} the next ASN number\n */\n nextIPNumber() {\n return new Asn(this.value.valueOf() + 1n);\n }\n /**\n * Returns the previous ASN number\n *\n * @returns {AbstractIPNum} the previous ASN number\n */\n previousIPNumber() {\n return new Asn(this.value.valueOf() - 1n);\n }\n static startWithASPrefix(word) {\n return word.indexOf(Asn.AS_PREFIX) === 0;\n }\n parseFromDotNotation(rawValue) {\n let values = rawValue.split(\".\");\n let high = parseInt(values[0]);\n let low = parseInt(values[1]);\n return (high * 65535) + (low + high);\n }\n}\nexports.Asn = Asn;\nAsn.AS_PREFIX = \"AS\";\n/**\n * Represents an IPv6 number. A 128 bit number that is used to uniquely identify a device that is part of a computer\n * network that uses the internet protocol for communication.\n *\n * @see https://en.wikipedia.org/wiki/IPv6\n * @see https://www.rfc-editor.org/info/rfc8200\n */\nclass IPv6 extends AbstractIPNum {\n /**\n * A convenience method for creating an {@link IPv6} by providing the decimal value of the IP number in BigInt\n *\n * @param {bigint} bigIntValue the decimal value of the IP number in BigInt\n * @returns {IPv6} the IPv6 instance\n */\n static fromBigInt(bigIntValue) {\n return new IPv6(bigIntValue);\n }\n /**\n * A convenience method for creating an {@link IPv6} by providing the IP number in hexadecatet notation. E.g\n * \"2001:800:0:0:0:0:0:2002\"\n *\n * {@see https://en.wikipedia.org/wiki/IPv6_address#Representation} for more information on hexadecatet notation.\n *\n * @param {string} ipString the IP number in hexadecatet\n * @returns {IPv6} the IPv6 instance\n */\n static fromHexadecatet(ipString) {\n return new IPv6(ipString);\n }\n /**\n * Alias for IPv6.fromHexadecimalString\n *\n * @param {string} ipString the IP number in hexadecatet\n * @returns {IPv6} the IPv6 instance\n */\n static fromString(ipString) {\n return IPv6.fromHexadecatet(ipString);\n }\n /**\n * A convenience method for creating an {@link IPv6} from binary string\n *\n * @param {string} ipBinaryString the binary string representing the IPv6 number to be created\n * @returns {IPv6} the IPv6 instance\n */\n static fromBinaryString(ipBinaryString) {\n let validationResult = Validator_1.Validator.isValidBinaryString(ipBinaryString);\n if (validationResult[0]) {\n let paddedBinaryString = (0, BinaryUtils_3.leftPadWithZeroBit)(ipBinaryString, 128);\n return new IPv6((0, BinaryUtils_2.parseBinaryStringToBigInt)(paddedBinaryString));\n }\n else {\n throw Error(validationResult[1].join(','));\n }\n }\n /**\n * A convenience method for creating an IPv4-Compatible {@link IPv6} Address from an instance of {@link IPv4}\n *\n * @param {IPv4} ipv4 to create an IPv4-Compatible {@link IPv6} Address\n * @returns {IPv6} the IPv4-Compatible {@link IPv6} Address\n */\n static fromIPv4(ipv4) {\n return ipv4.toIPv4MappedIPv6();\n }\n /**\n * A convenience method for creating an IPv4-Compatible {@link IPv6} Address from a IPv4 represented in\n * dot-decimal notation i.e. 127.0.0.1\n *\n * @param {IPv4} ip4DotDecimalString string represented in a dot decimal string\n * @returns {IPv6} the IPv4-Compatible {@link IPv6} Address\n */\n static fromIPv4DotDecimalString(ip4DotDecimalString) {\n return new IPv4(ip4DotDecimalString).toIPv4MappedIPv6();\n }\n /**\n * Constructor for an IPv6 number.\n *\n * @param {string | bigint} ipValue value to construct an IPv6 from. The given value can either be\n * numeric or string. If a string is given then it needs to be in hexadecatet string notation\n */\n constructor(ipValue) {\n super();\n /**\n * The number of bits needed to represents the value of the IPv6 number\n */\n this.bitSize = 128;\n /**\n * The maximum bit size (i.e. binary value) of the IPv6 number in BigInt\n */\n this.maximumBitSize = Validator_1.Validator.ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_SIZE;\n /**\n * The type of IP number. Value is one of the values of the {@link IPNumType} enum\n * @type {IPNumType} the type of IP number\n */\n this.type = \"IPv6\" /* IPNumType.IPv6 */;\n /**\n * An array of {@link Hexadecatet}'s\n *\n * @type {Array} the hexadecatet that makes up the IPv6 number\n */\n this.hexadecatet = [];\n /**\n * The string character used to separate the individual hexadecatet when the IPv6 is rendered as strings\n *\n * @type {string} The string character used to separate the individual hexadecatet when rendered as strings\n */\n this.separator = \":\";\n if (typeof ipValue === \"string\") {\n let expandedIPv6 = (0, IPv6Utils_1.expandIPv6Number)(ipValue);\n let [value, hexadecatet] = this.constructFromHexadecimalDottedString(expandedIPv6);\n this.value = value;\n this.hexadecatet = hexadecatet;\n }\n else {\n let [value, hexadecatet] = this.constructFromBigIntValue(ipValue);\n this.value = value;\n this.hexadecatet = hexadecatet;\n }\n }\n /**\n * A string representation of the IPv6 number.\n *\n * @returns {string} The string representation of IPv6\n */\n toString() {\n let ipv6String = this.hexadecatet.map((value) => { return value.toString(); }).join(\":\");\n if (this.hexadecatet.length < 8) {\n return \"::\" + ipv6String;\n }\n else {\n return ipv6String;\n }\n }\n /**\n * Gets the individual {@link Hexadecatet} that makes up the IPv6 number\n *\n * @returns {Array} The individual {@link Hexadecatet} that makes up the IPv6 number\n */\n //TODO maybe rename to something like getSegments? so it can be same with getOctet\n getHexadecatet() {\n return this.hexadecatet;\n }\n /**\n * Returns the next IPv6 number\n *\n * @returns {IPv6} the next IPv6 number\n */\n nextIPNumber() {\n return IPv6.fromBigInt(this.getValue() + 1n);\n }\n /**\n * Returns the previous IPv6 number\n *\n * @returns {IPv6} the previous IPv6 number\n */\n previousIPNumber() {\n return IPv6.fromBigInt(this.getValue() - 1n);\n }\n constructFromBigIntValue(ipv6Number) {\n let [isValid, message] = Validator_1.Validator.isValidIPv6Number(ipv6Number);\n if (!isValid) {\n throw new Error(message.filter(msg => { return msg !== ''; }).toString());\n }\n let binaryString = (0, BinaryUtils_4.numberToBinaryString)(ipv6Number);\n return [ipv6Number, this.binaryStringToHexadecatets(binaryString)];\n }\n constructFromHexadecimalDottedString(expandedIPv6) {\n let [isValid, message] = Validator_1.Validator.isValidIPv6String(expandedIPv6);\n if (!isValid) {\n throw new Error(message.filter(msg => { return msg !== ''; }).toString());\n }\n let stringHexadecimals = expandedIPv6.split(\":\");\n let hexadecatet = stringHexadecimals.map((stringHexadecatet) => {\n return Hexadecatet_1.Hexadecatet.fromString(stringHexadecatet);\n });\n let value = BigInt(`0b${(0, HexadecimalUtils_2.hexadectetNotationToBinaryString)(expandedIPv6)}`);\n return [value, hexadecatet];\n }\n binaryStringToHexadecatets(binaryString) {\n let hexadecimalString = (0, HexadecimalUtils_1.binaryStringToHexadecimalString)(binaryString);\n while (hexadecimalString.length % 4 != 0) {\n hexadecimalString = '0' + hexadecimalString;\n }\n let hexadecimalStrings = hexadecimalString.match(/.{1,4}/g);\n return hexadecimalStrings.map((stringHexadecatet) => {\n return Hexadecatet_1.Hexadecatet.fromString(stringHexadecatet);\n });\n }\n}\nexports.IPv6 = IPv6;\n/**\n * The IPv4Mask can be seen as a specialized IPv4 number where, in a 32 bit number, starting from the left, you\n * have continuous bits turned on (with 1 value) followed by bits turned off (with 0 value). In networking, it is used\n * to demarcate which bits are used to identify a network, and the ones that are used to identify hosts on the network\n */\nclass IPv4Mask extends IPv4 {\n /**\n * A convenience method for creating an instance of IPv4Mask. The passed strings need to be a valid IPv4\n * number in dot-decimal notation.\n *\n * @param {string} rawValue The passed string in dot-decimal notation\n * @returns {IPv4Mask} the instance of IPv4Mask\n */\n static fromDecimalDottedString(rawValue) {\n return new IPv4Mask(rawValue);\n }\n ;\n /**\n * Constructor for creating an instance of IPv4Mask.\n * The passed strings need to be a valid IPv4 mask number in dot-decimal notation.\n *\n * @param {string} ipString The passed string in dot-decimal notation\n */\n constructor(ipString) {\n super(ipString);\n /**\n * An array of {@link Octet}'s\n *\n * @type {Array} the octets that makes up the IPv4Mask\n */\n this.octets = [];\n let isValid;\n let message;\n [isValid, message] = Validator_1.Validator.isValidIPv4Mask(ipString);\n if (!isValid) {\n throw new Error(message.filter(msg => { return msg !== ''; }).toString());\n }\n let stringOctets = ipString.split(\".\");\n this.octets = stringOctets.map((rawOctet) => {\n return Octet_1.Octet.fromString(rawOctet);\n });\n let binaryString = (0, BinaryUtils_1.dottedDecimalNotationToBinaryString)(ipString);\n this.prefix = (binaryString.match(/1/g) || []).length;\n this.value = BigInt(`0b${binaryString}`);\n }\n}\nexports.IPv4Mask = IPv4Mask;\n/**\n * The IPv6Mask can be seen as a specialized IPv4 number where, in a 128 bit number, starting from the left,\n * you have continuous bits turned on (with 1 value) followed by bits turned off (with 0 value). In networking, it\n * is used to demarcate which bits are used to identify a network, and the ones that are used to identify hosts\n * on the network\n */\nclass IPv6Mask extends IPv6 {\n /**\n * A convenience method for creating an instance of IPv6Mask.\n * The passed strings need to be a valid IPv4 mask number in dot-decimal notation.\n *\n * @param {string} rawValue The passed string in textual notation\n * @returns {IPv6Mask} the instance of IPv6Mask\n */\n static fromHexadecatet(rawValue) {\n return new IPv6Mask(rawValue);\n }\n ;\n /**\n * Constructor for creating an instance of IPv6Mask.\n * The passed strings need to be a valid IPv6 mask number in dot-decimal notation\n *\n * @param {string} ipString The passed IPv6 string\n */\n constructor(ipString) {\n super(ipString);\n /**\n * An array of {@link Hexadecatet}'s\n *\n * @type {Array} the hexadecatet that makes up the IPv6 number\n */\n this.hexadecatet = [];\n let isValid;\n let message;\n let expandedIPv6 = (0, IPv6Utils_1.expandIPv6Number)(ipString);\n [isValid, message] = Validator_1.Validator.isValidIPv6Mask(expandedIPv6);\n if (!isValid) {\n throw new Error(message.filter(msg => { return msg !== ''; }).toString());\n }\n let stringHexadecimals = expandedIPv6.split(\":\");\n this.hexadecatet = stringHexadecimals.map((stringHexadecatet) => {\n return Hexadecatet_1.Hexadecatet.fromString(stringHexadecatet);\n });\n let binaryString = (0, HexadecimalUtils_2.hexadectetNotationToBinaryString)(expandedIPv6);\n this.prefix = (binaryString.match(/1/g) || []).length;\n this.value = BigInt(`0b${binaryString}`);\n this.value = BigInt(`0b${(0, HexadecimalUtils_2.hexadectetNotationToBinaryString)(expandedIPv6)}`);\n }\n}\nexports.IPv6Mask = IPv6Mask;\n/**\n * Check is the given IP number is an {@link IPv4} or not\n * @param ip the IP number to check if it is IPv4.\n */\nfunction isIPv4(ip) {\n return ip.bitSize === 32;\n}\n//# sourceMappingURL=IPNumber.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=IPNumType.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.IPv6Prefix = exports.IPv4Prefix = void 0;\nexports.isIPv4Prefix = isIPv4Prefix;\nconst Validator_1 = require(\"./Validator\");\nconst IPNumber_1 = require(\"./IPNumber\");\nconst BinaryUtils_1 = require(\"./BinaryUtils\");\nconst HexadecimalUtils_1 = require(\"./HexadecimalUtils\");\nconst Hexadecatet_1 = require(\"./Hexadecatet\");\n/**\n * Represents the prefix portion in the CIDR notation for representing IP ranges\n *\n * The IPv4 prefix portion represents the mask. It is the number of continuous bits turned on (with value 1)\n * counting from the left side of an 8 bit value.\n *\n * {@see https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing} for more information on CIDR\n */\nclass IPv4Prefix {\n /**\n * Convenience method for constructing an instance of IPv4 prefix from a decimal number\n *\n * @param {number} rawValue the decimal value to construct the IPv4 prefix from.\n * @returns {IPv4Prefix} the instance of an IPv4 prefix\n */\n static fromNumber(rawValue) {\n return new IPv4Prefix(rawValue);\n }\n ;\n static fromRangeSize(rangeSize) {\n let prefixNumber = rangeSize === (1n) ? 32 : 32 - rangeSizeToPrefix(rangeSize, Validator_1.Validator.IPV4_SIZE);\n return IPv4Prefix.fromNumber(BigInt(prefixNumber));\n }\n ;\n /**\n * Constructor for an instance of IPv4 prefix from a decimal number\n *\n * @param {number} rawValue the decimal value to construct the IPv4 prefix from.\n * @returns {IPv4Prefix} the instance of an IPv4 prefix\n */\n constructor(rawValue) {\n this.type = \"IPv4\";\n this.bitValue = 32n;\n let isValid;\n let message;\n [isValid, message] = Validator_1.Validator.isValidPrefixValue(rawValue, \"IPv4\" /* IPNumType.IPv4 */);\n if (!isValid) {\n throw new Error(message.filter(msg => { return msg !== ''; }).toString());\n }\n this.value = rawValue;\n }\n /**\n * Gets the decimal value of the IPv4 prefix\n *\n * @returns {number} the decimal value of the IPv4 prefix\n */\n getValue() {\n return this.value;\n }\n /**\n * Gets the decimal value of the IPv4 prefix as string\n * @returns {string} The decimal value of the IPv4 prefix as string\n */\n toString() {\n return this.value.toString();\n }\n /**\n * Converts the IPv4 prefix to a {@link IPv4Mask}\n *\n * The IPv4 mask is the representation of the prefix in the dot-decimal notation\n *\n * @returns {IPv4Mask} the mask representation of the prefix\n */\n toMask() {\n let onBits = '1'.repeat(Number(this.value));\n let offBits = '0'.repeat(Number(32n - this.value));\n return IPNumber_1.IPv4Mask.fromDecimalDottedString(this.toDecimalNotation(`${onBits}${offBits}`));\n }\n /**\n * Returns the size (number of IP numbers) of range of this prefix\n *\n * @return {bigint} the size (number of IP numbers) of range of this prefix\n */\n toRangeSize() {\n /**\n * Using bitwise shift operation this will be\n * 1 << (this.bitValue - this.getValue())\n * Since left shift a number by x is equivalent to multiplying the number by the power x raised to 2\n * 2 << 4 = 2 * (2 raised to 4)\n */\n return 1n << (this.bitValue - this.getValue());\n }\n /**\n * Returns a prefix for when this prefix is merged\n * with another prefix of the same size\n */\n merge() {\n return new IPv4Prefix(this.value - 1n);\n }\n /**\n * Returns a prefix for when this prefix is split\n * into two equal halves\n */\n split() {\n return new IPv4Prefix(this.value + 1n);\n }\n toDecimalNotation(bits) {\n return `${(0, BinaryUtils_1.parseBinaryStringToBigInt)(bits.substr(0, 8))}.${(0, BinaryUtils_1.parseBinaryStringToBigInt)(bits.substr(8, 8))}.${(0, BinaryUtils_1.parseBinaryStringToBigInt)(bits.substr(16, 8))}.${(0, BinaryUtils_1.parseBinaryStringToBigInt)(bits.substr(24, 8))}`;\n }\n}\nexports.IPv4Prefix = IPv4Prefix;\n/**\n * Represents the prefix portion in the CIDR notation for representing IP ranges\n *\n * The IPv6 prefix portion represents the mask. It is the number of continuous bits turned on (with value 1)\n * counting from the left side of an 128 bit value.\n *\n * {@see https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing} for more information on CIDR\n */\nclass IPv6Prefix {\n /**\n * Convenience method for constructing an instance of IPv46 prefix from a decimal number\n *\n * @param {number} rawValue the decimal value to construct the IPv6 prefix from.\n * @returns {IPv4Prefix} the instance of an IPv6 prefix\n */\n static fromNumber(rawValue) {\n return new IPv6Prefix(rawValue);\n }\n ;\n static fromRangeSize(rangeSize) {\n let prefixNumber = rangeSize === (1n) ? 128 : 128 - rangeSizeToPrefix(rangeSize, Validator_1.Validator.IPV6_SIZE);\n return IPv6Prefix.fromNumber(BigInt(prefixNumber));\n }\n /**\n * Constructor for an instance of IPv6 prefix from a decimal number\n *\n * @param {number} rawValue the decimal value to construct the IPv6 prefix from.\n * @returns {IPv4Prefix} the instance of an IPv6 prefix\n */\n constructor(rawValue) {\n this.type = \"IPv6\";\n this.bitValue = 128n;\n let isValid;\n let message;\n [isValid, message] = Validator_1.Validator.isValidPrefixValue(rawValue, \"IPv6\" /* IPNumType.IPv6 */);\n if (!isValid) {\n throw new Error(message.filter(msg => { return msg !== ''; }).toString());\n }\n this.value = rawValue;\n }\n /**\n * Gets the decimal value of the IPv6 prefix\n *\n * @returns {number} the decimal value of the IPv6 prefix\n */\n getValue() {\n return this.value;\n }\n /**\n * Gets the decimal value of the IPv4 prefix as string\n * @returns {string} he decimal value of the IPv4 prefix as string\n */\n toString() {\n return this.value.toString();\n }\n /**\n * Converts the IPv6 prefix to a {@link IPv6Mask}\n *\n * The IPv6 mask is the representation of the prefix in 8 groups of 16 bit values represented in hexadecimal\n *\n * @returns {IPv6Mask} the mask representation of the prefix\n */\n toMask() {\n let onBits = '1'.repeat(Number(this.value));\n let offBits = '0'.repeat(128 - Number(this.value));\n return IPNumber_1.IPv6Mask.fromHexadecatet(this.toHexadecatetNotation(`${onBits}${offBits}`));\n }\n /**\n * Returns the size (number of IP numbers) of range of this prefix\n *\n * @return {bigint} the size (number of IP numbers) of range of this prefix\n */\n toRangeSize() {\n /**\n * Using bitwise shift operation this will be\n * 1 << (this.bitValue - this.getValue())\n * Since left shift a number by x is equivalent to multiplying the number by the power x raised to 2\n * 2 << 4 = 2 * (2 raised to 4)\n */\n return 1n << (this.bitValue - this.getValue());\n }\n /**\n * Returns a prefix for when this prefix is merged\n * with another prefix of the same size\n */\n merge() {\n return new IPv6Prefix(this.value - 1n);\n }\n /**\n * Returns a prefix for when this prefix is split\n * into two equal halves\n */\n split() {\n return new IPv6Prefix(this.value + 1n);\n }\n toHexadecatetNotation(bits) {\n let binaryStrings = bits.match(/.{1,16}/g);\n let hexadecimalStrings = binaryStrings.map((binaryString) => {\n return Hexadecatet_1.Hexadecatet.fromString((0, HexadecimalUtils_1.binaryStringToHexadecimalString)(binaryString));\n });\n return hexadecimalStrings.map((value) => { return value.toString(); }).join(\":\");\n }\n}\nexports.IPv6Prefix = IPv6Prefix;\nfunction rangeSizeToPrefix(rangeSize, rangeMaxSize) {\n let ipType = rangeMaxSize > (Validator_1.Validator.IPV4_SIZE) ? \"IPv6\" : \"IPv4\";\n if (rangeSize > (rangeMaxSize) || rangeSize === (0n)) {\n throw new Error(Validator_1.Validator.invalidIPRangeSizeMessage.replace(\"$iptype\", ipType));\n }\n try {\n return (0, BinaryUtils_1.intLog2)(rangeSize);\n }\n catch (e) {\n throw new Error(Validator_1.Validator.invalidIPRangeSizeForCidrMessage);\n }\n}\n/**\n * Check is the given Prefix is an {@link IPv4Prefix} or not\n * @param prefix the IP prefix to check if it is IPv4Prefix.\n */\nfunction isIPv4Prefix(prefix) {\n return prefix.type === \"IPv4\";\n}\n/**\n * Check is the given Prefix is an {@link IPv4Prefix} or not\n * @param prefix the IP prefix to check if it is IPv4Prefix.\n */\nfunction isIPv6Prefix(prefix) {\n return prefix.type === \"IPv6\";\n}\n//# sourceMappingURL=Prefix.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.IPv6CidrRange = exports.IPv4CidrRange = exports.AbstractIPRange = exports.RangedSet = void 0;\nexports.isIPv4CidrRange = isIPv4CidrRange;\nconst IPNumber_1 = require(\"./IPNumber\");\nconst Prefix_1 = require(\"./Prefix\");\nconst BinaryUtils_1 = require(\"./BinaryUtils\");\nconst Validator_1 = require(\"./Validator\");\n/**\n * Represents a continuous segment of either IPv4 or IPv6 numbers\n * without adhering to classless inter-domain routing scheme\n * for allocating IP addresses.\n */\nclass RangedSet {\n /**\n * Convenience method for constructing an instance of {@link RangedSet} from a\n * single IP number.\n *\n * @param ip The IP number, either IPv4 or IPv6 to construct the range from.\n */\n static fromSingleIP(ip) {\n return new RangedSet(ip, ip);\n }\n /**\n * Convenience method for constructing an instance of {@link RangedSet} from an\n * instance of either {@link IPv4CidrRange} or {@link IPv6CidrRange}\n *\n * @param cidrRange an instance of {@link RangedSet}\n */\n static fromCidrRange(cidrRange) {\n return new RangedSet(cidrRange.getFirst(), cidrRange.getLast());\n }\n /**\n * Convenience method for constructing an instance of {@link RangedSet} from\n * a range string in the form of firstIp-lastIp\n *\n * @param rangeString string in the form of firstIp-lastIp\n */\n static fromRangeString(rangeString) {\n let ips = rangeString.split(\"-\").map(ip => ip.trim());\n if (ips.length !== 2) {\n throw new Error(\"Argument should be in the format firstip-lastip\");\n }\n let [firstIPString, lastIPString] = ips;\n let [isValidFirstIPv4,] = Validator_1.Validator.isValidIPv4String(firstIPString);\n let [isValidSecondIPv4,] = Validator_1.Validator.isValidIPv4String(lastIPString);\n let [isValidFirstIPv6,] = Validator_1.Validator.isValidIPv6String(firstIPString);\n let [isValidLastIPv6,] = Validator_1.Validator.isValidIPv6String(lastIPString);\n if (isValidFirstIPv4 && isValidSecondIPv4) {\n return new RangedSet(IPNumber_1.IPv4.fromDecimalDottedString(firstIPString), IPNumber_1.IPv4.fromDecimalDottedString(lastIPString));\n }\n else if (isValidFirstIPv6 && isValidLastIPv6) {\n return new RangedSet(IPNumber_1.IPv6.fromHexadecatet(firstIPString), IPNumber_1.IPv6.fromHexadecatet(lastIPString));\n }\n else {\n throw new Error(\"First IP and Last IP should be valid and same type\");\n }\n }\n /**\n * Constructor for an instance of {@link RangedSet} from an\n * instance of either {@link IPv4CidrRange} or {@link IPv6CidrRange}\n *\n * Throws an exception if first IP number is not less than given last IP number\n *\n * @param first the first IP number of the range\n * @param last the last IP number of the range\n */\n constructor(first, last) {\n this.first = first;\n this.last = last;\n if (first.isGreaterThan(last)) {\n throw new Error(`${first.toString()} should be lower than ${last.toString()}`);\n }\n this.currentValue = first;\n this.bitValue = BigInt(first.bitSize);\n }\n /**\n * Returns the first IP number in the range\n */\n getFirst() {\n return this.first;\n }\n /**\n * Returns the last IP number in the range\n */\n getLast() {\n return this.last;\n }\n /**\n * Returns the size, which is the number of IP numbers in the range.\n */\n getSize() {\n return this.last.getValue() - (this.first.getValue()) + 1n;\n }\n /**\n * Converts to a string representation of the range in the form of:\n * -\n */\n toRangeString() {\n return `${this.getFirst()}-${this.getLast()}`;\n }\n /**\n * Checks if this range is inside another range.\n *\n * @param otherRange the other range to check if this range is inside of.\n */\n inside(otherRange) {\n return otherRange.contains(this);\n }\n /**\n * Checks if this range contains the given other range.\n *\n * @param otherRange the other range to check if this range contains\n */\n contains(otherRange) {\n let thisFirst = this.getFirst();\n let thisLast = this.getLast();\n let otherFirst = otherRange.getFirst();\n let otherLast = otherRange.getLast();\n return (thisFirst.isLessThanOrEquals(otherFirst) && thisLast.isGreaterThanOrEquals(otherLast));\n }\n /**\n * Check if this range is equal to the given other range.\n *\n * @param otherRange the other range to check if equal to this range.\n */\n isEquals(otherRange) {\n return this.getFirst().isEquals(otherRange.getFirst())\n && this.getLast().isEquals(otherRange.getLast());\n }\n ;\n /**\n * Check if this range is less than the given range.\n *\n * @param otherRange the other range to check if less than.\n */\n isLessThan(otherRange) {\n if (this.isEquals(otherRange)) {\n return false;\n }\n else {\n if (this.getFirst().isEquals(otherRange.getFirst())) {\n return this.getSize() < (otherRange.getSize());\n }\n return this.getFirst().isLessThan(otherRange.getFirst());\n }\n }\n /**\n * Check if this range is greater than the given range.\n *\n * @param otherRange the other range to check if greater than.\n */\n isGreaterThan(otherRange) {\n if (this.isEquals(otherRange)) {\n return false;\n }\n else {\n if (this.getFirst().isEquals(otherRange.getFirst())) {\n return this.getSize() > (otherRange.getSize());\n }\n return this.getFirst().isGreaterThan(otherRange.getFirst());\n }\n }\n /**\n * Checks of this range overlaps with a given other range.\n *\n * This means it checks if part of a range is part of another range without\n * being totally contained in the other range. Hence Equal or ranges contained inside one\n * another are not considered as overlapping.\n *\n * @param otherRange the other range to check if it overlaps with this range.\n */\n isOverlapping(otherRange) {\n let thisFirst = this.getFirst();\n let thisLast = this.getLast();\n let otherFirst = otherRange.getFirst();\n let otherLast = otherRange.getLast();\n return (thisLast.isGreaterThan(otherFirst) && thisLast.isLessThanOrEquals(otherLast) && thisFirst.isLessThan(otherFirst)\n ||\n otherLast.isGreaterThan(thisFirst) && otherLast.isLessThanOrEquals(thisLast) && otherFirst.isLessThan(thisFirst)\n ||\n this.contains(otherRange)\n ||\n otherRange.contains(this));\n }\n /**\n * Check if this range can be converted to a CIDR range.\n */\n isCidrAble() {\n if (this.getSize() === 1n) {\n return true;\n }\n try {\n let prefix = (0, BinaryUtils_1.intLog2)(this.getSize());\n let netmask = (0, BinaryUtils_1.parseBinaryStringToBigInt)((0, BinaryUtils_1.cidrPrefixToMaskBinaryString)(prefix, (0, IPNumber_1.isIPv4)(this.currentValue) ? \"IPv4\" /* IPNumType.IPv4 */ : \"IPv6\" /* IPNumType.IPv6 */));\n return (this.first.getValue()) === (netmask & (this.first.getValue()));\n }\n catch (e) {\n return false;\n }\n }\n /**\n * Converts an instance of range to an instance of CIDR range\n */\n toCidrRange() {\n if ((0, IPNumber_1.isIPv4)(this.currentValue)) {\n return this.toIPv4CidrRange();\n }\n else {\n return this.toIPv6CidrRange();\n }\n }\n ;\n /**\n * Checks if this range is consecutive with another range.\n *\n * This means if the two ranges can be placed side by side, without any gap. Hence Equal\n * or ranges contained inside one another, or overlapping ranges are not considered as consecutive.\n *\n * @param otherRange the other range to check if this range is consecutive to.\n */\n isConsecutive(otherRange) {\n let thisFirst = this.getFirst();\n let thisLast = this.getLast();\n let otherFirst = otherRange.getFirst();\n let otherLast = otherRange.getLast();\n return (thisLast.hasNext() && thisLast.nextIPNumber().isEquals(otherFirst)\n ||\n otherLast.hasNext() && otherLast.nextIPNumber().isEquals(thisFirst));\n }\n /**\n * Creates a range that is a union of this range and the given other range.\n *\n * @param otherRange the other range to combine with this range\n */\n union(otherRange) {\n if (this.isEquals(otherRange)) {\n return new RangedSet(otherRange.getFirst(), otherRange.getLast());\n }\n if (this.contains(otherRange)) {\n return new RangedSet(this.getFirst(), this.getLast());\n }\n else if (otherRange.contains(this)) {\n return new RangedSet(otherRange.getFirst(), otherRange.getLast());\n }\n if (this.isOverlapping(otherRange)) {\n if (this.getFirst().isLessThan(otherRange.getFirst())) {\n return new RangedSet(this.getFirst(), otherRange.getLast());\n }\n else {\n return new RangedSet(otherRange.getFirst(), this.getLast());\n }\n }\n throw new Error(\"Ranges do not overlap nor are equal\");\n }\n /**\n * Prepends given range with this range.\n * The last IP in the given range should be adjacent to the first IP in this range\n *\n * @param otherRange the other range to prepend\n */\n prepend(otherRange) {\n if (otherRange.getLast().nextIPNumber().isEquals(this.getFirst())) {\n return new RangedSet(otherRange.getFirst(), this.getLast());\n }\n else {\n throw new Error(\"Range to prepend must be adjacent\");\n }\n }\n /**\n * Appends given range with this range.\n * The last IP in this range should be adjacent to the first IP in range to append\n *\n * @param otherRange the other range to append\n */\n append(otherRange) {\n if (this.getLast().nextIPNumber().isEquals(otherRange.getFirst())) {\n return new RangedSet(this.getFirst(), otherRange.getLast());\n }\n else {\n throw new Error(\"Range to append must be adjacent\");\n }\n }\n subtract(otherRange) {\n if (!this.isOverlapping(otherRange)) {\n throw new Error(\"Cannot subtract ranges that are not overlapping\");\n }\n if (!this.isLessThan(otherRange)) {\n throw new Error(\"Cannot subtract a larger range from this range\");\n }\n return new RangedSet(this.getFirst(), otherRange.getLast());\n }\n /**\n * Returns a sub range of a given size from this range.\n *\n * @param offset offset from this range where the subrange should begin\n * @param size the size of the range\n */\n takeSubRange(offset, size) {\n if (offset + (size) > (this.getSize())) {\n throw new RangeError(\"Requested range is greater than what can be taken\");\n }\n if (size === (0n)) {\n throw new Error(\"Sub range cannot be zero\");\n }\n let valueOfFirstIp = this.getFirst().value + (offset);\n let firstIp = (0, IPNumber_1.isIPv4)(this.getFirst()) ?\n IPNumber_1.IPv4.fromNumber(valueOfFirstIp) : IPNumber_1.IPv6.fromBigInt(valueOfFirstIp);\n let valueOfLastIp = firstIp.value + (size - 1n);\n let lastIp = (0, IPNumber_1.isIPv4)(firstIp) ? IPNumber_1.IPv4.fromNumber(valueOfLastIp) : IPNumber_1.IPv6.fromBigInt(valueOfLastIp);\n return new RangedSet(firstIp, lastIp);\n }\n /**\n * Performs a subtraction operation, where the passed range is removed from the original range.\n *\n * The return range from the subtraction operation could be a single or multiple ranges\n *\n * @param range\n */\n difference(range) {\n if (range.getSize() > (this.getSize())) {\n throw new Error(\"Range is greater than range to be subtracted from\");\n }\n if (!this.contains(range)) {\n throw new Error(\"Range to subtract is not contained in this range\");\n }\n let reminders = [];\n try {\n reminders.push(new RangedSet(this.getFirst(), range.getFirst().previousIPNumber()));\n }\n catch (e) { }\n try {\n reminders.push(new RangedSet(range.getLast().nextIPNumber(), this.getLast()));\n }\n catch (e) { }\n return reminders;\n }\n *take(count) {\n let computed = this.getFirst();\n let returnCount = count === undefined ? this.getSize().valueOf() : count;\n while (returnCount > 0) {\n returnCount--;\n yield computed;\n computed = computed.nextIPNumber();\n }\n }\n *[Symbol.iterator]() {\n yield* this.take();\n }\n toIPv4CidrRange() {\n let candidateRange = new IPv4CidrRange(IPNumber_1.IPv4.fromNumber(this.getFirst().getValue()), Prefix_1.IPv4Prefix.fromRangeSize(this.getSize()));\n if (candidateRange.getFirst().isEquals(this.getFirst())) {\n return candidateRange;\n }\n else {\n throw new Error(\"Range cannot be converted to CIDR\");\n }\n }\n toIPv6CidrRange() {\n let candidateRange = new IPv6CidrRange(IPNumber_1.IPv6.fromBigInt(this.getFirst().getValue()), Prefix_1.IPv6Prefix.fromRangeSize(this.getSize()));\n if (candidateRange.getFirst().isEquals(this.getFirst())) {\n return candidateRange;\n }\n else {\n throw new Error(\"Range cannot be converted to CIDR\");\n }\n }\n}\nexports.RangedSet = RangedSet;\n/**\n * Provides the implementation of functionality that are common to {@link IPv4CidrRange} and {@link IPv6CidrRange}\n */\nclass AbstractIPRange {\n hasNextRange() {\n let sizeOfCurrentRange = this.getSize();\n return ((2n ** this.bitValue) - sizeOfCurrentRange) >= (this.getFirst().getValue() + (sizeOfCurrentRange));\n }\n hasPreviousRange() {\n return this.getSize() <= (this.getFirst().getValue());\n }\n toRangeSet() {\n return new RangedSet(this.getFirst(), this.getLast());\n }\n inside(otherRange) {\n return this.toRangeSet().inside(otherRange.toRangeSet());\n }\n contains(otherRange) {\n if (otherRange instanceof IPNumber_1.AbstractIPNum) {\n const firstValue = this.getFirst().getValue();\n const lastValue = this.getLast().getValue();\n const otherValue = otherRange.getValue();\n return otherValue >= firstValue && otherValue <= lastValue;\n }\n return this.toRangeSet().contains(otherRange.toRangeSet());\n }\n toRangeString() {\n return this.toRangeSet().toRangeString();\n }\n isOverlapping(otherRange) {\n return this.toRangeSet().isOverlapping(otherRange.toRangeSet());\n }\n isConsecutive(otherRange) {\n return this.toRangeSet().isConsecutive(otherRange.toRangeSet());\n }\n isCidrMergeable(otherRange) {\n const count = BigInt((0, BinaryUtils_1.matchingBitCount)(this.getFirst().toBinaryString(), otherRange.getFirst().toBinaryString()));\n if (this.getPrefix().value - count !== 1n) {\n return false;\n }\n return this.isConsecutive(otherRange) && this.getSize() === (otherRange.getSize());\n }\n isMergeable(otherRange) {\n return this.isCidrMergeable(otherRange)\n || this.contains(otherRange)\n || this.inside(otherRange);\n }\n isEquals(otherRange) {\n return this.toRangeSet().isEquals(otherRange.toRangeSet());\n }\n merge(otherRange) {\n if (!this.isCidrMergeable(otherRange)) {\n throw new Error(`Cannot merge. Ranges (${this.toRangeString()},${otherRange.toRangeString()}) are not consecutive and/or of same size`);\n }\n return this.newInstance(this.getFirst(), this.getPrefix().merge());\n }\n /**\n * Returns a lazily evaluated representation of the IP range that produces IP numbers by either:\n *\n * - iterating over using the for of syntax\n * - converting to array using spread syntax\n * - or assigning values to variables using deconstruction\n *\n * @param count the number of IP numbers to lazily evaluate.\n * If none is given, the whole IP range is lazily returned.\n */\n *takeStream(count) {\n return this.toRangeSet().take(count);\n }\n *[Symbol.iterator]() {\n yield* this.toRangeSet();\n }\n}\nexports.AbstractIPRange = AbstractIPRange;\n/**\n * Represents a continuous segment of IPv4 numbers following the\n * classless inter-domain routing scheme for allocating IP addresses.\n *\n * @see https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing\n */\nclass IPv4CidrRange extends AbstractIPRange {\n /**\n * Convenience method for constructing an instance of an IPv4CidrRange from an IP range represented in CIDR notation\n *\n * @param {string} rangeIncidrNotation the range of the IPv4 number in CIDR notation\n * @returns {IPv4CidrRange} the IPv4CidrRange\n */\n static fromCidr(rangeIncidrNotation) {\n let [isValid, errorMessages] = Validator_1.Validator.isValidIPv4CidrNotation(rangeIncidrNotation);\n if (!isValid) {\n let messages = errorMessages.filter(message => { return message !== ''; });\n throw new Error(messages.join(' and '));\n }\n let cidrComponents = rangeIncidrNotation.split(\"/\");\n let ipString = cidrComponents[0];\n let prefix = BigInt(parseInt(cidrComponents[1]));\n return new IPv4CidrRange(IPNumber_1.IPv4.fromDecimalDottedString(ipString), Prefix_1.IPv4Prefix.fromNumber(prefix));\n }\n /**\n * Constructor for creating an instance of an IPv4 range.\n *\n * The arguments taken by the constructor is inspired by the CIDR notation which basically consists of the IP\n * number and the prefix.\n *\n * @param {IPv4} ipv4 the IP number used to construct the range. By convention this is the first IP number in\n * the range, but it could also be any IP number within the range\n * @param {IPv4Prefix} cidrPrefix the prefix which is a representation of the number of bits used to mask the\n * given IP number in other to create the range\n */\n constructor(ipv4, cidrPrefix) {\n super();\n this.ipv4 = ipv4;\n this.cidrPrefix = cidrPrefix;\n this.bitValue = 32n;\n }\n /**\n * Gets the size of IPv4 numbers contained within the IPv4 range\n *\n * @returns {bigint} the amount of IPv4 numbers in the range\n */\n getSize() {\n return this.cidrPrefix.toRangeSize();\n }\n /**\n * Method that returns the IPv4 range in CIDR (Classless Inter-Domain Routing) notation.\n *\n * See {@link https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation} for more information\n * on the Classless Inter-Domain Routing notation\n *\n * @returns {string} the IPv4 range in CIDR (Classless Inter-Domain Routing) notation\n */\n toCidrString() {\n let first = this.ipv4.toString();\n return `${first.toString()}/${this.cidrPrefix.toString()}`;\n }\n /**\n * Method that returns the IPv4 range in string notation where the first IPv4 number and last IPv4 number are\n * separated by an hyphen. eg. 192.198.0.0-192.198.0.255\n *\n * @returns {string} the range in [first IPv4 number] - [last IPv4 number] format\n */\n toRangeString() {\n return super.toRangeString();\n }\n /**\n * Method that returns the first IPv4 number in the IPv4 range\n *\n * @returns {IPv4} the first IPv4 number in the IPv4 range\n */\n getFirst() {\n return IPNumber_1.IPv4.fromNumber(this.ipv4.getValue() & (this.cidrPrefix.toMask().getValue()));\n }\n /**\n * Method that returns the last IPv4 number in the IPv4 range\n *\n * @returns {IPv4} the last IPv4 number in the IPv4 range\n */\n getLast() {\n return last(this, this.ipv4);\n }\n newInstance(num, prefix) {\n return new IPv4CidrRange(num, prefix);\n }\n getPrefix() {\n return this.cidrPrefix;\n }\n /**\n * Indicates whether the given IPv4 range is an adjacent range.\n *\n * An adjacent range being one where the end of the given range, when incremented by one marks the start of the\n * other range. Or where the start of the given range, when decreased by one, marks the end of the other range\n *\n * @param {IPv4CidrRange} otherRange the other IPv4 range to compare with\n * @returns {boolean} true if the two IPv4 ranges are consecutive, false otherwise\n */\n isConsecutive(otherRange) {\n return super.isConsecutive(otherRange);\n }\n /**\n * Indicates if the given IPv4 range is a subset.\n *\n * By a subset range, it means all the values of the given range are contained by this IPv4 range\n *\n * @param {IPv4CidrRange} otherRange the other IPv4 range\n * @returns {boolean} true if the other Ipv4 range is a subset. False otherwise.\n */\n contains(otherRange) {\n return super.contains(otherRange);\n }\n /**\n * Indicate if the given range is a container range.\n *\n * By container range, it means all the IP number in this current range can be found within the given range.\n *\n * @param {IPv4CidrRange} otherRange he other IPv4 range\n * @returns {boolean} true if the other Ipv4 range is a container range. False otherwise.\n */\n inside(otherRange) {\n return super.inside(otherRange);\n }\n /**\n * Checks if two IPv4 ranges overlap\n * @param {IPv4CidrRange} otherRange the other IPv4 range\n * @returns {boolean} true if the ranges overlap, false otherwise\n */\n isOverlapping(otherRange) {\n return super.isOverlapping(otherRange);\n }\n /**\n * Method that takes IPv4 number from within an IPv4 range, starting from the first IPv4 number\n *\n * @param {bigint} count the amount of IPv4 number to take from the IPv4 range\n * @returns {Array} an array of IPv4 number, taken from the IPv4 range\n */\n take(count) {\n let ipv4s = [this.getFirst()];\n let iteratingIPv4 = this.getFirst();\n if (count > (this.getSize())) {\n let errMessage = Validator_1.Validator.takeOutOfRangeSizeMessage\n .replace(\"$count\", count.toString())\n .replace(\"$size\", this.getSize().toString());\n throw new Error(errMessage);\n }\n for (let counter = 0; counter < count - 1n; counter++) {\n ipv4s.push(iteratingIPv4.nextIPNumber());\n iteratingIPv4 = iteratingIPv4.nextIPNumber();\n }\n return ipv4s;\n }\n /**\n * Method that splits an IPv4 range into two halves\n *\n * @returns {Array} An array of two {@link IPv4CidrRange}\n */\n split() {\n let prefixToSplit = this.cidrPrefix.getValue();\n if (prefixToSplit === 32n) {\n throw new Error(\"Cannot split an IP range with a single IP number\");\n }\n let splitCidr = Prefix_1.IPv4Prefix.fromNumber(prefixToSplit + 1n);\n let firstIPOfFirstRange = this.getFirst();\n let firstRange = new IPv4CidrRange(firstIPOfFirstRange, splitCidr);\n let firstIPOfSecondRange = firstRange.getLast().nextIPNumber();\n let secondRange = new IPv4CidrRange(firstIPOfSecondRange, splitCidr);\n return [firstRange, secondRange];\n }\n /**\n * Method that split prefix into ranges of the given prefix,\n * throws an exception if the size of the given prefix is larger than target prefix\n *\n * @param prefix the prefix to use to split\n * @returns {Array} An array of two {@link IPv4CidrRange}\n */\n splitInto(prefix) {\n let splitCount = prefix.getValue() - this.cidrPrefix.getValue();\n if (splitCount < 0) {\n throw new Error(\"Prefix to split into is larger than source prefix\");\n }\n else if (splitCount === 0n) {\n return [new IPv4CidrRange(this.getFirst(), prefix)];\n }\n else if (splitCount === 1n) {\n return this.split();\n }\n else {\n let results = this.split();\n while (splitCount > 1) {\n results = results.flatMap(result => result.split());\n splitCount = splitCount - 1n;\n }\n return results;\n }\n }\n /**\n * Returns true if there is an adjacent IPv4 cidr range of exactly the same size next to this range\n */\n hasNextRange() {\n return super.hasNextRange();\n }\n /**\n * Returns true if there is an adjacent IPv4 cidr range of exactly the same size previous to this range\n */\n hasPreviousRange() {\n return super.hasPreviousRange();\n }\n /**\n * Return the next IPv6 cidr range, or undefined if no next range\n */\n nextRange() {\n if (this.hasNextRange()) {\n let sizeOfCurrentRange = this.getSize();\n let startOfNextRange = this.getFirst().getValue() + (sizeOfCurrentRange);\n return new IPv4CidrRange(new IPNumber_1.IPv4(startOfNextRange), this.cidrPrefix);\n }\n return;\n }\n /**\n * Return the previous IPv6 cidr range, or undefined if no next range\n */\n previousRange() {\n if (this.hasPreviousRange()) {\n let sizeOfCurrentRange = this.getSize();\n let startOfPreviousRange = this.getFirst().getValue() - (sizeOfCurrentRange);\n return new IPv4CidrRange(new IPNumber_1.IPv4(startOfPreviousRange), this.cidrPrefix);\n }\n return;\n }\n}\nexports.IPv4CidrRange = IPv4CidrRange;\n/**\n * Represents a continuous segment of IPv6 number following the\n * classless inter-domain routing scheme for allocating IP addresses.\n *\n * @see https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing\n */\nclass IPv6CidrRange extends AbstractIPRange {\n /**\n * Convenience method for constructing an instance of an IPV6Range from an IP range represented in CIDR notation\n *\n * @param {string} rangeInCidrNotation the range of the IPv6 number in CIDR notation\n * @returns {IPv6CidrRange} the IPV6Range\n */\n static fromCidr(rangeInCidrNotation) {\n let [isValid, message] = Validator_1.Validator.isValidIPv6CidrNotation(rangeInCidrNotation);\n if (!isValid) {\n throw new Error(message.filter(msg => { return msg !== ''; }).toString());\n }\n let cidrComponents = rangeInCidrNotation.split(\"/\");\n let ipString = cidrComponents[0];\n let prefix = BigInt(parseInt(cidrComponents[1]));\n return new IPv6CidrRange(IPNumber_1.IPv6.fromHexadecatet(ipString), Prefix_1.IPv6Prefix.fromNumber(prefix));\n }\n ;\n /**\n * Constructor for creating an instance of an IPv6 range.\n *\n * The arguments taken by the constructor is inspired by the CIDR notation which basically consists of the IP\n * number and the prefix.\n *\n * @param {IPv6} ipv6 the IP number used to construct the range. By convention this is the first IP number in\n * the range, but it could also be any IP number within the range\n * @param {IPv6Prefix} cidrPrefix the prefix which is a representation of the number of bits used to mask the\n * given IPv6 number in other to create the range\n */\n constructor(ipv6, cidrPrefix) {\n super();\n this.ipv6 = ipv6;\n this.cidrPrefix = cidrPrefix;\n this.bitValue = 128n;\n }\n /**\n * Gets the size of IPv6 numbers contained within the IPv6 range\n *\n * @returns {bigint} the amount of IPv6 numbers in the range\n */\n getSize() {\n return this.cidrPrefix.toRangeSize();\n }\n /**\n * Method that returns the IPv6 range in CIDR (Classless Inter-Domain Routing) notation.\n *\n * See {@link https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation} for more information\n * on the Classless Inter-Domain Routing notation\n *\n * @returns {string} the IPv6 range in CIDR (Classless Inter-Domain Routing) notation\n */\n toCidrString() {\n let first = this.ipv6.toString();\n return `${first.toString()}/${this.cidrPrefix.toString()}`;\n }\n /**\n * Method that returns the IPv6 range in string notation where the first IPv6 number and last IPv6 number are\n * separated by an hyphen. eg. \"2001:db8:0:0:0:0:0:0-2001:db8:0:ffff:ffff:ffff:ffff:ffff\"\n *\n * @returns {string} the range in [first IPv6 number] - [last IPv6 number] format\n */\n toRangeString() {\n return super.toRangeString();\n }\n /**\n * Method that returns the first IPv6 number in the IPv6 range\n *\n * @returns {IPv6} the first IPv6 number in the IPv6 range\n */\n getFirst() {\n return IPNumber_1.IPv6.fromBigInt(this.ipv6.getValue() & (this.cidrPrefix.toMask().getValue()));\n }\n /**\n * Method that returns the last IPv6 number in the IPv6 range\n *\n * @returns {IPv6} the last IPv6 number in the IPv6 range\n */\n getLast() {\n return last(this, this.ipv6);\n }\n newInstance(num, prefix) {\n return new IPv6CidrRange(num, prefix);\n }\n getPrefix() {\n return this.cidrPrefix;\n }\n /**\n * Indicates whether the given IPv6 range is an adjacent range.\n *\n * An adjacent range being one where the end of the given range, when incremented by one marks the start of the\n * other range. Or where the start of the given range, when decreased by one, marks the end of the other range\n *\n * @param {IPv6CidrRange} otherRange the other IPv6 range to compare with\n * @returns {boolean} true if the two IPv6 ranges are consecutive, false otherwise\n */\n isConsecutive(otherRange) {\n return super.isConsecutive(otherRange);\n }\n /**\n * Indicates if the given IPv6 range is a subset.\n *\n * By a subset range, it means all the values of the given range are contained by this IPv6 range\n *\n * @param {IPv6CidrRange} otherRange the other IPv6 range\n * @returns {boolean} true if the other Ipv6 range is a subset. False otherwise.\n */\n contains(otherRange) {\n return super.contains(otherRange);\n }\n /**\n * Indicate if the given range is a container range.\n *\n * By container range, it means all the IP number in this current range can be found within the given range.\n *\n * @param {IPv6CidrRange} otherRange he other IPv6 range\n * @returns {boolean} true if the other Ipv6 range is a container range. False otherwise.\n */\n inside(otherRange) {\n return super.inside(otherRange);\n }\n /**\n * Checks if two IPv6 ranges overlap\n * @param {IPv6CidrRange} otherRange the other IPv6 range\n * @returns {boolean} true if the ranges overlap, false otherwise\n */\n isOverlapping(otherRange) {\n return super.isOverlapping(otherRange);\n }\n /**\n * Method that takes IPv6 number from within an IPv6 range, starting from the first IPv6 number\n *\n * @param {bigint} count the amount of IPv6 number to take from the IPv6 range\n * @returns {Array} an array of IPv6 number, taken from the IPv6 range\n */\n take(count) {\n let iPv6s = [this.getFirst()];\n let iteratingIPv6 = this.getFirst();\n if (count > (this.getSize())) {\n throw new Error(`${count.toString()} is greater than ${this.getSize().toString()}, the size of the range`);\n }\n for (var counter = 0; counter < count - 1n; counter++) {\n iPv6s.push(iteratingIPv6.nextIPNumber());\n iteratingIPv6 = iteratingIPv6.nextIPNumber();\n }\n return iPv6s;\n }\n /**\n * Method that splits an IPv6 cidr range into two halves\n *\n * @returns {Array} An array of two {@link IPv6CidrRange}\n */\n split() {\n let prefixToSplit = this.cidrPrefix.getValue();\n if (prefixToSplit === 128n) {\n throw new Error(\"Cannot split an IP range with a single IP number\");\n }\n let splitCidr = Prefix_1.IPv6Prefix.fromNumber(prefixToSplit + 1n);\n let firstIPOfFirstRange = this.getFirst();\n let firstRange = new IPv6CidrRange(firstIPOfFirstRange, splitCidr);\n let firstIPOfSecondRange = firstRange.getLast().nextIPNumber();\n let secondRange = new IPv6CidrRange(firstIPOfSecondRange, splitCidr);\n return [firstRange, secondRange];\n }\n /**\n * Method that split prefix into ranges of the given prefix,\n * throws an exception if the size of the given prefix is larger than target prefix\n *\n * @param prefix the prefix to use to split\n * @returns {Array} An array of two {@link IPv6CidrRange}\n */\n splitInto(prefix) {\n let splitCount = prefix.getValue() - this.cidrPrefix.getValue();\n if (splitCount < 0) {\n throw new Error(\"Prefix to split into is larger than source prefix\");\n }\n else if (splitCount === 0n) {\n return [new IPv6CidrRange(this.getFirst(), prefix)];\n }\n else if (splitCount === 1n) {\n return this.split();\n }\n else {\n let results = this.split();\n while (splitCount > 1) {\n results = results.flatMap(result => result.split());\n splitCount = splitCount - 1n;\n }\n return results;\n }\n }\n /**\n * Returns true if there is an adjacent IPv6 cidr range of exactly the same size next to this range\n */\n hasNextRange() {\n return super.hasNextRange();\n }\n /**\n * Returns true if there is an adjacent IPv6 cidr range of exactly the same size previous to this range\n */\n hasPreviousRange() {\n return super.hasPreviousRange();\n }\n /**\n * Return the next IPv6 cidr range, or undefined if no next range\n */\n nextRange() {\n if (this.hasNextRange()) {\n let sizeOfCurrentRange = this.getSize();\n let startOfNextRange = this.getFirst().getValue() + (sizeOfCurrentRange);\n return new IPv6CidrRange(new IPNumber_1.IPv6(startOfNextRange), this.cidrPrefix);\n }\n return;\n }\n /**\n * Return the previous IPv6 cidr range, or undefined if no next range\n */\n previousRange() {\n if (this.hasPreviousRange()) {\n let sizeOfCurrentRange = this.getSize();\n let startOfPreviousRange = this.getFirst().getValue() - sizeOfCurrentRange;\n return new IPv6CidrRange(new IPNumber_1.IPv6(startOfPreviousRange), this.cidrPrefix);\n }\n return;\n }\n}\nexports.IPv6CidrRange = IPv6CidrRange;\n// utility functions shared by both IPv6CidrRange and IPv4CidrRange\nlet last = (range, ip) => {\n let bitValue = Number(range.bitValue.valueOf());\n let maskSize = BigInt(`0b${\"1\".repeat(bitValue)}`);\n let maskAsBigInteger = range.cidrPrefix.toMask().getValue();\n let invertedMask = (0, BinaryUtils_1.leftPadWithZeroBit)((maskAsBigInteger ^ (maskSize)).toString(2), bitValue);\n if (isIPv4CidrRange(range)) {\n return IPNumber_1.IPv4.fromNumber((ip.getValue()) | ((0, BinaryUtils_1.parseBinaryStringToBigInt)(invertedMask)));\n }\n else {\n return IPNumber_1.IPv6.fromBigInt((ip.getValue()) | ((0, BinaryUtils_1.parseBinaryStringToBigInt)(invertedMask)));\n }\n};\nfunction isIPv4CidrRange(ip) {\n return ip.bitValue.valueOf() === 32n;\n}\n//# sourceMappingURL=IPRange.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Pool = void 0;\nconst IPRange_1 = require(\"./IPRange\");\nconst Prefix_1 = require(\"./Prefix\");\n/**\n * Represents a collection of IP {@link RangedSet}'s\n */\nclass Pool {\n /**\n * Convenient method for creating an instance from arrays of {@link IPv4} or {@link IPv6}\n * @param ipNumbers the arrays of {@link IPv4} or {@link IPv6} that will make up the pool.\n */\n static fromIP(ipNumbers) {\n let ranges = ipNumbers.map((ip) => {\n return IPRange_1.RangedSet.fromSingleIP(ip);\n });\n return new Pool(ranges);\n }\n /**\n * Convenient method for creating an instance from arrays of {@link RangedSet}.\n *\n * @param ipRanges the arrays of {@link RangedSet}'s that will make up the pool.\n */\n // TODO: TSE: This makes it possible to create an instance containing both Range set of IPv4 and IPv6\n static fromRangeSet(ipRanges) {\n return new Pool(ipRanges);\n }\n /**\n * Convenient method for creating an instance from arrays of {@link IPv4CidrRange} or {@link IPv6CidrRange}.\n *\n * @param cidrRanges the arrays of {@link IPv4CidrRange} or {@link IPv6CidrRange} that will make up the pool.\n */\n static fromCidrRanges(cidrRanges) {\n let cidr = cidrRanges;\n let rangeSet = cidr.map((range) => {\n return range.toRangeSet();\n });\n return new Pool(rangeSet);\n }\n /**\n * Constructor for an IP pool.\n *\n * Creates a Pool of IP ranges from supplied {@link RangedSet}'s\n *\n * @param ranges the array of IP ranges that would make up the pool.\n */\n constructor(ranges) {\n this.backingSet = new SortedSet();\n ranges.forEach(range => {\n this.backingSet.add(range);\n });\n }\n /**\n * Returns an array of {@link RangedSet}'s that is contained within the pool\n */\n getRanges() {\n return this.backingSet.asArray();\n }\n /**\n * Returns an new {@link Pool} with all the IP ranges aggregated\n */\n aggregate() {\n let sortedRanges = this.backingSet.asArray();\n let mergedRanges = sortedRanges.reduce((accumulator, currentRange, currentIndex, array) => {\n if (accumulator.length == 0) {\n accumulator.push(currentRange);\n return accumulator;\n }\n else {\n let previous = accumulator.pop();\n let previousCidrRange = previous.toCidrRange();\n let currentCidrRange = currentRange.toCidrRange();\n if (previousCidrRange.isCidrMergeable(currentCidrRange)) {\n let merged = previousCidrRange.merge(currentCidrRange);\n accumulator.push(merged.toRangeSet());\n return accumulator;\n }\n else {\n if (!previous.contains(currentRange)) {\n accumulator.push(previous);\n accumulator.push(currentRange);\n }\n else {\n accumulator.push(previous);\n }\n return accumulator;\n }\n }\n }, []);\n let aggregatedPool = Pool.fromRangeSet(mergedRanges);\n if (aggregatedPool.getRanges().length !== this.getRanges().length) {\n return aggregatedPool.aggregate();\n }\n else {\n return aggregatedPool;\n }\n }\n /**\n * Gets a single range of size of the given prefix from pool.\n * Only returns a range if there is a single range in the pool of same size or greater than given prefix.\n *\n * throws exception if the requested range cannot be got from the pool.\n *\n * @param prefix prefix range to retrieve\n * TODO TSE\n */\n getCidrRange(prefix) {\n if (prefix.toRangeSize() > (this.getSize())) {\n throw new Error(`Not enough IP number in the pool for requested prefix: ${prefix}`);\n }\n let selectedCidrRange;\n let error;\n loop: for (let range of this.getRanges()) {\n for (let offset = 0n; offset + (prefix.toRangeSize()) <= (range.getSize()); offset = offset + 1n)\n try {\n let selectedRange = range.takeSubRange(offset, prefix.toRangeSize());\n selectedCidrRange = selectedRange.toCidrRange();\n let remaining = range.difference(selectedRange);\n this.removeExact(range);\n this.add(remaining);\n break loop;\n }\n catch (e) {\n if (e instanceof RangeError) {\n continue loop;\n }\n error = e instanceof Error ? e : new Error(String(e));\n }\n }\n if (selectedCidrRange) {\n return selectedCidrRange;\n }\n else {\n throw (error === undefined ? new Error(`No range big enough in the pool for requested prefix: ${prefix}`) : error);\n }\n }\n /**\n * Gets a single or multiple ranges that fulfils the given prefix from the pool.\n *\n * throws exception if the requested range cannot be got from the pool.\n *\n * @param reqprefix prefix range to retrieve\n */\n getCidrRanges(reqprefix) {\n if (reqprefix.toRangeSize() > (this.getSize())) {\n throw new Error(\"Prefix greater than pool\");\n }\n let go = (reqprefix, prefix, accummulated) => {\n try {\n let singleCidrRange = this.getCidrRange(prefix);\n accummulated.push(singleCidrRange);\n let currentSize = accummulated.reduce((previous, current) => {\n return previous + (current.getSize());\n }, 0n);\n if (reqprefix.toRangeSize() === (currentSize)) {\n return accummulated;\n }\n else {\n return go(reqprefix, prefix, accummulated);\n }\n }\n catch (e) {\n let lowerPrefix = (0, Prefix_1.isIPv4Prefix)(prefix) ?\n Prefix_1.IPv4Prefix.fromNumber(prefix.getValue() + 1n) : Prefix_1.IPv6Prefix.fromNumber(prefix.getValue() + 1n);\n return go(reqprefix, lowerPrefix, accummulated);\n }\n };\n return go(reqprefix, reqprefix, []);\n }\n /**\n * Returns the size of IP numbers in the pool\n */\n getSize() {\n return this\n .aggregate()\n .getRanges()\n .reduce((previous, current) => {\n return previous + current.getSize();\n }, 0n);\n }\n /**\n * Empties the pool and fill it with given ranges\n *\n * @param ipRanges the range to fill the pool with after emptying\n */\n resetWith(ipRanges) {\n this.backingSet.clear();\n this.backingSet = this.backingSet.add(ipRanges);\n }\n /**\n * Removes the given range from the pool. It only removes if the exact range exist in the pool.\n * It is a Noop and returns false, if the given range does not exist in the pool. Returns true otherwise\n *\n * @param rangeToRemove range to remove from ppol\n */\n removeExact(rangeToRemove) {\n let updatedSet = this.backingSet.removeExact(rangeToRemove);\n let isUpdated = !this.backingSet.isEquals(updatedSet);\n this.backingSet = updatedSet;\n return isUpdated;\n }\n /**\n * Removes the given range from the pool. If the given range overlaps, then it removes the overlapping portion.\n * It is a Noop and returns false, if the given range does not exist in the pool. Returns true otherwise\n *\n * @param rangeToRemove range to remove from ppol\n */\n removeOverlapping(rangeToRemove) {\n let updatedSet = this.backingSet.removeOverlapping(rangeToRemove);\n let isUpdated = !this.backingSet.isEquals(updatedSet);\n this.backingSet = updatedSet;\n return isUpdated;\n }\n /**\n * Adds the given range to the pool.\n *\n * @param range to add to pool.\n */\n add(range) {\n this.backingSet = this.backingSet.add(range);\n }\n /**\n * Removes all ranges from pool\n */\n clear() {\n this.backingSet.clear();\n }\n}\nexports.Pool = Pool;\nclass SortedSet {\n sortArray(array) {\n array.sort((a, b) => {\n if (a.isLessThan(b)) {\n return -1;\n }\n if (a.isGreaterThan(b)) {\n return 1;\n }\n return 0;\n });\n return array;\n }\n constructor(array) {\n if (array) {\n this.backingArray = this.sortArray(array);\n }\n else {\n this.backingArray = new Array();\n }\n }\n asArray() {\n return this.backingArray;\n }\n isEquals(other) {\n if (this.backingArray.length !== other.asArray().length) {\n return false;\n }\n return this.backingArray.every((value, index) => {\n return value.getSize() === (other.asArray()[index].getSize());\n });\n }\n add(item) {\n let array = this.backingArray;\n if (\"push\" in item) {\n array = array.concat(item);\n }\n else {\n array.push(item);\n }\n return new SortedSet(this.sortArray(array));\n }\n removeExact(items) {\n let filtered = this.backingArray\n .filter(currentItem => {\n if (\"push\" in items) {\n return items.find(item => item.isEquals(currentItem)) !== undefined;\n }\n else {\n return !items.isEquals(currentItem);\n }\n });\n return new SortedSet(this.sortArray(filtered));\n }\n removeOverlapping(items) {\n let filtered = this.backingArray\n .flatMap(backingItem => {\n if (\"push\" in items) {\n return items.flatMap(item => {\n if (backingItem.contains(item)) {\n return backingItem.difference(item);\n }\n else if (backingItem.inside(item)) {\n return new Array();\n }\n else if (backingItem.isOverlapping(item)) {\n return [backingItem.subtract(item)];\n }\n else {\n return [item];\n }\n });\n }\n else {\n try {\n return backingItem.difference(items);\n }\n catch (e) {\n return backingItem;\n }\n }\n });\n return new SortedSet(this.sortArray(filtered));\n }\n clear() {\n this.backingArray = [];\n }\n}\n//# sourceMappingURL=IPPool.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * Exposes all the library's modules making them available from the \"ip-num\" module.\n * Making it possible to get access to all any of the modules by doing require(\"ip-num\")\n *\n * @example\n * let ipNum = require(\"ip-num\")\n * ipNum.IPv4CidrRange // gets access to IPv4CidrRange\n * ipNum.Asn // gets access to Asn\n */\n__exportStar(require(\"./BinaryUtils\"), exports);\n__exportStar(require(\"./Hexadecatet\"), exports);\n__exportStar(require(\"./HexadecimalUtils\"), exports);\n__exportStar(require(\"./IPNumber\"), exports);\n__exportStar(require(\"./IPNumType\"), exports);\n__exportStar(require(\"./IPPool\"), exports);\n__exportStar(require(\"./IPRange\"), exports);\n__exportStar(require(\"./IPv6Utils\"), exports);\n__exportStar(require(\"./Octet\"), exports);\n__exportStar(require(\"./Prefix\"), exports);\n__exportStar(require(\"./Validator\"), exports);\n//# sourceMappingURL=index.js.map"],"names":["exports","numberToBinaryString","num","decimalNumberToOctetString","binaryString","parseBinaryStringToBigInt","dottedDecimalNotationToBinaryString","dottedDecimal","binaryAsString","octet","leftPadWithZeroBit","finalStringLength","cidrPrefixToMaskBinaryString","cidrPrefix","ipType","cidrUpperValue","onBits","offBits","intLog2","givenNumber","result","matchingBitCount","firstBinaryString","secondBinaryString","longerString","otherString","count","BinaryUtils_1","require$$0","Validator_1","require$$1","extractPrefix","ipv6String","expandIPv6Number","expandWithZero","hexadecimalArray","hexadecimal","expandDoubleColon","gapCount","pads","prefix","split","leftPortion","rightPortion","leftPortionSplit","rightPortionSplit","doublePortion","leftString","rightString","shortenHexadecatet","hex","withoutLeadingZero","collapseIPv6Number","originalPrefix","processedIPv6String","expandedIPv6","tempExpanded","e","hexadecatets","zeroSequences","currentSequenceStart","currentSequenceLength","i","a","b","bestSequence","leftPartSegments","rightPartSegments","finalStr","IPv6Utils_1","bigIntToHexadecimalString","hexadecimalStringToBinaryString","hexadecimalString","hexadecimalStringToHexadecatetString","colonHexadecimalNotationToBinaryString","hexidecimal","binaryStringToHexadecimalString","hexadectetNotationToBinaryString","hexadectetString","hexadecimalAsString","hexavalue","BinaryUtils_2","HexadecimalUtils_1","require$$2","HexadecimalUtils_2","Validator$1","Validator","ipNumber","lowerBound","upperBound","asnNumber","isValid","ipv4Number","ipv6Number","octetNumber","withinRange","hexadecatetNum","ipv4String","rawOctets","hexadecimals","error","prefixValue","ipNumType","ipv4MaskString","ipv4InBinary","ipv6MaskString","ipv6InBinary","ipv4RangeAsCidrString","cidrComponents","ip","range","validIpv4","invalidIpv4Message","validPrefix","invalidPrefixMessage","invalidMessage","ipv4CidrNotation","value","ipv6CidrNotation","rangeString","cidrNotationValidator","toBinaryStringConverter","prefixFactory","validationResult","mask","ipv4RangeString","firstLastValidator","firstIP","lastIP","ipv6RangeString","validator","rangeComponents","component","validFirstIP","invalidFirstIPMessage","validLastIP","invalidLastIPMessage","ipv6RangeAsCidrString","Hexadecatet_1","Hexadecatet$1","Hexadecatet","rawValue","givenValue","hexadecatetValue","message","msg","Octet_1","Octet$1","Octet","octetValue","IPNumber","isIPv4","BinaryUtils_3","BinaryUtils_4","require$$3","require$$4","require$$5","AbstractIPNum","anotherIPNum","IPv4","bigIntValue","ipString","ipBinaryString","ipValue","octets","binary","IPv6","rawOctet","ipv4BinaryString","Asn","valueAsBigInt","stringValue","high","low","valid16BitAsnNumber","word","values","paddedBinaryString","ipv4","ip4DotDecimalString","hexadecatet","stringHexadecatet","IPv4Mask","stringOctets","IPv6Mask","stringHexadecimals","IPNumType","Prefix","isIPv4Prefix","IPNumber_1","IPv4Prefix","rangeSize","prefixNumber","rangeSizeToPrefix","bits","IPv6Prefix","rangeMaxSize","IPRange","isIPv4CidrRange","Prefix_1","RangedSet","cidrRange","ips","firstIPString","lastIPString","isValidFirstIPv4","isValidSecondIPv4","isValidFirstIPv6","isValidLastIPv6","first","last","otherRange","thisFirst","thisLast","otherFirst","otherLast","netmask","offset","size","valueOfFirstIp","firstIp","valueOfLastIp","lastIp","reminders","computed","returnCount","candidateRange","IPv4CidrRange","IPv6CidrRange","AbstractIPRange","sizeOfCurrentRange","firstValue","lastValue","otherValue","rangeIncidrNotation","errorMessages","messages","ipv4s","iteratingIPv4","errMessage","counter","prefixToSplit","splitCidr","firstIPOfFirstRange","firstRange","firstIPOfSecondRange","secondRange","splitCount","results","startOfNextRange","startOfPreviousRange","rangeInCidrNotation","ipv6","iPv6s","iteratingIPv6","bitValue","maskSize","maskAsBigInteger","invertedMask","IPPool","IPRange_1","Pool","ipNumbers","ranges","ipRanges","cidrRanges","rangeSet","SortedSet","mergedRanges","accumulator","currentRange","currentIndex","array","previous","previousCidrRange","currentCidrRange","merged","aggregatedPool","selectedCidrRange","loop","selectedRange","remaining","reqprefix","go","accummulated","singleCidrRange","currentSize","current","lowerPrefix","rangeToRemove","updatedSet","isUpdated","other","index","item","items","filtered","currentItem","backingItem","__createBinding","this","o","m","k","k2","desc","__exportStar","p","require$$6","require$$7","require$$8","require$$9","require$$10"],"mappings":"yDACA,OAAO,eAAcA,EAAU,aAAc,CAAE,MAAO,GAAM,EAC5DA,EAAA,iBAA2BA,EAAA,QAAkBA,+BAAuCA,EAAA,mBAA6BA,EAAA,oCAA8CA,4BAAoCA,EAAA,2BAAqCA,EAAA,qBAA+B,OAOvQ,IAAIC,EAAwBC,GACjBA,EAAI,SAAS,CAAC,EAEzBF,EAAA,qBAA+BC,EAQ/B,IAAIE,EAA8BD,GAAQ,CACtC,IAAIE,KAAmBJ,EAAQ,sBAAsBE,CAAG,EAExD,GADaE,EAAa,OACb,EACT,MAAM,IAAI,MAAM,+DAA+D,EAEnF,SAAWJ,EAAQ,oBAAoBI,EAAc,CAAC,CAC1D,EACAJ,EAAA,2BAAqCG,EAOrC,IAAIE,EAA6BH,GACtB,OAAO,KAAKA,CAAG,EAAE,EAE5BF,EAAA,0BAAoCK,EAQpC,IAAIC,EAAuCC,GACpBA,EAAc,MAAM,GAAG,EACtB,OAAO,CAACC,EAAgBC,IACjCD,EAAe,UAAWR,EAAQ,4BAA4B,SAASS,CAAK,CAAC,CAAC,EACtF,EAAE,EAETT,EAAA,oCAA8CM,EAO9C,IAAII,EAAqB,CAACN,EAAcO,IAAsB,CAC1D,GAAIP,EAAa,OAASO,EACtB,MAAM,IAAI,MAAM,yEAAyEA,CAAiB,EAAE,EAEhH,MAAO,IAAI,OAAOA,EAAoBP,EAAa,MAAM,EAAE,OAAOA,CAAY,CAClF,EACAJ,EAAA,mBAA6BU,EAO7B,IAAIE,EAA+B,CAACC,EAAYC,IAAW,CACvD,IAAIC,EAOJ,GANID,GAAU,OACVC,EAAiB,GAGjBA,EAAiB,IAEjBF,EAAaE,EACb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