(()=>{var t={104:function(t){(function(e){"use strict";const r="(0?\\d+|0x[a-f0-9]+)";const n={fourOctet:new RegExp(`^${r}\\.${r}\\.${r}\\.${r}$`,"i"),threeOctet:new RegExp(`^${r}\\.${r}\\.${r}$`,"i"),twoOctet:new RegExp(`^${r}\\.${r}$`,"i"),longValue:new RegExp(`^${r}$`,"i")};const i=new RegExp(`^0[0-7]+$`,"i");const s=new RegExp(`^0x[a-f0-9]+$`,"i");const o="%[0-9a-z]{1,}";const a="(?:[0-9a-f]+::?)+";const p={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${a})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${r}\\.${r}\\.${r}\\.${r}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${a})|(?:::)(?:${a})?)${r}\\.${r}\\.${r}\\.${r}(${o})?$`,"i")};function expandIPv6(t,e){if(t.indexOf("::")!==t.lastIndexOf("::")){return null}let r=0;let n=-1;let i=(t.match(p.zoneIndex)||[])[0];let s,o;if(i){i=i.substring(1);t=t.replace(/%.+$/,"")}while((n=t.indexOf(":",n+1))>=0){r++}if(t.substr(0,2)==="::"){r--}if(t.substr(-2,2)==="::"){r--}if(r>e){return null}o=e-r;s=":";while(o--){s+="0:"}t=t.replace("::",s);if(t[0]===":"){t=t.slice(1)}if(t[t.length-1]===":"){t=t.slice(0,-1)}e=function(){const e=t.split(":");const r=[];for(let t=0;t0){s=r-n;if(s<0){s=0}if(t[i]>>s!==e[i]>>s){return false}n-=r;i+=1}return true}function parseIntAuto(t){if(s.test(t)){return parseInt(t,16)}if(t[0]==="0"&&!isNaN(parseInt(t[1],10))){if(i.test(t)){return parseInt(t,8)}throw new Error(`ipaddr: cannot parse ${t} as octal`)}return parseInt(t,10)}function padPart(t,e){while(t.length=0;n-=1){i=this.octets[n];if(i in r){s=r[i];if(e&&s!==0){return null}if(s!==8){e=true}t+=s}else{return null}}return 32-t};IPv4.prototype.range=function(){return u.subnetMatch(this,this.SpecialRanges)};IPv4.prototype.toByteArray=function(){return this.octets.slice(0)};IPv4.prototype.toIPv4MappedAddress=function(){return u.IPv6.parse(`::ffff:${this.toString()}`)};IPv4.prototype.toNormalizedString=function(){return this.toString()};IPv4.prototype.toString=function(){return this.octets.join(".")};return IPv4}();u.IPv4.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t);const r=e[0].toByteArray();const n=this.subnetMaskFromPrefixLength(e[1]).toByteArray();const i=[];let s=0;while(s<4){i.push(parseInt(r[s],10)|parseInt(n[s],10)^255);s++}return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}};u.IPv4.isIPv4=function(t){return this.parser(t)!==null};u.IPv4.isValid=function(t){try{new this(this.parser(t));return true}catch(t){return false}};u.IPv4.isValidCIDR=function(t){try{this.parseCIDR(t);return true}catch(t){return false}};u.IPv4.isValidFourPartDecimal=function(t){if(u.IPv4.isValid(t)&&t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/)){return true}else{return false}};u.IPv4.networkAddressFromCIDR=function(t){let e,r,n,i,s;try{e=this.parseCIDR(t);n=e[0].toByteArray();s=this.subnetMaskFromPrefixLength(e[1]).toByteArray();i=[];r=0;while(r<4){i.push(parseInt(n[r],10)&parseInt(s[r],10));r++}return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}};u.IPv4.parse=function(t){const e=this.parser(t);if(e===null){throw new Error("ipaddr: string is not formatted like an IPv4 Address")}return new this(e)};u.IPv4.parseCIDR=function(t){let e;if(e=t.match(/^(.+)\/(\d+)$/)){const t=parseInt(e[2]);if(t>=0&&t<=32){const r=[this.parse(e[1]),t];Object.defineProperty(r,"toString",{value:function(){return this.join("/")}});return r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")};u.IPv4.parser=function(t){let e,r,i;if(e=t.match(n.fourOctet)){return function(){const t=e.slice(1,6);const n=[];for(let e=0;e4294967295||i<0){throw new Error("ipaddr: address outside defined range")}return function(){const t=[];let e;for(e=0;e<=24;e+=8){t.push(i>>e&255)}return t}().reverse()}else if(e=t.match(n.twoOctet)){return function(){const t=e.slice(1,4);const r=[];i=parseIntAuto(t[1]);if(i>16777215||i<0){throw new Error("ipaddr: address outside defined range")}r.push(parseIntAuto(t[0]));r.push(i>>16&255);r.push(i>>8&255);r.push(i&255);return r}()}else if(e=t.match(n.threeOctet)){return function(){const t=e.slice(1,5);const r=[];i=parseIntAuto(t[2]);if(i>65535||i<0){throw new Error("ipaddr: address outside defined range")}r.push(parseIntAuto(t[0]));r.push(parseIntAuto(t[1]));r.push(i>>8&255);r.push(i&255);return r}()}else{return null}};u.IPv4.subnetMaskFromPrefixLength=function(t){t=parseInt(t);if(t<0||t>32){throw new Error("ipaddr: invalid IPv4 prefix length")}const e=[0,0,0,0];let r=0;const n=Math.floor(t/8);while(r=0;s-=1){n=this.parts[s];if(n in r){i=r[n];if(e&&i!==0){return null}if(i!==16){e=true}t+=i}else{return null}}return 128-t};IPv6.prototype.range=function(){return u.subnetMatch(this,this.SpecialRanges)};IPv6.prototype.toByteArray=function(){let t;const e=[];const r=this.parts;for(let n=0;n>8);e.push(t&255)}return e};IPv6.prototype.toFixedLengthString=function(){const t=function(){const t=[];for(let e=0;e>8,e&255,r>>8,r&255])};IPv6.prototype.toNormalizedString=function(){const t=function(){const t=[];for(let e=0;en){r=i.index;n=i[0].length}}if(n<0){return e}return`${e.substring(0,r)}::${e.substring(r+n)}`};IPv6.prototype.toString=function(){return this.toRFC5952String()};return IPv6}();u.IPv6.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t);const r=e[0].toByteArray();const n=this.subnetMaskFromPrefixLength(e[1]).toByteArray();const i=[];let s=0;while(s<16){i.push(parseInt(r[s],10)|parseInt(n[s],10)^255);s++}return new this(i)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}};u.IPv6.isIPv6=function(t){return this.parser(t)!==null};u.IPv6.isValid=function(t){if(typeof t==="string"&&t.indexOf(":")===-1){return false}try{const e=this.parser(t);new this(e.parts,e.zoneId);return true}catch(t){return false}};u.IPv6.isValidCIDR=function(t){if(typeof t==="string"&&t.indexOf(":")===-1){return false}try{this.parseCIDR(t);return true}catch(t){return false}};u.IPv6.networkAddressFromCIDR=function(t){let e,r,n,i,s;try{e=this.parseCIDR(t);n=e[0].toByteArray();s=this.subnetMaskFromPrefixLength(e[1]).toByteArray();i=[];r=0;while(r<16){i.push(parseInt(n[r],10)&parseInt(s[r],10));r++}return new this(i)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}};u.IPv6.parse=function(t){const e=this.parser(t);if(e.parts===null){throw new Error("ipaddr: string is not formatted like an IPv6 Address")}return new this(e.parts,e.zoneId)};u.IPv6.parseCIDR=function(t){let e,r,n;if(r=t.match(/^(.+)\/(\d+)$/)){e=parseInt(r[2]);if(e>=0&&e<=128){n=[this.parse(r[1]),e];Object.defineProperty(n,"toString",{value:function(){return this.join("/")}});return n}}throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")};u.IPv6.parser=function(t){let e,r,n,i,s,o;if(n=t.match(p.deprecatedTransitional)){return this.parser(`::ffff:${n[1]}`)}if(p.native.test(t)){return expandIPv6(t,8)}if(n=t.match(p.transitional)){o=n[6]||"";e=n[1];if(!n[1].endsWith("::")){e=e.slice(0,-1)}e=expandIPv6(e+o,6);if(e.parts){s=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])];for(r=0;r128){throw new Error("ipaddr: invalid IPv6 prefix length")}const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(t/8);while(r