var result = [\n\t * {\n\t * ipLow : 2071689984,\n\t * ipLowStr : \"123.123.123.0\",\n\t * ipHigh : 2071690239,\n\t * ipHighStr : \"123.123.123.255\",\n\t * prefixMask : 4294967040,\n\t * prefixMaskStr : \"255.255.255.0\",\n\t * prefixSize : 24,\n\t * invertedMask : 255,\n\t * invertedMaskStr : \"0.0.0.255\",\n\t * invertedMaskSize : 8\n\t * },\n\t *\n\t * ...\n\t * ];\n\t *
\n\t * @public\n\t */\n\tcalculate : function( ipStart, ipEnd )\n\t{\n\t\tvar ipStartNum, ipEndNum, ipCurNum;\n\t\tvar rangeCollection = [];\n\n\t\ttry\n\t\t{\n\t\t\tipStartNum\t= this.toDecimal( ipStart );\n\t\t\tipEndNum\t= this.toDecimal( ipEnd );\n\t\t}\n\t\tcatch( err )\n\t\t{\n\t\t\treturn null;\n\t\t}\n\t\t\n\t\tif( ipEndNum < ipStartNum )\n\t\t{\n\t\t\treturn null;\n\t\t}\n\t\n\t\tipCurNum = ipStartNum;\n\t\t\n\t\twhile( ipCurNum <= ipEndNum )\n\t\t{\n\t\t\tvar optimalRange = this.getOptimalRange( ipCurNum, ipEndNum );\n\t\t\t\n\t\t\tif( optimalRange === null )\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\n\t\t\trangeCollection.push( optimalRange );\n\t\t\t\n\t\t\tipCurNum = optimalRange.ipHigh + 1;\n\t\t}\n\t\t\t\t\n\t\treturn rangeCollection;\n\t},\n\t\n\t\n\t/**\n\t * Calculates a subnet mask from CIDR prefix.\n\t *\n\t * @param {string|number} ip IP address (\"2.3.4.5\")\n\t * @param {int} prefixSize Number of relevant bits in the subnet mask (24)\n\t * @return {object|null} Returns null in case of an error, and a subnet data object otherwise.\n\t * For details about the subnet data object, see documentation of\n\t * getMaskRange()\n\t * @public\n\t */\n\tcalculateSubnetMask : function( ip, prefixSize )\n\t{\n\t\tvar ipNum;\n\n\t\ttry\n\t\t{\n\t\t\tipNum = this.toDecimal( ip );\n\t\t}\n\t\tcatch( err )\n\t\t{\n\t\t\treturn null;\n\t\t}\n\t\t\t\t\n\t\treturn this.getMaskRange( ipNum, prefixSize );\n\t},\n\t\n\t\n\t/**\n\t * Calculates a CIDR prefix from subnet mask.\n\t *\n\t * @param {string|number} ip IP address (\"2.3.4.5\")\n\t * @param {string|number} subnetMask IP subnet mask (\"255.255.255.0\")\n\t * @return {object|null} Returns `null` in case of an error, and a subnet data object otherwise.\n\t * For details about the subnet data object, see documentation of\n\t * getMaskRange()\n\t * @public\n\t */\n\tcalculateCIDRPrefix : function( ip, subnetMask )\n\t{\n\t\tvar ipNum,\n\t\t\tsubnetMaskNum,\n\t\t\tprefix\t\t\t= 0,\n\t\t\tnewPrefix\t\t= 0,\n\t\t\tprefixSize;\n\n\t\ttry\n\t\t{\n\t\t\tipNum\t\t\t= this.toDecimal( ip );\n\t\t\tsubnetMaskNum\t= this.toDecimal( subnetMask );\n\t\t}\n\t\tcatch( err )\n\t\t{\n\t\t\treturn null;\n\t\t}\n\n\t\tfor( prefixSize = 0; prefixSize < 32; prefixSize++ )\n\t\t{\n\t\t\tnewPrefix = ( prefix + ( 1 << ( 32 - ( prefixSize + 1 ) ) ) ) >>> 0;\n\t\t\n\t\t\tif( ( ( subnetMaskNum & newPrefix ) >>> 0 ) !== newPrefix )\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\n\t\t\tprefix = newPrefix;\n\t\t}\n\t\t\n\t\treturn this.getMaskRange( ipNum, prefixSize );\n\t},\n\t\n\n\t/**\n\t * Finds the largest subnet mask that begins from ipNum and does not\n\t * exceed ipEndNum.\n\t *\n\t * @param {int} ipNum IP start point (inclusive)\n\t * @param {int} ipEndNum IP end point (inclusive)\n\t * @return {object|null} Returns `null` on failure, otherwise an object with the following fields:\n\t *\n\t * ipLow - Decimal representation of the lowest IP address in the subnet\n\t * ipLowStr - String representation of the lowest IP address in the subnet\n\t * ipHigh - Decimal representation of the highest IP address in the subnet\n\t * ipHighStr - String representation of the highest IP address in the subnet\n\t * prefixMask - Bitmask matching prefixSize\n\t * prefixMaskStr - String / IP representation of the bitmask\n\t * prefixSize - Size of the prefix\n\t * invertedMask - Bitmask matching the inverted subnet mask\n\t * invertedMaskStr - String / IP representation of the inverted mask\n\t * invertedSize - Number of relevant bits in the inverted mask\n\t * @private\n\t */\n\tgetOptimalRange : function( ipNum, ipEndNum )\n\t{\n\t\tvar prefixSize,\n\t\t\toptimalRange = null;\n\t\t\n\t\tfor( prefixSize = 32; prefixSize >= 0; prefixSize-- )\n\t\t{\n\t\t\tvar maskRange = this.getMaskRange( ipNum, prefixSize );\n\t\t\t\n\t\t\tif( ( maskRange.ipLow === ipNum ) && ( maskRange.ipHigh <= ipEndNum ) )\n\t\t\t{\n\t\t\t\toptimalRange = maskRange;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn optimalRange;\n\t},\n\n\n\t/**\n\t * Calculates details of a CIDR subnet\n\t *\n\t * @param {int} ipNum Decimal IP address\n\t * @param {int} prefixSize Subnet mask size in bits\n\t * @return {object} Returns an object with the following fields:\n\t *\n\t * ipLow - Decimal representation of the lowest IP address in the subnet\n\t * ipLowStr - String representation of the lowest IP address in the subnet\n\t * ipHigh - Decimal representation of the highest IP address in the subnet\n\t * ipHighStr - String representation of the highest IP address in the subnet\n\t * prefixMask - Bitmask matching prefixSize\n\t * prefixMaskStr - String / IP representation of the bitmask\n\t * prefixSize - Size of the prefix\n\t * invertedMask - Bitmask matching the inverted subnet mask\n\t * invertedMaskStr - String / IP representation of the inverted mask\n\t * invertedSize - Number of relevant bits in the inverted mask\n\t * @private\n\t */\n\tgetMaskRange : function( ipNum, prefixSize )\n\t{\n\t\tvar prefixMask\t= this.getPrefixMask( prefixSize ),\n\t\t\tlowMask\t\t= this.getMask( 32 - prefixSize ),\n\t\t\tipLow\t\t= ( ipNum & prefixMask ) >>> 0,\n\t\t\tipHigh\t\t= ( ( ( ipNum & prefixMask ) >>> 0 ) + lowMask ) >>> 0;\n\n\t\treturn {\n\t\t\tipLow\t\t\t: ipLow,\n\t\t\tipLowStr\t\t: this.toString( ipLow ),\n\t\t\t\n\t\t\tipHigh\t\t\t: ipHigh,\n\t\t\tipHighStr\t\t: this.toString( ipHigh ),\n\t\t\t\n\t\t\tprefixMask\t\t: prefixMask,\n\t\t\tprefixMaskStr\t: this.toString( prefixMask ),\n\t\t\tprefixSize\t\t: prefixSize,\n\t\t\t\n\t\t\tinvertedMask\t: lowMask,\n\t\t\tinvertedMaskStr\t: this.toString( lowMask ),\n\t\t\tinvertedSize\t: 32 - prefixSize\n\t\t};\n\t},\n\n\n\t/**\n\t * Creates a bitmask with maskSize leftmost bits set to one\n\t *\n\t * @param {int} prefixSize Number of bits to be set\n\t * @return {int} Returns the bitmask\n\t * @private\n\t */\n\tgetPrefixMask : function( prefixSize )\n\t{\n\t\tvar mask = 0,\n\t\t\ti;\n\t\t\n\t\tfor( i = 0; i < prefixSize; i++ )\n\t\t{\n\t\t\tmask += ( 1 << ( 32 - ( i + 1 ) ) ) >>> 0;\n\t\t}\n\t\t\n\t\treturn mask;\n\t},\n\t\n\t\n\t/**\n\t * Creates a bitmask with maskSize rightmost bits set to one\n\t *\n\t * @param {int} maskSize Number of bits to be set\n\t * @return {int} Returns the bitmask\n\t * @private\n\t */\n\tgetMask : function( maskSize )\n\t{\n\t\tvar mask = 0,\n\t\t\ti;\n\t\t\n\t\tfor( i = 0; i < maskSize; i++ )\n\t\t{\n\t\t\tmask += ( 1 << i ) >>> 0;\n\t\t}\n\t\t\n\t\treturn mask;\n\t},\n\n\n\t/**\n\t * Test whether string is an IP address\n\t * @param {string} ip\n\t * @returns {boolean}\n\t * @public\n\t */\n\tisIp : function( ip )\n\t{\n\t\tif( typeof ip !== 'string' )\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\tvar parts = ip.match( /^([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$/ );\n\n\t\tif( parts === null )\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\tfor( var i = 1; i <= 4; i++ )\n\t\t{\n\t\t\tvar n = parseInt( parts[ i ], 10 );\n\n\t\t\tif( ( n > 255 ) || ( n < 0 ) )\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t},\n\n\n\t/**\n\t * Test whether number is an IP address\n \t * @param {number} ipNum\n\t * @returns {boolean}\n\t * @public\n\t */\n\tisDecimalIp : function( ipNum )\n\t{\n\t\treturn (\n\t\t\t\t( typeof ipNum === 'number' ) && // is this a number?\n\t\t\t\t( ipNum % 1 === 0 ) && // does the number have a decimal place?\n\t\t\t\t( ipNum >= 0 ) &&\n\t\t\t\t( ipNum <= 4294967295 )\n\t\t\t);\n\t},\n\n\t\n\t/**\n\t * Converts string formatted IPs to decimal representation\n\t *\n\t * @link http://javascript.about.com/library/blipconvert.htm\n\t * @param {string|number} ipString IP address in string format. If a decimal representation given, it is returned unmodified.\n\t * @return {int} Returns the IP address in decimal format\n\t * @throws {Error} Throws an error, if `ipString` does not contain an IP address.\n\t * @private\n\t */\n\ttoDecimal : function( ipString )\n\t{\n\t\tif( ( typeof ipString === 'number' ) && ( this.isDecimalIp( ipString ) === true ) )\n\t\t{\n\t\t\treturn ipString;\n\t\t}\n\n\t\tif( this.isIp( ipString ) === false )\n\t\t{\n\t\t\tthrow new Error( 'Not an IP address: ' + ipString );\n\t\t}\n\n\t\tvar d = ipString.split( '.' );\n\n\t\treturn ( ( ( ( ( ( +d[ 0 ] ) * 256 ) + ( +d [ 1 ] ) ) * 256 ) + ( +d[ 2 ] ) ) * 256 ) + ( +d[ 3 ] );\n\t},\n\t\n\t\n\t/**\n\t * Converts decimal IPs to string representation\n\t *\n\t * @link http://javascript.about.com/library/blipconvert.htm\n\t * @param {int} ipNum IP address in decimal format. If a string representation is given, it is returned unmodified.\n\t * @return {string} Returns the IP address in string format\n\t * @throws {Error} Throws an error, if `ipNum` is out of range, not a decimal, or not a number\n\t * @private\n\t */\n\ttoString : function( ipNum )\n\t{\n\t\tif( ( typeof ipNum === 'string' ) && ( this.isIp( ipNum ) === true ) )\n\t\t{\n\t\t\treturn ipNum;\n\t\t}\n\n\t\tif( this.isDecimalIp( ipNum ) === false )\n\t\t{\n\t\t\tthrow new Error( 'Not a numeric IP address: ' + ipNum );\n\t\t}\n\n\t\tvar d = ipNum % 256;\n\t\t\n\t\tfor( var i = 3; i > 0; i-- )\n\t\t{\n\t\t\tipNum\t= Math.floor( ipNum / 256 );\n\t\t\td\t\t= ipNum % 256 + '.' + d;\n\t\t}\n\t\t\n\t\treturn d;\n\t}\n};\n\n\nif( ( typeof define === 'function' ) && ( define.amd ) )\n{\n\tdefine( [], function() { return IpSubnetCalculator; } );\n}\nelse if( typeof exports === 'object' )\n{\n\tmodule.exports = IpSubnetCalculator;\n}\n\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bigint: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","/**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n/*\n Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n'use strict';var aa=require(\"react\"),ca=require(\"scheduler\");function p(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;ca||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","import arrayWithHoles from \"./arrayWithHoles.js\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableRest from \"./nonIterableRest.js\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"];\n\n if (_i == null) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n\n var _s, _e;\n\n try {\n for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import React from 'react'\nimport \"./Results.css\"\n\nvar IpSubnetCalculator = require( 'ip-subnet-calculator' );\n\nconst Results = (props) => {\n var results = IpSubnetCalculator.calculateSubnetMask( props.ip, props.cidr );\n return (\n
\n Network Address: {results.ipLowStr}\n
\n Broadcast Address: {results.ipHighStr}\n
\n Host Range: {IpSubnetCalculator.toString(results.ipLow+1)}-{IpSubnetCalculator.toString(results.ipHigh-1)}\n
\n
\n < Results ip={ip} cidr={cidr} />\n