function isIPv4(t){return!!RE_V4.test(t)||(!!RE_V4_HEX.test(t)||!!RE_V4_NUMERIC.test(t))}function isIPv6(t){function s(t,s){return(t.length-t.replace(new RegExp(s,"g"),"").length)/s.length}var r=0,e=t.match(RE_V4inV6);if(e){for(var n=e[0].split("."),i=0;i<4;i++)if(/^0[0-9]+/.test(n[i]))return!1;if(t=t.replace(RE_V4inV6,""),/[0-9]$/.test(t))return!1;t+=n.join(":"),r=2}if(RE_BAD_CHARACTERS.test(t))return!1;if(RE_BAD_ADDRESS.test(t))return!1;var o=s(t,"::");return 1==o&&s(t,":")<=8+r||0==o&&s(t,":")==7+r}function getBaseDomain(t){if(t=t.replace(/\.+$/,""),isIPv6(t)||isIPv4(t))return t;t.indexOf("xn--")>=0&&(t=punycode.toUnicode(t));for(var s=[],r=t,e=r.indexOf("."),n=0;;){var i=publicSuffixes[r];if("undefined"!=typeof i){n=i;break}if(e<0){n=1;break}s.push(r.substring(0,e)),r=r.substring(e+1),e=r.indexOf(".")}for(;n>0&&s.length>0;)r=s.pop()+"."+r,n--;return r}function isThirdParty(t,s){t=t.replace(/\.+$/,""),s=s.replace(/\.+$/,"");var r=getBaseDomain(s);return t.length>r.length?t.substr(t.length-r.length-1)!="."+r:t!=r}function extractHostFromURL(t){if(t&&extractHostFromURL._lastURL==t)return extractHostFromURL._lastDomain;var s="";try{s=new URI(t).host}catch(r){}return extractHostFromURL._lastURL=t,extractHostFromURL._lastDomain=s,s}function URI(t){if(this.spec=t,this._schemeEnd=t.indexOf(":"),this._schemeEnd<0)throw new Error("Invalid URI scheme");if("//"!=t.substr(this._schemeEnd+1,2))throw new Error("Unexpected URI structure");if(this._hostPortStart=this._schemeEnd+3,this._hostPortEnd=t.indexOf("/",this._hostPortStart),this._hostPortEnd<0)throw new Error("Invalid URI host");var s=t.indexOf("@",this._hostPortStart);s>=0&&s<this._hostPortEnd&&(this._hostPortStart=s+1),this._portStart=-1,this._hostEnd=t.indexOf("]",this._hostPortStart+1),"["==t[this._hostPortStart]&&this._hostEnd>=0&&this._hostEnd<this._hostPortEnd?(this._hostStart=this._hostPortStart+1,":"==t[this._hostEnd+1]&&(this._portStart=this._hostEnd+2)):(this._hostStart=this._hostPortStart,this._hostEnd=t.indexOf(":",this._hostStart),this._hostEnd>=0&&this._hostEnd<this._hostPortEnd?this._portStart=this._hostEnd+1:this._hostEnd=this._hostPortEnd)}const RE_V4=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|0x[0-9a-f][0-9a-f]?|0[0-7]{3})\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|0x[0-9a-f][0-9a-f]?|0[0-7]{3})$/i,RE_V4_HEX=/^0x([0-9a-f]{8})$/i,RE_V4_NUMERIC=/^[0-9]+$/,RE_V4inV6=/(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,RE_BAD_CHARACTERS=/([^0-9a-f:])/i,RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]$)/i;URI.prototype={spec:null,get scheme(){return this.spec.substring(0,this._schemeEnd).toLowerCase()},get host(){return this.spec.substring(this._hostStart,this._hostEnd)},get asciiHost(){var t=this.host;return/^[\x00-\x7F]+$/.test(t)?t:punycode.toASCII(t)},get hostPort(){return this.spec.substring(this._hostPortStart,this._hostPortEnd)},get port(){return this._portStart<0?-1:parseInt(this.spec.substring(this._portStart,this._hostPortEnd),10)},get path(){return this.spec.substring(this._hostPortEnd)},get prePath(){return this.spec.substring(0,this._hostPortEnd)}};