const r=128,e=1114111;function t(r){return r<26?97+r:22+r}function n(r){if(r<=90){if(r>=65)return r-65;if(r>=48&&r<=57)return r-22}else if(r>=97&&r<=122)return r-97;throw new Error(`not alphanumeric ASCII: 0x${r.toString(16)}`)}function o(r,e){let t=r-e;return t<=0?1:t>=26?26:t}function i(r,e,t){r=Math.floor(r/(t?700:2)),r+=Math.floor(r/e);let n=0;for(;r>455;)r=Math.floor(r/35),n+=36;return n+Math.floor(36*r/(r+38))}function f(r){return[...r].map((r=>r.codePointAt(0)))}function l(r,e){return Array.isArray(r)&&r.every((r=>Number.isSafeInteger(r)&&r>=0&&r<=e))}function u(r){if("string"==typeof r){let e=f(r),t=h(e);return e===t?r:String.fromCharCode(...t)}return String.fromCharCode(...c(r))}function c(r){if("string"==typeof r)return h(f(r));if(l(r,1114111)){let e=h(r);return r==e?r.slice():e}throw new Error("expected Unicode")}function h(r){let e=r.filter((r=>r<128)),n=e.length;if(n==r.length)return r;e.splice(0,0,120,110,45,45),n&&e.push(45);let f=128,l=72,u=0,c=n;for(;ce>=f&&e=4)||120!=t[0]&&88!=t[0]||110!=t[1]&&78!=t[1]||45!=t[2]||45!=t[3]?e===r?e.slice():e:p(e.slice(4));var t}function g(r){return p(a(r))}function p(r){let e=r.lastIndexOf(45)+1,t=Math.max(0,e-1),f=r.slice(0,t),l=0,u=128,c=72;for(;e=r.length)throw new Error("invalid encoding");h*=36-i,a+=36}let s=f.length+1;if(c=i(l-t,s,0==t),u+=Math.floor(l/s),u>1114111)throw new Error("invalid encoding");l%=s,f.splice(l++,0,u)}return f}function d(r){return r>=55296&&r<=57343}export{e as MAX_CP,r as MIN_CP,d as is_surrogate,g as puny_decode,s as puny_decoded,u as puny_encoded,c as puny_encoded_bytes};