"use strict";const maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexPunycode=/^xn--/,regexNonASCII=/[^\0-\x7F]/,regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g,errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=35,floor=Math.floor,stringFromCharCode=String.fromCharCode;function error(o){throw new RangeError(errors[o])}function map(o,e){const r=[];let t=o.length;for(;t--;)r[t]=e(o[t]);return r}function mapDomain(o,e){const r=o.split("@");let t="";return r.length>1&&(t=r[0]+"@",o=r[1]),t+map((o=o.replace(regexSeparators,".")).split("."),e).join(".")}function ucs2decode(o){const e=[];let r=0;const t=o.length;for(;r<t;){const n=o.charCodeAt(r++);if(n>=55296&&n<=56319&&r<t){const t=o.charCodeAt(r++);56320==(64512&t)?e.push(((1023&n)<<10)+(1023&t)+65536):(e.push(n),r--)}else e.push(n)}return e}const ucs2encode=o=>String.fromCodePoint(...o),basicToDigit=function(o){return o>=48&&o<58?o-48+26:o>=65&&o<91?o-65:o>=97&&o<123?o-97:36},digitToBasic=function(o,e){return o+22+75*(o<26)-((0!=e)<<5)},adapt=function(o,e,r){let t=0;for(o=r?floor(o/700):o>>1,o+=floor(o/e);o>455;t+=36)o=floor(o/35);return floor(t+36*o/(o+38))},decode=function(o){const e=[],r=o.length;let t=0,n=128,i=72,c=o.lastIndexOf("-");c<0&&(c=0);for(let r=0;r<c;++r)o.charCodeAt(r)>=128&&error("not-basic"),e.push(o.charCodeAt(r));for(let s=c>0?c+1:0;s<r;){const c=t;for(let e=1,n=36;;n+=36){s>=r&&error("invalid-input");const c=basicToDigit(o.charCodeAt(s++));c>=36&&error("invalid-input"),c>floor((maxInt-t)/e)&&error("overflow"),t+=c*e;const a=n<=i?1:n>=i+26?26:n-i;if(c<a)break;const d=36-a;e>floor(maxInt/d)&&error("overflow"),e*=d}const a=e.length+1;i=adapt(t-c,a,0==c),floor(t/a)>maxInt-n&&error("overflow"),n+=floor(t/a),t%=a,e.splice(t++,0,n)}return String.fromCodePoint(...e)},encode=function(o){const e=[],r=(o=ucs2decode(o)).length;let t=128,n=0,i=72;for(const r of o)r<128&&e.push(stringFromCharCode(r));const c=e.length;let s=c;for(c&&e.push("-");s<r;){let r=maxInt;for(const e of o)e>=t&&e<r&&(r=e);const a=s+1;r-t>floor((maxInt-n)/a)&&error("overflow"),n+=(r-t)*a,t=r;for(const r of o)if(r<t&&++n>maxInt&&error("overflow"),r===t){let o=n;for(let r=36;;r+=36){const t=r<=i?1:r>=i+26?26:r-i;if(o<t)break;const n=o-t,c=36-t;e.push(stringFromCharCode(digitToBasic(t+n%c,0))),o=floor(n/c)}e.push(stringFromCharCode(digitToBasic(o,0))),i=adapt(n,a,s===c),n=0,++s}++n,++t}return e.join("")},toUnicode=function(o){return mapDomain(o,(function(o){return regexPunycode.test(o)?decode(o.slice(4).toLowerCase()):o}))},toASCII=function(o){return mapDomain(o,(function(o){return regexNonASCII.test(o)?"xn--"+encode(o):o}))},punycode={version:"2.3.1",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:toASCII,toUnicode:toUnicode};module.exports=punycode;