var punycode=new function(){function r(a,d,c){a=c?Math.floor(a/s):a>>1;a+=Math.floor(a/d);for(d=0;a>(l-p)*q>>1;d+=l)a=Math.floor(a/(l-p));return Math.floor(d+(l-p+1)*a/(a+t))}function u(a,d){a-=(a-97<26)<<5;return a+((!d&&a-65<26)<<5)}this.utf16={decode:function(a){for(var d=[],c=0,f=a.length,e,m;c<f;){e=a.charCodeAt(c++);if((e&63488)===55296){m=a.charCodeAt(c++);if((e&64512)!==55296||(m&64512)!==56320)throw new RangeError("UTF-16(decode): Illegal UTF-16 sequence");e=((e&1023)<<10)+(m&1023)+65536}d.push(e)}return d},
encode:function(a){for(var d=[],c=0,f=a.length,e;c<f;){e=a[c++];if((e&63488)===55296)throw new RangeError("UTF-16(encode): Illegal UTF-16 value");if(e>65535){e-=65536;d.push(String.fromCharCode(e>>>10&1023|55296));e=56320|e&1023}d.push(String.fromCharCode(e))}return d.join("")}};var l=36,s=700,p=1,q=26,t=38;this.decode=function(a,d){var c=[],f=[],e=a.length,m,k,b,h,g,i,n,j,o;m=128;b=0;h=72;g=a.lastIndexOf("-");if(g<0)g=0;for(i=0;i<g;++i){if(d)f[c.length]=a.charCodeAt(i)-65<26;if(a.charCodeAt(i)>=
128)throw new RangeError("Illegal input >= 0x80");c.push(a.charCodeAt(i))}for(g=g>0?g+1:0;g<e;){i=b;k=1;for(n=l;;n+=l){if(g>=e)throw RangeError("punycode_bad_input(1)");j=a.charCodeAt(g++);j=j-48<10?j-22:j-65<26?j-65:j-97<26?j-97:l;if(j>=l)throw RangeError("punycode_bad_input(2)");if(j>Math.floor((2147483647-b)/k))throw RangeError("punycode_overflow(1)");b+=j*k;o=n<=h?p:n>=h+q?q:n-h;if(j<o)break;if(k>Math.floor(2147483647/(l-o)))throw RangeError("punycode_overflow(2)");k*=l-o}k=c.length+1;h=r(b-i,
k,i===0);if(Math.floor(b/k)>2147483647-m)throw RangeError("punycode_overflow(3)");m+=Math.floor(b/k);b%=k;d&&f.splice(b,0,a.charCodeAt(g-1)-65<26);c.splice(b,0,m);b++}if(d){b=0;for(e=c.length;b<e;b++)if(f[b])c[b]=String.fromCharCode(c[b]).toUpperCase().charCodeAt(0)}return this.utf16.encode(c)};this.encode=function(a,d){var c,f,e,m,k,b,h,g,i,n;if(d)n=this.utf16.decode(a);a=this.utf16.decode(a.toLowerCase());var j=a.length;if(d)for(b=0;b<j;b++)n[b]=a[b]!=n[b];var o=[];c=128;f=0;k=72;for(b=0;b<j;++b)if(a[b]<
128)o.push(String.fromCharCode(n?u(a[b],n[b]):a[b]));e=m=o.length;for(m>0&&o.push("-");e<j;){h=2147483647;for(b=0;b<j;++b){g=a[b];if(g>=c&&g<h)h=g}if(h-c>Math.floor((2147483647-f)/(e+1)))throw RangeError("punycode_overflow (1)");f+=(h-c)*(e+1);c=h;for(b=0;b<j;++b){g=a[b];if(g<c)if(++f>2147483647)return Error("punycode_overflow(2)");if(g==c){h=f;for(g=l;;g+=l){i=g<=k?p:g>=k+q?q:g-k;if(h<i)break;o.push(String.fromCharCode(i+(h-i)%(l-i)+22+75*(i+(h-i)%(l-i)<26)-(false<<5)));h=Math.floor((h-i)/(l-i))}o.push(String.fromCharCode(h+
22+75*(h<26)-(((d&&n[b]?1:0)!=0)<<5)));k=r(f,e+1,e==m);f=0;++e}}++f;++c}return o.join("")};this.ToASCII=function(a){a=a.split(".");for(var d=[],c=0;c<a.length;++c){var f=a[c];d.push(f.match(/[^A-Za-z0-9-]/)?"xn--"+punycode.encode(f):f)}return d.join(".")};this.URLToUnicode=function(a){var d=lpParseUri(a),c=this.ToUnicode(d.host);if(d.host==c)return a;return a.replace(d.host,c)};this.ToUnicode=function(a){a=a.split(".");for(var d=[],c=0;c<a.length;++c){var f=a[c];d.push(f.match(/^xn--/)?punycode.decode(f.slice(4)):
f)}return d.join(".")}};
