var e=256,t=class{_paddingCharacter;constructor(e=`=`){this._paddingCharacter=e}encodedLength(e){return this._paddingCharacter?(e+2)/3*4|0:(e*8+5)/6|0}encode(e){let t=``,n=0;for(;n>>18&63),t+=this._encodeByte(r>>>12&63),t+=this._encodeByte(r>>>6&63),t+=this._encodeByte(r>>>0&63)}let r=e.length-n;if(r>0){let i=e[n]<<16|(r===2?e[n+1]<<8:0);t+=this._encodeByte(i>>>18&63),t+=this._encodeByte(i>>>12&63),r===2?t+=this._encodeByte(i>>>6&63):t+=this._paddingCharacter||``,t+=this._paddingCharacter||``}return t}maxDecodedLength(e){return this._paddingCharacter?e/4*3|0:(e*6+7)/8|0}decodedLength(e){return this.maxDecodedLength(e.length-this._getPaddingLength(e))}decode(t){if(t.length===0)return new Uint8Array;let n=this._getPaddingLength(t),r=t.length-n,i=new Uint8Array(this.maxDecodedLength(r)),a=0,o=0,s=0,c=0,l=0,u=0,d=0;for(;o>>4,i[a++]=l<<4|u>>>2,i[a++]=u<<6|d,s|=c&e,s|=l&e,s|=u&e,s|=d&e;if(o>>4,s|=c&e,s|=l&e),o>>2,s|=u&e),o>>8&6,t+=51-e>>>8&-75,t+=61-e>>>8&-15,t+=62-e>>>8&3,String.fromCharCode(t)}_decodeChar(t){let n=e;return n+=(42-t&t-44)>>>8&-256+t-43+62,n+=(46-t&t-48)>>>8&-256+t-47+63,n+=(47-t&t-58)>>>8&-256+t-48+52,n+=(64-t&t-91)>>>8&-256+t-65+0,n+=(96-t&t-123)>>>8&-256+t-97+26,n}_getPaddingLength(e){let t=0;if(this._paddingCharacter){for(let n=e.length-1;n>=0&&e[n]===this._paddingCharacter;n--)t++;if(e.length<4||t>2)throw Error(`Base64Coder: incorrect padding`)}return t}},n=new t;function r(e){return n.encode(e)}function i(e){return n.decode(e)}var a=new class extends t{_encodeByte(e){let t=e;return t+=65,t+=25-e>>>8&6,t+=51-e>>>8&-75,t+=61-e>>>8&-13,t+=62-e>>>8&49,String.fromCharCode(t)}_decodeChar(t){let n=e;return n+=(44-t&t-46)>>>8&-256+t-45+62,n+=(94-t&t-96)>>>8&-256+t-95+63,n+=(47-t&t-58)>>>8&-256+t-48+52,n+=(64-t&t-91)>>>8&-256+t-65+0,n+=(96-t&t-123)>>>8&-256+t-97+26,n}};function o(e){return a.encode(e)}var s=65536,c=class{isAvailable=!1;isInstantiated=!1;constructor(){typeof crypto<`u`&&`getRandomValues`in crypto&&(this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable)throw Error(`System random byte generator is not available.`);let t=new Uint8Array(e);for(let e=0;e>16&1),n[e-1]&=65535;n[15]=r[15]-32767-(n[14]>>16&1);let e=n[15]>>16&1;n[14]&=65535,g(r,n,1-e)}for(let t=0;t<16;t++)e[2*t]=r[t]&255,e[2*t+1]=r[t]>>8}function v(e,t){for(let n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function y(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]+n[r]}function b(e,t,n){for(let r=0;r<16;r++)e[r]=t[r]-n[r]}function x(e,t,n){let r,i,a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=0,x=0,S=0,C=0,w=0,T=0,E=0,D=0,O=0,k=0,A=0,j=0,M=0,N=0,P=0,F=0,I=n[0],L=n[1],R=n[2],z=n[3],B=n[4],V=n[5],H=n[6],U=n[7],W=n[8],G=n[9],K=n[10],q=n[11],J=n[12],Y=n[13],X=n[14],Z=n[15];r=t[0],a+=r*I,o+=r*L,s+=r*R,c+=r*z,l+=r*B,u+=r*V,d+=r*H,f+=r*U,p+=r*W,m+=r*G,h+=r*K,g+=r*q,_+=r*J,v+=r*Y,y+=r*X,b+=r*Z,r=t[1],o+=r*I,s+=r*L,c+=r*R,l+=r*z,u+=r*B,d+=r*V,f+=r*H,p+=r*U,m+=r*W,h+=r*G,g+=r*K,_+=r*q,v+=r*J,y+=r*Y,b+=r*X,x+=r*Z,r=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*W,w+=r*G,T+=r*K,E+=r*q,D+=r*J,O+=r*Y,k+=r*X,A+=r*Z,r=t[11],g+=r*I,_+=r*L,v+=r*R,y+=r*z,b+=r*B,x+=r*V,S+=r*H,C+=r*U,w+=r*W,T+=r*G,E+=r*K,D+=r*q,O+=r*J,k+=r*Y,A+=r*X,j+=r*Z,r=t[12],_+=r*I,v+=r*L,y+=r*R,b+=r*z,x+=r*B,S+=r*V,C+=r*H,w+=r*U,T+=r*W,E+=r*G,D+=r*K,O+=r*q,k+=r*J,A+=r*Y,j+=r*X,M+=r*Z,r=t[13],v+=r*I,y+=r*L,b+=r*R,x+=r*z,S+=r*B,C+=r*V,w+=r*H,T+=r*U,E+=r*W,D+=r*G,O+=r*K,k+=r*q,A+=r*J,j+=r*Y,M+=r*X,N+=r*Z,r=t[14],y+=r*I,b+=r*L,x+=r*R,S+=r*z,C+=r*B,w+=r*V,T+=r*H,E+=r*U,D+=r*W,O+=r*G,k+=r*K,A+=r*q,j+=r*J,M+=r*Y,N+=r*X,P+=r*Z,r=t[15],b+=r*I,x+=r*L,S+=r*R,C+=r*z,w+=r*B,T+=r*V,E+=r*H,D+=r*U,O+=r*W,k+=r*G,A+=r*K,j+=r*q,M+=r*J,N+=r*Y,P+=r*X,F+=r*Z,a+=38*x,o+=38*S,s+=38*C,c+=38*w,l+=38*T,u+=38*E,d+=38*D,f+=38*O,p+=38*k,m+=38*A,h+=38*j,g+=38*M,_+=38*N,v+=38*P,y+=38*F,i=1,r=a+i+65535,i=Math.floor(r/65536),a=r-i*65536,r=o+i+65535,i=Math.floor(r/65536),o=r-i*65536,r=s+i+65535,i=Math.floor(r/65536),s=r-i*65536,r=c+i+65535,i=Math.floor(r/65536),c=r-i*65536,r=l+i+65535,i=Math.floor(r/65536),l=r-i*65536,r=u+i+65535,i=Math.floor(r/65536),u=r-i*65536,r=d+i+65535,i=Math.floor(r/65536),d=r-i*65536,r=f+i+65535,i=Math.floor(r/65536),f=r-i*65536,r=p+i+65535,i=Math.floor(r/65536),p=r-i*65536,r=m+i+65535,i=Math.floor(r/65536),m=r-i*65536,r=h+i+65535,i=Math.floor(r/65536),h=r-i*65536,r=g+i+65535,i=Math.floor(r/65536),g=r-i*65536,r=_+i+65535,i=Math.floor(r/65536),_=r-i*65536,r=v+i+65535,i=Math.floor(r/65536),v=r-i*65536,r=y+i+65535,i=Math.floor(r/65536),y=r-i*65536,r=b+i+65535,i=Math.floor(r/65536),b=r-i*65536,a+=i-1+37*(i-1),i=1,r=a+i+65535,i=Math.floor(r/65536),a=r-i*65536,r=o+i+65535,i=Math.floor(r/65536),o=r-i*65536,r=s+i+65535,i=Math.floor(r/65536),s=r-i*65536,r=c+i+65535,i=Math.floor(r/65536),c=r-i*65536,r=l+i+65535,i=Math.floor(r/65536),l=r-i*65536,r=u+i+65535,i=Math.floor(r/65536),u=r-i*65536,r=d+i+65535,i=Math.floor(r/65536),d=r-i*65536,r=f+i+65535,i=Math.floor(r/65536),f=r-i*65536,r=p+i+65535,i=Math.floor(r/65536),p=r-i*65536,r=m+i+65535,i=Math.floor(r/65536),m=r-i*65536,r=h+i+65535,i=Math.floor(r/65536),h=r-i*65536,r=g+i+65535,i=Math.floor(r/65536),g=r-i*65536,r=_+i+65535,i=Math.floor(r/65536),_=r-i*65536,r=v+i+65535,i=Math.floor(r/65536),v=r-i*65536,r=y+i+65535,i=Math.floor(r/65536),y=r-i*65536,r=b+i+65535,i=Math.floor(r/65536),b=r-i*65536,a+=i-1+37*(i-1),e[0]=a,e[1]=o,e[2]=s,e[3]=c,e[4]=l,e[5]=u,e[6]=d,e[7]=f,e[8]=p,e[9]=m,e[10]=h,e[11]=g,e[12]=_,e[13]=v,e[14]=y,e[15]=b}function S(e,t){x(e,t,t)}function C(e,t){let n=f();for(let e=0;e<16;e++)n[e]=t[e];for(let e=253;e>=0;e--)S(n,n),e!==2&&e!==4&&x(n,n,t);for(let t=0;t<16;t++)e[t]=n[t]}function w(e,t){let n=new Uint8Array(32),r=new Float64Array(80),i=f(),a=f(),o=f(),s=f(),c=f(),l=f();for(let t=0;t<31;t++)n[t]=e[t];n[31]=e[31]&127|64,n[0]&=248,v(r,t);for(let e=0;e<16;e++)a[e]=r[e];i[0]=s[0]=1;for(let e=254;e>=0;--e){let t=n[e>>>3]>>>(e&7)&1;g(i,a,t),g(o,s,t),y(c,i,o),b(i,i,o),y(o,a,s),b(a,a,s),S(s,c),S(l,i),x(i,o,i),x(o,a,c),y(c,i,o),b(i,i,o),S(a,i),b(o,s,l),x(i,o,m),y(i,i,s),x(o,o,i),x(i,s,l),x(s,a,r),S(a,c),g(i,a,t),g(o,s,t)}for(let e=0;e<16;e++)r[e+16]=i[e],r[e+32]=o[e],r[e+48]=a[e],r[e+64]=s[e];let u=r.subarray(32),d=r.subarray(16);C(u,u),x(d,d,u);let p=new Uint8Array(32);return _(p,d),p}function T(e){return w(e,p)}function E(e){if(e.length!==32)throw Error(`x25519: seed must be 32 bytes`);let t=new Uint8Array(e);return{publicKey:T(t),secretKey:t}}function D(e){let t=d(32,e),n=E(t);return l(t),n}export{o as i,i as n,r,D as t};